@fased/fased 0.1.66 → 0.1.67
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 +6 -0
- package/README.md +4 -0
- package/dist/brand.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/commands/onboard.js +0 -8
- package/dist/control-ui/assets/{app-DYxADzeH.js → app-De8gTtZU.js} +3 -3
- package/dist/control-ui/assets/{index-vw_10Zeo.js → index-DYYBRBOS.js} +3 -3
- package/dist/control-ui/index.html +1 -1
- package/dist/control-ui/version.json +1 -1
- package/dist/infra/runtime-guard.js +16 -0
- package/dist/plugin-sdk/{audio-preflight-BFLoas5R.js → audio-preflight-Dq_rJtqH.js} +2 -2
- package/dist/plugin-sdk/channel-plugin-common.d.ts +2 -2
- package/dist/plugin-sdk/{chunk-items-TErs62MC.js → chunk-items-Dunoq4Er.js} +1 -1
- package/dist/plugin-sdk/command-status.js +2 -2
- package/dist/plugin-sdk/{config-schema-BPnaDBwZ.js → config-schema--vl89M7d.js} +16 -16
- package/dist/plugin-sdk/device-pair.d.ts +1 -1
- package/dist/plugin-sdk/discord.d.ts +4 -4
- package/dist/plugin-sdk/index.d.ts +15 -15
- package/dist/plugin-sdk/index.js +2 -2
- package/dist/plugin-sdk/{monitor-sW6dQdX1.js → monitor-CV1sr0p2.js} +6 -6
- package/dist/plugin-sdk/{monitor-FuBPk-AL.js → monitor-DrTy_4CL.js} +4 -4
- package/dist/plugin-sdk/{openresponses-http-CVZq0H-P.js → openresponses-http-BAjgURZa.js} +2 -2
- package/dist/plugin-sdk/{pairing-message-L6L6L2YF.d.ts → pairing-message-BjIJYVvp.d.ts} +1 -1
- package/dist/plugin-sdk/provider-web-search-config-contract.d.ts +1 -1
- package/dist/plugin-sdk/{pw-ai-natjh3rm.js → pw-ai-DlxqX6Es.js} +1 -1
- package/dist/plugin-sdk/{runtime-dependency-DczkvPxn.js → runtime-dependency-nup8niQL.js} +9 -9
- package/dist/plugin-sdk/sat-runtime.d.ts +2 -2
- package/dist/plugin-sdk/sat-runtime.js +2 -2
- package/dist/plugin-sdk/{slack-BZISDxDd.js → slack-DSC6T2KW.js} +4 -4
- package/dist/plugin-sdk/slack.d.ts +4 -4
- package/dist/plugin-sdk/{sticker-cache-B0aPv6Lg.js → sticker-cache-C0l_5IKg.js} +2 -2
- package/dist/plugin-sdk/{telegram-actions-H3gePEn6.js → telegram-actions-BwGBIVDE.js} +3 -3
- package/dist/plugin-sdk/telegram.d.ts +4 -4
- package/dist/plugin-sdk/{tmp-fased-dir-d1CmFAnJ.d.ts → tmp-fased-dir-DXnGKKgi.d.ts} +1 -1
- package/dist/plugin-sdk/{types-DUjYaWB2.d.ts → types-Cegc86EP.d.ts} +1 -1
- package/dist/plugin-sdk/{types-xWjHXl1z.d.ts → types-eG9aYqXF.d.ts} +1 -1
- package/dist/plugin-sdk/{web-JwP9PAZR.js → web-C_AH5PyB.js} +2 -2
- package/dist/plugin-sdk/whatsapp.d.ts +9 -9
- package/dist/plugin-sdk/{zod-schema.providers-core-CIzCjXH9.d.ts → zod-schema.providers-core-FaYR6KdD.d.ts} +61 -61
- package/extensions/acpx/package.json +1 -1
- package/extensions/bluebubbles/package.json +1 -1
- package/extensions/copilot-proxy/package.json +1 -1
- package/extensions/diagnostics-otel/package.json +1 -1
- package/extensions/fased-federation/package.json +1 -1
- package/extensions/google-gemini-cli-auth/package.json +1 -1
- package/extensions/imessage/package.json +1 -1
- package/extensions/irc/package.json +1 -1
- package/extensions/line/package.json +1 -1
- package/extensions/llm-task/package.json +1 -1
- package/extensions/lobster/package.json +1 -1
- package/extensions/matrix/CHANGELOG.md +6 -0
- package/extensions/matrix/package.json +1 -1
- package/extensions/mattermost/package.json +1 -1
- package/extensions/memory-core/package.json +2 -2
- package/extensions/memory-lancedb/package.json +1 -1
- package/extensions/minimax-portal-auth/package.json +1 -1
- package/extensions/msteams/CHANGELOG.md +6 -0
- package/extensions/msteams/package.json +1 -1
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nostr/CHANGELOG.md +6 -0
- package/extensions/nostr/package.json +1 -1
- package/extensions/open-prose/package.json +1 -1
- package/extensions/sat-mining/package.json +1 -1
- package/extensions/signal/package.json +1 -1
- package/extensions/synology-chat/package.json +1 -1
- package/extensions/tlon/package.json +1 -1
- package/extensions/twitch/CHANGELOG.md +6 -0
- package/extensions/twitch/package.json +1 -1
- package/extensions/voice-call/CHANGELOG.md +6 -0
- package/extensions/voice-call/package.json +1 -1
- package/extensions/zalo/CHANGELOG.md +6 -0
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalouser/CHANGELOG.md +6 -0
- package/extensions/zalouser/package.json +1 -1
- package/fased.mjs +14 -1
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ This changelog starts with the public Fased Agent release line. Required
|
|
|
4
4
|
third-party and copied-code notices are kept in [LICENSE](./LICENSE) and
|
|
5
5
|
[THIRD_PARTY_NOTICES.md](./THIRD_PARTY_NOTICES.md).
|
|
6
6
|
|
|
7
|
+
## 0.1.67
|
|
8
|
+
|
|
9
|
+
- Reject native Windows npm installs at package selection and fail closed at
|
|
10
|
+
the launcher and central runtime guard; Windows Local remains supported
|
|
11
|
+
through Ubuntu on WSL2.
|
|
12
|
+
|
|
7
13
|
## 0.1.66
|
|
8
14
|
|
|
9
15
|
- Keep normal wallet onboarding to wallet role plus one primary Solana RPC,
|
package/README.md
CHANGED
|
@@ -65,6 +65,10 @@ Ubuntu shell. Do not run the Fased installer in PowerShell, Command Prompt, Git
|
|
|
65
65
|
Bash, or native Windows Node.js. Fased wallet signing requires Unix sockets and
|
|
66
66
|
therefore runs through WSL2 on Windows.
|
|
67
67
|
|
|
68
|
+
The published npm package also rejects native Windows. If npm reports
|
|
69
|
+
`EBADPLATFORM`, open Ubuntu in WSL2 and install or run Fased there; do not force
|
|
70
|
+
the package installation with npm platform overrides.
|
|
71
|
+
|
|
68
72
|
```bash
|
|
69
73
|
curl -fsSL https://raw.githubusercontent.com/fased-ai/fased/main/install.sh | bash -s -- --local
|
|
70
74
|
```
|
package/dist/brand.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const FASED_BRAND_NAME = "Fased";
|
|
3
3
|
const FASED_AGENT_NAME = "Fased Agent";
|
|
4
4
|
const FASED_CONTROL_NAME = "Fased Control";
|
|
5
|
-
const FASED_PRODUCT_VERSION = "0.1.
|
|
5
|
+
const FASED_PRODUCT_VERSION = "0.1.67";
|
|
6
6
|
const FASED_DISPLAY_VERSION = `v${FASED_PRODUCT_VERSION}`;
|
|
7
7
|
function formatFasedDisplayLine() {
|
|
8
8
|
return `${FASED_AGENT_NAME} ${FASED_DISPLAY_VERSION}`;
|
package/dist/build-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
e96ce5db89b3a4aa7e39dc823d1ac8e4d6685340f8f52ddfcf66441a3029793e
|
package/dist/commands/onboard.js
CHANGED
|
@@ -56,14 +56,6 @@ async function onboardCommand(opts, runtime = defaultRuntime) {
|
|
|
56
56
|
const repairScope = normalizedOpts.resetScope ?? "auth+sessions";
|
|
57
57
|
await handleOnboardingRepair(repairScope, runtime);
|
|
58
58
|
}
|
|
59
|
-
if (process.platform === "win32") {
|
|
60
|
-
runtime.log([
|
|
61
|
-
"Windows detected — FasedAgent runs great on WSL2!",
|
|
62
|
-
"Native Windows might be trickier.",
|
|
63
|
-
"Quick setup: wsl --install (one command, one reboot)",
|
|
64
|
-
"Guide: https://docs.fased.ai/windows"
|
|
65
|
-
].join("\n"));
|
|
66
|
-
}
|
|
67
59
|
const previousSuppressOverwrite = process.env.FASED_SUPPRESS_CONFIG_OVERWRITE_LOG;
|
|
68
60
|
process.env.FASED_SUPPRESS_CONFIG_OVERWRITE_LOG = "1";
|
|
69
61
|
try {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./config-LeImukCW.js","./icons-D3-vEvih.js","./open-external-url-ulF1B-sA.js","./providers-CIx9fxc6.js","./chat-model-ref-Djkv93yn.js","./federation-DgA9e-Pn.js","./marketplace-order-evidence-DkR0ZRHa.js","./task-ledger-source-route-C-yTp0QU.js","./wallet-DvStR_AT.js","./wallet-policy-C3ZS66Rl.js","./mining-Dg-3ll0F.js","./mining-commit-DFpB_4JN.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e,t}from"./index-vw_10Zeo.js";import{a as n,c as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"./icons-D3-vEvih.js";import{c as f,d as p,f as m,g as h,h as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as ee,u as w,y as T}from"./open-external-url-ulF1B-sA.js";import{a as E,d as D,i as te,l as O,o as ne,u as k}from"./marketplace-order-evidence-DkR0ZRHa.js";import{C as re,D as A,E as ie,S as j,T as ae,_ as oe,a as se,b as ce,c as M,d as le,f as ue,g as de,h as fe,i as pe,l as me,m as he,n as ge,o as N,p as _e,r as ve,s as ye,t as be,u as xe,v as Se,w as Ce,x as we,y as Te}from"./mining-commit-DFpB_4JN.js";import{B as Ee,F as De,I as Oe,R as ke,a as Ae,i as je,n as Me,o as Ne,r as Pe,t as Fe,z as Ie}from"./chat-model-ref-Djkv93yn.js";import{n as Le,t as Re}from"./task-ledger-source-route-C-yTp0QU.js";import{d as ze,f as Be,h as Ve,i as He,l as Ue,m as We,n as Ge,o as Ke,p as qe,r as Je,s as Ye,u as Xe}from"./wallet-policy-C3ZS66Rl.js";var Ze=e=>(t,n)=>{n===void 0?customElements.define(e,t):n.addInitializer(()=>{customElements.define(e,t)})},Qe={attribute:!0,type:String,converter:a,reflect:!1,hasChanged:r},$e=(e=Qe,t,n)=>{let{kind:r,metadata:i}=n,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),r===`setter`&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),r===`accessor`){let{name:r}=n;return{set(n){let i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e,!0,n)},init(t){return t!==void 0&&this.C(r,void 0,e,t),t}}}if(r===`setter`){let{name:r}=n;return function(n){let i=this[r];t.call(this,n),this.requestUpdate(r,i,e,!0,n)}}throw Error(`Unsupported decorator location: `+r)};function et(e){return(t,n)=>typeof n==`object`?$e(e,t,n):((e,t,n)=>{let r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function P(e){return et({...e,state:!0,attribute:!1})}function tt(e,t){return`${e}:${t??``}`}function nt(e){return`install:${e}`}function rt(e,t){return`qr:${e}:${t??``}`}function it(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}var at={whatsapp:`WhatsApp`,zalouser:`Zalo Personal`};function ot(e,t){return e?.channelLabels?.[t]??at[t]??t}function st(e,t){let n=e?.channels?.[t];if(!it(n)||!it(n.install))return`fased plugins install ${t}`;let r=n.install.localPath;if(typeof r==`string`&&r.trim())return`fased plugins install ${r.trim()}`;let i=n.install.npmSpec;return`fased plugins install ${typeof i==`string`&&i.trim()?i.trim():t}`}function ct(e,t,n){let r=String(e);if(r.includes(`web login provider is not available`)){let e=t?ot(n??null,t):`Channel`;return`${e} QR login is unavailable because the ${e} channel plugin is not loaded. Enable or install it, restart the gateway, then open Show QR again.`}return r}function lt(e,t,n){let r=e.channelQrLogin[t]??{message:null,qrDataUrl:null,connected:null},i={message:`message`in n?n.message??null:r.message,qrDataUrl:`qrDataUrl`in n?n.qrDataUrl??null:r.qrDataUrl,connected:`connected`in n?n.connected??null:r.connected};e.channelQrLogin={...e.channelQrLogin,[t]:i},t===`whatsapp`&&(e.whatsappLoginMessage=i.message,e.whatsappLoginQrDataUrl=i.qrDataUrl,e.whatsappLoginConnected=i.connected)}async function ut(e,t){if(!(!e.client||!e.connected)&&!e.channelsLoading){e.channelsLoading=!0,e.channelsError=null;try{e.channelsSnapshot=await e.client.request(`channels.status`,{probe:t,timeoutMs:8e3}),e.channelsLastSuccess=Date.now()}catch(t){e.channelsError=ct(t)}finally{e.channelsLoading=!1}}}async function dt(e,t,n,r){if(!e.client||!e.connected)return;let i=tt(n,r);if(!e.channelRuntimeBusy[i]){e.channelRuntimeBusy={...e.channelRuntimeBusy,[i]:!0},e.channelsError=null,e.channelsNotice=null;try{await e.client.request(t,{channel:n,...r?{accountId:r}:{}}),await ut(e,!1)}catch(t){e.channelsError=ct(t)}finally{let t={...e.channelRuntimeBusy};delete t[i],e.channelRuntimeBusy=t}}}async function ft(e,t,n){await dt(e,`channels.start`,t,n)}async function pt(e,t,n){await dt(e,`channels.stop`,t,n)}async function mt(e,t,n){if(!e.client||!e.connected)return;let r=tt(t,n);if(!e.channelRuntimeBusy[r]){e.channelRuntimeBusy={...e.channelRuntimeBusy,[r]:!0},e.channelsError=null,e.channelsNotice=null;try{let r=await e.client.request(`channels.logout`,{channel:t,...n?{accountId:n}:{}});await ut(e,!0);let i=r.accountId||n,a=`${t}${i?`/${i}`:``}`;e.channelsNotice=r.cleared||r.loggedOut?`Cleared ${a}.`:`No stored credentials were cleared for ${a}.`}catch(t){e.channelsError=ct(t)}finally{let t={...e.channelRuntimeBusy};delete t[r],e.channelRuntimeBusy=t}}}async function ht(e,t){if(!e.client||!e.connected)return;let n=nt(t);if(!e.channelRuntimeBusy[n]){e.channelRuntimeBusy={...e.channelRuntimeBusy,[n]:!0},e.channelsError=null,e.channelsNotice=null;try{let n=await e.client.request(`plugins.marketplace.install`,{id:t});await ut(e,!1),e.channelsNotice=n.requiresRestart?`${n.message} Restart the gateway to load this channel plugin. Until restart, this channel will stay in restart-required state.`:n.message}catch(n){e.channelsError=`${ct(n)}. Manual install: ${st(e.channelsSnapshot,t)}. Restart the gateway after install.`}finally{let t={...e.channelRuntimeBusy};delete t[n],e.channelRuntimeBusy=t}}}async function gt(e,t,n=!1,r){let i=rt(t,r);if(!(!e.client||!e.connected||e.channelRuntimeBusy[i])&&!(t===`whatsapp`&&e.whatsappBusy)){e.channelRuntimeBusy={...e.channelRuntimeBusy,[i]:!0},t===`whatsapp`&&(e.whatsappBusy=!0);try{let i=await e.client.request(`web.login.start`,{channel:t,force:n,timeoutMs:3e4,...r?{accountId:r}:{}});lt(e,t,{message:i.message??null,qrDataUrl:i.qrDataUrl??null,connected:null})}catch(n){lt(e,t,{message:ct(n,t,e.channelsSnapshot),qrDataUrl:null,connected:null})}finally{let n={...e.channelRuntimeBusy};delete n[i],e.channelRuntimeBusy=n,t===`whatsapp`&&(e.whatsappBusy=!1)}}}async function _t(e,t,n){let r=rt(t,n);if(!(!e.client||!e.connected||e.channelRuntimeBusy[r])&&!(t===`whatsapp`&&e.whatsappBusy)){e.channelRuntimeBusy={...e.channelRuntimeBusy,[r]:!0},t===`whatsapp`&&(e.whatsappBusy=!0);try{let r=await e.client.request(`web.login.wait`,{channel:t,timeoutMs:12e4,...n?{accountId:n}:{}});lt(e,t,{message:r.message??null,connected:r.connected??null}),r.connected&&(lt(e,t,{qrDataUrl:null}),await ut(e,!0))}catch(n){lt(e,t,{message:ct(n,t,e.channelsSnapshot),connected:null})}finally{let n={...e.channelRuntimeBusy};delete n[r],e.channelRuntimeBusy=n,t===`whatsapp`&&(e.whatsappBusy=!1)}}}async function vt(e,t){await gt(e,`whatsapp`,t)}async function yt(e){await _t(e,`whatsapp`)}async function bt(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request(`channels.logout`,{channel:`whatsapp`}),e.whatsappLoginMessage=`Logged out.`,e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}catch(t){e.whatsappLoginMessage=ct(t,`whatsapp`,e.channelsSnapshot)}finally{e.whatsappBusy=!1}}}function xt(e,t){let n=e.trim();if(n===``)return;let r=Number(n);return!Number.isFinite(r)||t&&!Number.isInteger(r)?e:r}function St(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:e}function Ct(e,t){if(e==null)return e;if(t.allOf&&t.allOf.length>0){let n=e;for(let e of t.allOf)n=Ct(n,e);return n}let n=T(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 Ct(e,n[0]);if(typeof e==`string`)for(let t of n){let n=T(t);if(n===`number`||n===`integer`){let t=xt(e,n===`integer`);if(t===void 0||typeof t==`number`)return t}if(n===`boolean`){let t=St(e);if(typeof t==`boolean`)return t}}for(let t of n){let n=T(t);if(n===`object`&&typeof e==`object`&&!Array.isArray(e)||n===`array`&&Array.isArray(e))return Ct(e,t)}return e}if(n===`number`||n===`integer`){if(typeof e==`string`){let t=xt(e,n===`integer`);if(t===void 0||typeof t==`number`)return t}return e}if(n===`boolean`){if(typeof e==`string`){let t=St(e);if(typeof t==`boolean`)return t}return 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?Ct(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?Ct(e,r):e})}let n=t.items;return n?e.map(e=>Ct(e,n)).filter(e=>e!==void 0):e}return e}function wt(e){return typeof structuredClone==`function`?structuredClone(e):JSON.parse(JSON.stringify(e))}function Tt(e){return`${JSON.stringify(e,null,2).trimEnd()}\n`}var Et=new Set([`__proto__`,`prototype`,`constructor`]);function Dt(e){return typeof e==`string`&&Et.has(e)}function Ot(e,t,n){if(t.length===0||t.some(Dt))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 kt(e,t,n){let r=Ot(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 At(e,t){let n=Ot(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]}}function jt(e,t){e.configAuthAction=t}function Mt(e){let t=String(e).trim();return t.startsWith(`Error: `)?t.slice(7):t}function Nt(e,t){let n=Mt(e);return n.includes(`models.auth.interactive.start`)&&n.includes(t)&&n.includes(`unexpected property`)}function Pt(e){return Nt(e,`replaceRunning`)}function Ft(e){return Nt(e,`browserLocal`)}function It(e){return{profileId:e.profileId,provider:e.provider??null,actionKind:e.actionKind,tone:e.tone,title:e.title,message:e.message,detail:e.detail,stepType:e.stepType??null,active:e.active??!1,hasUrl:e.hasUrl??!1,url:e.url??null,retryable:e.retryable??!1,prompt:e.prompt??null}}function Lt(e,t){let n=e.configAuthPromptResolver;e.configAuthPromptResolver=null,n?.({cancelled:!1,value:t})}function Rt(e){let t=e.configAuthPromptResolver;e.configAuthPromptResolver=null,t?.({cancelled:!0})}function zt(e){let t=e.configAuthPromptResolver;e.configAuthPromptResolver=null,e.configAuthActionRunId=(e.configAuthActionRunId??0)+1,jt(e,null),t?.({cancelled:!0})}function Bt(e,t,n){let r=Wt(t),i=!!r,a=t.title?.trim()||`Continue sign-in`,o=t.message?.trim()||`Follow the next prompt to continue.`,s=i&&o.includes(r??``)?`Open the sign-in link below, then return here.`:o;switch(t.type){case`note`:case`action`:return It({profileId:e,provider:n,actionKind:`interactive`,tone:`info`,title:a,message:s,stepType:t.type,active:!0,hasUrl:i,url:r});case`confirm`:return It({profileId:e,provider:n,actionKind:`interactive`,tone:`info`,title:a,message:s,detail:`Confirm the browser prompt to keep the sign-in flow moving.`,stepType:t.type,active:!0,hasUrl:i,url:r});case`text`:return It({profileId:e,provider:n,actionKind:`interactive`,tone:`info`,title:a,message:s,stepType:t.type,active:!0,hasUrl:i,url:r});case`select`:case`multiselect`:return It({profileId:e,provider:n,actionKind:`interactive`,tone:`info`,title:a,message:s,detail:`Choose from the prompt dialog, then return here for the next step.`,stepType:t.type,active:!0,hasUrl:i,url:r});default:return It({profileId:e,provider:n,actionKind:`interactive`,tone:`info`,title:a,message:s,stepType:t.type,active:!0,hasUrl:i,url:r})}}async function F(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{let[t,n,r]=await Promise.allSettled([e.client.request(`config.get`,{}),e.client.request(`models.auth.status`,{}),e.client.request(`models.catalog.status`,{})]);if(t.status!==`fulfilled`)throw t.reason;Qt(e,t.value),e.configAuthStatus=n.status===`fulfilled`?n.value:null,e.configModelCatalogStatus=r.status===`fulfilled`?r.value:null}catch(t){e.configAuthStatus=null,e.configModelCatalogStatus=null,e.lastError=String(t)}finally{e.configLoading=!1}}}async function Vt(e,t){if(!e.client||!e.connected)return!1;e.configAuthActionBusyProfileId=t.profileId,jt(e,It({profileId:t.profileId,provider:t.provider,actionKind:`store`,tone:`info`,title:`Saving credential for ${t.profileId}`,message:`Updating stored ${t.mode} credential…`,detail:`The provider-auth card will refresh after the credential is stored.`,active:!0})),e.lastError=null;try{let n=await e.client.request(`models.auth.store`,t);return jt(e,It({profileId:n.profileId,provider:t.provider,actionKind:`store`,tone:`success`,title:`Credential updated for ${n.profileId}`,message:`Stored ${n.mode} credential successfully.`,detail:`Live runtime status will refresh below after the reload completes.`})),await F(e),!0}catch(n){return jt(e,It({profileId:t.profileId,provider:t.provider,actionKind:`store`,tone:`danger`,title:`Failed to save credential for ${t.profileId}`,message:`The credential was not updated.`,detail:Mt(n),retryable:!0})),e.lastError=String(n),!1}finally{e.configAuthActionBusyProfileId=null}}async function Ht(e,t){if(!e.client||!e.connected)return!1;let n=t.provider.trim(),r=t.profileId?.trim()||`${n}:default`;e.configAuthActionBusyProfileId=r,jt(e,It({profileId:r,provider:n,actionKind:`store`,tone:`info`,title:`Configuring ${n}`,message:`Saving the API key and syncing provider model config…`,detail:`This uses the same provider-specific setup path as CLI/onboarding, then refreshes Providers.`,active:!0})),e.lastError=null;try{let i=await e.client.request(`models.auth.configure`,{provider:n,...t.secret?{secret:t.secret}:{},...t.profileId?{profileId:t.profileId}:{},...t.baseUrl?{baseUrl:t.baseUrl}:{},...t.modelId?{modelId:t.modelId}:{},...t.compatibility?{compatibility:t.compatibility}:{},...t.customProviderId?{customProviderId:t.customProviderId}:{},...t.alias?{alias:t.alias}:{},...t.allowPrivateNetwork===void 0?{}:{allowPrivateNetwork:t.allowPrivateNetwork},...t.accountId?{accountId:t.accountId}:{},...t.gatewayId?{gatewayId:t.gatewayId}:{},...t.setDefaultModel===void 0?{}:{setDefaultModel:t.setDefaultModel}});return jt(e,It({profileId:i.profileId??r,provider:i.provider,actionKind:`store`,tone:`success`,title:`${i.provider} configured`,message:i.defaultModel?`Provider auth is ready. Suggested model: ${i.defaultModel}.`:`Provider auth is ready. Choose a default model below.`,detail:i.detail??`Chat and Agents can use this provider after you choose or attach a model.`})),await F(e),!0}catch(t){return jt(e,It({profileId:r,provider:n,actionKind:`store`,tone:`danger`,title:`Failed to configure ${n}`,message:`The provider-specific setup path did not complete.`,detail:Mt(t),retryable:!0})),e.lastError=String(t),!1}finally{e.configAuthActionBusyProfileId=null}}async function Ut(e,t){if(!e.client||!e.connected)return!1;e.configAuthActionBusyProfileId=t,jt(e,It({profileId:t,actionKind:`clear`,tone:`info`,title:`Clearing stored credential for ${t}`,message:`Removing the currently stored credential…`,detail:`The provider-auth card will refresh after the credential is cleared.`,active:!0})),e.lastError=null;try{let n=await e.client.request(`models.auth.clear`,{profileId:t});return jt(e,It({profileId:n.profileId,actionKind:`clear`,tone:n.cleared?`success`:`warn`,title:n.cleared?`Credential cleared for ${n.profileId}`:`No stored credential for ${n.profileId}`,message:n.cleared?`Stored credential removed successfully.`:`There was nothing stored to clear for this profile.`})),await F(e),!0}catch(n){return jt(e,It({profileId:t,actionKind:`clear`,tone:`danger`,title:`Failed to clear credential for ${t}`,message:`The stored credential could not be removed.`,detail:Mt(n),retryable:!0})),e.lastError=String(n),!1}finally{e.configAuthActionBusyProfileId=null}}function Wt(e){return`${e.title??``}\n${e.message??``}`.match(/https?:\/\/\S+/u)?.[0]??null}function Gt(e){let t=e.title?.trim(),n=e.message?.trim();return t&&n?`${t}\n\n${n}`:t||n||`Continue provider sign-in.`}function Kt(e,t){let n=t.trim();if(!n)return e.initialValue;let r=e.options??[],i=Number.parseInt(n,10);return Number.isFinite(i)&&i>=1&&i<=r.length?r[i-1]?.value:r.find(e=>e.label.toLowerCase()===n.toLowerCase()||String(e.value).toLowerCase()===n.toLowerCase())?.value}function qt(e,t){let n=t.trim();if(!n)return Array.isArray(e.initialValue)?e.initialValue:[];let r=n.split(`,`).map(e=>e.trim()).filter(Boolean),i=[];for(let t of r){let n=Kt(e,t);if(n===void 0)return;i.push(n)}return i}async function Jt(e,t,n){if(t.type===`note`||t.type===`action`)return{cancelled:!1,value:null};if(n===`modal`)return await new Promise(n=>{e.configAuthPromptResolver=n;let r=e.configAuthAction;jt(e,It({profileId:r?.profileId??null,provider:r?.provider,actionKind:r?.actionKind,tone:r?.tone??`info`,title:r?.title??t.title??`Continue sign-in`,message:r?.message??t.message??`Continue provider sign-in.`,detail:r?.detail,stepType:t.type,active:!0,hasUrl:r?.hasUrl,url:r?.url,retryable:r?.retryable,prompt:{stepId:t.id,type:t.type,message:Gt(t),...t.placeholder?{placeholder:t.placeholder}:{},...t.initialValue===void 0?{}:{initialValue:t.initialValue},...t.options?{options:t.options}:{}}}))});if(typeof window>`u`)throw Error(`Interactive provider auth requires a browser environment.`);if(t.type===`confirm`)return{cancelled:!1,value:window.confirm(Gt(t))};if(t.type===`text`){let e=window.prompt(Gt(t),typeof t.initialValue==`string`?t.initialValue:``);return e===null?{cancelled:!0}:{cancelled:!1,value:e}}if(t.type===`select`){let e=(t.options??[]).map((e,t)=>`${t+1}. ${e.label}${e.hint?` — ${e.hint}`:``}`).join(`
|
|
2
|
+
import{n as e,t}from"./index-DYYBRBOS.js";import{a as n,c as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"./icons-D3-vEvih.js";import{c as f,d as p,f as m,g as h,h as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as ee,u as w,y as T}from"./open-external-url-ulF1B-sA.js";import{a as E,d as D,i as te,l as O,o as ne,u as k}from"./marketplace-order-evidence-DkR0ZRHa.js";import{C as re,D as A,E as ie,S as j,T as ae,_ as oe,a as se,b as ce,c as M,d as le,f as ue,g as de,h as fe,i as pe,l as me,m as he,n as ge,o as N,p as _e,r as ve,s as ye,t as be,u as xe,v as Se,w as Ce,x as we,y as Te}from"./mining-commit-DFpB_4JN.js";import{B as Ee,F as De,I as Oe,R as ke,a as Ae,i as je,n as Me,o as Ne,r as Pe,t as Fe,z as Ie}from"./chat-model-ref-Djkv93yn.js";import{n as Le,t as Re}from"./task-ledger-source-route-C-yTp0QU.js";import{d as ze,f as Be,h as Ve,i as He,l as Ue,m as We,n as Ge,o as Ke,p as qe,r as Je,s as Ye,u as Xe}from"./wallet-policy-C3ZS66Rl.js";var Ze=e=>(t,n)=>{n===void 0?customElements.define(e,t):n.addInitializer(()=>{customElements.define(e,t)})},Qe={attribute:!0,type:String,converter:a,reflect:!1,hasChanged:r},$e=(e=Qe,t,n)=>{let{kind:r,metadata:i}=n,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),r===`setter`&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),r===`accessor`){let{name:r}=n;return{set(n){let i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e,!0,n)},init(t){return t!==void 0&&this.C(r,void 0,e,t),t}}}if(r===`setter`){let{name:r}=n;return function(n){let i=this[r];t.call(this,n),this.requestUpdate(r,i,e,!0,n)}}throw Error(`Unsupported decorator location: `+r)};function et(e){return(t,n)=>typeof n==`object`?$e(e,t,n):((e,t,n)=>{let r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function P(e){return et({...e,state:!0,attribute:!1})}function tt(e,t){return`${e}:${t??``}`}function nt(e){return`install:${e}`}function rt(e,t){return`qr:${e}:${t??``}`}function it(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}var at={whatsapp:`WhatsApp`,zalouser:`Zalo Personal`};function ot(e,t){return e?.channelLabels?.[t]??at[t]??t}function st(e,t){let n=e?.channels?.[t];if(!it(n)||!it(n.install))return`fased plugins install ${t}`;let r=n.install.localPath;if(typeof r==`string`&&r.trim())return`fased plugins install ${r.trim()}`;let i=n.install.npmSpec;return`fased plugins install ${typeof i==`string`&&i.trim()?i.trim():t}`}function ct(e,t,n){let r=String(e);if(r.includes(`web login provider is not available`)){let e=t?ot(n??null,t):`Channel`;return`${e} QR login is unavailable because the ${e} channel plugin is not loaded. Enable or install it, restart the gateway, then open Show QR again.`}return r}function lt(e,t,n){let r=e.channelQrLogin[t]??{message:null,qrDataUrl:null,connected:null},i={message:`message`in n?n.message??null:r.message,qrDataUrl:`qrDataUrl`in n?n.qrDataUrl??null:r.qrDataUrl,connected:`connected`in n?n.connected??null:r.connected};e.channelQrLogin={...e.channelQrLogin,[t]:i},t===`whatsapp`&&(e.whatsappLoginMessage=i.message,e.whatsappLoginQrDataUrl=i.qrDataUrl,e.whatsappLoginConnected=i.connected)}async function ut(e,t){if(!(!e.client||!e.connected)&&!e.channelsLoading){e.channelsLoading=!0,e.channelsError=null;try{e.channelsSnapshot=await e.client.request(`channels.status`,{probe:t,timeoutMs:8e3}),e.channelsLastSuccess=Date.now()}catch(t){e.channelsError=ct(t)}finally{e.channelsLoading=!1}}}async function dt(e,t,n,r){if(!e.client||!e.connected)return;let i=tt(n,r);if(!e.channelRuntimeBusy[i]){e.channelRuntimeBusy={...e.channelRuntimeBusy,[i]:!0},e.channelsError=null,e.channelsNotice=null;try{await e.client.request(t,{channel:n,...r?{accountId:r}:{}}),await ut(e,!1)}catch(t){e.channelsError=ct(t)}finally{let t={...e.channelRuntimeBusy};delete t[i],e.channelRuntimeBusy=t}}}async function ft(e,t,n){await dt(e,`channels.start`,t,n)}async function pt(e,t,n){await dt(e,`channels.stop`,t,n)}async function mt(e,t,n){if(!e.client||!e.connected)return;let r=tt(t,n);if(!e.channelRuntimeBusy[r]){e.channelRuntimeBusy={...e.channelRuntimeBusy,[r]:!0},e.channelsError=null,e.channelsNotice=null;try{let r=await e.client.request(`channels.logout`,{channel:t,...n?{accountId:n}:{}});await ut(e,!0);let i=r.accountId||n,a=`${t}${i?`/${i}`:``}`;e.channelsNotice=r.cleared||r.loggedOut?`Cleared ${a}.`:`No stored credentials were cleared for ${a}.`}catch(t){e.channelsError=ct(t)}finally{let t={...e.channelRuntimeBusy};delete t[r],e.channelRuntimeBusy=t}}}async function ht(e,t){if(!e.client||!e.connected)return;let n=nt(t);if(!e.channelRuntimeBusy[n]){e.channelRuntimeBusy={...e.channelRuntimeBusy,[n]:!0},e.channelsError=null,e.channelsNotice=null;try{let n=await e.client.request(`plugins.marketplace.install`,{id:t});await ut(e,!1),e.channelsNotice=n.requiresRestart?`${n.message} Restart the gateway to load this channel plugin. Until restart, this channel will stay in restart-required state.`:n.message}catch(n){e.channelsError=`${ct(n)}. Manual install: ${st(e.channelsSnapshot,t)}. Restart the gateway after install.`}finally{let t={...e.channelRuntimeBusy};delete t[n],e.channelRuntimeBusy=t}}}async function gt(e,t,n=!1,r){let i=rt(t,r);if(!(!e.client||!e.connected||e.channelRuntimeBusy[i])&&!(t===`whatsapp`&&e.whatsappBusy)){e.channelRuntimeBusy={...e.channelRuntimeBusy,[i]:!0},t===`whatsapp`&&(e.whatsappBusy=!0);try{let i=await e.client.request(`web.login.start`,{channel:t,force:n,timeoutMs:3e4,...r?{accountId:r}:{}});lt(e,t,{message:i.message??null,qrDataUrl:i.qrDataUrl??null,connected:null})}catch(n){lt(e,t,{message:ct(n,t,e.channelsSnapshot),qrDataUrl:null,connected:null})}finally{let n={...e.channelRuntimeBusy};delete n[i],e.channelRuntimeBusy=n,t===`whatsapp`&&(e.whatsappBusy=!1)}}}async function _t(e,t,n){let r=rt(t,n);if(!(!e.client||!e.connected||e.channelRuntimeBusy[r])&&!(t===`whatsapp`&&e.whatsappBusy)){e.channelRuntimeBusy={...e.channelRuntimeBusy,[r]:!0},t===`whatsapp`&&(e.whatsappBusy=!0);try{let r=await e.client.request(`web.login.wait`,{channel:t,timeoutMs:12e4,...n?{accountId:n}:{}});lt(e,t,{message:r.message??null,connected:r.connected??null}),r.connected&&(lt(e,t,{qrDataUrl:null}),await ut(e,!0))}catch(n){lt(e,t,{message:ct(n,t,e.channelsSnapshot),connected:null})}finally{let n={...e.channelRuntimeBusy};delete n[r],e.channelRuntimeBusy=n,t===`whatsapp`&&(e.whatsappBusy=!1)}}}async function vt(e,t){await gt(e,`whatsapp`,t)}async function yt(e){await _t(e,`whatsapp`)}async function bt(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request(`channels.logout`,{channel:`whatsapp`}),e.whatsappLoginMessage=`Logged out.`,e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}catch(t){e.whatsappLoginMessage=ct(t,`whatsapp`,e.channelsSnapshot)}finally{e.whatsappBusy=!1}}}function xt(e,t){let n=e.trim();if(n===``)return;let r=Number(n);return!Number.isFinite(r)||t&&!Number.isInteger(r)?e:r}function St(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:e}function Ct(e,t){if(e==null)return e;if(t.allOf&&t.allOf.length>0){let n=e;for(let e of t.allOf)n=Ct(n,e);return n}let n=T(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 Ct(e,n[0]);if(typeof e==`string`)for(let t of n){let n=T(t);if(n===`number`||n===`integer`){let t=xt(e,n===`integer`);if(t===void 0||typeof t==`number`)return t}if(n===`boolean`){let t=St(e);if(typeof t==`boolean`)return t}}for(let t of n){let n=T(t);if(n===`object`&&typeof e==`object`&&!Array.isArray(e)||n===`array`&&Array.isArray(e))return Ct(e,t)}return e}if(n===`number`||n===`integer`){if(typeof e==`string`){let t=xt(e,n===`integer`);if(t===void 0||typeof t==`number`)return t}return e}if(n===`boolean`){if(typeof e==`string`){let t=St(e);if(typeof t==`boolean`)return t}return 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?Ct(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?Ct(e,r):e})}let n=t.items;return n?e.map(e=>Ct(e,n)).filter(e=>e!==void 0):e}return e}function wt(e){return typeof structuredClone==`function`?structuredClone(e):JSON.parse(JSON.stringify(e))}function Tt(e){return`${JSON.stringify(e,null,2).trimEnd()}\n`}var Et=new Set([`__proto__`,`prototype`,`constructor`]);function Dt(e){return typeof e==`string`&&Et.has(e)}function Ot(e,t,n){if(t.length===0||t.some(Dt))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 kt(e,t,n){let r=Ot(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 At(e,t){let n=Ot(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]}}function jt(e,t){e.configAuthAction=t}function Mt(e){let t=String(e).trim();return t.startsWith(`Error: `)?t.slice(7):t}function Nt(e,t){let n=Mt(e);return n.includes(`models.auth.interactive.start`)&&n.includes(t)&&n.includes(`unexpected property`)}function Pt(e){return Nt(e,`replaceRunning`)}function Ft(e){return Nt(e,`browserLocal`)}function It(e){return{profileId:e.profileId,provider:e.provider??null,actionKind:e.actionKind,tone:e.tone,title:e.title,message:e.message,detail:e.detail,stepType:e.stepType??null,active:e.active??!1,hasUrl:e.hasUrl??!1,url:e.url??null,retryable:e.retryable??!1,prompt:e.prompt??null}}function Lt(e,t){let n=e.configAuthPromptResolver;e.configAuthPromptResolver=null,n?.({cancelled:!1,value:t})}function Rt(e){let t=e.configAuthPromptResolver;e.configAuthPromptResolver=null,t?.({cancelled:!0})}function zt(e){let t=e.configAuthPromptResolver;e.configAuthPromptResolver=null,e.configAuthActionRunId=(e.configAuthActionRunId??0)+1,jt(e,null),t?.({cancelled:!0})}function Bt(e,t,n){let r=Wt(t),i=!!r,a=t.title?.trim()||`Continue sign-in`,o=t.message?.trim()||`Follow the next prompt to continue.`,s=i&&o.includes(r??``)?`Open the sign-in link below, then return here.`:o;switch(t.type){case`note`:case`action`:return It({profileId:e,provider:n,actionKind:`interactive`,tone:`info`,title:a,message:s,stepType:t.type,active:!0,hasUrl:i,url:r});case`confirm`:return It({profileId:e,provider:n,actionKind:`interactive`,tone:`info`,title:a,message:s,detail:`Confirm the browser prompt to keep the sign-in flow moving.`,stepType:t.type,active:!0,hasUrl:i,url:r});case`text`:return It({profileId:e,provider:n,actionKind:`interactive`,tone:`info`,title:a,message:s,stepType:t.type,active:!0,hasUrl:i,url:r});case`select`:case`multiselect`:return It({profileId:e,provider:n,actionKind:`interactive`,tone:`info`,title:a,message:s,detail:`Choose from the prompt dialog, then return here for the next step.`,stepType:t.type,active:!0,hasUrl:i,url:r});default:return It({profileId:e,provider:n,actionKind:`interactive`,tone:`info`,title:a,message:s,stepType:t.type,active:!0,hasUrl:i,url:r})}}async function F(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{let[t,n,r]=await Promise.allSettled([e.client.request(`config.get`,{}),e.client.request(`models.auth.status`,{}),e.client.request(`models.catalog.status`,{})]);if(t.status!==`fulfilled`)throw t.reason;Qt(e,t.value),e.configAuthStatus=n.status===`fulfilled`?n.value:null,e.configModelCatalogStatus=r.status===`fulfilled`?r.value:null}catch(t){e.configAuthStatus=null,e.configModelCatalogStatus=null,e.lastError=String(t)}finally{e.configLoading=!1}}}async function Vt(e,t){if(!e.client||!e.connected)return!1;e.configAuthActionBusyProfileId=t.profileId,jt(e,It({profileId:t.profileId,provider:t.provider,actionKind:`store`,tone:`info`,title:`Saving credential for ${t.profileId}`,message:`Updating stored ${t.mode} credential…`,detail:`The provider-auth card will refresh after the credential is stored.`,active:!0})),e.lastError=null;try{let n=await e.client.request(`models.auth.store`,t);return jt(e,It({profileId:n.profileId,provider:t.provider,actionKind:`store`,tone:`success`,title:`Credential updated for ${n.profileId}`,message:`Stored ${n.mode} credential successfully.`,detail:`Live runtime status will refresh below after the reload completes.`})),await F(e),!0}catch(n){return jt(e,It({profileId:t.profileId,provider:t.provider,actionKind:`store`,tone:`danger`,title:`Failed to save credential for ${t.profileId}`,message:`The credential was not updated.`,detail:Mt(n),retryable:!0})),e.lastError=String(n),!1}finally{e.configAuthActionBusyProfileId=null}}async function Ht(e,t){if(!e.client||!e.connected)return!1;let n=t.provider.trim(),r=t.profileId?.trim()||`${n}:default`;e.configAuthActionBusyProfileId=r,jt(e,It({profileId:r,provider:n,actionKind:`store`,tone:`info`,title:`Configuring ${n}`,message:`Saving the API key and syncing provider model config…`,detail:`This uses the same provider-specific setup path as CLI/onboarding, then refreshes Providers.`,active:!0})),e.lastError=null;try{let i=await e.client.request(`models.auth.configure`,{provider:n,...t.secret?{secret:t.secret}:{},...t.profileId?{profileId:t.profileId}:{},...t.baseUrl?{baseUrl:t.baseUrl}:{},...t.modelId?{modelId:t.modelId}:{},...t.compatibility?{compatibility:t.compatibility}:{},...t.customProviderId?{customProviderId:t.customProviderId}:{},...t.alias?{alias:t.alias}:{},...t.allowPrivateNetwork===void 0?{}:{allowPrivateNetwork:t.allowPrivateNetwork},...t.accountId?{accountId:t.accountId}:{},...t.gatewayId?{gatewayId:t.gatewayId}:{},...t.setDefaultModel===void 0?{}:{setDefaultModel:t.setDefaultModel}});return jt(e,It({profileId:i.profileId??r,provider:i.provider,actionKind:`store`,tone:`success`,title:`${i.provider} configured`,message:i.defaultModel?`Provider auth is ready. Suggested model: ${i.defaultModel}.`:`Provider auth is ready. Choose a default model below.`,detail:i.detail??`Chat and Agents can use this provider after you choose or attach a model.`})),await F(e),!0}catch(t){return jt(e,It({profileId:r,provider:n,actionKind:`store`,tone:`danger`,title:`Failed to configure ${n}`,message:`The provider-specific setup path did not complete.`,detail:Mt(t),retryable:!0})),e.lastError=String(t),!1}finally{e.configAuthActionBusyProfileId=null}}async function Ut(e,t){if(!e.client||!e.connected)return!1;e.configAuthActionBusyProfileId=t,jt(e,It({profileId:t,actionKind:`clear`,tone:`info`,title:`Clearing stored credential for ${t}`,message:`Removing the currently stored credential…`,detail:`The provider-auth card will refresh after the credential is cleared.`,active:!0})),e.lastError=null;try{let n=await e.client.request(`models.auth.clear`,{profileId:t});return jt(e,It({profileId:n.profileId,actionKind:`clear`,tone:n.cleared?`success`:`warn`,title:n.cleared?`Credential cleared for ${n.profileId}`:`No stored credential for ${n.profileId}`,message:n.cleared?`Stored credential removed successfully.`:`There was nothing stored to clear for this profile.`})),await F(e),!0}catch(n){return jt(e,It({profileId:t,actionKind:`clear`,tone:`danger`,title:`Failed to clear credential for ${t}`,message:`The stored credential could not be removed.`,detail:Mt(n),retryable:!0})),e.lastError=String(n),!1}finally{e.configAuthActionBusyProfileId=null}}function Wt(e){return`${e.title??``}\n${e.message??``}`.match(/https?:\/\/\S+/u)?.[0]??null}function Gt(e){let t=e.title?.trim(),n=e.message?.trim();return t&&n?`${t}\n\n${n}`:t||n||`Continue provider sign-in.`}function Kt(e,t){let n=t.trim();if(!n)return e.initialValue;let r=e.options??[],i=Number.parseInt(n,10);return Number.isFinite(i)&&i>=1&&i<=r.length?r[i-1]?.value:r.find(e=>e.label.toLowerCase()===n.toLowerCase()||String(e.value).toLowerCase()===n.toLowerCase())?.value}function qt(e,t){let n=t.trim();if(!n)return Array.isArray(e.initialValue)?e.initialValue:[];let r=n.split(`,`).map(e=>e.trim()).filter(Boolean),i=[];for(let t of r){let n=Kt(e,t);if(n===void 0)return;i.push(n)}return i}async function Jt(e,t,n){if(t.type===`note`||t.type===`action`)return{cancelled:!1,value:null};if(n===`modal`)return await new Promise(n=>{e.configAuthPromptResolver=n;let r=e.configAuthAction;jt(e,It({profileId:r?.profileId??null,provider:r?.provider,actionKind:r?.actionKind,tone:r?.tone??`info`,title:r?.title??t.title??`Continue sign-in`,message:r?.message??t.message??`Continue provider sign-in.`,detail:r?.detail,stepType:t.type,active:!0,hasUrl:r?.hasUrl,url:r?.url,retryable:r?.retryable,prompt:{stepId:t.id,type:t.type,message:Gt(t),...t.placeholder?{placeholder:t.placeholder}:{},...t.initialValue===void 0?{}:{initialValue:t.initialValue},...t.options?{options:t.options}:{}}}))});if(typeof window>`u`)throw Error(`Interactive provider auth requires a browser environment.`);if(t.type===`confirm`)return{cancelled:!1,value:window.confirm(Gt(t))};if(t.type===`text`){let e=window.prompt(Gt(t),typeof t.initialValue==`string`?t.initialValue:``);return e===null?{cancelled:!0}:{cancelled:!1,value:e}}if(t.type===`select`){let e=(t.options??[]).map((e,t)=>`${t+1}. ${e.label}${e.hint?` — ${e.hint}`:``}`).join(`
|
|
3
3
|
`);for(;;){let n=window.prompt(`${Gt(t)}\n\n${e}\n\nChoose a number or exact value.`,typeof t.initialValue==`string`?t.initialValue:``);if(n===null)return{cancelled:!0};let r=Kt(t,n);if(r!==void 0)return{cancelled:!1,value:r};window.alert(`Invalid selection. Enter a listed number or exact value.`)}}if(t.type===`multiselect`){let e=(t.options??[]).map((e,t)=>`${t+1}. ${e.label}${e.hint?` — ${e.hint}`:``}`).join(`
|
|
4
4
|
`);for(;;){let n=window.prompt(`${Gt(t)}\n\n${e}\n\nChoose one or more values separated by commas.`,Array.isArray(t.initialValue)?t.initialValue.join(`, `):``);if(n===null)return{cancelled:!0};let r=qt(t,n);if(r!==void 0)return{cancelled:!1,value:r};window.alert(`Invalid selection. Use comma-separated numbers or exact values.`)}}return{cancelled:!1,value:null}}async function Yt(e,t){if(!e.client||!e.connected)return!1;let n=(e.configAuthActionRunId??0)+1;e.configAuthActionRunId=n;let r=()=>e.configAuthActionRunId===n;if(e.configAuthPromptResolver){let t=e.configAuthPromptResolver;e.configAuthPromptResolver=null,t({cancelled:!0})}e.configAuthActionBusyProfileId=t.profileId;let i=null,a=null;jt(e,It({profileId:t.profileId,provider:t.provider,actionKind:`interactive`,tone:`info`,title:`Starting sign-in for ${t.profileId}`,message:`Preparing the interactive provider flow…`,detail:`A browser prompt may open depending on the provider method.`,active:!0})),e.lastError=null;try{let n;try{n=await e.client.request(`models.auth.interactive.start`,{provider:t.provider,...t.methodId?{methodId:t.methodId}:{},replaceRunning:!0,...t.browserLocal===!0?{browserLocal:!0}:{}})}catch(r){if(Ft(r))try{n=await e.client.request(`models.auth.interactive.start`,{provider:t.provider,...t.methodId?{methodId:t.methodId}:{},replaceRunning:!0})}catch(r){if(!Pt(r))throw r;n=await e.client.request(`models.auth.interactive.start`,{provider:t.provider,...t.methodId?{methodId:t.methodId}:{}})}else if(Pt(r))try{n=await e.client.request(`models.auth.interactive.start`,{provider:t.provider,...t.methodId?{methodId:t.methodId}:{},...t.browserLocal===!0?{browserLocal:!0}:{}})}catch(r){if(!Ft(r))throw r;n=await e.client.request(`models.auth.interactive.start`,{provider:t.provider,...t.methodId?{methodId:t.methodId}:{}})}else throw r}if(a=n.sessionId,!a)throw Error(`interactive provider auth did not return a session id`);for(;!n.done;){let o=n.step;if(!o)throw Error(`interactive provider auth did not return a prompt step`);let s=Bt(t.profileId,o,t.provider);s.url&&(i=s.url),jt(e,s.url||!i?s:{...s,hasUrl:!0,url:i});let c=await Jt(e,o,t.promptMode??`browserPrompt`);if(c.cancelled){let n=r()&&e.configAuthAction!==null;return await e.client.request(`wizard.cancel`,{sessionId:a}),a=null,n&&jt(e,It({profileId:t.profileId,provider:t.provider,actionKind:`interactive`,tone:`warn`,title:`Cancelled sign-in for ${t.profileId}`,message:`Interactive sign-in was cancelled before completion.`,detail:`You can retry from this profile card or reopen the last sign-in page.`,url:i,hasUrl:!!i,retryable:!0})),!1}n={...await e.client.request(`wizard.next`,{sessionId:a,answer:{stepId:o.id,value:c.value}}),sessionId:a}}if(n.status!==`done`)throw Error(n.error??`interactive provider auth ended with status ${n.status}`);return a=null,jt(e,r()?It({profileId:t.profileId,provider:t.provider,actionKind:`interactive`,tone:`success`,title:`Completed sign-in for ${t.profileId}`,message:`Interactive sign-in finished successfully.`,detail:`Live runtime status will refresh below after the reload completes.`,url:i,hasUrl:!!i}):e.configAuthAction),await F(e),!0}catch(n){if(a&&e.client&&e.connected)try{await e.client.request(`wizard.cancel`,{sessionId:a})}catch{}return r()&&jt(e,It({profileId:t.profileId,provider:t.provider,actionKind:`interactive`,tone:`danger`,title:`Sign-in failed for ${t.profileId}`,message:`Interactive provider sign-in did not complete.`,detail:Mt(n),url:i,hasUrl:!!i,retryable:!0})),e.lastError=String(n),!1}finally{r()&&(e.configAuthActionBusyProfileId=null)}}async function Xt(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{Zt(e,await e.client.request(`config.schema`,{}))}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function Zt(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function Qt(e,t){e.configSnapshot=t;let n=typeof t.raw==`string`,r=n?String(t.raw):t.config&&typeof t.config==`object`?Tt(t.config):e.configRaw??``;n||(e.configFormMode=`form`),!e.configFormDirty||e.configFormMode===`raw`?e.configRaw=r:e.configForm?e.configRaw=Tt(e.configForm):e.configRaw=r,e.configValid=typeof t.valid==`boolean`?t.valid:null,e.configIssues=Array.isArray(t.issues)?t.issues:[],e.configFormDirty||(e.configForm=wt(t.config??{}),e.configFormOriginal=wt(t.config??{}),e.configRawOriginal=r)}function $t(e){return!e||typeof e!=`object`||Array.isArray(e)?null:e}function en(e){if(e.configFormMode!==`form`||!e.configForm)return e.configRaw;let t=$t(e.configSchema);return Tt(t?Ct(e.configForm,t):e.configForm)}function tn(e){let t=Mt(e).toLowerCase();return t.includes(`config changed since last load`)||t.includes(`config base hash required`)||t.includes(`config base hash unavailable`)}async function nn(e){if(!e.client||!e.connected)return null;let t=await e.client.request(`config.get`,{});return Qt(e,t),typeof t.hash==`string`&&t.hash.trim()?t.hash:null}async function rn(e){if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{let t=en(e),n=e.configSnapshot?.hash;if(!n){e.lastError=`Config hash missing; reload and retry.`;return}try{await e.client.request(`config.set`,{raw:t,baseHash:n})}catch(n){if(!tn(n))throw n;let r=await nn(e);if(!r)throw n;await e.client.request(`config.set`,{raw:t,baseHash:r})}e.configFormDirty=!1,await F(e)}catch(t){e.lastError=String(t)}finally{e.configSaving=!1}}}async function an(e){if(!(!e.client||!e.connected)){e.configApplying=!0,e.lastError=null;try{let t=en(e),n=e.configSnapshot?.hash;if(!n){e.lastError=`Config hash missing; reload and retry.`;return}try{await e.client.request(`config.apply`,{raw:t,baseHash:n,sessionKey:e.applySessionKey})}catch(n){if(!tn(n))throw n;let r=await nn(e);if(!r)throw n;await e.client.request(`config.apply`,{raw:t,baseHash:r,sessionKey:e.applySessionKey})}e.configFormDirty=!1,await F(e)}catch(t){e.lastError=String(t)}finally{e.configApplying=!1}}}function I(e,t,n){let r=wt(e.configForm??e.configSnapshot?.config??{});kt(r,t,n),e.configForm=r,e.configFormDirty=!0,e.configFormMode===`form`&&(e.configRaw=Tt(r))}function on(e,t){let n=wt(e.configForm??e.configSnapshot?.config??{});At(n,t),e.configForm=n,e.configFormDirty=!0,e.configFormMode===`form`&&(e.configRaw=Tt(n))}function sn(e){let{values:t,original:n}=e;return t.name!==n.name||t.displayName!==n.displayName||t.about!==n.about||t.picture!==n.picture||t.banner!==n.banner||t.website!==n.website||t.nip05!==n.nip05||t.lud16!==n.lud16}function cn(e){let{state:t,callbacks:r,accountId:i}=e,a=sn(t),o=(e,i,a={})=>{let{type:o=`text`,placeholder:s,maxLength:l,help:u}=a,d=t.values[e]??``,f=t.fieldErrors[e],p=`nostr-profile-${e}`;return o===`textarea`?n`
|
|
5
5
|
<div class="form-field" style="margin-bottom: 12px;">
|
|
@@ -140,7 +140,7 @@ import{n as e,t}from"./index-vw_10Zeo.js";import{a as n,c as r,i,l as a,n as o,o
|
|
|
140
140
|
`);let r=F_(e);if(!r)return null;let i=[...r.matchAll(/<\s*think(?:ing)?\s*>([\s\S]*?)<\s*\/\s*think(?:ing)?\s*>/gi)].map(e=>(e[1]??``).trim()).filter(Boolean);return i.length>0?i.join(`
|
|
141
141
|
`):null}function P_(e){if(!e||typeof e!=`object`)return N_(e);let t=e;if(A_.has(t))return A_.get(t)??null;let n=N_(e);return A_.set(t,n),n}function F_(e){let t=e,n=t.content;if(typeof n==`string`)return n;if(Array.isArray(n)){let e=n.map(e=>{let t=e;return t.type===`text`&&typeof t.text==`string`?t.text:null}).filter(e=>typeof e==`string`);if(e.length>0)return e.join(`
|
|
142
142
|
`)}return typeof t.text==`string`?t.text:null}function I_(e){let t=e.trim();if(!t)return``;let n=t.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map(e=>`_${e}_`);return n.length?[`_Reasoning:_`,...n].join(`
|
|
143
|
-
`):``}function L_(e){return typeof e==`string`?e:e instanceof Error&&typeof e.message==`string`?e.message:`unknown error`}function R_(e){let t=L_(e.message);switch(Mc(e)){case es.AUTH_TOKEN_MISMATCH:return`gateway token mismatch`;case es.AUTH_UNAUTHORIZED:return`gateway auth failed`;case es.AUTH_RATE_LIMITED:return`too many failed authentication attempts`;case es.PAIRING_REQUIRED:return`gateway pairing required`;case es.CONTROL_UI_DEVICE_IDENTITY_REQUIRED:return`device identity required (use HTTPS/localhost or allow insecure auth explicitly)`;case es.CONTROL_UI_ORIGIN_NOT_ALLOWED:return`origin not allowed (open the Control UI from the gateway host or allow it in gateway.controlUi.allowedOrigins)`;case es.AUTH_TOKEN_MISSING:return`gateway token missing`;default:break}let n=t.trim().toLowerCase();return n===`fetch failed`||n===`failed to fetch`||n===`connect failed`?`gateway connect failed`:t}function z_(e){return e&&typeof e==`object`?R_(e):L_(e)}var B_=/^\s*(?:NO_REPLY|ANNOUNCE_SKIP|REPLY_SKIP)\s*$/,V_=new WeakMap;function H_(e){let t=e,n=(V_.get(t)??0)+1;return V_.set(t,n),n}function U_(e,t){return V_.get(e)===t}function W_(e,t,n){return U_(e,t)&&e.sessionKey===n}function G_(e){return B_.test(e)}function K_(e){return G_(e)?e:e.replace(/(?:^|\r?\n)[\t ]*(?:NO_REPLY|ANNOUNCE_SKIP|REPLY_SKIP)[\t ]*$/i,``).trimEnd()}function q_(e){if(!e||typeof e!=`object`)return e;let t=e;if(typeof t.role==`string`&&t.role.toLowerCase()!==`assistant`)return e;let n=!1,r={...t};if(typeof r.text==`string`){let e=K_(r.text);n||=e!==r.text,r.text=e}if(typeof r.content==`string`){let e=K_(r.content);n||=e!==r.content,r.content=e}else if(Array.isArray(r.content)){let e=[...r.content];for(let t=e.length-1;t>=0;--t){let r=e[t];if(!r||typeof r!=`object`||typeof r.text!=`string`)continue;let i={...r},a=i.text,o=e.slice(0,t).some(e=>e&&typeof e==`object`&&typeof e.text==`string`&&!!(e.text??``).trim())&&G_(a)?``:K_(a);n||=o!==i.text,i.text=o,e[t]=i;break}r.content=e}return n?r:e}function J_(e){if(!e||typeof e!=`object`)return!1;let t=e;if((typeof t.role==`string`?t.role.toLowerCase():``)!==`assistant`)return!1;if(typeof t.text==`string`)return G_(t.text);let n=j_(e);return typeof n==`string`&&G_(n)}function Y_(e){let t=e;t.toolStreamById instanceof Map&&Array.isArray(t.toolStreamOrder)&&Array.isArray(t.chatToolMessages)&&Array.isArray(t.chatStreamSegments)&&l_(t)}async function X_(e){if(!e.client||!e.connected)return;let t=e.sessionKey,n=H_(e);e.chatLoading=!0,e.lastError=null;try{let r=await e.client.request(`chat.history`,{sessionKey:t,limit:200});if(!W_(e,n,t))return;e.chatMessages=(Array.isArray(r.messages)?r.messages:[]).filter(e=>!J_(e)).map(e=>q_(e)),e.chatThinkingLevel=r.thinkingLevel??null,Y_(e),e.chatStream=null,e.chatStreamStartedAt=null}catch(r){if(!W_(e,n,t))return;zc(r)?(e.chatMessages=[],e.chatThinkingLevel=null,e.lastError=Bc(`existing chat history`)):e.lastError=String(r)}finally{U_(e,n)&&(e.chatLoading=!1)}}async function Z_(e){if(!e.client||!e.connected||!e.sessionKey.trim()){e.chatSessionUsage=null,e.chatSessionUsageLoading=!1;return}let t=e.sessionKey;e.chatSessionUsageLoading=!0,e.chatSessionUsageError=null;try{let n=await e.client.request(`sessions.usage`,{key:t,limit:1});if(e.sessionKey!==t)return;let r=Array.isArray(n?.sessions)?n.sessions:[];e.chatSessionUsage=r.find(e=>e.key===t)??r[0]??null}catch(n){if(e.sessionKey!==t)return;e.chatSessionUsage=null,e.chatSessionUsageError=String(n)}finally{e.sessionKey===t&&(e.chatSessionUsageLoading=!1)}}function Q_(e){let t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}function $_(e,t){if(!e||typeof e!=`object`)return null;let n=e,r=n.role;if(typeof r==`string`){if((t.roleCaseSensitive?r:r.toLowerCase())!==`assistant`)return null}else if(t.roleRequirement===`required`)return null;return t.requireContentArray?Array.isArray(n.content)?n:null:!(`content`in n)&&!(t.allowTextField&&`text`in n)?null:n}function ev(e){return $_(e,{roleRequirement:`required`,roleCaseSensitive:!0,requireContentArray:!0})}function tv(e){let t=$_(e,{roleRequirement:`optional`,allowTextField:!0});return t?q_(t):null}function nv(e){let t=e?.trim()||`chat error`;return/^Unhandled stop reason:\s*error$/i.test(t)?`Chat failed. Check gateway logs for details.`:`Chat failed: ${t}`}function rv(e,t){let n=nv(t),r=e.chatMessages.at(-1);(r?j_(r):null)!==n&&(e.chatMessages=[...e.chatMessages,{role:`assistant`,content:[{type:`text`,text:n}],timestamp:Date.now()}])}async function iv(e,t,n){if(!e.client||!e.connected)return null;let r=t.trim(),i=Array.isArray(n)?n:n?.attachments,a=Array.isArray(n)?`operator`:n?.deliveryMode??`operator`,o=i&&i.length>0;if(!r&&!o)return null;let s=Date.now(),c=[];if(r&&c.push({type:`text`,text:r}),o)for(let e of i)c.push({type:`image`,source:{type:`base64`,media_type:e.mimeType,data:e.dataUrl}});e.chatMessages=[...e.chatMessages,{role:`user`,content:c,timestamp:s}],e.chatSending=!0,e.lastError=null;let l=Kn();e.chatRunId=l,e.chatStream=``,e.chatStreamStartedAt=s;let u=o?i.map(e=>{let t=Q_(e.dataUrl);return t?{type:`image`,mimeType:t.mimeType,content:t.content}:null}).filter(e=>e!==null):void 0;try{return a===`channel`?await e.client.request(`agent`,{sessionKey:e.sessionKey,message:r,deliver:!0,idempotencyKey:l,thinking:e.chatThinkingLevel??void 0,attachments:u}):await e.client.request(`chat.send`,{sessionKey:e.sessionKey,message:r,deliver:!1,idempotencyKey:l,attachments:u}),l}catch(t){let n=z_(t);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=n,e.chatMessages=[...e.chatMessages,{role:`assistant`,content:[{type:`text`,text:`Error: `+n}],timestamp:Date.now()}],null}finally{e.chatSending=!1}}async function av(e){if(!e.client||!e.connected)return!1;let t=e.chatRunId;try{return await e.client.request(`chat.abort`,t?{sessionKey:e.sessionKey,runId:t}:{sessionKey:e.sessionKey}),!0}catch(t){return e.lastError=z_(t),!1}}function ov(e,t){if(!t||t.sessionKey!==e.sessionKey)return null;if(t.runId&&e.chatRunId&&t.runId!==e.chatRunId){if(t.state===`final`){let n=tv(t.message);return n&&!J_(n)?(e.chatMessages=[...e.chatMessages,n],null):`final`}return null}if(t.state===`delta`){let n=j_(t.message);typeof n==`string`&&!G_(n)&&(e.chatStream=n)}else if(t.state===`final`){let n=tv(t.message);n&&!J_(n)?e.chatMessages=[...e.chatMessages,n]:e.chatStream?.trim()&&!G_(e.chatStream)&&(e.chatMessages=[...e.chatMessages,{role:`assistant`,content:[{type:`text`,text:e.chatStream}],timestamp:Date.now()}]),e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null}else if(t.state===`aborted`){let n=ev(t.message);if(n&&!J_(n))e.chatMessages=[...e.chatMessages,n];else{let t=e.chatStream??``;t.trim()&&!G_(t)&&(e.chatMessages=[...e.chatMessages,{role:`assistant`,content:[{type:`text`,text:t}],timestamp:Date.now()}])}e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null}else t.state===`error`&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.lastError=nv(t.errorMessage),rv(e,t.errorMessage));return t.state}function sv(e){let t=e.message;if(!t||typeof t!=`object`||Array.isArray(t))return t;let n=t;return typeof n.id==`string`||typeof e.messageId!=`string`?t:{...n,id:e.messageId}}function cv(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=t.id??t.messageId;return typeof n==`string`&&n.trim()?n.trim():null}function lv(e){if(!e||typeof e!=`object`||Array.isArray(e))return``;let t=e.role;return typeof t==`string`?t:``}function uv(e,t){if(!e||!t)return!1;let n=lv(e),r=lv(t);if(n&&r&&n!==r)return!1;let i=j_(e),a=j_(t);return typeof i==`string`&&i.length>0&&i===a}function dv(e){let t=(e??``).trim().toLowerCase();return cd(t)?.rest??t}function fv(e,t){if(!t||dv(t.sessionKey)!==dv(e.sessionKey)||e.chatRunId)return!1;let n=sv(t);if(!n||J_(n))return!1;let r=cv(n);return r&&e.chatMessages.some(e=>cv(e)===r)||uv(e.chatMessages.at(-1),n)?!1:(e.chatMessages=[...e.chatMessages,n],!0)}var pv=new WeakMap;function mv(e){return e.chatSending||!!e.chatRunId}function hv(e){let t=e.trim();if(!t)return!1;let n=t.toLowerCase();return n===`/stop`?!0:n===`stop`||n===`esc`||n===`abort`||n===`wait`||n===`exit`}function gv(e){let t=e.trim();if(!t)return!1;let n=t.toLowerCase();return n===`/new`||n===`/reset`?!0:n.startsWith(`/new `)||n.startsWith(`/reset `)}function _v(e){let t=e.sessionsResult?.sessions?.find(t=>t.key===e.sessionKey),n=(t?.deliveryContext?.channel??t?.lastChannel??``).trim(),r=(t?.deliveryContext?.to??t?.lastTo??``).trim();return!!(n&&n!==`webchat`&&r)}async function vv(e){e.connected&&(e.chatMessage=``,await av(e))}function yv(e,t,n,r){let i=t.trim(),a=!!(n&&n.length>0);!i&&!a||(e.chatQueue=[...e.chatQueue,{id:Kn(),text:i,createdAt:Date.now(),attachments:a?n?.map(e=>({...e})):void 0,refreshSessions:r}])}async function bv(e,t,n){l_(e);let r=e.settings?.chatDeliveryMode===`channel`&&_v(e)?`channel`:`operator`,i=await iv(e,t,{attachments:n?.attachments,deliveryMode:r}),a=!!i;return!a&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!a&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),a&&Og(e,e.sessionKey),a&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),a&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),In(e),a&&!e.chatRunId&&xv(e),a&&n?.refreshSessions&&i&&e.refreshSessionsAfterChat.add(i),a}async function xv(e){if(!e.connected||mv(e))return;let[t,...n]=e.chatQueue;t&&(e.chatQueue=n,await bv(e,t.text,{attachments:t.attachments,refreshSessions:t.refreshSessions})||(e.chatQueue=[t,...e.chatQueue]))}async function Sv(e){let t=e.chatModelPatchPending;t&&await t.catch(()=>void 0)}function Cv(e){let t=e.replace(/\s+/g,` `).trim();return!t||t.startsWith(`/`)?null:(t.length>64?`${t.slice(0,61).trimEnd()}...`:t)||null}function wv(e){let t=e?.trim()??``;return!t||/^(?:local\s+)?chat\s+\d+$/i.test(t)}function Tv(e){if(!Nn(e.sessionKey)?.rest.toLowerCase().startsWith(`webchat:direct:`)||Array.isArray(e.chatMessages)&&e.chatMessages.length>0)return!1;let t=e.sessionsResult?.sessions?.find(t=>t.key===e.sessionKey);return wv(t?.label?.trim()||t?.displayName?.trim()||``)}async function Ev(e,t){if(!(!t||!e.client||!e.connected))try{await e.client.request(`sessions.patch`,{key:e.sessionKey,label:t}),e.sessionsResult?.sessions&&(e.sessionsResult={...e.sessionsResult,sessions:e.sessionsResult.sessions.map(n=>n.key===e.sessionKey?{...n,label:t}:n)})}catch{}}function Dv(e,t){e.chatQueue=e.chatQueue.filter(e=>e.id!==t)}function Ov(e,t){t&&(e.chatQueue=e.chatQueue.filter(e=>e.pendingRunId!==t))}async function kv(e,t,n){if(!e.connected)return;let r=e.chatMessage,i=(t??e.chatMessage).trim(),a=e.chatAttachments??[],o=t==null?a:[],s=o.length>0;if(!i&&!s)return;if(hv(i)){await vv(e);return}if(await Sv(e),!e.connected)return;let c=gv(i),l=Tv(e)?Cv(i):null;if(t??(e.chatMessage=``,e.chatAttachments=[]),mv(e)){yv(e,i,o,c);return}await bv(e,i,{previousDraft:t==null?r:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:s?o:void 0,previousAttachments:t==null?a:void 0,restoreAttachments:!!(t&&n?.restoreDraft),refreshSessions:c})&&l&&await Ev(e,l)}async function Av(e,t){await Promise.all([X_(e),Z_(e),U(e,{activeMinutes:120}),Iv(e)]),t?.scheduleScroll!==!1&&In(e)}var jv=xv;function Mv(e){let t=e,n=(pv.get(t)??0)+1;return pv.set(t,n),n}function Nv(e,t,n){return pv.get(e)===t&&e.sessionKey===n}function Pv(e){let t=Nn(e.sessionKey);return t?.agentId?t.agentId:(e.hello?.snapshot)?.sessionDefaults?.defaultAgentId?.trim()||`main`}function Fv(e,t){let n=p(e),r=encodeURIComponent(t);return n?`${n}/avatar/${r}?meta=1`:`/avatar/${r}?meta=1`}async function Iv(e){if(!e.connected){e.chatAvatarUrl=null;return}let t=e.sessionKey,n=Mv(e),r=Pv(e);if(!r){Nv(e,n,t)&&(e.chatAvatarUrl=null);return}e.chatAvatarUrl=null;let i=Fv(e.basePath,r);try{let r=await fetch(i,{method:`GET`});if(!Nv(e,n,t))return;if(!r.ok){e.chatAvatarUrl=null;return}let a=await r.json();if(!Nv(e,n,t))return;e.chatAvatarUrl=(typeof a.avatarUrl==`string`?a.avatarUrl.trim():``)||null}catch{Nv(e,n,t)&&(e.chatAvatarUrl=null)}}var Lv=`0.1.66`;function Rv(e,t=Lv){let n=e?.trim(),r=t.trim();return!!(n&&r&&r!==`dev`&&n!==r)}function zv(e){if(!e||e.state!==`final`)return!1;if(!e.message||typeof e.message!=`object`)return!0;let t=e.message,n=typeof t.role==`string`?t.role.toLowerCase():``;return!!(n&&n!==`assistant`)}var Bv=50,Vv=200;function Hv(e,t){if(typeof e!=`string`)return;let n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function Uv(e){let t=Hv(e?.name,Bv)??`Assistant`,n=Hv(e?.avatar??void 0,Vv)??null;return{agentId:typeof e?.agentId==`string`&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function Wv(){let e=window.__FASED_INJECTED_IDENTITY__;return Uv(e)}async function Gv(e,t){if(!e.client||!e.connected)return;let n=t?.sessionKey?.trim()||e.sessionKey.trim(),r=n?{sessionKey:n}:{};try{let t=await e.client.request(`agent.identity.get`,r);if(!t)return;let n=Uv(t);e.assistantName=n.name,e.assistantAvatar=n.avatar,e.assistantAgentId=n.agentId??null}catch{}}function Kv(e){return typeof e==`object`&&!!e}function qv(e){if(!Kv(e))return null;let t=typeof e.id==`string`?e.id.trim():``,n=e.request;if(!t||!Kv(n))return null;let r=typeof n.command==`string`?n.command.trim():``;if(!r)return null;let i=typeof e.createdAtMs==`number`?e.createdAtMs:0,a=typeof e.expiresAtMs==`number`?e.expiresAtMs:0;return!i||!a?null:{id:t,kind:`exec`,request:{command:r,cwd:typeof n.cwd==`string`?n.cwd:null,host:typeof n.host==`string`?n.host:null,security:typeof n.security==`string`?n.security:null,ask:typeof n.ask==`string`?n.ask:null,agentId:typeof n.agentId==`string`?n.agentId:null,resolvedPath:typeof n.resolvedPath==`string`?n.resolvedPath:null,sessionKey:typeof n.sessionKey==`string`?n.sessionKey:null},createdAtMs:i,expiresAtMs:a}}function Jv(e){if(!Kv(e))return null;let t=typeof e.id==`string`?e.id.trim():``;return t?{id:t,decision:typeof e.decision==`string`?e.decision:null,resolvedBy:typeof e.resolvedBy==`string`?e.resolvedBy:null,ts:typeof e.ts==`number`?e.ts:null}:null}function Yv(e){if(!Kv(e))return null;let t=typeof e.id==`string`?e.id.trim():``;if(!t)return null;let n=typeof e.createdAtMs==`number`?e.createdAtMs:0,r=typeof e.expiresAtMs==`number`?e.expiresAtMs:0;if(!n||!r)return null;let i=Kv(e.request)?e.request:{},a=typeof i.title==`string`?i.title.trim():``;if(!a)return null;let o=typeof i.description==`string`?i.description:null,s=typeof i.severity==`string`?i.severity:null,c=typeof i.pluginId==`string`?i.pluginId:null;return{id:t,kind:`plugin`,request:{command:a,agentId:typeof i.agentId==`string`?i.agentId:null,sessionKey:typeof i.sessionKey==`string`?i.sessionKey:null},pluginTitle:a,pluginDescription:o,pluginSeverity:s,pluginId:c,createdAtMs:n,expiresAtMs:r}}function Xv(e){let t=Date.now();return e.filter(e=>e.expiresAtMs>t)}function Zv(e,t){let n=Xv(e).filter(e=>e.id!==t.id);return n.unshift(t),n}function Qv(e,t){return Xv(e).filter(e=>e.id!==t)}function $v(e){return/^(?:typeerror:\s*)?(?:fetch failed|failed to fetch)$/i.test(e.trim())}function ey(e){if(e&&typeof e==`object`){let t=e.ts;if(typeof t==`number`&&Number.isFinite(t))return t}return Date.now()}function ty(e){e.restartReconnectTimer!=null&&(globalThis.clearTimeout(e.restartReconnectTimer),e.restartReconnectTimer=null)}function ny(e,t,n=e.client){ty(e),e.restartReconnectTimer=globalThis.setTimeout(()=>{e.restartReconnectTimer=null,!e.connected&&(!n||e.client!==n||oy(e))},Math.max(250,Math.floor(t)))}function ry(e){let t=e.uiVersion?.trim();if(!t)return;let n=e.pageUrl??(typeof window>`u`?void 0:window.location.href);if(n)try{let r=new URL(n),i=new URL(e.gatewayUrl,r);return!new Set([`ws:`,`wss:`,`http:`,`https:`]).has(i.protocol)||i.host!==r.host?void 0:t}catch{return}}function iy(e,t){let n=(e??``).trim(),r=t.mainSessionKey?.trim();if(!r)return n;if(!n)return r;let i=t.mainKey?.trim()||`main`,a=t.defaultAgentId?.trim();return n===`main`||n===i||a&&(n===`agent:${a}:main`||n===`agent:${a}:${i}`)?r:n}function ay(e,t){if(!t?.mainSessionKey)return;let n=iy(e.sessionKey,t),r=iy(e.settings.sessionKey,t),i=iy(e.settings.lastActiveSessionKey,t),a=n||r||e.sessionKey,o={...e.settings,sessionKey:r||a,lastActiveSessionKey:i||a},s=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;a!==e.sessionKey&&(e.sessionKey=a),s&&Dg(e,o)}function oy(e,t){let n=e,r=t?.reason??`initial`;n.pendingShutdownMessage=null,n.resumeChatQueueAfterReconnect=!1,ty(n),e.lastError=null,e.lastErrorCode=null,e.hello=null,e.connected=!1,e.sessionsSubscriptionActive=!1,e.sessionMessagesSubscriptionActive=!1,e.subscribedSessionMessageKey=null,r===`seq-gap`?(e.execApprovalQueue=Xv(e.execApprovalQueue),Ov(e,e.chatRunId??void 0),n.resumeChatQueueAfterReconnect=!0):e.execApprovalQueue=Xv(e.execApprovalQueue),e.execApprovalError=null;let i=e.client,a=ry({gatewayUrl:e.settings.gatewayUrl,uiVersion:Lv}),o=new Rc({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:`fased-control-ui`,clientVersion:a,mode:as.UI,instanceId:e.clientInstanceId,onHello:t=>{if(e.client===o){if(ty(n),n.pendingShutdownMessage=null,e.connected=!0,e.lastError=null,e.lastErrorCode=null,e.hello=t,e.serverVersion=t.server?.version?.trim()||null,e.serverVersion&&Rv(e.serverVersion)){e.uiRuntimeError=`Dashboard build ${Lv} does not match gateway ${e.serverVersion}. Run fased update, restart the gateway, and reload this page.`,o.stop();return}dy(e,t),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,l_(e),n.resumeChatQueueAfterReconnect&&(n.resumeChatQueueAfterReconnect=!1,jv(e)),gm(e),_m(e),Gv(e),pd(e),Au(e,{quiet:!0}),up(e,{quiet:!0}),Ng(e)}},onClose:({code:t,reason:r,error:i})=>{if(e.client===o){if(e.connected=!1,e.sessionsSubscriptionActive=!1,e.sessionMessagesSubscriptionActive=!1,e.subscribedSessionMessageKey=null,e.lastErrorCode=Mc(i)??(i?.details&&typeof i.details==`object`&&typeof i.details.code==`string`?i.details.code??null:null)??(typeof i?.code==`string`?i.code:null),t!==1012){if(i?.message){e.lastError=e.lastErrorCode&&$v(i.message)?z_({message:i.message,details:i.details,code:i.code}):i.message;return}e.lastError=n.pendingShutdownMessage??`disconnected (${t}): ${r||`no reason`}`}else e.lastError=n.pendingShutdownMessage??null,e.lastErrorCode=null;n.pendingShutdownMessage&&ny(n,1750,o)}},onEvent:t=>{e.client===o&&sy(e,t)},onGap:({expected:t,received:n})=>{e.client===o&&(e.lastError=`event gap detected (expected seq ${t}, got ${n}); reconnecting`,e.lastErrorCode=null,oy(e,{reason:`seq-gap`}))}});e.client=o,i?.stop(),o.start()}function sy(e,t){try{uy(e,t)}catch(e){console.error(`[gateway] handleGatewayEvent error:`,t.event,e)}}function cy(e,t,n){if(n!==`final`&&n!==`error`&&n!==`aborted`)return!1;let r=e.toolStreamOrder.length>0;l_(e),Ov(e,t?.runId),jv(e);let i=t?.runId;return i&&e.refreshSessionsAfterChat.has(i)&&(e.refreshSessionsAfterChat.delete(i),n===`final`&&U(e,{activeMinutes:120})),r&&n===`final`?(X_(e),!0):!1}function ly(e,t){t?.sessionKey&&Og(e,t.sessionKey);let n=ov(e,t),r=cy(e,t,n);n===`final`&&!r&&zv(t)&&X_(e)}function uy(e,t){if(e.eventLogBuffer=[{ts:Date.now(),event:t.event,payload:t.payload},...e.eventLogBuffer].slice(0,250),e.tab===`debug`&&(e.eventLog=e.eventLogBuffer),t.event===`agent`){if(e.onboarding)return;y_(e,t.payload);return}if(t.event===`chat`){ly(e,t.payload);return}if(t.event===`presence`){let n=t.payload;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event===`update.available`){let n=t.payload?.updateAvailable;n?.currentVersion&&n.latestVersion&&(e.updateAvailable={currentVersion:n.currentVersion,latestVersion:n.latestVersion,channel:n.channel});return}if(t.event===`mining.changed`){let n=t.payload,r=!!n?.method;!(r&&du(e,n))&&r&&e.tab===`mining`&&au(e,{quiet:!0});return}if(t.event===`cron`&&e.tab===`cron`){Jg(e);return}if(t.event===`sessions.changed`){e.sessionsLastEventAt=ey(t.payload),xm(e,t.payload)||U(e);return}if(t.event===`session.message`){e.sessionMessageLastEventAt=ey(t.payload),fv(e,t.payload)&&In(e);return}if(t.event===`device.pair.requested`||t.event===`device.pair.resolved`){up(e,{quiet:!0});return}if(t.event===`shutdown`){let n=t.payload;if(n?.reason){let t=`Restarting: ${n.reason}`;e.pendingShutdownMessage=t,e.lastError=t,e.lastErrorCode=null,ny(e,typeof n.restartExpectedMs==`number`&&Number.isFinite(n.restartExpectedMs)?Math.max(250,n.restartExpectedMs+250):1750)}return}if(t.event===`exec.approval.requested`){let n=qv(t.payload);if(n){e.execApprovalQueue=Zv(e.execApprovalQueue,n),e.execApprovalError=null;let t=Math.max(0,n.expiresAtMs-Date.now()+500);globalThis.setTimeout(()=>{e.execApprovalQueue=Qv(e.execApprovalQueue,n.id)},t)}return}if(t.event===`exec.approval.resolved`){let n=Jv(t.payload);n&&(e.execApprovalQueue=Qv(e.execApprovalQueue,n.id));return}if(t.event===`plugin.approval.requested`){let n=Yv(t.payload);if(n){e.execApprovalQueue=Zv(e.execApprovalQueue,n),e.execApprovalError=null;let t=Math.max(0,n.expiresAtMs-Date.now()+500);globalThis.setTimeout(()=>{e.execApprovalQueue=Qv(e.execApprovalQueue,n.id)},t)}return}if(t.event===`plugin.approval.resolved`){let n=Jv(t.payload);n&&(e.execApprovalQueue=Qv(e.execApprovalQueue,n.id))}}function dy(e,t){let n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&ay(e,n.sessionDefaults),e.federationManagedMode=n?.gatewayMode===`managed`}var fy=`/__fased/control-ui-config.json`;async function py(e){if(typeof window>`u`||typeof fetch!=`function`)return;let t=p(e.basePath??``),n=t?`${t}${fy}`:fy;try{let t=await fetch(n,{method:`GET`,headers:{Accept:`application/json`},credentials:`same-origin`});if(!t.ok)return;let r=await t.json();e.serverVersion=r.serverVersion?.trim()||null,e.serverVersion&&Rv(e.serverVersion)&&(e.uiRuntimeError=`Dashboard build ${Lv} does not match gateway ${e.serverVersion}. Run fased update, restart the gateway, and reload this page.`);let i=Uv({name:r.assistantName,avatar:r.assistantAvatar??null});e.assistantName=i.name,e.assistantAvatar=i.avatar}catch{}}function my(e){e.basePath=Fg(),e.authBootstrapPending=!0;let t=py(e);Bg(e,!0),Ig(e),Rg(e),window.addEventListener(`popstate`,e.popStateHandler),Promise.all([t,kg(e)]).then(()=>{e.authBootstrapPending=!1,e.settings.token.trim()&&!e.client&&oy(e)},()=>{e.authBootstrapPending=!1}),Lu(e),e.tab===`logs`&&zu(e),e.tab===`debug`&&Vu(e),(e.tab===`federation`||e.tab===`marketplace`)&&Uu(e),e.tab===`mining`&&Gu(e)}function hy(e){Hn(e)}function gy(e){window.removeEventListener(`popstate`,e.popStateHandler),Ru(e),Bu(e),Hu(e),Wu(e),Ku(e),e.client?.stop(),e.client=null,e.connected=!1,zg(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function _y(e,t){if(!(e.tab===`chat`&&e.chatManualRefreshInFlight)){if(e.tab===`chat`&&(t.has(`chatMessages`)||t.has(`chatToolMessages`)||t.has(`chatStream`)||t.has(`chatLoading`)||t.has(`tab`))){let n=t.has(`tab`),r=t.has(`chatLoading`)&&t.get(`chatLoading`)===!0&&!e.chatLoading;In(e,n||r||!e.chatHasAutoScrolled)}e.tab===`logs`&&(t.has(`logsEntries`)||t.has(`logsAutoFollow`)||t.has(`tab`))&&e.logsAutoFollow&&e.logsAtBottom&&Ln(e,t.has(`tab`)||t.has(`logsAutoFollow`))}}var vy=`Fased`,yy=`Fased Agent`;function by(e){if(Array.isArray(e))return e.map(e=>typeof e==`string`?e.trim():``).filter(Boolean).slice(0,1)}function xy(e,t){let n=t.trim();if(!n)return null;let r=e?.agents?.list,i=Array.isArray(r)?r.map(e=>e&&typeof e==`object`?{...e}:{}):r&&typeof r==`object`?Object.entries(r).map(([e,t])=>({...t&&typeof t==`object`?t:{},id:t&&typeof t==`object`&&`id`in t&&typeof t.id==`string`&&t.id.trim()?t.id:e})):[],a=i.findIndex(e=>e.id===n);return a>=0?{changed:!1,index:a,list:i}:(i.push({id:n}),{changed:!0,index:i.length-1,list:i})}var Sy=`Assistant`;function Cy(e){return e.split(/[-_]+/).filter(Boolean).map(e=>`${e.slice(0,1).toUpperCase()}${e.slice(1)}`).join(` `)}function wy(e){return(e??``).trim().toLowerCase()===`main`}function Ty(e){let t=e.id.trim(),n=t.toLowerCase(),r=e.identity?.name?.trim()||e.name?.trim()||``;return r&&r.toLowerCase()!==n?r:wy(t)?Sy:Cy(t)||t}function Ey(e){let t=e.id.trim(),n=Ty(e);return wy(t)?n:n&&n!==t?`${n} (${t})`:t}var Dy=new Set([`agent`,`channel`,`chat`,`provider`,`model`,`source`,`tool`,`label`,`key`,`session`,`id`,`has`,`mintokens`,`maxtokens`,`mincost`,`maxcost`,`minmessages`,`maxmessages`]),Oy=e=>e.trim().toLowerCase(),ky=e=>{let t=e.replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`.*`).replace(/\?/g,`.`);return RegExp(`^${t}$`,`i`)},Ay=e=>{let t=e.trim().toLowerCase();if(!t)return null;t.startsWith(`$`)&&(t=t.slice(1));let n=1;t.endsWith(`k`)?(n=1e3,t=t.slice(0,-1)):t.endsWith(`m`)&&(n=1e6,t=t.slice(0,-1));let r=Number(t);return Number.isFinite(r)?r*n:null},jy=e=>(e.match(/"[^"]+"|\S+/g)??[]).map(e=>{let t=e.replace(/^"|"$/g,``),n=t.indexOf(`:`);return n>0?{key:t.slice(0,n),value:t.slice(n+1),raw:t}:{value:t,raw:t}}),My=e=>[e.label,e.key,e.sessionId].filter(e=>!!e).map(e=>e.toLowerCase()),Ny=e=>{let t=new Set;e.modelProvider&&t.add(e.modelProvider.toLowerCase()),e.providerOverride&&t.add(e.providerOverride.toLowerCase()),e.origin?.provider&&t.add(e.origin.provider.toLowerCase());for(let n of e.usage?.modelUsage??[])n.provider&&t.add(n.provider.toLowerCase());return Array.from(t)},Py=e=>{let t=new Set;e.model&&t.add(e.model.toLowerCase());for(let n of e.usage?.modelUsage??[])n.model&&t.add(n.model.toLowerCase());return Array.from(t)},Fy=e=>(e.usage?.toolUsage?.tools??[]).map(e=>e.name.toLowerCase()),Iy=(e,t)=>{let n=Oy(t.value??``);if(!n)return!0;if(!t.key)return My(e).some(e=>e.includes(n));switch(Oy(t.key)){case`agent`:return e.agentId?.toLowerCase().includes(n)??!1;case`channel`:return e.channel?.toLowerCase().includes(n)??!1;case`chat`:return e.chatType?.toLowerCase().includes(n)??!1;case`provider`:return Ny(e).some(e=>e.includes(n));case`model`:return Py(e).some(e=>e.includes(n));case`source`:return e.source?.toLowerCase().includes(n)??!1;case`tool`:return Fy(e).some(e=>e.includes(n));case`label`:return e.label?.toLowerCase().includes(n)??!1;case`key`:case`session`:case`id`:if(n.includes(`*`)||n.includes(`?`)){let t=ky(n);return t.test(e.key)||(e.sessionId?t.test(e.sessionId):!1)}return e.key.toLowerCase().includes(n)||(e.sessionId?.toLowerCase().includes(n)??!1);case`has`:switch(n){case`tools`:return(e.usage?.toolUsage?.totalCalls??0)>0;case`errors`:return(e.usage?.messageCounts?.errors??0)>0;case`context`:return!!e.contextWeight;case`usage`:return!!e.usage;case`model`:return Py(e).length>0;case`provider`:return Ny(e).length>0;default:return!0}case`mintokens`:{let t=Ay(n);return t===null?!0:(e.usage?.totalTokens??0)>=t}case`maxtokens`:{let t=Ay(n);return t===null?!0:(e.usage?.totalTokens??0)<=t}case`mincost`:{let t=Ay(n);return t===null?!0:(e.usage?.totalCost??0)>=t}case`maxcost`:{let t=Ay(n);return t===null?!0:(e.usage?.totalCost??0)<=t}case`minmessages`:{let t=Ay(n);return t===null?!0:(e.usage?.messageCounts?.total??0)>=t}case`maxmessages`:{let t=Ay(n);return t===null?!0:(e.usage?.messageCounts?.total??0)<=t}default:return!0}},Ly=(e,t)=>{let n=jy(t);if(n.length===0)return{sessions:e,warnings:[]};let r=[];for(let e of n){if(!e.key)continue;let t=Oy(e.key);if(!Dy.has(t)){r.push(`Unknown filter: ${e.key}`);continue}if(e.value===``&&r.push(`Missing value for ${e.key}`),t===`has`){let t=new Set([`tools`,`errors`,`context`,`usage`,`model`,`provider`]);e.value&&!t.has(Oy(e.value))&&r.push(`Unknown has:${e.value}`)}[`mintokens`,`maxtokens`,`mincost`,`maxcost`,`minmessages`,`maxmessages`].includes(t)&&e.value&&Ay(e.value)===null&&r.push(`Invalid number for ${e.key}`)}return{sessions:e.filter(e=>n.every(t=>Iy(e,t))),warnings:r}};function Ry(e){let t=e.split(`
|
|
143
|
+
`):``}function L_(e){return typeof e==`string`?e:e instanceof Error&&typeof e.message==`string`?e.message:`unknown error`}function R_(e){let t=L_(e.message);switch(Mc(e)){case es.AUTH_TOKEN_MISMATCH:return`gateway token mismatch`;case es.AUTH_UNAUTHORIZED:return`gateway auth failed`;case es.AUTH_RATE_LIMITED:return`too many failed authentication attempts`;case es.PAIRING_REQUIRED:return`gateway pairing required`;case es.CONTROL_UI_DEVICE_IDENTITY_REQUIRED:return`device identity required (use HTTPS/localhost or allow insecure auth explicitly)`;case es.CONTROL_UI_ORIGIN_NOT_ALLOWED:return`origin not allowed (open the Control UI from the gateway host or allow it in gateway.controlUi.allowedOrigins)`;case es.AUTH_TOKEN_MISSING:return`gateway token missing`;default:break}let n=t.trim().toLowerCase();return n===`fetch failed`||n===`failed to fetch`||n===`connect failed`?`gateway connect failed`:t}function z_(e){return e&&typeof e==`object`?R_(e):L_(e)}var B_=/^\s*(?:NO_REPLY|ANNOUNCE_SKIP|REPLY_SKIP)\s*$/,V_=new WeakMap;function H_(e){let t=e,n=(V_.get(t)??0)+1;return V_.set(t,n),n}function U_(e,t){return V_.get(e)===t}function W_(e,t,n){return U_(e,t)&&e.sessionKey===n}function G_(e){return B_.test(e)}function K_(e){return G_(e)?e:e.replace(/(?:^|\r?\n)[\t ]*(?:NO_REPLY|ANNOUNCE_SKIP|REPLY_SKIP)[\t ]*$/i,``).trimEnd()}function q_(e){if(!e||typeof e!=`object`)return e;let t=e;if(typeof t.role==`string`&&t.role.toLowerCase()!==`assistant`)return e;let n=!1,r={...t};if(typeof r.text==`string`){let e=K_(r.text);n||=e!==r.text,r.text=e}if(typeof r.content==`string`){let e=K_(r.content);n||=e!==r.content,r.content=e}else if(Array.isArray(r.content)){let e=[...r.content];for(let t=e.length-1;t>=0;--t){let r=e[t];if(!r||typeof r!=`object`||typeof r.text!=`string`)continue;let i={...r},a=i.text,o=e.slice(0,t).some(e=>e&&typeof e==`object`&&typeof e.text==`string`&&!!(e.text??``).trim())&&G_(a)?``:K_(a);n||=o!==i.text,i.text=o,e[t]=i;break}r.content=e}return n?r:e}function J_(e){if(!e||typeof e!=`object`)return!1;let t=e;if((typeof t.role==`string`?t.role.toLowerCase():``)!==`assistant`)return!1;if(typeof t.text==`string`)return G_(t.text);let n=j_(e);return typeof n==`string`&&G_(n)}function Y_(e){let t=e;t.toolStreamById instanceof Map&&Array.isArray(t.toolStreamOrder)&&Array.isArray(t.chatToolMessages)&&Array.isArray(t.chatStreamSegments)&&l_(t)}async function X_(e){if(!e.client||!e.connected)return;let t=e.sessionKey,n=H_(e);e.chatLoading=!0,e.lastError=null;try{let r=await e.client.request(`chat.history`,{sessionKey:t,limit:200});if(!W_(e,n,t))return;e.chatMessages=(Array.isArray(r.messages)?r.messages:[]).filter(e=>!J_(e)).map(e=>q_(e)),e.chatThinkingLevel=r.thinkingLevel??null,Y_(e),e.chatStream=null,e.chatStreamStartedAt=null}catch(r){if(!W_(e,n,t))return;zc(r)?(e.chatMessages=[],e.chatThinkingLevel=null,e.lastError=Bc(`existing chat history`)):e.lastError=String(r)}finally{U_(e,n)&&(e.chatLoading=!1)}}async function Z_(e){if(!e.client||!e.connected||!e.sessionKey.trim()){e.chatSessionUsage=null,e.chatSessionUsageLoading=!1;return}let t=e.sessionKey;e.chatSessionUsageLoading=!0,e.chatSessionUsageError=null;try{let n=await e.client.request(`sessions.usage`,{key:t,limit:1});if(e.sessionKey!==t)return;let r=Array.isArray(n?.sessions)?n.sessions:[];e.chatSessionUsage=r.find(e=>e.key===t)??r[0]??null}catch(n){if(e.sessionKey!==t)return;e.chatSessionUsage=null,e.chatSessionUsageError=String(n)}finally{e.sessionKey===t&&(e.chatSessionUsageLoading=!1)}}function Q_(e){let t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}function $_(e,t){if(!e||typeof e!=`object`)return null;let n=e,r=n.role;if(typeof r==`string`){if((t.roleCaseSensitive?r:r.toLowerCase())!==`assistant`)return null}else if(t.roleRequirement===`required`)return null;return t.requireContentArray?Array.isArray(n.content)?n:null:!(`content`in n)&&!(t.allowTextField&&`text`in n)?null:n}function ev(e){return $_(e,{roleRequirement:`required`,roleCaseSensitive:!0,requireContentArray:!0})}function tv(e){let t=$_(e,{roleRequirement:`optional`,allowTextField:!0});return t?q_(t):null}function nv(e){let t=e?.trim()||`chat error`;return/^Unhandled stop reason:\s*error$/i.test(t)?`Chat failed. Check gateway logs for details.`:`Chat failed: ${t}`}function rv(e,t){let n=nv(t),r=e.chatMessages.at(-1);(r?j_(r):null)!==n&&(e.chatMessages=[...e.chatMessages,{role:`assistant`,content:[{type:`text`,text:n}],timestamp:Date.now()}])}async function iv(e,t,n){if(!e.client||!e.connected)return null;let r=t.trim(),i=Array.isArray(n)?n:n?.attachments,a=Array.isArray(n)?`operator`:n?.deliveryMode??`operator`,o=i&&i.length>0;if(!r&&!o)return null;let s=Date.now(),c=[];if(r&&c.push({type:`text`,text:r}),o)for(let e of i)c.push({type:`image`,source:{type:`base64`,media_type:e.mimeType,data:e.dataUrl}});e.chatMessages=[...e.chatMessages,{role:`user`,content:c,timestamp:s}],e.chatSending=!0,e.lastError=null;let l=Kn();e.chatRunId=l,e.chatStream=``,e.chatStreamStartedAt=s;let u=o?i.map(e=>{let t=Q_(e.dataUrl);return t?{type:`image`,mimeType:t.mimeType,content:t.content}:null}).filter(e=>e!==null):void 0;try{return a===`channel`?await e.client.request(`agent`,{sessionKey:e.sessionKey,message:r,deliver:!0,idempotencyKey:l,thinking:e.chatThinkingLevel??void 0,attachments:u}):await e.client.request(`chat.send`,{sessionKey:e.sessionKey,message:r,deliver:!1,idempotencyKey:l,attachments:u}),l}catch(t){let n=z_(t);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=n,e.chatMessages=[...e.chatMessages,{role:`assistant`,content:[{type:`text`,text:`Error: `+n}],timestamp:Date.now()}],null}finally{e.chatSending=!1}}async function av(e){if(!e.client||!e.connected)return!1;let t=e.chatRunId;try{return await e.client.request(`chat.abort`,t?{sessionKey:e.sessionKey,runId:t}:{sessionKey:e.sessionKey}),!0}catch(t){return e.lastError=z_(t),!1}}function ov(e,t){if(!t||t.sessionKey!==e.sessionKey)return null;if(t.runId&&e.chatRunId&&t.runId!==e.chatRunId){if(t.state===`final`){let n=tv(t.message);return n&&!J_(n)?(e.chatMessages=[...e.chatMessages,n],null):`final`}return null}if(t.state===`delta`){let n=j_(t.message);typeof n==`string`&&!G_(n)&&(e.chatStream=n)}else if(t.state===`final`){let n=tv(t.message);n&&!J_(n)?e.chatMessages=[...e.chatMessages,n]:e.chatStream?.trim()&&!G_(e.chatStream)&&(e.chatMessages=[...e.chatMessages,{role:`assistant`,content:[{type:`text`,text:e.chatStream}],timestamp:Date.now()}]),e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null}else if(t.state===`aborted`){let n=ev(t.message);if(n&&!J_(n))e.chatMessages=[...e.chatMessages,n];else{let t=e.chatStream??``;t.trim()&&!G_(t)&&(e.chatMessages=[...e.chatMessages,{role:`assistant`,content:[{type:`text`,text:t}],timestamp:Date.now()}])}e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null}else t.state===`error`&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.lastError=nv(t.errorMessage),rv(e,t.errorMessage));return t.state}function sv(e){let t=e.message;if(!t||typeof t!=`object`||Array.isArray(t))return t;let n=t;return typeof n.id==`string`||typeof e.messageId!=`string`?t:{...n,id:e.messageId}}function cv(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=t.id??t.messageId;return typeof n==`string`&&n.trim()?n.trim():null}function lv(e){if(!e||typeof e!=`object`||Array.isArray(e))return``;let t=e.role;return typeof t==`string`?t:``}function uv(e,t){if(!e||!t)return!1;let n=lv(e),r=lv(t);if(n&&r&&n!==r)return!1;let i=j_(e),a=j_(t);return typeof i==`string`&&i.length>0&&i===a}function dv(e){let t=(e??``).trim().toLowerCase();return cd(t)?.rest??t}function fv(e,t){if(!t||dv(t.sessionKey)!==dv(e.sessionKey)||e.chatRunId)return!1;let n=sv(t);if(!n||J_(n))return!1;let r=cv(n);return r&&e.chatMessages.some(e=>cv(e)===r)||uv(e.chatMessages.at(-1),n)?!1:(e.chatMessages=[...e.chatMessages,n],!0)}var pv=new WeakMap;function mv(e){return e.chatSending||!!e.chatRunId}function hv(e){let t=e.trim();if(!t)return!1;let n=t.toLowerCase();return n===`/stop`?!0:n===`stop`||n===`esc`||n===`abort`||n===`wait`||n===`exit`}function gv(e){let t=e.trim();if(!t)return!1;let n=t.toLowerCase();return n===`/new`||n===`/reset`?!0:n.startsWith(`/new `)||n.startsWith(`/reset `)}function _v(e){let t=e.sessionsResult?.sessions?.find(t=>t.key===e.sessionKey),n=(t?.deliveryContext?.channel??t?.lastChannel??``).trim(),r=(t?.deliveryContext?.to??t?.lastTo??``).trim();return!!(n&&n!==`webchat`&&r)}async function vv(e){e.connected&&(e.chatMessage=``,await av(e))}function yv(e,t,n,r){let i=t.trim(),a=!!(n&&n.length>0);!i&&!a||(e.chatQueue=[...e.chatQueue,{id:Kn(),text:i,createdAt:Date.now(),attachments:a?n?.map(e=>({...e})):void 0,refreshSessions:r}])}async function bv(e,t,n){l_(e);let r=e.settings?.chatDeliveryMode===`channel`&&_v(e)?`channel`:`operator`,i=await iv(e,t,{attachments:n?.attachments,deliveryMode:r}),a=!!i;return!a&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!a&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),a&&Og(e,e.sessionKey),a&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),a&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),In(e),a&&!e.chatRunId&&xv(e),a&&n?.refreshSessions&&i&&e.refreshSessionsAfterChat.add(i),a}async function xv(e){if(!e.connected||mv(e))return;let[t,...n]=e.chatQueue;t&&(e.chatQueue=n,await bv(e,t.text,{attachments:t.attachments,refreshSessions:t.refreshSessions})||(e.chatQueue=[t,...e.chatQueue]))}async function Sv(e){let t=e.chatModelPatchPending;t&&await t.catch(()=>void 0)}function Cv(e){let t=e.replace(/\s+/g,` `).trim();return!t||t.startsWith(`/`)?null:(t.length>64?`${t.slice(0,61).trimEnd()}...`:t)||null}function wv(e){let t=e?.trim()??``;return!t||/^(?:local\s+)?chat\s+\d+$/i.test(t)}function Tv(e){if(!Nn(e.sessionKey)?.rest.toLowerCase().startsWith(`webchat:direct:`)||Array.isArray(e.chatMessages)&&e.chatMessages.length>0)return!1;let t=e.sessionsResult?.sessions?.find(t=>t.key===e.sessionKey);return wv(t?.label?.trim()||t?.displayName?.trim()||``)}async function Ev(e,t){if(!(!t||!e.client||!e.connected))try{await e.client.request(`sessions.patch`,{key:e.sessionKey,label:t}),e.sessionsResult?.sessions&&(e.sessionsResult={...e.sessionsResult,sessions:e.sessionsResult.sessions.map(n=>n.key===e.sessionKey?{...n,label:t}:n)})}catch{}}function Dv(e,t){e.chatQueue=e.chatQueue.filter(e=>e.id!==t)}function Ov(e,t){t&&(e.chatQueue=e.chatQueue.filter(e=>e.pendingRunId!==t))}async function kv(e,t,n){if(!e.connected)return;let r=e.chatMessage,i=(t??e.chatMessage).trim(),a=e.chatAttachments??[],o=t==null?a:[],s=o.length>0;if(!i&&!s)return;if(hv(i)){await vv(e);return}if(await Sv(e),!e.connected)return;let c=gv(i),l=Tv(e)?Cv(i):null;if(t??(e.chatMessage=``,e.chatAttachments=[]),mv(e)){yv(e,i,o,c);return}await bv(e,i,{previousDraft:t==null?r:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:s?o:void 0,previousAttachments:t==null?a:void 0,restoreAttachments:!!(t&&n?.restoreDraft),refreshSessions:c})&&l&&await Ev(e,l)}async function Av(e,t){await Promise.all([X_(e),Z_(e),U(e,{activeMinutes:120}),Iv(e)]),t?.scheduleScroll!==!1&&In(e)}var jv=xv;function Mv(e){let t=e,n=(pv.get(t)??0)+1;return pv.set(t,n),n}function Nv(e,t,n){return pv.get(e)===t&&e.sessionKey===n}function Pv(e){let t=Nn(e.sessionKey);return t?.agentId?t.agentId:(e.hello?.snapshot)?.sessionDefaults?.defaultAgentId?.trim()||`main`}function Fv(e,t){let n=p(e),r=encodeURIComponent(t);return n?`${n}/avatar/${r}?meta=1`:`/avatar/${r}?meta=1`}async function Iv(e){if(!e.connected){e.chatAvatarUrl=null;return}let t=e.sessionKey,n=Mv(e),r=Pv(e);if(!r){Nv(e,n,t)&&(e.chatAvatarUrl=null);return}e.chatAvatarUrl=null;let i=Fv(e.basePath,r);try{let r=await fetch(i,{method:`GET`});if(!Nv(e,n,t))return;if(!r.ok){e.chatAvatarUrl=null;return}let a=await r.json();if(!Nv(e,n,t))return;e.chatAvatarUrl=(typeof a.avatarUrl==`string`?a.avatarUrl.trim():``)||null}catch{Nv(e,n,t)&&(e.chatAvatarUrl=null)}}var Lv=`0.1.67`;function Rv(e,t=Lv){let n=e?.trim(),r=t.trim();return!!(n&&r&&r!==`dev`&&n!==r)}function zv(e){if(!e||e.state!==`final`)return!1;if(!e.message||typeof e.message!=`object`)return!0;let t=e.message,n=typeof t.role==`string`?t.role.toLowerCase():``;return!!(n&&n!==`assistant`)}var Bv=50,Vv=200;function Hv(e,t){if(typeof e!=`string`)return;let n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function Uv(e){let t=Hv(e?.name,Bv)??`Assistant`,n=Hv(e?.avatar??void 0,Vv)??null;return{agentId:typeof e?.agentId==`string`&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function Wv(){let e=window.__FASED_INJECTED_IDENTITY__;return Uv(e)}async function Gv(e,t){if(!e.client||!e.connected)return;let n=t?.sessionKey?.trim()||e.sessionKey.trim(),r=n?{sessionKey:n}:{};try{let t=await e.client.request(`agent.identity.get`,r);if(!t)return;let n=Uv(t);e.assistantName=n.name,e.assistantAvatar=n.avatar,e.assistantAgentId=n.agentId??null}catch{}}function Kv(e){return typeof e==`object`&&!!e}function qv(e){if(!Kv(e))return null;let t=typeof e.id==`string`?e.id.trim():``,n=e.request;if(!t||!Kv(n))return null;let r=typeof n.command==`string`?n.command.trim():``;if(!r)return null;let i=typeof e.createdAtMs==`number`?e.createdAtMs:0,a=typeof e.expiresAtMs==`number`?e.expiresAtMs:0;return!i||!a?null:{id:t,kind:`exec`,request:{command:r,cwd:typeof n.cwd==`string`?n.cwd:null,host:typeof n.host==`string`?n.host:null,security:typeof n.security==`string`?n.security:null,ask:typeof n.ask==`string`?n.ask:null,agentId:typeof n.agentId==`string`?n.agentId:null,resolvedPath:typeof n.resolvedPath==`string`?n.resolvedPath:null,sessionKey:typeof n.sessionKey==`string`?n.sessionKey:null},createdAtMs:i,expiresAtMs:a}}function Jv(e){if(!Kv(e))return null;let t=typeof e.id==`string`?e.id.trim():``;return t?{id:t,decision:typeof e.decision==`string`?e.decision:null,resolvedBy:typeof e.resolvedBy==`string`?e.resolvedBy:null,ts:typeof e.ts==`number`?e.ts:null}:null}function Yv(e){if(!Kv(e))return null;let t=typeof e.id==`string`?e.id.trim():``;if(!t)return null;let n=typeof e.createdAtMs==`number`?e.createdAtMs:0,r=typeof e.expiresAtMs==`number`?e.expiresAtMs:0;if(!n||!r)return null;let i=Kv(e.request)?e.request:{},a=typeof i.title==`string`?i.title.trim():``;if(!a)return null;let o=typeof i.description==`string`?i.description:null,s=typeof i.severity==`string`?i.severity:null,c=typeof i.pluginId==`string`?i.pluginId:null;return{id:t,kind:`plugin`,request:{command:a,agentId:typeof i.agentId==`string`?i.agentId:null,sessionKey:typeof i.sessionKey==`string`?i.sessionKey:null},pluginTitle:a,pluginDescription:o,pluginSeverity:s,pluginId:c,createdAtMs:n,expiresAtMs:r}}function Xv(e){let t=Date.now();return e.filter(e=>e.expiresAtMs>t)}function Zv(e,t){let n=Xv(e).filter(e=>e.id!==t.id);return n.unshift(t),n}function Qv(e,t){return Xv(e).filter(e=>e.id!==t)}function $v(e){return/^(?:typeerror:\s*)?(?:fetch failed|failed to fetch)$/i.test(e.trim())}function ey(e){if(e&&typeof e==`object`){let t=e.ts;if(typeof t==`number`&&Number.isFinite(t))return t}return Date.now()}function ty(e){e.restartReconnectTimer!=null&&(globalThis.clearTimeout(e.restartReconnectTimer),e.restartReconnectTimer=null)}function ny(e,t,n=e.client){ty(e),e.restartReconnectTimer=globalThis.setTimeout(()=>{e.restartReconnectTimer=null,!e.connected&&(!n||e.client!==n||oy(e))},Math.max(250,Math.floor(t)))}function ry(e){let t=e.uiVersion?.trim();if(!t)return;let n=e.pageUrl??(typeof window>`u`?void 0:window.location.href);if(n)try{let r=new URL(n),i=new URL(e.gatewayUrl,r);return!new Set([`ws:`,`wss:`,`http:`,`https:`]).has(i.protocol)||i.host!==r.host?void 0:t}catch{return}}function iy(e,t){let n=(e??``).trim(),r=t.mainSessionKey?.trim();if(!r)return n;if(!n)return r;let i=t.mainKey?.trim()||`main`,a=t.defaultAgentId?.trim();return n===`main`||n===i||a&&(n===`agent:${a}:main`||n===`agent:${a}:${i}`)?r:n}function ay(e,t){if(!t?.mainSessionKey)return;let n=iy(e.sessionKey,t),r=iy(e.settings.sessionKey,t),i=iy(e.settings.lastActiveSessionKey,t),a=n||r||e.sessionKey,o={...e.settings,sessionKey:r||a,lastActiveSessionKey:i||a},s=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;a!==e.sessionKey&&(e.sessionKey=a),s&&Dg(e,o)}function oy(e,t){let n=e,r=t?.reason??`initial`;n.pendingShutdownMessage=null,n.resumeChatQueueAfterReconnect=!1,ty(n),e.lastError=null,e.lastErrorCode=null,e.hello=null,e.connected=!1,e.sessionsSubscriptionActive=!1,e.sessionMessagesSubscriptionActive=!1,e.subscribedSessionMessageKey=null,r===`seq-gap`?(e.execApprovalQueue=Xv(e.execApprovalQueue),Ov(e,e.chatRunId??void 0),n.resumeChatQueueAfterReconnect=!0):e.execApprovalQueue=Xv(e.execApprovalQueue),e.execApprovalError=null;let i=e.client,a=ry({gatewayUrl:e.settings.gatewayUrl,uiVersion:Lv}),o=new Rc({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:`fased-control-ui`,clientVersion:a,mode:as.UI,instanceId:e.clientInstanceId,onHello:t=>{if(e.client===o){if(ty(n),n.pendingShutdownMessage=null,e.connected=!0,e.lastError=null,e.lastErrorCode=null,e.hello=t,e.serverVersion=t.server?.version?.trim()||null,e.serverVersion&&Rv(e.serverVersion)){e.uiRuntimeError=`Dashboard build ${Lv} does not match gateway ${e.serverVersion}. Run fased update, restart the gateway, and reload this page.`,o.stop();return}dy(e,t),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,l_(e),n.resumeChatQueueAfterReconnect&&(n.resumeChatQueueAfterReconnect=!1,jv(e)),gm(e),_m(e),Gv(e),pd(e),Au(e,{quiet:!0}),up(e,{quiet:!0}),Ng(e)}},onClose:({code:t,reason:r,error:i})=>{if(e.client===o){if(e.connected=!1,e.sessionsSubscriptionActive=!1,e.sessionMessagesSubscriptionActive=!1,e.subscribedSessionMessageKey=null,e.lastErrorCode=Mc(i)??(i?.details&&typeof i.details==`object`&&typeof i.details.code==`string`?i.details.code??null:null)??(typeof i?.code==`string`?i.code:null),t!==1012){if(i?.message){e.lastError=e.lastErrorCode&&$v(i.message)?z_({message:i.message,details:i.details,code:i.code}):i.message;return}e.lastError=n.pendingShutdownMessage??`disconnected (${t}): ${r||`no reason`}`}else e.lastError=n.pendingShutdownMessage??null,e.lastErrorCode=null;n.pendingShutdownMessage&&ny(n,1750,o)}},onEvent:t=>{e.client===o&&sy(e,t)},onGap:({expected:t,received:n})=>{e.client===o&&(e.lastError=`event gap detected (expected seq ${t}, got ${n}); reconnecting`,e.lastErrorCode=null,oy(e,{reason:`seq-gap`}))}});e.client=o,i?.stop(),o.start()}function sy(e,t){try{uy(e,t)}catch(e){console.error(`[gateway] handleGatewayEvent error:`,t.event,e)}}function cy(e,t,n){if(n!==`final`&&n!==`error`&&n!==`aborted`)return!1;let r=e.toolStreamOrder.length>0;l_(e),Ov(e,t?.runId),jv(e);let i=t?.runId;return i&&e.refreshSessionsAfterChat.has(i)&&(e.refreshSessionsAfterChat.delete(i),n===`final`&&U(e,{activeMinutes:120})),r&&n===`final`?(X_(e),!0):!1}function ly(e,t){t?.sessionKey&&Og(e,t.sessionKey);let n=ov(e,t),r=cy(e,t,n);n===`final`&&!r&&zv(t)&&X_(e)}function uy(e,t){if(e.eventLogBuffer=[{ts:Date.now(),event:t.event,payload:t.payload},...e.eventLogBuffer].slice(0,250),e.tab===`debug`&&(e.eventLog=e.eventLogBuffer),t.event===`agent`){if(e.onboarding)return;y_(e,t.payload);return}if(t.event===`chat`){ly(e,t.payload);return}if(t.event===`presence`){let n=t.payload;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event===`update.available`){let n=t.payload?.updateAvailable;n?.currentVersion&&n.latestVersion&&(e.updateAvailable={currentVersion:n.currentVersion,latestVersion:n.latestVersion,channel:n.channel});return}if(t.event===`mining.changed`){let n=t.payload,r=!!n?.method;!(r&&du(e,n))&&r&&e.tab===`mining`&&au(e,{quiet:!0});return}if(t.event===`cron`&&e.tab===`cron`){Jg(e);return}if(t.event===`sessions.changed`){e.sessionsLastEventAt=ey(t.payload),xm(e,t.payload)||U(e);return}if(t.event===`session.message`){e.sessionMessageLastEventAt=ey(t.payload),fv(e,t.payload)&&In(e);return}if(t.event===`device.pair.requested`||t.event===`device.pair.resolved`){up(e,{quiet:!0});return}if(t.event===`shutdown`){let n=t.payload;if(n?.reason){let t=`Restarting: ${n.reason}`;e.pendingShutdownMessage=t,e.lastError=t,e.lastErrorCode=null,ny(e,typeof n.restartExpectedMs==`number`&&Number.isFinite(n.restartExpectedMs)?Math.max(250,n.restartExpectedMs+250):1750)}return}if(t.event===`exec.approval.requested`){let n=qv(t.payload);if(n){e.execApprovalQueue=Zv(e.execApprovalQueue,n),e.execApprovalError=null;let t=Math.max(0,n.expiresAtMs-Date.now()+500);globalThis.setTimeout(()=>{e.execApprovalQueue=Qv(e.execApprovalQueue,n.id)},t)}return}if(t.event===`exec.approval.resolved`){let n=Jv(t.payload);n&&(e.execApprovalQueue=Qv(e.execApprovalQueue,n.id));return}if(t.event===`plugin.approval.requested`){let n=Yv(t.payload);if(n){e.execApprovalQueue=Zv(e.execApprovalQueue,n),e.execApprovalError=null;let t=Math.max(0,n.expiresAtMs-Date.now()+500);globalThis.setTimeout(()=>{e.execApprovalQueue=Qv(e.execApprovalQueue,n.id)},t)}return}if(t.event===`plugin.approval.resolved`){let n=Jv(t.payload);n&&(e.execApprovalQueue=Qv(e.execApprovalQueue,n.id))}}function dy(e,t){let n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&ay(e,n.sessionDefaults),e.federationManagedMode=n?.gatewayMode===`managed`}var fy=`/__fased/control-ui-config.json`;async function py(e){if(typeof window>`u`||typeof fetch!=`function`)return;let t=p(e.basePath??``),n=t?`${t}${fy}`:fy;try{let t=await fetch(n,{method:`GET`,headers:{Accept:`application/json`},credentials:`same-origin`});if(!t.ok)return;let r=await t.json();e.serverVersion=r.serverVersion?.trim()||null,e.serverVersion&&Rv(e.serverVersion)&&(e.uiRuntimeError=`Dashboard build ${Lv} does not match gateway ${e.serverVersion}. Run fased update, restart the gateway, and reload this page.`);let i=Uv({name:r.assistantName,avatar:r.assistantAvatar??null});e.assistantName=i.name,e.assistantAvatar=i.avatar}catch{}}function my(e){e.basePath=Fg(),e.authBootstrapPending=!0;let t=py(e);Bg(e,!0),Ig(e),Rg(e),window.addEventListener(`popstate`,e.popStateHandler),Promise.all([t,kg(e)]).then(()=>{e.authBootstrapPending=!1,e.settings.token.trim()&&!e.client&&oy(e)},()=>{e.authBootstrapPending=!1}),Lu(e),e.tab===`logs`&&zu(e),e.tab===`debug`&&Vu(e),(e.tab===`federation`||e.tab===`marketplace`)&&Uu(e),e.tab===`mining`&&Gu(e)}function hy(e){Hn(e)}function gy(e){window.removeEventListener(`popstate`,e.popStateHandler),Ru(e),Bu(e),Hu(e),Wu(e),Ku(e),e.client?.stop(),e.client=null,e.connected=!1,zg(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function _y(e,t){if(!(e.tab===`chat`&&e.chatManualRefreshInFlight)){if(e.tab===`chat`&&(t.has(`chatMessages`)||t.has(`chatToolMessages`)||t.has(`chatStream`)||t.has(`chatLoading`)||t.has(`tab`))){let n=t.has(`tab`),r=t.has(`chatLoading`)&&t.get(`chatLoading`)===!0&&!e.chatLoading;In(e,n||r||!e.chatHasAutoScrolled)}e.tab===`logs`&&(t.has(`logsEntries`)||t.has(`logsAutoFollow`)||t.has(`tab`))&&e.logsAutoFollow&&e.logsAtBottom&&Ln(e,t.has(`tab`)||t.has(`logsAutoFollow`))}}var vy=`Fased`,yy=`Fased Agent`;function by(e){if(Array.isArray(e))return e.map(e=>typeof e==`string`?e.trim():``).filter(Boolean).slice(0,1)}function xy(e,t){let n=t.trim();if(!n)return null;let r=e?.agents?.list,i=Array.isArray(r)?r.map(e=>e&&typeof e==`object`?{...e}:{}):r&&typeof r==`object`?Object.entries(r).map(([e,t])=>({...t&&typeof t==`object`?t:{},id:t&&typeof t==`object`&&`id`in t&&typeof t.id==`string`&&t.id.trim()?t.id:e})):[],a=i.findIndex(e=>e.id===n);return a>=0?{changed:!1,index:a,list:i}:(i.push({id:n}),{changed:!0,index:i.length-1,list:i})}var Sy=`Assistant`;function Cy(e){return e.split(/[-_]+/).filter(Boolean).map(e=>`${e.slice(0,1).toUpperCase()}${e.slice(1)}`).join(` `)}function wy(e){return(e??``).trim().toLowerCase()===`main`}function Ty(e){let t=e.id.trim(),n=t.toLowerCase(),r=e.identity?.name?.trim()||e.name?.trim()||``;return r&&r.toLowerCase()!==n?r:wy(t)?Sy:Cy(t)||t}function Ey(e){let t=e.id.trim(),n=Ty(e);return wy(t)?n:n&&n!==t?`${n} (${t})`:t}var Dy=new Set([`agent`,`channel`,`chat`,`provider`,`model`,`source`,`tool`,`label`,`key`,`session`,`id`,`has`,`mintokens`,`maxtokens`,`mincost`,`maxcost`,`minmessages`,`maxmessages`]),Oy=e=>e.trim().toLowerCase(),ky=e=>{let t=e.replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`.*`).replace(/\?/g,`.`);return RegExp(`^${t}$`,`i`)},Ay=e=>{let t=e.trim().toLowerCase();if(!t)return null;t.startsWith(`$`)&&(t=t.slice(1));let n=1;t.endsWith(`k`)?(n=1e3,t=t.slice(0,-1)):t.endsWith(`m`)&&(n=1e6,t=t.slice(0,-1));let r=Number(t);return Number.isFinite(r)?r*n:null},jy=e=>(e.match(/"[^"]+"|\S+/g)??[]).map(e=>{let t=e.replace(/^"|"$/g,``),n=t.indexOf(`:`);return n>0?{key:t.slice(0,n),value:t.slice(n+1),raw:t}:{value:t,raw:t}}),My=e=>[e.label,e.key,e.sessionId].filter(e=>!!e).map(e=>e.toLowerCase()),Ny=e=>{let t=new Set;e.modelProvider&&t.add(e.modelProvider.toLowerCase()),e.providerOverride&&t.add(e.providerOverride.toLowerCase()),e.origin?.provider&&t.add(e.origin.provider.toLowerCase());for(let n of e.usage?.modelUsage??[])n.provider&&t.add(n.provider.toLowerCase());return Array.from(t)},Py=e=>{let t=new Set;e.model&&t.add(e.model.toLowerCase());for(let n of e.usage?.modelUsage??[])n.model&&t.add(n.model.toLowerCase());return Array.from(t)},Fy=e=>(e.usage?.toolUsage?.tools??[]).map(e=>e.name.toLowerCase()),Iy=(e,t)=>{let n=Oy(t.value??``);if(!n)return!0;if(!t.key)return My(e).some(e=>e.includes(n));switch(Oy(t.key)){case`agent`:return e.agentId?.toLowerCase().includes(n)??!1;case`channel`:return e.channel?.toLowerCase().includes(n)??!1;case`chat`:return e.chatType?.toLowerCase().includes(n)??!1;case`provider`:return Ny(e).some(e=>e.includes(n));case`model`:return Py(e).some(e=>e.includes(n));case`source`:return e.source?.toLowerCase().includes(n)??!1;case`tool`:return Fy(e).some(e=>e.includes(n));case`label`:return e.label?.toLowerCase().includes(n)??!1;case`key`:case`session`:case`id`:if(n.includes(`*`)||n.includes(`?`)){let t=ky(n);return t.test(e.key)||(e.sessionId?t.test(e.sessionId):!1)}return e.key.toLowerCase().includes(n)||(e.sessionId?.toLowerCase().includes(n)??!1);case`has`:switch(n){case`tools`:return(e.usage?.toolUsage?.totalCalls??0)>0;case`errors`:return(e.usage?.messageCounts?.errors??0)>0;case`context`:return!!e.contextWeight;case`usage`:return!!e.usage;case`model`:return Py(e).length>0;case`provider`:return Ny(e).length>0;default:return!0}case`mintokens`:{let t=Ay(n);return t===null?!0:(e.usage?.totalTokens??0)>=t}case`maxtokens`:{let t=Ay(n);return t===null?!0:(e.usage?.totalTokens??0)<=t}case`mincost`:{let t=Ay(n);return t===null?!0:(e.usage?.totalCost??0)>=t}case`maxcost`:{let t=Ay(n);return t===null?!0:(e.usage?.totalCost??0)<=t}case`minmessages`:{let t=Ay(n);return t===null?!0:(e.usage?.messageCounts?.total??0)>=t}case`maxmessages`:{let t=Ay(n);return t===null?!0:(e.usage?.messageCounts?.total??0)<=t}default:return!0}},Ly=(e,t)=>{let n=jy(t);if(n.length===0)return{sessions:e,warnings:[]};let r=[];for(let e of n){if(!e.key)continue;let t=Oy(e.key);if(!Dy.has(t)){r.push(`Unknown filter: ${e.key}`);continue}if(e.value===``&&r.push(`Missing value for ${e.key}`),t===`has`){let t=new Set([`tools`,`errors`,`context`,`usage`,`model`,`provider`]);e.value&&!t.has(Oy(e.value))&&r.push(`Unknown has:${e.value}`)}[`mintokens`,`maxtokens`,`mincost`,`maxcost`,`minmessages`,`maxmessages`].includes(t)&&e.value&&Ay(e.value)===null&&r.push(`Invalid number for ${e.key}`)}return{sessions:e.filter(e=>n.every(t=>Iy(e,t))),warnings:r}};function Ry(e){let t=e.split(`
|
|
144
144
|
`),n=new Map,r=[];for(let e of t){let t=/^\[Tool:\s*([^\]]+)\]/.exec(e.trim());if(t){let e=t[1];n.set(e,(n.get(e)??0)+1);continue}e.trim().startsWith(`[Tool Result]`)||r.push(e)}let i=Array.from(n.entries()).toSorted((e,t)=>t[1]-e[1]),a=i.reduce((e,[,t])=>e+t,0);return{tools:i,summary:i.length>0?`Tools: ${i.map(([e,t])=>`${e}×${t}`).join(`, `)} (${a} calls)`:``,cleanContent:r.join(`
|
|
145
145
|
`).trim()}}function zy(e){return{byChannel:Array.from(e.byChannelMap.entries()).map(([e,t])=>({channel:e,totals:t})).toSorted((e,t)=>t.totals.totalCost-e.totals.totalCost),latency:e.latencyTotals.count>0?{count:e.latencyTotals.count,avgMs:e.latencyTotals.sum/e.latencyTotals.count,minMs:e.latencyTotals.min===1/0?0:e.latencyTotals.min,maxMs:e.latencyTotals.max,p95Ms:e.latencyTotals.p95Max}:void 0,dailyLatency:Array.from(e.dailyLatencyMap.values()).map(e=>({date:e.date,count:e.count,avgMs:e.count?e.sum/e.count:0,minMs:e.min===1/0?0:e.min,maxMs:e.max,p95Ms:e.p95Max})).toSorted((e,t)=>e.date.localeCompare(t.date)),modelDaily:Array.from(e.modelDailyMap.values()).toSorted((e,t)=>e.date.localeCompare(t.date)||t.cost-e.cost),daily:Array.from(e.dailyMap.values()).toSorted((e,t)=>e.date.localeCompare(t.date))}}var By=4;function Vy(e){return Math.round(e/By)}function W(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Hy(e){let t=new Date;return t.setHours(e,0,0,0),t.toLocaleTimeString(void 0,{hour:`numeric`})}function Uy(e,t){let n=Array.from({length:24},()=>0),r=Array.from({length:24},()=>0);for(let i of e){let e=i.usage;if(!e?.messageCounts||e.messageCounts.total===0)continue;let a=e.firstActivity??i.updatedAt,o=e.lastActivity??i.updatedAt;if(!a||!o)continue;let s=Math.min(a,o),c=Math.max(a,o),l=Math.max(c-s,1)/6e4,u=s;for(;u<c;){let i=new Date(u),a=Gy(i,t),o=qy(i,t),s=Math.min(o.getTime(),c),d=Math.max((s-u)/6e4,0)/l;n[a]+=e.messageCounts.errors*d,r[a]+=e.messageCounts.total*d,u=s+1}}return r.map((e,t)=>{let r=n[t];return{hour:t,rate:e>0?r/e:0,errors:r,msgs:e}}).filter(e=>e.msgs>0&&e.errors>0).toSorted((e,t)=>t.rate-e.rate).slice(0,5).map(e=>({label:Hy(e.hour),value:`${(e.rate*100).toFixed(2)}%`,sub:`${Math.round(e.errors)} errors · ${Math.round(e.msgs)} msgs`}))}var Wy=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function Gy(e,t){return t===`utc`?e.getUTCHours():e.getHours()}function Ky(e,t){return t===`utc`?e.getUTCDay():e.getDay()}function qy(e,t){let n=new Date(e);return t===`utc`?n.setUTCMinutes(59,59,999):n.setMinutes(59,59,999),n}function Jy(e,t){let n=Array.from({length:24},()=>0),r=Array.from({length:7},()=>0),i=0,a=!1;for(let o of e){let e=o.usage;if(!e||!e.totalTokens||e.totalTokens<=0)continue;i+=e.totalTokens;let s=e.firstActivity??o.updatedAt,c=e.lastActivity??o.updatedAt;if(!s||!c)continue;a=!0;let l=Math.min(s,c),u=Math.max(s,c),d=Math.max(u-l,1)/6e4,f=l;for(;f<u;){let i=new Date(f),a=Gy(i,t),o=Ky(i,t),s=qy(i,t),c=Math.min(s.getTime(),u),l=Math.max((c-f)/6e4,0)/d;n[a]+=e.totalTokens*l,r[o]+=e.totalTokens*l,f=c+1}}let o=Wy.map((e,t)=>({label:e,tokens:r[t]}));return{hasData:a,totalTokens:i,hourTotals:n,weekdayTotals:o}}function Yy(e,t,r,i){let a=Jy(e,t);if(!a.hasData)return n`
|
|
146
146
|
<div class="card usage-mosaic">
|
|
@@ -25461,4 +25461,4 @@ handoff: Record follow-up`,notifyPolicy:`done_only`},this.taskWorkflowGraphDraft
|
|
|
25461
25461
|
Payload:
|
|
25462
25462
|
{{payload}}`,deliver:!1,channel:`last`,notifyPolicy:`done_only`},this.webhookTriggersMessage=null,this.webhookTriggersError=null}editWebhookTrigger(e){this.webhookTriggerDraft=og(e),this.webhookTriggersMessage=null,this.webhookTriggersError=null}cancelWebhookTriggerEdit(){this.webhookTriggerDraft=null}patchWebhookTriggerDraft(e){this.webhookTriggerDraft={...this.webhookTriggerDraft??{name:``,path:``,action:`agent`},...e}}async saveWebhookTriggerDraft(){this.webhookTriggerDraft&&(await rg(this,this.webhookTriggerDraft),this.webhookTriggersError||(this.webhookTriggerDraft=null))}async removeWebhookTrigger(e){await ig(this,e)}async toggleWebhookTrigger(e,t){await rg(this,{...og(e),enabled:t})}async testWebhookTrigger(e){await ag(this,e)&&await this.loadTaskLedger({quiet:!0})}async handleFederationLoad(){await wa(this)}async handleFederationLoadLocalOffers(){await Da(this),await Oa(this),await ka(this),await Io(this)}async handleFederationLoadOffers(){await Mo(this),await Po(this)}async handleFederationLoadMarketplaceIndex(){await Po(this)}async handleFederationOpenMarketplaceSellerProfile(e){await Fo(this,e)}async handleFederationPreviewMarketplaceIndex(){await Io(this)}async handleFederationPublishMarketplaceIndex(){await Ro(this)}async handleFederationLoadOperatorEconomy(){await Ea(this)}handleFederationStartLocalOfferDraft(e){Aa(this,e)}handleFederationStartLocalRequestDraft(e){ja(this,e)}handleFederationCancelLocalOfferDraft(){Ma(this)}handleFederationApplyMarketplaceServiceKind(e){Hi(this,e)}async handleFederationSaveLocalOffer(){await Na(this)}async handleFederationToggleLocalOffer(e){await mo(this,e)}async handleFederationDeleteLocalOffer(e){await ho(this,e)}async handleFederationToggleLocalRequest(e){await Pa(this,e)}async handleFederationDeleteLocalRequest(e){await Fa(this,e)}async handleFederationCreateOrderFromSelectedOffer(){await ro(this)}async handleFederationCreateOrderFromMarketplaceIndexEntry(e){await io(this,e)}async handleFederationCreateOrderFromLocalRequest(e){await ao(this,e)}async handleFederationDeleteLocalOrder(e){await so(this,e)}async handleFederationLoadOfferReputation(){await Bo(this)}async handleFederationLoadOperatorDisputes(){await Yo(this)}async handleFederationLoadDisputeNotaryAttestations(){await Qo(this)}async handleFederationRegister(){await go(this)}async handleFederationAttest(){if(this.federationManagedMode){this.federationError=`Managed mode: manual federation attestation is disabled.`;return}await _o(this)}async handleFederationRenew(){await vo(this)}async handleFederationRevoke(){if(this.federationManagedMode){this.federationError=`Managed mode: manual federation revoke is disabled.`;return}await yo(this)}async handleFederationSetBondWallet(){await bo(this)}async handleFederationClearBondWallet(){await xo(this)}async handleFederationOpenBond(){await So(this)}async handleFederationIncreaseBond(){await Co(this)}async handleFederationRequestBondUnlock(){await wo(this)}async handleFederationCancelBondUnlock(){await To(this)}async handleFederationFinalizeBondUnlock(){await Eo(this)}async handleFederationSubmitBondProof(){await Do(this)}async handleFederationInitBondStaking(){await Oo(this)}async handleFederationSyncBondStaking(){await ko(this)}async handleFederationClaimBondStaking(){await Ao(this)}async handleFederationReview(e,t){await jo(this,{handle:e,status:t})}async handleFederationRunContentSummarize(){await Vo(this)}async handleFederationRunPaidContentSummarize(){await Ho(this)}async handleFederationRunPaidContentSummarizeOrder(e){await Uo(this,e)}async handleFederationPayMarketplaceManualOrder(e){await Wo(this,e)}async handleFederationDeliverMarketplaceManualOrder(e){await Ko(this,e)}async handleFederationRunMarketplaceCapabilityOrder(e){await Go(this,e)}async handleFederationSaveMarketplaceOrderDeliveryTarget(e){await Ja(this,e)}async handleFederationFundMarketplaceEscrowOrder(e){await lo(this,e)}async handleFederationReleaseMarketplaceEscrowOrder(e){await uo(this,e)}async handleFederationRefundMarketplaceEscrowOrder(e){await fo(this,e)}async handleFederationCancelMarketplaceEscrowOrder(e){await po(this,e)}handleFederationOpenMarketplaceIndexOrderFeedback(e,t){oo(this,e,t)}handleFederationSelectOffer(e){this.federationMarketplaceFeedbackOrderId=``,this.federationOfferFeedbackTab=`review`,zo(this,e)}handleFederationOfferFeedbackTabChange(e){this.federationOfferFeedbackTab=e}async handleFederationPublishReview(){await qo(this)}async handleFederationPublishDispute(){await Jo(this)}async handleFederationReviewDispute(){await Xo(this)}async handleFederationPublishDisputeNotaryAttestation(){await $o(this)}async handleWalletLoad(){await tg(this),await Be(this),this.syncWalletPolicyDraftsFromSettings(),this.focusWalletSecuritySetupIfNeeded()}handleWalletMainPanelChange(e){if(this.walletMainPanel=e,typeof window>`u`||this.tab!==`wallet`)return;let t=new URL(window.location.href);t.hash=e===`skill-grants`?`wallet-skill-grants`:e===`access`?`wallet-access`:``,window.history.replaceState({},``,t.toString())}handleWalletSkillGrantDraftPatch(e){qe(this,e)}handleWalletSkillGrantActionToggle(e,t){Ve(this,e,t)}handleWalletSkillGrantSelect(e){this.walletSkillGrantDraft=ze(e),this.walletSkillGrantsError=null,this.walletSkillGrantsMessage=null}async handleWalletSkillGrantSave(){await We(this)}async handleWalletSkillGrantClear(e){await Ue(this,e)}currentWalletPolicyRole(){let e=this.walletDetailsWalletId.trim()||this.walletSendCreateForm.walletId?.trim()||void 0,t=e?this.walletNamedWallets.find(t=>t.id===e):void 0,n=(typeof t?.metadata?.purpose==`string`?t.metadata.purpose:typeof t?.metadata?.role==`string`?t.metadata.role:``).toLowerCase();return n===`mining`?`mining`:n===`agent`?`agent`:n===`vault`?`vault`:e&&e===String(this.walletDefaultWalletId??``).trim()?`agent`:`vault`}resolveRecurringTransferDecimals(e){let t=e.trim();if(!t)return 9;let n=(this.walletBalances?.assets?.solana??[]).find(e=>e.program===t);if(n&&Number.isFinite(n.decimals))return n.decimals;let r=this.walletPolicySolanaTokenCaps[t]?.decimals;return typeof r==`number`&&r>=0?r:-1}formatRecurringTransferAmount(e,t){return Je(e,t)}normalizeRecurringTransferAmount(e,t){let n=e.trim();return n?Ye(n,t):void 0}focusWalletSecuritySetupIfNeeded(){let e=this.walletSecuritySetupWalletId.trim(),t=this.walletSecuritySetupRole;if(this.tab!==`wallet`||!e||t!==`agent`&&t!==`vault`)return;this.walletDetailsWalletId!==e&&(this.walletDetailsWalletId=e),this.walletExpandedPanelWalletId=e,this.walletExpandedPanel=`security`,this.walletBalanceWalletId=``;let n=`${e}:${t}`;this.walletSecuritySetupScrollKey!==n&&(this.walletSecuritySetupScrollKey=n,this.updateComplete.then(()=>{let e=()=>{this.renderRoot.querySelector(`#wallet-security-card`)?.scrollIntoView({behavior:`smooth`,block:`start`})};typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(e,0)}))}syncWalletPolicyDraftsFromSettings(){if(!this.walletSettings)return;this.walletPolicyCapsEnabled=this.walletSettings.policy.capsEnabled===!0,this.walletPolicyAutoEnabled=this.walletSettings.policy.directSigning,this.walletPolicySkillsEnabled=this.walletSettings.policy.skillsEnabled===!0,this.walletPolicySolMaxPerTx=eX(this.walletSettings.policy.solana.maxPerTx),this.walletPolicySolMaxDaily=eX(this.walletSettings.policy.solana.maxDaily),this.walletPolicySolanaAllowPrograms=He(this.walletSettings.policy.solana.allowPrograms),this.walletPolicySolanaTokenCaps=Object.fromEntries(Object.entries(this.walletSettings.policy.solana.tokenCaps??{}).map(([e,t])=>[e,{maxPerTx:t.maxPerTx,maxDaily:t.maxDaily,decimals:-1}]));let e=this.walletSettings.policy.recurringTransfer,t=e?.program??``,n=this.resolveRecurringTransferDecimals(t);this.walletRecurringTransferEnabled=e?.enabled===!0,this.walletRecurringTransferDestination=e?.to??``,this.walletRecurringTransferMint=t,this.walletRecurringTransferAmountMode=e?.amountMode??`fixed`,this.walletRecurringTransferAmount=this.formatRecurringTransferAmount(e?.amount,n),this.walletRecurringTransferPercentage=String(e?.percentage??100),this.walletRecurringTransferMinAmount=this.formatRecurringTransferAmount(e?.minAmount,n),this.walletRecurringTransferKeepAmount=this.formatRecurringTransferAmount(e?.keepAmount,n),this.walletRecurringTransferDecimals=n>=0?String(n):t?``:`9`,this.walletRecurringTransferCron=typeof e?.schedule?.expr==`string`?e.schedule.expr:`0 9 * * *`,this.walletRecurringTransferTz=typeof e?.schedule?.tz==`string`?e.schedule.tz:``,this.walletRecurringTransferName=e?.name??``}gatewayRestartExpected(){return!this.connected&&typeof this.lastError==`string`&&this.lastError.startsWith(`Restarting:`)}walletReloadHitTransientRestartError(){let e=[this.walletError,this.walletSettingsError,this.walletApprovalsError,this.walletAuditError,this.walletBalancesError].filter(e=>typeof e==`string`&&e.trim().length>0).join(`
|
|
25463
25463
|
`);return/Request failed \(502\)|Failed to fetch|fetch failed/i.test(e)}clearTransientWalletReloadErrors(){let e=e=>typeof e==`string`&&/Request failed \(502\)|Failed to fetch|fetch failed/i.test(e)?null:e;this.walletError=e(this.walletError),this.walletSettingsError=e(this.walletSettingsError),this.walletApprovalsError=e(this.walletApprovalsError),this.walletAuditError=e(this.walletAuditError),this.walletBalancesError=e(this.walletBalancesError)}scheduleWalletReloadAfterSettingsSave(e=0){this.walletReloadAfterSettingsTimer!=null&&(window.clearTimeout(this.walletReloadAfterSettingsTimer),this.walletReloadAfterSettingsTimer=null);let t=e===0?2200:1400;this.walletReloadAfterSettingsTimer=window.setTimeout(()=>{if(this.walletReloadAfterSettingsTimer=null,this.gatewayRestartExpected()){e<5&&this.scheduleWalletReloadAfterSettingsSave(e+1);return}this.handleWalletLoad().then(()=>{this.walletReloadHitTransientRestartError()&&(this.clearTransientWalletReloadErrors(),e<5&&this.scheduleWalletReloadAfterSettingsSave(e+1))})},t)}async handleMiningLoad(e){await au(this,e)}async handleMiningSave(){if(!this.miningProfile)return;let e=this.normalizeMiningCommitTarget(String(this.miningProfile.funding.commitLamports??`250000000`),{enforceSafeMax:!1});if(e.kind===`blocked`){this.miningError=e.message,this.miningMessage=null,this.enqueueMiningNotification(`warning`,e.message);return}let t=e.kind===`clamped`?{...this.miningProfile,funding:{...this.miningProfile.funding,commitLamports:e.commitLamports}}:this.miningProfile;e.kind===`clamped`&&(this.miningProfile=t,this.miningMessage=e.message,this.miningError=null,this.enqueueMiningNotification(`warning`,e.message)),await fu(this,t)}handleMiningSaveLocalProfile(){pu(this)}handleMiningLoadSavedProfile(){mu(this)}handleMiningDeleteSavedProfile(){hu(this)}async handleMiningStart(){this.miningPendingAction=`starting`;try{await gu(this)}finally{this.miningPendingAction=null}}async handleMiningStop(){this.miningPendingAction=`stopping`;try{await xu(this)}finally{this.miningPendingAction=null}}async handleMiningMainnetSync(){await ou(this)}handleMiningCapitalDepositDraftChange(e){this.miningCapitalDepositDraft=e}handleMiningCapitalWithdrawDraftChange(e){this.miningCapitalWithdrawDraft=e}async handleMiningTopUpReserve(){try{let e=await this.resolveWalletApprovalToken({operation:`mining.capital`});await _u(this,e)}catch(e){this.miningError=`Failed to authorize mining buffer top-up: ${String(e)}`,this.enqueueMiningNotification(`error`,this.miningError)}}async handleMiningDepositCapital(){this.miningActionBusy=!0,this.miningCapitalActionBusy=`deposit`,this.miningError=null;try{let e=await this.resolveWalletApprovalToken({operation:`mining.capital`});await vu(this,Ke(this.miningCapitalDepositDraft,`solana`),e)}catch(e){this.miningError=`Failed to authorize mining fund action: ${String(e)}`,this.enqueueMiningNotification(`error`,this.miningError)}finally{this.miningActionBusy=!1,this.miningCapitalActionBusy=null}}async handleMiningWithdrawCapital(){this.miningActionBusy=!0,this.miningCapitalActionBusy=`withdraw`,this.miningError=null;try{let e=await this.resolveWalletApprovalToken({operation:`mining.capital`});await yu(this,Ke(this.miningCapitalWithdrawDraft,`solana`),e)}catch(e){this.miningError=`Failed to authorize mining withdraw action: ${String(e)}`,this.enqueueMiningNotification(`error`,this.miningError)}finally{this.miningActionBusy=!1,this.miningCapitalActionBusy=null}}async handleMiningSetActiveCommit(){let e=String(this.miningProfile?.funding.commitLamports??`250000000`),t=this.normalizeMiningCommitTarget(e,{enforceSafeMax:!0});if(t.kind===`blocked`){this.miningError=t.message,this.miningMessage=null,this.enqueueMiningNotification(`warning`,t.message);return}t.kind===`clamped`&&(this.miningMessage=t.message,this.enqueueMiningNotification(`warning`,t.message)),this.miningActionBusy=!0,this.miningError=null;try{let e=await this.resolveWalletApprovalToken({operation:`mining.capital`});await bu(this,t.commitLamports,e)}catch(e){this.miningError=`Failed to authorize mining commit action: ${String(e)}`,this.enqueueMiningNotification(`error`,this.miningError)}finally{this.miningActionBusy=!1}}async handleMiningUpdateCommit(e){let t=this.normalizeMiningCommitTarget(String(e||`250000000`),{enforceSafeMax:!1}),n=this.miningProfile??ve(),r={...n,funding:{...n.funding,commitLamports:t.commitLamports}};this.miningProfile=r,await fu(this,r),!this.miningError?.startsWith(`Mining profile save failed`)&&await this.handleMiningSetActiveCommit()}miningCommitInputLabel(){return(this.miningProfile?.strategyExecution??ie(this.miningProfile?.strategyMode))===`auto`?`target max`:`target`}normalizeMiningCommitTarget(e,t){let n=String(this.miningProfile?.walletId??this.miningStatus?.walletId??this.miningReadiness?.selectedWalletId??``).trim(),r=this.miningWallets.find(e=>e.walletId===n),i=ge({requestedCommitLamports:e,walletLamports:this.miningReadiness?.balances.solBalanceLamports??r?.solBalanceLamports??this.miningStatus?.currentSolBalanceLamports??`0`,capitalFundedLamports:this.miningStatus?.currentCapitalFundedLamports??`0`,capitalFreeLamports:this.miningStatus?.currentCapitalFreeLamports??`0`,capitalLockedLamports:this.miningStatus?.currentCapitalLockedLamports??`0`,pendingCycleCount:this.miningStatus?.currentCapitalPendingCycleCount,signerReserveLamports:this.miningStatus?.signerReserveLamports,signerFeeBufferLamports:this.miningStatus?.signerFeeBufferLamports,enforceSafeMax:t?.enforceSafeMax}),a=this.miningCommitInputLabel();return i.kind===`blocked`?{...i,message:`Cannot apply ${a} yet. Need ${tX(i.minimumCapitalForMinimumCommitLamports)} SOL free for the minimum 0.25 SOL commit.`}:i.kind===`clamped`?{...i,message:`Using safe commit: ${tX(i.commitLamports)} SOL.`}:{...i,message:null}}async persistMiningProfileUpdate(e){let t=e(this.miningProfile??ve());this.miningProfile=t,await fu(this,t)}handleMiningSelectedSavedProfileChange(e){this.miningSelectedSavedProfileId=e}handleMiningSaveProfileNameChange(e){this.miningSaveProfileName=e}handleMiningStrategyPresetChange(e){this.persistMiningProfileUpdate(t=>({...t,strategyPreset:e,riskMode:A(e)}))}handleMiningStrategyExecutionChange(e){this.persistMiningProfileUpdate(t=>({...t,strategyExecution:e,strategyMode:ae(e),skillConfig:{useAgentDefaultModel:!0,fallbackToBaseOnFailure:!0,...t.skillConfig,enabled:e===`auto`}}))}handleMiningCycleCadenceChange(e){this.persistMiningProfileUpdate(t=>({...t,cycleCadence:e}))}handleMiningStrategyModeChange(e){this.persistMiningProfileUpdate(t=>({...t,strategyExecution:ie(e),strategyMode:e,skillConfig:{useAgentDefaultModel:!0,fallbackToBaseOnFailure:!0,...t.skillConfig,enabled:e===`skill`}}))}handleMiningSkillConfigChange(e){this.persistMiningProfileUpdate(t=>({...t,skillConfig:{enabled:t.skillConfig?.enabled??!1,useAgentDefaultModel:!0,fallbackToBaseOnFailure:!0,...t.skillConfig,...e}}))}handleMiningRiskModeChange(e){this.persistMiningProfileUpdate(t=>({...t,riskMode:e,strategyPreset:Ce(e)}))}handleMiningCommitLamportsChange(e){let t=this.normalizeMiningCommitTarget(String(e||`250000000`),{enforceSafeMax:!1});if(t.kind===`blocked`){this.miningError=t.message,this.miningMessage=null,this.enqueueMiningNotification(`warning`,t.message);return}t.kind===`clamped`?(this.miningMessage=t.message,this.miningError=null,this.enqueueMiningNotification(`warning`,t.message)):this.miningError=null,this.persistMiningProfileUpdate(e=>({...e,funding:{...e.funding,commitLamports:t.commitLamports}}))}handleMiningReserveLamportsChange(e){this.persistMiningProfileUpdate(t=>({...t,funding:{...t.funding,minSolBalanceLamports:String(e||`150000000`)}}))}handleMiningPayoutChange(e){this.persistMiningProfileUpdate(t=>({...t,payout:e}))}handleMiningAutomationChange(e){this.persistMiningProfileUpdate(t=>({...t,automation:{...t.automation,...e}}))}handleMiningSatSweepChange(e){this.persistMiningProfileUpdate(t=>({...t,automation:{...t.automation,satSweep:{enabled:!1,mode:`all`,percentage:100,minRaw:`1`,keepRaw:`0`,...t.automation.satSweep,...e}}}))}handleMiningRecentActionsPageChange(e){this.miningRecentActionsPage=Math.max(1,e)}handleMiningActivityFilterChange(e){this.miningActivityFilter!==e&&(this.miningActivityFilter=e,this.miningRecentActionsPage=1)}handleMiningActivityWindowChange(e){this.miningActivityWindow!==e&&(this.miningActivityWindow=e,this.miningRecentActionsPage=1,iu(this,{window:this.miningPlannerWindow,activityWindow:e}))}handleMiningOpenHistoryModal(){this.miningHistoryModalOpen=!0}handleMiningCloseHistoryModal(){this.miningHistoryModalOpen=!1}handleMiningPlannerWindowChange(e){this.miningPlannerWindow!==e&&(this.miningPlannerWindow=e,iu(this,{window:e,activityWindow:this.miningActivityWindow}))}handleMiningRecoveryDisputeAuthorityChange(e){this.miningRecoveryDisputeAuthority=e,Eu(this)}handleMiningRecoveryTargetAuthorityChange(e){this.miningRecoveryTargetAuthority=e,Eu(this)}handleMiningRecoveryEpochIdChange(e){this.miningRecoveryEpochId=e,Eu(this)}handleMiningRecoveryMicroRoundIdChange(e){this.miningRecoveryMicroRoundId=e,Eu(this)}handleMiningRecoveryStatusFlagChange(e){this.miningRecoveryStatusFlag=e,Eu(this)}handleMiningRecoveryBoardRootChange(e){this.miningRecoveryBoardRoot=e,Eu(this)}handleMiningRecoveryScoreRootChange(e){this.miningRecoveryScoreRoot=e,Eu(this)}handleMiningRecoveryCoordinationRootChange(e){this.miningRecoveryCoordinationRoot=e,Eu(this)}async handleMiningRetryClaim(){let e=Number(this.miningRecovery?.epochId??this.miningStatus?.currentEpochId??0);if(!e){this.miningError=`Missing epoch id for retry claim.`;return}await Su(this,e)}async handleMiningResolveDispute(){await Cu(this)}async handleMiningRepublishRoots(){await wu(this)}async handleMiningClearHistory(){this.miningConfirmClearHistory=!1,await Tu(this)}handleMiningConfirmClearHistory(){this.miningConfirmClearHistory=!0}handleMiningCancelClearHistory(){this.miningConfirmClearHistory=!1}handleMiningResetRecoveryDraft(){Du(this)}handleMiningResetToSelectedCandidate(){Ou(this)}handleMiningExportSupportBundle(){ku(this)}enqueueMiningNotification(e,t){let n=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,r={id:n,level:e,message:t,createdAt:new Date().toISOString()};this.miningNotifications=[r,...this.miningNotifications].slice(0,5);let i=window.setTimeout(()=>{this.dismissMiningNotification(n)},8e3);this.miningNotificationTimers.set(n,i)}dismissMiningNotification(e){let t=this.miningNotificationTimers.get(e);t!=null&&(window.clearTimeout(t),this.miningNotificationTimers.delete(e)),this.miningNotifications=this.miningNotifications.filter(t=>t.id!==e)}enqueueAppNotification(e){let t=e.dedupeKey??`${e.code}:${e.message}`,n=Math.max(0,Number(e.cooldownMs??0)),r=Date.now();if(n>0){if(r-(this.notificationCooldowns.get(t)??0)<n)return;this.notificationCooldowns.set(t,r)}let i=this.settings.notificationRouteMode,a=this.settings.notificationRouteChannel.trim(),o=this.settings.notificationRouteAccountId.trim(),s=this.settings.notificationRouteTo.trim()||hl(this.channelsSnapshot,a,o,this.configForm),c=ol(this.settings.notificationEventPrefs,e.code),l=`ui-only`,u=null;i===`channel`&&(c?!a||!o||!s?(l=`disabled`,u=`Notification route is incomplete.`):l=`pending`:(l=`disabled`,u=`External routing disabled for this event type.`));let d={id:Kn(),code:e.code,category:e.category,level:e.level,title:e.title,message:e.message,createdAt:new Date(r).toISOString(),routeStatus:l,routeChannel:a||null,routeAccountId:o||null,routeTo:s||null,routeError:u,routedAt:null};this.notifications=[d,...this.notifications].slice(0,120),l===`pending`&&this.routeAppNotification(d)}dismissAppNotification(e){this.notifications=this.notifications.filter(t=>t.id!==e)}applyNotificationRouteDefaultsFromChannels(){let e=this.channelsSnapshot;if(!e)return;let t=gl(e,this.configForm);if(!t.notificationRouteChannel&&!t.notificationRouteAccountId&&!t.notificationRouteTo)return;let n={...this.settings},r=!1;!n.notificationRouteChannel.trim()&&t.notificationRouteChannel&&(n.notificationRouteChannel=t.notificationRouteChannel,r=!0),!n.notificationRouteAccountId.trim()&&t.notificationRouteAccountId&&(n.notificationRouteAccountId=t.notificationRouteAccountId,r=!0),!n.notificationRouteTo.trim()&&t.notificationRouteTo&&(n.notificationRouteTo=t.notificationRouteTo,r=!0),r&&this.applySettings(n)}updateAppNotification(e,t){this.notifications=this.notifications.map(n=>n.id===e?{...n,...t}:n)}async routeAppNotification(e){let t=e.routeChannel?.trim()??``,n=e.routeAccountId?.trim()??``,r=e.routeTo?.trim()??``,i=new Date().toISOString();if(!this.client||!this.connected){this.updateAppNotification(e.id,{routeStatus:`failed`,routeError:`Gateway is offline.`,routedAt:i});return}try{await this.client.request(`send`,{channel:t,accountId:n,to:r,message:vl(e),idempotencyKey:`notification:${e.id}`}),this.updateAppNotification(e.id,{routeStatus:`sent`,routeError:null,routedAt:i})}catch(t){this.updateAppNotification(e.id,{routeStatus:`failed`,routeError:t instanceof Error?t.message:String(t),routedAt:i})}}async handleWalletRefreshSignerDoctor(){try{let e=await Ur();if(!this.walletStatus)return;this.walletStatus={...this.walletStatus,signerDaemon:e.report,chainWallets:e.chainWallets}}catch(e){this.walletError=`Signer doctor refresh failed: ${String(e)}`}}async handleWalletPatchSettings(e,t){if(!this.walletSettingsBusy){this.walletSettingsBusy=!0,this.walletSettingsError=null,this.walletSettingsMessage=null;try{let n=this.walletDetailsWalletId.trim()||this.walletSendCreateForm.walletId?.trim()||void 0,r={...e,...e.walletId===void 0&&n?{walletId:n}:{}},i=r.policyTemplate!==void 0||r.approvalAuthMode!==void 0||r.approvalChallengeTtlSeconds!==void 0||r.approvalGrantTtlSeconds!==void 0||r.capsEnabled!==void 0||r.directSigning!==void 0||r.skillsEnabled!==void 0||r.solanaAllowPrograms!==void 0||r.solanaMaxPerTx!==void 0||r.solanaMaxDaily!==void 0||r.solanaTokenCaps!==void 0||r.recurringTransfer!==void 0||r.toolAccessMode!==void 0||r.toolAccessAllowAgents!==void 0;i&&this.walletSettings?.signerPolicy&&(this.walletSettingsMessage=`Signer policy update pending; settings remain unchanged until the signer acknowledges the exact next version and hash.`);let a=null;a=t?.requireExecutionApproval?await this.resolveWalletApprovalToken({operation:`wallet.execution-mode`}):await this.resolveWalletApprovalToken({operation:i?`wallet.policy`:`wallet.settings`});let o=await Yr(r,a??void 0);this.walletSettings=o.settings;let s=o.settings.signerPolicy;this.walletSettingsMessage=i&&s?.version&&s.hash?`Signer policy ${s.state}: version ${s.version}, hash ${s.hash}. Wallet settings were saved after this acknowledgement.`:`Wallet settings updated.`,this.syncWalletPolicyDraftsFromSettings(),this.scheduleWalletReloadAfterSettingsSave()}catch(e){this.walletSettingsMessage=null,this.walletSettingsError=`Wallet settings update failed: ${String(e)}`}finally{this.walletSettingsBusy=!1}}}handleWalletPolicyDraftChange(e){if(e.capsEnabled!==void 0&&(this.walletPolicyCapsEnabled=e.capsEnabled),e.directSigning!==void 0&&(this.walletPolicyAutoEnabled=e.directSigning),e.skillsEnabled!==void 0&&(this.walletPolicySkillsEnabled=e.skillsEnabled),e.solMaxPerTx!==void 0&&(this.walletPolicySolMaxPerTx=e.solMaxPerTx),e.solMaxDaily!==void 0&&(this.walletPolicySolMaxDaily=e.solMaxDaily),e.solanaAllowPrograms!==void 0&&(this.walletPolicySolanaAllowPrograms=e.solanaAllowPrograms),e.solanaTokenCaps!==void 0&&(this.walletPolicySolanaTokenCaps=e.solanaTokenCaps),e.tokenCapMint!==void 0&&(this.walletPolicyTokenCapMint=e.tokenCapMint),e.tokenCapDecimals!==void 0&&(this.walletPolicyTokenCapDecimals=e.tokenCapDecimals),e.tokenCapMaxPerTx!==void 0&&(this.walletPolicyTokenCapMaxPerTx=e.tokenCapMaxPerTx),e.tokenCapMaxDaily!==void 0&&(this.walletPolicyTokenCapMaxDaily=e.tokenCapMaxDaily),e.recurringTransferEnabled!==void 0&&(this.walletRecurringTransferEnabled=e.recurringTransferEnabled),e.recurringTransferDestination!==void 0&&(this.walletRecurringTransferDestination=e.recurringTransferDestination),e.recurringTransferMint!==void 0){this.walletRecurringTransferMint=e.recurringTransferMint;let t=this.resolveRecurringTransferDecimals(e.recurringTransferMint);this.walletRecurringTransferDecimals=t>=0?String(t):e.recurringTransferMint.trim()?``:`9`}e.recurringTransferAmountMode!==void 0&&(this.walletRecurringTransferAmountMode=e.recurringTransferAmountMode),e.recurringTransferAmount!==void 0&&(this.walletRecurringTransferAmount=e.recurringTransferAmount),e.recurringTransferPercentage!==void 0&&(this.walletRecurringTransferPercentage=e.recurringTransferPercentage),e.recurringTransferMinAmount!==void 0&&(this.walletRecurringTransferMinAmount=e.recurringTransferMinAmount),e.recurringTransferKeepAmount!==void 0&&(this.walletRecurringTransferKeepAmount=e.recurringTransferKeepAmount),e.recurringTransferDecimals!==void 0&&(this.walletRecurringTransferDecimals=e.recurringTransferDecimals),e.recurringTransferCron!==void 0&&(this.walletRecurringTransferCron=e.recurringTransferCron),e.recurringTransferTz!==void 0&&(this.walletRecurringTransferTz=e.recurringTransferTz),e.recurringTransferName!==void 0&&(this.walletRecurringTransferName=e.recurringTransferName)}handleWalletTokenSearchQueryChange(e){this.walletPolicyTokenSearchQuery=e,this.walletPolicyTokenSearchError=null}async handleWalletTokenSearch(){let e=this.walletPolicyTokenSearchQuery.trim();if(!(!e||this.walletPolicyTokenSearchLoading)){this.walletPolicyTokenSearchLoading=!0,this.walletPolicyTokenSearchError=null;try{let t=await Gr({query:e,walletId:this.walletDetailsWalletId||this.walletDefaultWalletId||void 0});this.walletPolicyTokenSearchResults=t.tokens,t.tokens.length===0&&(this.walletPolicyTokenSearchError=`No token matches. Paste the exact mint instead.`)}catch(e){this.walletPolicyTokenSearchError=e instanceof Error?e.message:`Token search failed`}finally{this.walletPolicyTokenSearchLoading=!1}}}handleWalletTokenSearchSelect(e){this.walletPolicyTokenCapMint=e.mint,this.walletPolicyTokenCapDecimals=String(e.decimals),this.walletPolicyTokenSearchQuery=e.symbol||e.name||e.mint,this.walletPolicyTokenSearchError=null}async handleWalletSavePolicy(){let e=this.walletRecurringTransferMint.trim(),t=e?Number.parseInt(this.walletRecurringTransferDecimals.trim(),10):9;if(this.currentWalletPolicyRole()===`agent`&&e&&(!Number.isInteger(t)||t<0||t>18)){this.walletSettingsError=`Set token decimals between 0 and 18 before saving a token schedule.`;return}await this.handleWalletPatchSettings(Ge({capsEnabled:this.walletPolicyCapsEnabled,directSigning:this.currentWalletPolicyRole()===`agent`?this.walletPolicyAutoEnabled:!1,skillsEnabled:this.currentWalletPolicyRole()===`agent`?this.walletPolicySkillsEnabled:!1,solanaMaxPerTx:this.walletPolicySolMaxPerTx,solanaMaxDaily:this.walletPolicySolMaxDaily,solanaAllowPrograms:this.walletPolicySolanaAllowPrograms,solanaTokenCaps:this.walletPolicySolanaTokenCaps,recurringTransfer:this.currentWalletPolicyRole()===`agent`?{enabled:this.walletRecurringTransferEnabled,to:this.walletRecurringTransferDestination,program:e,amountMode:this.walletRecurringTransferAmountMode,amount:this.walletRecurringTransferAmountMode===`fixed`?this.normalizeRecurringTransferAmount(this.walletRecurringTransferAmount,t):void 0,percentage:Number.parseInt(this.walletRecurringTransferPercentage||`100`,10),minAmount:this.normalizeRecurringTransferAmount(this.walletRecurringTransferMinAmount,t),keepAmount:this.normalizeRecurringTransferAmount(this.walletRecurringTransferKeepAmount,t),cron:this.walletRecurringTransferCron,tz:this.walletRecurringTransferTz,name:this.walletRecurringTransferName}:void 0}))}async handleWalletValidateSettings(){if(!this.walletSettingsBusy){this.walletSettingsBusy=!0,this.walletSettingsError=null,this.walletSettingsMessage=null;try{let e=await ii({providerId:this.walletProviderTab});this.walletSettingsValidation=e,this.walletSettingsMessage=e.valid?`Wallet settings validation passed.`:`Wallet settings validation reported issues.`}catch(e){this.walletSettingsError=`Wallet validation failed: ${String(e)}`}finally{this.walletSettingsBusy=!1}}}async handleWalletSaveRpcSecret(){this.walletSettingsError=`RPC settings are signer/provider-owned and are not accepted by the Gateway UI.`}async handleWalletSaveProviderCredentials(){if(this.walletSettingsBusy)return;if(!this.walletSettings){this.walletSettingsError=`Wallet settings are not loaded.`;return}let e=this.walletProviderTab;if(e!==`alchemy`){let t=this.walletProviderCredentialsJson.trim(),n={};try{n=t?JSON.parse(t):{}}catch{this.walletSettingsError=`Provider credentials JSON is invalid.`;return}let r={};for(let[e,t]of Object.entries(n)){if(typeof t!=`string`)continue;let n=e.trim(),i=t.trim();!n||!i||(r[n]=i)}if(Object.keys(r).length===0){this.walletSettingsError=`Provider credentials JSON must include at least one non-empty string field.`;return}this.walletSettingsBusy=!0,this.walletSettingsError=null,this.walletSettingsMessage=null;try{let t=await this.resolveWalletApprovalToken({operation:`wallet.provider-credentials`});await Xr({providerId:e,credentials:r},t??void 0),this.walletSettingsMessage=`Provider credentials saved.`,await this.handleWalletLoad()}catch(e){this.walletSettingsError=`Saving provider credentials failed: ${String(e)}`}finally{this.walletSettingsBusy=!1}return}let t=this.walletProviderApiKey.trim(),n=this.walletProviderServerSignerAccessKey.trim();if(!t||!n){this.walletSettingsError=`Alchemy API key and Server Signer Access Key are required.`;return}this.walletSettingsBusy=!0,this.walletSettingsError=null,this.walletSettingsMessage=null;try{let r=await this.resolveWalletApprovalToken({operation:`wallet.provider-credentials`});await Xr({providerId:e,apiKey:t,serverSignerAccessKey:n,serverSignerAccountId:this.walletProviderServerSignerAccountId.trim()||void 0,walletApiBaseUrl:this.walletProviderWalletApiBaseUrl.trim()||void 0,signerApiBaseUrl:this.walletProviderSignerApiBaseUrl.trim()||void 0,defaultSolanaAddress:this.walletProviderDefaultSolanaAddress.trim()||void 0},r??void 0),this.walletProviderApiKey=``,this.walletProviderServerSignerAccessKey=``,this.walletSettingsMessage=`Provider credentials saved.`,await this.handleWalletLoad()}catch(e){this.walletSettingsError=`Saving provider credentials failed: ${String(e)}`}finally{this.walletSettingsBusy=!1}}async handleWalletDeleteProviderCredentials(){if(!this.walletSettingsBusy){this.walletSettingsBusy=!0,this.walletSettingsError=null,this.walletSettingsMessage=null;try{let e=await this.resolveWalletApprovalToken({operation:`wallet.provider-credentials`});await Zr(this.walletProviderTab,e??void 0),this.walletSettingsMessage=`Provider credentials removed.`,await this.handleWalletLoad()}catch(e){this.walletSettingsError=`Removing provider credentials failed: ${String(e)}`}finally{this.walletSettingsBusy=!1}}}async handleWalletDeleteRpcSecret(){this.walletSettingsError=`RPC settings are signer/provider-owned and are not stored by the Gateway UI.`}async handleWalletSelectProvider(e){if(!this.walletSettingsBusy){this.walletSettingsBusy=!0,this.walletSettingsError=null,this.walletSettingsMessage=null;try{await Qr({providerId:e,enabled:!0,setDefault:!0}),this.walletProviderSelection=e,this.walletProviderTab=e;let t=this.walletNamedWallets.filter(t=>t.providerId===e);this.walletDetailsWalletId=t[0]?.id??``,this.walletCreateProvider=e,this.walletSettingsMessage=`Default wallet provider set to ${e}.`,await this.handleWalletLoad()}catch(e){this.walletSettingsError=`Selecting wallet provider failed: ${String(e)}`}finally{this.walletSettingsBusy=!1}}}async handleWalletProviderTabChange(e){this.walletProviderTab=e,this.walletCreateProvider=e;let t=this.walletNamedWallets.filter(t=>t.providerId===e);t.some(e=>e.id===this.walletDetailsWalletId)||(this.walletDetailsWalletId=t[0]?.id??``),t.some(e=>e.id===this.walletBalanceWalletId)||(this.walletBalanceWalletId=``),t.some(e=>e.id===this.walletExpandedPanelWalletId)||(this.walletExpandedPanelWalletId=``,this.walletExpandedPanel=``),await this.handleWalletLoad()}async handleWalletDetailsWalletChange(e){this.walletDetailsWalletId=e.trim(),await this.handleWalletLoad()}async handleWalletBalanceWalletChange(e){let t=e.trim();if(t){if(this.walletExpandedPanelWalletId===t&&this.walletExpandedPanel===`balance`){this.walletExpandedPanelWalletId=``,this.walletExpandedPanel=``,this.walletBalanceWalletId=``;return}this.walletExpandedPanelWalletId=t,this.walletExpandedPanel=`balance`,this.walletBalanceWalletId=t,await this.handleWalletLoad()}}handleWalletPolicyPanelChange(e){this.walletPolicyPanel=e}async handleWalletSetProviderEnabled(e,t){if(!this.walletSettingsBusy){this.walletSettingsBusy=!0,this.walletSettingsError=null,this.walletSettingsMessage=null;try{await Qr({providerId:e,enabled:t}),this.walletSettingsMessage=`${e} ${t?`enabled`:`disabled`}.`,await this.handleWalletLoad()}catch(e){this.walletSettingsError=`Updating provider state failed: ${String(e)}`}finally{this.walletSettingsBusy=!1}}}async handleWalletCreateNamedWallet(){if(this.walletSettingsBusy)return;let e=this.walletCreateName.trim();if(!e){this.walletSettingsError=`Wallet name is required.`;return}this.walletSettingsBusy=!0,this.walletSettingsError=null,this.walletSettingsMessage=null;try{let t=this.walletCreateProvider||this.walletProviderTab;if(t===`wallet-standard`)throw Error(`Use Attach Wallet Standard Vault so the browser wallet supplies and confirms the public account.`);let n=this.walletCreateId.trim()||void 0;if(t===`local-socket-signer`&&!n)throw Error(`Wallet ID is required for a native signer wallet (for example agent-primary or vault-reserve).`);let r=await ei({name:e,walletId:n,providerId:t,role:this.walletCreateRole,chain:`solana`});this.walletProviderTab=t,this.walletCreateName=``,this.walletCreateId=``,this.walletSendCreateForm={...this.walletSendCreateForm,walletId:r.wallet.id},this.walletDetailsWalletId=r.wallet.id,this.walletExpandedPanelWalletId=r.wallet.id,this.walletExpandedPanel=`security`,this.walletSettingsMessage=t===`local-socket-signer`?`Wallet created: ${r.wallet.name}. It is receive-only until signer-owned network setup, owner enrollment, and an explicit policy are acknowledged. Open Policy for the exact status.`:`Wallet created: ${r.wallet.name}. Verify provider policy and review readiness before funding it.`,await this.handleWalletLoad()}catch(e){this.walletSettingsError=`Creating wallet failed: ${String(e)}`}finally{this.walletSettingsBusy=!1}}async handleWalletAttachStandardVault(){if(!this.walletSettingsBusy){this.walletSettingsBusy=!0,this.walletSettingsError=null,this.walletSettingsMessage=null;try{let e=await DY({chooser:aX}),t=`${e.wallet.name} Vault`,n=window.prompt(`Name this Wallet Standard Vault`,t)?.trim();if(!n)throw Error(`Wallet Standard Vault attachment was cancelled`);let r=await ei({name:n,providerId:`wallet-standard`,role:`vault`,address:e.account.address});this.walletProviderTab=`wallet-standard`,this.walletSendCreateForm={...this.walletSendCreateForm,walletId:r.wallet.id},this.walletSettingsMessage=`Attached ${r.wallet.name}. Fased stores only its public address; each send still requires the connected wallet to review and sign. For reserve custody, verify on the device that this account is hardware-backed.`,await this.handleWalletLoad()}catch(e){this.walletSettingsError=`Attaching Wallet Standard Vault failed: ${String(e)}`}finally{this.walletSettingsBusy=!1}}}async handleWalletDeleteNamedWallet(e){if(!this.walletSettingsBusy&&window.confirm(`Delete this named wallet?`)){this.walletSettingsBusy=!0,this.walletSettingsError=null,this.walletSettingsMessage=null;try{await ti({walletId:e}),(this.walletSendCreateForm.walletId??``)===e&&(this.walletSendCreateForm={...this.walletSendCreateForm,walletId:``}),this.walletDetailsWalletId===e&&(this.walletDetailsWalletId=``),this.walletBalanceWalletId===e&&(this.walletBalanceWalletId=``),this.walletExpandedPanelWalletId===e&&(this.walletExpandedPanelWalletId=``,this.walletExpandedPanel=``),this.walletSettingsMessage=`Wallet deleted.`,await this.handleWalletLoad()}catch(e){this.walletSettingsError=`Deleting wallet failed: ${String(e)}`}finally{this.walletSettingsBusy=!1}}}async handleWalletSetDefaultWallet(e){if(this.walletSettingsBusy)return;let t=String(e??``).trim()||null,n=String(this.miningProfile?.walletId||this.miningStatus?.walletId||this.miningReadiness?.selectedWalletId||``).trim()||null;if(t&&t===n&&t!==(String(this.walletDefaultWalletId??``).trim()||null)){this.walletSettingsError=`Agent wallet must stay separate from SAT Mining. Clear the Agent default or choose a dedicated Agent wallet; @wallet:mining is reserved for SAT mining.`,this.walletSettingsMessage=null;return}this.walletSettingsBusy=!0,this.walletSettingsError=null,this.walletSettingsMessage=null;try{await ni({defaultWalletId:t}),this.walletSettingsMessage=t?`Primary Agent wallet set.`:`Primary Agent wallet cleared. Agent role stays on wallet handles.`,await this.handleWalletLoad()}catch(e){this.walletSettingsError=`Updating default wallet failed: ${String(e)}`}finally{this.walletSettingsBusy=!1}}async handleWalletAssignAgentWallet(){if(this.walletSettingsBusy)return;let e=this.walletAssignAgentId.trim();if(!e){this.walletSettingsError=`Agent ID is required.`;return}let t=this.walletAssignWalletId.trim()||void 0;this.walletSettingsBusy=!0,this.walletSettingsError=null,this.walletSettingsMessage=null;try{await ni({agentId:e,walletId:t}),this.walletSettingsMessage=t?`Assigned ${e} to wallet ${t}.`:`Cleared wallet assignment for ${e}.`,await this.handleWalletLoad()}catch(e){this.walletSettingsError=`Updating assignment failed: ${String(e)}`}finally{this.walletSettingsBusy=!1}}async handleWalletDeleteAgentAssignment(e){if(!this.walletSettingsBusy){this.walletSettingsBusy=!0,this.walletSettingsError=null,this.walletSettingsMessage=null;try{await ri({agentId:e}),this.walletSettingsMessage=`Assignment removed for ${e}.`,await this.handleWalletLoad()}catch(e){this.walletSettingsError=`Removing assignment failed: ${String(e)}`}finally{this.walletSettingsBusy=!1}}}async resolveWalletApprovalToken(e){if(this.walletStatus||await this.handleWalletLoad(),(this.walletStatus?.approvalAuth?.mode??`none`)!==`webauthn`)return null;if((this.walletStatus?.approvalAuth?.passkeyCount??0)<=0)throw Error(`Wallet Control Passkey is enabled but no passkey is enrolled. Enroll a passkey or turn passkey approval off.`);return(await tY({operation:e.operation,requestId:e.requestId})).approvalToken}async handleWalletEnrollPasskey(){if(!this.walletPasskeyBusy){if((this.walletStatus?.approvalAuth?.mode??`none`)!==`webauthn`){this.walletPasskeyError=`Passkey enrollment is disabled. Set wallet approval auth mode to webauthn in Policy and Safety.`;return}this.walletPasskeyBusy=!0,this.walletPasskeyError=null,this.walletActionMessage=null;try{let e=null;(this.walletStatus?.approvalAuth?.passkeyCount??0)>0&&(e=await this.resolveWalletApprovalToken({operation:`wallet.passkey-enroll`})),await eY(this.walletPasskeyLabel.trim()||void 0,e??void 0),this.walletPasskeyLabel=``,this.walletActionMessage=`Passkey enrolled for wallet approvals.`,await this.handleWalletLoad()}catch(e){this.walletPasskeyError=`Passkey enrollment failed: ${String(e)}`}finally{this.walletPasskeyBusy=!1}}}async handleWalletDeletePasskey(e){if(this.walletPasskeyBusy)return;let t=e.trim();if(t){this.walletPasskeyBusy=!0,this.walletPasskeyError=null,this.walletActionMessage=null;try{let e=await ci(t,await this.resolveWalletApprovalToken({operation:`wallet.passkey-remove`})??void 0);this.walletActionMessage=`Removed passkey ${e.passkey.label||t}.`,await this.handleWalletLoad()}catch(e){this.walletPasskeyError=`Passkey removal failed: ${String(e)}`}finally{this.walletPasskeyBusy=!1}}}async handleWalletEnablePasskeyApproval(){this.walletSettingsBusy||(this.walletPasskeyError=null,await this.handleWalletPatchSettings({approvalAuthMode:`webauthn`}),this.walletSettingsError||(this.walletActionMessage=`Passkey approval enabled. Enroll a passkey next.`))}async handleWalletRotateKeys(){this.walletError=`Wallet key rotation is signer/provider-owned and is unavailable through the Gateway UI.`}async handleWalletResetKeys(){this.walletError=`Wallet reset is unavailable through the Gateway UI. Create/import only in the signer, provider, or hardware-wallet authority surface.`}async handleWalletSetApprovalsFilter(e){this.walletApprovalsFilter=e,await this.handleWalletLoad()}async handleWalletApproveRequest(e){if(this.walletApprovalsBusyId)return;let t=this.walletApprovals.find(t=>t.id===e);this.walletApprovalsBusyId=e,this.walletApprovalsError=null;try{let n=await mi(e,(t?.payload.providerId===`local-socket-signer`&&t.payload.signerReviewId?.trim()?null:await this.resolveWalletApprovalToken({operation:`wallet.approve`,requestId:e}))??void 0);if(n.mode===`signer-webauthn`){let r=n.signerAuthorization;if(!t||!r)throw Error(`Gateway returned an incomplete signer WebAuthn review`);if(!pi(r,t))throw Error(`Signer WebAuthn binding does not match the reviewed approval`);let i=await rY(r);n=await hi({requestId:e,challengeId:i.challengeId,credential:i.credential})}else if(n.mode===`browser`){let t=n.browserReview;if(!t)throw Error(`Gateway returned an incomplete browser signing review`);if(Date.parse(t.expiresAt)<=Date.now())throw Error(`The reviewed transaction expired before signing; approve it again`);let r=await OY({unsignedTxBase64:t.unsignedTxBase64,expectedAddress:t.signer,chain:t.chain,chooser:aX});n=await gi({requestId:e,preparedId:t.preparedId,intentDigest:t.intentDigest,signedTxBase64:r.signedTxBase64})}let r=typeof n.tx?.txHash==`string`?n.tx.txHash:null,i=t?.payload.actionKind===`signer_review`?`Reviewed operation`:`Send`;this.walletActionMessage=r?`${i} approved and executed (${r}).`:`${i} approved.`,await this.handleWalletLoad()}catch(e){this.walletApprovalsError=iX(e)}finally{this.walletApprovalsBusyId=null}}async handleWalletRejectRequest(e){if(!this.walletApprovalsBusyId){this.walletApprovalsBusyId=e,this.walletApprovalsError=null;try{await _i(e,`rejected by operator`,await this.resolveWalletApprovalToken({operation:`wallet.approve`,requestId:e})??void 0),this.walletActionMessage=`Send request rejected.`,await this.handleWalletLoad()}catch(e){this.walletApprovalsError=`Reject failed: ${String(e)}`}finally{this.walletApprovalsBusyId=null}}}handleWalletOpenSendModal(e,t){let n=this.walletNamedWallets.find(t=>t.id===e),r=t?.trim()||void 0,i=r===`solana:native`?{chain:`solana`,assetId:r,contract:void 0,program:void 0}:r?.startsWith(`solana:spl-token:`)?{chain:`solana`,assetId:r,contract:void 0,program:r.slice(17)||void 0}:{assetId:nX(n)===`solana`?`solana:native`:this.walletSendCreateForm.assetId};this.handleWalletSendCreatePatch(rX({...this.walletSendCreateForm,walletId:e,...i},n)),this.sendModalVisible=!0,this.walletBalanceWalletId=e,this.loadWalletSendAssets(e)}async loadWalletSendAssets(e){let t=e.trim();if(t){this.walletBalancesLoading=!0;try{let e=await Wr(`all`,{walletId:t,includeAssets:!0});if(this.sendModalVisible&&this.walletSendCreateForm.walletId?.trim()===t){let n=e.balances.solana;this.walletBalances=e,this.walletBalancesError=null,this.walletNamedWallets=this.walletNamedWallets.map(r=>r.id===t?{...r,addresses:{...r.addresses,...e.addresses},balances:{...r.balances,solana:n?.ok?n.balance:r.balances?.solana},readiness:{...r.readiness,keystore:!!r.readiness?.keystore,rpc:!!(r.readiness?.rpc||n?.ok)}}:r)}}catch(e){this.sendModalVisible&&this.walletSendCreateForm.walletId?.trim()===t&&(this.walletBalancesError=String(e))}finally{this.walletSendCreateForm.walletId?.trim()===t&&(this.walletBalancesLoading=!1)}}}handleWalletCloseSendModal(){this.sendModalVisible=!1}handleWalletSendCreatePatch(e){let t={...this.walletSendCreateForm,...e},n=t.walletId?.trim(),r=n?this.walletNamedWallets.find(e=>e.id===n):void 0;this.walletSendCreateForm=rX(t,r)}async handleWalletSelectDetailsWallet(e){let t=e.trim();if(t){if(this.walletExpandedPanelWalletId===t&&this.walletExpandedPanel===`security`){this.walletExpandedPanelWalletId=``,this.walletExpandedPanel=``;return}this.walletExpandedPanelWalletId=t,this.walletExpandedPanel=`security`,this.walletBalanceWalletId=``,t!==this.walletDetailsWalletId&&(this.walletDetailsWalletId=t,await this.handleWalletLoad()),this.updateComplete.then(()=>{let e=()=>{this.renderRoot.querySelector(`#wallet-security-card`)?.scrollIntoView({behavior:`smooth`,block:`start`})};typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(e,0)})}}async handleWalletCreateSendRequest(){if(this.walletSendCreateBusy)return;let e=this.walletSendCreateForm,t=e.walletId?.trim()||void 0,n=rX(e,t?this.walletNamedWallets.find(e=>e.id===t):void 0);this.walletSendCreateBusy=!0,this.walletSendCreateError=null,this.walletActionMessage=null;try{let e=n.walletId?.trim()||void 0,t=e?this.walletNamedWallets.find(t=>t.id===e):void 0,r=oX(n,this.walletBalances),i=await qr({chain:n.chain,amountFormat:`human`,providerId:t?.providerId,walletId:e,walletName:t?.name,assetId:r.assetId,assetSymbol:r.assetSymbol,assetName:r.assetName,assetDecimals:r.assetDecimals,amountDisplay:r.amountDisplay,to:n.to?.trim()||void 0,amount:n.amount?.trim()||void 0,contract:n.contract?.trim()||void 0,program:n.program?.trim()||void 0,memo:n.memo?.trim()||void 0});if(i.mode===`manual`&&i.request?.id?(this.walletApprovalsFilter=`pending`,this.sendModalVisible=!1,this.walletActionMessage=`Created send request ${i.request.id}. Open Wallet Approvals below to approve and broadcast.`):i.mode===`autonomous`&&i.tx?.txHash?(this.sendModalVisible=!1,this.walletActionMessage=`Autonomous send executed (${i.tx.txHash}).`):(this.sendModalVisible=!1,this.walletActionMessage=`Wallet send submitted.`),this.walletSendCreateForm={...this.walletSendCreateForm,to:``,amount:``,memo:``},await this.handleWalletLoad(),i.mode===`manual`&&i.request?.id){let e=()=>document.getElementById(`wallet-approvals`)?.scrollIntoView({behavior:`smooth`,block:`start`});typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(e,0)}}catch(e){this.walletSendCreateError=`Create request failed: ${String(e)}`}finally{this.walletSendCreateBusy=!1}}async handleWalletApplyRecommendedPolicy(){await this.handleWalletPatchSettings({policyTemplate:`recommended`})}async handleAbortChat(){await vv(this)}removeQueuedMessage(e){Dv(this,e)}async handleSendChat(e,t){await kv(this,e,t)}async handleWhatsAppStart(e){await un(this,e)}async handleWhatsAppWait(){await dn(this)}async handleWhatsAppLogout(){await fn(this)}async handleChannelQrStart(e,t=!1,n){await pn(this,e,t,n)}async handleChannelQrWait(e,t){await mn(this,e,t)}async handleChannelLogout(e,t){await hn(this,e,t)}async handleChannelInstall(e){await gn(this,e)}cancelChannelConfirmAction(){_n(this)}async confirmChannelAction(){await vn(this)}async handleChannelEnable(e){await yn(this,e)}async handleChannelConfigSave(){await bn(this)}async handleChannelConfigReload(){await xn(this)}handleNostrProfileEdit(e,t){Dn(this,e,t)}handleNostrProfileCancel(){On(this)}handleNostrProfileFieldChange(e,t){kn(this,e,t)}async handleNostrProfileSave(){await jn(this)}async handleNostrProfileImport(){await Mn(this)}handleNostrProfileToggleAdvanced(){An(this)}async handleExecApprovalDecision(e){let t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{await this.client.request(`exec.approval.resolve`,{id:t.id,decision:e}),this.execApprovalQueue=this.execApprovalQueue.filter(e=>e.id!==t.id)}catch(e){this.execApprovalError=`Exec 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,Dg(this,{...this.settings,gatewayUrl:e,...t?{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})}setLoginTokenCandidate(e){this.loginTokenCandidate=e}render(){if(this.uiRuntimeError)return this.renderUiRuntimeError(this.uiRuntimeError);try{return PJ(this)}catch(e){let t=e instanceof Error?e.stack??e.message:String(e);return queueMicrotask(()=>this.reportUiRuntimeError(t)),this.renderUiRuntimeError(t)}}};G([P()],$.prototype,`settings`,void 0),G([P()],$.prototype,`password`,void 0),G([P()],$.prototype,`loginShowGatewayToken`,void 0),G([P()],$.prototype,`loginShowGatewayPassword`,void 0),G([P()],$.prototype,`tab`,void 0),G([P()],$.prototype,`onboarding`,void 0),G([P()],$.prototype,`connected`,void 0),G([P()],$.prototype,`theme`,void 0),G([P()],$.prototype,`themeResolved`,void 0),G([P()],$.prototype,`hello`,void 0),G([P()],$.prototype,`lastError`,void 0),G([P()],$.prototype,`lastErrorCode`,void 0),G([P()],$.prototype,`uiRuntimeError`,void 0),G([P()],$.prototype,`eventLog`,void 0),G([P()],$.prototype,`serverVersion`,void 0),G([P()],$.prototype,`updateAvailable`,void 0),G([P()],$.prototype,`assistantName`,void 0),G([P()],$.prototype,`assistantAvatar`,void 0),G([P()],$.prototype,`assistantAgentId`,void 0),G([P()],$.prototype,`sessionKey`,void 0),G([P()],$.prototype,`sessionsSubscriptionActive`,void 0),G([P()],$.prototype,`sessionsLastEventAt`,void 0),G([P()],$.prototype,`sessionMessagesSubscriptionActive`,void 0),G([P()],$.prototype,`subscribedSessionMessageKey`,void 0),G([P()],$.prototype,`sessionMessageLastEventAt`,void 0),G([P()],$.prototype,`chatLoading`,void 0),G([P()],$.prototype,`chatSending`,void 0),G([P()],$.prototype,`chatMessage`,void 0),G([P()],$.prototype,`chatMessages`,void 0),G([P()],$.prototype,`chatToolMessages`,void 0),G([P()],$.prototype,`chatStream`,void 0),G([P()],$.prototype,`chatStreamSegments`,void 0),G([P()],$.prototype,`chatStreamStartedAt`,void 0),G([P()],$.prototype,`chatRunId`,void 0),G([P()],$.prototype,`compactionStatus`,void 0),G([P()],$.prototype,`fallbackStatus`,void 0),G([P()],$.prototype,`chatAvatarUrl`,void 0),G([P()],$.prototype,`chatThinkingLevel`,void 0),G([P()],$.prototype,`chatQueue`,void 0),G([P()],$.prototype,`chatAttachments`,void 0),G([P()],$.prototype,`chatManualRefreshInFlight`,void 0),G([P()],$.prototype,`chatModelsLoading`,void 0),G([P()],$.prototype,`chatModelCatalog`,void 0),G([P()],$.prototype,`providerModelCatalog`,void 0),G([P()],$.prototype,`chatModelOverrides`,void 0),G([P()],$.prototype,`chatModelPatchInFlight`,void 0),G([P()],$.prototype,`chatModelPatchSessionKey`,void 0),G([P()],$.prototype,`chatModelPatchLabel`,void 0),G([P()],$.prototype,`chatSessionSearch`,void 0),G([P()],$.prototype,`chatSessionSearchOpen`,void 0),G([P()],$.prototype,`chatSessionListLimit`,void 0),G([P()],$.prototype,`chatTranscriptSearch`,void 0),G([P()],$.prototype,`chatTranscriptSearchIndex`,void 0),G([P()],$.prototype,`chatScheduleDraft`,void 0),G([P()],$.prototype,`chatSessionUsage`,void 0),G([P()],$.prototype,`chatSessionUsageLoading`,void 0),G([P()],$.prototype,`chatSessionUsageError`,void 0),G([P()],$.prototype,`sidebarOpen`,void 0),G([P()],$.prototype,`sidebarContent`,void 0),G([P()],$.prototype,`sidebarError`,void 0),G([P()],$.prototype,`splitRatio`,void 0),G([P()],$.prototype,`nodesLoading`,void 0),G([P()],$.prototype,`nodes`,void 0),G([P()],$.prototype,`commandsCatalogLoading`,void 0),G([P()],$.prototype,`commandsCatalogError`,void 0),G([P()],$.prototype,`commandsCatalog`,void 0),G([P()],$.prototype,`commandsCatalogScope`,void 0),G([P()],$.prototype,`devicesLoading`,void 0),G([P()],$.prototype,`devicesError`,void 0),G([P()],$.prototype,`devicesList`,void 0),G([P()],$.prototype,`execApprovalsLoading`,void 0),G([P()],$.prototype,`execApprovalsSaving`,void 0),G([P()],$.prototype,`execApprovalsDirty`,void 0),G([P()],$.prototype,`execApprovalsSnapshot`,void 0),G([P()],$.prototype,`sendModalVisible`,void 0),G([P()],$.prototype,`execApprovalsForm`,void 0),G([P()],$.prototype,`execApprovalsSelectedAgent`,void 0),G([P()],$.prototype,`execApprovalsTarget`,void 0),G([P()],$.prototype,`execApprovalsTargetNodeId`,void 0),G([P()],$.prototype,`execApprovalQueue`,void 0),G([P()],$.prototype,`execApprovalBusy`,void 0),G([P()],$.prototype,`execApprovalError`,void 0),G([P()],$.prototype,`pendingGatewayUrl`,void 0),G([P()],$.prototype,`pendingGatewayToken`,void 0),G([P()],$.prototype,`loginGrantInput`,void 0),G([P()],$.prototype,`loginGrantPending`,void 0),G([P()],$.prototype,`loginGrantError`,void 0),G([P()],$.prototype,`loginTokenPending`,void 0),G([P()],$.prototype,`loginTokenError`,void 0),G([P()],$.prototype,`loginTokenCandidate`,void 0),G([P()],$.prototype,`authBootstrapPending`,void 0),G([P()],$.prototype,`authNotice`,void 0),G([P()],$.prototype,`authSessionExpiresAt`,void 0),G([P()],$.prototype,`authSessionIdleTimeoutSeconds`,void 0),G([P()],$.prototype,`overviewAdvancedUnlocked`,void 0),G([P()],$.prototype,`overviewSecretsRevealUntilMs`,void 0),G([P()],$.prototype,`dashboardLayout`,void 0),G([P()],$.prototype,`dashboardWidgetDrawerOpen`,void 0),G([P()],$.prototype,`configLoading`,void 0),G([P()],$.prototype,`configRaw`,void 0),G([P()],$.prototype,`configRawOriginal`,void 0),G([P()],$.prototype,`configValid`,void 0),G([P()],$.prototype,`configIssues`,void 0),G([P()],$.prototype,`configSaving`,void 0),G([P()],$.prototype,`configApplying`,void 0),G([P()],$.prototype,`updateRunning`,void 0),G([P()],$.prototype,`applySessionKey`,void 0),G([P()],$.prototype,`configSnapshot`,void 0),G([P()],$.prototype,`configAuthStatus`,void 0),G([P()],$.prototype,`configModelCatalogStatus`,void 0),G([P()],$.prototype,`configAuthActionBusyProfileId`,void 0),G([P()],$.prototype,`configAuthAction`,void 0),G([P()],$.prototype,`configSchema`,void 0),G([P()],$.prototype,`configSchemaVersion`,void 0),G([P()],$.prototype,`configSchemaLoading`,void 0),G([P()],$.prototype,`configUiHints`,void 0),G([P()],$.prototype,`configForm`,void 0),G([P()],$.prototype,`configFormOriginal`,void 0),G([P()],$.prototype,`configFormDirty`,void 0),G([P()],$.prototype,`configFormMode`,void 0),G([P()],$.prototype,`configSearchQuery`,void 0),G([P()],$.prototype,`configActiveSection`,void 0),G([P()],$.prototype,`configActiveSubsection`,void 0),G([P()],$.prototype,`servicesWebSearchTesting`,void 0),G([P()],$.prototype,`servicesWebSearchTestMessage`,void 0),G([P()],$.prototype,`servicesCapabilities`,void 0),G([P()],$.prototype,`servicesCapabilitiesLoading`,void 0),G([P()],$.prototype,`servicesComponentBusy`,void 0),G([P()],$.prototype,`servicesComponentMessage`,void 0),G([P()],$.prototype,`servicesWebSearchProviders`,void 0),G([P()],$.prototype,`servicesWebSearchProvidersLoading`,void 0),G([P()],$.prototype,`servicesGmailProvisioning`,void 0),G([P()],$.prototype,`servicesGmailProvisionMessage`,void 0),G([P()],$.prototype,`channelsLoading`,void 0),G([P()],$.prototype,`channelsSnapshot`,void 0),G([P()],$.prototype,`channelsError`,void 0),G([P()],$.prototype,`channelsNotice`,void 0),G([P()],$.prototype,`channelsLastSuccess`,void 0),G([P()],$.prototype,`channelsView`,void 0),G([P()],$.prototype,`channelRuntimeBusy`,void 0),G([P()],$.prototype,`channelConfirmAction`,void 0),G([P()],$.prototype,`channelQrLogin`,void 0),G([P()],$.prototype,`whatsappLoginMessage`,void 0),G([P()],$.prototype,`whatsappLoginQrDataUrl`,void 0),G([P()],$.prototype,`whatsappLoginConnected`,void 0),G([P()],$.prototype,`whatsappBusy`,void 0),G([P()],$.prototype,`nostrProfileFormState`,void 0),G([P()],$.prototype,`nostrProfileAccountId`,void 0),G([P()],$.prototype,`presenceLoading`,void 0),G([P()],$.prototype,`presenceEntries`,void 0),G([P()],$.prototype,`presenceError`,void 0),G([P()],$.prototype,`presenceStatus`,void 0),G([P()],$.prototype,`agentsLoading`,void 0),G([P()],$.prototype,`agentsList`,void 0),G([P()],$.prototype,`agentsError`,void 0),G([P()],$.prototype,`agentsSelectedId`,void 0),G([P()],$.prototype,`agentsCreateBusy`,void 0),G([P()],$.prototype,`agentsCreateMessage`,void 0),G([P()],$.prototype,`agentsPanel`,void 0),G([P()],$.prototype,`agentFilesLoading`,void 0),G([P()],$.prototype,`agentFilesError`,void 0),G([P()],$.prototype,`agentFilesList`,void 0),G([P()],$.prototype,`agentFileContents`,void 0),G([P()],$.prototype,`agentFileDrafts`,void 0),G([P()],$.prototype,`agentFileActive`,void 0),G([P()],$.prototype,`agentFileSaving`,void 0),G([P()],$.prototype,`agentIdentityLoading`,void 0),G([P()],$.prototype,`agentIdentityError`,void 0),G([P()],$.prototype,`agentIdentityById`,void 0),G([P()],$.prototype,`agentSkillsLoading`,void 0),G([P()],$.prototype,`agentSkillsError`,void 0),G([P()],$.prototype,`agentSkillsReport`,void 0),G([P()],$.prototype,`agentSkillsAgentId`,void 0),G([P()],$.prototype,`toolsCatalogLoading`,void 0),G([P()],$.prototype,`toolsCatalogError`,void 0),G([P()],$.prototype,`toolsCatalogResult`,void 0),G([P()],$.prototype,`toolsEffectiveLoading`,void 0),G([P()],$.prototype,`toolsEffectiveError`,void 0),G([P()],$.prototype,`toolsEffectiveResult`,void 0),G([P()],$.prototype,`sessionsLoading`,void 0),G([P()],$.prototype,`sessionsResult`,void 0),G([P()],$.prototype,`sessionsError`,void 0),G([P()],$.prototype,`sessionsFilterActive`,void 0),G([P()],$.prototype,`sessionsFilterLimit`,void 0),G([P()],$.prototype,`sessionsFilterSearch`,void 0),G([P()],$.prototype,`sessionsIncludeGlobal`,void 0),G([P()],$.prototype,`sessionsIncludeUnknown`,void 0),G([P()],$.prototype,`sessionsHideCron`,void 0),G([P()],$.prototype,`usageLoading`,void 0),G([P()],$.prototype,`usageResult`,void 0),G([P()],$.prototype,`usageCostSummary`,void 0),G([P()],$.prototype,`usageError`,void 0),G([P()],$.prototype,`usageStartDate`,void 0),G([P()],$.prototype,`usageEndDate`,void 0),G([P()],$.prototype,`usageSelectedSessions`,void 0),G([P()],$.prototype,`usageSelectedDays`,void 0),G([P()],$.prototype,`usageSelectedHours`,void 0),G([P()],$.prototype,`usageChartMode`,void 0),G([P()],$.prototype,`usageDailyChartMode`,void 0),G([P()],$.prototype,`usageTimeSeriesMode`,void 0),G([P()],$.prototype,`usageTimeSeriesBreakdownMode`,void 0),G([P()],$.prototype,`usageTimeSeries`,void 0),G([P()],$.prototype,`usageTimeSeriesLoading`,void 0),G([P()],$.prototype,`usageTimeSeriesCursorStart`,void 0),G([P()],$.prototype,`usageTimeSeriesCursorEnd`,void 0),G([P()],$.prototype,`usageSessionLogs`,void 0),G([P()],$.prototype,`usageSessionLogsLoading`,void 0),G([P()],$.prototype,`usageSessionLogsExpanded`,void 0),G([P()],$.prototype,`usageQuery`,void 0),G([P()],$.prototype,`usageQueryDraft`,void 0),G([P()],$.prototype,`usageSessionSort`,void 0),G([P()],$.prototype,`usageSessionSortDir`,void 0),G([P()],$.prototype,`usageRecentSessions`,void 0),G([P()],$.prototype,`usageTimeZone`,void 0),G([P()],$.prototype,`usageContextExpanded`,void 0),G([P()],$.prototype,`usageHeaderPinned`,void 0),G([P()],$.prototype,`usageSessionsTab`,void 0),G([P()],$.prototype,`usageVisibleColumns`,void 0),G([P()],$.prototype,`usageLogFilterRoles`,void 0),G([P()],$.prototype,`usageLogFilterTools`,void 0),G([P()],$.prototype,`usageLogFilterHasTools`,void 0),G([P()],$.prototype,`usageLogFilterQuery`,void 0),G([P()],$.prototype,`cronLoading`,void 0),G([P()],$.prototype,`cronJobsLoadingMore`,void 0),G([P()],$.prototype,`cronJobs`,void 0),G([P()],$.prototype,`cronJobsTotal`,void 0),G([P()],$.prototype,`cronJobsHasMore`,void 0),G([P()],$.prototype,`cronJobsNextOffset`,void 0),G([P()],$.prototype,`cronJobsLimit`,void 0),G([P()],$.prototype,`cronJobsQuery`,void 0),G([P()],$.prototype,`cronJobsEnabledFilter`,void 0),G([P()],$.prototype,`cronJobsScheduleKindFilter`,void 0),G([P()],$.prototype,`cronJobsLastStatusFilter`,void 0),G([P()],$.prototype,`cronJobsAdaptiveRouteFilter`,void 0),G([P()],$.prototype,`cronJobsSortBy`,void 0),G([P()],$.prototype,`cronJobsSortDir`,void 0),G([P()],$.prototype,`cronStatus`,void 0),G([P()],$.prototype,`cronError`,void 0),G([P()],$.prototype,`cronForm`,void 0),G([P()],$.prototype,`cronFieldErrors`,void 0),G([P()],$.prototype,`agentTaskDialogOpen`,void 0),G([P()],$.prototype,`agentTaskForm`,void 0),G([P()],$.prototype,`agentTaskFieldErrors`,void 0),G([P()],$.prototype,`agentTaskEditingJobId`,void 0),G([P()],$.prototype,`agentTaskError`,void 0),G([P()],$.prototype,`agentTaskBusy`,void 0),G([P()],$.prototype,`agentTaskQuery`,void 0),G([P()],$.prototype,`agentTaskStatusFilter`,void 0),G([P()],$.prototype,`agentTaskAdaptiveRouteFilter`,void 0),G([P()],$.prototype,`agentTaskSortDir`,void 0),G([P()],$.prototype,`taskLedgerLoading`,void 0),G([P()],$.prototype,`taskLedgerBusy`,void 0),G([P()],$.prototype,`taskLedgerError`,void 0),G([P()],$.prototype,`taskLedgerMaintenanceMessage`,void 0),G([P()],$.prototype,`taskLedger`,void 0),G([P()],$.prototype,`taskLedgerOffset`,void 0),G([P()],$.prototype,`taskLedgerSourceFilter`,void 0),G([P()],$.prototype,`taskLedgerTypeFilter`,void 0),G([P()],$.prototype,`taskLedgerStatusFilter`,void 0),G([P()],$.prototype,`taskLedgerDetails`,void 0),G([P()],$.prototype,`taskLedgerDetailLoading`,void 0),G([P()],$.prototype,`taskLedgerDetailErrors`,void 0),G([P()],$.prototype,`taskWorkflowDraft`,void 0),G([P()],$.prototype,`taskWorkflowGraphDraft`,void 0),G([P()],$.prototype,`taskWorkflowBusy`,void 0),G([P()],$.prototype,`taskWorkflowError`,void 0),G([P()],$.prototype,`taskWorkflowMessage`,void 0),G([P()],$.prototype,`taskWorkflowDefinitionsLoading`,void 0),G([P()],$.prototype,`taskWorkflowDefinitionsBusy`,void 0),G([P()],$.prototype,`taskWorkflowDefinitionsError`,void 0),G([P()],$.prototype,`taskWorkflowDefinitions`,void 0),G([P()],$.prototype,`taskWorkflowTemplatesLoading`,void 0),G([P()],$.prototype,`taskWorkflowTemplatesError`,void 0),G([P()],$.prototype,`taskWorkflowTemplates`,void 0),G([P()],$.prototype,`taskStandingOrdersLoading`,void 0),G([P()],$.prototype,`taskStandingOrdersBusy`,void 0),G([P()],$.prototype,`taskStandingOrdersError`,void 0),G([P()],$.prototype,`taskStandingOrdersMessage`,void 0),G([P()],$.prototype,`taskStandingOrders`,void 0),G([P()],$.prototype,`taskStandingOrderDraft`,void 0),G([P()],$.prototype,`taskFlowRunsLoading`,void 0),G([P()],$.prototype,`taskFlowRunsBusy`,void 0),G([P()],$.prototype,`taskFlowRunsError`,void 0),G([P()],$.prototype,`taskFlowRuns`,void 0),G([P()],$.prototype,`webhookTriggersLoading`,void 0),G([P()],$.prototype,`webhookTriggersBusy`,void 0),G([P()],$.prototype,`webhookTriggersError`,void 0),G([P()],$.prototype,`webhookTriggersMessage`,void 0),G([P()],$.prototype,`webhookTriggers`,void 0),G([P()],$.prototype,`webhookTriggerDraft`,void 0),G([P()],$.prototype,`cronEditingJobId`,void 0),G([P()],$.prototype,`cronRunsJobId`,void 0),G([P()],$.prototype,`cronRunsLoadingMore`,void 0),G([P()],$.prototype,`cronRuns`,void 0),G([P()],$.prototype,`cronRunsTotal`,void 0),G([P()],$.prototype,`cronRunsHasMore`,void 0),G([P()],$.prototype,`cronRunsNextOffset`,void 0),G([P()],$.prototype,`cronRunsLimit`,void 0),G([P()],$.prototype,`cronRunsScope`,void 0),G([P()],$.prototype,`cronRunsStatuses`,void 0),G([P()],$.prototype,`cronRunsDeliveryStatuses`,void 0),G([P()],$.prototype,`cronRunsStatusFilter`,void 0),G([P()],$.prototype,`cronRunsQuery`,void 0),G([P()],$.prototype,`cronRunsSortDir`,void 0),G([P()],$.prototype,`cronRunDetail`,void 0),G([P()],$.prototype,`cronRunDetailLoading`,void 0),G([P()],$.prototype,`cronRunDetailError`,void 0),G([P()],$.prototype,`cronBusy`,void 0),G([P()],$.prototype,`federationLoading`,void 0),G([P()],$.prototype,`federationError`,void 0),G([P()],$.prototype,`federationMessage`,void 0),G([P()],$.prototype,`federationDirectory`,void 0),G([P()],$.prototype,`federationHandle`,void 0),G([P()],$.prototype,`federationNodeEndpoint`,void 0),G([P()],$.prototype,`federationToken`,void 0),G([P()],$.prototype,`federationStatus`,void 0),G([P()],$.prototype,`federationManagedMode`,void 0),G([P()],$.prototype,`federationAdminToken`,void 0),G([P()],$.prototype,`federationReviewReason`,void 0),G([P()],$.prototype,`federationReviewBusyHandle`,void 0),G([P()],$.prototype,`federationBondWalletIdDraft`,void 0),G([P()],$.prototype,`federationBondAmountDraft`,void 0),G([P()],$.prototype,`federationBondTierDraft`,void 0),G([P()],$.prototype,`federationBondAutoSubmitProof`,void 0),G([P()],$.prototype,`federationBondActionBusy`,void 0),G([P()],$.prototype,`federationBondBusyAction`,void 0),G([P()],$.prototype,`federationOperatorEconomyLoading`,void 0),G([P()],$.prototype,`federationOperatorEconomyError`,void 0),G([P()],$.prototype,`federationOperatorEconomyCollectionStatus`,void 0),G([P()],$.prototype,`federationOperatorEconomyFeeObjects`,void 0),G([P()],$.prototype,`federationOperatorEconomyBucketJournal`,void 0),G([P()],$.prototype,`federationOperatorEconomyBucketBalances`,void 0),G([P()],$.prototype,`federationOperatorEconomyReconciliationReports`,void 0),G([P()],$.prototype,`federationOperatorEconomyAutoFeeDecisions`,void 0),G([P()],$.prototype,`federationOperatorEconomyShowcase`,void 0),G([P()],$.prototype,`federationLocalOffers`,void 0),G([P()],$.prototype,`federationLocalRequests`,void 0),G([P()],$.prototype,`federationLocalOrders`,void 0),G([P()],$.prototype,`federationLocalOffersLoading`,void 0),G([P()],$.prototype,`federationLocalRequestsLoading`,void 0),G([P()],$.prototype,`federationLocalOrdersLoading`,void 0),G([P()],$.prototype,`federationLocalRequestsError`,void 0),G([P()],$.prototype,`federationLocalOrdersError`,void 0),G([P()],$.prototype,`federationLocalOffersError`,void 0),G([P()],$.prototype,`federationLocalOffersMessage`,void 0),G([P()],$.prototype,`federationLocalOfferBusy`,void 0),G([P()],$.prototype,`federationLocalOrderBusy`,void 0),G([P()],$.prototype,`federationEscrowBusyOrderId`,void 0),G([P()],$.prototype,`federationEscrowError`,void 0),G([P()],$.prototype,`federationEscrowMessage`,void 0),G([P()],$.prototype,`federationMarketplaceOrderDeliveryDraftOrderId`,void 0),G([P()],$.prototype,`federationMarketplaceOrderDeliveryKindDraft`,void 0),G([P()],$.prototype,`federationMarketplaceOrderDeliveryWebhookUrlDraft`,void 0),G([P()],$.prototype,`federationMarketplaceOrderDeliveryBusyOrderId`,void 0),G([P()],$.prototype,`federationMarketplaceOrderDeliveryError`,void 0),G([P()],$.prototype,`federationMarketplaceOrderDeliveryMessage`,void 0),G([P()],$.prototype,`federationMarketplaceManualOrderBusyId`,void 0),G([P()],$.prototype,`federationMarketplaceManualOrderError`,void 0),G([P()],$.prototype,`federationMarketplaceManualOrderMessage`,void 0),G([P()],$.prototype,`federationMarketplaceCapabilityOrderBusyId`,void 0),G([P()],$.prototype,`federationMarketplaceCapabilityOrderError`,void 0),G([P()],$.prototype,`federationMarketplaceCapabilityOrderMessage`,void 0),G([P()],$.prototype,`federationLocalOfferDraftOpen`,void 0),G([P()],$.prototype,`federationLocalListingDraftKind`,void 0),G([P()],$.prototype,`federationLocalOfferEditingId`,void 0),G([P()],$.prototype,`federationLocalRequestEditingId`,void 0),G([P()],$.prototype,`federationLocalOfferEnabledDraft`,void 0),G([P()],$.prototype,`federationLocalOfferTitleDraft`,void 0),G([P()],$.prototype,`federationLocalOfferSummaryDraft`,void 0),G([P()],$.prototype,`federationLocalOfferServiceKindDraft`,void 0),G([P()],$.prototype,`federationLocalOfferInputShapeDraft`,void 0),G([P()],$.prototype,`federationLocalOfferDeliveryShapeDraft`,void 0),G([P()],$.prototype,`federationLocalOfferCapabilitiesDraft`,void 0),G([P()],$.prototype,`federationLocalOfferPriceAmountDraft`,void 0),G([P()],$.prototype,`federationLocalOfferPricingModelDraft`,void 0),G([P()],$.prototype,`federationLocalOfferPriceUnitDraft`,void 0),G([P()],$.prototype,`federationLocalOfferCurrencyDraft`,void 0),G([P()],$.prototype,`federationLocalOfferFulfillmentModeDraft`,void 0),G([P()],$.prototype,`federationLocalOfferAcceptedAssetsDraft`,void 0),G([P()],$.prototype,`federationLocalOfferPaymentRailsDraft`,void 0),G([P()],$.prototype,`federationOffersLoading`,void 0),G([P()],$.prototype,`federationOffersError`,void 0),G([P()],$.prototype,`federationOffersHint`,void 0),G([P()],$.prototype,`federationOffers`,void 0),G([P()],$.prototype,`federationOffersQuery`,void 0),G([P()],$.prototype,`federationOffersServiceKindFilter`,void 0),G([P()],$.prototype,`federationMarketplaceSection`,void 0),G([P()],$.prototype,`federationMarketplaceKindFilter`,void 0),G([P()],$.prototype,`federationMarketplaceTrustFilter`,void 0),G([P()],$.prototype,`federationMarketplaceStatusFilter`,void 0),G([P()],$.prototype,`federationMarketplaceDateFromFilter`,void 0),G([P()],$.prototype,`federationMarketplaceDateToFilter`,void 0),G([P()],$.prototype,`federationMarketplaceSort`,void 0),G([P()],$.prototype,`federationSelectedOfferId`,void 0),G([P()],$.prototype,`federationMarketplaceIndexLoading`,void 0),G([P()],$.prototype,`federationMarketplaceIndexPublishing`,void 0),G([P()],$.prototype,`federationMarketplaceIndexError`,void 0),G([P()],$.prototype,`federationMarketplaceIndexMessage`,void 0),G([P()],$.prototype,`federationMarketplaceIndexPreview`,void 0),G([P()],$.prototype,`federationMarketplaceIndexEntries`,void 0),G([P()],$.prototype,`federationMarketplaceIndexSelectedEntryId`,void 0),G([P()],$.prototype,`federationMarketplaceIndexDetailTab`,void 0),G([P()],$.prototype,`federationMarketplaceFeedbackOrderId`,void 0),G([P()],$.prototype,`federationMarketplaceSellerProfileHandle`,void 0),G([P()],$.prototype,`federationMarketplaceSellerProfileTab`,void 0),G([P()],$.prototype,`federationMarketplaceSellerProfileLoading`,void 0),G([P()],$.prototype,`federationMarketplaceSellerProfileError`,void 0),G([P()],$.prototype,`federationMarketplaceSellerProfileEntries`,void 0),G([P()],$.prototype,`federationMarketplaceSellerProfileReviews`,void 0),G([P()],$.prototype,`federationMarketplaceSellerProfileDisputes`,void 0),G([P()],$.prototype,`federationMarketplaceSellerProfileNotaryRecords`,void 0),G([P()],$.prototype,`federationOfferReviewsLoading`,void 0),G([P()],$.prototype,`federationOfferReviewsError`,void 0),G([P()],$.prototype,`federationOfferReviews`,void 0),G([P()],$.prototype,`federationOfferDisputesLoading`,void 0),G([P()],$.prototype,`federationOfferDisputesError`,void 0),G([P()],$.prototype,`federationOfferDisputes`,void 0),G([P()],$.prototype,`federationOfferFeedbackBusy`,void 0),G([P()],$.prototype,`federationOfferFeedbackError`,void 0),G([P()],$.prototype,`federationOfferFeedbackMessage`,void 0),G([P()],$.prototype,`federationOfferFeedbackTab`,void 0),G([P()],$.prototype,`federationSummarizeSourceText`,void 0),G([P()],$.prototype,`federationSummarizeStyle`,void 0),G([P()],$.prototype,`federationSummarizeMaxSentences`,void 0),G([P()],$.prototype,`federationSummarizeBusy`,void 0),G([P()],$.prototype,`federationSummarizeError`,void 0),G([P()],$.prototype,`federationPaidSummarizeBusy`,void 0),G([P()],$.prototype,`federationPaidSummarizeError`,void 0),G([P()],$.prototype,`federationSummarizeResult`,void 0),G([P()],$.prototype,`federationPaidQuoteAmountDraft`,void 0),G([P()],$.prototype,`federationPaidQuoteAssetDecimalsDraft`,void 0),G([P()],$.prototype,`federationPaidQuoteCurrencyDraft`,void 0),G([P()],$.prototype,`federationPaidQuoteChainDraft`,void 0),G([P()],$.prototype,`federationPaidQuoteAssetKindDraft`,void 0),G([P()],$.prototype,`federationPaidQuoteAssetAddressDraft`,void 0),G([P()],$.prototype,`federationPaidQuotePayeeAddressDraft`,void 0),G([P()],$.prototype,`federationPaidQuoteExpiresMinutesDraft`,void 0),G([P()],$.prototype,`federationReviewRatingDraft`,void 0),G([P()],$.prototype,`federationReviewOutcomeDraft`,void 0),G([P()],$.prototype,`federationReviewPaymentStatusDraft`,void 0),G([P()],$.prototype,`federationReviewInvoiceIdDraft`,void 0),G([P()],$.prototype,`federationReviewReceiptIdDraft`,void 0),G([P()],$.prototype,`federationReviewSummaryDraft`,void 0),G([P()],$.prototype,`federationDisputeReasonCodeDraft`,void 0),G([P()],$.prototype,`federationDisputePaymentStatusDraft`,void 0),G([P()],$.prototype,`federationDisputeInvoiceIdDraft`,void 0),G([P()],$.prototype,`federationDisputeReceiptIdDraft`,void 0),G([P()],$.prototype,`federationDisputeSummaryDraft`,void 0),G([P()],$.prototype,`federationOperatorDisputesLoading`,void 0),G([P()],$.prototype,`federationOperatorDisputesError`,void 0),G([P()],$.prototype,`federationOperatorDisputes`,void 0),G([P()],$.prototype,`federationOperatorDisputeProviderFilter`,void 0),G([P()],$.prototype,`federationOperatorDisputeOfferIdFilter`,void 0),G([P()],$.prototype,`federationOperatorDisputeStatusFilter`,void 0),G([P()],$.prototype,`federationOperatorDisputePaymentStatusFilter`,void 0),G([P()],$.prototype,`federationOperatorSelectedCaseId`,void 0),G([P()],$.prototype,`federationOperatorDisputeReviewStatusDraft`,void 0),G([P()],$.prototype,`federationOperatorDisputeResolutionDraft`,void 0),G([P()],$.prototype,`federationOperatorDisputeReviewBusy`,void 0),G([P()],$.prototype,`federationOperatorDisputeReviewError`,void 0),G([P()],$.prototype,`federationOperatorDisputeReviewMessage`,void 0),G([P()],$.prototype,`federationDisputeNotaryRecordsLoading`,void 0),G([P()],$.prototype,`federationDisputeNotaryRecordsError`,void 0),G([P()],$.prototype,`federationDisputeNotaryRecords`,void 0),G([P()],$.prototype,`federationDisputeNotaryOpinionDraft`,void 0),G([P()],$.prototype,`federationDisputeNotaryConfidenceDraft`,void 0),G([P()],$.prototype,`federationDisputeNotaryRecommendedResolutionDraft`,void 0),G([P()],$.prototype,`federationDisputeNotarySummaryDraft`,void 0),G([P()],$.prototype,`federationDisputeNotaryBusy`,void 0),G([P()],$.prototype,`federationDisputeNotaryError`,void 0),G([P()],$.prototype,`federationDisputeNotaryMessage`,void 0),G([P()],$.prototype,`walletLoading`,void 0),G([P()],$.prototype,`walletError`,void 0),G([P()],$.prototype,`walletStatus`,void 0),G([P()],$.prototype,`walletBalancesLoading`,void 0),G([P()],$.prototype,`walletBalancesError`,void 0),G([P()],$.prototype,`walletBalances`,void 0),G([P()],$.prototype,`miningLoading`,void 0),G([P()],$.prototype,`miningSaving`,void 0),G([P()],$.prototype,`miningActionBusy`,void 0),G([P()],$.prototype,`miningCapitalActionBusy`,void 0),G([P()],$.prototype,`miningPendingAction`,void 0),G([P()],$.prototype,`miningError`,void 0),G([P()],$.prototype,`miningMessage`,void 0),G([P()],$.prototype,`miningWallets`,void 0),G([P()],$.prototype,`miningAttachedWalletId`,void 0),G([P()],$.prototype,`miningProfile`,void 0),G([P()],$.prototype,`miningSavedProfiles`,void 0),G([P()],$.prototype,`miningSelectedSavedProfileId`,void 0),G([P()],$.prototype,`miningSaveProfileName`,void 0),G([P()],$.prototype,`miningCapitalDepositDraft`,void 0),G([P()],$.prototype,`miningCapitalWithdrawDraft`,void 0),G([P()],$.prototype,`miningReadiness`,void 0),G([P()],$.prototype,`miningStatus`,void 0),G([P()],$.prototype,`miningMainnetSync`,void 0),G([P()],$.prototype,`miningMainnetSyncBusy`,void 0),G([P()],$.prototype,`miningHistoryLoading`,void 0),G([P()],$.prototype,`miningHistoryError`,void 0),G([P()],$.prototype,`miningHistory`,void 0),G([P()],$.prototype,`miningRecovery`,void 0),G([P()],$.prototype,`miningRecoveryDisputeAuthority`,void 0),G([P()],$.prototype,`miningRecoveryTargetAuthority`,void 0),G([P()],$.prototype,`miningRecoveryEpochId`,void 0),G([P()],$.prototype,`miningRecoveryMicroRoundId`,void 0),G([P()],$.prototype,`miningRecoveryStatusFlag`,void 0),G([P()],$.prototype,`miningRecoveryBoardRoot`,void 0),G([P()],$.prototype,`miningRecoveryScoreRoot`,void 0),G([P()],$.prototype,`miningRecoveryCoordinationRoot`,void 0),G([P()],$.prototype,`miningRecoveryDraftRestored`,void 0),G([P()],$.prototype,`miningRecoveryDraftUpdatedAt`,void 0),G([P()],$.prototype,`miningRecoveryDraftSavedHint`,void 0),G([P()],$.prototype,`miningLastNotifiedAction`,void 0),G([P()],$.prototype,`miningNotifications`,void 0),G([P()],$.prototype,`notifications`,void 0),G([P()],$.prototype,`miningConfirmClearHistory`,void 0),G([P()],$.prototype,`miningRecentActionsPage`,void 0),G([P()],$.prototype,`miningHistoryModalOpen`,void 0),G([P()],$.prototype,`miningActivityFilter`,void 0),G([P()],$.prototype,`miningActivityWindow`,void 0),G([P()],$.prototype,`miningPlannerWindow`,void 0),G([P()],$.prototype,`miningChartMetric`,void 0),G([P()],$.prototype,`miningNowMs`,void 0),G([P()],$.prototype,`walletSettingsLoading`,void 0),G([P()],$.prototype,`walletSettingsBusy`,void 0),G([P()],$.prototype,`walletSettingsError`,void 0),G([P()],$.prototype,`walletSettingsMessage`,void 0),G([P()],$.prototype,`walletSettings`,void 0),G([P()],$.prototype,`walletSettingsValidation`,void 0),G([P()],$.prototype,`walletSkillGrantsLoading`,void 0),G([P()],$.prototype,`walletSkillGrantsError`,void 0),G([P()],$.prototype,`walletSkillGrantsMessage`,void 0),G([P()],$.prototype,`walletSkillGrantsWorkspace`,void 0),G([P()],$.prototype,`walletSkillGrantRows`,void 0),G([P()],$.prototype,`walletSkillGrantDraft`,void 0),G([P()],$.prototype,`walletSkillGrantBusy`,void 0),G([P()],$.prototype,`walletProvidersLoading`,void 0),G([P()],$.prototype,`walletProviders`,void 0),G([P()],$.prototype,`walletNamedWallets`,void 0),G([P()],$.prototype,`walletAssignments`,void 0),G([P()],$.prototype,`walletDefaultWalletId`,void 0),G([P()],$.prototype,`walletProviderSelection`,void 0),G([P()],$.prototype,`walletProviderTab`,void 0),G([P()],$.prototype,`walletMainPanel`,void 0),G([P()],$.prototype,`walletDetailsWalletId`,void 0),G([P()],$.prototype,`walletBalanceWalletId`,void 0),G([P()],$.prototype,`walletExpandedPanelWalletId`,void 0),G([P()],$.prototype,`walletExpandedPanel`,void 0),G([P()],$.prototype,`walletPolicyPanel`,void 0),G([P()],$.prototype,`walletCreateName`,void 0),G([P()],$.prototype,`walletCreateId`,void 0),G([P()],$.prototype,`walletCreateProvider`,void 0),G([P()],$.prototype,`walletCreateRole`,void 0),G([P()],$.prototype,`walletAssignAgentId`,void 0),G([P()],$.prototype,`walletAssignWalletId`,void 0),G([P()],$.prototype,`walletRpcChain`,void 0),G([P()],$.prototype,`walletPolicyCapsEnabled`,void 0),G([P()],$.prototype,`walletPolicyAutoEnabled`,void 0),G([P()],$.prototype,`walletPolicySkillsEnabled`,void 0),G([P()],$.prototype,`walletPolicySolMaxPerTx`,void 0),G([P()],$.prototype,`walletPolicySolMaxDaily`,void 0),G([P()],$.prototype,`walletPolicySolanaAllowPrograms`,void 0),G([P()],$.prototype,`walletPolicySolanaTokenCaps`,void 0),G([P()],$.prototype,`walletPolicyTokenCapMint`,void 0),G([P()],$.prototype,`walletPolicyTokenCapDecimals`,void 0),G([P()],$.prototype,`walletPolicyTokenCapMaxPerTx`,void 0),G([P()],$.prototype,`walletPolicyTokenCapMaxDaily`,void 0),G([P()],$.prototype,`walletPolicyTokenSearchQuery`,void 0),G([P()],$.prototype,`walletPolicyTokenSearchLoading`,void 0),G([P()],$.prototype,`walletPolicyTokenSearchError`,void 0),G([P()],$.prototype,`walletPolicyTokenSearchResults`,void 0),G([P()],$.prototype,`walletRecurringTransferEnabled`,void 0),G([P()],$.prototype,`walletRecurringTransferDestination`,void 0),G([P()],$.prototype,`walletRecurringTransferMint`,void 0),G([P()],$.prototype,`walletRecurringTransferAmountMode`,void 0),G([P()],$.prototype,`walletRecurringTransferAmount`,void 0),G([P()],$.prototype,`walletRecurringTransferPercentage`,void 0),G([P()],$.prototype,`walletRecurringTransferMinAmount`,void 0),G([P()],$.prototype,`walletRecurringTransferKeepAmount`,void 0),G([P()],$.prototype,`walletRecurringTransferDecimals`,void 0),G([P()],$.prototype,`walletRecurringTransferCron`,void 0),G([P()],$.prototype,`walletRecurringTransferTz`,void 0),G([P()],$.prototype,`walletRecurringTransferName`,void 0),G([P()],$.prototype,`walletSecuritySetupWalletId`,void 0),G([P()],$.prototype,`walletSecuritySetupRole`,void 0),G([P()],$.prototype,`walletRpcProvider`,void 0),G([P()],$.prototype,`walletRpcApiKey`,void 0),G([P()],$.prototype,`walletRpcUrl`,void 0),G([P()],$.prototype,`walletProviderApiKey`,void 0),G([P()],$.prototype,`walletProviderServerSignerAccessKey`,void 0),G([P()],$.prototype,`walletProviderServerSignerAccountId`,void 0),G([P()],$.prototype,`walletProviderWalletApiBaseUrl`,void 0),G([P()],$.prototype,`walletProviderSignerApiBaseUrl`,void 0),G([P()],$.prototype,`walletProviderDefaultSolanaAddress`,void 0),G([P()],$.prototype,`walletProviderCredentialsJson`,void 0),G([P()],$.prototype,`walletActionBusy`,void 0),G([P()],$.prototype,`walletActionMessage`,void 0),G([P()],$.prototype,`walletApprovalsLoading`,void 0),G([P()],$.prototype,`walletApprovalsBusyId`,void 0),G([P()],$.prototype,`walletApprovalsError`,void 0),G([P()],$.prototype,`walletApprovalsFilter`,void 0),G([P()],$.prototype,`walletApprovals`,void 0),G([P()],$.prototype,`walletAuditLoading`,void 0),G([P()],$.prototype,`walletAuditError`,void 0),G([P()],$.prototype,`walletAuditEntries`,void 0),G([P()],$.prototype,`walletActivityPage`,void 0),G([P()],$.prototype,`walletResetConfirmText`,void 0),G([P()],$.prototype,`walletSendCreateBusy`,void 0),G([P()],$.prototype,`walletSendCreateError`,void 0),G([P()],$.prototype,`walletSendCreateForm`,void 0),G([P()],$.prototype,`walletPasskeyBusy`,void 0),G([P()],$.prototype,`walletPasskeyError`,void 0),G([P()],$.prototype,`walletPasskeyLabel`,void 0),G([P()],$.prototype,`skillsLoading`,void 0),G([P()],$.prototype,`skillsReport`,void 0),G([P()],$.prototype,`skillsError`,void 0),G([P()],$.prototype,`skillsFilter`,void 0),G([P()],$.prototype,`skillsStatusFilter`,void 0),G([P()],$.prototype,`skillsLibraryPanel`,void 0),G([P()],$.prototype,`skillEdits`,void 0),G([P()],$.prototype,`skillsBusyKey`,void 0),G([P()],$.prototype,`skillMessages`,void 0),G([P()],$.prototype,`skillEnvEdits`,void 0),G([P()],$.prototype,`skillConfigEdits`,void 0),G([P()],$.prototype,`skillCreateOpen`,void 0),G([P()],$.prototype,`skillCreateName`,void 0),G([P()],$.prototype,`skillCreateDescription`,void 0),G([P()],$.prototype,`skillCreateAgentId`,void 0),G([P()],$.prototype,`skillCreateTemplate`,void 0),G([P()],$.prototype,`skillCreateBusy`,void 0),G([P()],$.prototype,`skillCreateError`,void 0),G([P()],$.prototype,`skillEditor`,void 0),G([P()],$.prototype,`skillEditorDraft`,void 0),G([P()],$.prototype,`skillEditorLoading`,void 0),G([P()],$.prototype,`skillEditorSaving`,void 0),G([P()],$.prototype,`skillEditorError`,void 0),G([P()],$.prototype,`skillsDetailKey`,void 0),G([P()],$.prototype,`skillsAttachAgentId`,void 0),G([P()],$.prototype,`clawhubSearchQuery`,void 0),G([P()],$.prototype,`clawhubSearchResults`,void 0),G([P()],$.prototype,`clawhubSearchLoading`,void 0),G([P()],$.prototype,`clawhubSearchError`,void 0),G([P()],$.prototype,`clawhubDetail`,void 0),G([P()],$.prototype,`clawhubDetailSlug`,void 0),G([P()],$.prototype,`clawhubDetailLoading`,void 0),G([P()],$.prototype,`clawhubDetailError`,void 0),G([P()],$.prototype,`clawhubInstallSlug`,void 0),G([P()],$.prototype,`clawhubInstallMessage`,void 0),G([P()],$.prototype,`clawhubReview`,void 0),G([P()],$.prototype,`clawhubReviewLoading`,void 0),G([P()],$.prototype,`clawhubReviewError`,void 0),G([P()],$.prototype,`clawhubInstallTarget`,void 0),G([P()],$.prototype,`pluginsMarketplaceLoading`,void 0),G([P()],$.prototype,`pluginsMarketplaceDetailLoading`,void 0),G([P()],$.prototype,`pluginsMarketplaceError`,void 0),G([P()],$.prototype,`pluginsMarketplaceList`,void 0),G([P()],$.prototype,`pluginsMarketplaceSelectedId`,void 0),G([P()],$.prototype,`pluginsMarketplaceDetail`,void 0),G([P()],$.prototype,`pluginsMarketplaceActionBusy`,void 0),G([P()],$.prototype,`pluginsMarketplaceMessage`,void 0),G([P()],$.prototype,`pluginsMarketplaceRemediation`,void 0),G([P()],$.prototype,`extensionsHooksLoading`,void 0),G([P()],$.prototype,`extensionsHooksError`,void 0),G([P()],$.prototype,`extensionsHooksStatus`,void 0),G([P()],$.prototype,`extensionsHooksBusyKey`,void 0),G([P()],$.prototype,`extensionsHooksMessage`,void 0),G([P()],$.prototype,`memoryLoading`,void 0),G([P()],$.prototype,`memoryError`,void 0),G([P()],$.prototype,`memoryInventory`,void 0),G([P()],$.prototype,`memoryValidation`,void 0),G([P()],$.prototype,`memoryWiki`,void 0),G([P()],$.prototype,`memoryWikiRebuilding`,void 0),G([P()],$.prototype,`memoryWikiError`,void 0),G([P()],$.prototype,`dreamingStatusLoading`,void 0),G([P()],$.prototype,`dreamingStatusError`,void 0),G([P()],$.prototype,`dreamingStatus`,void 0),G([P()],$.prototype,`dreamingModeSaving`,void 0),G([P()],$.prototype,`dreamDiaryLoading`,void 0),G([P()],$.prototype,`dreamDiaryError`,void 0),G([P()],$.prototype,`dreamDiaryPath`,void 0),G([P()],$.prototype,`dreamDiaryContent`,void 0),G([P()],$.prototype,`debugLoading`,void 0),G([P()],$.prototype,`debugStatus`,void 0),G([P()],$.prototype,`debugHealth`,void 0),G([P()],$.prototype,`debugModels`,void 0),G([P()],$.prototype,`debugModelCatalogStatus`,void 0),G([P()],$.prototype,`debugCommandsCatalog`,void 0),G([P()],$.prototype,`debugUpdateStatus`,void 0),G([P()],$.prototype,`debugPluginsMarketplace`,void 0),G([P()],$.prototype,`debugDiagnosticsStability`,void 0),G([P()],$.prototype,`debugMemoryInventory`,void 0),G([P()],$.prototype,`debugMemoryValidation`,void 0),G([P()],$.prototype,`debugMemoryRepairPreview`,void 0),G([P()],$.prototype,`debugHeartbeat`,void 0),G([P()],$.prototype,`debugCallMethod`,void 0),G([P()],$.prototype,`debugCallParams`,void 0),G([P()],$.prototype,`debugCallResult`,void 0),G([P()],$.prototype,`debugCallError`,void 0),G([P()],$.prototype,`debugAdminRpcBusy`,void 0),G([P()],$.prototype,`debugAdminRpcResult`,void 0),G([P()],$.prototype,`debugAdminRpcError`,void 0),G([P()],$.prototype,`debugAdminChatSessionKey`,void 0),G([P()],$.prototype,`debugAdminChatMessage`,void 0),G([P()],$.prototype,`debugAdminPushNodeId`,void 0),G([P()],$.prototype,`debugAdminPushTitle`,void 0),G([P()],$.prototype,`debugAdminPushBody`,void 0),G([P()],$.prototype,`debugAdminWebAccountId`,void 0),G([P()],$.prototype,`debugAcpxBridgeConfigBusy`,void 0),G([P()],$.prototype,`debugAcpxBridgeConfigResult`,void 0),G([P()],$.prototype,`debugAcpxBridgeConfigError`,void 0),G([P()],$.prototype,`debugAcpxPushTestBusy`,void 0),G([P()],$.prototype,`debugAcpxPushTestPreview`,void 0),G([P()],$.prototype,`debugAcpxPushTestAuditHistory`,void 0),G([P()],$.prototype,`debugAcpxPushTestResult`,void 0),G([P()],$.prototype,`debugAcpxPushTestError`,void 0),G([P()],$.prototype,`debugSatProtocolMaintenanceBusy`,void 0),G([P()],$.prototype,`debugSatProtocolMaintenanceResult`,void 0),G([P()],$.prototype,`debugSatProtocolMaintenanceError`,void 0),G([P()],$.prototype,`logsLoading`,void 0),G([P()],$.prototype,`logsError`,void 0),G([P()],$.prototype,`logsFile`,void 0),G([P()],$.prototype,`logsEntries`,void 0),G([P()],$.prototype,`logsFilterText`,void 0),G([P()],$.prototype,`logsLevelFilters`,void 0),G([P()],$.prototype,`logsAutoFollow`,void 0),G([P()],$.prototype,`logsTruncated`,void 0),G([P()],$.prototype,`logsCursor`,void 0),G([P()],$.prototype,`logsLastFetchAt`,void 0),G([P()],$.prototype,`logsLimit`,void 0),G([P()],$.prototype,`logsMaxBytes`,void 0),G([P()],$.prototype,`logsAtBottom`,void 0),G([P()],$.prototype,`chatNewMessagesBelow`,void 0),$=G([Ze(`fased-app`)],$);
|
|
25464
|
-
//# sourceMappingURL=app-
|
|
25464
|
+
//# sourceMappingURL=app-De8gTtZU.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./app-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./app-De8gTtZU.js","./icons-D3-vEvih.js","./open-external-url-ulF1B-sA.js","./marketplace-order-evidence-DkR0ZRHa.js","./mining-commit-DFpB_4JN.js","./chat-model-ref-Djkv93yn.js","./task-ledger-source-route-C-yTp0QU.js","./wallet-policy-C3ZS66Rl.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
(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)}})();var e={"entry-loaded":10,"app-import-start":20,"app-imported":30,"custom-element-defined":40,connected:50,"first-updated":60,rendered:70,"boot-failed":100};function t(t,n){if(typeof window>`u`)return;let r=window.__FASED_CONTROL_UI_BOOT=window.__FASED_CONTROL_UI_BOOT??{},i=e[r.stage]??0;e[t]<i&&r.stage!==`boot-failed`||(r.stage=t,r.detail=n??``,r.updatedAt=Date.now(),typeof r.mark==`function`&&r.mark(t,n),typeof window.dispatchEvent==`function`&&typeof CustomEvent==`function`&&window.dispatchEvent(new CustomEvent(`fased-control-ui-boot`,{detail:{stage:t,detail:n??``}})))}var n=`modulepreload`,r=function(e,t){return new URL(e,t).href},i={},a=function(e,t,a){let o=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),s=document.querySelector(`meta[property=csp-nonce]`),c=s?.nonce||s?.getAttribute(`nonce`);function l(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function u(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,new URL(`../../../src/node/plugins/importAnalysisBuild.ts`,import.meta.url)).href}o=l(t.map(t=>{if(t=r(t,a),t=u(t),t in i)return;i[t]=!0;let o=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.href===t&&(!o||r.rel===`stylesheet`))return}let s=document.createElement(`link`);if(s.rel=o?`stylesheet`:n,o||(s.as=`script`),s.crossOrigin=``,s.href=t,c&&s.setAttribute(`nonce`,c),document.head.appendChild(s),o)return new Promise((e,n)=>{s.addEventListener(`load`,e),s.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function s(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return o.then(t=>{for(let e of t||[])e.status===`rejected`&&s(e.reason);return e().catch(s)})};function o(e){let n=e instanceof Error?e.stack??e.message:String(e);t(`boot-failed`,n||`Unknown dashboard boot error.`);let r=document.querySelector(`fased-app`);if(!r)return;r.innerHTML=``;let i=document.createElement(`style`);i.textContent=`
|
|
3
3
|
body {
|
|
4
4
|
margin: 0;
|
|
@@ -57,5 +57,5 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./app-DYxADzeH.js","./
|
|
|
57
57
|
font-weight: 650;
|
|
58
58
|
cursor: pointer;
|
|
59
59
|
}
|
|
60
|
-
`;let a=document.createElement(`div`);a.className=`boot-page`;let o=document.createElement(`section`);o.className=`boot-card`;let s=document.createElement(`h1`);s.className=`boot-title`,s.textContent=`Dashboard bundle could not load`;let c=document.createElement(`p`);c.className=`boot-desc`,c.textContent=`The gateway page loaded, but the browser could not start the dashboard bundle. Reload first. If it keeps happening after an update, clear this site's browser data and sign in again.`;let l=document.createElement(`div`);l.className=`boot-error`,l.textContent=n||`Unknown dashboard boot error.`;let u=document.createElement(`button`);u.className=`boot-button`,u.textContent=`Reload`,u.addEventListener(`click`,()=>window.location.reload()),o.append(s,c,l,u),a.append(o),r.append(i,a)}t(`entry-loaded`),t(`app-import-start`),a(()=>import(`./app-
|
|
61
|
-
//# sourceMappingURL=index-
|
|
60
|
+
`;let a=document.createElement(`div`);a.className=`boot-page`;let o=document.createElement(`section`);o.className=`boot-card`;let s=document.createElement(`h1`);s.className=`boot-title`,s.textContent=`Dashboard bundle could not load`;let c=document.createElement(`p`);c.className=`boot-desc`,c.textContent=`The gateway page loaded, but the browser could not start the dashboard bundle. Reload first. If it keeps happening after an update, clear this site's browser data and sign in again.`;let l=document.createElement(`div`);l.className=`boot-error`,l.textContent=n||`Unknown dashboard boot error.`;let u=document.createElement(`button`);u.className=`boot-button`,u.textContent=`Reload`,u.addEventListener(`click`,()=>window.location.reload()),o.append(s,c,l,u),a.append(o),r.append(i,a)}t(`entry-loaded`),t(`app-import-start`),a(()=>import(`./app-De8gTtZU.js`).then(()=>t(`app-imported`)),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url).catch(o);export{t as n,a as t};
|
|
61
|
+
//# sourceMappingURL=index-DYYBRBOS.js.map
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<link rel="icon" type="image/png" sizes="32x32" href="./favicon-32.png" />
|
|
15
15
|
<link rel="apple-touch-icon" sizes="180x180" href="./apple-touch-icon.png" />
|
|
16
16
|
<script data-fased-boot-watchdog src="./boot-watchdog.js" defer></script>
|
|
17
|
-
<script type="module" crossorigin src="./assets/index-
|
|
17
|
+
<script type="module" crossorigin src="./assets/index-DYYBRBOS.js"></script>
|
|
18
18
|
<link rel="stylesheet" crossorigin href="./assets/index-RwVraC3c.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.1.
|
|
1
|
+
{"version":"0.1.67"}
|