fengming 0.3.9 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/build-info.json +2 -2
- package/dist/{bundled-channel-config-schema-DpdKMATU.d.ts → bundled-channel-config-schema-Bte--ZlY.d.ts} +26 -26
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/cli-startup-metadata.json +8 -8
- package/dist/control-ui/assets/{activity-B2W-IeAT.js → activity-D-mnRThU.js} +2 -2
- package/dist/control-ui/assets/{agents-mRUyNVCz.js → agents-U_KSP5I_.js} +2 -2
- package/dist/control-ui/assets/{channels-8QHOqBnt.js → channels-ohK9_G1O.js} +2 -2
- package/dist/control-ui/assets/{cron-H3unP_mO.js → cron-6ZCzfU29.js} +2 -2
- package/dist/control-ui/assets/{debug-CxLsQ9vH.js → debug-CSsDLg_s.js} +2 -2
- package/dist/control-ui/assets/{index-jtIYT0Eh.js → index-jUDczxhd.js} +4 -4
- package/dist/control-ui/assets/{instances-B1JQeCRb.js → instances-782ZoDT4.js} +2 -2
- package/dist/control-ui/assets/{nodes-RGOmq_1l.js → nodes-BMX16BKM.js} +2 -2
- package/dist/control-ui/assets/{sessions-C2O-Jgpg.js → sessions-jLGSApYa.js} +2 -2
- package/dist/control-ui/assets/{skills-jyJOYA4I.js → skills-DweBwUhs.js} +2 -2
- package/dist/control-ui/assets/{workboard-uM_kK8cQ.js → workboard-BsU-FXIo.js} +2 -2
- package/dist/control-ui/index.html +1 -1
- package/dist/control-ui/sw.js +1 -1
- package/dist/gateway/protocol/index.d.ts +1 -1
- package/dist/{index-DhOQs6M_.d.ts → index-AZzJCgph.d.ts} +45 -45
- package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
- package/dist/plugin-sdk/config-schema.d.ts +4 -4
- package/dist/{zod-schema.core-Cuz0lz6m.d.ts → zod-schema.core-BGLctDlK.d.ts} +1 -1
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./agents-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./agents-U_KSP5I_.js","./lit-runtime-DA0-mbwP.js","./markdown-runtime-C9Jq8Bu5.js","./rolldown-runtime-QTnfLwEv.js","./string-coerce-BuYUxt7q.js","./i18n-BWPaSddY.js","./channel-config-extras-GDGUjA2T.js","./skills-shared-lQxAuc7D.js","./activity-D-mnRThU.js","./channels-ohK9_G1O.js","./cron-6ZCzfU29.js","./debug-CSsDLg_s.js","./instances-782ZoDT4.js","./logs-atEFsTJJ.js","./nodes-BMX16BKM.js","./sessions-jLGSApYa.js","./skills-DweBwUhs.js","./workboard-BsU-FXIo.js","./push-subscription-CY8GxC_U.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{a as t,c as n,d as r,f as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,u as m}from"./lit-runtime-DA0-mbwP.js";import{a as h,i as g,n as _,r as v,t as y}from"./i18n-BWPaSddY.js";import{i as b,n as x,r as S,t as C}from"./gateway-runtime-CMyVbEq5.js";import{n as w,r as T,t as E}from"./string-coerce-BuYUxt7q.js";import{n as D,r as O,t as ee}from"./config-runtime-CCw2hptH.js";import{_ as k,a as te,c as A,d as j,f as M,g as N,h as P,i as F,l as ne,m as re,n as ie,o as ae,p as oe,r as se,s as ce,t as le,u as I,v as ue}from"./markdown-runtime-C9Jq8Bu5.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function de(e){if(typeof e==`string`)return e.trim()||void 0}function fe(e){if(!Array.isArray(e))return;let t=e.map(e=>de(e)).filter(e=>!!e);return t.length>0?t:void 0}var L={AUTH_REQUIRED:`AUTH_REQUIRED`,AUTH_UNAUTHORIZED:`AUTH_UNAUTHORIZED`,AUTH_TOKEN_MISSING:`AUTH_TOKEN_MISSING`,AUTH_TOKEN_MISMATCH:`AUTH_TOKEN_MISMATCH`,AUTH_TOKEN_NOT_CONFIGURED:`AUTH_TOKEN_NOT_CONFIGURED`,AUTH_PASSWORD_MISSING:`AUTH_PASSWORD_MISSING`,AUTH_PASSWORD_MISMATCH:`AUTH_PASSWORD_MISMATCH`,AUTH_PASSWORD_NOT_CONFIGURED:`AUTH_PASSWORD_NOT_CONFIGURED`,AUTH_BOOTSTRAP_TOKEN_INVALID:`AUTH_BOOTSTRAP_TOKEN_INVALID`,AUTH_DEVICE_TOKEN_MISMATCH:`AUTH_DEVICE_TOKEN_MISMATCH`,AUTH_SCOPE_MISMATCH:`AUTH_SCOPE_MISMATCH`,AUTH_RATE_LIMITED:`AUTH_RATE_LIMITED`,AUTH_TAILSCALE_IDENTITY_MISSING:`AUTH_TAILSCALE_IDENTITY_MISSING`,AUTH_TAILSCALE_PROXY_MISSING:`AUTH_TAILSCALE_PROXY_MISSING`,AUTH_TAILSCALE_WHOIS_FAILED:`AUTH_TAILSCALE_WHOIS_FAILED`,AUTH_TAILSCALE_IDENTITY_MISMATCH:`AUTH_TAILSCALE_IDENTITY_MISMATCH`,CONTROL_UI_ORIGIN_NOT_ALLOWED:`CONTROL_UI_ORIGIN_NOT_ALLOWED`,PROTOCOL_MISMATCH:`PROTOCOL_MISMATCH`,CONTROL_UI_DEVICE_IDENTITY_REQUIRED:`CONTROL_UI_DEVICE_IDENTITY_REQUIRED`,DEVICE_IDENTITY_REQUIRED:`DEVICE_IDENTITY_REQUIRED`,DEVICE_AUTH_INVALID:`DEVICE_AUTH_INVALID`,DEVICE_AUTH_DEVICE_ID_MISMATCH:`DEVICE_AUTH_DEVICE_ID_MISMATCH`,DEVICE_AUTH_SIGNATURE_EXPIRED:`DEVICE_AUTH_SIGNATURE_EXPIRED`,DEVICE_AUTH_NONCE_REQUIRED:`DEVICE_AUTH_NONCE_REQUIRED`,DEVICE_AUTH_NONCE_MISMATCH:`DEVICE_AUTH_NONCE_MISMATCH`,DEVICE_AUTH_SIGNATURE_INVALID:`DEVICE_AUTH_SIGNATURE_INVALID`,DEVICE_AUTH_PUBLIC_KEY_INVALID:`DEVICE_AUTH_PUBLIC_KEY_INVALID`,PAIRING_REQUIRED:`PAIRING_REQUIRED`,CLIENT_VERSION_MISMATCH:`CLIENT_VERSION_MISMATCH`},pe={NOT_PAIRED:`not-paired`,ROLE_UPGRADE:`role-upgrade`,SCOPE_UPGRADE:`scope-upgrade`,METADATA_UPGRADE:`metadata-upgrade`},me=new Set([`retry_with_device_token`,`update_auth_configuration`,`update_auth_credentials`,`wait_then_retry`,`review_auth_configuration`]),he=new Set([`not-paired`,`role-upgrade`,`scope-upgrade`,`metadata-upgrade`]),ge=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/,_e={"not-paired":{requirement:`device is not approved yet`,remediationHint:`Approve this device from the pending pairing requests.`,recoveryTitle:`Gateway pairing approval required.`},"role-upgrade":{requirement:`device is asking for a higher role than currently approved`,remediationHint:`Review the requested role upgrade, then approve the pending request.`,recoveryTitle:`Gateway role upgrade approval required.`},"scope-upgrade":{requirement:`device is asking for more scopes than currently approved`,remediationHint:`Review the requested scopes, then approve the pending upgrade.`,recoveryTitle:`Gateway scope upgrade approval required.`},"metadata-upgrade":{requirement:`device identity changed and must be re-approved`,remediationHint:`Review the refreshed device details, then approve the pending request.`,recoveryTitle:`Gateway device refresh approval required.`}},ve={"not-paired":`device pairing required`,"role-upgrade":`role upgrade pending approval`,"scope-upgrade":`scope upgrade pending approval`,"metadata-upgrade":`device metadata change pending approval`};function ye(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.code;return typeof t==`string`&&t.trim().length>0?t:null}function be(e){if(!e||typeof e!=`object`||Array.isArray(e))return{};let t=e,n=typeof t.canRetryWithDeviceToken==`boolean`?t.canRetryWithDeviceToken:void 0,r=de(t.recommendedNextStep)??``;return{canRetryWithDeviceToken:n,recommendedNextStep:me.has(r)?r:void 0}}function xe(e){let t=de(e)??``;return he.has(t)?t:void 0}function Se(e){let t=de(e);return t&&ge.test(t)?t:void 0}function Ce(e){return fe(e)}function we(e){return{code:L.PAIRING_REQUIRED,...e.reason?{reason:e.reason}:{},...e.requestId?{requestId:e.requestId}:{},...e.remediationHint?{remediationHint:e.remediationHint}:{},...e.recommendedNextStep?{recommendedNextStep:e.recommendedNextStep}:{},...e.retryable===void 0?{}:{retryable:e.retryable},...e.pauseReconnect===void 0?{}:{pauseReconnect:e.pauseReconnect},...e.deviceId?{deviceId:e.deviceId}:{},...e.requestedRole?{requestedRole:e.requestedRole}:{},...e.requestedScopes?{requestedScopes:e.requestedScopes}:{},...e.approvedRoles?{approvedRoles:e.approvedRoles}:{},...e.approvedScopes?{approvedScopes:e.approvedScopes}:{}}}function Te(e){return e?_e[e].requirement:`device approval is required`}function Ee(e){return e?_e[e].remediationHint:`Approve the pending device request before retrying.`}function De(e){if(ye(e)!==L.PAIRING_REQUIRED||!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=xe(t.reason),r=Se(t.requestId),i=de(t.remediationHint)??Ee(n),a=de(t.recommendedNextStep)??``,o=me.has(a)?a:void 0,s=de(t.deviceId),c=de(t.requestedRole),l=Ce(t.requestedScopes),u=Ce(t.approvedRoles),d=Ce(t.approvedScopes);return we({reason:n,requestId:r,remediationHint:i,recommendedNextStep:o,retryable:typeof t.retryable==`boolean`?t.retryable:void 0,pauseReconnect:typeof t.pauseReconnect==`boolean`?t.pauseReconnect:void 0,deviceId:s,requestedRole:c,requestedScopes:l,approvedRoles:u,approvedScopes:d})}function Oe(e){let t=de(e);if(!t)return null;let n=t.trim().toLowerCase(),r;for(let[e,t]of Object.entries(ve))if(n.includes(t)){r=e;break}if(!r&&n.includes(`pairing required`)&&(r=pe.NOT_PAIRED),!r)return null;let i=Se(t.match(/\(requestId:\s*([^\s)]+)\)/i)?.[1]);return{...i?{requestId:i}:{},reason:r}}function ke(e){let t=De(e),n=ve[t?.reason??pe.NOT_PAIRED];return t?.requestId?`${n} (requestId: ${t.requestId})`:n}function Ae(e){return ye(e.details)===L.PAIRING_REQUIRED?ke(e.details):ye(e.details)===L.PROTOCOL_MISMATCH?je(e.message,e.details):de(e.message)??`gateway request failed`}function je(e,t){let n=t,r=Me(n.clientMinProtocol),i=Me(n.clientMaxProtocol),a=Me(n.expectedProtocol),o=Me(n.minimumProbeProtocol),s=[];r!==void 0&&i!==void 0&&s.push(r===i?`Control UI v${r}`:`Control UI v${r}-v${i}`),a!==void 0&&s.push(`Gateway v${a}`),o!==void 0&&s.push(`probe min v${o}`);let c=de(e)??`protocol mismatch`;return s.length>0?`${c}: ${s.join(`, `)}`:c}function Me(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:void 0}var Ne={WEBCHAT_UI:`webchat-ui`,CONTROL_UI:`fengming-control-ui`,TUI:`fengming-tui`,WEBCHAT:`webchat`,CLI:`cli`,GATEWAY_CLIENT:`gateway-client`,MACOS_APP:`fengming-macos`,IOS_APP:`fengming-ios`,ANDROID_APP:`fengming-android`,NODE_HOST:`node-host`,TEST:`test`,FINGERPRINT:`fingerprint`,PROBE:`fengming-probe`},Pe=Ne,Fe={WEBCHAT:`webchat`,CLI:`cli`,UI:`ui`,BACKEND:`backend`,NODE:`node`,PROBE:`probe`,TEST:`test`};new Set(Object.values(Ne)),new Set(Object.values(Fe));var Ie=100,Le=2e3;function Re(e){return typeof e==`object`&&!!e&&e.reason===`startup-sidecars`}function ze(e){if(!e||typeof e!=`object`)return!1;let t=e;return(t.gatewayCode??t.code)===`UNAVAILABLE`&&t.retryable===!0&&Re(t.details)}function Be(e){if(!ze(e))return null;let t=e.retryAfterMs;return Math.min(Math.max(Math.floor(typeof t==`number`&&Number.isFinite(t)?t:500),Ie),Le)}function Ve(e){let t=e.scopes.join(`,`),n=e.token??``;return[`v2`,e.deviceId,e.clientId,e.clientMode,e.role,t,String(e.signedAtMs),n,e.nonce].join(`|`)}function He(e){return e.trim()}function Ue(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();e&&t.add(e)}return t.has(`operator.admin`)?(t.add(`operator.read`),t.add(`operator.write`)):t.has(`operator.write`)&&t.add(`operator.read`),[...t].toSorted()}function We(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ge(e){return We(e)?e:void 0}function Ke(e){return e&&typeof e==`object`?e:void 0}function qe(e,t){if(!We(t)||typeof t.token!=`string`)return null;let n=typeof t.updatedAtMs==`number`&&Number.isFinite(t.updatedAtMs)?t.updatedAtMs:0;return{token:t.token,role:e,scopes:Ue(Array.isArray(t.scopes)?t.scopes:void 0),updatedAtMs:n}}function Je(e){let t={};for(let[n,r]of Object.entries(e)){let e=He(n);if(!e)continue;let i=qe(e,r);i&&(t[e]=i)}return t}function Ye(e){let t=e.adapter.readStore();if(!t||t.deviceId!==e.deviceId)return null;let n=He(e.role);return qe(n,t.tokens[n])}function Xe(e){let t=He(e.role),n=e.adapter.readStore(),r={version:1,deviceId:e.deviceId,tokens:n&&n.deviceId===e.deviceId&&n.tokens?Je(n.tokens):{}},i={token:e.token,role:t,scopes:Ue(e.scopes),updatedAtMs:Date.now()};return r.tokens[t]=i,e.adapter.writeStore(r),i}function Ze(e){let t=e.adapter.readStore();if(!t||t.deviceId!==e.deviceId)return;let n=He(e.role);if(!t.tokens[n])return;let r={version:1,deviceId:t.deviceId,tokens:Je(t.tokens)};delete r.tokens[n],e.adapter.writeStore(r)}function Qe(e){return!!e&&typeof e.getItem==`function`&&typeof e.setItem==`function`}function $e(e){let t=Object.getOwnPropertyDescriptor(globalThis,e);if(typeof process<`u`&&{}.VITEST)return t&&!t.get&&Qe(t.value)?t.value:null;if(typeof window<`u`&&typeof document<`u`)try{let t=window[e];return Qe(t)?t:null}catch{return null}return t&&!t.get&&Qe(t.value)?t.value:null}function et(){return $e(`localStorage`)}function tt(){return $e(`sessionStorage`)}var nt=`fengming.device.auth.v1`;function rt(){try{let e=et()?.getItem(nt);if(!e)return null;let t=JSON.parse(e);return!t||t.version!==1||!t.deviceId||typeof t.deviceId!=`string`||!t.tokens||typeof t.tokens!=`object`?null:t}catch{return null}}function it(e){try{et()?.setItem(nt,JSON.stringify(e))}catch{}}function at(e){return Ye({adapter:{readStore:rt,writeStore:it},deviceId:e.deviceId,role:e.role})}function ot(e){return Xe({adapter:{readStore:rt,writeStore:it},deviceId:e.deviceId,role:e.role,token:e.token,scopes:e.scopes})}function st(e){Ze({adapter:{readStore:rt,writeStore:it},deviceId:e.deviceId,role:e.role})}var ct=`fengming-device-identity-v1`;function lt(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``)}function ut(e){let t=e.replaceAll(`-`,`+`).replaceAll(`_`,`/`),n=t+`=`.repeat((4-t.length%4)%4),r=atob(n),i=new Uint8Array(r.length);for(let e=0;e<r.length;e+=1)i[e]=r.charCodeAt(e);return i}function dt(e){return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function ft(e){let t=await crypto.subtle.digest(`SHA-256`,e.slice().buffer);return dt(new Uint8Array(t))}async function pt(){let e=b.randomSecretKey(),t=await x(e);return{deviceId:await ft(t),publicKey:lt(t),privateKey:lt(e)}}async function mt(){let e=et();try{let t=e?.getItem(ct);if(t){let n=JSON.parse(t);if(n?.version===1&&typeof n.deviceId==`string`&&typeof n.publicKey==`string`&&typeof n.privateKey==`string`){let t=await ft(ut(n.publicKey));if(t!==n.deviceId){let r={...n,deviceId:t};return e?.setItem(ct,JSON.stringify(r)),{deviceId:t,publicKey:n.publicKey,privateKey:n.privateKey}}return{deviceId:n.deviceId,publicKey:n.publicKey,privateKey:n.privateKey}}}}catch{}let t=await pt(),n={version:1,deviceId:t.deviceId,publicKey:t.publicKey,privateKey:t.privateKey,createdAtMs:Date.now()};return e?.setItem(ct,JSON.stringify(n)),t}async function ht(e,t){let n=ut(e);return lt(await S(new TextEncoder().encode(t),n))}var gt=!1;function _t(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=``;for(let n=0;n<e.length;n++)t+=e[n].toString(16).padStart(2,`0`);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function vt(){gt||(gt=!0,console.warn(`[uuid] crypto API missing; refusing insecure UUID generation`))}function yt(e=globalThis.crypto){if(e&&typeof e.randomUUID==`function`)return e.randomUUID();if(e&&typeof e.getRandomValues==`function`){let t=new Uint8Array(16);return e.getRandomValues(t),_t(t)}throw vt(),Error(`Web Crypto is required for UUID generation`)}var bt=class extends Error{constructor(e){super(Ae({message:e.message,details:xt(e.message,e.details)})),this.name=`GatewayRequestError`,this.gatewayCode=e.code,this.details=e.details,this.retryable=e.retryable===!0,this.retryAfterMs=e.retryAfterMs}};function xt(e,t){return ye(t)===L.PROTOCOL_MISMATCH||!e?.toLowerCase().includes(`protocol mismatch`)?t:{code:L.PROTOCOL_MISMATCH,clientMinProtocol:4,clientMaxProtocol:4,...t&&typeof t==`object`&&!Array.isArray(t)?t:{}}}function St(e){return ye(e?.details)}function Ct(e){let t=De(e);return t?.pauseReconnect===!1||t?.recommendedNextStep===`wait_then_retry`}function wt(e){if(!e)return!1;let t=St(e);return t===L.PAIRING_REQUIRED&&Ct(e.details)?!1:t===L.AUTH_TOKEN_MISSING||t===L.AUTH_BOOTSTRAP_TOKEN_INVALID||t===L.AUTH_PASSWORD_MISSING||t===L.AUTH_PASSWORD_MISMATCH||t===L.AUTH_RATE_LIMITED||t===L.AUTH_DEVICE_TOKEN_MISMATCH||t===L.AUTH_SCOPE_MISMATCH||t===L.PAIRING_REQUIRED||t===L.CONTROL_UI_DEVICE_IDENTITY_REQUIRED||t===L.DEVICE_IDENTITY_REQUIRED}function Tt(e){let t=e.split(`.`);return t.length!==4||t[0]!==`127`?!1:t.every(e=>{if(!/^\d+$/.test(e))return!1;let t=Number(e);return t>=0&&t<=255})}function Et(e){try{let t=new URL(e,window.location.href),n=t.hostname.trim().toLowerCase(),r=n===`localhost`||n===`::1`||n===`[::1]`,i=Tt(n);if(r||i)return!0;let a=new URL(window.location.href);return t.host===a.host}catch{return!1}}var Dt=`operator`,Ot=[`operator.admin`,`operator.read`,`operator.write`,`operator.approvals`,`operator.pairing`],kt=4008,At=4013,jt=1006,Mt=`BROWSER_WEBSOCKET_CONSTRUCTOR_ERROR`,Nt=`BROWSER_WEBSOCKET_SECURITY_ERROR`;function Pt(e){let t=e.authToken;if(t||e.authPassword)return{token:t,deviceToken:e.authDeviceToken??e.resolvedDeviceToken,password:e.authPassword}}function Ft(e){return e instanceof Error&&e.message?e.message:String(e)}function It(e){if(e instanceof Error&&e.name)return e.name;if(e&&typeof e==`object`&&`name`in e){let t=e.name;return typeof t==`string`&&t.trim()?t:void 0}}function Lt(e){let t=It(e)?.toLowerCase(),n=Ft(e).toLowerCase();return t===`securityerror`||n.includes(`security error`)||n.includes(`mixed content`)||n.includes(`insecure websocket`)}function Rt(e,t){let n=Lt(e),r=Ft(e),i=t.trim().toLowerCase().startsWith(`ws://`);return n?{code:Nt,message:`Browser refused the Gateway WebSocket for security reasons.`+(i?` Use wss:// when the Control UI is served over HTTPS/Tailscale Serve, or open the loopback dashboard at http://127.0.0.1:18789.`:` Check the Gateway WebSocket URL and browser security policy.`),details:{code:Nt,browserErrorName:It(e),browserMessage:r}}:{code:Mt,message:`Could not create the Gateway WebSocket: ${r}`,details:{code:Mt,browserErrorName:It(e),browserMessage:r}}}function zt(e){return e.storedToken&&(e.resolvedDeviceToken===e.storedToken||e.authDeviceToken===e.storedToken)&&e.storedScopes&&e.storedScopes.length>0?[...e.storedScopes]:[...Ot]}async function Bt(e){let{deviceIdentity:t}=e;if(!t)return;let n=Date.now(),r=e.connectNonce??``,i=Ve({deviceId:t.deviceId,clientId:e.client.id,clientMode:e.client.mode,role:e.role,scopes:e.scopes,signedAtMs:n,token:e.authToken??null,nonce:r}),a=await ht(t.privateKey,i);return{id:t.deviceId,publicKey:t.publicKey,signature:a,signedAt:n,nonce:r}}function Vt(e){return!e.deviceTokenRetryBudgetUsed&&!e.authDeviceToken&&!!e.explicitGatewayToken&&!!e.deviceIdentity&&!!e.storedToken&&e.canRetryWithDeviceTokenHint&&Et(e.url)}var Ht=class{constructor(e){this.opts=e,this.ws=null,this.pending=new Map,this.closed=!1,this.lastSeq=null,this.connectNonce=null,this.connectSent=!1,this.connectTimer=null,this.connectGeneration=0,this.backoffMs=800,this.pendingDeviceTokenRetry=!1,this.deviceTokenRetryBudgetUsed=!1,this.pendingStartupReconnectDelayMs=null,this.eventListeners=new Set}start(){this.closed=!1,this.connect()}stop(){this.closed=!0,this.clearConnectTimer(),this.ws?.close(),this.ws=null,this.pendingConnectError=void 0,this.pendingDeviceTokenRetry=!1,this.deviceTokenRetryBudgetUsed=!1,this.pendingStartupReconnectDelayMs=null,this.flushPending(Error(`网关客户端已停止`))}get connected(){return this.ws?.readyState===WebSocket.OPEN}connect(){if(this.closed)return;let e;try{e=new WebSocket(this.opts.url)}catch(e){let t=Rt(e,this.opts.url);this.ws=null,this.pendingConnectError=void 0,this.pendingDeviceTokenRetry=!1,this.pendingStartupReconnectDelayMs=null,this.flushPending(Error(t.message)),this.opts.onClose?.({code:jt,reason:t.code===Nt?`security error`:`websocket error`,error:t});return}let t=++this.connectGeneration;this.ws=e,e.addEventListener(`open`,()=>this.queueConnect(e,t)),e.addEventListener(`message`,n=>{this.isActiveSocket(e,t)&&this.handleMessage(e,t,String(n.data??``))}),e.addEventListener(`close`,t=>{if(this.ws!==e)return;let n=t.reason??``,r=this.pendingConnectError;if(this.pendingConnectError=void 0,this.ws=null,this.pendingStartupReconnectDelayMs!==null){this.flushPending(Error(`gateway closed (${t.code}): ${n}`)),this.scheduleReconnect();return}if(this.flushPending(Error(`gateway closed (${t.code}): ${n}`)),this.opts.onClose?.({code:t.code,reason:n,error:r}),St(r)===L.AUTH_TOKEN_MISMATCH){this.pendingDeviceTokenRetry&&this.scheduleReconnect();return}wt(r)||this.scheduleReconnect()}),e.addEventListener(`error`,()=>{})}scheduleReconnect(){if(this.closed)return;let e=this.pendingStartupReconnectDelayMs;this.pendingStartupReconnectDelayMs=null;let t=e??this.backoffMs;e===null&&(this.backoffMs=Math.min(this.backoffMs*1.7,15e3)),this.clearConnectTimer(),this.connectTimer=window.setTimeout(()=>{this.connectTimer=null,this.connect()},t)}flushPending(e){for(let[t,n]of this.pending)this.emitRequestTiming(t,n,!1,`CLIENT_CLOSED`),n.reject(e);this.pending.clear()}nowMs(){return typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()}emitRequestTiming(e,t,n,r){let i=this.nowMs();try{this.opts.onRequestTiming?.({id:e,method:t.method,ok:n,durationMs:Math.max(0,i-t.startedAtMs),startedAtMs:t.startedAtMs,endedAtMs:i,errorCode:r})}catch(e){console.error(`[gateway] request timing handler error:`,e)}}buildConnectClient(){return{id:this.opts.clientName??Pe.CONTROL_UI,version:this.opts.clientVersion??`control-ui`,platform:this.opts.platform??navigator.platform??`web`,mode:this.opts.mode??Fe.WEBCHAT,instanceId:this.opts.instanceId}}buildConnectParams(e){return{minProtocol:4,maxProtocol:4,client:e.client,role:e.role,scopes:e.scopes,device:e.device,caps:[`tool-events`],auth:e.auth,userAgent:navigator.userAgent,locale:navigator.language}}async buildConnectPlan(e){let t=Dt,n=this.buildConnectClient(),r=this.opts.token?.trim()||void 0,i=this.opts.password?.trim()||void 0,a=typeof crypto<`u`&&!!crypto.subtle,o=null,s={authToken:r,authPassword:i,canFallbackToShared:!1};a&&(o=await mt(),s=this.selectConnectAuth({role:t,deviceId:o.deviceId}));let c=zt(s);return{role:t,scopes:c,client:n,explicitGatewayToken:r,selectedAuth:s,auth:Pt(s),deviceIdentity:o,device:await Bt({deviceIdentity:o,client:n,role:t,scopes:c,authToken:s.authToken,connectNonce:e})}}handleConnectHello(e,t,n,r){this.isActiveSocket(n,r)&&(this.pendingDeviceTokenRetry=!1,this.deviceTokenRetryBudgetUsed=!1,this.pendingStartupReconnectDelayMs=null,e?.auth?.deviceToken&&t.deviceIdentity&&ot({deviceId:t.deviceIdentity.deviceId,role:e.auth.role??t.role,token:e.auth.deviceToken,scopes:e.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(e))}handleConnectFailure(e,t,n,r){if(!this.isActiveSocket(n,r))return;let i=e instanceof bt?St(e):null,a=e instanceof bt?be(e.details):{},o=a.recommendedNextStep===`retry_with_device_token`,s=a.canRetryWithDeviceToken===!0||o||i===L.AUTH_TOKEN_MISMATCH;Vt({deviceTokenRetryBudgetUsed:this.deviceTokenRetryBudgetUsed,authDeviceToken:t.selectedAuth.authDeviceToken,explicitGatewayToken:t.explicitGatewayToken,deviceIdentity:t.deviceIdentity,storedToken:t.selectedAuth.storedToken,canRetryWithDeviceTokenHint:s,url:this.opts.url})&&(this.pendingDeviceTokenRetry=!0,this.deviceTokenRetryBudgetUsed=!0),e instanceof bt?this.pendingConnectError={code:e.gatewayCode,message:e.message,details:e.details,retryable:e.retryable,retryAfterMs:e.retryAfterMs}:this.pendingConnectError=void 0,t.selectedAuth.storedToken&&(t.selectedAuth.resolvedDeviceToken===t.selectedAuth.storedToken||t.selectedAuth.authDeviceToken===t.selectedAuth.storedToken)&&t.deviceIdentity&&i===L.AUTH_DEVICE_TOKEN_MISMATCH&&st({deviceId:t.deviceIdentity.deviceId,role:t.role});let c=Be(e);if(c!==null&&(this.pendingStartupReconnectDelayMs=c),ze(e)){n.close(At,`gateway starting`);return}n.close(kt,`connect failed`)}isActiveSocket(e,t){return!this.closed&&this.ws===e&&this.connectGeneration===t}async sendConnect(e,t){if(!this.isActiveSocket(e,t)||e.readyState!==WebSocket.OPEN||this.connectSent)return;this.connectSent=!0,this.clearConnectTimer();let n=await this.buildConnectPlan(this.connectNonce);!this.isActiveSocket(e,t)||e.readyState!==WebSocket.OPEN||(this.pendingDeviceTokenRetry&&n.selectedAuth.authDeviceToken&&(this.pendingDeviceTokenRetry=!1),this.requestOnSocket(e,`connect`,this.buildConnectParams(n)).then(r=>this.handleConnectHello(r,n,e,t)).catch(r=>this.handleConnectFailure(r,n,e,t)))}handleMessage(e,t,n){let r;try{r=JSON.parse(n)}catch{return}let i=r;if(i.type===`event`){let n=r;if(n.event===`connect.challenge`){let r=n.payload,i=r&&typeof r.nonce==`string`?r.nonce:null;i&&(this.connectNonce=i,this.sendConnect(e,t));return}let i=typeof n.seq==`number`?n.seq:null;i!==null&&(this.lastSeq!==null&&i>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:i}),this.lastSeq=i);try{this.opts.onEvent?.(n);for(let e of this.eventListeners)e(n)}catch(e){console.error(`[gateway] event handler error:`,e)}return}if(i.type===`res`){let e=r,t=this.pending.get(e.id);if(!t)return;this.pending.delete(e.id),e.ok?(this.emitRequestTiming(e.id,t,!0),t.resolve(e.payload)):(this.emitRequestTiming(e.id,t,!1,e.error?.code),t.reject(new bt({code:e.error?.code??`UNAVAILABLE`,message:e.error?.message??`request failed`,details:e.error?.details,retryable:e.error?.retryable,retryAfterMs:e.error?.retryAfterMs})));return}}selectConnectAuth(e){let t=this.opts.token?.trim()||void 0,n=this.opts.password?.trim()||void 0,r=at({deviceId:e.deviceId,role:e.role}),i=r?.scopes??[],a=e.role!==Dt||i.includes(`operator.read`)||i.includes(`operator.write`)||i.includes(`operator.admin`)?r?.token:void 0,o=this.pendingDeviceTokenRetry&&!!t&&!!a&&Et(this.opts.url),s=t||n?void 0:a??void 0;return{authToken:t??s,authDeviceToken:o?a??void 0:void 0,authPassword:n,resolvedDeviceToken:s,storedToken:a??void 0,storedScopes:r?.scopes??void 0,canFallbackToShared:!!(a&&t)}}request(e,t){return!this.ws||this.ws.readyState!==WebSocket.OPEN?Promise.reject(Error(`网关未连接`)):this.requestOnSocket(this.ws,e,t)}requestOnSocket(e,t,n){if(this.ws!==e||e.readyState!==WebSocket.OPEN)return Promise.reject(Error(`网关未连接`));let r=yt(),i={type:`req`,id:r,method:t,params:n},a=this.nowMs(),o=new Promise((e,n)=>{this.pending.set(r,{resolve:t=>e(t),reject:n,method:t,startedAtMs:a})});return e.send(JSON.stringify(i)),o}addEventListener(e){return this.eventListeners.add(e),()=>{this.eventListeners.delete(e)}}queueConnect(e,t){this.isActiveSocket(e,t)&&(this.connectNonce=null,this.connectSent=!1,this.clearConnectTimer(),this.connectTimer=window.setTimeout(()=>{this.connectTimer=null,this.sendConnect(e,t)},750))}clearConnectTimer(){this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null)}};function Ut(e){return e instanceof bt?St(e)===L.AUTH_UNAUTHORIZED?!0:e.message.includes(`missing scope: operator.read`):!1}function Wt(e){return`This connection is missing operator.read, so ${e} cannot be loaded yet.`}function Gt(e){return new Promise(t=>setTimeout(()=>t(`timeout`),e))}async function Kt(e,t,n={}){if(!e.client||!e.connected||e.channelsLoading&&(!e.channelsLoadingProbe||t))return;let r=(e.channelsRefreshSeq??0)+1;e.channelsRefreshSeq=r,e.channelsLoading=!0,e.channelsLoadingProbe=t,e.channelsError=null;let i=(async()=>{try{let n=await e.client.request(`channels.status`,{probe:t,timeoutMs:8e3});if(e.channelsRefreshSeq!==r)return;e.channelsSnapshot=n,e.channelsLastSuccess=Date.now()}catch(t){if(e.channelsRefreshSeq!==r)return;Ut(t)?(e.channelsSnapshot=null,e.channelsError=Wt(`channel status`)):e.channelsError=String(t)}finally{e.channelsRefreshSeq===r&&(e.channelsLoading=!1,e.channelsLoadingProbe=null)}})(),a=n.softTimeoutMs;if(typeof a==`number`&&a>0)return await Promise.race([i.then(()=>`done`),Gt(a)]),void 0;await i}function qt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.prototype.toString.call(e)===`[object Object]`}var Jt=new Set([`__proto__`,`prototype`,`constructor`]);function Yt(e){return Jt.has(e)}function Xt(e){return qt(e)?typeof e.id==`string`&&e.id.length>0:!1}function Zt(e,t,n){if(!e.every(Xt))return;let r=[...e],i=new Map;for(let[e,t]of r.entries()){if(!Xt(t))return;i.set(t.id,e)}for(let e of t){if(!Xt(e)){r.push(structuredClone(e));continue}let t=i.get(e.id);if(t===void 0){r.push(structuredClone(e)),i.set(e.id,r.length-1);continue}r[t]=Qt(r[t],e,n)}return r}function Qt(e,t,n={}){if(!qt(t))return t;let r=qt(e)?{...e}:{};for(let[e,i]of Object.entries(t))if(!Yt(e)){if(i===null){delete r[e];continue}if(n.mergeObjectArraysById&&Array.isArray(r[e])&&Array.isArray(i)){let t=Zt(r[e],i,n);if(t){r[e]=t;continue}}if(qt(i)){let t=r[e];r[e]=Qt(qt(t)?t:{},i,n);continue}r[e]=i}return r}function $t(e){return(e??[]).map(e=>T(String(e))??``).filter(Boolean)}function en(e){return[...new Set(e)]}function tn(e){return en(e)}function nn(e){return tn(e).toSorted((e,t)=>e<t?-1:+(e>t))}function rn(e){if(e)return Array.isArray(e.type)?e.type.find(e=>e!==`null`)??e.type[0]:e.type}function an(e){if(!e)return``;if(e.default!==void 0)return e.default;switch(rn(e)){case`object`:return{};case`array`:return[];case`boolean`:return!1;case`number`:case`integer`:return 0;case`string`:return``;default:return``}}function on(e){return e.filter(e=>typeof e==`string`).join(`.`)}function sn(e,t){let n=t[on(e)];if(n)return n;let r=e.map(String);for(let[e,n]of Object.entries(t)){if(!e.includes(`*`))continue;let t=e.split(`.`);if(t.length!==r.length)continue;let i=!0;for(let e=0;e<r.length;e+=1)if(t[e]!==`*`&&t[e]!==r[e]){i=!1;break}if(i)return n}}function cn(e){return e.replace(/_/g,` `).replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/\s+/g,` `).replace(/^./,e=>e.toUpperCase())}var ln=[`maxtokens`,`maxoutputtokens`,`maxinputtokens`,`maxcompletiontokens`,`contexttokens`,`totaltokens`,`tokencount`,`tokenlimit`,`tokenbudget`,`passwordfile`],un=[/token$/i,/password/i,/secret/i,/api.?key/i,/serviceaccount(?:ref)?$/i],dn=/^\$\{[^}]*\}$/,fn=`[redacted - click reveal to view]`,pn=64,mn=2e4;function hn(){return{visited:0}}function gn(e,t){return!(t>pn||(e.visited+=1,e.visited>mn))}function _n(e){return dn.test(e.trim())}function vn(e){let t=E(e);return!ln.some(e=>t.endsWith(e))&&un.some(t=>t.test(e))}function yn(e){return typeof e==`string`?e.trim().length>0&&!_n(e):e!=null}function bn(e){return e?.sensitive??!1}function xn(e,t,n){return Sn(e,t,n,hn(),0)}function Sn(e,t,n,r,i){if(!gn(r,i))return!0;let a=on(t);return(bn(sn(t,n))||vn(a))&&yn(e)?!0:Array.isArray(e)?e.some((e,a)=>Sn(e,[...t,a],n,r,i+1)):e&&typeof e==`object`?Object.entries(e).some(([e,a])=>Sn(a,[...t,e],n,r,i+1)):!1}function Cn(e,t,n){return wn(e,t,n,hn(),0)}function wn(e,t,n,r,i){if(!gn(r,i))return 1;if(e==null)return 0;let a=on(t);return(bn(sn(t,n))||vn(a))&&yn(e)?1:Array.isArray(e)?e.reduce((e,a,o)=>e+wn(a,[...t,o],n,r,i+1),0):e&&typeof e==`object`?Object.entries(e).reduce((e,[a,o])=>e+wn(o,[...t,a],n,r,i+1),0):0}function Tn(e,t){let n=e.trim();if(n===``)return;let r=Number(n);return!Number.isFinite(r)||t&&!Number.isInteger(r)?e:r}function En(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:e}function Dn(e,t){if(e==null)return e;if(t.allOf&&t.allOf.length>0){let n=e;for(let e of t.allOf)n=Dn(n,e);return n}let n=rn(t);if(t.anyOf||t.oneOf){let n=(t.anyOf??t.oneOf??[]).filter(e=>!(e.type===`null`||Array.isArray(e.type)&&e.type.includes(`null`)));if(n.length===1)return Dn(e,n[0]);if(typeof e==`string`)for(let t of n){let n=rn(t);if(n===`number`||n===`integer`){let t=Tn(e,n===`integer`);if(t===void 0||typeof t==`number`)return t}if(n===`boolean`){let t=En(e);if(typeof t==`boolean`)return t}}for(let t of n){let n=rn(t);if(n===`object`&&typeof e==`object`&&!Array.isArray(e)||n===`array`&&Array.isArray(e))return Dn(e,t)}return e}if(n===`number`||n===`integer`){if(typeof e==`string`){let t=Tn(e,n===`integer`);if(t===void 0||typeof t==`number`)return t}return e}if(n===`boolean`){if(typeof e==`string`){let t=En(e);if(typeof t==`boolean`)return t}return e}if(n===`string`)return typeof e==`string`&&e.length===0&&t.minLength?void 0:e;if(n===`object`){if(typeof e!=`object`||Array.isArray(e))return e;let n=e,r=t.properties??{},i=t.additionalProperties&&typeof t.additionalProperties==`object`?t.additionalProperties:null,a={};for(let[e,t]of Object.entries(n)){let n=r[e]??i,o=n?Dn(t,n):t;o!==void 0&&(a[e]=o)}return a}if(n===`array`){if(!Array.isArray(e))return e;if(Array.isArray(t.items)){let n=t.items;return e.map((e,t)=>{let r=t<n.length?n[t]:void 0;return r?Dn(e,r):e})}let n=t.items;return n?e.map(e=>Dn(e,n)).filter(e=>e!==void 0):e}return e}function On(e){return structuredClone(e)}function kn(e){return`${JSON.stringify(e,null,2).trimEnd()}\n`}var An=`__FENGMING_REDACTED__`,jn={omitted:!0};function Mn(e){return{omitted:!1,value:e}}function Nn(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function Pn(e,t){return e!=null&&Object.prototype.hasOwnProperty.call(e,t)}function Fn(e){if(e.value===An)return e.originalFormValue!==An||e.originalRawPathExists?Mn(e.value):e.canOmit?jn:Mn(e.value);if(Array.isArray(e.value)){let t=Array.isArray(e.originalFormValue)?e.originalFormValue:[],n=Array.isArray(e.originalRawValue)?e.originalRawValue:[];return Mn(e.value.map((e,r)=>{let i=Fn({value:e,originalFormValue:t[r],originalRawValue:n[r],originalRawPathExists:r in n,canOmit:!1});return i.omitted?e:i.value}))}if(!Nn(e.value))return Mn(e.value);let t=Nn(e.originalFormValue)?e.originalFormValue:null,n=Nn(e.originalRawValue)?e.originalRawValue:null,r={};for(let[i,a]of Object.entries(e.value)){let e=t!=null&&Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0,o=Pn(n,i),s=Fn({value:a,originalFormValue:e,originalRawValue:o?n?.[i]:void 0,originalRawPathExists:o,canOmit:!0});s.omitted||(r[i]=s.value)}return e.canOmit&&Object.keys(r).length===0&&!e.originalRawPathExists?jn:Mn(r)}function In(e,t,n){if(!t||!n)return e;let r;try{r=O.parse(n)}catch{return e}if(!Nn(r))return e;let i=Fn({value:e,originalFormValue:t,originalRawValue:r,originalRawPathExists:!0,canOmit:!1});return!i.omitted&&Nn(i.value)?i.value:e}var Ln=new Set([`__proto__`,`prototype`,`constructor`]);function Rn(e){return typeof e==`string`&&Ln.has(e)}function zn(e,t,n){if(t.length===0||t.some(Rn))return null;let r=e;for(let e=0;e<t.length-1;e+=1){let i=t[e],a=t[e+1];if(typeof i==`number`){if(!Array.isArray(r))return null;if(r[i]==null){if(!n)return null;r[i]=typeof a==`number`?[]:{}}r=r[i];continue}if(typeof r!=`object`||!r)return null;let o=r;if(o[i]==null){if(!n)return null;o[i]=typeof a==`number`?[]:{}}r=o[i]}return{current:r,lastKey:t[t.length-1]}}function Bn(e,t,n){let r=zn(e,t,!0);if(r){if(typeof r.lastKey==`number`){Array.isArray(r.current)&&(r.current[r.lastKey]=n);return}typeof r.current==`object`&&r.current!=null&&(r.current[r.lastKey]=n)}}function Vn(e,t){let n=zn(e,t,!1);if(n){if(typeof n.lastKey==`number`){Array.isArray(n.current)&&n.current.splice(n.lastKey,1);return}typeof n.current==`object`&&n.current!=null&&delete n.current[n.lastKey]}}var Hn=new WeakMap;async function Un(e,t={}){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{Jn(e,await e.client.request(`config.get`,{}),t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function Wn(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{Gn(e,await e.client.request(`config.schema`,{}))}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function Gn(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function Kn(e){return!e||typeof e!=`object`||Array.isArray(e)?null:e}function qn(e){return Kn(e?.sourceConfig)??Kn(e?.resolved)??Kn(e?.config)}function Jn(e,t,n={}){let r=e.configFormDirty&&n.discardPendingChanges!==!0,i=e.configDraftBaseHash??e.configSnapshot?.hash??null;e.configSnapshot=t;let a=qn(t);!(typeof t.raw==`string`||a||e.configForm)&&e.configFormMode===`raw`&&(e.configFormMode=`form`);let o=typeof t.raw==`string`?t.raw:a?kn(a):e.configRaw;r?e.configFormMode!==`raw`&&e.configForm?e.configRaw=kn(e.configForm):e.configFormMode!==`raw`&&(e.configRaw=o):e.configRaw=o,e.configValid=typeof t.valid==`boolean`?t.valid:null,e.configIssues=Array.isArray(t.issues)?t.issues:[],r?e.configDraftBaseHash=i:(e.configForm=On(a??{}),e.configFormOriginal=On(a??{}),e.configRawOriginal=o,e.configFormDirty=!1,e.configDraftBaseHash=t.hash??null,Hn.delete(e))}function Yn(e){return!e||typeof e!=`object`||Array.isArray(e)?null:e}function Xn(e){if(e.configFormMode!==`form`||!e.configForm)return e.configRaw;let t=Yn(e.configSchema);return kn(In(t?Dn(e.configForm,t):e.configForm,e.configFormOriginal,e.configRawOriginal))}function Zn(e){let t=(e.status??`error`).trim()||`error`,n=(e.reason??`unexpected-error`).trim()||`unexpected-error`;return{tone:t===`skipped`?`warn`:`danger`,text:`Update ${t}: ${n}. ${{dirty:`Commit or stash changes, then retry.`,"no-upstream":`Set an upstream branch, then retry.`,"not-git-install":"Not a git checkout. Run `fengming update` from the CLI for a global reinstall.","not-fengming-root":`Run the update from an FengMing checkout or use the CLI global reinstall path.`,"deps-install-failed":`Dependency install failed. Fix the install error and retry.`,"build-failed":`Build failed. Fix the build error and retry.`,"ui-build-failed":`The control UI rebuild failed. Fix the UI build error and retry.`,"global-install-failed":`The global package install did not verify on disk. Retry or reinstall from the CLI.`,"restart-disabled":"The update was not applied because gateway restarts are disabled. Enable restarts in config, then retry — or run `fengming update` from the CLI.","restart-unavailable":`This global install cannot be safely replaced while restarts are disabled and no supervisor is present.`,"restart-unhealthy":`The replacement process never became healthy. The previous process stayed up so you can recover.`,"doctor-failed":"Doctor repair failed. Run `fengming doctor --non-interactive` and retry."}[n]??`See the gateway logs for the exact failure and retry once the cause is fixed.`}`}}async function Qn(e,t,n,r={}){if(!e.client||!e.connected)return!1;e[n]=!0,e.lastError=null;try{let n=Xn(e),i=e.configDraftBaseHash??e.configSnapshot?.hash;return i?(await e.client.request(t,{raw:n,baseHash:i,...r}),e.configFormDirty=!1,e.configDraftBaseHash=null,Hn.delete(e),await Un(e),!0):(e.lastError=`Config hash missing; reload and retry.`,!1)}catch(t){return e.lastError=String(t),!1}finally{e[n]=!1}}function $n(e,t){let n=On(e.configFormOriginal??qn(e.configSnapshot)??{}),r=kn(t),i=kn(n);e.configForm=t,e.configRaw=r,e.configFormDirty=r!==i}async function er(e){return Qn(e,`config.set`,`configSaving`)}async function tr(e){return Qn(e,`config.apply`,`configApplying`,{sessionKey:e.applySessionKey})}async function nr(e){if(!(!e.client||!e.connected)){e.updateRunning=!0,e.lastError=null,e.updateStatusBanner=null;try{let t=await e.client.request(`update.run`,{sessionKey:e.applySessionKey}),n=t.result?.status??(t.ok===!0?`ok`:`error`);if(n===`ok`&&t.ok===!0){e.pendingUpdateExpectedVersion=t.result?.after?.version??null;return}e.pendingUpdateExpectedVersion=null,e.updateStatusBanner=Zn({status:n,reason:t.result?.reason})}catch(t){e.lastError=String(t),e.pendingUpdateExpectedVersion=null}finally{e.updateRunning=!1}}}function rr(e,t){let n=On(e.configForm??qn(e.configSnapshot)??{});t(n),$n(e,n)}function ir(e,t){let n=Hn.get(e);n?n.add(t):Hn.set(e,new Set([t]))}function ar(e,t){let n=Hn.get(e);n&&(n.delete(t),n.size===0&&Hn.delete(e))}function or(e,t,n,r){if(n.length!==4||n[0]!==`plugins`||n[1]!==`entries`||typeof n[2]!=`string`||n[3]!==`enabled`)return;let i=n[2],a=t.plugins&&typeof t.plugins==`object`&&!Array.isArray(t.plugins)?t.plugins:null,o=Array.isArray(a?.allow)?a.allow:null;if(!o){ar(e,i);return}if(r===!0){if(o.includes(i))return;if(o.length===0){ar(e,i);return}Bn(t,[`plugins`,`allow`],[...o,i]),ir(e,i);return}Hn.get(e)?.has(i)&&(Bn(t,[`plugins`,`allow`],o.filter(e=>e!==i)),ar(e,i))}function sr(e,t,n){rr(e,r=>{if(Bn(r,t,n),t[0]===`plugins`&&t[1]===`allow`){Hn.delete(e);return}or(e,r,t,n)})}function cr(e,t){e.configRaw=t,e.configFormDirty=t!==e.configRawOriginal,e.configFormDirty?e.configDraftBaseHash=e.configDraftBaseHash??e.configSnapshot?.hash??null:e.configDraftBaseHash=e.configSnapshot?.hash??null}function lr(e,t){let n=qn(e.configSnapshot),r=e.configForm??n;if(!r||!e.configForm&&!e.configSnapshot?.hash)return;let i=Qt(On(r),t);!i||typeof i!=`object`||Array.isArray(i)||$n(e,On(i))}function ur(e){let t=qn(e.configSnapshot);e.configForm=On(e.configFormOriginal??t??{}),e.configRaw=e.configRawOriginal??kn(e.configFormOriginal??t??{}),e.configFormDirty=!1,e.configDraftBaseHash=e.configSnapshot?.hash??null,Hn.delete(e)}function dr(e,t){rr(e,e=>Vn(e,t))}function fr(e,t){let n=t.trim();if(!n)return-1;let r=e?.agents?.list;return Array.isArray(r)?r.findIndex(e=>e&&typeof e==`object`&&`id`in e&&e.id===n):-1}function pr(e,t){let n=t.trim();if(!n)return-1;let r=e.configForm??qn(e.configSnapshot),i=fr(r,n);if(i>=0)return i;let a=r?.agents?.list,o=Array.isArray(a)?a.length:0;return sr(e,[`agents`,`list`,o,`id`],n),o}function mr(e,t){let n=t.trim();if(!n)return!1;let r=fr(e.configForm??qn(e.configSnapshot),n);return r<0?!1:(rr(e,e=>{let t=e?.agents?.list;if(Array.isArray(t))for(let e=0;e<t.length;e++){let n=t[e];if(!n||typeof n!=`object`||Array.isArray(n))continue;let i=n;e===r?i.default=!0:delete i.default}}),!0)}async function hr(e){if(!(!e.client||!e.connected)){e.lastError=null;try{let t=await e.client.request(`config.openFile`,{});if(!t.ok){e.lastError=t.error||`Failed to open config file`;let n=t.path||e.configSnapshot?.path;if(n)try{await navigator.clipboard.writeText(n),e.lastError+=`\n\nFile path copied to clipboard: ${n}`}catch{e.lastError+=`\n\nFile path: ${n}`}}}catch(t){let n=e.configSnapshot?.path;if(n)try{await navigator.clipboard.writeText(n)}catch{}e.lastError=String(t)}}}async function gr(e){let t=await er(e),n=e.lastError;if(!t){await Un(e),n&&!e.lastError&&(e.lastError=n);return}await Kt(e,!0)}async function _r(e){await Un(e,{discardPendingChanges:!0}),await Kt(e,!0)}function vr(e,t){let n=t.trim();!n||e.settings.lastActiveSessionKey===n||e.applySettings({...e.settings,lastActiveSessionKey:n})}var yr=new Set([`tweakcn.com`,`www.tweakcn.com`]),br=/^[A-Za-z0-9][A-Za-z0-9_-]{7,127}$/,xr=`fengming-custom-theme`,Sr=2e5,Cr=240,wr=1e4,Tr=`"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`,Er=`"JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace`,Dr=[`url(`,`image(`,`image-set(`,`-webkit-image-set(`,`cross-fade(`,`element(`,`-moz-element(`,`paint(`,`@import`,`expression(`],Or=new Set([`black`,`white`,`transparent`,`currentcolor`]),kr=/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([a-z0-9+\-.,/%\s]+\)$/i,Ar=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,jr=new Set([`,`,`'`,`"`,`.`,`_`,`-`]),Mr=`bg.bg-accent.bg-elevated.bg-hover.bg-muted.bg-content.card.card-foreground.card-highlight.popover.popover-foreground.panel.panel-strong.panel-hover.chrome.chrome-strong.text.text-strong.chat-text.muted.muted-strong.muted-foreground.border.border-strong.border-hover.input.ring.accent.accent-hover.accent-muted.accent-subtle.accent-foreground.accent-glow.primary.primary-foreground.secondary.secondary-foreground.accent-2.accent-2-muted.accent-2-subtle.destructive.destructive-foreground.danger.danger-muted.danger-subtle.focus.focus-ring.focus-glow.font-body.font-display.mono.grid-line`.split(`.`),Nr=[`background`,`foreground`,`card`,`card-foreground`,`popover`,`popover-foreground`,`primary`,`primary-foreground`,`secondary`,`secondary-foreground`,`muted`,`muted-foreground`,`accent`,`accent-foreground`,`destructive`,`destructive-foreground`,`border`,`input`,`ring`],Pr=D().max(Cr);function Fr(e){return Object.fromEntries(e.map(e=>[e,Pr]))}var Ir=ee({name:D().max(80).optional(),cssVars:ee({theme:ee({"font-sans":Pr.optional(),"font-mono":Pr.optional()}).optional(),light:ee(Fr(Nr)),dark:ee(Fr(Nr))})}),Lr=ee({sourceUrl:D(),themeId:D(),label:D(),importedAt:D(),light:ee(Fr(Mr)),dark:ee(Fr(Mr))});function Rr(e){if(!br.test(e))throw Error(`Unsupported tweakcn link. Expected a theme share URL.`)}function zr(e){let t=e.split(`/`).filter(Boolean);return t.length===2&&t[0]===`themes`?(Rr(t[1]),t[1]):t.length===3&&t[0]===`r`&&t[1]===`themes`?(Rr(t[2]),t[2]):null}function Br(e){let t=T(e);if(!t)throw Error(`Paste a tweakcn theme link to import.`);let n=t.replace(/[.,;:]+$/,``);return br.test(n)?`https://tweakcn.com/themes/${n}`:n.startsWith(`/themes/`)||n.startsWith(`/r/themes/`)?`https://tweakcn.com${n}`:/^(?:www\.)?tweakcn\.com\//i.test(n)?`https://${n}`:n.match(/https?:\/\/(?:www\.)?tweakcn\.com\/[^\s<>"')]+/i)?.[0]?.replace(/[.,;:]+$/,``)??n}function Vr(e){let t=zr(e.pathname);if(t)return t;let n=e.searchParams.get(`theme`)??e.searchParams.get(`themeId`)??e.searchParams.get(`id`);if(n)return Rr(n),n;throw Error(`Unsupported tweakcn link. Expected a theme share URL.`)}function Hr(e,t){let n=T(e);if(!n||n.length>Cr)throw Error(`Unsupported tweakcn token: ${t}`);let r=n.toLowerCase();if(Dr.some(e=>r.includes(e))||n.includes(`/*`)||n.includes(`*/`)||n.includes(`\\`))throw Error(`Unsupported tweakcn token: ${t}`);for(let e of n){let n=e.charCodeAt(0);if(n<32||n===127||e===`{`||e===`}`||e===`;`||e===`<`||e===`>`||e==="`")throw Error(`Unsupported tweakcn token: ${t}`)}return n}function Ur(e,t){let n=Hr(e,t),r=n.toLowerCase();if(Or.has(r)||Ar.test(n)||kr.test(n))return n;throw Error(`Unsupported tweakcn token: ${t}`)}function Wr(e){let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||e===` `||jr.has(e)}function Gr(e,t){let n=Hr(e,t);if(n.includes(`(`)||n.includes(`)`)||!Array.from(n).every(Wr))throw Error(`Unsupported tweakcn token: ${t}`);return n}function Kr(e,t){return t===`font-sans`||t===`font-mono`?Gr(e,t):Ur(e,t)}function qr(e){return Object.fromEntries(e)}function Jr(e){if(!e||typeof e!=`object`)return null;let t=[];for(let n of Mr){let r=n===`font-body`||n===`font-display`||n===`mono`?Gr(e[n],n):Hr(e[n],n);t.push([n,r])}return qr(t)}function R(e,t,n,r){let i=T(e[n]);if(i)return Kr(i,n);let a=T(t?.[n]);if(a)return Kr(a,n);if(r!=null)return n===`font-sans`||n===`font-mono`?Gr(r,n):Hr(r,n);throw Error(`tweakcn theme is missing required token: ${n}`)}function Yr(e,t,n){let r=e===`light`,i=r?`black`:`white`,a=R(t,n,`background`),o=R(t,n,`foreground`),s=R(t,n,`card`),c=R(t,n,`card-foreground`),l=R(t,n,`popover`),u=R(t,n,`popover-foreground`),d=R(t,n,`primary`),f=R(t,n,`primary-foreground`),p=R(t,n,`secondary`),m=R(t,n,`secondary-foreground`),h=R(t,n,`muted`),g=R(t,n,`muted-foreground`),_=R(t,n,`accent`),v=R(t,n,`accent-foreground`),y=R(t,n,`destructive`),b=R(t,n,`destructive-foreground`),x=R(t,n,`border`),S=R(t,n,`input`),C=R(t,n,`ring`),w=R(t,n,`font-sans`,Tr),T=R(t,n,`font-mono`,Er);return qr([[`bg`,a],[`bg-accent`,`color-mix(in srgb, var(--bg) 88%, var(--card) 12%)`],[`bg-elevated`,s],[`bg-hover`,`color-mix(in srgb, var(--muted) 68%, var(--bg) 32%)`],[`bg-muted`,h],[`bg-content`,`color-mix(in srgb, var(--bg) 92%, var(--card) 8%)`],[`card`,s],[`card-foreground`,c],[`card-highlight`,`color-mix(in srgb, var(--text) ${r?`3`:`5`}%, transparent)`],[`popover`,l],[`popover-foreground`,u],[`panel`,a],[`panel-strong`,s],[`panel-hover`,`color-mix(in srgb, var(--card) 76%, var(--muted) 24%)`],[`chrome`,`color-mix(in srgb, var(--bg) 96%, transparent)`],[`chrome-strong`,`color-mix(in srgb, var(--bg) 98%, transparent)`],[`text`,o],[`text-strong`,o],[`chat-text`,o],[`muted`,g],[`muted-strong`,`color-mix(in srgb, var(--muted) 84%, var(--text) 16%)`],[`muted-foreground`,g],[`border`,x],[`border-strong`,`color-mix(in srgb, var(--border) 72%, var(--text) 28%)`],[`border-hover`,`color-mix(in srgb, var(--border) 55%, var(--text) 45%)`],[`input`,S],[`ring`,C],[`accent`,_],[`accent-hover`,`color-mix(in srgb, var(--accent) 82%, ${i} 18%)`],[`accent-muted`,_],[`accent-subtle`,`color-mix(in srgb, var(--accent) ${r?`10`:`16`}%, transparent)`],[`accent-foreground`,v],[`accent-glow`,`color-mix(in srgb, var(--accent) ${r?`18`:`30`}%, transparent)`],[`primary`,d],[`primary-foreground`,f],[`secondary`,p],[`secondary-foreground`,m],[`accent-2`,d],[`accent-2-muted`,`color-mix(in srgb, var(--accent-2) 72%, transparent)`],[`accent-2-subtle`,`color-mix(in srgb, var(--accent-2) ${r?`8`:`12`}%, transparent)`],[`destructive`,y],[`destructive-foreground`,b],[`danger`,y],[`danger-muted`,`color-mix(in srgb, var(--danger) 75%, transparent)`],[`danger-subtle`,`color-mix(in srgb, var(--danger) ${r?`8`:`12`}%, transparent)`],[`focus`,`color-mix(in srgb, var(--ring) ${r?`14`:`22`}%, transparent)`],[`focus-ring`,`0 0 0 2px var(--bg), 0 0 0 3px color-mix(in srgb, var(--ring) ${r?`70`:`80`}%, transparent)`],[`focus-glow`,`0 0 0 2px var(--bg), 0 0 0 3px var(--ring), 0 0 16px var(--accent-glow)`],[`font-body`,w],[`font-display`,w],[`mono`,T],[`grid-line`,`color-mix(in srgb, var(--text) ${r?`4`:`3`}%, transparent)`]])}function Xr(e){let t=T(e);return t?t.slice(0,80):`Custom`}function Zr(e){let t=Br(e),n;try{n=new URL(t)}catch{throw Error(`Paste a full tweakcn URL.`)}if(!yr.has(n.hostname))throw Error(`Only tweakcn.com theme links are supported.`);let r=Vr(n);return{themeId:r,sourceUrl:`https://tweakcn.com/themes/${r}`,fetchUrl:`https://tweakcn.com/r/themes/${r}`}}function Qr(e){let t=Lr.safeParse(e);if(!t.success)return null;try{Rr(t.data.themeId);let e=Jr(t.data.light),n=Jr(t.data.dark);return!e||!n?null:{sourceUrl:t.data.sourceUrl,themeId:t.data.themeId,label:Xr(t.data.label),importedAt:t.data.importedAt,light:e,dark:n}}catch{return null}}function $r(e,t){let n=Ir.safeParse(e);if(!n.success)throw Error(`tweakcn returned an invalid theme payload.`);let r=n.data,i=r.cssVars.theme;return{sourceUrl:t.sourceUrl,themeId:t.themeId,label:Xr(r.name),importedAt:new Date().toISOString(),light:Yr(`light`,r.cssVars.light,i),dark:Yr(`dark`,r.cssVars.dark,i)}}function ei(e){if(!e)return;let t;try{t=new URL(e)}catch{throw Error(`Unexpected tweakcn import response URL.`)}if(t.protocol!==`https:`||!yr.has(t.hostname))throw Error(`Unexpected redirect during tweakcn import.`)}function ti(e){let t=e.get(`content-length`);if(!t)return null;let n=Number(t);return Number.isFinite(n)&&n>=0?n:null}async function ni(e){let t=ti(e.headers);if(t!=null&&t>Sr)throw Error(`tweakcn theme payload is too large.`);if(!e.body)throw Error(`tweakcn returned an unreadable theme payload.`);let n=e.body.getReader(),r=new TextDecoder,i=0,a=``;try{for(;;){let e=await n.read();if(e.done)break;if(i+=e.value.byteLength,i>Sr)throw await n.cancel().catch(()=>void 0),Error(`tweakcn theme payload is too large.`);a+=r.decode(e.value,{stream:!0})}return a+=r.decode(),a}finally{n.releaseLock()}}async function ri(e){let t=await ni(e);try{return JSON.parse(t)}catch{throw Error(`tweakcn returned invalid JSON.`)}}async function ii(e,t=fetch){let n=Zr(e),r=new AbortController,i=setTimeout(()=>r.abort(),wr);try{let e=await t(n.fetchUrl,{headers:{accept:`application/json`},redirect:`error`,signal:r.signal});if(ei(e.url),!e.ok)throw Error(`tweakcn import failed (${e.status}).`);return $r(await ri(e),n)}catch(e){throw r.signal.aborted?Error(`tweakcn import timed out.`,{cause:e}):e}finally{clearTimeout(i)}}function ai(e){let t=Jr(e.light),n=Jr(e.dark);if(!t||!n)throw Error(`存储的自定义主题缺少必需的令牌`);let r=e=>Mr.map(t=>` --${t}: ${e[t]};`).join(`
|
|
3
3
|
`);return[`:root[data-theme="custom"] {`,r(n),`}`,`:root[data-theme="custom-light"] {`,r(t),`}`].join(`
|
|
4
4
|
`)}function oi(e){if(typeof document>`u`)return;let t=document.getElementById(xr);if(!e){t?.remove();return}let n=``;try{n=ai(e)}catch{t?.remove();return}if(!n){t?.remove();return}t||(t=document.createElement(`style`),t.id=xr,document.head.appendChild(t)),t.textContent=n}var si=[{label:`chat`,tabs:[`chat`]},{label:`control`,tabs:[`overview`,`activity`,`workboard`,`instances`,`sessions`,`usage`,`cron`]},{label:`agent`,tabs:[`agents`,`skills`,`nodes`,`dreams`]},{label:`settings`,tabs:[`config`]}],ci=[`config`,`channels`,`communications`,`appearance`,`automation`,`infrastructure`,`aiAgents`,`debug`,`logs`],li={agents:`/agents`,activity:`/activity`,overview:`/overview`,workboard:`/workboard`,channels:`/channels`,instances:`/instances`,sessions:`/sessions`,usage:`/usage`,cron:`/cron`,skills:`/skills`,nodes:`/nodes`,chat:`/chat`,config:`/config`,communications:`/communications`,appearance:`/appearance`,automation:`/automation`,infrastructure:`/infrastructure`,aiAgents:`/ai-agents`,debug:`/debug`,logs:`/logs`,dreams:`/dreaming`},ui={"/dreams":`dreams`},di=new Map([...Object.entries(li).map(([e,t])=>[t,e]),...Object.entries(ui)]);function fi(e){if(!e)return``;let t=e.trim();return t.startsWith(`/`)||(t=`/${t}`),t===`/`?``:(t.endsWith(`/`)&&(t=t.slice(0,-1)),t)}function pi(e){if(!e)return`/`;let t=e.trim();return t.startsWith(`/`)||(t=`/${t}`),t.length>1&&t.endsWith(`/`)&&(t=t.slice(0,-1)),t}function mi(e,t=``){let n=fi(t),r=li[e];return n?`${n}${r}`:r}function hi(e){return ci.includes(e)}function gi(e,t=``){let n=fi(t),r=e||`/`;n&&(r===n?r=`/`:r.startsWith(`${n}/`)&&(r=r.slice(n.length)));let i=E(pi(r));return i.endsWith(`/index.html`)&&(i=`/`),i===`/`?`chat`:di.get(i)??null}function _i(e){let t=pi(e);if(t.endsWith(`/index.html`)&&(t=pi(t.slice(0,-11))),t===`/`)return``;let n=t.split(`/`).filter(Boolean);if(n.length===0)return``;for(let e=0;e<n.length;e++){let t=E(`/${n.slice(e).join(`/`)}`);if(di.has(t)){let t=n.slice(0,e);return t.length?`/${t.join(`/`)}`:``}}return`/${n.join(`/`)}`}function vi(e){switch(e){case`agents`:return`folder`;case`chat`:return`messageSquare`;case`overview`:return`barChart`;case`activity`:return`activity`;case`workboard`:return`folder`;case`channels`:return`link`;case`instances`:return`radio`;case`sessions`:return`fileText`;case`usage`:return`barChart`;case`cron`:return`loader`;case`skills`:return`zap`;case`nodes`:return`monitor`;case`config`:return`settings`;case`communications`:return`send`;case`appearance`:return`spark`;case`automation`:return`terminal`;case`infrastructure`:return`globe`;case`aiAgents`:return`brain`;case`debug`:return`bug`;case`logs`:return`scrollText`;case`dreams`:return`moon`;default:return`folder`}}function yi(e){return v(e===`config`?`nav.settings`:`tabs.${e}`)}function bi(e){return v(`subtitles.${e}`)}var xi=new Set([`claw`,`knot`,`dash`,`custom`]),Si=new Set([`system`,`light`,`dark`]),Ci={defaultTheme:{theme:`claw`,mode:`dark`},docsTheme:{theme:`claw`,mode:`light`},lightTheme:{theme:`knot`,mode:`dark`},landingTheme:{theme:`knot`,mode:`dark`},newTheme:{theme:`knot`,mode:`dark`},dark:{theme:`claw`,mode:`dark`},light:{theme:`claw`,mode:`light`},openknot:{theme:`knot`,mode:`dark`},fieldmanual:{theme:`dash`,mode:`dark`},clawdash:{theme:`dash`,mode:`light`},system:{theme:`claw`,mode:`system`}};function wi(){return typeof globalThis.matchMedia==`function`?globalThis.matchMedia(`(prefers-color-scheme: light)`).matches:!1}function Ti(e,t){let n=typeof e==`string`?e:``,r=typeof t==`string`?t:``;return{theme:xi.has(n)?n:Ci[n]?.theme??`claw`,mode:Si.has(r)?r:Ci[n]?.mode??`system`}}function Ei(e){return e===`system`?wi()?`light`:`dark`:e}function Di(e,t){let n=Ei(t);return e===`claw`?n===`light`?`light`:`dark`:e===`knot`?n===`light`?`openknot-light`:`openknot`:e===`dash`?n===`light`?`dash-light`:`dash`:n===`light`?`custom-light`:`custom`}function Oi(e,t){let n=T(e);if(n)return n.length<=t?n:n.slice(0,t)}var ki=[{id:`read`,label:`read`,description:`Read file contents`,sectionId:`fs`,profiles:[`coding`]},{id:`write`,label:`write`,description:`Create or overwrite files`,sectionId:`fs`,profiles:[`coding`]},{id:`edit`,label:`edit`,description:`Make precise edits`,sectionId:`fs`,profiles:[`coding`]},{id:`apply_patch`,label:`apply_patch`,description:`Patch files`,sectionId:`fs`,profiles:[`coding`]},{id:`exec`,label:`exec`,description:`Run shell now.`,sectionId:`runtime`,profiles:[`coding`]},{id:`process`,label:`process`,description:`Inspect/control exec sessions.`,sectionId:`runtime`,profiles:[`coding`]},{id:`code_execution`,label:`code_execution`,description:`Run sandboxed remote analysis`,sectionId:`runtime`,profiles:[`coding`],includeInFengMingGroup:!0},{id:`web_search`,label:`web_search`,description:`Search the web`,sectionId:`web`,profiles:[`coding`],includeInFengMingGroup:!0},{id:`web_fetch`,label:`web_fetch`,description:`Fetch web content`,sectionId:`web`,profiles:[`coding`],includeInFengMingGroup:!0},{id:`x_search`,label:`x_search`,description:`Search X posts`,sectionId:`web`,profiles:[`coding`],includeInFengMingGroup:!0},{id:`memory_search`,label:`memory_search`,description:`Semantic search`,sectionId:`memory`,profiles:[`coding`],includeInFengMingGroup:!0},{id:`memory_get`,label:`memory_get`,description:`Read memory files`,sectionId:`memory`,profiles:[`coding`],includeInFengMingGroup:!0},{id:`sessions_list`,label:`sessions_list`,description:`List visible sessions; filters/previews.`,sectionId:`sessions`,profiles:[`coding`,`messaging`],includeInFengMingGroup:!0},{id:`sessions_history`,label:`sessions_history`,description:`Read sanitized session history.`,sectionId:`sessions`,profiles:[`coding`,`messaging`],includeInFengMingGroup:!0},{id:`sessions_send`,label:`sessions_send`,description:`Message session or configured agent.`,sectionId:`sessions`,profiles:[`coding`,`messaging`],includeInFengMingGroup:!0},{id:`sessions_spawn`,label:`sessions_spawn`,description:`Spawn subagent or ACP session.`,sectionId:`sessions`,profiles:[`coding`],includeInFengMingGroup:!0},{id:`sessions_yield`,label:`sessions_yield`,description:`End turn to receive sub-agent results`,sectionId:`sessions`,profiles:[`coding`],includeInFengMingGroup:!0},{id:`subagents`,label:`subagents`,description:`Manage sub-agents`,sectionId:`sessions`,profiles:[`coding`],includeInFengMingGroup:!0},{id:`session_status`,label:`session_status`,description:`Show session status/model/usage.`,sectionId:`sessions`,profiles:[`minimal`,`coding`,`messaging`],includeInFengMingGroup:!0},{id:`browser`,label:`browser`,description:`Control web browser`,sectionId:`ui`,profiles:[],includeInFengMingGroup:!0},{id:`canvas`,label:`canvas`,description:`Control node Canvas surfaces when the Canvas plugin is enabled`,sectionId:`ui`,profiles:[]},{id:`message`,label:`message`,description:`Send messages`,sectionId:`messaging`,profiles:[`messaging`],includeInFengMingGroup:!0},{id:`heartbeat_respond`,label:`heartbeat_respond`,description:`Record heartbeat outcomes`,sectionId:`automation`,profiles:[],includeInFengMingGroup:!0},{id:`cron`,label:`cron`,description:`Schedule reminders, cron, wake events.`,sectionId:`automation`,profiles:[`coding`],includeInFengMingGroup:!0},{id:`gateway`,label:`gateway`,description:`Gateway control`,sectionId:`automation`,profiles:[],includeInFengMingGroup:!0},{id:`nodes`,label:`nodes`,description:`Nodes + devices`,sectionId:`nodes`,profiles:[],includeInFengMingGroup:!0},{id:`agents_list`,label:`agents_list`,description:`List agents`,sectionId:`agents`,profiles:[],includeInFengMingGroup:!0},{id:`get_goal`,label:`get_goal`,description:`Get current thread goal`,sectionId:`agents`,profiles:[`coding`],includeInFengMingGroup:!0},{id:`create_goal`,label:`create_goal`,description:`Create a thread goal`,sectionId:`agents`,profiles:[`coding`],includeInFengMingGroup:!0},{id:`update_goal`,label:`update_goal`,description:`Complete or block a thread goal`,sectionId:`agents`,profiles:[`coding`],includeInFengMingGroup:!0},{id:`update_plan`,label:`update_plan`,description:`Track short work plan.`,sectionId:`agents`,profiles:[`coding`],includeInFengMingGroup:!0},{id:`image`,label:`image`,description:`Image understanding`,sectionId:`media`,profiles:[`coding`],includeInFengMingGroup:!0},{id:`image_generate`,label:`image_generate`,description:`Image generation`,sectionId:`media`,profiles:[`coding`],includeInFengMingGroup:!0},{id:`music_generate`,label:`music_generate`,description:`Music generation`,sectionId:`media`,profiles:[`coding`],includeInFengMingGroup:!0},{id:`video_generate`,label:`video_generate`,description:`Video generation`,sectionId:`media`,profiles:[`coding`],includeInFengMingGroup:!0},{id:`tts`,label:`tts`,description:`Text-to-speech conversion`,sectionId:`media`,profiles:[],includeInFengMingGroup:!0}];new Map(ki.map(e=>[e.id,e]));function Ai(e){return ki.filter(t=>t.profiles.includes(e)).map(e=>e.id)}var ji={minimal:{allow:Ai(`minimal`)},coding:{allow:[...Ai(`coding`),`bundle-mcp`]},messaging:{allow:[...Ai(`messaging`),`bundle-mcp`]},full:{allow:[`*`]}};function Mi(){let e=new Map;for(let t of ki){let n=`group:${t.sectionId}`,r=e.get(n)??[];r.push(t.id),e.set(n,r)}return{"group:fengming":ki.filter(e=>e.includeInFengMingGroup).map(e=>e.id),...Object.fromEntries(e.entries())}}var Ni=Mi();function Pi(e){if(!e)return;let t=ji[e];if(t&&!(!t.allow&&!t.deny))return{allow:t.allow?[...t.allow]:void 0,deny:t.deny?[...t.deny]:void 0}}var Fi={bash:`exec`,"apply-patch":`apply_patch`},Ii={...Ni};function Li(e){let t=E(e);return Fi[t]??t}function Ri(e){return e?e.map(Li).filter(Boolean):[]}function zi(e){let t=Ri(e),n=[];for(let e of t){let t=Ii[e];if(t){n.push(...t);continue}n.push(e)}return tn(n)}function Bi(e){return Pi(e)}var Vi=50,Hi=64,Ui=2e6,Wi=500,Gi=200,Ki=/^(data:image\/|\/(?!\/))/i,qi=`Assistant`;function Ji(e){let t=Oi(e??void 0,Ui);return t?Ki.test(t)?t:/[\r\n]/.test(t)?null:t.length<=Hi?t:null:null}function Yi(e){let t=Oi(e?.name,Vi)??qi,n=Ji(e?.avatar),r=Oi(e?.avatarSource??void 0,Wi)??null,i=e?.avatarStatus===`none`||e?.avatarStatus===`local`||e?.avatarStatus===`remote`||e?.avatarStatus===`data`?e.avatarStatus:null,a=Oi(e?.avatarReason??void 0,Gi)??null;return{agentId:typeof e?.agentId==`string`&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n,avatarSource:r,avatarStatus:i,avatarReason:a}}function Xi(e,t){let n=e.trim();if(!n)return``;let r=t?.trim();if(!r)return n;let i=`${r.toLowerCase()}/`;return n.toLowerCase().startsWith(i)?n:`${r}/${n}`}function Zi(e){let t=e.trim();return t?t.includes(`/`)?{kind:`qualified`,value:t}:{kind:`raw`,value:t}:null}function Qi(e,t){if(!e)return``;let n=e?.value.trim();return n?e.kind===`qualified`?n:ta(n,t)||n:``}function $i(e,t){if(typeof e!=`string`)return``;let n=e.trim();if(!n)return``;let r=t?.trim();if(!r)return n;let i=`${r.toLowerCase()}/`;return n.toLowerCase().startsWith(i)||n.includes(`/`)?n:Xi(n,r)}function ea(e,t){let n=t.trim().toLowerCase();return n?e.some(e=>oa(e)===n):!1}function ta(e,t){let n=e.trim().toLowerCase();if(!n)return``;let r=``;for(let e of t){if(e.id.trim().toLowerCase()!==n)continue;let t=Xi(e.id,e.provider);if(!r){r=t;continue}if(r.toLowerCase()!==t.toLowerCase())return``}return r}function na(e,t,n){if(typeof e!=`string`)return``;let r=e.trim();if(!r)return``;let i=t?.trim();if(!i)return Qi(Zi(r),n);if(!r.includes(`/`)){let e=Qi(Zi(r),n);return e===r?$i(r,i):e}if(ea(n,r))return r;let a=ta(r,n);if(a)return a;let o=Xi(r,i);return ea(n,o)?o:$i(r,i)}function ra(e){let t=e.trim();if(!t)return``;let n=t.indexOf(`/`);return n<=0?t:`${t.slice(n+1)} · ${t.slice(0,n)}`}function ia(e){let t=e.provider?.trim();return t?`${e.id} · ${t}`:e.id}function aa(e){return e.alias?.trim()||e.name.trim()}function oa(e){return Xi(e.id,e.provider).trim().toLowerCase()}function sa(e,t){return`${e.toLowerCase()}\u0000${t?.trim().toLowerCase()??``}`}function ca(e){let t=new Map,n=new Map;for(let r of e){let e=aa(r);if(!e)continue;let i=oa(r),a=e.toLowerCase(),o=sa(e,r.provider),s=t.get(a)??new Set;s.add(i),t.set(a,s);let c=n.get(o)??new Set;c.add(i),n.set(o,c)}let r=new Map;for(let i of e){let e=oa(i),a=aa(i);if(!a){r.set(e,ia(i));continue}let o=a.toLowerCase();if((t.get(o)?.size??0)<=1){r.set(e,a);continue}let s=i.provider?.trim();if((n.get(sa(a,s))?.size??0)<=1){r.set(e,s?`${a} · ${s}`:`${a} · ${i.id}`);continue}r.set(e,`${a} · ${ia(i)}`)}return r}function la(e,t){return t.get(oa(e))??ia(e)}function ua(e,t){let n=e.trim();return n?t.get(n.toLowerCase())??ra(n):``}function da(e,t){let n=e.provider?.trim();return{value:Xi(e.id,n),label:la(e,t)}}var fa=[{id:`fs`,label:v(`agents.tools.cat.files`),tools:[{id:`read`,label:`read`,description:v(`tools.readFiles`)},{id:`write`,label:`write`,description:v(`tools.createFiles`)},{id:`edit`,label:`edit`,description:v(`tools.preciseEdits`)},{id:`apply_patch`,label:`apply_patch`,description:v(`agents.tools.desc.patchFiles`)}]},{id:`runtime`,label:v(`agents.tools.cat.runtime`),tools:[{id:`exec`,label:`exec`,description:v(`tools.runShell`)},{id:`process`,label:`process`,description:v(`tools.manageProcesses`)}]},{id:`web`,label:v(`agents.tools.cat.web`),tools:[{id:`web_search`,label:`web_search`,description:v(`tools.searchWeb`)},{id:`web_fetch`,label:`web_fetch`,description:v(`tools.fetchWeb`)}]},{id:`memory`,label:v(`agents.tools.cat.memory`),tools:[{id:`memory_search`,label:`memory_search`,description:v(`tools.semanticSearch`)},{id:`memory_get`,label:`memory_get`,description:v(`tools.readMemory`)}]},{id:`sessions`,label:v(`agents.tools.cat.sessions`),tools:[{id:`sessions_list`,label:`sessions_list`,description:v(`tools.listSessions`)},{id:`sessions_history`,label:`sessions_history`,description:v(`tools.sessionHistory`)},{id:`sessions_send`,label:`sessions_send`,description:v(`tools.sendToSession`)},{id:`sessions_spawn`,label:`sessions_spawn`,description:v(`agents.spawnSubAgent`)},{id:`session_status`,label:`session_status`,description:v(`tools.sessionStatus`)}]},{id:`ui`,label:v(`agents.tools.cat.ui`),tools:[{id:`browser`,label:`browser`,description:v(`tools.controlBrowser`)},{id:`canvas`,label:`canvas`,description:v(`tools.controlCanvases`)}]},{id:`messaging`,label:v(`agents.tools.cat.messaging`),tools:[{id:`message`,label:`message`,description:v(`tools.sendMessages`)}]},{id:`automation`,label:v(`agents.tools.cat.automation`),tools:[{id:`cron`,label:`cron`,description:v(`tools.scheduleTasks`)},{id:`gateway`,label:`gateway`,description:v(`tools.gatewayControl`)}]},{id:`nodes`,label:v(`agents.tools.cat.nodes`),tools:[{id:`nodes`,label:`nodes`,description:v(`agents.nodesDevices`)}]},{id:`agents`,label:v(`agents.tools.cat.agents`),tools:[{id:`agents_list`,label:`agents_list`,description:v(`tools.listAgents`)}]},{id:`media`,label:v(`agents.tools.cat.media`),tools:[{id:`image`,label:`image`,description:v(`tools.imageUnderstanding`)}]}],pa=[{id:`minimal`,label:v(`agents.profile.minimal`)},{id:`coding`,label:v(`agents.profile.coding`)},{id:`messaging`,label:v(`agents.profile.messaging`)},{id:`full`,label:v(`agents.profile.full`)}];function ma(e){return e?.groups?.length?e.groups.map(e=>({id:e.id,label:e.label,source:e.source,pluginId:e.pluginId,tools:e.tools.map(e=>({id:e.id,label:e.label,description:e.description,source:e.source,pluginId:e.pluginId,optional:e.optional,defaultProfiles:[...e.defaultProfiles]}))})):fa}function ha(e){return e?.profiles?.length?e.profiles:pa}function ga(e){return T(e.name)??T(e.identity?.name)??e.id}var _a=/^(data:image\/|\/(?!\/))/i;function va(e){return _a.test(e)}function ya(e,t){let n=[T(t?.avatar),T(e.identity?.avatarUrl),T(e.identity?.avatar)];for(let e of n)if(e&&va(e))return e;return null}function ba(e,t,n){let r=T(e);return r?.startsWith(`blob:`)?r:ya(t,n)}function xa(e){let t=T(e)?.replace(/\/$/,``)??``;return t?`${t}/favicon.svg`:`favicon.svg`}function Sa(e){let t=T(e)?.replace(/\/$/,``)??``;return t?`${t}/apple-touch-icon.png`:`apple-touch-icon.png`}function Ca(e){let t=e.trim();return t.startsWith(`blob:`)||va(t)}var wa=/[\u200B-\u200F\u202A-\u202E\u2060-\u206F\uFEFF]/u;function Ta(e){let t=e?.trim();return!t||t===`A`||Ca(t)||t.length>8||/\s/.test(t)||/[\\/.:]/.test(t)||wa.test(t)?null:t}function Ea(e,t){let n=[T(e.identity?.emoji),T(e.identity?.avatar),T(t?.emoji),T(t?.avatar)];for(let e of n){let t=Ta(e);if(t)return t}return null}function Da(e,t){return t&&e===t?`default`:null}function Oa(e){if(e==null||!Number.isFinite(e))return`-`;if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(+(n<10))} ${t[r]}`}function ka(e,t){let n=e;return{entry:(n?.agents?.list??[]).find(e=>e?.id===t),defaults:n?.agents?.defaults,globalTools:n?.tools}}function Aa(e,t,n,r,i){let a=ka(t,e.id),o=(n&&n.agentId===e.id?n.workspace:null)||a.entry?.workspace||a.defaults?.workspace||e.workspace||`default`,s=a.entry?.model?Ma(a.entry?.model):a.defaults?.model?Ma(a.defaults?.model):Ma(e.model),c=ja(e.agentRuntime),l=T(e.identity?.name)||T(e.name)||T(i?.name)||a.entry?.name||e.id,u=ya(e,i)?`custom`:Ea(e,i)??`—`,d=Array.isArray(a.entry?.skills)?a.entry?.skills:null,f=d?.length??null;return{workspace:o,model:s,runtime:c,identityName:l,identityAvatar:u,skillsLabel:d?`${f} selected`:`all skills`,isDefault:!!(r&&e.id===r)}}function ja(e){let t=T(e?.id)??`pi`,n=T(e?.fallback);return n?`${t} (fallback ${n})`:t}function Ma(e){if(!e)return`-`;if(typeof e==`string`)return T(e)||`-`;if(typeof e==`object`&&e){let t=e,n=T(t.primary);if(n){let e=Array.isArray(t.fallbacks)?t.fallbacks.length:0;return e>0?`${n} (+${e} fallback)`:n}}return`-`}function Na(e){let t=e.match(/^(.+) \(\+\d+ fallback\)$/);return t?t[1]:e}function Pa(e){if(!e)return null;if(typeof e==`string`)return T(e)||null;if(typeof e==`object`&&e){let t=e;return T(typeof t.primary==`string`?t.primary:typeof t.model==`string`?t.model:typeof t.id==`string`?t.id:typeof t.value==`string`?t.value:null)||null}return null}function Fa(e){if(!e||typeof e==`string`)return null;if(typeof e==`object`&&e){let t=e,n=Array.isArray(t.fallbacks)?t.fallbacks:Array.isArray(t.fallback)?t.fallback:null;return n?n.filter(e=>typeof e==`string`):null}return null}function Ia(e,t){return Fa(e)??Fa(t)}function La(e,t){if(typeof t!=`string`)return;let n=t.trim();n&&e.add(n)}function Ra(e,t){if(!t)return;if(typeof t==`string`){La(e,t);return}if(typeof t!=`object`)return;let n=t;La(e,n.primary),La(e,n.model),La(e,n.id),La(e,n.value);let r=Array.isArray(n.fallbacks)?n.fallbacks:Array.isArray(n.fallback)?n.fallback:[];for(let t of r)La(e,t)}function za(e){let t=Array.from(e),n=Array.from({length:t.length},()=>``),r=(e,r,i)=>{let a=e,o=r,s=e;for(;a<r&&o<i;)n[s++]=t[a].localeCompare(t[o])<=0?t[a++]:t[o++];for(;a<r;)n[s++]=t[a++];for(;o<i;)n[s++]=t[o++];for(let r=e;r<i;r+=1)t[r]=n[r]},i=(e,t)=>{if(t-e<=1)return;let n=e+t>>>1;i(e,n),i(n,t),r(e,n,t)};return i(0,t.length),t}function Ba(e){if(!e||typeof e!=`object`)return[];let t=e.agents;if(!t||typeof t!=`object`)return[];let n=new Set,r=t.defaults;if(r&&typeof r==`object`){let e=r;Ra(n,e.model);let t=e.models;if(t&&typeof t==`object`)for(let e of Object.keys(t))La(n,e)}let i=t.list;if(i&&typeof i==`object`)for(let e of Object.values(i))!e||typeof e!=`object`||Ra(n,e.model);return za(n)}function Va(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function Ha(e){let t=e?.agents?.defaults?.models;if(!t||typeof t!=`object`)return[];let n=[];for(let[e,r]of Object.entries(t)){let t=e.trim();if(!t)continue;let i=r&&typeof r==`object`&&`alias`in r&&typeof r.alias==`string`?r.alias?.trim():void 0,a=i&&i!==t?`${i} (${t})`:t;n.push({value:t,label:a})}return n}function Ua(e,t,n,r){let a=new Set,o=[],s=r?E(r):null,c=(e,t)=>{let n=E(e);a.has(n)||(a.add(n),o.push({value:e,label:t}))};for(let t of Ha(e))c(t.value,t.label);if(n)for(let e of n){let t=e.provider?.trim();c(Xi(e.id,t),t?`${e.id} · ${t}`:e.id)}return t&&!a.has(E(t))&&o.unshift({value:t,label:`Current (${t})`}),o.length===0?i:o.map(e=>d`
|
|
@@ -7004,7 +7004,7 @@ ${e.pluginDescription}</pre
|
|
|
7004
7004
|
aria-label=${v(`sessions.sessionDetails.activeRun`)}
|
|
7005
7005
|
></span>`:i}
|
|
7006
7006
|
</a>
|
|
7007
|
-
`}var wV=dI(()=>hV(()=>import(`./agents-mRUyNVCz.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url),_V),TV=dI(()=>hV(()=>import(`./activity-B2W-IeAT.js`),__vite__mapDeps([8,1,4,5]),import.meta.url),_V),EV=dI(()=>hV(()=>import(`./channels-8QHOqBnt.js`),__vite__mapDeps([9,1,5,6]),import.meta.url),_V),DV=dI(()=>hV(()=>import(`./cron-H3unP_mO.js`),__vite__mapDeps([10,1,5]),import.meta.url),_V),OV=dI(()=>hV(()=>import(`./debug-CxLsQ9vH.js`),__vite__mapDeps([11,1,5]),import.meta.url),_V),kV=dI(()=>hV(()=>import(`./instances-B1JQeCRb.js`),__vite__mapDeps([12,1,5]),import.meta.url),_V),AV=dI(()=>hV(()=>import(`./logs-atEFsTJJ.js`),__vite__mapDeps([13,1,4,5]),import.meta.url),_V),jV=dI(()=>hV(()=>import(`./nodes-RGOmq_1l.js`),__vite__mapDeps([14,1,4,5]),import.meta.url),_V),MV=dI(()=>hV(()=>import(`./sessions-C2O-Jgpg.js`),__vite__mapDeps([15,1,4,5]),import.meta.url),_V),NV=dI(()=>hV(()=>import(`./skills-jyJOYA4I.js`),__vite__mapDeps([16,1,4,5,7]),import.meta.url),_V),PV=dI(()=>hV(()=>import(`./workboard-uM_kK8cQ.js`),__vite__mapDeps([17,1,5]),import.meta.url),_V);function FV(e){return typeof e!=`number`||!Number.isFinite(e)?null:new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function IV(e){if(!e?.phases)return null;let t;for(let n of Object.values(e.phases))!n.enabled||typeof n.nextRunAtMs!=`number`||(t===void 0||n.nextRunAtMs<t)&&(t=n.nextRunAtMs);return FV(t)}var LV=null,RV=`fengming:control-ui:update-banner-dismissed:v1`,zV=[`off`,`minimal`,`low`,`medium`,`high`],BV=[`UTC`,`America/Los_Angeles`,`America/Denver`,`America/Chicago`,`America/New_York`,`Europe/London`,`Europe/Berlin`,`Asia/Tokyo`];function VV(e){return/^https?:\/\//i.test(e.trim())}function HV(e){return typeof e==`string`?e.trim():``}function UV(e){let t=new Set,n=[];for(let r of e){let e=r.trim();if(!e)continue;let i=e.toLowerCase();t.has(i)||(t.add(i),n.push(e))}return n}function WV(){try{let e=et()?.getItem(RV);if(!e)return null;let t=JSON.parse(e);return!t||typeof t.latestVersion!=`string`?null:{latestVersion:t.latestVersion,channel:typeof t.channel==`string`?t.channel:null,dismissedAtMs:typeof t.dismissedAtMs==`number`?t.dismissedAtMs:Date.now()}}catch{return null}}function GV(e){let t=WV();if(!t)return!1;let n=e,r=n&&typeof n.latestVersion==`string`?n.latestVersion:null,i=n&&typeof n.channel==`string`?n.channel:null;return!!(r&&t.latestVersion===r&&t.channel===i)}function KV(e){let t=e,n=t&&typeof t.latestVersion==`string`?t.latestVersion:null;if(!n)return;let r={latestVersion:n,channel:t&&typeof t.channel==`string`?t.channel:null,dismissedAtMs:Date.now()};try{et()?.setItem(RV,JSON.stringify(r))}catch{}}var qV=[`messages`,`broadcast`,`__notifications__`,`talk`,`audio`,`channels`],JV=[`__appearance__`,`ui`,`wizard`],YV=[`commands`,`hooks`,`bindings`,`cron`,`approvals`,`plugins`],XV=[`gateway`,`web`,`browser`,`nodeHost`,`canvasHost`,`discovery`,`media`,`acp`,`mcp`],ZV=[`agents`,`models`,`skills`,`tools`,`memory`,`session`],QV=new Set([...qV,...JV,...YV,...XV,...ZV]);function $V(e,t){return e&&QV.has(e)?{activeSection:null,activeSubsection:null}:{activeSection:e,activeSubsection:t}}function eH(e,t,n){return e&&!n.includes(e)?{activeSection:null,activeSubsection:null}:{activeSection:e,activeSubsection:t}}function tH(e,t,n){if(!e||typeof e!=`object`||Array.isArray(e))return 0;let r=e.properties;if(!r||typeof r!=`object`||Array.isArray(r))return 0;let i=t?.length?new Set(t):null,a=n?.length?new Set(n):null;return Object.keys(r).filter(e=>!(i&&!i.has(e)||a?.has(e))).length}function nH(e,t,n,r){let i=Qg(),a=r();return u_(e,t,{...n,durationMs:$g(Qg()-i)}),a}function rH(e){let t=e.agentsList?.agents??[],n=z(e.sessionKey)?.agentId??e.agentsList?.defaultId??`main`,r=t.find(e=>e.id===n)?.identity,i=r?.avatarUrl??r?.avatar;if(i&&va(i))return i}function iH(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.ui;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.assistant;return!n||typeof n!=`object`||Array.isArray(n)?null:T(n.avatar)??null}function aH(e,t){let n=fi(e??``),r=encodeURIComponent(t);return n?`${n}/avatar/${r}`:`/avatar/${r}`}var oH=[{id:`weixin`,label:`微信`},{id:`qqbot`,label:`QQ`},{id:`feishu`,label:`飞书`},{id:`webhooks`,label:`Webhooks`}];function sH(e){let t=e.trim();return t?t.split(/[-_]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `):`Unknown`}function cH(e){let t=e.configForm??e.configSnapshot?.config;if(!t||typeof t!=`object`)return[];let n=`channels`in t&&t.channels&&typeof t.channels==`object`?t.channels:{},r=Object.keys(n).filter(e=>e.trim().length>0),i=r.length>0?r.toSorted((e,t)=>e.localeCompare(t)):oH.map(({id:e})=>e),a=new Map(oH.map(({id:e,label:t})=>[e,t])),o=[];for(let e of i){let t=n[e],r=typeof t==`object`&&!!t&&Object.keys(t).length>0;o.push({id:e,label:a.get(e)??sH(e),connected:r,detail:r?`Configured`:void 0})}return o}function lH(e){let t=e.configForm??e.configSnapshot?.config;if(!t||typeof t!=`object`)return 0;let n=t.mcp;if(!n||typeof n!=`object`)return 0;let r=`servers`in n&&n.servers&&typeof n.servers==`object`?n.servers:{};return Object.keys(r).length}function uH(e){let t=e.configForm??e.configSnapshot?.config;if(!t||typeof t!=`object`)return{gatewayAuth:`unknown`,execPolicy:`unknown`,deviceAuth:!1,browserEnabled:!0,toolProfile:`full`};let n=t,r=`gateway`in n&&n.gateway&&typeof n.gateway==`object`?n.gateway:null,i=r&&`auth`in r&&r.auth&&typeof r.auth==`object`?r.auth:null,a=`unknown`;i&&(a=(typeof i.mode==`string`?i.mode.trim():``)||(i.password?`password`:i.token?`token`:i.trustedProxy?`trusted-proxy`:`none`));let o=`allowlist`,s=`full`,c=n.tools;if(c&&typeof c==`object`){let e=c.profile;if(typeof e==`string`){let t=e.trim();t&&(s=t)}let t=c.exec;if(t&&typeof t==`object`){let e=t.security;if(typeof e==`string`){let t=e.trim();t&&(o=t)}}}let l=!0,u=`browser`in n&&n.browser&&typeof n.browser==`object`?n.browser:null;u&&typeof u.enabled==`boolean`&&(l=u.enabled);let d=!0;return r&&(`controlUi`in r&&r.controlUi&&typeof r.controlUi==`object`?r.controlUi:null)?.dangerouslyDisableDeviceAuth===!0&&(d=!1),{gatewayAuth:a,execPolicy:o,deviceAuth:d,browserEnabled:l,toolProfile:s}}function dH(e){return e.sessionsResult?.sessions?.find(t=>t.key===e.sessionKey)}function fH(e,t){return nz({open:e.cronQuickCreateOpen,step:e.cronQuickCreateStep,draft:e.cronQuickCreateDraft??KR(),onDraftChange:n=>{e.cronQuickCreateDraft={...e.cronQuickCreateDraft??KR(),...n},t?.()},onStepChange:n=>{e.cronQuickCreateStep=n,t?.()},onCreate:()=>{let n=JR(e.cronQuickCreateDraft??KR());e.cronEditingJobId=null,e.cronForm={...hg,...n},t?.(),(async()=>{if(!await cv(e)){t?.();return}e.cronQuickCreateOpen=!1,e.cronQuickCreateStep=`what`,e.cronQuickCreateDraft=null,t?.()})()},onAdvancedCreate:()=>{let n=JR(e.cronQuickCreateDraft??KR());e.cronEditingJobId=null,e.cronForm=B_({...hg,...n}),e.cronFieldErrors=V_(e.cronForm),e.cronQuickCreateOpen=!1,e.cronQuickCreateStep=`what`,e.cronQuickCreateDraft=null,e.cronFormCollapsed=!1,t?.()},onCancel:()=>{e.cronQuickCreateOpen=!1,e.cronQuickCreateStep=`what`,e.cronQuickCreateDraft=null,t?.()}})}function pH(e){let t=e,n=typeof t.requestUpdate==`function`?()=>t.requestUpdate?.():void 0;if(gV=n,!e.connected)return d` ${HB(e)} ${kB(e)} `;let r=e.presenceEntries.length,a=e.sessionsResult?.count??null,o=e.cronStatus?.nextWakeAtMs??null,s=e.connected?null:v(`chat.disconnected`),c=e.tab===`chat`,u=c&&(e.settings.chatFocusMode||e.onboarding),f=c&&(u||e.chatHeaderControlsHidden),p=e.navDrawerOpen&&!u&&!e.onboarding,m=e.settings.navCollapsed&&!p,h=WN(e),g=e.onboarding?!1:e.settings.chatShowThinking,_=e.onboarding?!0:e.settings.chatShowToolCalls,y=T(Mo().avatar)??null,b=rH(e),x=y?`data`:e.chatAvatarStatus??e.assistantAvatarStatus??null,S=y?null:e.chatAvatarReason??e.assistantAvatarReason??null,C=x===`none`&&S===`missing`,w=y??(C?null:e.assistantAvatar),E=y??e.chatAvatarUrl??(C?null:b??null),D=y?`data`:e.assistantAvatarStatus??e.chatAvatarStatus??null,O=y?null:e.assistantAvatarReason??e.chatAvatarReason??null,ee=y??e.assistantAvatarSource??e.chatAvatarSource??null,k=D===`none`&&O===`missing`,te=y??(k||D===`local`?null:e.assistantAvatar),A=y??(D===`local`&&e.assistantAgentId?aH(e.basePath,e.assistantAgentId):e.chatAvatarUrl??(k?null:b??null)),j=e.configForm??e.configSnapshot?.config,M=zv(j),N=e.dreamingStatus?.enabled??M.enabled,P=IV(e.dreamingStatus),F=e.dreamingStatusLoading||e.dreamingModeSaving,ne=e.dreamingStatusLoading||e.dreamDiaryLoading,re=()=>{(async()=>{await Un(e),await Promise.all([ey(e),ty(e),ny(e),ry(e)])})()},ie=async t=>{if(!e.client||!e.connected)return null;let n=await e.client.request(`wiki.get`,{lookup:t,fromLine:1,lineCount:5e3}),r=typeof n?.title==`string`&&n.title.trim()?n.title.trim():t,i=typeof n?.path==`string`&&n.path.trim()?n.path.trim():t,a=typeof n?.content==`string`&&n.content.length>0?n.content:v(`wiki.noContent`),o=typeof n?.updatedAt==`string`&&n.updatedAt.trim()?n.updatedAt.trim():void 0,s=typeof n?.totalLines==`number`&&Number.isFinite(n.totalLines)?Math.max(0,Math.floor(n.totalLines)):void 0,c=n?.truncated===!0;return{title:r,path:i,content:a,...s===void 0?{}:{totalLines:s},...c?{truncated:c}:{},...o?{updatedAt:o}:{}}},ae=t=>{e.dreamingModeSaving||e.dreamingRestartConfirmLoading||e.dreamingRestartConfirmOpen||N===t||(e.dreamingPendingEnabled=t,e.dreamingRestartConfirmOpen=!0,e.dreamingStatusError=null)},oe=()=>{e.dreamingRestartConfirmLoading||(e.dreamingRestartConfirmOpen=!1,e.dreamingPendingEnabled=null,e.dreamingStatusError=null)},se=()=>{let t=e.dreamingPendingEnabled;t==null||e.dreamingRestartConfirmLoading||(async()=>{e.dreamingRestartConfirmLoading=!0,e.dreamingStatusError=null;try{if(!await hy(e,t)){e.dreamingStatusError||=v(`dreaming.restartConfirmation.failed`);return}await Un(e),await ey(e),e.dreamingRestartConfirmOpen=!1,e.dreamingPendingEnabled=null}finally{e.dreamingRestartConfirmLoading=!1}})()},ce=fi(e.basePath??``),le=()=>e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id??null,I=le(),ue=Xc(e.sessionKey),de=!!(I&&ue&&I===ue),fe=()=>e.configForm??e.configSnapshot?.config,L=e=>fr(fe(),e),pe=t=>pr(e,t),me=(e,t)=>{let n=t?pe(e):L(e);return n>=0?[`agents`,`list`,n,`tools`]:null},he=e=>{let t=fe()?.agents?.list,n=Array.isArray(t)?t[e]?.model:void 0;return{basePath:[`agents`,`list`,e,`model`],existing:n}},ge=za(new Set([...e.agentsList?.agents?.map(e=>e.id.trim())??[],...e.cronJobs.map(e=>typeof e.agentId==`string`?e.agentId.trim():``).filter(Boolean)].filter(Boolean))),_e=za(new Set([...e.cronModelSuggestions,...Ba(j),...e.cronJobs.map(e=>{let t=F_(e);return t?.kind!==`agentTurn`||typeof t.model!=`string`?``:t.model.trim()}).filter(Boolean)].filter(Boolean))),ve=Y_(e),ye=e.cronForm.deliveryChannel&&e.cronForm.deliveryChannel.trim()?e.cronForm.deliveryChannel.trim():`last`,be=e.cronJobs.map(e=>HV(e.delivery?.to)).filter(Boolean),xe=(ye===`last`?Object.values(e.channelsSnapshot?.channelAccounts??{}).flat():e.channelsSnapshot?.channelAccounts?.[ye]??[]).flatMap(e=>[HV(e.accountId),HV(e.name)]).filter(Boolean),Se=UV([...be,...xe]),Ce=UV(xe),we=e.cronForm.deliveryMode===`webhook`?Se.filter(e=>VV(e)):Se,Te={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,formValue:e.configForm,originalValue:e.configFormOriginal,onRawChange:t=>{cr(e,t)},onRequestUpdate:n,onFormPatch:(t,n)=>sr(e,t,n),onReload:()=>Un(e,{discardPendingChanges:!0}),onReset:()=>ur(e),onSave:()=>er(e),onApply:()=>tr(e),onUpdate:()=>nr(e),onOpenFile:()=>hr(e),version:e.hello?.server?.version??``,theme:e.theme,themeMode:e.themeMode,setTheme:(t,n)=>e.setTheme(t,n),setThemeMode:(t,n)=>e.setThemeMode(t,n),hasCustomTheme:!!e.settings.customTheme,customThemeLabel:e.settings.customTheme?.label??null,customThemeSourceUrl:e.settings.customTheme?.sourceUrl??null,customThemeImportUrl:e.customThemeImportUrl,customThemeImportBusy:e.customThemeImportBusy,customThemeImportMessage:e.customThemeImportMessage,customThemeImportExpanded:e.customThemeImportExpanded,customThemeImportFocusToken:e.customThemeImportFocusToken,onCustomThemeImportUrlChange:t=>e.setCustomThemeImportUrl(t),onOpenCustomThemeImport:()=>e.openCustomThemeImport(),onImportCustomTheme:()=>void e.importCustomTheme(),onClearCustomTheme:()=>e.clearCustomTheme(),borderRadius:e.settings.borderRadius,setBorderRadius:t=>e.setBorderRadius(t),textScale:e.settings.textScale??100,setTextScale:t=>e.setTextScale(t),gatewayUrl:e.settings.gatewayUrl,assistantName:e.assistantName,configPath:e.configSnapshot?.path??null,rawAvailable:typeof e.configSnapshot?.raw==`string`||!!e.configSnapshot?.config||!!e.configForm},Ee=t=>{let n=t.includeSections?.[0]??null,r=t.activeSection??n,i=t.showRootTab??!t.includeSections?.length;return nH(e,`config`,{tab:e.tab,formMode:t.formMode,activeSection:r,activeSubsection:t.activeSubsection,schemaSectionCount:tH(Te.schema,t.includeSections,t.excludeSections),hasSearch:!!t.searchQuery?.trim()},()=>UR({...Te,includeVirtualSections:!1,...t,activeSection:r,showRootTab:i}))},De=$V(e.configActiveSection,e.configActiveSubsection),Oe=eH(e.communicationsActiveSection,e.communicationsActiveSubsection,qV),ke=eH(e.appearanceActiveSection,e.appearanceActiveSubsection,JV),Ae=eH(e.automationActiveSection,e.automationActiveSubsection,YV),je=eH(e.infrastructureActiveSection,e.infrastructureActiveSubsection,XV),Me=eH(e.aiAgentsActiveSection,e.aiAgentsActiveSubsection,ZV),Ne=()=>{switch(e.tab){case`config`:if(e.configSettingsMode===`quick`){let t=e.configForm??e.configSnapshot?.config??{},r=y??iH(t),i=t.agents?.defaults??{},a=dH(e),o=typeof a?.model==`string`?a.model:typeof i.model==`string`?i.model:`default`,s=typeof a?.thinkingLevel==`string`?a.thinkingLevel:typeof i.thinkingLevel==`string`?i.thinkingLevel:`off`,c=typeof a?.fastMode==`boolean`?a.fastMode:i.fastMode===!0;return yL({currentModel:o,thinkingLevel:s,fastMode:c,onModelChange:()=>{e.configSettingsMode=`advanced`,e.aiAgentsActiveSection=`models`,e.setTab(`aiAgents`)},onThinkingChange:t=>{qm(e,e.sessionKey,{thinkingLevel:t}).then(()=>n?.())},onFastModeToggle:()=>{qm(e,e.sessionKey,{fastMode:!c}).then(()=>n?.())},channels:cH(e),onChannelConfigure:()=>{e.setTab(`channels`)},automation:{cronJobCount:e.cronJobs?.length??0,skillCount:e.skillsReport?.skills?.length??0,mcpServerCount:lH(e)},onManageCron:()=>{e.setTab(`cron`)},onBrowseSkills:()=>{e.setTab(`skills`)},onConfigureMcp:()=>{e.infrastructureActiveSection=`mcp`,e.setTab(`infrastructure`)},security:uH(e),onSecurityConfigure:()=>{e.configSettingsMode=`advanced`,e.configActiveSection=`auth`,n?.()},onBrowserEnabledToggle:t=>{sr(e,[`browser`,`enabled`],t),n?.()},onToolProfileChange:t=>{sr(e,[`tools`,`profile`],t),n?.()},theme:e.theme,themeMode:e.themeMode,hasCustomTheme:!!e.settings.customTheme,customThemeLabel:e.settings.customTheme?.label??null,borderRadius:e.settings.borderRadius,textScale:e.settings.textScale??100,setTheme:(t,n)=>e.setTheme(t,n),onOpenCustomThemeImport:()=>{e.setTab(`appearance`),e.appearanceFormMode=`form`,e.appearanceSearchQuery=``,e.appearanceActiveSection=`__appearance__`,e.appearanceActiveSubsection=null,e.openCustomThemeImport(),n?.()},setThemeMode:(t,n)=>e.setThemeMode(t,n),setBorderRadius:t=>e.setBorderRadius(t),setTextScale:t=>e.setTextScale(t),userAvatar:e.userAvatar??null,onUserAvatarChange:t=>e.applyLocalUserIdentity?.({avatar:t}),assistantAvatar:te,assistantAvatarUrl:A,assistantAvatarSource:ee,assistantAvatarStatus:D,assistantAvatarReason:O,assistantAvatarOverride:r,assistantAvatarUploadBusy:e.assistantAvatarUploadBusy,assistantAvatarUploadError:e.assistantAvatarUploadError,onAssistantAvatarOverrideChange:t=>{GA(e,t),e.chatAvatarUrl=t,e.chatAvatarSource=t,e.chatAvatarStatus=`data`,e.chatAvatarReason=null,e.assistantAvatarUploadError=null,n?.()},onAssistantAvatarClearOverride:()=>{GA(e,null),e.chatAvatarUrl=null,e.chatAvatarSource=null,e.chatAvatarStatus=null,e.chatAvatarReason=null,e.assistantAvatarUploadError=null,e.loadAssistantIdentity?.().finally(()=>n?.()),n?.()},basePath:e.basePath??``,configObject:t,savedConfigObject:e.configSnapshot?.config??{},configDirty:e.configFormDirty,configSaving:e.configSaving,configApplying:e.configApplying,configReady:!!e.configSnapshot?.hash,onSelectPreset:t=>{let r=zI(t);r&&(lr(e,r.patch),n?.())},onResetConfig:()=>ur(e),onSaveConfig:()=>er(e),onApplyConfig:()=>tr(e),onAdvancedSettings:()=>{e.configSettingsMode=`advanced`,n?.()},connected:e.connected,gatewayUrl:e.settings.gatewayUrl,assistantName:e.assistantName,version:e.hello?.server?.version??``})}return Ee({formMode:e.configFormMode,searchQuery:e.configSearchQuery,activeSection:De.activeSection,activeSubsection:De.activeSubsection,onFormModeChange:t=>e.configFormMode=t,onSearchChange:t=>e.configSearchQuery=t,onSectionChange:t=>{e.configActiveSection=t,e.configActiveSubsection=null},onSubsectionChange:t=>e.configActiveSubsection=t,showModeToggle:!0,settingsLayout:`accordion`,onBackToQuick:()=>{e.configSettingsMode=`quick`,n?.()},excludeSections:[...qV,...YV,...XV,...ZV,`ui`,`wizard`]});case`channels`:return pI(EV,t=>t.renderChannels({connected:e.connected,loading:e.channelsLoading,snapshot:e.channelsSnapshot,lastError:e.channelsError,lastSuccessAt:e.channelsLastSuccess,configSchema:e.configSchema,configSchemaLoading:e.configSchemaLoading,configForm:e.configForm,configUiHints:e.configUiHints,configSaving:e.configSaving,configFormDirty:e.configFormDirty,onRefresh:t=>Kt(e,t),onConfigPatch:(t,n)=>sr(e,t,n),onConfigSave:()=>e.handleChannelConfigSave(),onConfigReload:()=>e.handleChannelConfigReload()}));case`communications`:return Ee({formMode:e.communicationsFormMode,searchQuery:e.communicationsSearchQuery,activeSection:Oe.activeSection,activeSubsection:Oe.activeSubsection,onFormModeChange:t=>e.communicationsFormMode=t,onSearchChange:t=>e.communicationsSearchQuery=t,onSectionChange:t=>{e.communicationsActiveSection=t,e.communicationsActiveSubsection=null},onSubsectionChange:t=>e.communicationsActiveSubsection=t,navRootLabel:`Communication`,includeSections:[...qV],includeVirtualSections:!0,webPush:{supported:e.webPushSupported,permission:e.webPushPermission,subscribed:e.webPushSubscribed,loading:e.webPushLoading},onWebPushSubscribe:()=>e.handleWebPushSubscribe(),onWebPushUnsubscribe:()=>e.handleWebPushUnsubscribe(),onWebPushTest:()=>e.handleWebPushTest()});case`appearance`:return Ee({formMode:e.appearanceFormMode,searchQuery:e.appearanceSearchQuery,activeSection:ke.activeSection,activeSubsection:ke.activeSubsection,onFormModeChange:t=>e.appearanceFormMode=t,onSearchChange:t=>e.appearanceSearchQuery=t,onSectionChange:t=>{e.appearanceActiveSection=t,e.appearanceActiveSubsection=null},onSubsectionChange:t=>e.appearanceActiveSubsection=t,navRootLabel:v(`tabs.appearance`),includeSections:[...JV],includeVirtualSections:!0});case`automation`:return Ee({formMode:e.automationFormMode,searchQuery:e.automationSearchQuery,activeSection:Ae.activeSection,activeSubsection:Ae.activeSubsection,onFormModeChange:t=>e.automationFormMode=t,onSearchChange:t=>e.automationSearchQuery=t,onSectionChange:t=>{e.automationActiveSection=t,e.automationActiveSubsection=null},onSubsectionChange:t=>e.automationActiveSubsection=t,navRootLabel:`Automation`,includeSections:[...YV]});case`infrastructure`:return Ee({formMode:e.infrastructureFormMode,searchQuery:e.infrastructureSearchQuery,activeSection:je.activeSection,activeSubsection:je.activeSubsection,onFormModeChange:t=>e.infrastructureFormMode=t,onSearchChange:t=>e.infrastructureSearchQuery=t,onSectionChange:t=>{e.infrastructureActiveSection=t,e.infrastructureActiveSubsection=null},onSubsectionChange:t=>e.infrastructureActiveSubsection=t,navRootLabel:v(`settings.section.web`),includeSections:[...XV]});case`aiAgents`:return Ee({formMode:e.aiAgentsFormMode,searchQuery:e.aiAgentsSearchQuery,activeSection:Me.activeSection,activeSubsection:Me.activeSubsection,onFormModeChange:t=>e.aiAgentsFormMode=t,onSearchChange:t=>e.aiAgentsSearchQuery=t,onSectionChange:t=>{e.aiAgentsActiveSection=t,e.aiAgentsActiveSubsection=null},onSubsectionChange:t=>e.aiAgentsActiveSubsection=t,navRootLabel:`AI & Agents`,includeSections:[...ZV]});default:return i}},Pe=t=>{if(t)switch(e.agentsPanel){case`files`:__(e,t);return;case`skills`:S_(e,t);return;case`tools`:E_(e,t),A_(e);return;case`overview`:case`channels`:case`cron`:return}},Fe=t=>{if(t===`channels`){Kt(e,!1);return}t===`cron`&&e.loadCron()},Ie=(t=!1)=>{e.agentFilesList=null,e.agentFilesError=null,e.agentFileActive=null,e.agentFileContents={},e.agentFileDrafts={},t&&(e.agentFilesLoading=!1)},Le=()=>{Ie(!0),e.agentSkillsReport=null,e.agentSkillsError=null,e.agentSkillsAgentId=null,e.toolsCatalogResult=null,e.toolsCatalogError=null,e.toolsCatalogLoading=!1,O_(e)};return d`
|
|
7007
|
+
`}var wV=dI(()=>hV(()=>import(`./agents-U_KSP5I_.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url),_V),TV=dI(()=>hV(()=>import(`./activity-D-mnRThU.js`),__vite__mapDeps([8,1,4,5]),import.meta.url),_V),EV=dI(()=>hV(()=>import(`./channels-ohK9_G1O.js`),__vite__mapDeps([9,1,5,6]),import.meta.url),_V),DV=dI(()=>hV(()=>import(`./cron-6ZCzfU29.js`),__vite__mapDeps([10,1,5]),import.meta.url),_V),OV=dI(()=>hV(()=>import(`./debug-CSsDLg_s.js`),__vite__mapDeps([11,1,5]),import.meta.url),_V),kV=dI(()=>hV(()=>import(`./instances-782ZoDT4.js`),__vite__mapDeps([12,1,5]),import.meta.url),_V),AV=dI(()=>hV(()=>import(`./logs-atEFsTJJ.js`),__vite__mapDeps([13,1,4,5]),import.meta.url),_V),jV=dI(()=>hV(()=>import(`./nodes-BMX16BKM.js`),__vite__mapDeps([14,1,4,5]),import.meta.url),_V),MV=dI(()=>hV(()=>import(`./sessions-jLGSApYa.js`),__vite__mapDeps([15,1,4,5]),import.meta.url),_V),NV=dI(()=>hV(()=>import(`./skills-DweBwUhs.js`),__vite__mapDeps([16,1,4,5,7]),import.meta.url),_V),PV=dI(()=>hV(()=>import(`./workboard-BsU-FXIo.js`),__vite__mapDeps([17,1,5]),import.meta.url),_V);function FV(e){return typeof e!=`number`||!Number.isFinite(e)?null:new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function IV(e){if(!e?.phases)return null;let t;for(let n of Object.values(e.phases))!n.enabled||typeof n.nextRunAtMs!=`number`||(t===void 0||n.nextRunAtMs<t)&&(t=n.nextRunAtMs);return FV(t)}var LV=null,RV=`fengming:control-ui:update-banner-dismissed:v1`,zV=[`off`,`minimal`,`low`,`medium`,`high`],BV=[`UTC`,`America/Los_Angeles`,`America/Denver`,`America/Chicago`,`America/New_York`,`Europe/London`,`Europe/Berlin`,`Asia/Tokyo`];function VV(e){return/^https?:\/\//i.test(e.trim())}function HV(e){return typeof e==`string`?e.trim():``}function UV(e){let t=new Set,n=[];for(let r of e){let e=r.trim();if(!e)continue;let i=e.toLowerCase();t.has(i)||(t.add(i),n.push(e))}return n}function WV(){try{let e=et()?.getItem(RV);if(!e)return null;let t=JSON.parse(e);return!t||typeof t.latestVersion!=`string`?null:{latestVersion:t.latestVersion,channel:typeof t.channel==`string`?t.channel:null,dismissedAtMs:typeof t.dismissedAtMs==`number`?t.dismissedAtMs:Date.now()}}catch{return null}}function GV(e){let t=WV();if(!t)return!1;let n=e,r=n&&typeof n.latestVersion==`string`?n.latestVersion:null,i=n&&typeof n.channel==`string`?n.channel:null;return!!(r&&t.latestVersion===r&&t.channel===i)}function KV(e){let t=e,n=t&&typeof t.latestVersion==`string`?t.latestVersion:null;if(!n)return;let r={latestVersion:n,channel:t&&typeof t.channel==`string`?t.channel:null,dismissedAtMs:Date.now()};try{et()?.setItem(RV,JSON.stringify(r))}catch{}}var qV=[`messages`,`broadcast`,`__notifications__`,`talk`,`audio`,`channels`],JV=[`__appearance__`,`ui`,`wizard`],YV=[`commands`,`hooks`,`bindings`,`cron`,`approvals`,`plugins`],XV=[`gateway`,`web`,`browser`,`nodeHost`,`canvasHost`,`discovery`,`media`,`acp`,`mcp`],ZV=[`agents`,`models`,`skills`,`tools`,`memory`,`session`],QV=new Set([...qV,...JV,...YV,...XV,...ZV]);function $V(e,t){return e&&QV.has(e)?{activeSection:null,activeSubsection:null}:{activeSection:e,activeSubsection:t}}function eH(e,t,n){return e&&!n.includes(e)?{activeSection:null,activeSubsection:null}:{activeSection:e,activeSubsection:t}}function tH(e,t,n){if(!e||typeof e!=`object`||Array.isArray(e))return 0;let r=e.properties;if(!r||typeof r!=`object`||Array.isArray(r))return 0;let i=t?.length?new Set(t):null,a=n?.length?new Set(n):null;return Object.keys(r).filter(e=>!(i&&!i.has(e)||a?.has(e))).length}function nH(e,t,n,r){let i=Qg(),a=r();return u_(e,t,{...n,durationMs:$g(Qg()-i)}),a}function rH(e){let t=e.agentsList?.agents??[],n=z(e.sessionKey)?.agentId??e.agentsList?.defaultId??`main`,r=t.find(e=>e.id===n)?.identity,i=r?.avatarUrl??r?.avatar;if(i&&va(i))return i}function iH(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.ui;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.assistant;return!n||typeof n!=`object`||Array.isArray(n)?null:T(n.avatar)??null}function aH(e,t){let n=fi(e??``),r=encodeURIComponent(t);return n?`${n}/avatar/${r}`:`/avatar/${r}`}var oH=[{id:`weixin`,label:`微信`},{id:`qqbot`,label:`QQ`},{id:`feishu`,label:`飞书`},{id:`webhooks`,label:`Webhooks`}];function sH(e){let t=e.trim();return t?t.split(/[-_]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `):`Unknown`}function cH(e){let t=e.configForm??e.configSnapshot?.config;if(!t||typeof t!=`object`)return[];let n=`channels`in t&&t.channels&&typeof t.channels==`object`?t.channels:{},r=Object.keys(n).filter(e=>e.trim().length>0),i=r.length>0?r.toSorted((e,t)=>e.localeCompare(t)):oH.map(({id:e})=>e),a=new Map(oH.map(({id:e,label:t})=>[e,t])),o=[];for(let e of i){let t=n[e],r=typeof t==`object`&&!!t&&Object.keys(t).length>0;o.push({id:e,label:a.get(e)??sH(e),connected:r,detail:r?`Configured`:void 0})}return o}function lH(e){let t=e.configForm??e.configSnapshot?.config;if(!t||typeof t!=`object`)return 0;let n=t.mcp;if(!n||typeof n!=`object`)return 0;let r=`servers`in n&&n.servers&&typeof n.servers==`object`?n.servers:{};return Object.keys(r).length}function uH(e){let t=e.configForm??e.configSnapshot?.config;if(!t||typeof t!=`object`)return{gatewayAuth:`unknown`,execPolicy:`unknown`,deviceAuth:!1,browserEnabled:!0,toolProfile:`full`};let n=t,r=`gateway`in n&&n.gateway&&typeof n.gateway==`object`?n.gateway:null,i=r&&`auth`in r&&r.auth&&typeof r.auth==`object`?r.auth:null,a=`unknown`;i&&(a=(typeof i.mode==`string`?i.mode.trim():``)||(i.password?`password`:i.token?`token`:i.trustedProxy?`trusted-proxy`:`none`));let o=`allowlist`,s=`full`,c=n.tools;if(c&&typeof c==`object`){let e=c.profile;if(typeof e==`string`){let t=e.trim();t&&(s=t)}let t=c.exec;if(t&&typeof t==`object`){let e=t.security;if(typeof e==`string`){let t=e.trim();t&&(o=t)}}}let l=!0,u=`browser`in n&&n.browser&&typeof n.browser==`object`?n.browser:null;u&&typeof u.enabled==`boolean`&&(l=u.enabled);let d=!0;return r&&(`controlUi`in r&&r.controlUi&&typeof r.controlUi==`object`?r.controlUi:null)?.dangerouslyDisableDeviceAuth===!0&&(d=!1),{gatewayAuth:a,execPolicy:o,deviceAuth:d,browserEnabled:l,toolProfile:s}}function dH(e){return e.sessionsResult?.sessions?.find(t=>t.key===e.sessionKey)}function fH(e,t){return nz({open:e.cronQuickCreateOpen,step:e.cronQuickCreateStep,draft:e.cronQuickCreateDraft??KR(),onDraftChange:n=>{e.cronQuickCreateDraft={...e.cronQuickCreateDraft??KR(),...n},t?.()},onStepChange:n=>{e.cronQuickCreateStep=n,t?.()},onCreate:()=>{let n=JR(e.cronQuickCreateDraft??KR());e.cronEditingJobId=null,e.cronForm={...hg,...n},t?.(),(async()=>{if(!await cv(e)){t?.();return}e.cronQuickCreateOpen=!1,e.cronQuickCreateStep=`what`,e.cronQuickCreateDraft=null,t?.()})()},onAdvancedCreate:()=>{let n=JR(e.cronQuickCreateDraft??KR());e.cronEditingJobId=null,e.cronForm=B_({...hg,...n}),e.cronFieldErrors=V_(e.cronForm),e.cronQuickCreateOpen=!1,e.cronQuickCreateStep=`what`,e.cronQuickCreateDraft=null,e.cronFormCollapsed=!1,t?.()},onCancel:()=>{e.cronQuickCreateOpen=!1,e.cronQuickCreateStep=`what`,e.cronQuickCreateDraft=null,t?.()}})}function pH(e){let t=e,n=typeof t.requestUpdate==`function`?()=>t.requestUpdate?.():void 0;if(gV=n,!e.connected)return d` ${HB(e)} ${kB(e)} `;let r=e.presenceEntries.length,a=e.sessionsResult?.count??null,o=e.cronStatus?.nextWakeAtMs??null,s=e.connected?null:v(`chat.disconnected`),c=e.tab===`chat`,u=c&&(e.settings.chatFocusMode||e.onboarding),f=c&&(u||e.chatHeaderControlsHidden),p=e.navDrawerOpen&&!u&&!e.onboarding,m=e.settings.navCollapsed&&!p,h=WN(e),g=e.onboarding?!1:e.settings.chatShowThinking,_=e.onboarding?!0:e.settings.chatShowToolCalls,y=T(Mo().avatar)??null,b=rH(e),x=y?`data`:e.chatAvatarStatus??e.assistantAvatarStatus??null,S=y?null:e.chatAvatarReason??e.assistantAvatarReason??null,C=x===`none`&&S===`missing`,w=y??(C?null:e.assistantAvatar),E=y??e.chatAvatarUrl??(C?null:b??null),D=y?`data`:e.assistantAvatarStatus??e.chatAvatarStatus??null,O=y?null:e.assistantAvatarReason??e.chatAvatarReason??null,ee=y??e.assistantAvatarSource??e.chatAvatarSource??null,k=D===`none`&&O===`missing`,te=y??(k||D===`local`?null:e.assistantAvatar),A=y??(D===`local`&&e.assistantAgentId?aH(e.basePath,e.assistantAgentId):e.chatAvatarUrl??(k?null:b??null)),j=e.configForm??e.configSnapshot?.config,M=zv(j),N=e.dreamingStatus?.enabled??M.enabled,P=IV(e.dreamingStatus),F=e.dreamingStatusLoading||e.dreamingModeSaving,ne=e.dreamingStatusLoading||e.dreamDiaryLoading,re=()=>{(async()=>{await Un(e),await Promise.all([ey(e),ty(e),ny(e),ry(e)])})()},ie=async t=>{if(!e.client||!e.connected)return null;let n=await e.client.request(`wiki.get`,{lookup:t,fromLine:1,lineCount:5e3}),r=typeof n?.title==`string`&&n.title.trim()?n.title.trim():t,i=typeof n?.path==`string`&&n.path.trim()?n.path.trim():t,a=typeof n?.content==`string`&&n.content.length>0?n.content:v(`wiki.noContent`),o=typeof n?.updatedAt==`string`&&n.updatedAt.trim()?n.updatedAt.trim():void 0,s=typeof n?.totalLines==`number`&&Number.isFinite(n.totalLines)?Math.max(0,Math.floor(n.totalLines)):void 0,c=n?.truncated===!0;return{title:r,path:i,content:a,...s===void 0?{}:{totalLines:s},...c?{truncated:c}:{},...o?{updatedAt:o}:{}}},ae=t=>{e.dreamingModeSaving||e.dreamingRestartConfirmLoading||e.dreamingRestartConfirmOpen||N===t||(e.dreamingPendingEnabled=t,e.dreamingRestartConfirmOpen=!0,e.dreamingStatusError=null)},oe=()=>{e.dreamingRestartConfirmLoading||(e.dreamingRestartConfirmOpen=!1,e.dreamingPendingEnabled=null,e.dreamingStatusError=null)},se=()=>{let t=e.dreamingPendingEnabled;t==null||e.dreamingRestartConfirmLoading||(async()=>{e.dreamingRestartConfirmLoading=!0,e.dreamingStatusError=null;try{if(!await hy(e,t)){e.dreamingStatusError||=v(`dreaming.restartConfirmation.failed`);return}await Un(e),await ey(e),e.dreamingRestartConfirmOpen=!1,e.dreamingPendingEnabled=null}finally{e.dreamingRestartConfirmLoading=!1}})()},ce=fi(e.basePath??``),le=()=>e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id??null,I=le(),ue=Xc(e.sessionKey),de=!!(I&&ue&&I===ue),fe=()=>e.configForm??e.configSnapshot?.config,L=e=>fr(fe(),e),pe=t=>pr(e,t),me=(e,t)=>{let n=t?pe(e):L(e);return n>=0?[`agents`,`list`,n,`tools`]:null},he=e=>{let t=fe()?.agents?.list,n=Array.isArray(t)?t[e]?.model:void 0;return{basePath:[`agents`,`list`,e,`model`],existing:n}},ge=za(new Set([...e.agentsList?.agents?.map(e=>e.id.trim())??[],...e.cronJobs.map(e=>typeof e.agentId==`string`?e.agentId.trim():``).filter(Boolean)].filter(Boolean))),_e=za(new Set([...e.cronModelSuggestions,...Ba(j),...e.cronJobs.map(e=>{let t=F_(e);return t?.kind!==`agentTurn`||typeof t.model!=`string`?``:t.model.trim()}).filter(Boolean)].filter(Boolean))),ve=Y_(e),ye=e.cronForm.deliveryChannel&&e.cronForm.deliveryChannel.trim()?e.cronForm.deliveryChannel.trim():`last`,be=e.cronJobs.map(e=>HV(e.delivery?.to)).filter(Boolean),xe=(ye===`last`?Object.values(e.channelsSnapshot?.channelAccounts??{}).flat():e.channelsSnapshot?.channelAccounts?.[ye]??[]).flatMap(e=>[HV(e.accountId),HV(e.name)]).filter(Boolean),Se=UV([...be,...xe]),Ce=UV(xe),we=e.cronForm.deliveryMode===`webhook`?Se.filter(e=>VV(e)):Se,Te={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,formValue:e.configForm,originalValue:e.configFormOriginal,onRawChange:t=>{cr(e,t)},onRequestUpdate:n,onFormPatch:(t,n)=>sr(e,t,n),onReload:()=>Un(e,{discardPendingChanges:!0}),onReset:()=>ur(e),onSave:()=>er(e),onApply:()=>tr(e),onUpdate:()=>nr(e),onOpenFile:()=>hr(e),version:e.hello?.server?.version??``,theme:e.theme,themeMode:e.themeMode,setTheme:(t,n)=>e.setTheme(t,n),setThemeMode:(t,n)=>e.setThemeMode(t,n),hasCustomTheme:!!e.settings.customTheme,customThemeLabel:e.settings.customTheme?.label??null,customThemeSourceUrl:e.settings.customTheme?.sourceUrl??null,customThemeImportUrl:e.customThemeImportUrl,customThemeImportBusy:e.customThemeImportBusy,customThemeImportMessage:e.customThemeImportMessage,customThemeImportExpanded:e.customThemeImportExpanded,customThemeImportFocusToken:e.customThemeImportFocusToken,onCustomThemeImportUrlChange:t=>e.setCustomThemeImportUrl(t),onOpenCustomThemeImport:()=>e.openCustomThemeImport(),onImportCustomTheme:()=>void e.importCustomTheme(),onClearCustomTheme:()=>e.clearCustomTheme(),borderRadius:e.settings.borderRadius,setBorderRadius:t=>e.setBorderRadius(t),textScale:e.settings.textScale??100,setTextScale:t=>e.setTextScale(t),gatewayUrl:e.settings.gatewayUrl,assistantName:e.assistantName,configPath:e.configSnapshot?.path??null,rawAvailable:typeof e.configSnapshot?.raw==`string`||!!e.configSnapshot?.config||!!e.configForm},Ee=t=>{let n=t.includeSections?.[0]??null,r=t.activeSection??n,i=t.showRootTab??!t.includeSections?.length;return nH(e,`config`,{tab:e.tab,formMode:t.formMode,activeSection:r,activeSubsection:t.activeSubsection,schemaSectionCount:tH(Te.schema,t.includeSections,t.excludeSections),hasSearch:!!t.searchQuery?.trim()},()=>UR({...Te,includeVirtualSections:!1,...t,activeSection:r,showRootTab:i}))},De=$V(e.configActiveSection,e.configActiveSubsection),Oe=eH(e.communicationsActiveSection,e.communicationsActiveSubsection,qV),ke=eH(e.appearanceActiveSection,e.appearanceActiveSubsection,JV),Ae=eH(e.automationActiveSection,e.automationActiveSubsection,YV),je=eH(e.infrastructureActiveSection,e.infrastructureActiveSubsection,XV),Me=eH(e.aiAgentsActiveSection,e.aiAgentsActiveSubsection,ZV),Ne=()=>{switch(e.tab){case`config`:if(e.configSettingsMode===`quick`){let t=e.configForm??e.configSnapshot?.config??{},r=y??iH(t),i=t.agents?.defaults??{},a=dH(e),o=typeof a?.model==`string`?a.model:typeof i.model==`string`?i.model:`default`,s=typeof a?.thinkingLevel==`string`?a.thinkingLevel:typeof i.thinkingLevel==`string`?i.thinkingLevel:`off`,c=typeof a?.fastMode==`boolean`?a.fastMode:i.fastMode===!0;return yL({currentModel:o,thinkingLevel:s,fastMode:c,onModelChange:()=>{e.configSettingsMode=`advanced`,e.aiAgentsActiveSection=`models`,e.setTab(`aiAgents`)},onThinkingChange:t=>{qm(e,e.sessionKey,{thinkingLevel:t}).then(()=>n?.())},onFastModeToggle:()=>{qm(e,e.sessionKey,{fastMode:!c}).then(()=>n?.())},channels:cH(e),onChannelConfigure:()=>{e.setTab(`channels`)},automation:{cronJobCount:e.cronJobs?.length??0,skillCount:e.skillsReport?.skills?.length??0,mcpServerCount:lH(e)},onManageCron:()=>{e.setTab(`cron`)},onBrowseSkills:()=>{e.setTab(`skills`)},onConfigureMcp:()=>{e.infrastructureActiveSection=`mcp`,e.setTab(`infrastructure`)},security:uH(e),onSecurityConfigure:()=>{e.configSettingsMode=`advanced`,e.configActiveSection=`auth`,n?.()},onBrowserEnabledToggle:t=>{sr(e,[`browser`,`enabled`],t),n?.()},onToolProfileChange:t=>{sr(e,[`tools`,`profile`],t),n?.()},theme:e.theme,themeMode:e.themeMode,hasCustomTheme:!!e.settings.customTheme,customThemeLabel:e.settings.customTheme?.label??null,borderRadius:e.settings.borderRadius,textScale:e.settings.textScale??100,setTheme:(t,n)=>e.setTheme(t,n),onOpenCustomThemeImport:()=>{e.setTab(`appearance`),e.appearanceFormMode=`form`,e.appearanceSearchQuery=``,e.appearanceActiveSection=`__appearance__`,e.appearanceActiveSubsection=null,e.openCustomThemeImport(),n?.()},setThemeMode:(t,n)=>e.setThemeMode(t,n),setBorderRadius:t=>e.setBorderRadius(t),setTextScale:t=>e.setTextScale(t),userAvatar:e.userAvatar??null,onUserAvatarChange:t=>e.applyLocalUserIdentity?.({avatar:t}),assistantAvatar:te,assistantAvatarUrl:A,assistantAvatarSource:ee,assistantAvatarStatus:D,assistantAvatarReason:O,assistantAvatarOverride:r,assistantAvatarUploadBusy:e.assistantAvatarUploadBusy,assistantAvatarUploadError:e.assistantAvatarUploadError,onAssistantAvatarOverrideChange:t=>{GA(e,t),e.chatAvatarUrl=t,e.chatAvatarSource=t,e.chatAvatarStatus=`data`,e.chatAvatarReason=null,e.assistantAvatarUploadError=null,n?.()},onAssistantAvatarClearOverride:()=>{GA(e,null),e.chatAvatarUrl=null,e.chatAvatarSource=null,e.chatAvatarStatus=null,e.chatAvatarReason=null,e.assistantAvatarUploadError=null,e.loadAssistantIdentity?.().finally(()=>n?.()),n?.()},basePath:e.basePath??``,configObject:t,savedConfigObject:e.configSnapshot?.config??{},configDirty:e.configFormDirty,configSaving:e.configSaving,configApplying:e.configApplying,configReady:!!e.configSnapshot?.hash,onSelectPreset:t=>{let r=zI(t);r&&(lr(e,r.patch),n?.())},onResetConfig:()=>ur(e),onSaveConfig:()=>er(e),onApplyConfig:()=>tr(e),onAdvancedSettings:()=>{e.configSettingsMode=`advanced`,n?.()},connected:e.connected,gatewayUrl:e.settings.gatewayUrl,assistantName:e.assistantName,version:e.hello?.server?.version??``})}return Ee({formMode:e.configFormMode,searchQuery:e.configSearchQuery,activeSection:De.activeSection,activeSubsection:De.activeSubsection,onFormModeChange:t=>e.configFormMode=t,onSearchChange:t=>e.configSearchQuery=t,onSectionChange:t=>{e.configActiveSection=t,e.configActiveSubsection=null},onSubsectionChange:t=>e.configActiveSubsection=t,showModeToggle:!0,settingsLayout:`accordion`,onBackToQuick:()=>{e.configSettingsMode=`quick`,n?.()},excludeSections:[...qV,...YV,...XV,...ZV,`ui`,`wizard`]});case`channels`:return pI(EV,t=>t.renderChannels({connected:e.connected,loading:e.channelsLoading,snapshot:e.channelsSnapshot,lastError:e.channelsError,lastSuccessAt:e.channelsLastSuccess,configSchema:e.configSchema,configSchemaLoading:e.configSchemaLoading,configForm:e.configForm,configUiHints:e.configUiHints,configSaving:e.configSaving,configFormDirty:e.configFormDirty,onRefresh:t=>Kt(e,t),onConfigPatch:(t,n)=>sr(e,t,n),onConfigSave:()=>e.handleChannelConfigSave(),onConfigReload:()=>e.handleChannelConfigReload()}));case`communications`:return Ee({formMode:e.communicationsFormMode,searchQuery:e.communicationsSearchQuery,activeSection:Oe.activeSection,activeSubsection:Oe.activeSubsection,onFormModeChange:t=>e.communicationsFormMode=t,onSearchChange:t=>e.communicationsSearchQuery=t,onSectionChange:t=>{e.communicationsActiveSection=t,e.communicationsActiveSubsection=null},onSubsectionChange:t=>e.communicationsActiveSubsection=t,navRootLabel:`Communication`,includeSections:[...qV],includeVirtualSections:!0,webPush:{supported:e.webPushSupported,permission:e.webPushPermission,subscribed:e.webPushSubscribed,loading:e.webPushLoading},onWebPushSubscribe:()=>e.handleWebPushSubscribe(),onWebPushUnsubscribe:()=>e.handleWebPushUnsubscribe(),onWebPushTest:()=>e.handleWebPushTest()});case`appearance`:return Ee({formMode:e.appearanceFormMode,searchQuery:e.appearanceSearchQuery,activeSection:ke.activeSection,activeSubsection:ke.activeSubsection,onFormModeChange:t=>e.appearanceFormMode=t,onSearchChange:t=>e.appearanceSearchQuery=t,onSectionChange:t=>{e.appearanceActiveSection=t,e.appearanceActiveSubsection=null},onSubsectionChange:t=>e.appearanceActiveSubsection=t,navRootLabel:v(`tabs.appearance`),includeSections:[...JV],includeVirtualSections:!0});case`automation`:return Ee({formMode:e.automationFormMode,searchQuery:e.automationSearchQuery,activeSection:Ae.activeSection,activeSubsection:Ae.activeSubsection,onFormModeChange:t=>e.automationFormMode=t,onSearchChange:t=>e.automationSearchQuery=t,onSectionChange:t=>{e.automationActiveSection=t,e.automationActiveSubsection=null},onSubsectionChange:t=>e.automationActiveSubsection=t,navRootLabel:`Automation`,includeSections:[...YV]});case`infrastructure`:return Ee({formMode:e.infrastructureFormMode,searchQuery:e.infrastructureSearchQuery,activeSection:je.activeSection,activeSubsection:je.activeSubsection,onFormModeChange:t=>e.infrastructureFormMode=t,onSearchChange:t=>e.infrastructureSearchQuery=t,onSectionChange:t=>{e.infrastructureActiveSection=t,e.infrastructureActiveSubsection=null},onSubsectionChange:t=>e.infrastructureActiveSubsection=t,navRootLabel:v(`settings.section.web`),includeSections:[...XV]});case`aiAgents`:return Ee({formMode:e.aiAgentsFormMode,searchQuery:e.aiAgentsSearchQuery,activeSection:Me.activeSection,activeSubsection:Me.activeSubsection,onFormModeChange:t=>e.aiAgentsFormMode=t,onSearchChange:t=>e.aiAgentsSearchQuery=t,onSectionChange:t=>{e.aiAgentsActiveSection=t,e.aiAgentsActiveSubsection=null},onSubsectionChange:t=>e.aiAgentsActiveSubsection=t,navRootLabel:`AI & Agents`,includeSections:[...ZV]});default:return i}},Pe=t=>{if(t)switch(e.agentsPanel){case`files`:__(e,t);return;case`skills`:S_(e,t);return;case`tools`:E_(e,t),A_(e);return;case`overview`:case`channels`:case`cron`:return}},Fe=t=>{if(t===`channels`){Kt(e,!1);return}t===`cron`&&e.loadCron()},Ie=(t=!1)=>{e.agentFilesList=null,e.agentFilesError=null,e.agentFileActive=null,e.agentFileContents={},e.agentFileDrafts={},t&&(e.agentFilesLoading=!1)},Le=()=>{Ie(!0),e.agentSkillsReport=null,e.agentSkillsError=null,e.agentSkillsAgentId=null,e.toolsCatalogResult=null,e.toolsCatalogError=null,e.toolsCatalogLoading=!1,O_(e)};return d`
|
|
7008
7008
|
${LI({open:e.paletteOpen,query:e.paletteQuery,activeIndex:e.paletteActiveIndex,onToggle:()=>{e.paletteOpen=!e.paletteOpen},onQueryChange:t=>{e.paletteQuery=t},onActiveIndexChange:t=>{e.paletteActiveIndex=t},onNavigate:t=>{e.setTab(t)},onSlashCommand:t=>{e.setTab(`chat`),e.handleChatDraftChange(t.endsWith(` `)?t:`${t} `)}})}
|
|
7009
7009
|
<div
|
|
7010
7010
|
class="shell ${c?`shell--chat`:``} ${u?`shell--chat-focus`:``} ${m?`shell--nav-collapsed`:``} ${p?`shell--nav-drawer-open`:``} ${e.onboarding?`shell--onboarding`:``}"
|
|
@@ -7210,5 +7210,5 @@ ${e.pluginDescription}</pre
|
|
|
7210
7210
|
|
|
7211
7211
|
`).trim()}function eU(e){return new Promise((t,n)=>{if(e.signal?.aborted){n(new DOMException(`FengMing tool call aborted`,`AbortError`));return}let r=window.setTimeout(()=>{o(),n(Error(`FengMing tool call timed out`))},e.timeoutMs),i=()=>{o(),n(new DOMException(`FengMing tool call aborted`,`AbortError`))};e.signal?.addEventListener(`abort`,i,{once:!0});let a=()=>void 0;a=e.client.addEventListener(r=>{if(r.event!==`chat`)return;let i=r.payload;!i||i.runId!==e.runId||(tU(e.emitTalkEvent,i),i.state===`final`?(o(),t($H(i.message)||`FengMing finished with no text.`)):i.state===`aborted`?(o(),n(new DOMException(i.errorMessage??`FengMing tool call aborted`,`AbortError`))):i.state===`error`&&(o(),n(Error(i.errorMessage??`FengMing tool call failed`))))});function o(){window.clearTimeout(r),e.signal?.removeEventListener(`abort`,i),a()}})}function tU(e,t){if(!e||t.stream!==`tool`)return;let n=t.data&&typeof t.data==`object`?t.data:{},r=typeof n.phase==`string`?n.phase:void 0,i=typeof n.name==`string`?n.name:void 0;e({type:`tool.progress`,callId:typeof n.toolCallId==`string`?n.toolCallId:void 0,payload:{runId:t.runId,...i?{name:i}:{},...r?{phase:r}:{}}})}async function nU(e){let t=e.text.trim();if(!t)return;let n=e.sessionId&&e.sessionId.trim()?e.ctx.client.request(`talk.session.steer`,{sessionId:e.sessionId,sessionKey:e.ctx.sessionKey,text:t,...e.mode?{mode:e.mode}:{}}):e.ctx.client.request(`talk.client.steer`,{sessionKey:e.ctx.sessionKey,text:t,...e.mode?{mode:e.mode}:{}});try{let t=await n;e.onControlResult?.(t),iU(t,e.speakControlResult,e.suppressSpeechForModes),e.emitTalkEvent?.({type:`tool.progress`,payload:{name:`fengming_agent_control`,result:t},final:t&&typeof t==`object`&&`mode`in t?t.mode===`status`||t.mode===`cancel`:void 0})}catch(t){e.emitTalkEvent?.({type:`tool.error`,payload:{message:t instanceof Error?t.message:String(t)},final:!0})}}async function rU(e){try{let t=KH(e.args),n=e.sessionId&&e.sessionId.trim()?await e.ctx.client.request(`talk.session.steer`,{sessionId:e.sessionId,sessionKey:e.ctx.sessionKey,text:t.text,mode:t.mode}):await e.ctx.client.request(`talk.client.steer`,{sessionKey:e.ctx.sessionKey,text:t.text,mode:t.mode});e.emitTalkEvent?.({type:`tool.progress`,callId:e.callId,payload:{name:`fengming_agent_control`,result:n},final:n&&typeof n==`object`&&`mode`in n?n.mode===`status`||n.mode===`cancel`:void 0}),e.submit(e.callId,n)}catch(t){let n=t instanceof Error?t.message:String(t);e.emitTalkEvent?.({type:`tool.error`,callId:e.callId,payload:{message:n},final:!0}),e.submit(e.callId,{error:n})}}function iU(e,t,n){if(!t||!e||typeof e!=`object`)return;let r=e,i=typeof r.mode==`string`?r.mode:void 0;if(i&&n?.includes(i))return;let a=typeof r.message==`string`?r.message.trim():``;(r.speak===!0&&r.suppress!==!0||r.ok===!0&&i===`steer`&&r.suppress===!0)&&a&&t(JH(a))}async function aU(e){let{ctx:t,callId:n,submit:r}=e;t.callbacks.onStatus?.(`thinking`);let i,a=!1,o=!1,s=e=>{o||(o=!0,r(n,e))},c=()=>{e.submitAbortResult!==!1&&s(YH())},l=()=>{a=!0,i&&t.client.request(`chat.abort`,{sessionKey:t.sessionKey,runId:i})};if(e.signal?.aborted){c();return}e.signal?.addEventListener(`abort`,l,{once:!0});try{let r=typeof e.args==`string`?JSON.parse(e.args||`{}`):e.args??{},a=await t.client.request(`talk.client.toolCall`,{sessionKey:t.sessionKey,callId:n,name:PH,args:r,...e.relaySessionId?{relaySessionId:e.relaySessionId}:{}});if(i=a.runId??a.idempotencyKey,!i)throw Error(`FengMing realtime tool call did not return a run id`);if(e.signal?.aborted){l(),c();return}s({result:await eU({client:t.client,runId:i,timeoutMs:12e4,emitTalkEvent:e.emitTalkEvent,signal:e.signal})})}catch(t){if(a||e.signal?.aborted||oU(t)){c();return}s({error:t instanceof Error?t.message:String(t)})}finally{e.signal?.removeEventListener(`abort`,l),!a&&!e.signal?.aborted&&t.callbacks.onStatus?.(`listening`)}}function oU(e){return typeof DOMException<`u`&&e instanceof DOMException&&e.name===`AbortError`}var sU=.02,cU=.08,lU=2,uU=class{constructor(e,t){this.session=e,this.ctx=t,this.media=null,this.inputContext=null,this.outputContext=null,this.inputSource=null,this.inputProcessor=null,this.unsubscribe=null,this.closed=!1,this.outputQueue=new NH,this.consultAbortControllers=new Map,this.completedToolCalls=new Set,this.cancelRequestedForPlayback=!1,this.speechFramesDuringPlayback=0}async start(){if(!navigator.mediaDevices?.getUserMedia)throw Error(`实时通话需要浏览器麦克风访问`);if(this.session.audio.inputEncoding!==`pcm16`||this.session.audio.outputEncoding!==`pcm16`)throw Error(`网关中继实时通话目前需要 PCM16 音频`);this.closed=!1,this.unsubscribe=this.ctx.client.addEventListener(e=>{e.event===`talk.event`&&this.handleRelayEvent(e.payload)}),this.media=await navigator.mediaDevices.getUserMedia({audio:{autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0}}),this.inputContext=new AudioContext({sampleRate:this.session.audio.inputSampleRateHz}),this.outputContext=new AudioContext({sampleRate:this.session.audio.outputSampleRateHz}),this.startMicrophonePump()}stop(){let e=this.closed;this.stopLocal(),e||this.ctx.client.request(`talk.session.close`,{sessionId:this.session.relaySessionId}).catch(()=>void 0)}stopLocal(){this.closed=!0,this.unsubscribe?.(),this.unsubscribe=null,this.inputProcessor?.disconnect(),this.inputProcessor=null,this.inputSource?.disconnect(),this.inputSource=null,this.abortConsults(),this.media?.getTracks().forEach(e=>e.stop()),this.media=null,this.stopOutput(),this.inputContext?.close(),this.inputContext=null,this.outputContext?.close(),this.outputContext=null}startMicrophonePump(){!this.media||!this.inputContext||(this.inputSource=this.inputContext.createMediaStreamSource(this.media),this.inputProcessor=this.inputContext.createScriptProcessor(4096,1,1),this.inputProcessor.onaudioprocess=e=>{if(this.closed)return;let t=e.inputBuffer.getChannelData(0),n=jH(t);this.detectBargeInSpeech(t)&&this.cancelOutputForBargeIn(),this.ctx.client.request(`talk.session.appendAudio`,{sessionId:this.session.relaySessionId,audioBase64:kH(n),timestamp:Math.round((this.inputContext?.currentTime??0)*1e3)}).catch(e=>{this.closed||(this.ctx.callbacks.onStatus?.(`error`,e instanceof Error?e.message:String(e)),this.stop())})},this.inputSource.connect(this.inputProcessor),this.inputProcessor.connect(this.inputContext.destination))}handleRelayEvent(e){if(!(e.relaySessionId!==this.session.relaySessionId||this.closed))switch(e.talkEvent&&this.ctx.callbacks.onTalkEvent?.(e.talkEvent),e.type){case`ready`:this.ctx.callbacks.onStatus?.(`listening`);return;case`audio`:e.audioBase64&&(this.cancelRequestedForPlayback=!1,this.speechFramesDuringPlayback=0,this.playPcm16(e.audioBase64));return;case`clear`:this.stopOutput();return;case`mark`:this.scheduleMarkAck();return;case`transcript`:e.role&&e.text&&this.ctx.callbacks.onTranscript?.({role:e.role,text:e.text,final:e.final??!1});return;case`toolCall`:this.handleToolCall(e);return;case`toolResult`:this.isFinalToolResult(e)&&this.completeToolCall(e.callId);return;case`error`:this.lastRelayError=e.message??v(`chat.realtimeRelayFailed`),this.ctx.callbacks.onStatus?.(`error`,this.lastRelayError);return;case`close`:this.abortConsults(),this.closed||(this.ctx.callbacks.onStatus?.(e.reason===`error`?`error`:`idle`,e.reason===`error`?this.lastRelayError??v(`chat.realtimeRelayClosed`):void 0),this.stopLocal());return;default:return}}playPcm16(e){this.outputQueue.play(e,this.outputContext,this.session.audio.outputSampleRateHz)}stopOutput(){this.outputQueue.stop(this.outputContext),this.speechFramesDuringPlayback=0}scheduleMarkAck(){let e=Math.max(0,Math.ceil(((this.outputQueue.queuedUntil||this.outputContext?.currentTime||0)-(this.outputContext?.currentTime??0))*1e3));window.setTimeout(()=>{this.closed},e)}async handleToolCall(e){let t=e.callId?.trim(),n=e.name?.trim();if(!t||!n)return;if(n===`fengming_agent_control`){await rU({ctx:this.ctx,callId:t,args:e.args??{},sessionId:this.session.relaySessionId,submit:(e,t)=>this.submitToolResult(e,t)});return}if(n!==`fengming_agent_consult`){this.submitToolResult(t,{error:`Tool "${n}" not available in browser Talk`});return}let r=new AbortController;this.consultAbortControllers.set(t,r);try{e.forced&&this.submitToolResult(t,{status:`working`,tool:PH,message:`Tell the person briefly that you are checking, then wait for the final FengMing result before answering with the actual result.`},{willContinue:!0}),await aU({ctx:this.ctx,callId:t,args:e.args??{},relaySessionId:this.session.relaySessionId,signal:r.signal,submit:(e,t)=>this.submitToolResult(e,t)})}finally{this.consultAbortControllers.delete(t)}}submitToolResult(e,t,n){this.completedToolCalls.has(e)||this.ctx.client.request(`talk.session.submitToolResult`,{sessionId:this.session.relaySessionId,callId:e,result:t,...n?{options:n}:{}})}completeToolCall(e){let t=e?.trim();t&&(this.completedToolCalls.add(t),this.consultAbortControllers.get(t)?.abort(),this.consultAbortControllers.delete(t))}isFinalToolResult(e){let t=e.talkEvent;return!(t?.type===`tool.progress`||t?.type===`tool.result`&&t.final===!1)}cancelOutputForBargeIn(){!this.outputQueue.isPlaying||this.cancelRequestedForPlayback||(this.cancelRequestedForPlayback=!0,this.stopOutput(),this.ctx.client.request(`talk.session.cancelOutput`,{sessionId:this.session.relaySessionId,reason:`barge-in`}))}abortConsults(){for(let e of this.consultAbortControllers.values())e.abort();this.consultAbortControllers.clear()}detectBargeInSpeech(e){if(!this.outputQueue.isPlaying||this.cancelRequestedForPlayback||e.length===0)return this.speechFramesDuringPlayback=0,!1;let t=0,n=0;for(let r of e)n=Math.max(n,Math.abs(r)),t+=r*r;return Math.sqrt(t/e.length)>=sU&&n>=cU?this.speechFramesDuringPlayback+=1:this.speechFramesDuringPlayback=0,this.speechFramesDuringPlayback>=lU}},dU=class{constructor(e,t){this.session=e,this.ctx=t,this.peer=null,this.channel=null,this.media=null,this.audio=null,this.closed=!1,this.responseActive=!1,this.responseCreateInFlight=!1,this.responseCreatePending=!1,this.toolBuffers=new Map,this.consultAbortControllers=new Set,this.emitTalkEvent=XH(t,e)}async start(){if(!navigator.mediaDevices?.getUserMedia||typeof RTCPeerConnection>`u`)throw Error(`实时通话需要浏览器 WebRTC 和麦克风访问`);this.closed=!1,this.peer=new RTCPeerConnection,this.audio=document.createElement(`audio`),this.audio.autoplay=!0,this.audio.style.display=`none`,document.body.append(this.audio),this.peer.addEventListener(`track`,e=>{this.audio&&(this.audio.srcObject=e.streams[0])}),this.media=await navigator.mediaDevices.getUserMedia({audio:!0});for(let e of this.media.getAudioTracks())this.peer.addTrack(e,this.media);this.channel=this.peer.createDataChannel(`oai-events`),this.channel.addEventListener(`open`,()=>{this.ctx.callbacks.onStatus?.(`listening`),this.emitTalkEvent({type:`session.ready`})}),this.channel.addEventListener(`message`,e=>this.handleRealtimeEvent(e.data)),this.peer.addEventListener(`connectionstatechange`,()=>{this.closed||(this.peer?.connectionState===`failed`||this.peer?.connectionState===`closed`)&&this.ctx.callbacks.onStatus?.(`error`,v(`chat.realtimeConnectionClosed`))});let e=await this.peer.createOffer();await this.peer.setLocalDescription(e);let t=await fetch(this.session.offerUrl??`https://api.openai.com/v1/realtime/calls`,{method:`POST`,body:e.sdp,headers:{...this.session.offerHeaders,Authorization:`Bearer ${this.session.clientSecret}`,"Content-Type":`application/sdp`}});if(!t.ok)throw Error(`Realtime WebRTC setup failed (${t.status})`);await this.peer.setRemoteDescription({type:`answer`,sdp:await t.text()})}stop(){this.closed||this.emitTalkEvent({type:`session.closed`,final:!0}),this.closed=!0,this.channel?.close(),this.channel=null,this.peer?.close(),this.peer=null,this.media?.getTracks().forEach(e=>e.stop()),this.media=null,this.audio?.remove(),this.audio=null;for(let e of this.consultAbortControllers)e.abort();this.consultAbortControllers.clear(),this.toolBuffers.clear(),this.responseActive=!1,this.responseCreateInFlight=!1,this.responseCreatePending=!1}send(e){this.channel?.readyState===`open`&&this.channel.send(JSON.stringify(e))}handleRealtimeEvent(e){if(this.closed)return;let t;try{t=JSON.parse(String(e))}catch{return}switch(t.type){case`conversation.item.input_audio_transcription.completed`:t.transcript&&(this.ctx.callbacks.onTranscript?.({role:`user`,text:t.transcript,final:!0}),this.emitTalkEvent({type:`transcript.done`,final:!0,itemId:t.item_id,payload:{role:`user`,text:t.transcript}}),this.consultAbortControllers.size>0&&GH(t.transcript)&&nU({ctx:this.ctx,text:t.transcript,emitTalkEvent:this.emitTalkEvent,onControlResult:e=>this.interruptSuppressedControlResponse(e),speakControlResult:e=>this.sendControlSpeechMessage(e),suppressSpeechForModes:[`cancel`]}));return;case`response.audio_transcript.done`:t.transcript&&(this.ctx.callbacks.onTranscript?.({role:`assistant`,text:t.transcript,final:!0}),this.emitTalkEvent({type:`output.text.done`,final:!0,itemId:t.item_id,payload:{text:t.transcript}}));return;case`response.function_call_arguments.delta`:this.bufferToolDelta(t);return;case`response.function_call_arguments.done`:this.handleToolCall(t);return;case`input_audio_buffer.speech_started`:this.ctx.callbacks.onStatus?.(`listening`,v(`chat.speechDetected`)),this.emitTalkEvent({type:`turn.started`,payload:{source:t.type}});return;case`input_audio_buffer.speech_stopped`:this.ctx.callbacks.onStatus?.(`thinking`,v(`chat.processingSpeech`)),this.emitTalkEvent({type:`input.audio.committed`,final:!0});return;case`response.created`:this.responseActive=!0,this.responseCreateInFlight=!1,this.ctx.callbacks.onStatus?.(`thinking`,v(`chat.generatingResponse`));return;case`response.cancelled`:case`response.done`:this.responseActive=!1,this.responseCreateInFlight=!1,this.ctx.callbacks.onStatus?.(`listening`,this.extractResponseStatus(t)),this.emitTalkEvent({type:`turn.ended`,final:!0,payload:{status:t.response?.status??(t.type===`response.cancelled`?`cancelled`:`completed`)}}),this.flushPendingResponseCreate();return;case`error`:this.responseCreateInFlight=!1,this.ctx.callbacks.onStatus?.(`error`,this.extractErrorDetail(t.error)),this.emitTalkEvent({type:`session.error`,final:!0,payload:{message:this.extractErrorDetail(t.error)}});return;default:return}}extractResponseStatus(e){let t=e.response?.status;return t&&t!==`completed`?`Response ${t}`:void 0}extractErrorDetail(e){if(!e||typeof e!=`object`)return v(`chat.realtimeProviderError`);let t=e,n=typeof t.message==`string`?t.message.trim():``,r=typeof t.code==`string`?t.code.trim():``,i=typeof t.type==`string`?t.type.trim():``;return n||r||i||v(`chat.realtimeProviderError`)}bufferToolDelta(e){let t=e.item_id??`unknown`,n=this.toolBuffers.get(t);if(n){n.args+=e.delta??``;return}this.toolBuffers.set(t,{name:e.name??``,callId:e.call_id??``,args:e.delta??``})}async handleToolCall(e){let t=e.item_id??`unknown`,n=this.toolBuffers.get(t);this.toolBuffers.delete(t);let r=n?.name||e.name||``,i=n?.callId||e.call_id||``;if(!i)return;if(r===`fengming_agent_control`){await rU({ctx:this.ctx,callId:i,args:n?.args||e.arguments||`{}`,emitTalkEvent:this.emitTalkEvent,submit:(e,t)=>this.submitToolResult(e,t)});return}if(r!==`fengming_agent_consult`)return;this.emitTalkEvent({type:`tool.call`,callId:i,itemId:t,payload:{name:r,args:n?.args||e.arguments||`{}`}});let a=new AbortController;this.consultAbortControllers.add(a);try{await aU({ctx:this.ctx,callId:i,args:n?.args||e.arguments||`{}`,signal:a.signal,emitTalkEvent:this.emitTalkEvent,submit:(e,t)=>this.submitToolResult(e,t)})}finally{this.consultAbortControllers.delete(a)}}submitToolResult(e,t){this.send({type:`conversation.item.create`,item:{type:`function_call_output`,call_id:e,output:JSON.stringify(t)}}),this.requestResponseCreate()}sendControlSpeechMessage(e){this.responseActive&&this.send({type:`response.cancel`}),this.send({type:`conversation.item.create`,item:{type:`message`,role:`user`,content:[{type:`input_text`,text:e}]}}),this.requestResponseCreate()}interruptSuppressedControlResponse(e){if(!this.responseActive||!e||typeof e!=`object`)return;let t=e;t.ok===!0&&(t.mode===`cancel`||t.suppress===!0&&t.mode!==`steer`)&&this.send({type:`response.cancel`})}requestResponseCreate(){if(this.responseActive||this.responseCreateInFlight){this.responseCreatePending=!0;return}this.responseCreatePending=!1,this.responseCreateInFlight=!0,this.send({type:`response.create`})}flushPendingResponseCreate(){this.responseCreatePending&&(this.responseCreatePending=!1,this.requestResponseCreate())}};function fU(e,t){let n=pU(e);if(n===`webrtc`)return new dU(e,t);if(n===`gateway-relay`)return new uU(e,t);if(n===`managed-room`)throw Error(`托管房间实时通话会话在此界面中尚不可用`);let r=e.transport??`unknown`;throw Error(`Unsupported realtime Talk transport: ${r}`)}function pU(e){return OH(e.transport)??`webrtc`}function mU(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}var hU=class{constructor(e,t,n={},r={}){this.client=e,this.sessionKey=t,this.callbacks=n,this.options=r,this.transport=null,this.closed=!1}async start(){this.closed=!1,this.callbacks.onStatus?.(`connecting`);let e=await this.createSession();this.closed||(this.transport=fU(e,{client:this.client,sessionKey:this.sessionKey,callbacks:this.callbacks,consultThinkingLevel:e.consultThinkingLevel,consultFastMode:e.consultFastMode}),await this.transport.start())}async createSession(){try{return await this.client.request(`talk.client.create`,mU({sessionKey:this.sessionKey,...this.options}))}catch(e){if(this.options.transport&&this.options.transport!==`gateway-relay`)throw e;try{return await this.client.request(`talk.session.create`,mU({sessionKey:this.sessionKey,...this.options,mode:`realtime`,transport:this.options.transport??`gateway-relay`,brain:`agent-consult`}))}catch{throw e}}}stop(){this.closed=!0,this.callbacks.onStatus?.(`idle`),this.transport?.stop(),this.transport=null}},gU=Yi({}),_U=Ao();function vU(){if(!window.location.search)return!1;let e=new URLSearchParams(window.location.search).get(`onboarding`);if(!e)return!1;let t=e.trim().toLowerCase();return t===`1`||t===`true`||t===`yes`||t===`on`}var $=class extends r{constructor(){super(),this.i18nController=new y(this),this.clientInstanceId=yt(),this.connectGeneration=0,this.settings=Oo(),this.password=``,this.loginShowGatewayToken=!1,this.loginShowGatewayPassword=!1,this.tab=`chat`,this.onboarding=vU(),this.connected=!1,this.theme=this.settings.theme??`claw`,this.themeMode=this.settings.themeMode??`system`,this.themeResolved=`dark`,this.themeOrder=this.buildThemeOrder(this.theme),this.customThemeImportUrl=``,this.customThemeImportBusy=!1,this.customThemeImportMessage=null,this.customThemeImportExpanded=!1,this.customThemeImportFocusToken=0,this.customThemeImportSelectOnSuccess=!1,this.hello=null,this.lastError=null,this.lastErrorCode=null,this.eventLog=[],this.eventLogBuffer=[],this.toolStreamSyncTimer=null,this.sidebarCloseTimer=null,this.assistantName=gU.name,this.assistantAvatar=gU.avatar,this.assistantAvatarSource=gU.avatarSource??null,this.assistantAvatarStatus=gU.avatarStatus??null,this.assistantAvatarReason=gU.avatarReason??null,this.assistantAvatarUploadBusy=!1,this.assistantAvatarUploadError=null,this.assistantAgentId=gU.agentId??null,this.userName=_U.name,this.userAvatar=_U.avatar,this.localMediaPreviewRoots=[],this.embedSandboxMode=`scripts`,this.allowExternalEmbedUrls=!1,this.chatMessageMaxWidth=null,this.serverVersion=null,this.sessionKey=this.settings.sessionKey,this.chatSessionMessageSubscriptionKey=null,this.chatSessionMessageSubscriptionRequestedKey=null,this.currentSessionId=null,this.chatLoading=!1,this.chatSending=!1,this.chatMessage=``,this.chatMessages=[],this.chatToolMessages=[],this.activityEntries=[],this.activityFilterText=``,this.activityStatusFilters={running:!0,done:!0,error:!0},this.activityToolFilter=``,this.activityExpandedIds=new Set,this.activityAutoFollow=!0,this.activityAtBottom=!0,this.chatStreamSegments=[],this.chatStream=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.chatSideResult=null,this.compactionStatus=null,this.fallbackStatus=null,this.chatRunStatus=null,this.chatRunStatusClearTimer=null,this.chatAvatarUrl=null,this.chatAvatarSource=null,this.chatAvatarStatus=null,this.chatAvatarReason=null,this.chatThinkingLevel=null,this.chatModelOverrides={},this.chatModelSwitchPromises={},this.chatModelsLoading=!1,this.chatModelCatalog=[],this.sessionSwitchNotice=null,this.sessionSwitchFlashKey=null,this.chatSessionPickerOpen=!1,this.chatSessionPickerSurface=null,this.chatSessionPickerQuery=``,this.chatSessionPickerAppliedQuery=``,this.chatSessionPickerLoading=!1,this.chatSessionPickerError=null,this.chatSessionPickerResult=null,this.sessionSwitchNoticeSeq=0,this.sessionSwitchNoticeTimer=null,this.sessionSwitchFlashTimer=null,this.chatQueue=[],this.chatQueueBySession={},this.chatAttachments=[],this.realtimeTalkActive=!1,this.realtimeTalkStatus=`idle`,this.realtimeTalkDetail=null,this.realtimeTalkTranscript=null,this.realtimeTalkConversation=[],this.realtimeTalkOptionsOpen=!1,this.realtimeTalkOptions={provider:``,model:``,voice:``,transport:``,vadThreshold:``,silenceDurationMs:``,prefixPaddingMs:``,reasoningEffort:``},this.realtimeTalkSession=null,this.realtimeTalkConversationState=hH(),this.nativeBridgeCleanup=null,this.chatManualRefreshInFlight=!1,this.chatHeaderControlsHidden=!1,this.chatMobileControlsOpen=!1,this.chatMobileControlsTrigger=null,this.navDrawerOpen=!1,this.chatLocalInputHistoryBySession={},this.chatInputHistorySessionKey=null,this.chatInputHistoryItems=null,this.chatInputHistoryIndex=-1,this.chatDraftBeforeHistory=null,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.pendingGatewayToken=null,this.configLoading=!1,this.configRaw=`{
|
|
7212
7212
|
}
|
|
7213
|
-
`,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.dreamingStatusLoading=!1,this.dreamingStatusError=null,this.dreamingStatus=null,this.dreamingModeSaving=!1,this.dreamingRestartConfirmOpen=!1,this.dreamingRestartConfirmLoading=!1,this.dreamingPendingEnabled=null,this.dreamDiaryLoading=!1,this.dreamDiaryActionLoading=!1,this.dreamDiaryActionMessage=null,this.dreamDiaryActionArchivePath=null,this.dreamDiaryError=null,this.dreamDiaryPath=null,this.dreamDiaryContent=null,this.wikiImportInsightsLoading=!1,this.wikiImportInsightsError=null,this.wikiImportInsights=null,this.wikiMemoryPalaceLoading=!1,this.wikiMemoryPalaceError=null,this.wikiMemoryPalace=null,this.configFormDirty=!1,this.configSettingsMode=`quick`,this.configFormMode=`form`,this.configSearchQuery=``,this.configActiveSection=null,this.configActiveSubsection=null,this.pendingUpdateExpectedVersion=null,this.updateStatusBanner=null,this.communicationsFormMode=`form`,this.communicationsSearchQuery=``,this.communicationsActiveSection=null,this.communicationsActiveSubsection=null,this.appearanceFormMode=`form`,this.appearanceSearchQuery=``,this.appearanceActiveSection=null,this.appearanceActiveSubsection=null,this.automationFormMode=`form`,this.automationSearchQuery=``,this.automationActiveSection=null,this.automationActiveSubsection=null,this.infrastructureFormMode=`form`,this.infrastructureSearchQuery=``,this.infrastructureActiveSection=null,this.infrastructureActiveSubsection=null,this.aiAgentsFormMode=`form`,this.aiAgentsSearchQuery=``,this.aiAgentsActiveSection=null,this.aiAgentsActiveSubsection=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=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.toolsCatalogLoading=!1,this.toolsCatalogError=null,this.toolsCatalogResult=null,this.toolsEffectiveLoading=!1,this.toolsEffectiveLoadingKey=null,this.toolsEffectiveResultKey=null,this.toolsEffectiveError=null,this.toolsEffectiveResult=null,this.agentsPanel=`files`,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=mg.activeMinutes,this.sessionsFilterLimit=mg.limit,this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.sessionsShowArchived=!1,this.sessionsFiltersCollapsed=!1,this.sessionsHideCron=!0,this.sessionsSearchQuery=``,this.sessionsSortColumn=`updated`,this.sessionsSortDir=`desc`,this.sessionsPage=0,this.sessionsPageSize=25,this.sessionsSelectedKeys=new Set,this.sessionsExpandedCheckpointKey=null,this.sessionsCheckpointItemsByKey={},this.sessionsCheckpointLoadingKey=null,this.sessionsCheckpointBusyKey=null,this.sessionsCheckpointErrorByKey={},this.usageLoading=!1,this.usageResult=null,this.usageCostSummary=null,this.usageError=null,this.usageStartDate=(()=>{let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`})(),this.usageEndDate=(()=>{let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`})(),this.usageScope=`family`,this.usageAgentId=null,this.usageSelectedSessions=[],this.usageSelectedDays=[],this.usageSelectedHours=[],this.usageChartMode=`tokens`,this.usageDailyChartMode=`by-type`,this.usageTimeSeriesMode=`per-turn`,this.usageTimeSeriesBreakdownMode=`by-type`,this.usageTimeSeries=null,this.usageTimeSeriesLoading=!1,this.usageTimeSeriesCursorStart=null,this.usageTimeSeriesCursorEnd=null,this.usageSessionLogs=null,this.usageSessionLogsLoading=!1,this.usageSessionLogsExpanded=!1,this.usageQuery=``,this.usageQueryDraft=``,this.usageSessionSort=`recent`,this.usageSessionSortDir=`desc`,this.usageRecentSessions=[],this.usageTimeZone=`local`,this.usageContextExpanded=!1,this.usageHeaderPinned=!1,this.usageSessionsTab=`all`,this.usageVisibleColumns=[`channel`,`agent`,`provider`,`model`,`messages`,`tools`,`errors`,`duration`],this.usageLogFilterRoles=[],this.usageLogFilterTools=[],this.usageLogFilterHasTools=!1,this.usageLogFilterQuery=``,this.usageQueryDebounceTimer=null,this.cronLoading=!1,this.cronQuickCreateOpen=!1,this.cronQuickCreateStep=`what`,this.cronQuickCreateDraft=null,this.cronJobsLoadingMore=!1,this.cronJobsReloadPending=!1,this.cronJobsReloadPendingTableFilters=!1,this.cronJobs=[],this.cronJobsTotal=0,this.cronJobsHasMore=!1,this.cronJobsNextOffset=null,this.cronJobsLimit=50,this.cronJobsQuery=``,this.cronJobsEnabledFilter=`all`,this.cronJobsScheduleKindFilter=`all`,this.cronJobsLastStatusFilter=`all`,this.cronJobsSortBy=`nextRunAtMs`,this.cronJobsSortDir=`asc`,this.cronStatus=null,this.cronError=null,this.cronForm={...hg},this.cronFormCollapsed=!0,this.cronFieldErrors={},this.cronEditingJobId=null,this.cronRunsJobId=null,this.cronRunsLoadingMore=!1,this.cronRuns=[],this.cronRunsTotal=0,this.cronRunsHasMore=!1,this.cronRunsNextOffset=null,this.cronRunsLimit=50,this.cronRunsScope=`all`,this.cronRunsStatuses=[],this.cronRunsDeliveryStatuses=[],this.cronRunsStatusFilter=`all`,this.cronRunsQuery=``,this.cronRunsSortDir=`desc`,this.cronModelSuggestions=[],this.cronBusy=!1,this.updateAvailable=null,this.attentionItems=[],this.paletteOpen=!1,this.paletteQuery=``,this.paletteActiveIndex=0,this.overviewShowGatewayToken=!1,this.overviewShowGatewayPassword=!1,this.overviewLogLines=[],this.overviewLogCursor=0,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter=``,this.skillsStatusFilter=`all`,this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.skillsDetailKey=null,this.skillsDetailTab=`overview`,this.clawhubSearchQuery=``,this.clawhubSearchResults=null,this.clawhubSearchLoading=!1,this.clawhubSearchError=null,this.clawhubDetail=null,this.clawhubDetailSlug=null,this.clawhubDetailLoading=!1,this.clawhubDetailError=null,this.clawhubInstallSlug=null,this.clawhubInstallMessage=null,this.clawhubVerdicts={},this.clawhubVerdictsLoading=!1,this.clawhubVerdictsError=null,this.skillCardContents={},this.skillCardContentKeys={},this.skillCardLoadingKey=null,this.skillCardErrors={},this.healthLoading=!1,this.healthResult=null,this.healthError=null,this.modelAuthStatusLoading=!1,this.modelAuthStatusResult=null,this.modelAuthStatusError=null,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.webPushSupported=!1,this.webPushPermission=`unsupported`,this.webPushSubscribed=!1,this.webPushLoading=!1,this.logsLoading=!1,this.logsError=null,this.logsFile=null,this.logsEntries=[],this.logsFilterText=``,this.logsLevelFilters={...pg},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.chatLastScrollTop=0,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.chatIsProgrammaticScroll=!1,this.chatProgrammaticScrollTarget=0,this.chatNewMessagesBelow=!1,this.nodesPollInterval=null,this.logsPollInterval=null,this.debugPollInterval=null,this.sessionsChangedReloadTimer=null,this.logsScrollFrame=null,this.activityScrollFrame=null,this.controlUiResponsivenessObserver=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.refreshSessionsAfterChat=new Set,this.chatSideResultTerminalRuns=new Set,this.basePath=``,this.popStateHandler=()=>SA(this),this.topbarObserver=null,this.globalKeydownHandler=e=>{(e.metaKey||e.ctrlKey)&&!e.shiftKey&&e.key===`k`&&(e.preventDefault(),this.paletteOpen=!this.paletteOpen,this.paletteOpen&&(this.paletteQuery=``,this.paletteActiveIndex=0))},this.chatMobileControlsKeydownHandler=e=>{if(e.key===`Escape`){if(this.chatSessionPickerOpen){e.preventDefault(),this.chatSessionPickerOpen=!1,this.chatSessionPickerSurface=null;return}this.chatMobileControlsOpen&&(e.preventDefault(),this.setChatMobileControlsOpen(!1,{restoreFocus:!0}))}},this.chatMobileControlsPointerdownHandler=e=>{let t=e.composedPath();if(this.chatSessionPickerOpen&&(Array.from(this.querySelectorAll(`.chat-controls__session-picker`)).some(e=>t.includes(e))||(this.chatSessionPickerOpen=!1,this.chatSessionPickerSurface=null)),!this.chatMobileControlsOpen)return;let n=this.querySelector(`.chat-mobile-controls-wrapper`);n&&t.includes(n)||this.setChatMobileControlsOpen(!1)},h(this.settings.locale)&&_.setLocale(this.settings.locale)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.onSlashAction=async e=>{switch(e){case`new-session`:await lP(this);break;case`toggle-focus`:this.applySettings({...this.settings,chatFocusMode:!this.settings.chatFocusMode});break;case`export`:FE(this.chatMessages,this.assistantName);break;case`refresh-tools-effective`:await A_(this);break}},document.addEventListener(`keydown`,this.globalKeydownHandler),document.addEventListener(`keydown`,this.chatMobileControlsKeydownHandler),document.addEventListener(`pointerdown`,this.chatMobileControlsPointerdownHandler),dM(this),this.nativeBridgeCleanup=xM(this),this.initWebPushState()}firstUpdated(){fM(this)}disconnectedCallback(){document.removeEventListener(`keydown`,this.globalKeydownHandler),this.nativeBridgeCleanup?.(),this.nativeBridgeCleanup=null,document.removeEventListener(`keydown`,this.chatMobileControlsKeydownHandler),document.removeEventListener(`pointerdown`,this.chatMobileControlsPointerdownHandler),this.sessionSwitchNoticeTimer!==null&&(window.clearTimeout(this.sessionSwitchNoticeTimer),this.sessionSwitchNoticeTimer=null),this.sessionSwitchFlashTimer!==null&&(window.clearTimeout(this.sessionSwitchFlashTimer),this.sessionSwitchFlashTimer=null),this.chatMobileControlsTrigger=null,gM(this),super.disconnectedCallback()}updated(e){if(_M(this,e),e.has(`tab`)&&this.tab!==`chat`&&this.chatMobileControlsOpen&&this.setChatMobileControlsOpen(!1),!e.has(`sessionKey`)||this.agentsPanel!==`tools`)return;let t=Xc(this.sessionKey);if(this.agentsSelectedId&&this.agentsSelectedId===t){D_(this,{agentId:this.agentsSelectedId,sessionKey:this.sessionKey});return}this.toolsEffectiveResult=null,this.toolsEffectiveResultKey=null,this.toolsEffectiveError=null,this.toolsEffectiveLoading=!1,this.toolsEffectiveLoadingKey=null}connect(){tM(this)}handleChatScroll(e){Ho(this,e)}handleLogsScroll(e){Uo(this,e)}handleActivityScroll(e){Wo(this,e)}scheduleActivityScroll(e=!1){Vo(this,e)}exportLogs(e,t){Ko(e,t)}resetToolStream(){wl(this)}resetChatScroll(){Go(this)}scrollToBottom(e){Go(this),zo(this,!0,!!e?.smooth,{source:`manual`})}async loadAssistantIdentity(){await WA(this)}applySettings(e){eA(this,e)}applyLocalUserIdentity(e){tA(this,e)}setTab(e){oA(this,e),e!==`chat`&&this.setChatMobileControlsOpen(!1),this.navDrawerOpen=!1}setChatMobileControlsOpen(e,t){if(e){this.chatMobileControlsTrigger=t?.trigger??this.chatMobileControlsTrigger,this.chatMobileControlsOpen=!0;return}let n=t?.restoreFocus?this.chatMobileControlsTrigger:null;this.chatMobileControlsOpen=!1,this.chatSessionPickerSurface===`mobile`&&(this.chatSessionPickerOpen=!1,this.chatSessionPickerSurface=null),this.chatMobileControlsTrigger=null,!(!(n instanceof HTMLElement)||!n.isConnected)&&requestAnimationFrame(()=>{n.isConnected&&n.focus()})}setTheme(e,t){cA(this,e,t),this.themeOrder=this.buildThemeOrder(e)}setThemeMode(e,t){lA(this,e,t)}setCustomThemeImportUrl(e){this.customThemeImportUrl=e,this.customThemeImportMessage?.kind===`error`&&(this.customThemeImportMessage=null)}openCustomThemeImport(){this.customThemeImportExpanded=!0,this.customThemeImportFocusToken+=1,this.settings.customTheme||(this.customThemeImportSelectOnSuccess=!0)}async importCustomTheme(){if(!this.customThemeImportBusy){this.customThemeImportExpanded=!0,this.customThemeImportBusy=!0,this.customThemeImportMessage=null;try{let e=await ii(this.customThemeImportUrl),t=this.theme===`custom`||!this.settings.customTheme||this.customThemeImportSelectOnSuccess;eA(this,{...this.settings,theme:t?`custom`:this.settings.theme,customTheme:e}),this.themeOrder=this.buildThemeOrder(t?`custom`:this.theme),this.customThemeImportUrl=``,this.customThemeImportSelectOnSuccess=!1,this.customThemeImportMessage={kind:`success`,text:`Imported ${e.label}.`}}catch(e){this.customThemeImportMessage={kind:`error`,text:e instanceof Error?e.message:v(`settings.quick.importThemeFailed`)}}finally{this.customThemeImportBusy=!1}}}clearCustomTheme(){let e=this.theme===`custom`?`claw`:this.theme;this.customThemeImportExpanded=!0,this.customThemeImportSelectOnSuccess=!1,eA(this,{...this.settings,theme:e,customTheme:void 0}),this.themeOrder=this.buildThemeOrder(e),this.customThemeImportMessage={kind:`success`,text:v(`settings.quick.clearedTheme`)}}setBorderRadius(e){eA(this,{...this.settings,borderRadius:e}),this.requestUpdate()}setTextScale(e){eA(this,{...this.settings,textScale:e}),this.requestUpdate()}announceSessionSwitch(e,t){let n=++this.sessionSwitchNoticeSeq;this.sessionSwitchNoticeTimer!==null&&window.clearTimeout(this.sessionSwitchNoticeTimer),this.sessionSwitchFlashTimer!==null&&window.clearTimeout(this.sessionSwitchFlashTimer),this.sessionSwitchNotice={id:n,text:v(`chat.switchedSession`,{session:t})},this.sessionSwitchFlashKey=e,this.sessionSwitchFlashTimer=window.setTimeout(()=>{this.sessionSwitchNotice?.id===n&&(this.sessionSwitchFlashKey=null),this.sessionSwitchFlashTimer=null},200),this.sessionSwitchNoticeTimer=window.setTimeout(()=>{this.sessionSwitchNotice?.id===n&&(this.sessionSwitchNotice=null),this.sessionSwitchNoticeTimer=null},2800)}buildThemeOrder(e){return[e,...[...xi].filter(t=>t!==e)]}async loadOverview(e){await kA(this,e)}async loadCron(){await IA(this)}async handleAbortChat(e){await mh(this,e)}handleChatDraftChange(e){Wu(this,e)}handleChatInputHistoryKey(e){return Ju(this,e)}resetChatInputHistoryNavigation(){Uu(this)}removeQueuedMessage(e){Rh(this,e)}async retryQueuedChatMessage(e){await Wh(this,e)}async handleSendChat(e,t){await Gh(this,e,t)}updateRealtimeTalkOptions(e){this.realtimeTalkOptions={...this.realtimeTalkOptions,...e}}buildRealtimeTalkLaunchOptions(){let e=this.realtimeTalkOptions??{provider:``,model:``,voice:``,transport:``,vadThreshold:``,silenceDurationMs:``,prefixPaddingMs:``,reasoningEffort:``},t=e=>e.trim()||void 0,n=e=>{let t=e.trim();if(!t)return;let n=Number(t);return Number.isFinite(n)?n:void 0},r=t(e.transport);return{provider:t(e.provider),model:t(e.model),voice:t(e.voice),transport:r,vadThreshold:n(e.vadThreshold),silenceDurationMs:n(e.silenceDurationMs),prefixPaddingMs:n(e.prefixPaddingMs),reasoningEffort:t(e.reasoningEffort)}}async toggleRealtimeTalk(){if(this.realtimeTalkSession)if(this.realtimeTalkStatus===`error`)this.realtimeTalkSession.stop(),this.realtimeTalkSession=null;else{this.realtimeTalkSession.stop(),this.realtimeTalkSession=null,this.realtimeTalkActive=!1,this.realtimeTalkStatus=`idle`,this.realtimeTalkDetail=null,this.realtimeTalkTranscript=null,this.resetRealtimeTalkConversation();return}if(!this.client||!this.connected){this.lastError=v(`chat.gatewayNotConnected`);return}this.realtimeTalkActive=!0,this.realtimeTalkStatus=`connecting`,this.realtimeTalkDetail=null,this.realtimeTalkTranscript=null,this.resetRealtimeTalkConversation();let e=new hU(this.client,this.sessionKey,{onStatus:(e,t)=>{this.realtimeTalkStatus=e,this.realtimeTalkDetail=t??null,(e===`idle`||e===`error`)&&(this.realtimeTalkActive=e!==`idle`)},onTranscript:e=>{this.realtimeTalkTranscript=`${e.role===`user`?`You`:`FengMing`}: ${e.text}`,this.realtimeTalkConversationState=gH(this.realtimeTalkConversationState,e),this.realtimeTalkConversation=this.realtimeTalkConversationState.entries}},this.buildRealtimeTalkLaunchOptions());this.realtimeTalkSession=e;try{await e.start()}catch(t){e.stop(),this.realtimeTalkSession===e&&(this.realtimeTalkSession=null),this.realtimeTalkActive=!1,this.realtimeTalkStatus=`error`,this.realtimeTalkDetail=t instanceof Error?t.message:String(t),this.lastError=this.realtimeTalkDetail}}resetRealtimeTalkConversation(){this.realtimeTalkConversationState=hH(),this.realtimeTalkConversation=[]}async steerQueuedChatMessage(e){await Ih(this,e)}async handleChannelConfigSave(){await gr(this)}async handleChannelConfigReload(){await _r(this)}async handleExecApprovalDecision(e){let t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{let n=t.kind===`plugin`?`plugin.approval.resolve`:`exec.approval.resolve`;await this.client.request(n,{id:t.id,decision:e}),yj(this,t.id)}catch(e){if(uj(e)){yj(this,t.id),await vj(this);return}if(!this.execApprovalQueue.some(e=>e.id===t.id))return;this.execApprovalError=`Approval failed: ${String(e)}`}finally{this.execApprovalBusy=!1}}}handleGatewayUrlConfirm(){let e=this.pendingGatewayUrl;if(!e)return;let t=this.pendingGatewayToken?.trim()||``;this.pendingGatewayUrl=null,this.pendingGatewayToken=null,eA(this,{...this.settings,gatewayUrl:e,token:t}),this.connect()}handleGatewayUrlCancel(){this.pendingGatewayUrl=null,this.pendingGatewayToken=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){let t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}async initWebPushState(){let e=`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window;if(this.webPushSupported=e,this.webPushPermission=e?Notification.permission:`unsupported`,e)try{let{getExistingSubscription:e}=await hV(async()=>{let{getExistingSubscription:e}=await import(`./push-subscription-CY8GxC_U.js`);return{getExistingSubscription:e}},__vite__mapDeps([18,5]),import.meta.url),t=await e();this.webPushSubscribed=t!==null}catch{}}async reconcileWebPushState(){if(this.client)try{let{getExistingSubscription:e}=await hV(async()=>{let{getExistingSubscription:e}=await import(`./push-subscription-CY8GxC_U.js`);return{getExistingSubscription:e}},__vite__mapDeps([18,5]),import.meta.url),t=await e();if(!t)return;this.webPushSubscribed=!0;let n=t.toJSON();n.endpoint&&n.keys?.p256dh&&n.keys?.auth&&await this.client.request(`push.web.subscribe`,{endpoint:n.endpoint,keys:{p256dh:n.keys.p256dh,auth:n.keys.auth}})}catch{}}async handleWebPushSubscribe(){if(!(!this.client||this.webPushLoading)){this.webPushLoading=!0;try{let{subscribeToWebPush:e}=await hV(async()=>{let{subscribeToWebPush:e}=await import(`./push-subscription-CY8GxC_U.js`);return{subscribeToWebPush:e}},__vite__mapDeps([18,5]),import.meta.url);await e(this.client),this.webPushSubscribed=!0,this.webPushPermission=Notification.permission}catch(e){this.lastError=String(e)}finally{this.webPushLoading=!1,`Notification`in window&&(this.webPushPermission=Notification.permission)}}}async handleWebPushUnsubscribe(){if(!(!this.client||this.webPushLoading)){this.webPushLoading=!0;try{let{unsubscribeFromWebPush:e}=await hV(async()=>{let{unsubscribeFromWebPush:e}=await import(`./push-subscription-CY8GxC_U.js`);return{unsubscribeFromWebPush:e}},__vite__mapDeps([18,5]),import.meta.url);await e(this.client),this.webPushSubscribed=!1}catch(e){this.lastError=String(e)}finally{this.webPushLoading=!1}}}async handleWebPushTest(){if(this.client)try{let{sendTestWebPush:e}=await hV(async()=>{let{sendTestWebPush:e}=await import(`./push-subscription-CY8GxC_U.js`);return{sendTestWebPush:e}},__vite__mapDeps([18,5]),import.meta.url);await e(this.client)}catch(e){this.lastError=String(e)}}render(){return pH(this)}};if(J([s()],$.prototype,`settings`,void 0),J([s()],$.prototype,`password`,void 0),J([s()],$.prototype,`loginShowGatewayToken`,void 0),J([s()],$.prototype,`loginShowGatewayPassword`,void 0),J([s()],$.prototype,`tab`,void 0),J([s()],$.prototype,`onboarding`,void 0),J([s()],$.prototype,`connected`,void 0),J([s()],$.prototype,`theme`,void 0),J([s()],$.prototype,`themeMode`,void 0),J([s()],$.prototype,`themeResolved`,void 0),J([s()],$.prototype,`themeOrder`,void 0),J([s()],$.prototype,`customThemeImportUrl`,void 0),J([s()],$.prototype,`customThemeImportBusy`,void 0),J([s()],$.prototype,`customThemeImportMessage`,void 0),J([s()],$.prototype,`customThemeImportExpanded`,void 0),J([s()],$.prototype,`customThemeImportFocusToken`,void 0),J([s()],$.prototype,`hello`,void 0),J([s()],$.prototype,`lastError`,void 0),J([s()],$.prototype,`lastErrorCode`,void 0),J([s()],$.prototype,`eventLog`,void 0),J([s()],$.prototype,`assistantName`,void 0),J([s()],$.prototype,`assistantAvatar`,void 0),J([s()],$.prototype,`assistantAvatarSource`,void 0),J([s()],$.prototype,`assistantAvatarStatus`,void 0),J([s()],$.prototype,`assistantAvatarReason`,void 0),J([s()],$.prototype,`assistantAvatarUploadBusy`,void 0),J([s()],$.prototype,`assistantAvatarUploadError`,void 0),J([s()],$.prototype,`assistantAgentId`,void 0),J([s()],$.prototype,`userName`,void 0),J([s()],$.prototype,`userAvatar`,void 0),J([s()],$.prototype,`localMediaPreviewRoots`,void 0),J([s()],$.prototype,`embedSandboxMode`,void 0),J([s()],$.prototype,`allowExternalEmbedUrls`,void 0),J([s()],$.prototype,`chatMessageMaxWidth`,void 0),J([s()],$.prototype,`serverVersion`,void 0),J([s()],$.prototype,`sessionKey`,void 0),J([s()],$.prototype,`chatLoading`,void 0),J([s()],$.prototype,`chatSending`,void 0),J([s()],$.prototype,`chatMessage`,void 0),J([s()],$.prototype,`chatMessages`,void 0),J([s()],$.prototype,`chatToolMessages`,void 0),J([s()],$.prototype,`activityEntries`,void 0),J([s()],$.prototype,`activityFilterText`,void 0),J([s()],$.prototype,`activityStatusFilters`,void 0),J([s()],$.prototype,`activityToolFilter`,void 0),J([s()],$.prototype,`activityExpandedIds`,void 0),J([s()],$.prototype,`activityAutoFollow`,void 0),J([s()],$.prototype,`activityAtBottom`,void 0),J([s()],$.prototype,`chatStreamSegments`,void 0),J([s()],$.prototype,`chatStream`,void 0),J([s()],$.prototype,`chatStreamStartedAt`,void 0),J([s()],$.prototype,`chatRunId`,void 0),J([s()],$.prototype,`chatSideResult`,void 0),J([s()],$.prototype,`compactionStatus`,void 0),J([s()],$.prototype,`fallbackStatus`,void 0),J([s()],$.prototype,`chatRunStatus`,void 0),J([s()],$.prototype,`chatAvatarUrl`,void 0),J([s()],$.prototype,`chatAvatarSource`,void 0),J([s()],$.prototype,`chatAvatarStatus`,void 0),J([s()],$.prototype,`chatAvatarReason`,void 0),J([s()],$.prototype,`chatThinkingLevel`,void 0),J([s()],$.prototype,`chatModelOverrides`,void 0),J([s()],$.prototype,`chatModelSwitchPromises`,void 0),J([s()],$.prototype,`chatModelsLoading`,void 0),J([s()],$.prototype,`chatModelCatalog`,void 0),J([s()],$.prototype,`sessionSwitchNotice`,void 0),J([s()],$.prototype,`sessionSwitchFlashKey`,void 0),J([s()],$.prototype,`chatSessionPickerOpen`,void 0),J([s()],$.prototype,`chatSessionPickerSurface`,void 0),J([s()],$.prototype,`chatSessionPickerQuery`,void 0),J([s()],$.prototype,`chatSessionPickerAppliedQuery`,void 0),J([s()],$.prototype,`chatSessionPickerLoading`,void 0),J([s()],$.prototype,`chatSessionPickerError`,void 0),J([s()],$.prototype,`chatSessionPickerResult`,void 0),J([s()],$.prototype,`chatQueue`,void 0),J([s()],$.prototype,`chatQueueBySession`,void 0),J([s()],$.prototype,`chatAttachments`,void 0),J([s()],$.prototype,`realtimeTalkActive`,void 0),J([s()],$.prototype,`realtimeTalkStatus`,void 0),J([s()],$.prototype,`realtimeTalkDetail`,void 0),J([s()],$.prototype,`realtimeTalkTranscript`,void 0),J([s()],$.prototype,`realtimeTalkConversation`,void 0),J([s()],$.prototype,`realtimeTalkOptionsOpen`,void 0),J([s()],$.prototype,`realtimeTalkOptions`,void 0),J([s()],$.prototype,`chatManualRefreshInFlight`,void 0),J([s()],$.prototype,`chatHeaderControlsHidden`,void 0),J([s()],$.prototype,`chatMobileControlsOpen`,void 0),J([s()],$.prototype,`navDrawerOpen`,void 0),J([s()],$.prototype,`chatInputHistoryIndex`,void 0),J([s()],$.prototype,`sidebarOpen`,void 0),J([s()],$.prototype,`sidebarContent`,void 0),J([s()],$.prototype,`sidebarError`,void 0),J([s()],$.prototype,`splitRatio`,void 0),J([s()],$.prototype,`nodesLoading`,void 0),J([s()],$.prototype,`nodes`,void 0),J([s()],$.prototype,`devicesLoading`,void 0),J([s()],$.prototype,`devicesError`,void 0),J([s()],$.prototype,`devicesList`,void 0),J([s()],$.prototype,`execApprovalsLoading`,void 0),J([s()],$.prototype,`execApprovalsSaving`,void 0),J([s()],$.prototype,`execApprovalsDirty`,void 0),J([s()],$.prototype,`execApprovalsSnapshot`,void 0),J([s()],$.prototype,`execApprovalsForm`,void 0),J([s()],$.prototype,`execApprovalsSelectedAgent`,void 0),J([s()],$.prototype,`execApprovalsTarget`,void 0),J([s()],$.prototype,`execApprovalsTargetNodeId`,void 0),J([s()],$.prototype,`execApprovalQueue`,void 0),J([s()],$.prototype,`execApprovalBusy`,void 0),J([s()],$.prototype,`execApprovalError`,void 0),J([s()],$.prototype,`pendingGatewayUrl`,void 0),J([s()],$.prototype,`configLoading`,void 0),J([s()],$.prototype,`configRaw`,void 0),J([s()],$.prototype,`configRawOriginal`,void 0),J([s()],$.prototype,`configValid`,void 0),J([s()],$.prototype,`configIssues`,void 0),J([s()],$.prototype,`configSaving`,void 0),J([s()],$.prototype,`configApplying`,void 0),J([s()],$.prototype,`updateRunning`,void 0),J([s()],$.prototype,`applySessionKey`,void 0),J([s()],$.prototype,`configSnapshot`,void 0),J([s()],$.prototype,`configSchema`,void 0),J([s()],$.prototype,`configSchemaVersion`,void 0),J([s()],$.prototype,`configSchemaLoading`,void 0),J([s()],$.prototype,`configUiHints`,void 0),J([s()],$.prototype,`configForm`,void 0),J([s()],$.prototype,`configFormOriginal`,void 0),J([s()],$.prototype,`dreamingStatusLoading`,void 0),J([s()],$.prototype,`dreamingStatusError`,void 0),J([s()],$.prototype,`dreamingStatus`,void 0),J([s()],$.prototype,`dreamingModeSaving`,void 0),J([s()],$.prototype,`dreamingRestartConfirmOpen`,void 0),J([s()],$.prototype,`dreamingRestartConfirmLoading`,void 0),J([s()],$.prototype,`dreamingPendingEnabled`,void 0),J([s()],$.prototype,`dreamDiaryLoading`,void 0),J([s()],$.prototype,`dreamDiaryActionLoading`,void 0),J([s()],$.prototype,`dreamDiaryActionMessage`,void 0),J([s()],$.prototype,`dreamDiaryActionArchivePath`,void 0),J([s()],$.prototype,`dreamDiaryError`,void 0),J([s()],$.prototype,`dreamDiaryPath`,void 0),J([s()],$.prototype,`dreamDiaryContent`,void 0),J([s()],$.prototype,`wikiImportInsightsLoading`,void 0),J([s()],$.prototype,`wikiImportInsightsError`,void 0),J([s()],$.prototype,`wikiImportInsights`,void 0),J([s()],$.prototype,`wikiMemoryPalaceLoading`,void 0),J([s()],$.prototype,`wikiMemoryPalaceError`,void 0),J([s()],$.prototype,`wikiMemoryPalace`,void 0),J([s()],$.prototype,`configFormDirty`,void 0),J([s()],$.prototype,`configSettingsMode`,void 0),J([s()],$.prototype,`configFormMode`,void 0),J([s()],$.prototype,`configSearchQuery`,void 0),J([s()],$.prototype,`configActiveSection`,void 0),J([s()],$.prototype,`configActiveSubsection`,void 0),J([s()],$.prototype,`pendingUpdateExpectedVersion`,void 0),J([s()],$.prototype,`updateStatusBanner`,void 0),J([s()],$.prototype,`communicationsFormMode`,void 0),J([s()],$.prototype,`communicationsSearchQuery`,void 0),J([s()],$.prototype,`communicationsActiveSection`,void 0),J([s()],$.prototype,`communicationsActiveSubsection`,void 0),J([s()],$.prototype,`appearanceFormMode`,void 0),J([s()],$.prototype,`appearanceSearchQuery`,void 0),J([s()],$.prototype,`appearanceActiveSection`,void 0),J([s()],$.prototype,`appearanceActiveSubsection`,void 0),J([s()],$.prototype,`automationFormMode`,void 0),J([s()],$.prototype,`automationSearchQuery`,void 0),J([s()],$.prototype,`automationActiveSection`,void 0),J([s()],$.prototype,`automationActiveSubsection`,void 0),J([s()],$.prototype,`infrastructureFormMode`,void 0),J([s()],$.prototype,`infrastructureSearchQuery`,void 0),J([s()],$.prototype,`infrastructureActiveSection`,void 0),J([s()],$.prototype,`infrastructureActiveSubsection`,void 0),J([s()],$.prototype,`aiAgentsFormMode`,void 0),J([s()],$.prototype,`aiAgentsSearchQuery`,void 0),J([s()],$.prototype,`aiAgentsActiveSection`,void 0),J([s()],$.prototype,`aiAgentsActiveSubsection`,void 0),J([s()],$.prototype,`channelsLoading`,void 0),J([s()],$.prototype,`channelsSnapshot`,void 0),J([s()],$.prototype,`channelsError`,void 0),J([s()],$.prototype,`channelsLastSuccess`,void 0),J([s()],$.prototype,`presenceLoading`,void 0),J([s()],$.prototype,`presenceEntries`,void 0),J([s()],$.prototype,`presenceError`,void 0),J([s()],$.prototype,`presenceStatus`,void 0),J([s()],$.prototype,`agentsLoading`,void 0),J([s()],$.prototype,`agentsList`,void 0),J([s()],$.prototype,`agentsError`,void 0),J([s()],$.prototype,`agentsSelectedId`,void 0),J([s()],$.prototype,`toolsCatalogLoading`,void 0),J([s()],$.prototype,`toolsCatalogError`,void 0),J([s()],$.prototype,`toolsCatalogResult`,void 0),J([s()],$.prototype,`toolsEffectiveLoading`,void 0),J([s()],$.prototype,`toolsEffectiveLoadingKey`,void 0),J([s()],$.prototype,`toolsEffectiveResultKey`,void 0),J([s()],$.prototype,`toolsEffectiveError`,void 0),J([s()],$.prototype,`toolsEffectiveResult`,void 0),J([s()],$.prototype,`agentsPanel`,void 0),J([s()],$.prototype,`agentFilesLoading`,void 0),J([s()],$.prototype,`agentFilesError`,void 0),J([s()],$.prototype,`agentFilesList`,void 0),J([s()],$.prototype,`agentFileContents`,void 0),J([s()],$.prototype,`agentFileDrafts`,void 0),J([s()],$.prototype,`agentFileActive`,void 0),J([s()],$.prototype,`agentFileSaving`,void 0),J([s()],$.prototype,`agentIdentityLoading`,void 0),J([s()],$.prototype,`agentIdentityError`,void 0),J([s()],$.prototype,`agentIdentityById`,void 0),J([s()],$.prototype,`agentSkillsLoading`,void 0),J([s()],$.prototype,`agentSkillsError`,void 0),J([s()],$.prototype,`agentSkillsReport`,void 0),J([s()],$.prototype,`agentSkillsAgentId`,void 0),J([s()],$.prototype,`sessionsLoading`,void 0),J([s()],$.prototype,`sessionsResult`,void 0),J([s()],$.prototype,`sessionsError`,void 0),J([s()],$.prototype,`sessionsFilterActive`,void 0),J([s()],$.prototype,`sessionsFilterLimit`,void 0),J([s()],$.prototype,`sessionsIncludeGlobal`,void 0),J([s()],$.prototype,`sessionsIncludeUnknown`,void 0),J([s()],$.prototype,`sessionsShowArchived`,void 0),J([s()],$.prototype,`sessionsFiltersCollapsed`,void 0),J([s()],$.prototype,`sessionsHideCron`,void 0),J([s()],$.prototype,`sessionsSearchQuery`,void 0),J([s()],$.prototype,`sessionsSortColumn`,void 0),J([s()],$.prototype,`sessionsSortDir`,void 0),J([s()],$.prototype,`sessionsPage`,void 0),J([s()],$.prototype,`sessionsPageSize`,void 0),J([s()],$.prototype,`sessionsSelectedKeys`,void 0),J([s()],$.prototype,`sessionsExpandedCheckpointKey`,void 0),J([s()],$.prototype,`sessionsCheckpointItemsByKey`,void 0),J([s()],$.prototype,`sessionsCheckpointLoadingKey`,void 0),J([s()],$.prototype,`sessionsCheckpointBusyKey`,void 0),J([s()],$.prototype,`sessionsCheckpointErrorByKey`,void 0),J([s()],$.prototype,`usageLoading`,void 0),J([s()],$.prototype,`usageResult`,void 0),J([s()],$.prototype,`usageCostSummary`,void 0),J([s()],$.prototype,`usageError`,void 0),J([s()],$.prototype,`usageStartDate`,void 0),J([s()],$.prototype,`usageEndDate`,void 0),J([s()],$.prototype,`usageScope`,void 0),J([s()],$.prototype,`usageAgentId`,void 0),J([s()],$.prototype,`usageSelectedSessions`,void 0),J([s()],$.prototype,`usageSelectedDays`,void 0),J([s()],$.prototype,`usageSelectedHours`,void 0),J([s()],$.prototype,`usageChartMode`,void 0),J([s()],$.prototype,`usageDailyChartMode`,void 0),J([s()],$.prototype,`usageTimeSeriesMode`,void 0),J([s()],$.prototype,`usageTimeSeriesBreakdownMode`,void 0),J([s()],$.prototype,`usageTimeSeries`,void 0),J([s()],$.prototype,`usageTimeSeriesLoading`,void 0),J([s()],$.prototype,`usageTimeSeriesCursorStart`,void 0),J([s()],$.prototype,`usageTimeSeriesCursorEnd`,void 0),J([s()],$.prototype,`usageSessionLogs`,void 0),J([s()],$.prototype,`usageSessionLogsLoading`,void 0),J([s()],$.prototype,`usageSessionLogsExpanded`,void 0),J([s()],$.prototype,`usageQuery`,void 0),J([s()],$.prototype,`usageQueryDraft`,void 0),J([s()],$.prototype,`usageSessionSort`,void 0),J([s()],$.prototype,`usageSessionSortDir`,void 0),J([s()],$.prototype,`usageRecentSessions`,void 0),J([s()],$.prototype,`usageTimeZone`,void 0),J([s()],$.prototype,`usageContextExpanded`,void 0),J([s()],$.prototype,`usageHeaderPinned`,void 0),J([s()],$.prototype,`usageSessionsTab`,void 0),J([s()],$.prototype,`usageVisibleColumns`,void 0),J([s()],$.prototype,`usageLogFilterRoles`,void 0),J([s()],$.prototype,`usageLogFilterTools`,void 0),J([s()],$.prototype,`usageLogFilterHasTools`,void 0),J([s()],$.prototype,`usageLogFilterQuery`,void 0),J([s()],$.prototype,`cronLoading`,void 0),J([s()],$.prototype,`cronQuickCreateOpen`,void 0),J([s()],$.prototype,`cronQuickCreateStep`,void 0),J([s()],$.prototype,`cronQuickCreateDraft`,void 0),J([s()],$.prototype,`cronJobsLoadingMore`,void 0),J([s()],$.prototype,`cronJobs`,void 0),J([s()],$.prototype,`cronJobsTotal`,void 0),J([s()],$.prototype,`cronJobsHasMore`,void 0),J([s()],$.prototype,`cronJobsNextOffset`,void 0),J([s()],$.prototype,`cronJobsLimit`,void 0),J([s()],$.prototype,`cronJobsQuery`,void 0),J([s()],$.prototype,`cronJobsEnabledFilter`,void 0),J([s()],$.prototype,`cronJobsScheduleKindFilter`,void 0),J([s()],$.prototype,`cronJobsLastStatusFilter`,void 0),J([s()],$.prototype,`cronJobsSortBy`,void 0),J([s()],$.prototype,`cronJobsSortDir`,void 0),J([s()],$.prototype,`cronStatus`,void 0),J([s()],$.prototype,`cronError`,void 0),J([s()],$.prototype,`cronForm`,void 0),J([s()],$.prototype,`cronFormCollapsed`,void 0),J([s()],$.prototype,`cronFieldErrors`,void 0),J([s()],$.prototype,`cronEditingJobId`,void 0),J([s()],$.prototype,`cronRunsJobId`,void 0),J([s()],$.prototype,`cronRunsLoadingMore`,void 0),J([s()],$.prototype,`cronRuns`,void 0),J([s()],$.prototype,`cronRunsTotal`,void 0),J([s()],$.prototype,`cronRunsHasMore`,void 0),J([s()],$.prototype,`cronRunsNextOffset`,void 0),J([s()],$.prototype,`cronRunsLimit`,void 0),J([s()],$.prototype,`cronRunsScope`,void 0),J([s()],$.prototype,`cronRunsStatuses`,void 0),J([s()],$.prototype,`cronRunsDeliveryStatuses`,void 0),J([s()],$.prototype,`cronRunsStatusFilter`,void 0),J([s()],$.prototype,`cronRunsQuery`,void 0),J([s()],$.prototype,`cronRunsSortDir`,void 0),J([s()],$.prototype,`cronModelSuggestions`,void 0),J([s()],$.prototype,`cronBusy`,void 0),J([s()],$.prototype,`updateAvailable`,void 0),J([s()],$.prototype,`attentionItems`,void 0),J([s()],$.prototype,`paletteOpen`,void 0),J([s()],$.prototype,`paletteQuery`,void 0),J([s()],$.prototype,`paletteActiveIndex`,void 0),J([s()],$.prototype,`overviewShowGatewayToken`,void 0),J([s()],$.prototype,`overviewShowGatewayPassword`,void 0),J([s()],$.prototype,`overviewLogLines`,void 0),J([s()],$.prototype,`overviewLogCursor`,void 0),J([s()],$.prototype,`skillsLoading`,void 0),J([s()],$.prototype,`skillsReport`,void 0),J([s()],$.prototype,`skillsError`,void 0),J([s()],$.prototype,`skillsFilter`,void 0),J([s()],$.prototype,`skillsStatusFilter`,void 0),J([s()],$.prototype,`skillEdits`,void 0),J([s()],$.prototype,`skillsBusyKey`,void 0),J([s()],$.prototype,`skillMessages`,void 0),J([s()],$.prototype,`skillsDetailKey`,void 0),J([s()],$.prototype,`skillsDetailTab`,void 0),J([s()],$.prototype,`clawhubSearchQuery`,void 0),J([s()],$.prototype,`clawhubSearchResults`,void 0),J([s()],$.prototype,`clawhubSearchLoading`,void 0),J([s()],$.prototype,`clawhubSearchError`,void 0),J([s()],$.prototype,`clawhubDetail`,void 0),J([s()],$.prototype,`clawhubDetailSlug`,void 0),J([s()],$.prototype,`clawhubDetailLoading`,void 0),J([s()],$.prototype,`clawhubDetailError`,void 0),J([s()],$.prototype,`clawhubInstallSlug`,void 0),J([s()],$.prototype,`clawhubInstallMessage`,void 0),J([s()],$.prototype,`clawhubVerdicts`,void 0),J([s()],$.prototype,`clawhubVerdictsLoading`,void 0),J([s()],$.prototype,`clawhubVerdictsError`,void 0),J([s()],$.prototype,`skillCardContents`,void 0),J([s()],$.prototype,`skillCardContentKeys`,void 0),J([s()],$.prototype,`skillCardLoadingKey`,void 0),J([s()],$.prototype,`skillCardErrors`,void 0),J([s()],$.prototype,`healthLoading`,void 0),J([s()],$.prototype,`healthResult`,void 0),J([s()],$.prototype,`healthError`,void 0),J([s()],$.prototype,`modelAuthStatusLoading`,void 0),J([s()],$.prototype,`modelAuthStatusResult`,void 0),J([s()],$.prototype,`modelAuthStatusError`,void 0),J([s()],$.prototype,`debugLoading`,void 0),J([s()],$.prototype,`debugStatus`,void 0),J([s()],$.prototype,`debugHealth`,void 0),J([s()],$.prototype,`debugModels`,void 0),J([s()],$.prototype,`debugHeartbeat`,void 0),J([s()],$.prototype,`debugCallMethod`,void 0),J([s()],$.prototype,`debugCallParams`,void 0),J([s()],$.prototype,`debugCallResult`,void 0),J([s()],$.prototype,`debugCallError`,void 0),J([s()],$.prototype,`webPushSupported`,void 0),J([s()],$.prototype,`webPushPermission`,void 0),J([s()],$.prototype,`webPushSubscribed`,void 0),J([s()],$.prototype,`webPushLoading`,void 0),J([s()],$.prototype,`logsLoading`,void 0),J([s()],$.prototype,`logsError`,void 0),J([s()],$.prototype,`logsFile`,void 0),J([s()],$.prototype,`logsEntries`,void 0),J([s()],$.prototype,`logsFilterText`,void 0),J([s()],$.prototype,`logsLevelFilters`,void 0),J([s()],$.prototype,`logsAutoFollow`,void 0),J([s()],$.prototype,`logsTruncated`,void 0),J([s()],$.prototype,`logsCursor`,void 0),J([s()],$.prototype,`logsLastFetchAt`,void 0),J([s()],$.prototype,`logsLimit`,void 0),J([s()],$.prototype,`logsMaxBytes`,void 0),J([s()],$.prototype,`logsAtBottom`,void 0),J([s()],$.prototype,`chatNewMessagesBelow`,void 0),customElements.get(`fengming-app`)||customElements.define(`fengming-app`,$),`serviceWorker`in navigator){let e=new URL(`./sw.js`,window.location.href);e.searchParams.set(`v`,`0.3.9-7f24a1dc5720`),navigator.serviceWorker.register(e,{updateViaCache:`none`})}export{Pa as $,Hx as A,Da as B,Tx as C,Wx as D,Gx as E,yc as F,Ja as G,Ua as H,vc as I,Va as J,ga as K,_c as L,L_ as M,F_ as N,$x as O,Yu as P,Ma as Q,wc as R,tS as S,hx as T,Oa as U,Aa as V,qa as W,ja as X,ka as Y,Fa as Z,dD as _,ZB as a,rn as at,qx as b,XB as c,tn as ct,RM as d,Ya as et,zM as f,_D as g,sk as h,QB as i,mi as it,ky as j,eS as k,nR as l,Ue as lt,ck as m,eV as n,ma as nt,YB as o,$t as ot,LM as p,Na as q,$B as r,Li as rt,JB as s,nn as st,hV as t,ha as tt,RL as u,q as v,ix as w,Kx as x,Rb as y,Xo as z};
|
|
7214
|
-
//# sourceMappingURL=index-
|
|
7213
|
+
`,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.dreamingStatusLoading=!1,this.dreamingStatusError=null,this.dreamingStatus=null,this.dreamingModeSaving=!1,this.dreamingRestartConfirmOpen=!1,this.dreamingRestartConfirmLoading=!1,this.dreamingPendingEnabled=null,this.dreamDiaryLoading=!1,this.dreamDiaryActionLoading=!1,this.dreamDiaryActionMessage=null,this.dreamDiaryActionArchivePath=null,this.dreamDiaryError=null,this.dreamDiaryPath=null,this.dreamDiaryContent=null,this.wikiImportInsightsLoading=!1,this.wikiImportInsightsError=null,this.wikiImportInsights=null,this.wikiMemoryPalaceLoading=!1,this.wikiMemoryPalaceError=null,this.wikiMemoryPalace=null,this.configFormDirty=!1,this.configSettingsMode=`quick`,this.configFormMode=`form`,this.configSearchQuery=``,this.configActiveSection=null,this.configActiveSubsection=null,this.pendingUpdateExpectedVersion=null,this.updateStatusBanner=null,this.communicationsFormMode=`form`,this.communicationsSearchQuery=``,this.communicationsActiveSection=null,this.communicationsActiveSubsection=null,this.appearanceFormMode=`form`,this.appearanceSearchQuery=``,this.appearanceActiveSection=null,this.appearanceActiveSubsection=null,this.automationFormMode=`form`,this.automationSearchQuery=``,this.automationActiveSection=null,this.automationActiveSubsection=null,this.infrastructureFormMode=`form`,this.infrastructureSearchQuery=``,this.infrastructureActiveSection=null,this.infrastructureActiveSubsection=null,this.aiAgentsFormMode=`form`,this.aiAgentsSearchQuery=``,this.aiAgentsActiveSection=null,this.aiAgentsActiveSubsection=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=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.toolsCatalogLoading=!1,this.toolsCatalogError=null,this.toolsCatalogResult=null,this.toolsEffectiveLoading=!1,this.toolsEffectiveLoadingKey=null,this.toolsEffectiveResultKey=null,this.toolsEffectiveError=null,this.toolsEffectiveResult=null,this.agentsPanel=`files`,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=mg.activeMinutes,this.sessionsFilterLimit=mg.limit,this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.sessionsShowArchived=!1,this.sessionsFiltersCollapsed=!1,this.sessionsHideCron=!0,this.sessionsSearchQuery=``,this.sessionsSortColumn=`updated`,this.sessionsSortDir=`desc`,this.sessionsPage=0,this.sessionsPageSize=25,this.sessionsSelectedKeys=new Set,this.sessionsExpandedCheckpointKey=null,this.sessionsCheckpointItemsByKey={},this.sessionsCheckpointLoadingKey=null,this.sessionsCheckpointBusyKey=null,this.sessionsCheckpointErrorByKey={},this.usageLoading=!1,this.usageResult=null,this.usageCostSummary=null,this.usageError=null,this.usageStartDate=(()=>{let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`})(),this.usageEndDate=(()=>{let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`})(),this.usageScope=`family`,this.usageAgentId=null,this.usageSelectedSessions=[],this.usageSelectedDays=[],this.usageSelectedHours=[],this.usageChartMode=`tokens`,this.usageDailyChartMode=`by-type`,this.usageTimeSeriesMode=`per-turn`,this.usageTimeSeriesBreakdownMode=`by-type`,this.usageTimeSeries=null,this.usageTimeSeriesLoading=!1,this.usageTimeSeriesCursorStart=null,this.usageTimeSeriesCursorEnd=null,this.usageSessionLogs=null,this.usageSessionLogsLoading=!1,this.usageSessionLogsExpanded=!1,this.usageQuery=``,this.usageQueryDraft=``,this.usageSessionSort=`recent`,this.usageSessionSortDir=`desc`,this.usageRecentSessions=[],this.usageTimeZone=`local`,this.usageContextExpanded=!1,this.usageHeaderPinned=!1,this.usageSessionsTab=`all`,this.usageVisibleColumns=[`channel`,`agent`,`provider`,`model`,`messages`,`tools`,`errors`,`duration`],this.usageLogFilterRoles=[],this.usageLogFilterTools=[],this.usageLogFilterHasTools=!1,this.usageLogFilterQuery=``,this.usageQueryDebounceTimer=null,this.cronLoading=!1,this.cronQuickCreateOpen=!1,this.cronQuickCreateStep=`what`,this.cronQuickCreateDraft=null,this.cronJobsLoadingMore=!1,this.cronJobsReloadPending=!1,this.cronJobsReloadPendingTableFilters=!1,this.cronJobs=[],this.cronJobsTotal=0,this.cronJobsHasMore=!1,this.cronJobsNextOffset=null,this.cronJobsLimit=50,this.cronJobsQuery=``,this.cronJobsEnabledFilter=`all`,this.cronJobsScheduleKindFilter=`all`,this.cronJobsLastStatusFilter=`all`,this.cronJobsSortBy=`nextRunAtMs`,this.cronJobsSortDir=`asc`,this.cronStatus=null,this.cronError=null,this.cronForm={...hg},this.cronFormCollapsed=!0,this.cronFieldErrors={},this.cronEditingJobId=null,this.cronRunsJobId=null,this.cronRunsLoadingMore=!1,this.cronRuns=[],this.cronRunsTotal=0,this.cronRunsHasMore=!1,this.cronRunsNextOffset=null,this.cronRunsLimit=50,this.cronRunsScope=`all`,this.cronRunsStatuses=[],this.cronRunsDeliveryStatuses=[],this.cronRunsStatusFilter=`all`,this.cronRunsQuery=``,this.cronRunsSortDir=`desc`,this.cronModelSuggestions=[],this.cronBusy=!1,this.updateAvailable=null,this.attentionItems=[],this.paletteOpen=!1,this.paletteQuery=``,this.paletteActiveIndex=0,this.overviewShowGatewayToken=!1,this.overviewShowGatewayPassword=!1,this.overviewLogLines=[],this.overviewLogCursor=0,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter=``,this.skillsStatusFilter=`all`,this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.skillsDetailKey=null,this.skillsDetailTab=`overview`,this.clawhubSearchQuery=``,this.clawhubSearchResults=null,this.clawhubSearchLoading=!1,this.clawhubSearchError=null,this.clawhubDetail=null,this.clawhubDetailSlug=null,this.clawhubDetailLoading=!1,this.clawhubDetailError=null,this.clawhubInstallSlug=null,this.clawhubInstallMessage=null,this.clawhubVerdicts={},this.clawhubVerdictsLoading=!1,this.clawhubVerdictsError=null,this.skillCardContents={},this.skillCardContentKeys={},this.skillCardLoadingKey=null,this.skillCardErrors={},this.healthLoading=!1,this.healthResult=null,this.healthError=null,this.modelAuthStatusLoading=!1,this.modelAuthStatusResult=null,this.modelAuthStatusError=null,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.webPushSupported=!1,this.webPushPermission=`unsupported`,this.webPushSubscribed=!1,this.webPushLoading=!1,this.logsLoading=!1,this.logsError=null,this.logsFile=null,this.logsEntries=[],this.logsFilterText=``,this.logsLevelFilters={...pg},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.chatLastScrollTop=0,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.chatIsProgrammaticScroll=!1,this.chatProgrammaticScrollTarget=0,this.chatNewMessagesBelow=!1,this.nodesPollInterval=null,this.logsPollInterval=null,this.debugPollInterval=null,this.sessionsChangedReloadTimer=null,this.logsScrollFrame=null,this.activityScrollFrame=null,this.controlUiResponsivenessObserver=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.refreshSessionsAfterChat=new Set,this.chatSideResultTerminalRuns=new Set,this.basePath=``,this.popStateHandler=()=>SA(this),this.topbarObserver=null,this.globalKeydownHandler=e=>{(e.metaKey||e.ctrlKey)&&!e.shiftKey&&e.key===`k`&&(e.preventDefault(),this.paletteOpen=!this.paletteOpen,this.paletteOpen&&(this.paletteQuery=``,this.paletteActiveIndex=0))},this.chatMobileControlsKeydownHandler=e=>{if(e.key===`Escape`){if(this.chatSessionPickerOpen){e.preventDefault(),this.chatSessionPickerOpen=!1,this.chatSessionPickerSurface=null;return}this.chatMobileControlsOpen&&(e.preventDefault(),this.setChatMobileControlsOpen(!1,{restoreFocus:!0}))}},this.chatMobileControlsPointerdownHandler=e=>{let t=e.composedPath();if(this.chatSessionPickerOpen&&(Array.from(this.querySelectorAll(`.chat-controls__session-picker`)).some(e=>t.includes(e))||(this.chatSessionPickerOpen=!1,this.chatSessionPickerSurface=null)),!this.chatMobileControlsOpen)return;let n=this.querySelector(`.chat-mobile-controls-wrapper`);n&&t.includes(n)||this.setChatMobileControlsOpen(!1)},h(this.settings.locale)&&_.setLocale(this.settings.locale)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.onSlashAction=async e=>{switch(e){case`new-session`:await lP(this);break;case`toggle-focus`:this.applySettings({...this.settings,chatFocusMode:!this.settings.chatFocusMode});break;case`export`:FE(this.chatMessages,this.assistantName);break;case`refresh-tools-effective`:await A_(this);break}},document.addEventListener(`keydown`,this.globalKeydownHandler),document.addEventListener(`keydown`,this.chatMobileControlsKeydownHandler),document.addEventListener(`pointerdown`,this.chatMobileControlsPointerdownHandler),dM(this),this.nativeBridgeCleanup=xM(this),this.initWebPushState()}firstUpdated(){fM(this)}disconnectedCallback(){document.removeEventListener(`keydown`,this.globalKeydownHandler),this.nativeBridgeCleanup?.(),this.nativeBridgeCleanup=null,document.removeEventListener(`keydown`,this.chatMobileControlsKeydownHandler),document.removeEventListener(`pointerdown`,this.chatMobileControlsPointerdownHandler),this.sessionSwitchNoticeTimer!==null&&(window.clearTimeout(this.sessionSwitchNoticeTimer),this.sessionSwitchNoticeTimer=null),this.sessionSwitchFlashTimer!==null&&(window.clearTimeout(this.sessionSwitchFlashTimer),this.sessionSwitchFlashTimer=null),this.chatMobileControlsTrigger=null,gM(this),super.disconnectedCallback()}updated(e){if(_M(this,e),e.has(`tab`)&&this.tab!==`chat`&&this.chatMobileControlsOpen&&this.setChatMobileControlsOpen(!1),!e.has(`sessionKey`)||this.agentsPanel!==`tools`)return;let t=Xc(this.sessionKey);if(this.agentsSelectedId&&this.agentsSelectedId===t){D_(this,{agentId:this.agentsSelectedId,sessionKey:this.sessionKey});return}this.toolsEffectiveResult=null,this.toolsEffectiveResultKey=null,this.toolsEffectiveError=null,this.toolsEffectiveLoading=!1,this.toolsEffectiveLoadingKey=null}connect(){tM(this)}handleChatScroll(e){Ho(this,e)}handleLogsScroll(e){Uo(this,e)}handleActivityScroll(e){Wo(this,e)}scheduleActivityScroll(e=!1){Vo(this,e)}exportLogs(e,t){Ko(e,t)}resetToolStream(){wl(this)}resetChatScroll(){Go(this)}scrollToBottom(e){Go(this),zo(this,!0,!!e?.smooth,{source:`manual`})}async loadAssistantIdentity(){await WA(this)}applySettings(e){eA(this,e)}applyLocalUserIdentity(e){tA(this,e)}setTab(e){oA(this,e),e!==`chat`&&this.setChatMobileControlsOpen(!1),this.navDrawerOpen=!1}setChatMobileControlsOpen(e,t){if(e){this.chatMobileControlsTrigger=t?.trigger??this.chatMobileControlsTrigger,this.chatMobileControlsOpen=!0;return}let n=t?.restoreFocus?this.chatMobileControlsTrigger:null;this.chatMobileControlsOpen=!1,this.chatSessionPickerSurface===`mobile`&&(this.chatSessionPickerOpen=!1,this.chatSessionPickerSurface=null),this.chatMobileControlsTrigger=null,!(!(n instanceof HTMLElement)||!n.isConnected)&&requestAnimationFrame(()=>{n.isConnected&&n.focus()})}setTheme(e,t){cA(this,e,t),this.themeOrder=this.buildThemeOrder(e)}setThemeMode(e,t){lA(this,e,t)}setCustomThemeImportUrl(e){this.customThemeImportUrl=e,this.customThemeImportMessage?.kind===`error`&&(this.customThemeImportMessage=null)}openCustomThemeImport(){this.customThemeImportExpanded=!0,this.customThemeImportFocusToken+=1,this.settings.customTheme||(this.customThemeImportSelectOnSuccess=!0)}async importCustomTheme(){if(!this.customThemeImportBusy){this.customThemeImportExpanded=!0,this.customThemeImportBusy=!0,this.customThemeImportMessage=null;try{let e=await ii(this.customThemeImportUrl),t=this.theme===`custom`||!this.settings.customTheme||this.customThemeImportSelectOnSuccess;eA(this,{...this.settings,theme:t?`custom`:this.settings.theme,customTheme:e}),this.themeOrder=this.buildThemeOrder(t?`custom`:this.theme),this.customThemeImportUrl=``,this.customThemeImportSelectOnSuccess=!1,this.customThemeImportMessage={kind:`success`,text:`Imported ${e.label}.`}}catch(e){this.customThemeImportMessage={kind:`error`,text:e instanceof Error?e.message:v(`settings.quick.importThemeFailed`)}}finally{this.customThemeImportBusy=!1}}}clearCustomTheme(){let e=this.theme===`custom`?`claw`:this.theme;this.customThemeImportExpanded=!0,this.customThemeImportSelectOnSuccess=!1,eA(this,{...this.settings,theme:e,customTheme:void 0}),this.themeOrder=this.buildThemeOrder(e),this.customThemeImportMessage={kind:`success`,text:v(`settings.quick.clearedTheme`)}}setBorderRadius(e){eA(this,{...this.settings,borderRadius:e}),this.requestUpdate()}setTextScale(e){eA(this,{...this.settings,textScale:e}),this.requestUpdate()}announceSessionSwitch(e,t){let n=++this.sessionSwitchNoticeSeq;this.sessionSwitchNoticeTimer!==null&&window.clearTimeout(this.sessionSwitchNoticeTimer),this.sessionSwitchFlashTimer!==null&&window.clearTimeout(this.sessionSwitchFlashTimer),this.sessionSwitchNotice={id:n,text:v(`chat.switchedSession`,{session:t})},this.sessionSwitchFlashKey=e,this.sessionSwitchFlashTimer=window.setTimeout(()=>{this.sessionSwitchNotice?.id===n&&(this.sessionSwitchFlashKey=null),this.sessionSwitchFlashTimer=null},200),this.sessionSwitchNoticeTimer=window.setTimeout(()=>{this.sessionSwitchNotice?.id===n&&(this.sessionSwitchNotice=null),this.sessionSwitchNoticeTimer=null},2800)}buildThemeOrder(e){return[e,...[...xi].filter(t=>t!==e)]}async loadOverview(e){await kA(this,e)}async loadCron(){await IA(this)}async handleAbortChat(e){await mh(this,e)}handleChatDraftChange(e){Wu(this,e)}handleChatInputHistoryKey(e){return Ju(this,e)}resetChatInputHistoryNavigation(){Uu(this)}removeQueuedMessage(e){Rh(this,e)}async retryQueuedChatMessage(e){await Wh(this,e)}async handleSendChat(e,t){await Gh(this,e,t)}updateRealtimeTalkOptions(e){this.realtimeTalkOptions={...this.realtimeTalkOptions,...e}}buildRealtimeTalkLaunchOptions(){let e=this.realtimeTalkOptions??{provider:``,model:``,voice:``,transport:``,vadThreshold:``,silenceDurationMs:``,prefixPaddingMs:``,reasoningEffort:``},t=e=>e.trim()||void 0,n=e=>{let t=e.trim();if(!t)return;let n=Number(t);return Number.isFinite(n)?n:void 0},r=t(e.transport);return{provider:t(e.provider),model:t(e.model),voice:t(e.voice),transport:r,vadThreshold:n(e.vadThreshold),silenceDurationMs:n(e.silenceDurationMs),prefixPaddingMs:n(e.prefixPaddingMs),reasoningEffort:t(e.reasoningEffort)}}async toggleRealtimeTalk(){if(this.realtimeTalkSession)if(this.realtimeTalkStatus===`error`)this.realtimeTalkSession.stop(),this.realtimeTalkSession=null;else{this.realtimeTalkSession.stop(),this.realtimeTalkSession=null,this.realtimeTalkActive=!1,this.realtimeTalkStatus=`idle`,this.realtimeTalkDetail=null,this.realtimeTalkTranscript=null,this.resetRealtimeTalkConversation();return}if(!this.client||!this.connected){this.lastError=v(`chat.gatewayNotConnected`);return}this.realtimeTalkActive=!0,this.realtimeTalkStatus=`connecting`,this.realtimeTalkDetail=null,this.realtimeTalkTranscript=null,this.resetRealtimeTalkConversation();let e=new hU(this.client,this.sessionKey,{onStatus:(e,t)=>{this.realtimeTalkStatus=e,this.realtimeTalkDetail=t??null,(e===`idle`||e===`error`)&&(this.realtimeTalkActive=e!==`idle`)},onTranscript:e=>{this.realtimeTalkTranscript=`${e.role===`user`?`You`:`FengMing`}: ${e.text}`,this.realtimeTalkConversationState=gH(this.realtimeTalkConversationState,e),this.realtimeTalkConversation=this.realtimeTalkConversationState.entries}},this.buildRealtimeTalkLaunchOptions());this.realtimeTalkSession=e;try{await e.start()}catch(t){e.stop(),this.realtimeTalkSession===e&&(this.realtimeTalkSession=null),this.realtimeTalkActive=!1,this.realtimeTalkStatus=`error`,this.realtimeTalkDetail=t instanceof Error?t.message:String(t),this.lastError=this.realtimeTalkDetail}}resetRealtimeTalkConversation(){this.realtimeTalkConversationState=hH(),this.realtimeTalkConversation=[]}async steerQueuedChatMessage(e){await Ih(this,e)}async handleChannelConfigSave(){await gr(this)}async handleChannelConfigReload(){await _r(this)}async handleExecApprovalDecision(e){let t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{let n=t.kind===`plugin`?`plugin.approval.resolve`:`exec.approval.resolve`;await this.client.request(n,{id:t.id,decision:e}),yj(this,t.id)}catch(e){if(uj(e)){yj(this,t.id),await vj(this);return}if(!this.execApprovalQueue.some(e=>e.id===t.id))return;this.execApprovalError=`Approval failed: ${String(e)}`}finally{this.execApprovalBusy=!1}}}handleGatewayUrlConfirm(){let e=this.pendingGatewayUrl;if(!e)return;let t=this.pendingGatewayToken?.trim()||``;this.pendingGatewayUrl=null,this.pendingGatewayToken=null,eA(this,{...this.settings,gatewayUrl:e,token:t}),this.connect()}handleGatewayUrlCancel(){this.pendingGatewayUrl=null,this.pendingGatewayToken=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){let t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}async initWebPushState(){let e=`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window;if(this.webPushSupported=e,this.webPushPermission=e?Notification.permission:`unsupported`,e)try{let{getExistingSubscription:e}=await hV(async()=>{let{getExistingSubscription:e}=await import(`./push-subscription-CY8GxC_U.js`);return{getExistingSubscription:e}},__vite__mapDeps([18,5]),import.meta.url),t=await e();this.webPushSubscribed=t!==null}catch{}}async reconcileWebPushState(){if(this.client)try{let{getExistingSubscription:e}=await hV(async()=>{let{getExistingSubscription:e}=await import(`./push-subscription-CY8GxC_U.js`);return{getExistingSubscription:e}},__vite__mapDeps([18,5]),import.meta.url),t=await e();if(!t)return;this.webPushSubscribed=!0;let n=t.toJSON();n.endpoint&&n.keys?.p256dh&&n.keys?.auth&&await this.client.request(`push.web.subscribe`,{endpoint:n.endpoint,keys:{p256dh:n.keys.p256dh,auth:n.keys.auth}})}catch{}}async handleWebPushSubscribe(){if(!(!this.client||this.webPushLoading)){this.webPushLoading=!0;try{let{subscribeToWebPush:e}=await hV(async()=>{let{subscribeToWebPush:e}=await import(`./push-subscription-CY8GxC_U.js`);return{subscribeToWebPush:e}},__vite__mapDeps([18,5]),import.meta.url);await e(this.client),this.webPushSubscribed=!0,this.webPushPermission=Notification.permission}catch(e){this.lastError=String(e)}finally{this.webPushLoading=!1,`Notification`in window&&(this.webPushPermission=Notification.permission)}}}async handleWebPushUnsubscribe(){if(!(!this.client||this.webPushLoading)){this.webPushLoading=!0;try{let{unsubscribeFromWebPush:e}=await hV(async()=>{let{unsubscribeFromWebPush:e}=await import(`./push-subscription-CY8GxC_U.js`);return{unsubscribeFromWebPush:e}},__vite__mapDeps([18,5]),import.meta.url);await e(this.client),this.webPushSubscribed=!1}catch(e){this.lastError=String(e)}finally{this.webPushLoading=!1}}}async handleWebPushTest(){if(this.client)try{let{sendTestWebPush:e}=await hV(async()=>{let{sendTestWebPush:e}=await import(`./push-subscription-CY8GxC_U.js`);return{sendTestWebPush:e}},__vite__mapDeps([18,5]),import.meta.url);await e(this.client)}catch(e){this.lastError=String(e)}}render(){return pH(this)}};if(J([s()],$.prototype,`settings`,void 0),J([s()],$.prototype,`password`,void 0),J([s()],$.prototype,`loginShowGatewayToken`,void 0),J([s()],$.prototype,`loginShowGatewayPassword`,void 0),J([s()],$.prototype,`tab`,void 0),J([s()],$.prototype,`onboarding`,void 0),J([s()],$.prototype,`connected`,void 0),J([s()],$.prototype,`theme`,void 0),J([s()],$.prototype,`themeMode`,void 0),J([s()],$.prototype,`themeResolved`,void 0),J([s()],$.prototype,`themeOrder`,void 0),J([s()],$.prototype,`customThemeImportUrl`,void 0),J([s()],$.prototype,`customThemeImportBusy`,void 0),J([s()],$.prototype,`customThemeImportMessage`,void 0),J([s()],$.prototype,`customThemeImportExpanded`,void 0),J([s()],$.prototype,`customThemeImportFocusToken`,void 0),J([s()],$.prototype,`hello`,void 0),J([s()],$.prototype,`lastError`,void 0),J([s()],$.prototype,`lastErrorCode`,void 0),J([s()],$.prototype,`eventLog`,void 0),J([s()],$.prototype,`assistantName`,void 0),J([s()],$.prototype,`assistantAvatar`,void 0),J([s()],$.prototype,`assistantAvatarSource`,void 0),J([s()],$.prototype,`assistantAvatarStatus`,void 0),J([s()],$.prototype,`assistantAvatarReason`,void 0),J([s()],$.prototype,`assistantAvatarUploadBusy`,void 0),J([s()],$.prototype,`assistantAvatarUploadError`,void 0),J([s()],$.prototype,`assistantAgentId`,void 0),J([s()],$.prototype,`userName`,void 0),J([s()],$.prototype,`userAvatar`,void 0),J([s()],$.prototype,`localMediaPreviewRoots`,void 0),J([s()],$.prototype,`embedSandboxMode`,void 0),J([s()],$.prototype,`allowExternalEmbedUrls`,void 0),J([s()],$.prototype,`chatMessageMaxWidth`,void 0),J([s()],$.prototype,`serverVersion`,void 0),J([s()],$.prototype,`sessionKey`,void 0),J([s()],$.prototype,`chatLoading`,void 0),J([s()],$.prototype,`chatSending`,void 0),J([s()],$.prototype,`chatMessage`,void 0),J([s()],$.prototype,`chatMessages`,void 0),J([s()],$.prototype,`chatToolMessages`,void 0),J([s()],$.prototype,`activityEntries`,void 0),J([s()],$.prototype,`activityFilterText`,void 0),J([s()],$.prototype,`activityStatusFilters`,void 0),J([s()],$.prototype,`activityToolFilter`,void 0),J([s()],$.prototype,`activityExpandedIds`,void 0),J([s()],$.prototype,`activityAutoFollow`,void 0),J([s()],$.prototype,`activityAtBottom`,void 0),J([s()],$.prototype,`chatStreamSegments`,void 0),J([s()],$.prototype,`chatStream`,void 0),J([s()],$.prototype,`chatStreamStartedAt`,void 0),J([s()],$.prototype,`chatRunId`,void 0),J([s()],$.prototype,`chatSideResult`,void 0),J([s()],$.prototype,`compactionStatus`,void 0),J([s()],$.prototype,`fallbackStatus`,void 0),J([s()],$.prototype,`chatRunStatus`,void 0),J([s()],$.prototype,`chatAvatarUrl`,void 0),J([s()],$.prototype,`chatAvatarSource`,void 0),J([s()],$.prototype,`chatAvatarStatus`,void 0),J([s()],$.prototype,`chatAvatarReason`,void 0),J([s()],$.prototype,`chatThinkingLevel`,void 0),J([s()],$.prototype,`chatModelOverrides`,void 0),J([s()],$.prototype,`chatModelSwitchPromises`,void 0),J([s()],$.prototype,`chatModelsLoading`,void 0),J([s()],$.prototype,`chatModelCatalog`,void 0),J([s()],$.prototype,`sessionSwitchNotice`,void 0),J([s()],$.prototype,`sessionSwitchFlashKey`,void 0),J([s()],$.prototype,`chatSessionPickerOpen`,void 0),J([s()],$.prototype,`chatSessionPickerSurface`,void 0),J([s()],$.prototype,`chatSessionPickerQuery`,void 0),J([s()],$.prototype,`chatSessionPickerAppliedQuery`,void 0),J([s()],$.prototype,`chatSessionPickerLoading`,void 0),J([s()],$.prototype,`chatSessionPickerError`,void 0),J([s()],$.prototype,`chatSessionPickerResult`,void 0),J([s()],$.prototype,`chatQueue`,void 0),J([s()],$.prototype,`chatQueueBySession`,void 0),J([s()],$.prototype,`chatAttachments`,void 0),J([s()],$.prototype,`realtimeTalkActive`,void 0),J([s()],$.prototype,`realtimeTalkStatus`,void 0),J([s()],$.prototype,`realtimeTalkDetail`,void 0),J([s()],$.prototype,`realtimeTalkTranscript`,void 0),J([s()],$.prototype,`realtimeTalkConversation`,void 0),J([s()],$.prototype,`realtimeTalkOptionsOpen`,void 0),J([s()],$.prototype,`realtimeTalkOptions`,void 0),J([s()],$.prototype,`chatManualRefreshInFlight`,void 0),J([s()],$.prototype,`chatHeaderControlsHidden`,void 0),J([s()],$.prototype,`chatMobileControlsOpen`,void 0),J([s()],$.prototype,`navDrawerOpen`,void 0),J([s()],$.prototype,`chatInputHistoryIndex`,void 0),J([s()],$.prototype,`sidebarOpen`,void 0),J([s()],$.prototype,`sidebarContent`,void 0),J([s()],$.prototype,`sidebarError`,void 0),J([s()],$.prototype,`splitRatio`,void 0),J([s()],$.prototype,`nodesLoading`,void 0),J([s()],$.prototype,`nodes`,void 0),J([s()],$.prototype,`devicesLoading`,void 0),J([s()],$.prototype,`devicesError`,void 0),J([s()],$.prototype,`devicesList`,void 0),J([s()],$.prototype,`execApprovalsLoading`,void 0),J([s()],$.prototype,`execApprovalsSaving`,void 0),J([s()],$.prototype,`execApprovalsDirty`,void 0),J([s()],$.prototype,`execApprovalsSnapshot`,void 0),J([s()],$.prototype,`execApprovalsForm`,void 0),J([s()],$.prototype,`execApprovalsSelectedAgent`,void 0),J([s()],$.prototype,`execApprovalsTarget`,void 0),J([s()],$.prototype,`execApprovalsTargetNodeId`,void 0),J([s()],$.prototype,`execApprovalQueue`,void 0),J([s()],$.prototype,`execApprovalBusy`,void 0),J([s()],$.prototype,`execApprovalError`,void 0),J([s()],$.prototype,`pendingGatewayUrl`,void 0),J([s()],$.prototype,`configLoading`,void 0),J([s()],$.prototype,`configRaw`,void 0),J([s()],$.prototype,`configRawOriginal`,void 0),J([s()],$.prototype,`configValid`,void 0),J([s()],$.prototype,`configIssues`,void 0),J([s()],$.prototype,`configSaving`,void 0),J([s()],$.prototype,`configApplying`,void 0),J([s()],$.prototype,`updateRunning`,void 0),J([s()],$.prototype,`applySessionKey`,void 0),J([s()],$.prototype,`configSnapshot`,void 0),J([s()],$.prototype,`configSchema`,void 0),J([s()],$.prototype,`configSchemaVersion`,void 0),J([s()],$.prototype,`configSchemaLoading`,void 0),J([s()],$.prototype,`configUiHints`,void 0),J([s()],$.prototype,`configForm`,void 0),J([s()],$.prototype,`configFormOriginal`,void 0),J([s()],$.prototype,`dreamingStatusLoading`,void 0),J([s()],$.prototype,`dreamingStatusError`,void 0),J([s()],$.prototype,`dreamingStatus`,void 0),J([s()],$.prototype,`dreamingModeSaving`,void 0),J([s()],$.prototype,`dreamingRestartConfirmOpen`,void 0),J([s()],$.prototype,`dreamingRestartConfirmLoading`,void 0),J([s()],$.prototype,`dreamingPendingEnabled`,void 0),J([s()],$.prototype,`dreamDiaryLoading`,void 0),J([s()],$.prototype,`dreamDiaryActionLoading`,void 0),J([s()],$.prototype,`dreamDiaryActionMessage`,void 0),J([s()],$.prototype,`dreamDiaryActionArchivePath`,void 0),J([s()],$.prototype,`dreamDiaryError`,void 0),J([s()],$.prototype,`dreamDiaryPath`,void 0),J([s()],$.prototype,`dreamDiaryContent`,void 0),J([s()],$.prototype,`wikiImportInsightsLoading`,void 0),J([s()],$.prototype,`wikiImportInsightsError`,void 0),J([s()],$.prototype,`wikiImportInsights`,void 0),J([s()],$.prototype,`wikiMemoryPalaceLoading`,void 0),J([s()],$.prototype,`wikiMemoryPalaceError`,void 0),J([s()],$.prototype,`wikiMemoryPalace`,void 0),J([s()],$.prototype,`configFormDirty`,void 0),J([s()],$.prototype,`configSettingsMode`,void 0),J([s()],$.prototype,`configFormMode`,void 0),J([s()],$.prototype,`configSearchQuery`,void 0),J([s()],$.prototype,`configActiveSection`,void 0),J([s()],$.prototype,`configActiveSubsection`,void 0),J([s()],$.prototype,`pendingUpdateExpectedVersion`,void 0),J([s()],$.prototype,`updateStatusBanner`,void 0),J([s()],$.prototype,`communicationsFormMode`,void 0),J([s()],$.prototype,`communicationsSearchQuery`,void 0),J([s()],$.prototype,`communicationsActiveSection`,void 0),J([s()],$.prototype,`communicationsActiveSubsection`,void 0),J([s()],$.prototype,`appearanceFormMode`,void 0),J([s()],$.prototype,`appearanceSearchQuery`,void 0),J([s()],$.prototype,`appearanceActiveSection`,void 0),J([s()],$.prototype,`appearanceActiveSubsection`,void 0),J([s()],$.prototype,`automationFormMode`,void 0),J([s()],$.prototype,`automationSearchQuery`,void 0),J([s()],$.prototype,`automationActiveSection`,void 0),J([s()],$.prototype,`automationActiveSubsection`,void 0),J([s()],$.prototype,`infrastructureFormMode`,void 0),J([s()],$.prototype,`infrastructureSearchQuery`,void 0),J([s()],$.prototype,`infrastructureActiveSection`,void 0),J([s()],$.prototype,`infrastructureActiveSubsection`,void 0),J([s()],$.prototype,`aiAgentsFormMode`,void 0),J([s()],$.prototype,`aiAgentsSearchQuery`,void 0),J([s()],$.prototype,`aiAgentsActiveSection`,void 0),J([s()],$.prototype,`aiAgentsActiveSubsection`,void 0),J([s()],$.prototype,`channelsLoading`,void 0),J([s()],$.prototype,`channelsSnapshot`,void 0),J([s()],$.prototype,`channelsError`,void 0),J([s()],$.prototype,`channelsLastSuccess`,void 0),J([s()],$.prototype,`presenceLoading`,void 0),J([s()],$.prototype,`presenceEntries`,void 0),J([s()],$.prototype,`presenceError`,void 0),J([s()],$.prototype,`presenceStatus`,void 0),J([s()],$.prototype,`agentsLoading`,void 0),J([s()],$.prototype,`agentsList`,void 0),J([s()],$.prototype,`agentsError`,void 0),J([s()],$.prototype,`agentsSelectedId`,void 0),J([s()],$.prototype,`toolsCatalogLoading`,void 0),J([s()],$.prototype,`toolsCatalogError`,void 0),J([s()],$.prototype,`toolsCatalogResult`,void 0),J([s()],$.prototype,`toolsEffectiveLoading`,void 0),J([s()],$.prototype,`toolsEffectiveLoadingKey`,void 0),J([s()],$.prototype,`toolsEffectiveResultKey`,void 0),J([s()],$.prototype,`toolsEffectiveError`,void 0),J([s()],$.prototype,`toolsEffectiveResult`,void 0),J([s()],$.prototype,`agentsPanel`,void 0),J([s()],$.prototype,`agentFilesLoading`,void 0),J([s()],$.prototype,`agentFilesError`,void 0),J([s()],$.prototype,`agentFilesList`,void 0),J([s()],$.prototype,`agentFileContents`,void 0),J([s()],$.prototype,`agentFileDrafts`,void 0),J([s()],$.prototype,`agentFileActive`,void 0),J([s()],$.prototype,`agentFileSaving`,void 0),J([s()],$.prototype,`agentIdentityLoading`,void 0),J([s()],$.prototype,`agentIdentityError`,void 0),J([s()],$.prototype,`agentIdentityById`,void 0),J([s()],$.prototype,`agentSkillsLoading`,void 0),J([s()],$.prototype,`agentSkillsError`,void 0),J([s()],$.prototype,`agentSkillsReport`,void 0),J([s()],$.prototype,`agentSkillsAgentId`,void 0),J([s()],$.prototype,`sessionsLoading`,void 0),J([s()],$.prototype,`sessionsResult`,void 0),J([s()],$.prototype,`sessionsError`,void 0),J([s()],$.prototype,`sessionsFilterActive`,void 0),J([s()],$.prototype,`sessionsFilterLimit`,void 0),J([s()],$.prototype,`sessionsIncludeGlobal`,void 0),J([s()],$.prototype,`sessionsIncludeUnknown`,void 0),J([s()],$.prototype,`sessionsShowArchived`,void 0),J([s()],$.prototype,`sessionsFiltersCollapsed`,void 0),J([s()],$.prototype,`sessionsHideCron`,void 0),J([s()],$.prototype,`sessionsSearchQuery`,void 0),J([s()],$.prototype,`sessionsSortColumn`,void 0),J([s()],$.prototype,`sessionsSortDir`,void 0),J([s()],$.prototype,`sessionsPage`,void 0),J([s()],$.prototype,`sessionsPageSize`,void 0),J([s()],$.prototype,`sessionsSelectedKeys`,void 0),J([s()],$.prototype,`sessionsExpandedCheckpointKey`,void 0),J([s()],$.prototype,`sessionsCheckpointItemsByKey`,void 0),J([s()],$.prototype,`sessionsCheckpointLoadingKey`,void 0),J([s()],$.prototype,`sessionsCheckpointBusyKey`,void 0),J([s()],$.prototype,`sessionsCheckpointErrorByKey`,void 0),J([s()],$.prototype,`usageLoading`,void 0),J([s()],$.prototype,`usageResult`,void 0),J([s()],$.prototype,`usageCostSummary`,void 0),J([s()],$.prototype,`usageError`,void 0),J([s()],$.prototype,`usageStartDate`,void 0),J([s()],$.prototype,`usageEndDate`,void 0),J([s()],$.prototype,`usageScope`,void 0),J([s()],$.prototype,`usageAgentId`,void 0),J([s()],$.prototype,`usageSelectedSessions`,void 0),J([s()],$.prototype,`usageSelectedDays`,void 0),J([s()],$.prototype,`usageSelectedHours`,void 0),J([s()],$.prototype,`usageChartMode`,void 0),J([s()],$.prototype,`usageDailyChartMode`,void 0),J([s()],$.prototype,`usageTimeSeriesMode`,void 0),J([s()],$.prototype,`usageTimeSeriesBreakdownMode`,void 0),J([s()],$.prototype,`usageTimeSeries`,void 0),J([s()],$.prototype,`usageTimeSeriesLoading`,void 0),J([s()],$.prototype,`usageTimeSeriesCursorStart`,void 0),J([s()],$.prototype,`usageTimeSeriesCursorEnd`,void 0),J([s()],$.prototype,`usageSessionLogs`,void 0),J([s()],$.prototype,`usageSessionLogsLoading`,void 0),J([s()],$.prototype,`usageSessionLogsExpanded`,void 0),J([s()],$.prototype,`usageQuery`,void 0),J([s()],$.prototype,`usageQueryDraft`,void 0),J([s()],$.prototype,`usageSessionSort`,void 0),J([s()],$.prototype,`usageSessionSortDir`,void 0),J([s()],$.prototype,`usageRecentSessions`,void 0),J([s()],$.prototype,`usageTimeZone`,void 0),J([s()],$.prototype,`usageContextExpanded`,void 0),J([s()],$.prototype,`usageHeaderPinned`,void 0),J([s()],$.prototype,`usageSessionsTab`,void 0),J([s()],$.prototype,`usageVisibleColumns`,void 0),J([s()],$.prototype,`usageLogFilterRoles`,void 0),J([s()],$.prototype,`usageLogFilterTools`,void 0),J([s()],$.prototype,`usageLogFilterHasTools`,void 0),J([s()],$.prototype,`usageLogFilterQuery`,void 0),J([s()],$.prototype,`cronLoading`,void 0),J([s()],$.prototype,`cronQuickCreateOpen`,void 0),J([s()],$.prototype,`cronQuickCreateStep`,void 0),J([s()],$.prototype,`cronQuickCreateDraft`,void 0),J([s()],$.prototype,`cronJobsLoadingMore`,void 0),J([s()],$.prototype,`cronJobs`,void 0),J([s()],$.prototype,`cronJobsTotal`,void 0),J([s()],$.prototype,`cronJobsHasMore`,void 0),J([s()],$.prototype,`cronJobsNextOffset`,void 0),J([s()],$.prototype,`cronJobsLimit`,void 0),J([s()],$.prototype,`cronJobsQuery`,void 0),J([s()],$.prototype,`cronJobsEnabledFilter`,void 0),J([s()],$.prototype,`cronJobsScheduleKindFilter`,void 0),J([s()],$.prototype,`cronJobsLastStatusFilter`,void 0),J([s()],$.prototype,`cronJobsSortBy`,void 0),J([s()],$.prototype,`cronJobsSortDir`,void 0),J([s()],$.prototype,`cronStatus`,void 0),J([s()],$.prototype,`cronError`,void 0),J([s()],$.prototype,`cronForm`,void 0),J([s()],$.prototype,`cronFormCollapsed`,void 0),J([s()],$.prototype,`cronFieldErrors`,void 0),J([s()],$.prototype,`cronEditingJobId`,void 0),J([s()],$.prototype,`cronRunsJobId`,void 0),J([s()],$.prototype,`cronRunsLoadingMore`,void 0),J([s()],$.prototype,`cronRuns`,void 0),J([s()],$.prototype,`cronRunsTotal`,void 0),J([s()],$.prototype,`cronRunsHasMore`,void 0),J([s()],$.prototype,`cronRunsNextOffset`,void 0),J([s()],$.prototype,`cronRunsLimit`,void 0),J([s()],$.prototype,`cronRunsScope`,void 0),J([s()],$.prototype,`cronRunsStatuses`,void 0),J([s()],$.prototype,`cronRunsDeliveryStatuses`,void 0),J([s()],$.prototype,`cronRunsStatusFilter`,void 0),J([s()],$.prototype,`cronRunsQuery`,void 0),J([s()],$.prototype,`cronRunsSortDir`,void 0),J([s()],$.prototype,`cronModelSuggestions`,void 0),J([s()],$.prototype,`cronBusy`,void 0),J([s()],$.prototype,`updateAvailable`,void 0),J([s()],$.prototype,`attentionItems`,void 0),J([s()],$.prototype,`paletteOpen`,void 0),J([s()],$.prototype,`paletteQuery`,void 0),J([s()],$.prototype,`paletteActiveIndex`,void 0),J([s()],$.prototype,`overviewShowGatewayToken`,void 0),J([s()],$.prototype,`overviewShowGatewayPassword`,void 0),J([s()],$.prototype,`overviewLogLines`,void 0),J([s()],$.prototype,`overviewLogCursor`,void 0),J([s()],$.prototype,`skillsLoading`,void 0),J([s()],$.prototype,`skillsReport`,void 0),J([s()],$.prototype,`skillsError`,void 0),J([s()],$.prototype,`skillsFilter`,void 0),J([s()],$.prototype,`skillsStatusFilter`,void 0),J([s()],$.prototype,`skillEdits`,void 0),J([s()],$.prototype,`skillsBusyKey`,void 0),J([s()],$.prototype,`skillMessages`,void 0),J([s()],$.prototype,`skillsDetailKey`,void 0),J([s()],$.prototype,`skillsDetailTab`,void 0),J([s()],$.prototype,`clawhubSearchQuery`,void 0),J([s()],$.prototype,`clawhubSearchResults`,void 0),J([s()],$.prototype,`clawhubSearchLoading`,void 0),J([s()],$.prototype,`clawhubSearchError`,void 0),J([s()],$.prototype,`clawhubDetail`,void 0),J([s()],$.prototype,`clawhubDetailSlug`,void 0),J([s()],$.prototype,`clawhubDetailLoading`,void 0),J([s()],$.prototype,`clawhubDetailError`,void 0),J([s()],$.prototype,`clawhubInstallSlug`,void 0),J([s()],$.prototype,`clawhubInstallMessage`,void 0),J([s()],$.prototype,`clawhubVerdicts`,void 0),J([s()],$.prototype,`clawhubVerdictsLoading`,void 0),J([s()],$.prototype,`clawhubVerdictsError`,void 0),J([s()],$.prototype,`skillCardContents`,void 0),J([s()],$.prototype,`skillCardContentKeys`,void 0),J([s()],$.prototype,`skillCardLoadingKey`,void 0),J([s()],$.prototype,`skillCardErrors`,void 0),J([s()],$.prototype,`healthLoading`,void 0),J([s()],$.prototype,`healthResult`,void 0),J([s()],$.prototype,`healthError`,void 0),J([s()],$.prototype,`modelAuthStatusLoading`,void 0),J([s()],$.prototype,`modelAuthStatusResult`,void 0),J([s()],$.prototype,`modelAuthStatusError`,void 0),J([s()],$.prototype,`debugLoading`,void 0),J([s()],$.prototype,`debugStatus`,void 0),J([s()],$.prototype,`debugHealth`,void 0),J([s()],$.prototype,`debugModels`,void 0),J([s()],$.prototype,`debugHeartbeat`,void 0),J([s()],$.prototype,`debugCallMethod`,void 0),J([s()],$.prototype,`debugCallParams`,void 0),J([s()],$.prototype,`debugCallResult`,void 0),J([s()],$.prototype,`debugCallError`,void 0),J([s()],$.prototype,`webPushSupported`,void 0),J([s()],$.prototype,`webPushPermission`,void 0),J([s()],$.prototype,`webPushSubscribed`,void 0),J([s()],$.prototype,`webPushLoading`,void 0),J([s()],$.prototype,`logsLoading`,void 0),J([s()],$.prototype,`logsError`,void 0),J([s()],$.prototype,`logsFile`,void 0),J([s()],$.prototype,`logsEntries`,void 0),J([s()],$.prototype,`logsFilterText`,void 0),J([s()],$.prototype,`logsLevelFilters`,void 0),J([s()],$.prototype,`logsAutoFollow`,void 0),J([s()],$.prototype,`logsTruncated`,void 0),J([s()],$.prototype,`logsCursor`,void 0),J([s()],$.prototype,`logsLastFetchAt`,void 0),J([s()],$.prototype,`logsLimit`,void 0),J([s()],$.prototype,`logsMaxBytes`,void 0),J([s()],$.prototype,`logsAtBottom`,void 0),J([s()],$.prototype,`chatNewMessagesBelow`,void 0),customElements.get(`fengming-app`)||customElements.define(`fengming-app`,$),`serviceWorker`in navigator){let e=new URL(`./sw.js`,window.location.href);e.searchParams.set(`v`,`0.3.10-7f24a1dc5720`),navigator.serviceWorker.register(e,{updateViaCache:`none`})}export{Pa as $,Hx as A,Da as B,Tx as C,Wx as D,Gx as E,yc as F,Ja as G,Ua as H,vc as I,Va as J,ga as K,_c as L,L_ as M,F_ as N,$x as O,Yu as P,Ma as Q,wc as R,tS as S,hx as T,Oa as U,Aa as V,qa as W,ja as X,ka as Y,Fa as Z,dD as _,ZB as a,rn as at,qx as b,XB as c,tn as ct,RM as d,Ya as et,zM as f,_D as g,sk as h,QB as i,mi as it,ky as j,eS as k,nR as l,Ue as lt,ck as m,eV as n,ma as nt,YB as o,$t as ot,LM as p,Na as q,$B as r,Li as rt,JB as s,nn as st,hV as t,ha as tt,RL as u,q as v,ix as w,Kx as x,Rb as y,Xo as z};
|
|
7214
|
+
//# sourceMappingURL=index-jUDczxhd.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as e,p as t}from"./lit-runtime-DA0-mbwP.js";import{r as n}from"./i18n-BWPaSddY.js";import{s as r,v as i}from"./index-
|
|
1
|
+
import{f as e,p as t}from"./lit-runtime-DA0-mbwP.js";import{r as n}from"./i18n-BWPaSddY.js";import{s as r,v as i}from"./index-jUDczxhd.js";var a=!1;function o(r){let o=!a;return t`
|
|
2
2
|
<section class="card">
|
|
3
3
|
<div class="row" style="justify-content: space-between;">
|
|
4
4
|
<div>
|
|
@@ -54,4 +54,4 @@ import{f as e,p as t}from"./lit-runtime-DA0-mbwP.js";import{r as n}from"./i18n-B
|
|
|
54
54
|
</div>
|
|
55
55
|
</div>
|
|
56
56
|
`}export{o as renderInstances};
|
|
57
|
-
//# sourceMappingURL=instances-
|
|
57
|
+
//# sourceMappingURL=instances-782ZoDT4.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as e,p as t}from"./lit-runtime-DA0-mbwP.js";import{r as n}from"./i18n-BWPaSddY.js";import{r}from"./string-coerce-BuYUxt7q.js";import{F as i,I as a,lt as o,z as s}from"./index-
|
|
1
|
+
import{f as e,p as t}from"./lit-runtime-DA0-mbwP.js";import{r as n}from"./i18n-BWPaSddY.js";import{r}from"./string-coerce-BuYUxt7q.js";import{F as i,I as a,lt as o,z as s}from"./index-jUDczxhd.js";function c(...e){let t=new Set;for(let n of e){if(!n)continue;if(Array.isArray(n)){for(let e of n){let n=e.trim();n&&t.add(n)}continue}let e=n.trim();e&&t.add(e)}return[...t].toSorted()}function l(e,t){let n=new Set(e);return t.every(e=>n.has(e))}function u(e){return{roles:c(e.roles,e.role),scopes:o(e.scopes)}}function d(e){let t=c(e.roles,e.role),n=Array.isArray(e.tokens)?e.tokens:e.tokens?Object.values(e.tokens):void 0;return{roles:n===void 0?t:c(n.filter(e=>!e.revokedAtMs).flatMap(e=>e.role??[])).filter(e=>t.includes(e)),scopes:o(e.scopes)}}function f(e,t){let n=u(e),r=t?d(t):null;return r?l(r.roles,n.roles)?l(r.scopes,n.scopes)?{kind:`re-approval`,requested:n,approved:r}:{kind:`scope-upgrade`,requested:n,approved:r}:{kind:`role-upgrade`,requested:n,approved:r}:{kind:`new-pairing`,requested:n,approved:null}}function p(e){let t=e?.agents??{},n=Array.isArray(t.list)?t.list:[],i=[];return n.forEach((e,t)=>{if(!e||typeof e!=`object`)return;let n=e,a=r(n.id)??``;if(!a)return;let o=r(n.name),s=n.default===!0;i.push({id:a,name:o,isDefault:s,index:t,record:n})}),i}function m(e,t){let n=new Set(t),i=[];for(let t of e){if(!(Array.isArray(t.commands)?t.commands:[]).some(e=>n.has(String(e))))continue;let e=r(t.nodeId)??``;if(!e)continue;let a=r(t.displayName)??e;i.push({id:e,label:a===e?e:`${a} · ${e}`})}return i.sort((e,t)=>e.label.localeCompare(t.label)),i}var h=`__defaults__`,g=[{value:`deny`,label:`nodes.exec.securityLevels.deny`},{value:`allowlist`,label:`nodes.exec.securityLevels.allowlist`},{value:`full`,label:`nodes.exec.securityLevels.full`}],_=[{value:`off`,label:`nodes.exec.askLevels.off`},{value:`on-miss`,label:`nodes.exec.askLevels.onMiss`},{value:`always`,label:`nodes.exec.askLevels.always`}];function v(e){return e===`allowlist`||e===`full`||e===`deny`?e:`deny`}function y(e){return e===`always`||e===`off`||e===`on-miss`?e:`on-miss`}function b(e){let t=e?.defaults??{};return{security:v(t.security),ask:y(t.ask),askFallback:v(t.askFallback??`deny`),autoAllowSkills:t.autoAllowSkills??!1}}function x(e){return p(e).map(e=>({id:e.id,name:e.name,isDefault:e.isDefault}))}function S(e,t){let n=x(e),r=Object.keys(t?.agents??{}),i=new Map;n.forEach(e=>i.set(e.id,e)),r.forEach(e=>{i.has(e)||i.set(e,{id:e})});let a=Array.from(i.values());return a.length===0&&a.push({id:`main`,isDefault:!0}),a.sort((e,t)=>{if(e.isDefault&&!t.isDefault)return-1;if(!e.isDefault&&t.isDefault)return 1;let n=e.name?.trim()?e.name:e.id,r=t.name?.trim()?t.name:t.id;return n.localeCompare(r)}),a}function C(e,t){return e===h?h:e&&t.some(t=>t.id===e)?e:h}function w(e){let t=e.execApprovalsForm??e.execApprovalsSnapshot?.file??null,n=!!t,r=b(t),i=S(e.configForm,t),a=j(e.nodes),o=e.execApprovalsTarget,s=o===`node`&&e.execApprovalsTargetNodeId?e.execApprovalsTargetNodeId:null;o===`node`&&s&&!a.some(e=>e.id===s)&&(s=null);let c=C(e.execApprovalsSelectedAgent,i),l=c===h?null:(t?.agents??{})[c]??null,u=Array.isArray(l?.allowlist)?l.allowlist??[]:[];return{ready:n,disabled:e.execApprovalsSaving||e.execApprovalsLoading,dirty:e.execApprovalsDirty,loading:e.execApprovalsLoading,saving:e.execApprovalsSaving,form:t,defaults:r,selectedScope:c,selectedAgent:l,agents:i,allowlist:u,target:o,targetNodeId:s,targetNodes:a,onSelectScope:e.onExecApprovalsSelectAgent,onSelectTarget:e.onExecApprovalsTargetChange,onPatch:e.onExecApprovalsPatch,onRemove:e.onExecApprovalsRemove,onLoad:e.onLoadExecApprovals,onSave:e.onSaveExecApprovals}}function T(r){let i=r.ready,a=r.target!==`node`||!!r.targetNodeId;return t`
|
|
2
2
|
<section class="card">
|
|
3
3
|
<div class="row" style="justify-content: space-between; align-items: center;">
|
|
4
4
|
<div>
|
|
@@ -441,4 +441,4 @@ import{f as e,p as t}from"./lit-runtime-DA0-mbwP.js";import{r as n}from"./i18n-B
|
|
|
441
441
|
</div>
|
|
442
442
|
</div>
|
|
443
443
|
`}export{M as renderNodes};
|
|
444
|
-
//# sourceMappingURL=nodes-
|
|
444
|
+
//# sourceMappingURL=nodes-BMX16BKM.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as e,p as t}from"./lit-runtime-DA0-mbwP.js";import{r as n}from"./i18n-BWPaSddY.js";import{r,t as i}from"./string-coerce-BuYUxt7q.js";import{P as a,R as o,X as s,c,d as l,f as u,h as d,it as f,m as p,p as m,v as h,z as g}from"./index-
|
|
1
|
+
import{f as e,p as t}from"./lit-runtime-DA0-mbwP.js";import{r as n}from"./i18n-BWPaSddY.js";import{r,t as i}from"./string-coerce-BuYUxt7q.js";import{P as a,R as o,X as s,c,d as l,f as u,h as d,it as f,m as p,p as m,v as h,z as g}from"./index-jUDczxhd.js";var _=[`off`,`minimal`,`low`,`medium`,`high`],v=[``,`off`,`on`,`full`],y=[``,`on`,`off`],b=[``,`off`,`on`,`stream`],x=[10,25,50,100];function S(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]??null:null}function C(e,t){return(!e.modelProvider||e.modelProvider===t?.modelProvider)&&(!e.model||e.model===t?.model)}function ee(e,t){let n=C(e,t),r=l(e.thinkingDefault??(n?t?.thinkingDefault:void 0)),i=e.thinkingLevels?.length?e.thinkingLevels:n&&t?.thinkingLevels?.length?t.thinkingLevels:(e.thinkingOptions?.length?e.thinkingOptions:n&&t?.thinkingOptions?.length?t.thinkingOptions:_).map(e=>({id:m(e),label:e}));return[{value:``,label:r},...i.map(e=>({value:m(e.id),label:u(e.id,e.label)}))]}function te(e,t){return!t||e.includes(t)?[...e]:[...e,t]}function w(e,t){return!t||e.some(e=>e.value===t)?[...e]:[...e,{value:t,label:u(t)}]}function ne(){return v.map(e=>({value:e,label:n(e===``?`sessionsView.inherit`:e===`off`?`sessionsView.offExplicit`:`sessionsView.${e}`)}))}function re(){return y.map(e=>({value:e,label:n(e===``?`sessionsView.inherit`:`sessionsView.${e}`)}))}function T(e){switch(e){case`running`:return n(`sessionsView.statusRunning`);case`done`:return n(`sessionsView.statusDone`);case`failed`:return n(`sessionsView.statusFailed`);case`killed`:return n(`sessionsView.statusKilled`);case`timeout`:return n(`sessionsView.statusTimeout`);default:return n(`sessionsView.statusUnknown`)}}function E(e){if(a(e))return{label:n(`sessionsView.statusLive`),tone:`live`};if(e.status===`running`&&e.hasActiveRun===!1)return{label:n(`sessions.statusIdle`),tone:`idle`};if(e.status){let t=e.status===`done`?`done`:`failed`;return{label:T(e.status),tone:t}}return e.hasActiveRun===!1?{label:n(`sessions.statusIdle`),tone:`idle`}:{label:n(`sessionsView.statusUnknown`),tone:`muted`}}function D(e){let r=E(e),i=`${n(`sessionsView.status`)}: ${r.label}`;return t`
|
|
2
2
|
<span
|
|
3
3
|
class="session-status-badge session-status-badge--${r.tone}"
|
|
4
4
|
title=${i}
|
|
@@ -422,4 +422,4 @@ import{f as e,p as t}from"./lit-runtime-DA0-mbwP.js";import{r as n}from"./i18n-B
|
|
|
422
422
|
</div>
|
|
423
423
|
</td>
|
|
424
424
|
</tr>`]:[]]}export{V as renderSessions};
|
|
425
|
-
//# sourceMappingURL=sessions-
|
|
425
|
+
//# sourceMappingURL=sessions-jLGSApYa.js.map
|