@solana-agent-wallet-adapter/cli 0.1.0 → 0.2.0
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/dist/index.js +1122 -221
- package/dist/index.js.map +4 -4
- package/dist/wallet-host/assets/index-BF6JLAtr.js +3215 -0
- package/dist/wallet-host/assets/index-dftlursl.css +1 -0
- package/dist/wallet-host/assets/{mobile-wallet-adapter-CqDJSDZ5.js → mobile-wallet-adapter-B8zYDJwO.js} +1 -1
- package/dist/wallet-host/assets/solana-runtime-CsPLEN69.js +13 -0
- package/dist/wallet-host/assets/{wallet-standard-eoxEevjj.js → wallet-standard-CIBAN9Xp.js} +1 -1
- package/dist/wallet-host/index.html +5 -8
- package/dist/wallet-host/manifest.webmanifest +2 -13
- package/package.json +1 -1
- package/dist/wallet-host/assets/index-D5ySS2CU.js +0 -2143
- package/dist/wallet-host/assets/index-ZynMhs1G.css +0 -1
- package/dist/wallet-host/assets/solana-runtime-BhiDfU5_.js +0 -20
|
@@ -0,0 +1,3215 @@
|
|
|
1
|
+
var Vd=Object.defineProperty;var Jd=(e,t,r)=>t in e?Vd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Pr=(e,t,r)=>Jd(e,typeof t!="symbol"?t+"":t,r);import{P as $t,j as ra,h as Zd,l as Qd,W as Xd}from"./wallet-standard-CIBAN9Xp.js";import{r as eu,g as tu,P as Js,C as oo,T as ru,a as au}from"./solana-runtime-CsPLEN69.js";import{d as nu,r as iu}from"./mobile-wallet-adapter-B8zYDJwO.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&n(d)}).observe(document,{childList:!0,subtree:!0});function r(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function n(o){if(o.ep)return;o.ep=!0;const c=r(o);fetch(o.href,c)}})();function ou(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Zs={exports:{}};(function(e){(function(t){var r=function(l){var p,u=new Float64Array(16);if(l)for(p=0;p<l.length;p++)u[p]=l[p];return u},n=function(){throw new Error("no PRNG")},o=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var d=r(),m=r([1]),A=r([56129,1]),$=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),R=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),F=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),pe=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),we=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function Ce(l,p,u,i){l[p]=u>>24&255,l[p+1]=u>>16&255,l[p+2]=u>>8&255,l[p+3]=u&255,l[p+4]=i>>24&255,l[p+5]=i>>16&255,l[p+6]=i>>8&255,l[p+7]=i&255}function Le(l,p,u,i,f){var y,v=0;for(y=0;y<f;y++)v|=l[p+y]^u[i+y];return(1&v-1>>>8)-1}function Me(l,p,u,i){return Le(l,p,u,i,16)}function Ue(l,p,u,i){return Le(l,p,u,i,32)}function Ze(l,p,u,i){for(var f=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,y=u[0]&255|(u[1]&255)<<8|(u[2]&255)<<16|(u[3]&255)<<24,v=u[4]&255|(u[5]&255)<<8|(u[6]&255)<<16|(u[7]&255)<<24,k=u[8]&255|(u[9]&255)<<8|(u[10]&255)<<16|(u[11]&255)<<24,E=u[12]&255|(u[13]&255)<<8|(u[14]&255)<<16|(u[15]&255)<<24,j=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,D=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,he=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,W=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,V=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,J=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,ae=u[16]&255|(u[17]&255)<<8|(u[18]&255)<<16|(u[19]&255)<<24,re=u[20]&255|(u[21]&255)<<8|(u[22]&255)<<16|(u[23]&255)<<24,Z=u[24]&255|(u[25]&255)<<8|(u[26]&255)<<16|(u[27]&255)<<24,ee=u[28]&255|(u[29]&255)<<8|(u[30]&255)<<16|(u[31]&255)<<24,Q=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,U=f,z=y,N=v,q=k,B=E,O=j,b=D,w=he,C=W,x=V,P=J,I=ae,K=re,ne=Z,oe=ee,ie=Q,g,ce=0;ce<20;ce+=2)g=U+K|0,B^=g<<7|g>>>25,g=B+U|0,C^=g<<9|g>>>23,g=C+B|0,K^=g<<13|g>>>19,g=K+C|0,U^=g<<18|g>>>14,g=O+z|0,x^=g<<7|g>>>25,g=x+O|0,ne^=g<<9|g>>>23,g=ne+x|0,z^=g<<13|g>>>19,g=z+ne|0,O^=g<<18|g>>>14,g=P+b|0,oe^=g<<7|g>>>25,g=oe+P|0,N^=g<<9|g>>>23,g=N+oe|0,b^=g<<13|g>>>19,g=b+N|0,P^=g<<18|g>>>14,g=ie+I|0,q^=g<<7|g>>>25,g=q+ie|0,w^=g<<9|g>>>23,g=w+q|0,I^=g<<13|g>>>19,g=I+w|0,ie^=g<<18|g>>>14,g=U+q|0,z^=g<<7|g>>>25,g=z+U|0,N^=g<<9|g>>>23,g=N+z|0,q^=g<<13|g>>>19,g=q+N|0,U^=g<<18|g>>>14,g=O+B|0,b^=g<<7|g>>>25,g=b+O|0,w^=g<<9|g>>>23,g=w+b|0,B^=g<<13|g>>>19,g=B+w|0,O^=g<<18|g>>>14,g=P+x|0,I^=g<<7|g>>>25,g=I+P|0,C^=g<<9|g>>>23,g=C+I|0,x^=g<<13|g>>>19,g=x+C|0,P^=g<<18|g>>>14,g=ie+oe|0,K^=g<<7|g>>>25,g=K+ie|0,ne^=g<<9|g>>>23,g=ne+K|0,oe^=g<<13|g>>>19,g=oe+ne|0,ie^=g<<18|g>>>14;U=U+f|0,z=z+y|0,N=N+v|0,q=q+k|0,B=B+E|0,O=O+j|0,b=b+D|0,w=w+he|0,C=C+W|0,x=x+V|0,P=P+J|0,I=I+ae|0,K=K+re|0,ne=ne+Z|0,oe=oe+ee|0,ie=ie+Q|0,l[0]=U>>>0&255,l[1]=U>>>8&255,l[2]=U>>>16&255,l[3]=U>>>24&255,l[4]=z>>>0&255,l[5]=z>>>8&255,l[6]=z>>>16&255,l[7]=z>>>24&255,l[8]=N>>>0&255,l[9]=N>>>8&255,l[10]=N>>>16&255,l[11]=N>>>24&255,l[12]=q>>>0&255,l[13]=q>>>8&255,l[14]=q>>>16&255,l[15]=q>>>24&255,l[16]=B>>>0&255,l[17]=B>>>8&255,l[18]=B>>>16&255,l[19]=B>>>24&255,l[20]=O>>>0&255,l[21]=O>>>8&255,l[22]=O>>>16&255,l[23]=O>>>24&255,l[24]=b>>>0&255,l[25]=b>>>8&255,l[26]=b>>>16&255,l[27]=b>>>24&255,l[28]=w>>>0&255,l[29]=w>>>8&255,l[30]=w>>>16&255,l[31]=w>>>24&255,l[32]=C>>>0&255,l[33]=C>>>8&255,l[34]=C>>>16&255,l[35]=C>>>24&255,l[36]=x>>>0&255,l[37]=x>>>8&255,l[38]=x>>>16&255,l[39]=x>>>24&255,l[40]=P>>>0&255,l[41]=P>>>8&255,l[42]=P>>>16&255,l[43]=P>>>24&255,l[44]=I>>>0&255,l[45]=I>>>8&255,l[46]=I>>>16&255,l[47]=I>>>24&255,l[48]=K>>>0&255,l[49]=K>>>8&255,l[50]=K>>>16&255,l[51]=K>>>24&255,l[52]=ne>>>0&255,l[53]=ne>>>8&255,l[54]=ne>>>16&255,l[55]=ne>>>24&255,l[56]=oe>>>0&255,l[57]=oe>>>8&255,l[58]=oe>>>16&255,l[59]=oe>>>24&255,l[60]=ie>>>0&255,l[61]=ie>>>8&255,l[62]=ie>>>16&255,l[63]=ie>>>24&255}function xe(l,p,u,i){for(var f=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,y=u[0]&255|(u[1]&255)<<8|(u[2]&255)<<16|(u[3]&255)<<24,v=u[4]&255|(u[5]&255)<<8|(u[6]&255)<<16|(u[7]&255)<<24,k=u[8]&255|(u[9]&255)<<8|(u[10]&255)<<16|(u[11]&255)<<24,E=u[12]&255|(u[13]&255)<<8|(u[14]&255)<<16|(u[15]&255)<<24,j=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,D=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,he=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,W=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,V=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,J=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,ae=u[16]&255|(u[17]&255)<<8|(u[18]&255)<<16|(u[19]&255)<<24,re=u[20]&255|(u[21]&255)<<8|(u[22]&255)<<16|(u[23]&255)<<24,Z=u[24]&255|(u[25]&255)<<8|(u[26]&255)<<16|(u[27]&255)<<24,ee=u[28]&255|(u[29]&255)<<8|(u[30]&255)<<16|(u[31]&255)<<24,Q=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,U=f,z=y,N=v,q=k,B=E,O=j,b=D,w=he,C=W,x=V,P=J,I=ae,K=re,ne=Z,oe=ee,ie=Q,g,ce=0;ce<20;ce+=2)g=U+K|0,B^=g<<7|g>>>25,g=B+U|0,C^=g<<9|g>>>23,g=C+B|0,K^=g<<13|g>>>19,g=K+C|0,U^=g<<18|g>>>14,g=O+z|0,x^=g<<7|g>>>25,g=x+O|0,ne^=g<<9|g>>>23,g=ne+x|0,z^=g<<13|g>>>19,g=z+ne|0,O^=g<<18|g>>>14,g=P+b|0,oe^=g<<7|g>>>25,g=oe+P|0,N^=g<<9|g>>>23,g=N+oe|0,b^=g<<13|g>>>19,g=b+N|0,P^=g<<18|g>>>14,g=ie+I|0,q^=g<<7|g>>>25,g=q+ie|0,w^=g<<9|g>>>23,g=w+q|0,I^=g<<13|g>>>19,g=I+w|0,ie^=g<<18|g>>>14,g=U+q|0,z^=g<<7|g>>>25,g=z+U|0,N^=g<<9|g>>>23,g=N+z|0,q^=g<<13|g>>>19,g=q+N|0,U^=g<<18|g>>>14,g=O+B|0,b^=g<<7|g>>>25,g=b+O|0,w^=g<<9|g>>>23,g=w+b|0,B^=g<<13|g>>>19,g=B+w|0,O^=g<<18|g>>>14,g=P+x|0,I^=g<<7|g>>>25,g=I+P|0,C^=g<<9|g>>>23,g=C+I|0,x^=g<<13|g>>>19,g=x+C|0,P^=g<<18|g>>>14,g=ie+oe|0,K^=g<<7|g>>>25,g=K+ie|0,ne^=g<<9|g>>>23,g=ne+K|0,oe^=g<<13|g>>>19,g=oe+ne|0,ie^=g<<18|g>>>14;l[0]=U>>>0&255,l[1]=U>>>8&255,l[2]=U>>>16&255,l[3]=U>>>24&255,l[4]=O>>>0&255,l[5]=O>>>8&255,l[6]=O>>>16&255,l[7]=O>>>24&255,l[8]=P>>>0&255,l[9]=P>>>8&255,l[10]=P>>>16&255,l[11]=P>>>24&255,l[12]=ie>>>0&255,l[13]=ie>>>8&255,l[14]=ie>>>16&255,l[15]=ie>>>24&255,l[16]=b>>>0&255,l[17]=b>>>8&255,l[18]=b>>>16&255,l[19]=b>>>24&255,l[20]=w>>>0&255,l[21]=w>>>8&255,l[22]=w>>>16&255,l[23]=w>>>24&255,l[24]=C>>>0&255,l[25]=C>>>8&255,l[26]=C>>>16&255,l[27]=C>>>24&255,l[28]=x>>>0&255,l[29]=x>>>8&255,l[30]=x>>>16&255,l[31]=x>>>24&255}function mt(l,p,u,i){Ze(l,p,u,i)}function ht(l,p,u,i){xe(l,p,u,i)}var at=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Se(l,p,u,i,f,y,v){var k=new Uint8Array(16),E=new Uint8Array(64),j,D;for(D=0;D<16;D++)k[D]=0;for(D=0;D<8;D++)k[D]=y[D];for(;f>=64;){for(mt(E,k,v,at),D=0;D<64;D++)l[p+D]=u[i+D]^E[D];for(j=1,D=8;D<16;D++)j=j+(k[D]&255)|0,k[D]=j&255,j>>>=8;f-=64,p+=64,i+=64}if(f>0)for(mt(E,k,v,at),D=0;D<f;D++)l[p+D]=u[i+D]^E[D];return 0}function nt(l,p,u,i,f){var y=new Uint8Array(16),v=new Uint8Array(64),k,E;for(E=0;E<16;E++)y[E]=0;for(E=0;E<8;E++)y[E]=i[E];for(;u>=64;){for(mt(v,y,f,at),E=0;E<64;E++)l[p+E]=v[E];for(k=1,E=8;E<16;E++)k=k+(y[E]&255)|0,y[E]=k&255,k>>>=8;u-=64,p+=64}if(u>0)for(mt(v,y,f,at),E=0;E<u;E++)l[p+E]=v[E];return 0}function Mt(l,p,u,i,f){var y=new Uint8Array(32);ht(y,i,f,at);for(var v=new Uint8Array(8),k=0;k<8;k++)v[k]=i[k+16];return nt(l,p,u,v,y)}function Ut(l,p,u,i,f,y,v){var k=new Uint8Array(32);ht(k,y,v,at);for(var E=new Uint8Array(8),j=0;j<8;j++)E[j]=y[j+16];return Se(l,p,u,i,f,E,k)}var qt=function(l){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var p,u,i,f,y,v,k,E;p=l[0]&255|(l[1]&255)<<8,this.r[0]=p&8191,u=l[2]&255|(l[3]&255)<<8,this.r[1]=(p>>>13|u<<3)&8191,i=l[4]&255|(l[5]&255)<<8,this.r[2]=(u>>>10|i<<6)&7939,f=l[6]&255|(l[7]&255)<<8,this.r[3]=(i>>>7|f<<9)&8191,y=l[8]&255|(l[9]&255)<<8,this.r[4]=(f>>>4|y<<12)&255,this.r[5]=y>>>1&8190,v=l[10]&255|(l[11]&255)<<8,this.r[6]=(y>>>14|v<<2)&8191,k=l[12]&255|(l[13]&255)<<8,this.r[7]=(v>>>11|k<<5)&8065,E=l[14]&255|(l[15]&255)<<8,this.r[8]=(k>>>8|E<<8)&8191,this.r[9]=E>>>5&127,this.pad[0]=l[16]&255|(l[17]&255)<<8,this.pad[1]=l[18]&255|(l[19]&255)<<8,this.pad[2]=l[20]&255|(l[21]&255)<<8,this.pad[3]=l[22]&255|(l[23]&255)<<8,this.pad[4]=l[24]&255|(l[25]&255)<<8,this.pad[5]=l[26]&255|(l[27]&255)<<8,this.pad[6]=l[28]&255|(l[29]&255)<<8,this.pad[7]=l[30]&255|(l[31]&255)<<8};qt.prototype.blocks=function(l,p,u){for(var i=this.fin?0:2048,f,y,v,k,E,j,D,he,W,V,J,ae,re,Z,ee,Q,U,z,N,q=this.h[0],B=this.h[1],O=this.h[2],b=this.h[3],w=this.h[4],C=this.h[5],x=this.h[6],P=this.h[7],I=this.h[8],K=this.h[9],ne=this.r[0],oe=this.r[1],ie=this.r[2],g=this.r[3],ce=this.r[4],ye=this.r[5],ve=this.r[6],le=this.r[7],ge=this.r[8],me=this.r[9];u>=16;)f=l[p+0]&255|(l[p+1]&255)<<8,q+=f&8191,y=l[p+2]&255|(l[p+3]&255)<<8,B+=(f>>>13|y<<3)&8191,v=l[p+4]&255|(l[p+5]&255)<<8,O+=(y>>>10|v<<6)&8191,k=l[p+6]&255|(l[p+7]&255)<<8,b+=(v>>>7|k<<9)&8191,E=l[p+8]&255|(l[p+9]&255)<<8,w+=(k>>>4|E<<12)&8191,C+=E>>>1&8191,j=l[p+10]&255|(l[p+11]&255)<<8,x+=(E>>>14|j<<2)&8191,D=l[p+12]&255|(l[p+13]&255)<<8,P+=(j>>>11|D<<5)&8191,he=l[p+14]&255|(l[p+15]&255)<<8,I+=(D>>>8|he<<8)&8191,K+=he>>>5|i,W=0,V=W,V+=q*ne,V+=B*(5*me),V+=O*(5*ge),V+=b*(5*le),V+=w*(5*ve),W=V>>>13,V&=8191,V+=C*(5*ye),V+=x*(5*ce),V+=P*(5*g),V+=I*(5*ie),V+=K*(5*oe),W+=V>>>13,V&=8191,J=W,J+=q*oe,J+=B*ne,J+=O*(5*me),J+=b*(5*ge),J+=w*(5*le),W=J>>>13,J&=8191,J+=C*(5*ve),J+=x*(5*ye),J+=P*(5*ce),J+=I*(5*g),J+=K*(5*ie),W+=J>>>13,J&=8191,ae=W,ae+=q*ie,ae+=B*oe,ae+=O*ne,ae+=b*(5*me),ae+=w*(5*ge),W=ae>>>13,ae&=8191,ae+=C*(5*le),ae+=x*(5*ve),ae+=P*(5*ye),ae+=I*(5*ce),ae+=K*(5*g),W+=ae>>>13,ae&=8191,re=W,re+=q*g,re+=B*ie,re+=O*oe,re+=b*ne,re+=w*(5*me),W=re>>>13,re&=8191,re+=C*(5*ge),re+=x*(5*le),re+=P*(5*ve),re+=I*(5*ye),re+=K*(5*ce),W+=re>>>13,re&=8191,Z=W,Z+=q*ce,Z+=B*g,Z+=O*ie,Z+=b*oe,Z+=w*ne,W=Z>>>13,Z&=8191,Z+=C*(5*me),Z+=x*(5*ge),Z+=P*(5*le),Z+=I*(5*ve),Z+=K*(5*ye),W+=Z>>>13,Z&=8191,ee=W,ee+=q*ye,ee+=B*ce,ee+=O*g,ee+=b*ie,ee+=w*oe,W=ee>>>13,ee&=8191,ee+=C*ne,ee+=x*(5*me),ee+=P*(5*ge),ee+=I*(5*le),ee+=K*(5*ve),W+=ee>>>13,ee&=8191,Q=W,Q+=q*ve,Q+=B*ye,Q+=O*ce,Q+=b*g,Q+=w*ie,W=Q>>>13,Q&=8191,Q+=C*oe,Q+=x*ne,Q+=P*(5*me),Q+=I*(5*ge),Q+=K*(5*le),W+=Q>>>13,Q&=8191,U=W,U+=q*le,U+=B*ve,U+=O*ye,U+=b*ce,U+=w*g,W=U>>>13,U&=8191,U+=C*ie,U+=x*oe,U+=P*ne,U+=I*(5*me),U+=K*(5*ge),W+=U>>>13,U&=8191,z=W,z+=q*ge,z+=B*le,z+=O*ve,z+=b*ye,z+=w*ce,W=z>>>13,z&=8191,z+=C*g,z+=x*ie,z+=P*oe,z+=I*ne,z+=K*(5*me),W+=z>>>13,z&=8191,N=W,N+=q*me,N+=B*ge,N+=O*le,N+=b*ve,N+=w*ye,W=N>>>13,N&=8191,N+=C*ce,N+=x*g,N+=P*ie,N+=I*oe,N+=K*ne,W+=N>>>13,N&=8191,W=(W<<2)+W|0,W=W+V|0,V=W&8191,W=W>>>13,J+=W,q=V,B=J,O=ae,b=re,w=Z,C=ee,x=Q,P=U,I=z,K=N,p+=16,u-=16;this.h[0]=q,this.h[1]=B,this.h[2]=O,this.h[3]=b,this.h[4]=w,this.h[5]=C,this.h[6]=x,this.h[7]=P,this.h[8]=I,this.h[9]=K},qt.prototype.finish=function(l,p){var u=new Uint16Array(10),i,f,y,v;if(this.leftover){for(v=this.leftover,this.buffer[v++]=1;v<16;v++)this.buffer[v]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(i=this.h[1]>>>13,this.h[1]&=8191,v=2;v<10;v++)this.h[v]+=i,i=this.h[v]>>>13,this.h[v]&=8191;for(this.h[0]+=i*5,i=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=i,i=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=i,u[0]=this.h[0]+5,i=u[0]>>>13,u[0]&=8191,v=1;v<10;v++)u[v]=this.h[v]+i,i=u[v]>>>13,u[v]&=8191;for(u[9]-=8192,f=(i^1)-1,v=0;v<10;v++)u[v]&=f;for(f=~f,v=0;v<10;v++)this.h[v]=this.h[v]&f|u[v];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,y=this.h[0]+this.pad[0],this.h[0]=y&65535,v=1;v<8;v++)y=(this.h[v]+this.pad[v]|0)+(y>>>16)|0,this.h[v]=y&65535;l[p+0]=this.h[0]>>>0&255,l[p+1]=this.h[0]>>>8&255,l[p+2]=this.h[1]>>>0&255,l[p+3]=this.h[1]>>>8&255,l[p+4]=this.h[2]>>>0&255,l[p+5]=this.h[2]>>>8&255,l[p+6]=this.h[3]>>>0&255,l[p+7]=this.h[3]>>>8&255,l[p+8]=this.h[4]>>>0&255,l[p+9]=this.h[4]>>>8&255,l[p+10]=this.h[5]>>>0&255,l[p+11]=this.h[5]>>>8&255,l[p+12]=this.h[6]>>>0&255,l[p+13]=this.h[6]>>>8&255,l[p+14]=this.h[7]>>>0&255,l[p+15]=this.h[7]>>>8&255},qt.prototype.update=function(l,p,u){var i,f;if(this.leftover){for(f=16-this.leftover,f>u&&(f=u),i=0;i<f;i++)this.buffer[this.leftover+i]=l[p+i];if(u-=f,p+=f,this.leftover+=f,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(u>=16&&(f=u-u%16,this.blocks(l,p,f),p+=f,u-=f),u){for(i=0;i<u;i++)this.buffer[this.leftover+i]=l[p+i];this.leftover+=u}};function ar(l,p,u,i,f,y){var v=new qt(y);return v.update(u,i,f),v.finish(l,p),0}function wr(l,p,u,i,f,y){var v=new Uint8Array(16);return ar(v,0,u,i,f,y),Me(l,p,v,0)}function Wr(l,p,u,i,f){var y;if(u<32)return-1;for(Ut(l,0,p,0,u,i,f),ar(l,16,l,32,u-32,l),y=0;y<16;y++)l[y]=0;return 0}function Mr(l,p,u,i,f){var y,v=new Uint8Array(32);if(u<32||(Mt(v,0,32,i,f),wr(p,16,p,32,u-32,v)!==0))return-1;for(Ut(l,0,p,0,u,i,f),y=0;y<32;y++)l[y]=0;return 0}function yt(l,p){var u;for(u=0;u<16;u++)l[u]=p[u]|0}function Ur(l){var p,u,i=1;for(p=0;p<16;p++)u=l[p]+i+65535,i=Math.floor(u/65536),l[p]=u-i*65536;l[0]+=i-1+37*(i-1)}function Bt(l,p,u){for(var i,f=~(u-1),y=0;y<16;y++)i=f&(l[y]^p[y]),l[y]^=i,p[y]^=i}function Ft(l,p){var u,i,f,y=r(),v=r();for(u=0;u<16;u++)v[u]=p[u];for(Ur(v),Ur(v),Ur(v),i=0;i<2;i++){for(y[0]=v[0]-65517,u=1;u<15;u++)y[u]=v[u]-65535-(y[u-1]>>16&1),y[u-1]&=65535;y[15]=v[15]-32767-(y[14]>>16&1),f=y[15]>>16&1,y[14]&=65535,Bt(v,y,1-f)}for(u=0;u<16;u++)l[2*u]=v[u]&255,l[2*u+1]=v[u]>>8}function $a(l,p){var u=new Uint8Array(32),i=new Uint8Array(32);return Ft(u,l),Ft(i,p),Ue(u,0,i,0)}function xa(l){var p=new Uint8Array(32);return Ft(p,l),p[0]&1}function qr(l,p){var u;for(u=0;u<16;u++)l[u]=p[2*u]+(p[2*u+1]<<8);l[15]&=32767}function it(l,p,u){for(var i=0;i<16;i++)l[i]=p[i]+u[i]}function ot(l,p,u){for(var i=0;i<16;i++)l[i]=p[i]-u[i]}function de(l,p,u){var i,f,y=0,v=0,k=0,E=0,j=0,D=0,he=0,W=0,V=0,J=0,ae=0,re=0,Z=0,ee=0,Q=0,U=0,z=0,N=0,q=0,B=0,O=0,b=0,w=0,C=0,x=0,P=0,I=0,K=0,ne=0,oe=0,ie=0,g=u[0],ce=u[1],ye=u[2],ve=u[3],le=u[4],ge=u[5],me=u[6],_e=u[7],Ae=u[8],Te=u[9],Ie=u[10],Re=u[11],We=u[12],Ge=u[13],Ke=u[14],Ye=u[15];i=p[0],y+=i*g,v+=i*ce,k+=i*ye,E+=i*ve,j+=i*le,D+=i*ge,he+=i*me,W+=i*_e,V+=i*Ae,J+=i*Te,ae+=i*Ie,re+=i*Re,Z+=i*We,ee+=i*Ge,Q+=i*Ke,U+=i*Ye,i=p[1],v+=i*g,k+=i*ce,E+=i*ye,j+=i*ve,D+=i*le,he+=i*ge,W+=i*me,V+=i*_e,J+=i*Ae,ae+=i*Te,re+=i*Ie,Z+=i*Re,ee+=i*We,Q+=i*Ge,U+=i*Ke,z+=i*Ye,i=p[2],k+=i*g,E+=i*ce,j+=i*ye,D+=i*ve,he+=i*le,W+=i*ge,V+=i*me,J+=i*_e,ae+=i*Ae,re+=i*Te,Z+=i*Ie,ee+=i*Re,Q+=i*We,U+=i*Ge,z+=i*Ke,N+=i*Ye,i=p[3],E+=i*g,j+=i*ce,D+=i*ye,he+=i*ve,W+=i*le,V+=i*ge,J+=i*me,ae+=i*_e,re+=i*Ae,Z+=i*Te,ee+=i*Ie,Q+=i*Re,U+=i*We,z+=i*Ge,N+=i*Ke,q+=i*Ye,i=p[4],j+=i*g,D+=i*ce,he+=i*ye,W+=i*ve,V+=i*le,J+=i*ge,ae+=i*me,re+=i*_e,Z+=i*Ae,ee+=i*Te,Q+=i*Ie,U+=i*Re,z+=i*We,N+=i*Ge,q+=i*Ke,B+=i*Ye,i=p[5],D+=i*g,he+=i*ce,W+=i*ye,V+=i*ve,J+=i*le,ae+=i*ge,re+=i*me,Z+=i*_e,ee+=i*Ae,Q+=i*Te,U+=i*Ie,z+=i*Re,N+=i*We,q+=i*Ge,B+=i*Ke,O+=i*Ye,i=p[6],he+=i*g,W+=i*ce,V+=i*ye,J+=i*ve,ae+=i*le,re+=i*ge,Z+=i*me,ee+=i*_e,Q+=i*Ae,U+=i*Te,z+=i*Ie,N+=i*Re,q+=i*We,B+=i*Ge,O+=i*Ke,b+=i*Ye,i=p[7],W+=i*g,V+=i*ce,J+=i*ye,ae+=i*ve,re+=i*le,Z+=i*ge,ee+=i*me,Q+=i*_e,U+=i*Ae,z+=i*Te,N+=i*Ie,q+=i*Re,B+=i*We,O+=i*Ge,b+=i*Ke,w+=i*Ye,i=p[8],V+=i*g,J+=i*ce,ae+=i*ye,re+=i*ve,Z+=i*le,ee+=i*ge,Q+=i*me,U+=i*_e,z+=i*Ae,N+=i*Te,q+=i*Ie,B+=i*Re,O+=i*We,b+=i*Ge,w+=i*Ke,C+=i*Ye,i=p[9],J+=i*g,ae+=i*ce,re+=i*ye,Z+=i*ve,ee+=i*le,Q+=i*ge,U+=i*me,z+=i*_e,N+=i*Ae,q+=i*Te,B+=i*Ie,O+=i*Re,b+=i*We,w+=i*Ge,C+=i*Ke,x+=i*Ye,i=p[10],ae+=i*g,re+=i*ce,Z+=i*ye,ee+=i*ve,Q+=i*le,U+=i*ge,z+=i*me,N+=i*_e,q+=i*Ae,B+=i*Te,O+=i*Ie,b+=i*Re,w+=i*We,C+=i*Ge,x+=i*Ke,P+=i*Ye,i=p[11],re+=i*g,Z+=i*ce,ee+=i*ye,Q+=i*ve,U+=i*le,z+=i*ge,N+=i*me,q+=i*_e,B+=i*Ae,O+=i*Te,b+=i*Ie,w+=i*Re,C+=i*We,x+=i*Ge,P+=i*Ke,I+=i*Ye,i=p[12],Z+=i*g,ee+=i*ce,Q+=i*ye,U+=i*ve,z+=i*le,N+=i*ge,q+=i*me,B+=i*_e,O+=i*Ae,b+=i*Te,w+=i*Ie,C+=i*Re,x+=i*We,P+=i*Ge,I+=i*Ke,K+=i*Ye,i=p[13],ee+=i*g,Q+=i*ce,U+=i*ye,z+=i*ve,N+=i*le,q+=i*ge,B+=i*me,O+=i*_e,b+=i*Ae,w+=i*Te,C+=i*Ie,x+=i*Re,P+=i*We,I+=i*Ge,K+=i*Ke,ne+=i*Ye,i=p[14],Q+=i*g,U+=i*ce,z+=i*ye,N+=i*ve,q+=i*le,B+=i*ge,O+=i*me,b+=i*_e,w+=i*Ae,C+=i*Te,x+=i*Ie,P+=i*Re,I+=i*We,K+=i*Ge,ne+=i*Ke,oe+=i*Ye,i=p[15],U+=i*g,z+=i*ce,N+=i*ye,q+=i*ve,B+=i*le,O+=i*ge,b+=i*me,w+=i*_e,C+=i*Ae,x+=i*Te,P+=i*Ie,I+=i*Re,K+=i*We,ne+=i*Ge,oe+=i*Ke,ie+=i*Ye,y+=38*z,v+=38*N,k+=38*q,E+=38*B,j+=38*O,D+=38*b,he+=38*w,W+=38*C,V+=38*x,J+=38*P,ae+=38*I,re+=38*K,Z+=38*ne,ee+=38*oe,Q+=38*ie,f=1,i=y+f+65535,f=Math.floor(i/65536),y=i-f*65536,i=v+f+65535,f=Math.floor(i/65536),v=i-f*65536,i=k+f+65535,f=Math.floor(i/65536),k=i-f*65536,i=E+f+65535,f=Math.floor(i/65536),E=i-f*65536,i=j+f+65535,f=Math.floor(i/65536),j=i-f*65536,i=D+f+65535,f=Math.floor(i/65536),D=i-f*65536,i=he+f+65535,f=Math.floor(i/65536),he=i-f*65536,i=W+f+65535,f=Math.floor(i/65536),W=i-f*65536,i=V+f+65535,f=Math.floor(i/65536),V=i-f*65536,i=J+f+65535,f=Math.floor(i/65536),J=i-f*65536,i=ae+f+65535,f=Math.floor(i/65536),ae=i-f*65536,i=re+f+65535,f=Math.floor(i/65536),re=i-f*65536,i=Z+f+65535,f=Math.floor(i/65536),Z=i-f*65536,i=ee+f+65535,f=Math.floor(i/65536),ee=i-f*65536,i=Q+f+65535,f=Math.floor(i/65536),Q=i-f*65536,i=U+f+65535,f=Math.floor(i/65536),U=i-f*65536,y+=f-1+37*(f-1),f=1,i=y+f+65535,f=Math.floor(i/65536),y=i-f*65536,i=v+f+65535,f=Math.floor(i/65536),v=i-f*65536,i=k+f+65535,f=Math.floor(i/65536),k=i-f*65536,i=E+f+65535,f=Math.floor(i/65536),E=i-f*65536,i=j+f+65535,f=Math.floor(i/65536),j=i-f*65536,i=D+f+65535,f=Math.floor(i/65536),D=i-f*65536,i=he+f+65535,f=Math.floor(i/65536),he=i-f*65536,i=W+f+65535,f=Math.floor(i/65536),W=i-f*65536,i=V+f+65535,f=Math.floor(i/65536),V=i-f*65536,i=J+f+65535,f=Math.floor(i/65536),J=i-f*65536,i=ae+f+65535,f=Math.floor(i/65536),ae=i-f*65536,i=re+f+65535,f=Math.floor(i/65536),re=i-f*65536,i=Z+f+65535,f=Math.floor(i/65536),Z=i-f*65536,i=ee+f+65535,f=Math.floor(i/65536),ee=i-f*65536,i=Q+f+65535,f=Math.floor(i/65536),Q=i-f*65536,i=U+f+65535,f=Math.floor(i/65536),U=i-f*65536,y+=f-1+37*(f-1),l[0]=y,l[1]=v,l[2]=k,l[3]=E,l[4]=j,l[5]=D,l[6]=he,l[7]=W,l[8]=V,l[9]=J,l[10]=ae,l[11]=re,l[12]=Z,l[13]=ee,l[14]=Q,l[15]=U}function Qe(l,p){de(l,p,p)}function ka(l,p){var u=r(),i;for(i=0;i<16;i++)u[i]=p[i];for(i=253;i>=0;i--)Qe(u,u),i!==2&&i!==4&&de(u,u,p);for(i=0;i<16;i++)l[i]=u[i]}function Pa(l,p){var u=r(),i;for(i=0;i<16;i++)u[i]=p[i];for(i=250;i>=0;i--)Qe(u,u),i!==1&&de(u,u,p);for(i=0;i<16;i++)l[i]=u[i]}function Ar(l,p,u){var i=new Uint8Array(32),f=new Float64Array(80),y,v,k=r(),E=r(),j=r(),D=r(),he=r(),W=r();for(v=0;v<31;v++)i[v]=p[v];for(i[31]=p[31]&127|64,i[0]&=248,qr(f,u),v=0;v<16;v++)E[v]=f[v],D[v]=k[v]=j[v]=0;for(k[0]=D[0]=1,v=254;v>=0;--v)y=i[v>>>3]>>>(v&7)&1,Bt(k,E,y),Bt(j,D,y),it(he,k,j),ot(k,k,j),it(j,E,D),ot(E,E,D),Qe(D,he),Qe(W,k),de(k,j,k),de(j,E,he),it(he,k,j),ot(k,k,j),Qe(E,k),ot(j,D,W),de(k,j,A),it(k,k,D),de(j,j,k),de(k,D,W),de(D,E,f),Qe(E,he),Bt(k,E,y),Bt(j,D,y);for(v=0;v<16;v++)f[v+16]=k[v],f[v+32]=j[v],f[v+48]=E[v],f[v+64]=D[v];var V=f.subarray(32),J=f.subarray(16);return ka(V,V),de(J,J,V),Ft(l,J),0}function Sr(l,p){return Ar(l,p,c)}function Ca(l,p){return n(p,32),Sr(l,p)}function $r(l,p,u){var i=new Uint8Array(32);return Ar(i,u,p),ht(l,o,i,at)}var Ta=Wr,pn=Mr;function fn(l,p,u,i,f,y){var v=new Uint8Array(32);return $r(v,f,y),Ta(l,p,u,i,v)}function gn(l,p,u,i,f,y){var v=new Uint8Array(32);return $r(v,f,y),pn(l,p,u,i,v)}var Ia=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ra(l,p,u,i){for(var f=new Int32Array(16),y=new Int32Array(16),v,k,E,j,D,he,W,V,J,ae,re,Z,ee,Q,U,z,N,q,B,O,b,w,C,x,P,I,K=l[0],ne=l[1],oe=l[2],ie=l[3],g=l[4],ce=l[5],ye=l[6],ve=l[7],le=p[0],ge=p[1],me=p[2],_e=p[3],Ae=p[4],Te=p[5],Ie=p[6],Re=p[7],We=0;i>=128;){for(B=0;B<16;B++)O=8*B+We,f[B]=u[O+0]<<24|u[O+1]<<16|u[O+2]<<8|u[O+3],y[B]=u[O+4]<<24|u[O+5]<<16|u[O+6]<<8|u[O+7];for(B=0;B<80;B++)if(v=K,k=ne,E=oe,j=ie,D=g,he=ce,W=ye,V=ve,J=le,ae=ge,re=me,Z=_e,ee=Ae,Q=Te,U=Ie,z=Re,b=ve,w=Re,C=w&65535,x=w>>>16,P=b&65535,I=b>>>16,b=(g>>>14|Ae<<18)^(g>>>18|Ae<<14)^(Ae>>>9|g<<23),w=(Ae>>>14|g<<18)^(Ae>>>18|g<<14)^(g>>>9|Ae<<23),C+=w&65535,x+=w>>>16,P+=b&65535,I+=b>>>16,b=g&ce^~g&ye,w=Ae&Te^~Ae&Ie,C+=w&65535,x+=w>>>16,P+=b&65535,I+=b>>>16,b=Ia[B*2],w=Ia[B*2+1],C+=w&65535,x+=w>>>16,P+=b&65535,I+=b>>>16,b=f[B%16],w=y[B%16],C+=w&65535,x+=w>>>16,P+=b&65535,I+=b>>>16,x+=C>>>16,P+=x>>>16,I+=P>>>16,N=P&65535|I<<16,q=C&65535|x<<16,b=N,w=q,C=w&65535,x=w>>>16,P=b&65535,I=b>>>16,b=(K>>>28|le<<4)^(le>>>2|K<<30)^(le>>>7|K<<25),w=(le>>>28|K<<4)^(K>>>2|le<<30)^(K>>>7|le<<25),C+=w&65535,x+=w>>>16,P+=b&65535,I+=b>>>16,b=K&ne^K&oe^ne&oe,w=le&ge^le&me^ge&me,C+=w&65535,x+=w>>>16,P+=b&65535,I+=b>>>16,x+=C>>>16,P+=x>>>16,I+=P>>>16,V=P&65535|I<<16,z=C&65535|x<<16,b=j,w=Z,C=w&65535,x=w>>>16,P=b&65535,I=b>>>16,b=N,w=q,C+=w&65535,x+=w>>>16,P+=b&65535,I+=b>>>16,x+=C>>>16,P+=x>>>16,I+=P>>>16,j=P&65535|I<<16,Z=C&65535|x<<16,ne=v,oe=k,ie=E,g=j,ce=D,ye=he,ve=W,K=V,ge=J,me=ae,_e=re,Ae=Z,Te=ee,Ie=Q,Re=U,le=z,B%16===15)for(O=0;O<16;O++)b=f[O],w=y[O],C=w&65535,x=w>>>16,P=b&65535,I=b>>>16,b=f[(O+9)%16],w=y[(O+9)%16],C+=w&65535,x+=w>>>16,P+=b&65535,I+=b>>>16,N=f[(O+1)%16],q=y[(O+1)%16],b=(N>>>1|q<<31)^(N>>>8|q<<24)^N>>>7,w=(q>>>1|N<<31)^(q>>>8|N<<24)^(q>>>7|N<<25),C+=w&65535,x+=w>>>16,P+=b&65535,I+=b>>>16,N=f[(O+14)%16],q=y[(O+14)%16],b=(N>>>19|q<<13)^(q>>>29|N<<3)^N>>>6,w=(q>>>19|N<<13)^(N>>>29|q<<3)^(q>>>6|N<<26),C+=w&65535,x+=w>>>16,P+=b&65535,I+=b>>>16,x+=C>>>16,P+=x>>>16,I+=P>>>16,f[O]=P&65535|I<<16,y[O]=C&65535|x<<16;b=K,w=le,C=w&65535,x=w>>>16,P=b&65535,I=b>>>16,b=l[0],w=p[0],C+=w&65535,x+=w>>>16,P+=b&65535,I+=b>>>16,x+=C>>>16,P+=x>>>16,I+=P>>>16,l[0]=K=P&65535|I<<16,p[0]=le=C&65535|x<<16,b=ne,w=ge,C=w&65535,x=w>>>16,P=b&65535,I=b>>>16,b=l[1],w=p[1],C+=w&65535,x+=w>>>16,P+=b&65535,I+=b>>>16,x+=C>>>16,P+=x>>>16,I+=P>>>16,l[1]=ne=P&65535|I<<16,p[1]=ge=C&65535|x<<16,b=oe,w=me,C=w&65535,x=w>>>16,P=b&65535,I=b>>>16,b=l[2],w=p[2],C+=w&65535,x+=w>>>16,P+=b&65535,I+=b>>>16,x+=C>>>16,P+=x>>>16,I+=P>>>16,l[2]=oe=P&65535|I<<16,p[2]=me=C&65535|x<<16,b=ie,w=_e,C=w&65535,x=w>>>16,P=b&65535,I=b>>>16,b=l[3],w=p[3],C+=w&65535,x+=w>>>16,P+=b&65535,I+=b>>>16,x+=C>>>16,P+=x>>>16,I+=P>>>16,l[3]=ie=P&65535|I<<16,p[3]=_e=C&65535|x<<16,b=g,w=Ae,C=w&65535,x=w>>>16,P=b&65535,I=b>>>16,b=l[4],w=p[4],C+=w&65535,x+=w>>>16,P+=b&65535,I+=b>>>16,x+=C>>>16,P+=x>>>16,I+=P>>>16,l[4]=g=P&65535|I<<16,p[4]=Ae=C&65535|x<<16,b=ce,w=Te,C=w&65535,x=w>>>16,P=b&65535,I=b>>>16,b=l[5],w=p[5],C+=w&65535,x+=w>>>16,P+=b&65535,I+=b>>>16,x+=C>>>16,P+=x>>>16,I+=P>>>16,l[5]=ce=P&65535|I<<16,p[5]=Te=C&65535|x<<16,b=ye,w=Ie,C=w&65535,x=w>>>16,P=b&65535,I=b>>>16,b=l[6],w=p[6],C+=w&65535,x+=w>>>16,P+=b&65535,I+=b>>>16,x+=C>>>16,P+=x>>>16,I+=P>>>16,l[6]=ye=P&65535|I<<16,p[6]=Ie=C&65535|x<<16,b=ve,w=Re,C=w&65535,x=w>>>16,P=b&65535,I=b>>>16,b=l[7],w=p[7],C+=w&65535,x+=w>>>16,P+=b&65535,I+=b>>>16,x+=C>>>16,P+=x>>>16,I+=P>>>16,l[7]=ve=P&65535|I<<16,p[7]=Re=C&65535|x<<16,We+=128,i-=128}return i}function Ct(l,p,u){var i=new Int32Array(8),f=new Int32Array(8),y=new Uint8Array(256),v,k=u;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,f[0]=4089235720,f[1]=2227873595,f[2]=4271175723,f[3]=1595750129,f[4]=2917565137,f[5]=725511199,f[6]=4215389547,f[7]=327033209,Ra(i,f,p,u),u%=128,v=0;v<u;v++)y[v]=p[k-u+v];for(y[u]=128,u=256-128*(u<112?1:0),y[u-9]=0,Ce(y,u-8,k/536870912|0,k<<3),Ra(i,f,y,u),v=0;v<8;v++)Ce(l,8*v,i[v],f[v]);return 0}function xr(l,p){var u=r(),i=r(),f=r(),y=r(),v=r(),k=r(),E=r(),j=r(),D=r();ot(u,l[1],l[0]),ot(D,p[1],p[0]),de(u,u,D),it(i,l[0],l[1]),it(D,p[0],p[1]),de(i,i,D),de(f,l[3],p[3]),de(f,f,R),de(y,l[2],p[2]),it(y,y,y),ot(v,i,u),ot(k,y,f),it(E,y,f),it(j,i,u),de(l[0],v,k),de(l[1],j,E),de(l[2],E,k),de(l[3],v,j)}function h(l,p,u){var i;for(i=0;i<4;i++)Bt(l[i],p[i],u)}function S(l,p){var u=r(),i=r(),f=r();ka(f,p[2]),de(u,p[0],f),de(i,p[1],f),Ft(l,i),l[31]^=xa(u)<<7}function ue(l,p,u){var i,f;for(yt(l[0],d),yt(l[1],m),yt(l[2],m),yt(l[3],d),f=255;f>=0;--f)i=u[f/8|0]>>(f&7)&1,h(l,p,i),xr(p,l),xr(l,l),h(l,p,i)}function vt(l,p){var u=[r(),r(),r(),r()];yt(u[0],F),yt(u[1],pe),yt(u[2],m),de(u[3],F,pe),ue(l,u,p)}function Ea(l,p,u){var i=new Uint8Array(64),f=[r(),r(),r(),r()],y;for(u||n(p,32),Ct(i,p,32),i[0]&=248,i[31]&=127,i[31]|=64,vt(f,i),S(l,f),y=0;y<32;y++)p[y+32]=l[y];return 0}var Br=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function jt(l,p){var u,i,f,y;for(i=63;i>=32;--i){for(u=0,f=i-32,y=i-12;f<y;++f)p[f]+=u-16*p[i]*Br[f-(i-32)],u=Math.floor((p[f]+128)/256),p[f]-=u*256;p[f]+=u,p[i]=0}for(u=0,f=0;f<32;f++)p[f]+=u-(p[31]>>4)*Br[f],u=p[f]>>8,p[f]&=255;for(f=0;f<32;f++)p[f]-=u*Br[f];for(i=0;i<32;i++)p[i+1]+=p[i]>>8,l[i]=p[i]&255}function _a(l){var p=new Float64Array(64),u;for(u=0;u<64;u++)p[u]=l[u];for(u=0;u<64;u++)l[u]=0;jt(l,p)}function ds(l,p,u,i){var f=new Uint8Array(64),y=new Uint8Array(64),v=new Uint8Array(64),k,E,j=new Float64Array(64),D=[r(),r(),r(),r()];Ct(f,i,32),f[0]&=248,f[31]&=127,f[31]|=64;var he=u+64;for(k=0;k<u;k++)l[64+k]=p[k];for(k=0;k<32;k++)l[32+k]=f[32+k];for(Ct(v,l.subarray(32),u+32),_a(v),vt(D,v),S(l,D),k=32;k<64;k++)l[k]=i[k];for(Ct(y,l,u+64),_a(y),k=0;k<64;k++)j[k]=0;for(k=0;k<32;k++)j[k]=v[k];for(k=0;k<32;k++)for(E=0;E<32;E++)j[k+E]+=y[k]*f[E];return jt(l.subarray(32),j),he}function zd(l,p){var u=r(),i=r(),f=r(),y=r(),v=r(),k=r(),E=r();return yt(l[2],m),qr(l[1],p),Qe(f,l[1]),de(y,f,$),ot(f,f,l[2]),it(y,l[2],y),Qe(v,y),Qe(k,v),de(E,k,v),de(u,E,f),de(u,u,y),Pa(u,u),de(u,u,f),de(u,u,y),de(u,u,y),de(l[0],u,y),Qe(i,l[0]),de(i,i,y),$a(i,f)&&de(l[0],l[0],we),Qe(i,l[0]),de(i,i,y),$a(i,f)?-1:(xa(l[0])===p[31]>>7&&ot(l[0],d,l[0]),de(l[3],l[0],l[1]),0)}function li(l,p,u,i){var f,y=new Uint8Array(32),v=new Uint8Array(64),k=[r(),r(),r(),r()],E=[r(),r(),r(),r()];if(u<64||zd(E,i))return-1;for(f=0;f<u;f++)l[f]=p[f];for(f=0;f<32;f++)l[f+32]=i[f];if(Ct(v,l,u),_a(v),ue(k,E,v),vt(E,p.subarray(32)),xr(k,E),S(y,k),u-=64,Ue(p,0,y,0)){for(f=0;f<u;f++)l[f]=0;return-1}for(f=0;f<u;f++)l[f]=p[f+64];return u}var ci=32,mn=24,La=32,Fr=16,Oa=32,hn=32,Da=32,Na=32,di=32,us=mn,Gd=La,Kd=Fr,Ht=64,kr=32,jr=64,ui=32,pi=64;t.lowlevel={crypto_core_hsalsa20:ht,crypto_stream_xor:Ut,crypto_stream:Mt,crypto_stream_salsa20_xor:Se,crypto_stream_salsa20:nt,crypto_onetimeauth:ar,crypto_onetimeauth_verify:wr,crypto_verify_16:Me,crypto_verify_32:Ue,crypto_secretbox:Wr,crypto_secretbox_open:Mr,crypto_scalarmult:Ar,crypto_scalarmult_base:Sr,crypto_box_beforenm:$r,crypto_box_afternm:Ta,crypto_box:fn,crypto_box_open:gn,crypto_box_keypair:Ca,crypto_hash:Ct,crypto_sign:ds,crypto_sign_keypair:Ea,crypto_sign_open:li,crypto_secretbox_KEYBYTES:ci,crypto_secretbox_NONCEBYTES:mn,crypto_secretbox_ZEROBYTES:La,crypto_secretbox_BOXZEROBYTES:Fr,crypto_scalarmult_BYTES:Oa,crypto_scalarmult_SCALARBYTES:hn,crypto_box_PUBLICKEYBYTES:Da,crypto_box_SECRETKEYBYTES:Na,crypto_box_BEFORENMBYTES:di,crypto_box_NONCEBYTES:us,crypto_box_ZEROBYTES:Gd,crypto_box_BOXZEROBYTES:Kd,crypto_sign_BYTES:Ht,crypto_sign_PUBLICKEYBYTES:kr,crypto_sign_SECRETKEYBYTES:jr,crypto_sign_SEEDBYTES:ui,crypto_hash_BYTES:pi,gf:r,D:$,L:Br,pack25519:Ft,unpack25519:qr,M:de,A:it,S:Qe,Z:ot,pow2523:Pa,add:xr,set25519:yt,modL:jt,scalarmult:ue,scalarbase:vt};function ps(l,p){if(l.length!==ci)throw new Error("bad key size");if(p.length!==mn)throw new Error("bad nonce size")}function Yd(l,p){if(l.length!==Da)throw new Error("bad public key size");if(p.length!==Na)throw new Error("bad secret key size")}function dt(){for(var l=0;l<arguments.length;l++)if(!(arguments[l]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function fs(l){for(var p=0;p<l.length;p++)l[p]=0}t.randomBytes=function(l){var p=new Uint8Array(l);return n(p,l),p},t.secretbox=function(l,p,u){dt(l,p,u),ps(u,p);for(var i=new Uint8Array(La+l.length),f=new Uint8Array(i.length),y=0;y<l.length;y++)i[y+La]=l[y];return Wr(f,i,i.length,p,u),f.subarray(Fr)},t.secretbox.open=function(l,p,u){dt(l,p,u),ps(u,p);for(var i=new Uint8Array(Fr+l.length),f=new Uint8Array(i.length),y=0;y<l.length;y++)i[y+Fr]=l[y];return i.length<32||Mr(f,i,i.length,p,u)!==0?null:f.subarray(La)},t.secretbox.keyLength=ci,t.secretbox.nonceLength=mn,t.secretbox.overheadLength=Fr,t.scalarMult=function(l,p){if(dt(l,p),l.length!==hn)throw new Error("bad n size");if(p.length!==Oa)throw new Error("bad p size");var u=new Uint8Array(Oa);return Ar(u,l,p),u},t.scalarMult.base=function(l){if(dt(l),l.length!==hn)throw new Error("bad n size");var p=new Uint8Array(Oa);return Sr(p,l),p},t.scalarMult.scalarLength=hn,t.scalarMult.groupElementLength=Oa,t.box=function(l,p,u,i){var f=t.box.before(u,i);return t.secretbox(l,p,f)},t.box.before=function(l,p){dt(l,p),Yd(l,p);var u=new Uint8Array(di);return $r(u,l,p),u},t.box.after=t.secretbox,t.box.open=function(l,p,u,i){var f=t.box.before(u,i);return t.secretbox.open(l,p,f)},t.box.open.after=t.secretbox.open,t.box.keyPair=function(){var l=new Uint8Array(Da),p=new Uint8Array(Na);return Ca(l,p),{publicKey:l,secretKey:p}},t.box.keyPair.fromSecretKey=function(l){if(dt(l),l.length!==Na)throw new Error("bad secret key size");var p=new Uint8Array(Da);return Sr(p,l),{publicKey:p,secretKey:new Uint8Array(l)}},t.box.publicKeyLength=Da,t.box.secretKeyLength=Na,t.box.sharedKeyLength=di,t.box.nonceLength=us,t.box.overheadLength=t.secretbox.overheadLength,t.sign=function(l,p){if(dt(l,p),p.length!==jr)throw new Error("bad secret key size");var u=new Uint8Array(Ht+l.length);return ds(u,l,l.length,p),u},t.sign.open=function(l,p){if(dt(l,p),p.length!==kr)throw new Error("bad public key size");var u=new Uint8Array(l.length),i=li(u,l,l.length,p);if(i<0)return null;for(var f=new Uint8Array(i),y=0;y<f.length;y++)f[y]=u[y];return f},t.sign.detached=function(l,p){for(var u=t.sign(l,p),i=new Uint8Array(Ht),f=0;f<i.length;f++)i[f]=u[f];return i},t.sign.detached.verify=function(l,p,u){if(dt(l,p,u),p.length!==Ht)throw new Error("bad signature size");if(u.length!==kr)throw new Error("bad public key size");var i=new Uint8Array(Ht+l.length),f=new Uint8Array(Ht+l.length),y;for(y=0;y<Ht;y++)i[y]=p[y];for(y=0;y<l.length;y++)i[y+Ht]=l[y];return li(f,i,i.length,u)>=0},t.sign.keyPair=function(){var l=new Uint8Array(kr),p=new Uint8Array(jr);return Ea(l,p),{publicKey:l,secretKey:p}},t.sign.keyPair.fromSecretKey=function(l){if(dt(l),l.length!==jr)throw new Error("bad secret key size");for(var p=new Uint8Array(kr),u=0;u<p.length;u++)p[u]=l[32+u];return{publicKey:p,secretKey:new Uint8Array(l)}},t.sign.keyPair.fromSeed=function(l){if(dt(l),l.length!==ui)throw new Error("bad seed size");for(var p=new Uint8Array(kr),u=new Uint8Array(jr),i=0;i<32;i++)u[i]=l[i];return Ea(p,u,!0),{publicKey:p,secretKey:u}},t.sign.publicKeyLength=kr,t.sign.secretKeyLength=jr,t.sign.seedLength=ui,t.sign.signatureLength=Ht,t.hash=function(l){dt(l);var p=new Uint8Array(pi);return Ct(p,l,l.length),p},t.hash.hashLength=pi,t.verify=function(l,p){return dt(l,p),l.length===0||p.length===0||l.length!==p.length?!1:Le(l,0,p,0,l.length)===0},t.setPRNG=function(l){n=l},function(){var l=typeof self<"u"?self.crypto||self.msCrypto:null;if(l&&l.getRandomValues){var p=65536;t.setPRNG(function(u,i){var f,y=new Uint8Array(i);for(f=0;f<i;f+=p)l.getRandomValues(y.subarray(f,f+Math.min(i-f,p)));for(f=0;f<i;f++)u[f]=y[f];fs(y)})}else typeof ou<"u"&&(l=eu,l&&l.randomBytes&&t.setPRNG(function(u,i){var f,y=l.randomBytes(i);for(f=0;f<i;f++)u[f]=y[f];fs(y)}))}()})(e.exports?e.exports:self.nacl=self.nacl||{})})(Zs);var su=Zs.exports;const lu=tu(su);function cu(e,t){if(e.maxOccurrences!==void 0&&(e.occurrencesCreated??0)>=e.maxOccurrences)return"max_occurrences";if(e.expiresAt){const r=new Date(e.expiresAt);if(!Number.isNaN(r.getTime())&&t.getTime()>=r.getTime())return"expired"}return null}function du(e,t){const r=Qs(e);if(!r)return null;const n=uu(e,t,r);if(!n)return null;if(e.expiresAt){const o=new Date(e.expiresAt);if(!Number.isNaN(o.getTime())&&n.dueAt.getTime()>=o.getTime())return null}return n}function so(e,t,r){if(r<=0)return[];const n=[];let o=t,c=e.occurrencesCreated??0;for(let d=0;d<r;d+=1){const m={...e,occurrencesCreated:c};if(cu(m,o))break;const A=du(m,o);if(!A)break;n.push(A),c+=1,o=new Date(A.dueAt.getTime())}return n}function Qs(e){const t=new Date(e.startAt??e.createdAt);return Number.isNaN(t.getTime())?null:t}function lo(e){if(!e)return null;const[t,r]=e.split(":"),n=Number(t),o=Number(r);return!Number.isInteger(n)||!Number.isInteger(o)||n<0||n>23||o<0||o>59?null:{hour:n,minute:o}}function fi(e,t,r,n,o){const c=new Date(e,t+1,0).getDate();return new Date(e,t,Math.min(r,c),n,o,0,0)}function Xs(e){const t=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${e.getFullYear()}-${t}-${r}`}function gs(e,t){return t==="interval_days"?Xs(e):e.toISOString()}function uu(e,t,r){switch(e.cadence){case"weekly":return pu(e,t,r);case"monthly":return fu(e,t,r);case"interval_days":return gi(e,t,e.intervalDays,24*60*60*1e3);case"interval_hours":return gi(e,t,e.intervalHours,60*60*1e3);case"interval_minutes":return gi(e,t,e.intervalMinutes,60*1e3);default:return gu(e.cadence)}}function pu(e,t,r){const n=lo(e.localTime);if(!n||!Number.isInteger(e.dayOfWeek)||e.dayOfWeek===void 0)return null;const o=new Date(t.getTime());o.setHours(n.hour,n.minute,0,0);const c=(e.dayOfWeek-o.getDay()+7)%7;for(o.setDate(o.getDate()+c),o.getTime()<=t.getTime()&&o.setDate(o.getDate()+7);o.getTime()<r.getTime();)o.setDate(o.getDate()+7);return{dueAt:o,key:o.toISOString().slice(0,10)}}function fu(e,t,r){const n=lo(e.localTime);if(!n||!Number.isInteger(e.dayOfMonth)||e.dayOfMonth===void 0)return null;let o=fi(t.getFullYear(),t.getMonth(),e.dayOfMonth,n.hour,n.minute);for(o.getTime()<=t.getTime()&&(o=fi(o.getFullYear(),o.getMonth()+1,e.dayOfMonth,n.hour,n.minute));o.getTime()<r.getTime();)o=fi(o.getFullYear(),o.getMonth()+1,e.dayOfMonth,n.hour,n.minute);return{dueAt:o,key:Xs(o)}}function gi(e,t,r,n){if(!Number.isInteger(r)||r===void 0||r<1)return null;const o=Qs(e);if(!o)return null;const c=e.cadence==="interval_days"?lo(e.localTime):null,d=new Date(o.getTime());c&&d.setHours(c.hour,c.minute,0,0);const m=r*n;if(d.getTime()>t.getTime())return{dueAt:d,key:gs(d,e.cadence)};const A=t.getTime()-d.getTime(),$=Math.floor(A/m)+1;return d.setTime(d.getTime()+$*m),{dueAt:d,key:gs(d,e.cadence)}}function gu(e){throw new Error(`Unhandled recurring cadence: ${String(e)}`)}const mu=1e4;function el(e,t,r){const n=e.maxOccurrences!==void 0||e.expiresAt!==void 0,o=ms(t,hu(e)),c=ms(t,yu(e));if(!n)return{bounded:!1,perWeek:o,perMonth:c};const d=so(e,r,mu).length,m=vu(t,d);return{bounded:!0,totalRuns:d,totalAmount:m,perWeek:o,perMonth:c}}function hu(e){switch(e.cadence){case"weekly":return 1;case"monthly":return 7/30.4375;case"interval_days":return e.intervalDays&&e.intervalDays>0?7/e.intervalDays:0;case"interval_hours":return e.intervalHours&&e.intervalHours>0?168/e.intervalHours:0;case"interval_minutes":return e.intervalMinutes&&e.intervalMinutes>0?10080/e.intervalMinutes:0;default:return 0}}function yu(e){switch(e.cadence){case"weekly":return 30.4375/7;case"monthly":return 1;case"interval_days":return e.intervalDays&&e.intervalDays>0?30.4375/e.intervalDays:0;case"interval_hours":return e.intervalHours&&e.intervalHours>0?730.5/e.intervalHours:0;case"interval_minutes":return e.intervalMinutes&&e.intervalMinutes>0?43830/e.intervalMinutes:0;default:return 0}}function ms(e,t){const r=Number(e)*t;return Number.isFinite(r)?r.toFixed(6).replace(/\.?0+$/,""):"0"}function vu(e,t){if(!Number.isInteger(t)||t<0||t===0)return"0";const r=e.trim(),n=/^(\d+)(?:\.(\d+))?$/.exec(r);if(!n)return"0";const o=n[1],c=n[2]??"",d=c.length;if(d===0)return(BigInt(o)*BigInt(t)).toString();const A=(BigInt(o+c)*BigInt(t)).toString().padStart(d+1,"0"),$=A.slice(0,-d),R=A.slice(-d).replace(/0+$/,"");return R?`${$}.${R}`:$}function co(e,t){return e==="completed"?(t==null?void 0:t.txStatus)==="confirmed"?{label:"Executed",tone:"success"}:{label:"Approved",tone:"success"}:e==="failed"?{label:"Failed",tone:"danger"}:e==="cancelled"?{label:"Cancelled",tone:"muted"}:e==="skipped"?{label:"Skipped",tone:"warning"}:e==="approval_pending"?{label:"Awaiting approval",tone:"info"}:e==="ready"?{label:"Awaiting approval",tone:"info"}:e==="scheduled"?{label:"Scheduled",tone:"muted"}:{label:e,tone:"muted"}}function hs(e){switch(e){case"active":return{label:"Active",tone:"success"};case"paused":return{label:"Paused",tone:"warning"};case"completed":return{label:"Completed",tone:"muted"};case"cancelled":return{label:"Cancelled",tone:"muted"};default:return{label:e,tone:"muted"}}}const bu=["agentic_cloud","browser_fallback","local_bridge"],wu=["cloud","browser","local_bridge"],en=["mainnet-beta","testnet","devnet","localnet"],Au=["low","medium","high","unknown"],Su=["template","ai"],$u=["draft","signed","queued","archived"],xu=["pending","scheduled","ready","overdue","approval_pending","approved","denied","rejected","blocked","failed","expired","cancelled"],tl=["pending","confirmed","failed"],ku=["weekly","monthly","interval_days","interval_hours","interval_minutes"],Pu=["active","paused","completed","cancelled"],Cu=["scheduled","ready","approval_pending","completed","skipped","failed","cancelled"],ys=["one_time","recurring_occurrence","recurring_schedule","evidence_receipt"],Tu=["review_proof","intent_receipt","policy_receipt","risk_review_receipt","rejection_receipt","tool_trace_receipt"],Iu=["user","wallet","server","system"],Ru=["none","wallet_decision_proof","transaction_preview"],Eu=["proof_only","wallet_execute","unsupported"];class Ne extends Error{constructor(r,n,o){super(n);Pr(this,"code");Pr(this,"path");this.code=r,this.name="WorkflowValidationError",this.path=o}}function _u(e){const t=Bn(e.plan)?e.plan:{},r=dl(e.parameters??ip(t.parameters)),n=ul(e.fields??t.fields),o=Be(e.source)??Be(t.source)??"template",c=Be(e.category)??Be(t.category)??"custom",d=Be(e.actionType)??Be(t.actionType)??"manual_review",m=Be(e.templateId)??Be(t.templateId)??"",A=Be(e.templateTitle)??Be(t.templateTitle)??"",$=Be(e.cluster)??Be(t.cluster)??"devnet",R=Be(e.userNotes)??Be(t.userNotes)??"",F=Be(e.prompt)??Be(t.prompt)??"",pe=[];Li({value:{...t,...e.prompt!==void 0?{prompt:F}:{},...e.userNotes!==void 0?{userNotes:R}:{}},path:"$.plan",violations:pe}),Oi({value:{intent:t.intent,route:t.route,risk:t.risk,approval:t.approval,safeguards:t.safeguards,prompt:F,userNotes:R,parameters:r,fields:n},path:"$.plan",source:o,violations:pe}),al(d)&&ep(d,r,pe),o==="ai"&&tp(t,d,r,pe);const we=Nu(d),Ce=Lu({source:o,category:c,actionType:d,templateId:m,templateTitle:A,cluster:$,parameters:r,fields:n,userNotes:R}),Le=Ou(Ce),Me=Du(Ce),Ue=pe.some(Ze=>Ze.severity==="block")?"block":pe.some(Ze=>Ze.severity==="warn")?"warn":"pass";return{verdict:Ue,source:o,actionType:d,finalizationRequirement:we,constraintFingerprint:Le,constraintHash:Me,violations:pe,summary:ap(Ue,we,pe)}}function rl(e){const t=_u(e);if(t.verdict==="block"){const r=t.violations.find(n=>n.severity==="block");throw new Ne("ai_guardrail_blocked",(r==null?void 0:r.message)??"Plan is blocked by Agentic AI guardrails.",r==null?void 0:r.path)}return t}function Lu(e){return{source:e.source??"template",category:e.category??"custom",actionType:e.actionType??"manual_review",templateId:e.templateId??"",templateTitle:e.templateTitle??"",cluster:e.cluster??"devnet",parameters:dl(e.parameters),fields:ul(e.fields),...e.userNotes?{userNotes:e.userNotes}:{}}}function Ou(e){const t=za(e);let r=2166136261;for(let n=0;n<t.length;n+=1)r^=t.charCodeAt(n),r=Math.imul(r,16777619);return`wf_${(r>>>0).toString(16).padStart(8,"0")}`}function Du(e){return sp(za(e))}function al(e){return e==="transfer_sol"||e==="transfer_spl"||e==="swap"||e==="recurring_payment"}function Nu(e){return e==="transfer_sol"||e==="transfer_spl"||e==="swap"||e==="custom_transaction"?"transaction_preview":e==="recurring_payment"||e==="manual_review"?"wallet_decision_proof":"none"}function Wu(e){return["Agentic Cloud workflow decision",`Decision: ${e.decision}`,`Approval: ${e.approval.id}`,`Wallet: ${e.approval.walletAddress}`,`Cluster: ${e.approval.cluster??"devnet"}`,`Summary: ${e.approval.summary}`,`Kind: ${e.approval.kind}`,`Params: ${za(e.approval.params)}`,"This signature records a cloud workflow decision only. It does not submit a transaction or grant spending authority."].join(`
|
|
2
|
+
`)}function Mu(e){var o,c;const t=((o=e.finalization.quote)==null?void 0:o.quoteHash)??"",r=((c=e.finalization.simulation)==null?void 0:c.simulationHash)??"",n=Zu(e.finalization.metadata,"constraintHash")??"";return["Agentic Cloud transaction finalization","Decision: approved",`Approval: ${e.approval.id}`,`Finalization: ${e.finalization.id}`,`Wallet: ${e.approval.walletAddress}`,`Cluster: ${e.approval.cluster??"devnet"}`,`Summary: ${e.approval.summary}`,`Kind: ${e.approval.kind}`,`Params: ${za(e.approval.params)}`,`Transaction hash: ${e.finalization.transactionHash}`,`Message hash: ${e.finalization.messageHash??""}`,`Quote hash: ${t}`,`Simulation hash: ${r}`,`Constraint hash: ${n}`,`Wallet action: ${za(e.finalization.walletAction)}`,"This signature approves only this reviewed transaction boundary. It does not grant custody, delegated authority, or unlimited signing rights."].join(`
|
|
3
|
+
`)}function qn(e,t="$"){if(!rn(e))throw new Ne("invalid_object","Expected a JSON object.",t);const r={};for(const[n,o]of Object.entries(e))r[n]=pl(o,`${t}.${n}`);return r}function Uu(e,t="$"){const r=ze(e,t);return{mode:xt(r,"mode",bu,t),storage:xt(r,"storage",wu,t),persistent:et(r,"persistent",t),availableOffline:et(r,"availableOffline",t),requiresWalletSession:et(r,"requiresWalletSession",t),requiresLocalhost:et(r,"requiresLocalhost",t),supportsCloudSync:et(r,"supportsCloudSync",t),supportsPrivateLocalMode:et(r,"supportsPrivateLocalMode",t),supportsPlanDrafts:et(r,"supportsPlanDrafts",t),supportsApprovalRequests:et(r,"supportsApprovalRequests",t),supportsRecurringSchedules:et(r,"supportsRecurringSchedules",t),supportsCompletedHistory:et(r,"supportsCompletedHistory",t),supportsEvidenceReceipts:et(r,"supportsEvidenceReceipts",t),supportsAuditEvents:et(r,"supportsAuditEvents",t)}}function qu(e,t="$"){const r=ze(e,t);return{id:H(r,"id",t),walletAddress:H(r,"walletAddress",t),createdAt:H(r,"createdAt",t),expiresAt:H(r,"expiresAt",t),...L(r,"userId",t),...L(r,"lastSeenAt",t)}}function Bu(e,t="$"){const r=ze(e,t);return{walletAddress:H(r,"walletAddress",t),...L(r,"id",t),...L(r,"createdAt",t),...L(r,"updatedAt",t),...L(r,"lastSeenAt",t)}}function Fu(e,t="$"){const r=ze(e,t);return{label:H(r,"label",t),value:H(r,"value",t)}}function nl(e,t="$"){const r=ze(e,t),n=L(r,"templateId",t).templateId??"",o=L(r,"templateTitle",t).templateTitle??"",c=L(r,"prompt",t).prompt??"";return{id:H(r,"id",t),walletAddress:H(r,"walletAddress",t),plan:r.plan===void 0?{}:po(r,"plan",t),title:H(r,"title",t),intent:H(r,"intent",t),route:H(r,"route",t),risk:H(r,"risk",t),approval:H(r,"approval",t),source:xt(r,"source",Su,t),category:H(r,"category",t),actionType:H(r,"actionType",t),parameters:dp(r,"parameters",t),fields:mr(r,"fields",t).map((d,m)=>Fu(d,`${t}.fields[${m}]`)),safeguards:cp(r,"safeguards",t),status:xt(r,"status",$u,t),createdAt:H(r,"createdAt",t),updatedAt:H(r,"updatedAt",t),templateId:n,templateTitle:o,prompt:c,cluster:xt(r,"cluster",en,t),...L(r,"userNotes",t),...Gt(r,"riskLevel",Au,t),...L(r,"signature",t),...L(r,"approvalRequestId",t),...Et(r,"riskMetadata",t),...Et(r,"metadata",t)}}function il(e,t="$"){const r=ze(e,t),n=L(r,"planDraftId",t).planDraftId??L(r,"planId",t).planId;return{id:H(r,"id",t),walletAddress:H(r,"walletAddress",t),...n?{planDraftId:n}:{},...Et(r,"plan",t),kind:H(r,"kind",t),status:xt(r,"status",xu,t),summary:H(r,"summary",t),params:po(r,"params",t),...Gt(r,"cluster",en,t),dueAt:H(r,"dueAt",t),createdAt:H(r,"createdAt",t),updatedAt:H(r,"updatedAt",t),...L(r,"recurringScheduleId",t),...L(r,"recurringOccurrenceId",t),...L(r,"occurrenceKey",t),...L(r,"activeRequestId",t),...L(r,"amount",t),...L(r,"token",t),...L(r,"recipient",t),...L(r,"txid",t),...Gt(r,"txStatus",tl,t),...L(r,"explorerUrl",t),...L(r,"confirmedAt",t),...L(r,"decidedAt",t),...L(r,"txError",t),...L(r,"error",t),...L(r,"note",t),...L(r,"decisionNote",t),...Gt(r,"finalizationRequirement",Ru,t),...Gt(r,"executionMode",Eu,t),...up(r,"finalizationSupport",t),...L(r,"proofSignature",t),...L(r,"decisionProofSignature",t),...L(r,"decisionProofMessage",t),...vs(r,"decisionProofVerified",t),...vs(r,"archived",t),...L(r,"archivedAt",t),...Et(r,"riskMetadata",t),...Et(r,"metadata",t)}}function uo(e,t="$"){const r=ze(e,t);return{id:H(r,"id",t),status:xt(r,"status",Pu,t),walletAddress:H(r,"walletAddress",t),cluster:xt(r,"cluster",en,t),token:H(r,"token",t),recipient:H(r,"recipient",t),amount:H(r,"amount",t),cadence:xt(r,"cadence",ku,t),createdAt:H(r,"createdAt",t),updatedAt:H(r,"updatedAt",t),...nr(r,"dayOfWeek",t),...nr(r,"dayOfMonth",t),...nr(r,"intervalDays",t),...nr(r,"intervalHours",t),...nr(r,"intervalMinutes",t),...L(r,"localTime",t),...L(r,"startAt",t),...nr(r,"maxOccurrences",t),...nr(r,"occurrencesCreated",t),...L(r,"nextDueAt",t),...L(r,"lastMaterializedAt",t),...nr(r,"slippageBps",t),...L(r,"memo",t),...L(r,"note",t),...L(r,"expiresAt",t),...gp(r,"notifications",t),...Et(r,"riskMetadata",t),...Et(r,"metadata",t)}}function ol(e,t="$"){const r=ze(e,t);return{id:H(r,"id",t),recurringScheduleId:H(r,"recurringScheduleId",t),walletAddress:H(r,"walletAddress",t),cluster:xt(r,"cluster",en,t),status:xt(r,"status",Cu,t),occurrenceKey:H(r,"occurrenceKey",t),dueAt:H(r,"dueAt",t),createdAt:H(r,"createdAt",t),updatedAt:H(r,"updatedAt",t),...L(r,"approvalRequestId",t),...L(r,"completedRecordId",t),...L(r,"error",t),...Et(r,"metadata",t)}}function ju(e,t="$"){const r=ze(e,t),n=L(r,"planDraftId",t).planDraftId??L(r,"planId",t).planId,o=L(r,"approvalRequestId",t).approvalRequestId??L(r,"approvalId",t).approvalId;return{id:H(r,"id",t),kind:pp(r,"kind",t),status:H(r,"status",t),title:H(r,"title",t),summary:H(r,"summary",t),walletAddress:H(r,"walletAddress",t),createdAt:H(r,"createdAt",t),completedAt:H(r,"completedAt",t),...Gt(r,"cluster",en,t),...L(r,"amount",t),...L(r,"token",t),...L(r,"recipient",t),...L(r,"signature",t),...L(r,"proofSignature",t),...L(r,"txid",t),...Gt(r,"txStatus",tl,t),...L(r,"confirmationStatus",t),...L(r,"finalizationId",t),...L(r,"transactionHash",t),...L(r,"messageHash",t),...L(r,"quoteHash",t),...L(r,"simulationHash",t),...L(r,"explorerUrl",t),...n?{planDraftId:n}:{},...o?{approvalRequestId:o}:{},...L(r,"recurringScheduleId",t),...L(r,"recurringOccurrenceId",t),...L(r,"occurrenceKey",t),...L(r,"evidenceReceiptId",t),...L(r,"error",t),copyPayload:po(r,"copyPayload",t),detailRows:fp(r,"detailRows",t),...Et(r,"payload",t),...Et(r,"metadata",t)}}function Hu(e,t="$"){const r=ze(e,t),n=r.type===void 0?H(r,"eventType",t):H(r,"type",t),o=L(r,"eventType",t).eventType??n,c=L(r,"subjectType",t).subjectType??L(r,"recordType",t).recordType,d=L(r,"subjectId",t).subjectId??L(r,"recordId",t).recordId;return{id:H(r,"id",t),walletAddress:H(r,"walletAddress",t),type:n,createdAt:H(r,"createdAt",t),...Gt(r,"actor",Iu,t),eventType:o,...Gt(r,"recordType",["plan","approval","completed","evidence"],t),...L(r,"recordId",t),...c?{subjectType:c}:{},...d?{subjectId:d}:{},...L(r,"outcome",t),metadata:r.metadata===void 0?{}:qn(r.metadata,`${t}.metadata`)}}function zu(e,t="$"){const r=ze(e,t);return{nonce:H(r,"nonce",t),message:H(r,"message",t),domain:H(r,"domain",t),issuedAt:H(r,"issuedAt",t),expiresAt:H(r,"expiresAt",t),...L(r,"walletAddress",t)}}function sl(e,t="$"){const r=ze(e,t);return{signedIn:et(r,"signedIn",t),...mi(r,"capabilities",Uu,t),...mi(r,"session",qu,t),...mi(r,"user",Bu,t),...L(r,"expiresAt",t)}}function Gu(e,t="$"){const r=ze(e,t);return{plans:mr(r,"plans",t).map((n,o)=>nl(n,`${t}.plans[${o}]`))}}function Ku(e,t="$"){const r=ze(e,t);return{approvals:mr(r,"approvals",t).map((n,o)=>il(n,`${t}.approvals[${o}]`))}}function Yu(e,t="$"){const r=ze(e,t);return{schedules:mr(r,"schedules",t).map((n,o)=>uo(n,`${t}.schedules[${o}]`)),occurrences:mr(r,"occurrences",t).map((n,o)=>ol(n,`${t}.occurrences[${o}]`))}}function Vu(e,t="$"){const r=ze(e,t);return{completed:mr(r,"completed",t).map((n,o)=>ju(n,`${t}.completed[${o}]`))}}const Ju=new Set(["seedphrase","recoveryphrase","mnemonic","privatekey","secretkey","delegatedsigner","delegatesigner","unlimitedapproval"]);function Zu(e,t){const r=e==null?void 0:e[t];return typeof r=="string"&&r.trim()?r:void 0}function Li(e){if(!e.value||typeof e.value!="object"){typeof e.value=="string"&&Qu(e.value,e.path,e.violations);return}if(Array.isArray(e.value)){e.value.forEach((t,r)=>Li({value:t,path:`${e.path}[${r}]`,violations:e.violations}));return}for(const[t,r]of Object.entries(e.value)){const n=t.replace(/[^a-z0-9]/gi,"").toLowerCase(),o=`${e.path}.${t}`;(Ju.has(n)||n.includes("privatekey")||n.includes("secretkey"))&&e.violations.push({code:"forbidden_secret",severity:"block",message:`${o} is not accepted by Agentic workflow guardrails.`,path:o}),(n.includes("approvalauthority")||n.includes("signingauthority")||n.includes("authority"))&&mp(r)&&e.violations.push({code:"forbidden_authority",severity:"block",message:`${o} cannot grant unlimited approval authority.`,path:o}),Li({value:r,path:o,violations:e.violations})}}function Qu(e,t,r){const n=ll(e);(/\b(share|send|enter|paste|provide|export|store|upload|reveal|recover)\b.{0,60}\b(seed phrase|recovery phrase|mnemonic|private key|secret key)\b/.test(n)||/\b(seed phrase|recovery phrase|mnemonic|private key|secret key)\b.{0,60}\b(ai|agent|server|cloud|provider)\b/.test(n))&&r.push({code:"forbidden_secret_request",severity:"block",message:"Plans cannot request seed phrases, private keys, recovery phrases, or secret keys.",path:t}),(/\b(grant|give|create|use|authorize|allow|enable)\b.{0,60}\b(delegated signer|delegate signer|server signer|unlimited approval|unrestricted authority|unlimited authority)\b/.test(n)||/\b(unlimited approval|unrestricted authority|server signer|delegated signer)\b/.test(n))&&!/\b(no|never|without|cannot|must not|do not|reject|block|forbid|forbidden|disallow)\b.{0,60}\b(unlimited approval|unrestricted authority|server signer|delegated signer)\b/.test(n)&&r.push({code:"forbidden_authority_request",severity:"block",message:"Plans cannot create delegated signers, server signers, or unlimited approval authority.",path:t})}function Oi(e){if(typeof e.value=="string"){e.source==="ai"&&Xu(e.value,e.path,e.violations);return}if(!(!e.value||typeof e.value!="object")){if(Array.isArray(e.value)){e.value.forEach((t,r)=>Oi({value:t,path:`${e.path}[${r}]`,source:e.source,violations:e.violations}));return}for(const[t,r]of Object.entries(e.value))Oi({value:r,path:`${e.path}.${t}`,source:e.source,violations:e.violations})}}function Xu(e,t,r){const n=ll(e),o=[{code:"ai_claims_approved",pattern:/\b(already|pre|auto)[-\s]?(approved|approval)\b|\bapproved automatically\b/,message:"AI drafts cannot claim that wallet approval has already happened."},{code:"ai_claims_signed",pattern:/\b(already|pre|auto)[-\s]?(signed|signing)\b|\bsigned automatically\b/,message:"AI drafts cannot claim that a wallet signature has already happened."},{code:"ai_claims_submitted",pattern:/\b(already|pre|auto)[-\s]?(submitted|executed|broadcast|sent)\b|\bsubmitted automatically\b/,message:"AI drafts cannot claim that a transaction has already been submitted or executed."},{code:"ai_bypasses_wallet",pattern:/\b(no|without|skip|bypass)\b.{0,40}\b(wallet|approval|signature|signing)\b|\bdoes not require\b.{0,40}\b(wallet|approval|signature|signing)\b/,message:"AI drafts cannot bypass wallet approval or signing."},{code:"ai_claims_safe",pattern:/\b(guaranteed safe|risk[-\s]?free|100%\s+safe|safe to sign|guaranteed profit|guaranteed return|cannot fail|fully reversible)\b/,message:"AI drafts cannot claim that a transaction is guaranteed safe, profitable, reversible, or risk-free."}];for(const c of o)c.pattern.test(n)&&r.push({code:c.code,severity:"block",message:c.message,path:t})}function ep(e,t,r){const n=rp(e);for(const c of n)c.keys.some(d=>np(t,d))||r.push({code:"missing_executable_constraint",severity:"block",message:`${c.label} is required before this plan can enter Approval Inbox.`,path:`$.parameters.${c.keys[0]}`});const o=cl(t,["amount","amountSol","inputAmount","plannedAmount"]);o!==void 0&&!(Number(o)>0)&&r.push({code:"invalid_amount_constraint",severity:"block",message:"Amount must be a positive number before this plan can enter Approval Inbox.",path:"$.parameters.amount"})}function tp(e,t,r,n){for(const o of["route","risk","approval"]){const c=Be(e[o]);(!c||c.length<12)&&n.push({code:"vague_ai_review_text",severity:"warn",message:`AI ${o} text should be explicit before review.`,path:`$.plan.${o}`})}al(t)&&!cl(r,["memo","note","reason"])&&n.push({code:"missing_context_note",severity:"warn",message:"A memo or reason is recommended for queueable AI plans.",path:"$.parameters.memo"})}function rp(e){return e==="transfer_sol"?[{label:"Recipient",keys:["recipient","recipientAddress"]},{label:"Amount",keys:["amount","amountSol"]}]:e==="transfer_spl"?[{label:"Token",keys:["token"]},{label:"Recipient",keys:["recipient","recipientAddress"]},{label:"Amount",keys:["amount"]}]:e==="swap"?[{label:"Input token",keys:["inputToken"]},{label:"Output token",keys:["outputToken"]},{label:"Amount",keys:["amount","inputAmount"]},{label:"Slippage cap",keys:["slippageBps"]}]:e==="recurring_payment"?[{label:"Token",keys:["token"]},{label:"Recipient",keys:["recipient","recipientAddress"]},{label:"Amount",keys:["amount"]},{label:"Cadence",keys:["cadence"]}]:[]}function ap(e,t,r){var n,o;return e==="block"?((n=r.find(c=>c.severity==="block"))==null?void 0:n.message)??"Plan is blocked by guardrails.":e==="warn"?((o=r.find(c=>c.severity==="warn"))==null?void 0:o.message)??"Plan has guardrail warnings.":t==="transaction_preview"?"Plan passed guardrails and requires transaction preview before wallet approval.":t==="wallet_decision_proof"?"Plan passed guardrails and requires explicit wallet decision proof.":"Plan passed guardrails."}function ll(e){return e.toLowerCase().replace(/\s+/g," ").trim()}function np(e,t){var r;return!!((r=e[t])!=null&&r.trim())}function cl(e,t){var r;for(const n of t){const o=(r=e[n])==null?void 0:r.trim();if(o)return o}}function dl(e){if(!Bn(e))return{};const t={};for(const[r,n]of Object.entries(e))typeof n=="string"&&(t[r]=n);return t}function ul(e){return Array.isArray(e)?e.filter(t=>!!(Bn(t)&&typeof t.label=="string"&&typeof t.value=="string")).map(t=>({label:t.label,value:t.value})):[]}function ip(e){return Bn(e)?e:void 0}function Be(e){return typeof e=="string"&&e.trim()?e.trim():void 0}function Bn(e){return rn(e)}function za(e){return JSON.stringify(Di(e))}const op=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function sp(e){const t=lp(e),r=t.length*8;for(t.push(128);t.length%64!==56;)t.push(0);const n=Math.floor(r/4294967296),o=r>>>0;for(const Ce of[n,o])t.push(Ce>>>24&255,Ce>>>16&255,Ce>>>8&255,Ce&255);let c=1779033703,d=3144134277,m=1013904242,A=2773480762,$=1359893119,R=2600822924,F=528734635,pe=1541459225;const we=new Array(64);for(let Ce=0;Ce<t.length;Ce+=64){for(let Se=0;Se<16;Se+=1){const nt=Ce+Se*4;we[Se]=(t[nt]??0)<<24|(t[nt+1]??0)<<16|(t[nt+2]??0)<<8|(t[nt+3]??0)}for(let Se=16;Se<64;Se+=1){const nt=Tt(we[Se-15],7)^Tt(we[Se-15],18)^we[Se-15]>>>3,Mt=Tt(we[Se-2],17)^Tt(we[Se-2],19)^we[Se-2]>>>10;we[Se]=we[Se-16]+nt+we[Se-7]+Mt>>>0}let Le=c,Me=d,Ue=m,Ze=A,xe=$,mt=R,ht=F,at=pe;for(let Se=0;Se<64;Se+=1){const nt=Tt(xe,6)^Tt(xe,11)^Tt(xe,25),Mt=xe&mt^~xe&ht,Ut=at+nt+Mt+op[Se]+we[Se]>>>0,qt=Tt(Le,2)^Tt(Le,13)^Tt(Le,22),ar=Le&Me^Le&Ue^Me&Ue,wr=qt+ar>>>0;at=ht,ht=mt,mt=xe,xe=Ze+Ut>>>0,Ze=Ue,Ue=Me,Me=Le,Le=Ut+wr>>>0}c=c+Le>>>0,d=d+Me>>>0,m=m+Ue>>>0,A=A+Ze>>>0,$=$+xe>>>0,R=R+mt>>>0,F=F+ht>>>0,pe=pe+at>>>0}return[c,d,m,A,$,R,F,pe].map(Ce=>Ce.toString(16).padStart(8,"0")).join("")}function Tt(e,t){return e>>>t|e<<32-t}function lp(e){const t=[];for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>=55296&&n<=56319){const o=e.charCodeAt(r+1);o>=56320&&o<=57343?(n=65536+(n-55296<<10)+(o-56320),r+=1):n=65533}else n>=56320&&n<=57343&&(n=65533);n<128?t.push(n):n<2048?t.push(192|n>>6,128|n&63):n<65536?t.push(224|n>>12,128|n>>6&63,128|n&63):t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|n&63)}return t}function Di(e){if(Array.isArray(e))return e.map(Di);if(e&&typeof e=="object"){const t={};for(const r of Object.keys(e).sort()){const n=e[r];n!==void 0&&(t[r]=Di(n))}return t}return e}function pl(e,t){if(e===null||typeof e=="string"||typeof e=="boolean")return e;if(typeof e=="number"){if(!Number.isFinite(e))throw new Ne("invalid_json","Expected a finite JSON number.",t);return e}if(Array.isArray(e))return e.map((r,n)=>pl(r,`${t}[${n}]`));if(rn(e))return qn(e,t);throw new Ne("invalid_json","Expected a JSON value.",t)}function ze(e,t){if(!rn(e))throw new Ne("invalid_object","Expected an object.",t);return e}function tn(e,t,r){const n=e[t];if(n===void 0)throw new Ne("missing_field","Missing required field.",`${r}.${t}`);return n}function H(e,t,r){const n=tn(e,t,r);if(typeof n!="string")throw new Ne("invalid_string","Expected a string.",`${r}.${t}`);return n}function et(e,t,r){const n=tn(e,t,r);if(typeof n!="boolean")throw new Ne("invalid_boolean","Expected a boolean.",`${r}.${t}`);return n}function xt(e,t,r,n){const o=H(e,t,n);if(!r.includes(o))throw new Ne("invalid_enum",`Expected one of: ${r.join(", ")}.`,`${n}.${t}`);return o}function mr(e,t,r){const n=tn(e,t,r);if(!Array.isArray(n))throw new Ne("invalid_array","Expected an array.",`${r}.${t}`);return n}function cp(e,t,r){return mr(e,t,r).map((n,o)=>{if(typeof n!="string")throw new Ne("invalid_string","Expected a string.",`${r}.${t}[${o}]`);return n})}function dp(e,t,r){const n=tn(e,t,r);if(!rn(n))throw new Ne("invalid_object","Expected an object.",`${r}.${t}`);const o={};for(const[c,d]of Object.entries(n)){if(typeof d!="string")throw new Ne("invalid_string","Expected a string.",`${r}.${t}.${c}`);o[c]=d}return o}function po(e,t,r){return qn(tn(e,t,r),`${r}.${t}`)}function L(e,t,r){const n=e[t];if(n===void 0)return{};if(typeof n!="string")throw new Ne("invalid_string","Expected a string.",`${r}.${t}`);return{[t]:n}}function vs(e,t,r){const n=e[t];if(n===void 0)return{};if(typeof n!="boolean")throw new Ne("invalid_boolean","Expected a boolean.",`${r}.${t}`);return{[t]:n}}function nr(e,t,r){const n=e[t];if(n===void 0)return{};if(!Number.isInteger(n))throw new Ne("invalid_integer","Expected an integer.",`${r}.${t}`);return{[t]:n}}function Gt(e,t,r,n){const o=e[t];if(o===void 0)return{};if(typeof o!="string"||!r.includes(o))throw new Ne("invalid_enum",`Expected one of: ${r.join(", ")}.`,`${n}.${t}`);return{[t]:o}}function Et(e,t,r){const n=e[t];return n===void 0?{}:{[t]:qn(n,`${r}.${t}`)}}function up(e,t,r){const n=e[t];if(n===void 0)return{};const o=ze(n,`${r}.${t}`),c={required:et(o,"required",`${r}.${t}`),supported:et(o,"supported",`${r}.${t}`),...L(o,"reason",`${r}.${t}`)};return{[t]:c}}function mi(e,t,r,n){const o=e[t];return o===void 0?{}:{[t]:r(o,`${n}.${t}`)}}function pp(e,t,r){const n=H(e,t,r);if(n==="one-time")return"one_time";if(ys.includes(n))return n;throw new Ne("invalid_kind",`Expected one of: one-time, ${ys.join(", ")}.`,`${r}.${t}`)}function fp(e,t,r){return mr(e,t,r).map((n,o)=>{if(!Array.isArray(n)||n.length!==2||typeof n[0]!="string"||typeof n[1]!="string")throw new Ne("invalid_detail_rows","Expected a [label, value] string tuple.",`${r}.${t}[${o}]`);return[n[0],n[1]]})}function gp(e,t,r){const n=e[t];if(n==null)return{};if(typeof n!="object"||Array.isArray(n))throw new Ne("invalid_notifications",`${r}.${t} must be an object.`);const o=n,c={};return typeof o.inApp=="boolean"&&(c.inApp=o.inApp),typeof o.webhookUrl=="string"&&o.webhookUrl&&(c.webhookUrl=o.webhookUrl),typeof o.webhookSecret=="string"&&o.webhookSecret&&(c.webhookSecret=o.webhookSecret),{[t]:c}}function mp(e){if(e===!0)return!0;if(typeof e=="string"){const t=e.toLowerCase();return t.includes("unlimited")||t.includes("delegate")||t.includes("any amount")}return typeof e=="number"?!Number.isFinite(e):!1}function rn(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}const hp=12e4,Er=new Map;let yp=1;function fl(){const e=fo();return{isAndroidNative:!!(e!=null&&e.mwaRequest),bridgeAvailable:!!e}}async function vp(){return{count:(await zt("status")).cachedCount}}async function gl(e){const t=new In(e),r=await t.reconnectLatest();return r?{backend:t,address:r,walletName:t.walletName(),cacheCount:t.cacheCount()}:null}class In{constructor(t){Pr(this,"cluster");Pr(this,"approvals",new Map);Pr(this,"activeStatus",null);this.cluster=bp(t.cluster)}async capabilities(){var t,r,n;return(t=this.activeStatus)!=null&&t.capabilities||await this.refreshStatus(),(r=this.activeStatus)!=null&&r.capabilities?this.activeStatus.capabilities:bs(this.cluster,(n=this.activeStatus)==null?void 0:n.address)}async getAddress(){var r;if((r=this.activeStatus)!=null&&r.address)return this.activeStatus.address;const t=await this.refreshStatus();return t.address?t.address:this.connect()}async connect(){const t=await zt("connect",{cluster:this.cluster});if(this.applyStatus(t),!t.address)throw new $t("wallet_unreachable","Android MWA did not return a wallet address.");return t.address}async reconnectLatest(){const t=await zt("reconnectLatest",{cluster:this.cluster});return this.applyStatus(t),t.address??null}async submit(t){if(t.cluster!==this.cluster)throw new $t("cluster_mismatch",`Android native MWA is connected to ${this.cluster}; request targets ${t.cluster}.`);await this.getAddress();const r={requestId:t.id,status:"pending"};return this.approvals.set(t.id,r),pr("submit","START",{requestId:t.id,kind:t.kind,cluster:t.cluster,payload:aa(t)}),zt("sign",t).then(n=>{this.approvals.set(t.id,{requestId:t.id,status:"approved",result:n}),pr("submit","SUCCESS",{requestId:t.id,kind:t.kind,result:aa(n)})}).catch(n=>{const o=ml(n);this.approvals.set(t.id,{requestId:t.id,status:o.code==="user_rejected"?"rejected":"failed",error:o.toPayload()}),pr("submit","FAIL",{requestId:t.id,kind:t.kind,code:o.code,message:o.message,error:o.toPayload()},"warn")}),r}async poll(t){const r=this.approvals.get(t);if(!r)throw new $t("invalid_request",`Unknown Android native MWA request id: ${t}`);return r}async cancel(t){this.approvals.get(t)&&this.approvals.set(t,{requestId:t,status:"rejected",error:{code:"user_rejected",message:"Android native MWA approval request cancelled by caller.",recoverable:!1}})}async disconnect(){const t=await zt("disconnect");this.applyStatus(t)}async clearTransientState(){const t=await zt("clearTransient");this.applyStatus(t)}async clearStateFullReset(){const t=await zt("fullReset");this.applyStatus(t)}async clearAllCachedAuthorizations(){const t=await zt("clearAllAccounts");this.applyStatus(t)}walletName(){return xp(this.activeStatus)}cacheCount(){var t;return((t=this.activeStatus)==null?void 0:t.cachedCount)??0}async refreshStatus(){const t=await zt("status");return this.applyStatus(t),t}applyStatus(t){this.activeStatus={...t,capabilities:t.capabilities??bs(this.cluster,t.address)}}}function bs(e,t){return{backend:"android-native-mwa",cluster:[e],supports:{signMessage:!0,signTransaction:!0,signAndSendTransaction:!0,multiSign:!0,simulationPreview:!1},...t&&{address:t}}}function bp(e){if(e==="localnet")throw new $t("cluster_mismatch","Android native MWA supports mainnet-beta, devnet, and testnet. Select devnet for local testing.");return e}function zt(e,t){wp();const r=fo();if(!(r!=null&&r.mwaRequest))return Promise.reject(new $t("wallet_unreachable","Android native MWA bridge is not available."));const n=r,o=`android-mwa-${Date.now()}-${yp++}`;return new Promise((c,d)=>{const m=window.setTimeout(()=>{Er.delete(o),pr("request","FAIL",{method:e,requestId:o,reason:"timeout"},"warn"),d(new $t("expired",`Android native MWA request ${o} timed out.`))},hp);Er.set(o,{method:e,resolve:A=>c(A),reject:d,timer:m});try{const A=JSON.stringify(t??{});pr("request","START",{method:e,requestId:o,payloadChars:A.length,payloadHash:vl(A),payload:aa(t??{})}),n.mwaRequest(o,e,A)}catch(A){window.clearTimeout(m),Er.delete(o),pr("request","FAIL",{method:e,requestId:o,error:A instanceof Error?A.message:String(A),payload:aa(t??{})},"warn"),d(ml(A))}})}function wp(){const e=window;e.__agenticAndroidMwaBridge||(e.__agenticAndroidMwaBridge={resolve(t,r){const n=Er.get(t);n&&(window.clearTimeout(n.timer),Er.delete(t),pr("request","SUCCESS",{method:n.method,requestId:t,payload:aa(r)}),n.resolve(r))},reject(t,r){const n=Er.get(t);n&&(window.clearTimeout(n.timer),Er.delete(t),pr("request","FAIL",{method:n.method,requestId:t,code:r.code??"UNKNOWN",message:r.message??"Android native MWA request failed.",error:aa(r)},"warn"),n.reject(hl(r)))}})}function fo(){return globalThis.AgenticAndroid}function Ap(){var e,t;try{return((t=(e=fo())==null?void 0:e.isDebugBuild)==null?void 0:t.call(e))===!0}catch{return!1}}function ml(e){return e instanceof $t?e:$p(e)?$t.fromPayload(e):yl(e)?hl(e):new $t("wallet_unreachable",e instanceof Error?e.message:String(e))}function hl(e){return new $t(Sp(e.code),e.message||"Android native MWA request failed.")}function Sp(e){switch((e??"").toUpperCase()){case"USER_REJECTED":return"user_rejected";case"UNAUTHORIZED":case"WALLET_AUTH_MISMATCH":case"WALLET_CHANGED":case"INSUFFICIENT_FUNDS_FOR_RENT":return"unauthorized";case"CLUSTER_MISMATCH":return"cluster_mismatch";case"UNSUPPORTED_METHOD":case"WALLET_SIGN_MESSAGES_UNSUPPORTED":case"JUPITER_SIGN_TRANSACTION_UNSUPPORTED":return"unsupported_method";case"INVALID_PAYLOADS":case"INVALID_REQUEST":return"invalid_request";case"NO_WALLET_FOUND":case"WALLET_HUNG":case"WALLET_ERROR":case"WALLET_NATIVE_SIGN_AND_SEND_UNSUPPORTED":case"RPC_BROADCAST_FAILED":default:return"wallet_unreachable"}}function $p(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.code=="string"&&typeof t.message=="string"}function yl(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.code=="string"||typeof t.message=="string"}function xp(e){var r;const t=((r=e==null?void 0:e.walletPackage)==null?void 0:r.toLowerCase())??"";return t.includes("phantom")?"Phantom":t.includes("solflare")?"Solflare":t.includes("backpack")?"Backpack":t.includes("jupiter")?"Jupiter":e!=null&&e.accountLabel?e.accountLabel:"Mobile Wallet Adapter"}function pr(e,t,r,n="info"){const o=Object.entries(r).map(([d,m])=>`${d}=${kp(m)}`).join(" "),c=`[AgentAndroidNative] ${e} | ${t}${o?` ${o}`:""}`;if(n==="warn"){console.warn(c);return}console.info(c)}function kp(e){try{return JSON.stringify(e)??"undefined"}catch(t){return JSON.stringify(t instanceof Error?t.message:String(e))??'"[unserializable]"'}}function aa(e){return Ap()?e:Pp(e)}function Pp(e){var t,r,n;if(!e||typeof e!="object")return e;if(Cp(e)){const o=e;return{id:o.id,kind:o.kind,cluster:o.cluster,payload:{encoding:o.payload.encoding,chars:o.payload.data.length,hash:vl(o.payload.data)},display:o.display?{summary:o.display.summary,riskLevel:o.display.riskLevel,simulationErr:((t=o.display.simulation)==null?void 0:t.err)??null,simulationLogCount:((n=(r=o.display.simulation)==null?void 0:r.logs)==null?void 0:n.length)??0}:void 0,expiresAt:o.expiresAt}}if(Tp(e)){const o=e;return{signature:o.signature,txid:o.txid}}return yl(e)?{code:e.code,message:e.message}:e}function Cp(e){const t=e;return typeof t.id=="string"&&typeof t.kind=="string"&&typeof t.cluster=="string"&&typeof t.payload=="object"&&t.payload!==null&&typeof t.payload.data=="string"&&typeof t.payload.encoding=="string"}function Tp(e){const t=e;return typeof t.signature=="string"||typeof t.txid=="string"}function vl(e){let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")}const Ip={VITE_AGENTIC_GA_MEASUREMENT_ID:""},ws="agentic-ga4",kn=Mp();let As=!1,Ss="";function bl(){if(!kn||As||typeof window>"u"||typeof document>"u")return;const e=window;if(e.dataLayer=e.dataLayer??[],e.gtag=e.gtag??function(){var r;(r=e.dataLayer)==null||r.push(arguments)},e.gtag("consent","default",{analytics_storage:"granted",ad_storage:"denied",ad_user_data:"denied",ad_personalization:"denied",personalization_storage:"denied",security_storage:"granted",functionality_storage:"granted"}),e.gtag("set",{allow_google_signals:!1,allow_ad_personalization_signals:!1}),e.gtag("js",new Date),e.gtag("config",kn,{send_page_view:!1,allow_google_signals:!1,allow_ad_personalization_signals:!1}),!document.getElementById(ws)){const t=document.createElement("script");t.id=ws,t.async=!0,t.src=`https://www.googletagmanager.com/gtag/js?id=${encodeURIComponent(kn)}`,document.head.appendChild(t)}As=!0}function Rp(e,t){const r=Np(e);r!==Ss&&(Ss=r,br("page_view",{page_title:t,page_location:`${window.location.origin}${r}`,page_path:r}))}function Pn(e,t){br("nav_click",{target_route:Wp(e),nav_area:rt(t)})}function Ep(e,t,r){br("download_click",{download_kind:rt(e),platform:rt(t),asset_name:rt(r)})}function _p(e){br("cli_command_copy",{command_kind:rt(e)})}function Lp(e){br("generate_template_plan",{template_id:rt(e)})}function Op(e,t,r){br("generate_ai_plan",{template_id:rt(e),ai_mode:rt(t),ai_provider:rt(r)})}function Fn(e,t){br("connect_wallet_click",{wallet_surface:rt(e),connect_source:rt(t)})}function Zr(e,t,r){br("wallet_connect_success",{wallet_surface:rt(e),cluster:rt(t),connect_source:rt(r)})}function br(e,t={}){if(!kn)return;bl();const r=window.gtag;r&&r("event",e,Dp(t))}function Dp(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function Np(e){const t=e.trim()||"/",r=t.startsWith("http")?new URL(t).pathname:t.split(/[?#]/,1)[0]??"/";return(r.startsWith("/")?r:`/${r}`).replace(/\/+$/,"")||"/"}function Wp(e){const t=e.trim()||"/",r=t.startsWith("http")?new URL(t):null,n=r?`${r.pathname}${r.hash}`:t.split("?",1)[0]??"/",[o="/",c=""]=n.split("#",2),d=(o.startsWith("/")?o:`/${o}`).replace(/\/+$/,"")||"/",m=c?`#${rt(c)}`:"";return`${d}${m}`.slice(0,80)}function rt(e){return e.trim().toLowerCase().replace(/[^a-z0-9_./-]+/g,"_").slice(0,80)||"unknown"}function Mp(){const e=Ip;return String(e==null?void 0:e.VITE_AGENTIC_GA_MEASUREMENT_ID).trim()}class wl extends Error{constructor(r,n){super(je(r));Pr(this,"diagnostics");this.name="AiPlanConnectionError",this.diagnostics=n.map(ho)}}const go=["Wallet approval is required before any signature or transaction leaves the device.","The agent never receives the wallet private key or seed phrase.","Amounts, recipients, routes, and policy notes must be visible before signing."],$s="https://api.openai.com/v1",Yr="gpt-5",mo="openai",Rn=[{id:"openai",label:"OpenAI",detail:"GPT models through Agentic hosted or local bridge calls.",apiFormat:"openai-compatible",baseUrl:$s,model:Yr,models:[{id:"gpt-5.5",label:"GPT-5.5"},{id:"gpt-5.4",label:"GPT-5.4"},{id:"gpt-5.4-mini",label:"GPT-5.4 mini"},{id:"gpt-5.4-nano",label:"GPT-5.4 nano"},{id:Yr,label:"GPT-5"},{id:"gpt-5.2",label:"GPT-5.2"},{id:"gpt-5.1",label:"GPT-5.1"},{id:"gpt-5-mini",label:"GPT-5 mini"},{id:"gpt-5-nano",label:"GPT-5 nano"},{id:"gpt-4.1",label:"GPT-4.1"}]},{id:"anthropic",label:"Claude / Anthropic",detail:"Claude models through the Anthropic Messages API.",apiFormat:"anthropic",baseUrl:"https://api.anthropic.com/v1",model:"claude-sonnet-4-5",models:[{id:"claude-sonnet-4-5",label:"Claude Sonnet 4.5"},{id:"claude-sonnet-4-5-20250929",label:"Claude Sonnet 4.5 snapshot"},{id:"claude-opus-4-1-20250805",label:"Claude Opus 4.1"},{id:"claude-sonnet-4-20250514",label:"Claude Sonnet 4"},{id:"claude-3-5-haiku-20241022",label:"Claude Haiku 3.5"}]},{id:"gemini",label:"Gemini",detail:"Google Gemini through its OpenAI-compatible endpoint.",apiFormat:"openai-compatible",baseUrl:"https://generativelanguage.googleapis.com/v1beta/openai",model:"gemini-2.5-flash",models:[{id:"gemini-2.5-flash",label:"Gemini 2.5 Flash"},{id:"gemini-2.5-pro",label:"Gemini 2.5 Pro"},{id:"gemini-2.5-flash-lite",label:"Gemini 2.5 Flash-Lite"},{id:"gemini-2.0-flash",label:"Gemini 2.0 Flash"}]},{id:"openrouter",label:"OpenRouter",detail:"Use OpenRouter as a gateway for many hosted models.",apiFormat:"openai-compatible",baseUrl:"https://openrouter.ai/api/v1",model:"openrouter/auto",models:[{id:"openrouter/auto",label:"Auto Router"},{id:"openai/gpt-5",label:"OpenAI GPT-5"},{id:"anthropic/claude-sonnet-4.5",label:"Claude Sonnet 4.5"},{id:"google/gemini-2.5-pro",label:"Gemini 2.5 Pro"}]},{id:"custom-openai-compatible",label:"Custom OpenAI-compatible",detail:"Vercel AI Gateway, Cloudflare AI Gateway, or a self-hosted proxy.",apiFormat:"openai-compatible",baseUrl:$s,model:Yr,models:[{id:Yr,label:"GPT-5 compatible default"}]}],En=[$e("payments","transfer-sol","Send SOL","Prepare a SOL payment with recipient, amount, memo, and wallet approval.","transfer_sol","medium",[G("recipient","Recipient address","Recipient public key","",!0),G("amount","Amount SOL","0.01","0.01",!0),G("memo","Memo / reason","Invoice, friend payment, reimbursement","User-approved SOL payment")]),$e("payments","transfer-token","Send SPL token","Prepare a token transfer for USDC, BONK, JUP, or any configured SPL token.","transfer_spl","medium",[Xe("token","Token",["USDC","SOL","JUP","BONK","WIF","PYUSD"],"USDC"),G("recipient","Recipient address","Recipient public key","",!0),G("amount","Token amount","10","10",!0),G("memo","Memo / reason","Payment reason","User-approved token payment")]),$e("trading","swap","Swap tokens","Prepare a Jupiter-style swap request with explicit input, output, amount, and slippage cap.","swap","medium",[Xe("inputToken","Input token",["SOL","USDC","JUP","BONK","WIF","PYUSD"],"SOL"),Xe("outputToken","Output token",["USDC","SOL","JUP","BONK","WIF","PYUSD"],"USDC"),G("amount","Input amount","0.01","0.01",!0),G("slippageBps","Max slippage bps","50","50")]),$e("recurring","dca","DCA review proof","Sign a review proof for a recurring DCA strategy before using a swap-capable recurring engine.","manual_review","medium",[Xe("token","Spend token",["SOL","USDC","PYUSD"],"USDC"),G("amount","Amount per occurrence","10","10",!0),G("recipient","Recipient / settlement wallet","Recipient public key","",!0),Xe("cadence","Cadence",["weekly","monthly","interval_days"],"weekly"),G("memo","Strategy note","Buy SOL weekly if route stays under cap","Recurring DCA approval")]),$e("recurring","subscription","Subscription / allowance","Prepare a recurring payment review without granting unlimited authority.","recurring_payment","medium",[Xe("token","Token",["USDC","SOL","PYUSD"],"USDC"),G("recipient","Recipient address","Recipient public key","",!0),G("amount","Max amount per payment","5","5",!0),Xe("cadence","Cadence",["weekly","monthly","interval_days"],"monthly"),G("memo","Service / reason","Subscription memo","Recurring user-approved payment")]),$e("trading","limit-order","Limit order review","Prepare a limit-order intent that waits for explicit wallet approval at execution time.","manual_review","medium",[Xe("inputToken","Input token",["SOL","USDC","JUP","BONK","WIF"],"SOL"),Xe("outputToken","Output token",["USDC","SOL","JUP","BONK","WIF"],"USDC"),G("amount","Input amount","0.1","0.1"),G("limitPrice","Limit price / condition","Only if SOL >= $250","")]),$e("trading","rebalance","Portfolio rebalance","Plan a rebalance while preserving final wallet approval for each action.","manual_review","high",[Cr("target","Target allocation","Example: 60% SOL, 30% USDC, 10% JUP"),G("maxTradeSize","Max trade size","100 USDC","100 USDC"),G("slippageBps","Max slippage bps","50","50")]),$e("portfolio","balances","Portfolio check","Read and summarize wallet balances before proposing any action.","read_only","low",[Xe("scope","Scope",["SOL + configured tokens","All SPL tokens","NFTs","DeFi positions"],"SOL + configured tokens"),G("threshold","Alert threshold","Show assets over $10","Show assets over $10")]),$e("portfolio","nft-review","NFT holdings review","Review NFT holdings, floor-risk notes, and suspicious collection signals.","read_only","low",[G("collection","Collection / mint","Optional collection name or mint",""),Xe("goal","Goal",["Summarize","Flag suspicious assets","Prepare sale review","Prepare transfer review"],"Summarize")]),$e("staking","stake-sol","Stake SOL","Prepare a staking/delegation action with validator and amount visible before signing.","manual_review","medium",[G("validator","Validator vote account","Vote account or validator name","",!0),G("amount","Amount SOL","1","1"),G("memo","Reason","Stake with selected validator","Stake review")]),$e("staking","unstake-sol","Unstake / deactivate","Prepare an unstake or deactivate review with cooldown expectations.","manual_review","medium",[G("stakeAccount","Stake account","Stake account public key",""),G("amount","Amount SOL or all","all","all"),G("memo","Reason","Liquidity needed","Unstake review")]),$e("governance","vote","Governance vote","Summarize a proposal and create a wallet review proof for the chosen vote.","manual_review","medium",[G("proposal","Proposal link / id","Realm proposal URL or id","",!0),Xe("vote","Vote",["Yes","No","Abstain"],"Abstain"),Cr("reason","Voting reason","Why this vote matches my policy")]),$e("security","transaction-review","Transaction simulation review","Review transaction bytes, touched programs, accounts, and authority changes before signing.","manual_review","high",[Cr("transaction","Transaction / link / base64","Paste transaction bytes, link, or request description"),G("policy","Policy cap","No new authority grants, no unlimited approvals","No new authority grants")]),$e("security","authority-audit","Authority / approval audit","Look for delegate authority, token account permissions, and suspicious approval semantics.","manual_review","high",[G("programOrMint","Program, mint, or account","Address to review",""),Cr("concern","Concern","What feels risky or needs checking?")]),$e("security","rug-check","Token risk check","Prepare a token risk review before buying, swapping, or accepting a token.","manual_review","high",[G("mint","Token mint","Mint address",""),G("amount","Planned amount","Optional amount",""),G("source","Source / link","DexScreener, Jupiter, X, website","")]),$e("defi","lend-borrow","Lending / borrow review","Prepare a DeFi lending, borrow, repay, or withdraw plan with collateral risk visible.","manual_review","high",[Xe("action","Action",["Deposit","Withdraw","Borrow","Repay"],"Deposit"),G("market","Protocol / market","Kamino, MarginFi, Solend, custom",""),G("amount","Amount","100 USDC","100 USDC"),G("ltv","Max LTV / rule","Stay below 50% LTV","Stay below 50% LTV")]),$e("defi","liquidity","Liquidity position review","Review LP deposits, withdrawals, fees, and impermanent loss before wallet approval.","manual_review","high",[G("pool","Pool / protocol","Orca, Raydium, Meteora, custom",""),G("amounts","Amounts","0.1 SOL + 20 USDC",""),G("range","Price range / condition","Optional range","")]),$e("nft","nft-transfer","NFT transfer","Prepare an NFT transfer with recipient, collection, and anti-phishing checks.","manual_review","medium",[G("mint","NFT mint","Mint address","",!0),G("recipient","Recipient address","Recipient public key","",!0),G("memo","Reason","Transfer memo","NFT transfer review")]),$e("nft","marketplace-listing","Marketplace listing review","Prepare a listing or delisting review with price, marketplace, and royalties visible.","manual_review","medium",[G("mint","NFT mint","Mint address",""),G("marketplace","Marketplace","Tensor, Magic Eden, custom",""),G("price","Price","1 SOL","")]),$e("developer","devnet-smoke","Devnet smoke test","Prepare a safe devnet signing test for local wallets, bridge, and receipt flow.","manual_review","low",[G("message","Test message","Approve this Agentic devnet smoke test.","Approve this Agentic devnet smoke test."),Xe("network","Network",["devnet","testnet","localnet"],"devnet")]),$e("developer","custom-tx","Custom transaction bytes","Review pasted transaction bytes and produce an approval checklist before signing.","manual_review","high",[Cr("transaction","Transaction bytes / base64","Paste base64 transaction bytes"),G("expected","Expected outcome","What should happen if signed?","")]),$e("mobile","seed-vault","Seed Vault mobile approval","Plan an Android MWA or Seed Vault signing path without exposing wallet keys.","manual_review","medium",[Xe("walletPath","Wallet path",["Mobile Wallet Adapter","Seed Vault Wallet","Phantom mobile","Solflare mobile"],"Mobile Wallet Adapter"),G("action","Action","Connect wallet and approve request","Connect wallet and approve request"),G("deviceNote","Device note","Seeker / Android Chrome / TWA","Android Chrome / TWA")]),$e("integration","dapp-interaction","dApp interaction review","Prepare a review for a third-party dApp request before the user signs.","manual_review","high",[G("dapp","dApp / URL","Jupiter, Meteora, Tensor, custom URL",""),Cr("request","Request details","What the dApp asks the wallet to sign"),G("policy","Policy cap","No unknown programs or authority grants","No unknown programs or authority grants")]),$e("bridge","bridge-swap","Bridge / cross-chain link review","Review a bridge or cross-chain link while keeping signing inside the wallet flow.","manual_review","high",[G("sourceChain","Source chain","Solana","Solana"),G("destinationChain","Destination chain","Base, Ethereum, Arbitrum, Solana",""),G("amount","Amount","10 USDC","10 USDC"),G("link","Bridge link / quote","Paste link or quote id","")]),$e("receipts","tax-export","Receipt / tax note","Create an audit note after approval for tax, accounting, or operations review.","read_only","low",[G("txid","Transaction id","Optional tx id",""),G("label","Label","Treasury transfer, swap, reimbursement","Agentic wallet action"),Cr("notes","Notes","Accounting or audit notes")]),$e("custom","custom-request","Custom request","Turn any plain-English request into a visible review plan before signing evidence.","manual_review","medium",[G("policy","Policy cap","What should never be allowed?","No private key sharing, no unlimited approvals")])];function Vt(e){return En.find(t=>t.id===e)??En[0]}function Rt(e){return Object.fromEntries(e.fields.map(t=>[t.id,t.defaultValue??""]))}function Up(e,t){var r;return((r=e.fields.find(n=>n.id===t))==null?void 0:r.label)??vo(t)}function Al(e,t,r="template",n=""){const o=af(e,t),c=o.length?o.map(A=>`${A.label}: ${A.value}`).join("; "):e.prompt,d=n.trim(),m={intent:r==="ai"?e.prompt:`${e.title}: ${c}`,route:hi(e.route,t),risk:hi(e.riskText,t),approval:hi(e.approval,t),source:r,category:e.category,actionType:e.actionType,templateTitle:e.title,...d&&{userNotes:d},parameters:t,fields:o,safeguards:[...go,...e.safeguards]};return yo(m,{templateId:e.id,prompt:d||e.description})}function bt(e){return Rn.find(t=>t.id===e)??Rn[0]}function qp(e){return e==="anthropic"?"Anthropic Messages API":"OpenAI-compatible"}function Bp(e,t){const r=t.method??(e.mode==="session"?void 0:"POST"),n=e.model.trim()||"model configured";return e.mode==="bridge"?{code:"AI_ROUTE",message:r==="GET"?"Local bridge AI status route selected.":"Local bridge AI route selected.",detail:nf(t.bridgeBaseUrl,t.path),...r&&{method:r},path:t.path}:e.mode==="session"?{code:"AI_ROUTE",message:"Browser session AI route selected.",detail:`${e.provider} ${n}`}:{code:"AI_ROUTE",message:r==="GET"?"Hosted BYOK status route selected.":"Hosted BYOK route selected.",detail:`${e.provider} ${n}${t.origin?` on ${t.origin}`:""}`,...r&&{method:r},path:t.path}}async function Fp(e,t){if(!e.apiKey.trim())throw new Error("Session AI key is required.");if(Cl(t),e.provider==="openai")throw new Error("OpenAI keys cannot be called directly from browser session mode. Select Hosted BYOK or Local bridge.");return e.apiFormat==="anthropic"?Qp(e,t):Vp(e,t)}async function jp(e,t){if(!e.apiKey.trim())throw new Error("Hosted BYOK key is required.");Cl(t);const r=[{code:"AI_ROUTE",message:"Hosted BYOK route selected.",detail:`provider=${e.provider}; model=${e.model.trim()||bt(e.provider).model}`,method:"POST",path:"/api/ai/generate-plan"}];await Sl(r);const n=await fetch("/api/ai/generate-plan",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({settings:{apiKey:e.apiKey,provider:e.provider,apiFormat:e.apiFormat,baseUrl:e.baseUrl,model:e.model},request:t})}).catch(c=>{throw na(`Hosted AI request failed. ${je(c instanceof Error?c.message:String(c),e.apiKey)}`,r,{code:"AI_PROVIDER_ERROR",message:"Hosted BYOK request could not reach the same-origin API.",detail:je(c instanceof Error?c.message:String(c),e.apiKey),method:"POST",path:"/api/ai/generate-plan"})}),o=await $l(n,"Hosted BYOK API returned a non-JSON response. Serve Agentic through the Render Node service or use Local bridge.",r,{method:"POST",path:"/api/ai/generate-plan"});if(!n.ok){const c=je(Il(o)||`Hosted AI returned HTTP ${n.status}.`,e.apiKey);throw na(c,r,{code:"AI_PROVIDER_ERROR",message:c,method:"POST",path:"/api/ai/generate-plan",status:n.status,contentType:n.headers.get("content-type")??""})}return r.push({code:"AI_PLAN_READY",message:"Hosted BYOK returned a valid AI plan.",method:"POST",path:"/api/ai/generate-plan",status:n.status,contentType:n.headers.get("content-type")??""}),Jp(o,t)}async function Hp(e){if(!e.apiKey.trim())throw new Error("Hosted BYOK key is required before confirming planner setup.");if(e.provider==="custom-openai-compatible")throw new Error("Hosted BYOK supports preset providers only. Use Local bridge or Browser Session for custom gateways.");if(!e.model.trim())throw new Error("Choose or enter an AI model before confirming planner setup.");const t=[{code:"AI_ROUTE",message:"Hosted BYOK planner confirmation selected.",detail:`provider=${e.provider}; model=${e.model.trim()||bt(e.provider).model}`,method:"GET",path:"/api/ai/status"}];return await Sl(t),t.push({code:"AI_PLAN_READY",message:"Hosted BYOK planner route confirmed. No plan was generated.",detail:"Provider key is used only when creating an AI draft; workflow approvals remain separate.",method:"GET",path:"/api/ai/status"}),t.map(ho)}async function Sl(e){const t=await fetch("/api/ai/status",{headers:{accept:"application/json"}}).catch(n=>{throw na(`Hosted BYOK API is not reachable on this origin. Serve Agentic through the Render Node service or use Local bridge. ${n instanceof Error?n.message:String(n)}`,e,{code:"AI_PROVIDER_ERROR",message:"Hosted BYOK status request failed before a response was returned.",detail:n instanceof Error?n.message:String(n),method:"GET",path:"/api/ai/status"})}),r=await $l(t,"Hosted BYOK API is not available on this origin. Serve Agentic through the Render Node service or use Local bridge.",e,{method:"GET",path:"/api/ai/status"});if(!t.ok||!zp(r))throw na("Hosted BYOK API is not available on this origin. Serve Agentic through the Render Node service or use Local bridge.",e,{code:"AI_PROVIDER_ERROR",message:"Hosted BYOK status response was not the expected hosted-byok JSON.",method:"GET",path:"/api/ai/status",status:t.status,contentType:t.headers.get("content-type")??""})}function zp(e){if(!e||typeof e!="object")return!1;const t=e;return t.available===!0&&t.mode==="hosted-byok"}async function $l(e,t,r,n){const o=e.headers.get("content-type")??"";r.push({code:"AI_HTTP",message:`${n.method} ${n.path} returned HTTP ${e.status}.`,method:n.method,path:n.path,status:e.status,contentType:o});const c=await e.text().catch(()=>"");if(!c.trim())return{};try{return JSON.parse(c)}catch{throw Gp(c,o)?na(Kp(n.path,e.status,o),r,{code:"AI_ROUTE_MISMATCH",message:"Hosted AI API routed to frontend shell.",detail:`${n.path} returned HTML instead of hosted BYOK JSON.`,method:n.method,path:n.path,status:e.status,contentType:o}):na(t,r,{code:"AI_CONTENT_TYPE",message:"Hosted BYOK API returned a non-JSON response.",method:n.method,path:n.path,status:e.status,contentType:o})}}function Gp(e,t){return/text\/html/i.test(t)||/^\s*<!doctype\s+html/i.test(e)||/^\s*<html[\s>]/i.test(e)}function Kp(e,t,r){return`Hosted AI API routed to frontend shell. ${e} returned HTTP ${t} ${r||"unknown content-type"} instead of JSON. Redeploy Render as the Node web service.`}function na(e,t,r){return new wl(e,[...t,r])}function ho(e){return{...e,message:je(e.message),...e.detail!==void 0&&{detail:je(e.detail)},...e.contentType!==void 0&&{contentType:je(e.contentType)}}}function xl(e){if(e instanceof wl)return e.diagnostics;if(e&&typeof e=="object"&&"diagnostics"in e){const t=e.diagnostics;if(Array.isArray(t))return t.filter(Yp).map(ho)}return[]}function Yp(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.code=="string"&&typeof t.message=="string"}async function Vp(e,t){const r=Tl(e.baseUrl,"openai-compatible"),n={model:e.model.trim()||Yr,response_format:{type:"json_object"},messages:kl(t),...!of(e.model.trim()||Yr)&&{temperature:.2}},o=await fetch(`${r}/chat/completions`,{method:"POST",headers:{authorization:`Bearer ${e.apiKey.trim()}`,"content-type":"application/json"},body:JSON.stringify(n)}).catch(d=>{throw new Error(`AI provider request failed. Use the local bridge or a browser-compatible gateway. ${je(d instanceof Error?d.message:String(d),e.apiKey)}`)}),c=await o.json().catch(()=>({}));if(!o.ok)throw new Error(Rl(c,o.status,e.apiKey));return Pl(c,t)}function Jp(e,t){if(!Zp(e))throw new Error("Hosted AI returned an invalid plan.");const r=e,n=Array.isArray(r.fields)?r.fields.filter(d=>!!d&&typeof d=="object"&&typeof d.label=="string"&&typeof d.value=="string"):Object.entries(t.parameters).filter(([,d])=>d.trim().length>0).map(([d,m])=>({label:vo(d),value:m})),o=Array.isArray(r.safeguards)?r.safeguards.filter(d=>typeof d=="string"&&d.trim().length>0):go,c={intent:At(r.intent,`${t.template.title}: ${t.prompt}`),route:At(r.route,`Prepare ${t.template.actionType} request and show route details before wallet approval.`),risk:At(r.risk,`Risk level ${t.template.risk}. Verify all visible fields before signing.`),approval:At(r.approval,"Wallet approval remains a separate explicit user action."),source:"ai",category:At(r.category,t.template.category),actionType:At(r.actionType,t.template.actionType),templateTitle:At(r.templateTitle,t.template.title),userNotes:typeof r.userNotes=="string"?r.userNotes:t.userNotes,parameters:r.parameters&&typeof r.parameters=="object"?r.parameters:t.parameters,fields:n,safeguards:o};return yo(c,{templateId:t.template.id,prompt:t.prompt})}function Zp(e){if(!e||typeof e!="object")return!1;const t=e;return t.source==="ai"&&typeof t.intent=="string"&&typeof t.route=="string"&&typeof t.risk=="string"&&typeof t.approval=="string"}async function Qp(e,t){var A,$;const r=Tl(e.baseUrl,"anthropic"),n=kl(t),o=((A=n[0])==null?void 0:A.content)??"",c=(($=n[1])==null?void 0:$.content)??JSON.stringify(t),d=await fetch(`${r}/messages`,{method:"POST",headers:{"anthropic-dangerous-direct-browser-access":"true","anthropic-version":"2023-06-01","content-type":"application/json","x-api-key":e.apiKey.trim()},body:JSON.stringify({model:e.model.trim()||bt("anthropic").model,max_tokens:1024,system:o,messages:[{role:"user",content:c}],temperature:.2})}).catch(R=>{throw new Error(`AI provider request failed. Use the local bridge or a browser-compatible gateway. ${je(R instanceof Error?R.message:String(R),e.apiKey)}`)}),m=await d.json().catch(()=>({}));if(!d.ok)throw new Error(Rl(m,d.status,e.apiKey));return Pl(m,t)}function kl(e){return[{role:"system",content:"You convert Solana wallet user requests into structured approval plans. Return only JSON with string fields intent, route, risk, approval, and safeguards as an array of short strings. Never claim a transaction is signed, submitted, approved, or safe. Never request private keys. The wallet user must approve separately."},{role:"user",content:JSON.stringify({userPrompt:e.prompt,userNotes:e.userNotes,template:e.template,parameters:e.parameters,requiredBoundary:"AI prepares a plan only. Wallet approval and signing happen later in the user wallet."})}]}function Pl(e,t){var m;const r=sf(e),n=lf(r),o=Vt(t.template.id),c=Al(o,t.parameters,"ai"),d={...c,intent:At(n.intent,c.intent),route:At(n.route,c.route),risk:At(n.risk,c.risk),approval:At(n.approval,c.approval),source:"ai",userNotes:((m=t.userNotes)==null?void 0:m.trim())||t.prompt.trim()||void 0,safeguards:cf(n.safeguards,c.safeguards)};return yo(d,{templateId:o.id,prompt:t.prompt})}function Cl(e){rl({source:"ai",category:e.template.category,actionType:e.template.actionType,templateId:e.template.id,templateTitle:e.template.title,parameters:e.parameters,userNotes:e.userNotes,prompt:e.prompt,plan:{source:"ai",category:e.template.category,actionType:e.template.actionType,templateId:e.template.id,templateTitle:e.template.title,parameters:e.parameters,prompt:e.prompt,userNotes:e.userNotes,intent:e.prompt,route:"AI draft only. Wallet approval is required later.",risk:`Requested risk level ${e.template.risk}.`,approval:"Wallet approval is required before signing or submitting."}})}function yo(e,t={}){const r=rl({plan:{...e},source:e.source,category:e.category,actionType:e.actionType,templateId:t.templateId,templateTitle:e.templateTitle,parameters:e.parameters,fields:e.fields,userNotes:e.userNotes,prompt:t.prompt});return{...e,guardrailReport:r,constraintFingerprint:r.constraintFingerprint,...r.constraintHash?{constraintHash:r.constraintHash}:{}}}function je(e,t=""){const r=t.trim();return(r?e.split(r).join("[redacted]"):e).replace(/Bearer\s+[A-Za-z0-9._~+/=-]+/gi,"Bearer [redacted]").replace(/\bsk-proj-[A-Za-z0-9_-]{8,}\b/g,"sk-proj-[redacted]").replace(/\bsk-[A-Za-z0-9_-]{8,}\b/g,"sk-[redacted]").replace(/\b[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}\b/g,"[redacted-token]").replace(/(api[-_ ]?key|token|secret)(["':=\s]+)([^"',\s]{8,})/gi,"$1$2[redacted]")}function $e(e,t,r,n,o,c,d){return{id:t,category:e,title:r,description:n,actionType:o,risk:c,route:Xp(o),riskText:ef(c),approval:tf(o),safeguards:rf(o,c),requiresWallet:o!=="read_only",requiresBridge:["transfer_sol","transfer_spl","swap","recurring_payment"].includes(o),fields:d,prompt:n}}function G(e,t,r="",n="",o=!1){return{id:e,label:t,placeholder:r,defaultValue:n,required:o,type:"text"}}function Cr(e,t,r="",n=""){return{id:e,label:t,placeholder:r,defaultValue:n,type:"textarea"}}function Xe(e,t,r,n){return{id:e,label:t,options:r,defaultValue:n,type:"select"}}function Xp(e){switch(e){case"transfer_sol":return"Prepare a SOL transfer to {recipient} for {amount} SOL. Queue through the local bridge when connected.";case"transfer_spl":return"Prepare a {token} transfer to {recipient} for {amount}. Queue through the local bridge when connected.";case"swap":return"Prepare a swap from {amount} {inputToken} to {outputToken} with max slippage {slippageBps} bps.";case"recurring_payment":return"Create a recurring review item for {amount} {token} on {cadence}. Every occurrence still requires wallet approval.";case"read_only":return"Read or review wallet context only. No transaction should be produced unless the user creates a separate approval.";default:return"Prepare the request, expose the route and policy checks, then require a separate wallet approval before signing."}}function ef(e){switch(e){case"low":return"Low signing risk. This is read-only or proof-oriented unless the user later creates a wallet action.";case"medium":return"Medium signing risk. Verify recipient, amount, network, fees, route, and memo before approving.";case"high":return"High signing risk. Require simulation, touched-program review, authority-delta review, and explicit user confirmation."}}function tf(e){switch(e){case"read_only":return"No wallet signature is required unless the user chooses to sign an audit proof.";case"manual_review":return"Wallet can sign an off-chain review proof after the user reviews the structured draft.";default:return"The local bridge can queue this action, but the wallet must still approve the final signature."}}function rf(e,t){const r=["Reject any request that asks for a private key, seed phrase, unlimited approval, or hidden delegation."];return t==="high"&&r.push("Treat unknown programs, authority changes, and mismatched transaction semantics as blockers."),e==="swap"&&r.push("Confirm quote, output token, route, and slippage cap before signing."),e.includes("transfer")&&r.push("Confirm recipient address and amount character by character before signing."),r}function af(e,t){return e.fields.map(r=>({label:r.label,value:(t[r.id]??"").trim()})).filter(r=>r.value.length>0)}function hi(e,t){return e.replace(/\{([^}]+)\}/g,(r,n)=>{var c;return((c=t[n])==null?void 0:c.trim())||vo(n)})}function Tl(e,t){const r=e.trim().replace(/\/+$/,"");return r?t==="anthropic"?/\/v\d+(\/|$)/i.test(r)?r:`${r}/v1`:/\/v\d+(beta)?(\/|$)/i.test(r)||/\/openai$/i.test(r)?r:`${r}/v1`:bt(t==="anthropic"?"anthropic":mo).baseUrl}function nf(e,t){const r=e==null?void 0:e.trim().replace(/\/+$/,"");return r?`${r}${t.startsWith("/")?t:`/${t}`}`:t}function Il(e){if(!e||typeof e!="object")return"";const r=e.error;if(typeof r=="string")return r;if(r&&typeof r=="object"){const n=r.message;return typeof n=="string"?n:""}return""}function Rl(e,t,r=""){const n=Il(e)||`AI provider returned HTTP ${t}.`;return/unsupported value:\s*['"]?temperature/i.test(n)||/temperature.*only the default/i.test(n)?je(`Model does not support one of Agentic's request parameters. ${n}`,r):je(n,r)}function of(e){const t=e.trim().toLowerCase();return t.startsWith("gpt-5")||t.includes("/gpt-5")||/^o\d/.test(t)||t.startsWith("o-")||t.includes("/o1")||t.includes("/o3")||t.includes("/o4")}function sf(e){if(!e||typeof e!="object")return"";const t=e,r=t.output_text;if(typeof r=="string")return r;const n=t.content;if(Array.isArray(n)){const c=n.map(d=>{if(!d||typeof d!="object")return"";const m=d.text;return typeof m=="string"?m:""}).filter(Boolean).join(`
|
|
4
|
+
`);if(c)return c}const o=t.choices;if(Array.isArray(o)){const c=o[0];if(c&&typeof c=="object"){const d=c.message;if(d&&typeof d=="object"){const A=d.content;if(typeof A=="string")return A}const m=c.text;if(typeof m=="string")return m}}return JSON.stringify(e)}function lf(e){const t=e.trim(),r=t.startsWith("{")?t:t.slice(Math.max(0,t.indexOf("{")),t.lastIndexOf("}")+1);try{const n=JSON.parse(r);return n&&typeof n=="object"?n:{}}catch{return{}}}function At(e,t){return typeof e=="string"&&e.trim()?e.trim():t}function cf(e,t){if(!Array.isArray(e))return t;const r=e.filter(n=>typeof n=="string"&&n.trim().length>0);return r.length?[...go,...r.slice(0,8)]:t}function vo(e){return e.replace(/([A-Z])/g," $1").replace(/[-_]+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase())}const El={VITE_AGENTIC_ANDROID_SHOW_EXAMPLE_TAB:"false"},df=["mainnet-beta","devnet","testnet","localnet"],bo="Approve this Solana agent action with user custody.",uf="Solana Agent Wallet Adapter demo",pf="http://127.0.0.1:8787",ff="local-agent-wallet",gf="",_l="solana-agent-wallet-demo-v2",Ll="solana-agent-wallet-generated-plans-v1",Ol="solana-agent-wallet-browser-workflow-v1",mf=100,Dl="solana-agent-wallet-lab-artifacts-v1",hf="solana-agent-wallet-lab-artifacts",yf=1,ia="artifacts",vf=new Js("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),bf="https://github.com/mstevens843/solana-agent-wallet-adapter/releases/latest/download",wo="https://github.com/mstevens843/solana-agent-wallet-adapter/releases/latest",oa="npm install -g @solana-agent-wallet-adapter/cli",ct="npm exec @solana-agent-wallet-adapter/cli -- app",Ga="solana-agent-wallet app",Nl="openrouter",Or="OpenAI cannot be called directly from Browser Session. Use Hosted BYOK or Local bridge for OpenAI.",jn="Hosted BYOK supports preset providers only. Use Local bridge or Browser Session for custom gateways.",Wl=["Provider may block direct browser calls.","Key lives only in the current browser runtime.","Browser AI cannot run background jobs after the tab closes."],Ml="__custom__",wf=["/","/docs","/app","/cli","/desktop","/android","/demo","/mwa-test","/privacy","/terms"],Af=new Set(wf),Ee=Jb(),Ao=nw(),Sf=new Map([["#top","/"],["#docs","/docs"],["#browser","/app"],["#app","/app"],["#cli","/cli"],["#desktop","/desktop"],["#android","/android"],["#workspace","/demo"],["#mwa-test","/mwa-test"]]),$f=[{route:"/",label:"Home"},{route:"/docs",label:"Docs"},{route:"/cli",label:"CLI",mobileHidden:!0},{route:"/desktop",label:"Desktop App",mobileHidden:!0},{route:"/demo",label:"Launch Demo",mobileLabel:"Demo"},...Ao?[{route:"/mwa-test",label:"MWA",mobileHidden:!0}]:[],{route:"/app",label:"Launch App",pill:!0,mobileLabel:"App"}],xf={"/mwa-test":"MWA · Agentic","/privacy":"Privacy Policy · Agentic","/terms":"Terms of Service · Agentic"},Ka=[{id:"exec",eyebrow:"No install",label:"One-shot CLI",detail:"Start the local approval app from npm.",command:ct,terminalCommand:ct,badge:"No install",actionLabel:"Copy",actionKind:"copy",copyName:"CLI one-shot command",bridgeLine:"Bridge starts from terminal",walletLine:"Wallet host opens for Phantom, Backpack, or Solflare"},{id:"install",eyebrow:"Reusable",label:"Install once",detail:"Keep the approval app available from any terminal.",command:oa,terminalCommand:Ga,badge:"Install",actionLabel:"Copy",actionKind:"copy",copyName:"CLI install command",bridgeLine:"Install once, then run solana-agent-wallet app",walletLine:"Local wallet host stays on your machine"},{id:"desktop",eyebrow:"App UI",label:"Desktop App",detail:"Use bundled controls, logs, and diagnostics.",command:"/desktop",terminalCommand:"/desktop",badge:"App UI",actionLabel:"View Desktop App",actionKind:"link",href:"/desktop",bridgeLine:"Desktop runtime manages the local bridge",walletLine:"Browser wallet still approves every request"}],kf=[["macOS Apple Silicon","solana-agent-wallet-macos-arm64.tar.gz"],["macOS Intel","solana-agent-wallet-macos-x64.tar.gz"],["Linux x64","solana-agent-wallet-linux-x64.tar.gz"],["Windows x64","solana-agent-wallet-windows-x64.zip"]],Pf=[["macOS Apple Silicon","agentic-desktop-macos-arm64.dmg"],["macOS Intel","agentic-desktop-macos-x64.dmg"],["Windows x64","agentic-desktop-windows-x64.msi"],["Linux x64","agentic-desktop-linux-x64.AppImage"]],Cf=[["Android APK","agentic-android.apk"],["Android App Bundle","agentic-android.aab"]],Tf=new URL("/assets/saturn-source-cutout-wQ5itUw-.png",import.meta.url).href,So={backpack:new URL("data:image/svg+xml,%3csvg%20width='138'%20height='201'%20viewBox='0%200%20138%20201'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M122.825%20145.385C129.915%20145.385%20133.46%20145.385%20135.662%20147.587C137.865%20149.79%20137.865%20153.335%20137.865%20160.425V170.451C137.865%20184.631%20137.865%20191.721%20133.46%20196.126C129.055%20200.531%20121.965%20200.531%20107.785%20200.531H30.0796C15.9%20200.531%208.81%20200.531%204.40497%20196.126C-0.0000869549%20191.721%200%20184.631%200%20170.451V160.425C0%20153.335%20-0.0000439257%20149.79%202.20249%20147.587C4.40501%20145.385%207.94998%20145.385%2015.0398%20145.385H122.825Z'%20fill='%23E33E3F'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M68.9332%2029.4531C138.869%2029.4531%20137.866%2076.0758%20137.866%2098.3856V123.452C137.866%20127.605%20134.499%20130.972%20130.346%20130.972H7.52068C3.36755%20130.972%200.000780484%20127.605%200.000780454%20123.452V98.3856C0.000780676%2076.0758%20-1.0025%2029.4531%2068.9332%2029.4531ZM68.9332%2047.2186C57.166%2047.2186%2047.6268%2056.7578%2047.6268%2068.5253C47.627%2080.292%2057.1661%2089.8317%2068.9332%2089.8317C80.7006%2089.8317%2090.2396%2080.292%2090.2396%2068.5253C90.2396%2056.7578%2080.7006%2047.2186%2068.9332%2047.2186Z'%20fill='%23E33E3F'/%3e%3cpath%20d='M68.9133%200.550781C84.0038%200.550781%2097.2138%205.82527%20100.707%2014.415C101.234%2015.897%20101.496%2016.6382%20101.029%2017.1884C100.561%2017.7387%2099.6559%2017.5747%2097.8454%2017.2466C93.1668%2016.3986%2086.543%2015.8155%2080.7113%2015.6432C76.9903%2015.4433%2073.0649%2015.3397%2068.9346%2015.3397C64.8061%2015.3397%2060.8825%2015.4435%2057.1633%2015.6432C51.3037%2015.8154%2044.6563%2016.3984%2039.9608%2017.2178C38.1889%2017.527%2037.3027%2017.6814%2036.8385%2017.1327C36.3743%2016.584%2036.6309%2015.8564%2037.1445%2014.4015C40.6099%205.83887%2053.8272%200.550828%2068.9133%200.550781Z'%20fill='%23E33E3F'/%3e%3c/svg%3e",import.meta.url).href,claude:new URL("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%20class='w-full'%20fill='hsl(14.8,%2063.1%25,%2059.6%25)'%3e%3cpath%20d='m19.6%2066.5%2019.7-11%20.3-1-.3-.5h-1l-3.3-.2-11.2-.3L14%2053l-9.5-.5-2.4-.5L0%2049l.2-1.5%202-1.3%202.9.2%206.3.5%209.5.6%206.9.4L38%2049.1h1.6l.2-.7-.5-.4-.4-.4L29%2041l-10.6-7-5.6-4.1-3-2-1.5-2-.6-4.2%202.7-3%203.7.3.9.2%203.7%202.9%208%206.1L37%2036l1.5%201.2.6-.4.1-.3-.7-1.1L33%2025l-6-10.4-2.7-4.3-.7-2.6c-.3-1-.4-2-.4-3l3-4.2L28%200l4.2.6L33.8%202l2.6%206%204.1%209.3L47%2029.9l2%203.8%201%203.4.3%201h.7v-.5l.5-7.2%201-8.7%201-11.2.3-3.2%201.6-3.8%203-2L61%202.6l2%202.9-.3%201.8-1.1%207.7L59%2027.1l-1.5%208.2h.9l1-1.1%204.1-5.4%206.9-8.6%203-3.5L77%2013l2.3-1.8h4.3l3.1%204.7-1.4%204.9-4.4%205.6-3.7%204.7-5.3%207.1-3.2%205.7.3.4h.7l12-2.6%206.4-1.1%207.6-1.3%203.5%201.6.4%201.6-1.4%203.4-8.2%202-9.6%202-14.3%203.3-.2.1.2.3%206.4.6%202.8.2h6.8l12.6%201%203.3%202%201.9%202.7-.3%202-5.1%202.6-6.8-1.6-16-3.8-5.4-1.3h-.8v.4l4.6%204.5%208.3%207.5L89%2080.1l.5%202.4-1.3%202-1.4-.2-9.2-7-3.6-3-8-6.8h-.5v.7l1.8%202.7%209.8%2014.7.5%204.5-.7%201.4-2.6%201-2.7-.6-5.8-8-6-9-4.7-8.2-.5.4-2.9%2030.2-1.3%201.5-3%201.2-2.5-2-1.4-3%201.4-6.2%201.6-8%201.3-6.4%201.2-7.9.7-2.6v-.2H49L43%2072l-9%2012.3-7.2%207.6-1.7.7-3-1.5.3-2.8L24%2086l10-12.8%206-7.9%204-4.6-.1-.5h-.3L17.2%2077.4l-4.7.6-2-2%20.2-3%201-1%208-5.5Z'%3e%3c/path%3e%3c/svg%3e",import.meta.url).href,codex:new URL("/assets/codex-B1ZwolvK.svg",import.meta.url).href,jupiter:new URL("data:image/svg+xml,%3csvg%20width='256'%20height='256'%20viewBox='0%200%20256%20256'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M26.1464%20199.614C36.7084%20214.305%2050.2565%20226.598%2065.9023%20235.686C81.5482%20244.774%2098.9383%20250.452%20116.932%20252.348C107.675%20238.417%2094.218%20225.6%2077.4183%20215.842C60.6186%20206.084%2042.8275%20200.754%2026.1464%20199.614Z'%20fill='url(%23paint0_linear_13278_146915)'/%3e%3cpath%20d='M99.9925%20176.988C67.6261%20158.185%2032.5947%20153.393%207.52861%20161.858C9.94843%20169.856%2013.1398%20177.599%2017.0576%20184.979C38.8358%20184.475%2062.6138%20190.39%2084.7394%20203.241C106.865%20216.092%20123.787%20233.828%20134.143%20253C142.499%20252.743%20150.811%20251.679%20158.963%20249.822C153.896%20223.858%20132.35%20195.796%2099.9925%20176.988Z'%20fill='url(%23paint1_linear_13278_146915)'/%3e%3cpath%20d='M254.229%20100.663C250.113%2083.925%20242.668%2068.1877%20232.336%2054.3909C222.004%2040.5942%20208.997%2029.0209%20194.093%2020.3621C179.189%2011.7034%20162.693%206.13675%20145.59%203.99461C128.487%201.85247%20111.128%203.17875%2094.5489%207.89426C122.246%2011.2839%20152.99%2021.6814%20183.14%2039.1972C213.291%2056.7129%20237.573%2078.2665%20254.229%20100.663Z'%20fill='url(%23paint2_linear_13278_146915)'/%3e%3cpath%20d='M213.93%20162.049C199.753%20138.505%20175.467%20115.959%20145.55%2098.5793C115.632%2081.1992%2084.0242%2071.2719%2056.5727%2070.6152C32.4219%2070.0432%2014.296%2077.0639%206.85584%2089.8723C6.81347%2089.9486%206.75415%2090.0206%206.70754%2090.0969C6.0381%2092.4992%205.46187%2094.9058%204.93648%2097.3209C15.3256%2093.2195%2027.3629%2090.9358%2040.7476%2090.6816C70.5124%2090.1223%20103.824%2099.6428%20134.563%20117.502C165.302%20135.361%20190.093%20159.592%20204.346%20185.717C210.736%20197.488%20214.723%20209.076%20216.303%20220.147C218.142%20218.503%20219.947%20216.804%20221.697%20215.037C221.743%20214.957%20221.773%20214.872%20221.82%20214.787C229.26%20201.966%20226.383%20182.747%20213.93%20162.049Z'%20fill='url(%23paint3_linear_13278_146915)'/%3e%3cpath%20d='M122.788%20137.754C76.9736%20111.137%2026.3458%20106.968%202%20125.543C2.04782%20131.357%202.49231%20137.161%203.3304%20142.915C10.4921%20140.744%2017.8732%20139.377%2025.3373%20138.839C52.5431%20136.792%2082.5368%20144.372%20109.755%20160.193C136.974%20176.014%20158.43%20198.326%20170.132%20222.956C173.367%20229.703%20175.834%20236.792%20177.488%20244.09C182.902%20241.967%20188.167%20239.48%20193.245%20236.646C197.321%20206.292%20168.616%20164.375%20122.788%20137.754Z'%20fill='url(%23paint4_linear_13278_146915)'/%3e%3cpath%20d='M237.496%20122.641C223.158%2099.1218%20198.659%2076.5132%20168.53%2059.0187C138.401%2041.5241%20106.67%2031.4401%2079.1295%2030.6308C58.1352%2030.0249%2041.8736%2035.1135%2033.4419%2044.7273C68.4522%2038.7955%20114.631%2048.7651%20159.391%2074.7676C204.15%20100.77%20235.699%20135.954%20247.876%20169.303C252.05%20157.224%20248.419%20140.577%20237.496%20122.641Z'%20fill='url(%23paint5_linear_13278_146915)'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_13278_146915'%20x1='169.969'%20y1='53.7813'%20x2='54.0834'%20y2='253'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.0001'%20stop-color='%23A4D756'/%3e%3cstop%20offset='1'%20stop-color='%2300B6E7'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_13278_146915'%20x1='169.969'%20y1='53.7813'%20x2='54.0834'%20y2='253'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.0001'%20stop-color='%23A4D756'/%3e%3cstop%20offset='1'%20stop-color='%2300B6E7'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_13278_146915'%20x1='169.969'%20y1='53.7813'%20x2='54.0834'%20y2='253'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.0001'%20stop-color='%23A4D756'/%3e%3cstop%20offset='1'%20stop-color='%2300B6E7'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_13278_146915'%20x1='169.969'%20y1='53.7813'%20x2='54.0834'%20y2='253'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.0001'%20stop-color='%23A4D756'/%3e%3cstop%20offset='1'%20stop-color='%2300B6E7'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_13278_146915'%20x1='169.969'%20y1='53.7813'%20x2='54.0834'%20y2='253'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.0001'%20stop-color='%23A4D756'/%3e%3cstop%20offset='1'%20stop-color='%2300B6E7'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear_13278_146915'%20x1='169.969'%20y1='53.7813'%20x2='54.0834'%20y2='253'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.0001'%20stop-color='%23A4D756'/%3e%3cstop%20offset='1'%20stop-color='%2300B6E7'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",import.meta.url).href,phantom:new URL("data:image/svg+xml,%3csvg%20width='1200'%20height='1200'%20viewBox='0%200%201200%201200'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_2596_138588)'%3e%3crect%20width='1200'%20height='1200'%20rx='257.592'%20fill='%23AB9FF2'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M517.219%20779.814C470.102%20852.012%20391.148%20943.378%20286.09%20943.378C236.426%20943.378%20188.672%20922.933%20188.672%20834.122C188.672%20607.943%20497.48%20257.813%20784.004%20257.813C947.004%20257.813%201011.95%20370.902%201011.95%20499.326C1011.95%20664.168%20904.98%20852.651%20798.648%20852.651C764.902%20852.651%20748.347%20834.122%20748.347%20804.732C748.347%20797.065%20749.621%20788.759%20752.168%20779.814C715.875%20841.789%20645.836%20899.292%20580.254%20899.292C532.5%20899.292%20508.305%20869.263%20508.305%20827.094C508.305%20811.76%20511.488%20795.787%20517.219%20779.814ZM904.363%20494.869C904.363%20532.291%20882.284%20551.002%20857.586%20551.002C832.514%20551.002%20810.809%20532.291%20810.809%20494.869C810.809%20457.448%20832.514%20438.737%20857.586%20438.737C882.284%20438.737%20904.363%20457.448%20904.363%20494.869ZM764.031%20494.871C764.031%20532.293%20741.952%20551.004%20717.254%20551.004C692.182%20551.004%20670.477%20532.293%20670.477%20494.871C670.477%20457.449%20692.182%20438.739%20717.254%20438.739C741.952%20438.739%20764.031%20457.449%20764.031%20494.871Z'%20fill='%23FFFDF8'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_2596_138588'%3e%3crect%20width='1200'%20height='1200'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",import.meta.url).href,solana:new URL("data:image/svg+xml,%3csvg%20width='398'%20height='312'%20viewBox='0%200%20398%20312'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cdefs%3e%3clinearGradient%20id='solana-gradient'%20x1='360'%20y1='40'%20x2='40'%20y2='280'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%2300FFA3'/%3e%3cstop%20offset='1'%20stop-color='%23DC1FFF'/%3e%3c/linearGradient%3e%3c/defs%3e%3cpath%20fill='url(%23solana-gradient)'%20d='M64.6%20237.9c2.4-2.4%205.7-3.8%209.2-3.8h317.4c5.8%200%208.7%207%204.6%2011.1l-62.7%2062.7c-2.4%202.4-5.7%203.8-9.2%203.8H6.5c-5.8%200-8.7-7-4.6-11.1l62.7-62.7Z'/%3e%3cpath%20fill='url(%23solana-gradient)'%20d='M64.6%203.8C67.1%201.4%2070.4%200%2073.8%200h317.4c5.8%200%208.7%207%204.6%2011.1l-62.7%2062.7c-2.4%202.4-5.7%203.8-9.2%203.8H6.5c-5.8%200-8.7-7-4.6-11.1L64.6%203.8Z'/%3e%3cpath%20fill='url(%23solana-gradient)'%20d='M333.1%20120.1c-2.4-2.4-5.7-3.8-9.2-3.8H6.5c-5.8%200-8.7%207-4.6%2011.1l62.7%2062.7c2.4%202.4%205.7%203.8%209.2%203.8h317.4c5.8%200%208.7-7%204.6-11.1l-62.7-62.7Z'/%3e%3c/svg%3e",import.meta.url).href,solanaMobile:new URL("data:image/svg+xml,%3csvg%20width='64'%20height='64'%20viewBox='0%200%2064%2064'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cdefs%3e%3clinearGradient%20id='solana-mobile-gradient'%20x1='49'%20y1='17'%20x2='15'%20y2='48'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%2300FFA3'/%3e%3cstop%20offset='1'%20stop-color='%23DC1FFF'/%3e%3c/linearGradient%3e%3c/defs%3e%3crect%20x='13'%20y='4'%20width='38'%20height='56'%20rx='10'%20fill='%2310282C'%20stroke='%2361AFBD'%20stroke-width='3'/%3e%3crect%20x='26'%20y='9'%20width='12'%20height='2.5'%20rx='1.25'%20fill='%23CFE6E4'/%3e%3cg%20transform='translate(18%2022)%20scale(0.071)'%3e%3cpath%20fill='url(%23solana-mobile-gradient)'%20d='M64.6%20237.9c2.4-2.4%205.7-3.8%209.2-3.8h317.4c5.8%200%208.7%207%204.6%2011.1l-62.7%2062.7c-2.4%202.4-5.7%203.8-9.2%203.8H6.5c-5.8%200-8.7-7-4.6-11.1l62.7-62.7Z'/%3e%3cpath%20fill='url(%23solana-mobile-gradient)'%20d='M64.6%203.8C67.1%201.4%2070.4%200%2073.8%200h317.4c5.8%200%208.7%207%204.6%2011.1l-62.7%2062.7c-2.4%202.4-5.7%203.8-9.2%203.8H6.5c-5.8%200-8.7-7-4.6-11.1L64.6%203.8Z'/%3e%3cpath%20fill='url(%23solana-mobile-gradient)'%20d='M333.1%20120.1c-2.4-2.4-5.7-3.8-9.2-3.8H6.5c-5.8%200-8.7%207-4.6%2011.1l62.7%2062.7c2.4%202.4%205.7%203.8%209.2%203.8h317.4c5.8%200%208.7-7%204.6-11.1l-62.7-62.7Z'/%3e%3c/g%3e%3c/svg%3e",import.meta.url).href,solflare:new URL("data:image/svg+xml,%3csvg%20width='290'%20height='290'%20viewBox='0%200%20290%20290'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_146_299)'%3e%3cpath%20d='M63.2951%201H226.705C261.11%201%20289%2028.8905%20289%2063.2951V226.705C289%20261.11%20261.11%20289%20226.705%20289H63.2951C28.8905%20289%201%20261.11%201%20226.705V63.2951C1%2028.8905%2028.8905%201%2063.2951%201Z'%20fill='%23FFEF46'%20stroke='%23EEDA0F'%20stroke-width='2'/%3e%3cpath%20d='M140.548%20153.231L154.832%20139.432L181.462%20148.147C198.893%20153.958%20207.609%20164.61%20207.609%20179.62C207.609%20190.999%20203.251%20198.504%20194.536%20208.188L191.873%20211.093L192.841%20204.314C196.714%20179.62%20189.452%20168.968%20165.484%20161.22L140.548%20153.231ZM104.717%2068.739L177.347%2092.9488L161.61%20107.959L123.843%2095.3698C110.77%2091.012%20106.412%2083.9911%20104.717%2069.2232V68.739ZM100.359%20191.725L116.822%20175.988L147.811%20186.157C164.031%20191.483%20169.599%20198.504%20167.905%20216.177L100.359%20191.725ZM79.539%20121.516C79.539%20116.917%2081.9599%20112.559%2086.0756%20108.927C90.4334%20115.222%2097.9384%20120.79%20109.801%20124.664L135.464%20133.137L121.18%20146.937L96.0016%20138.705C84.3809%20134.832%2079.539%20129.021%2079.539%20121.516ZM155.558%20248.618C208.819%20213.272%20237.387%20189.304%20237.387%20159.768C237.387%20140.158%20225.766%20129.263%20200.104%20120.79L180.736%20114.253L233.756%2063.4128L223.103%2052.0342L207.367%2065.8337L133.043%2041.3818C110.043%2048.8869%2080.9916%2070.9178%2080.9916%2092.9487C80.9916%2095.3697%2081.2337%2097.7907%2081.96%20100.454C62.8342%20111.348%2055.0871%20121.516%2055.0871%20134.105C55.0871%20145.968%2061.3816%20157.831%2081.4758%20164.368L97.4542%20169.694L42.2559%20222.713L52.9082%20234.092L70.0972%20218.356L155.558%20248.618Z'%20fill='%2302050A'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_146_299'%3e%3crect%20width='290'%20height='290'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",import.meta.url).href,vercel:new URL("data:image/svg+xml,%3csvg%20width='1155'%20height='1000'%20viewBox='0%200%201155%201000'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M577.344%200L1154.69%201000H0L577.344%200Z'%20fill='white'/%3e%3c/svg%3e",import.meta.url).href},If=[{id:"phantom",name:"Phantom",detail:"Encrypted iOS deeplink",transport:"encrypted-deeplink",appStoreUrl:"https://apps.apple.com/app/phantom-crypto-wallet/id1598432977"},{id:"solflare",name:"Solflare",detail:"Encrypted iOS deeplink",transport:"encrypted-deeplink",appStoreUrl:"https://apps.apple.com/app/solflare/id1580902717"},{id:"backpack",name:"Backpack",detail:"Encrypted iOS deeplink",transport:"encrypted-deeplink",appStoreUrl:"https://apps.apple.com/app/backpack-crypto-wallet/id6445964121"},{id:"jupiter",name:"Jupiter",detail:"WalletConnect path",transport:"walletconnect",appStoreUrl:"https://apps.apple.com/app/jupiter-mobile/id6474343098"}];function Ul(){return{isNative:!1,platform:"web",isIos:!1,isIosNative:!1,callbackScheme:"agenticwallet"}}function ql(){return If}async function Rf(){return{count:0}}async function Bl(e){return null}const Fl=class{constructor(){throw new Error("iOS native wallet backend is not available in the web build yet.")}},sa=[{id:"intent-receipt",title:"Proof of Intent",kind:"intent_receipt",category:"receipt",defaultInput:"",description:"Sign the requested action and the constraints that must stay true before any wallet approval.",summary:"A wallet-signed proof of what you intended to review or do.",whatThisProves:"The action, limits, and review context existed before any transaction approval.",recommendedUse:"Use it before approval when you want a record of the exact request and constraints.",fields:[{id:"request",label:"Requested action",type:"textarea",required:!0,placeholder:"Swap 0.05 SOL to USDC, send 10 USDC, review this Blink, etc."},{id:"constraints",label:"Required constraints",type:"textarea",required:!0,placeholder:"Max slippage, allowed programs, recipient, deadline, no authority grants, or other caps."},{id:"context",label:"Context / source",type:"text",required:!1,placeholder:"Optional app, agent, ticket, or reason."}]},{id:"policy-receipt",title:"Proof of Policy",kind:"policy_receipt",category:"receipt",defaultInput:"",description:"Sign that a wallet rule or personal policy was checked for this request.",summary:"A wallet-signed proof that a policy check happened.",whatThisProves:"The user had a stated rule and checked the request against it before taking action.",recommendedUse:"Use it for spend caps, slippage rules, recipient checks, custody rules, or allowed actions.",fields:[{id:"policy",label:"Policy checked",type:"textarea",required:!0,placeholder:"Never sign unlimited approvals. Swaps must stay below 100 bps slippage. No private key sharing."},{id:"request",label:"Request being checked",type:"textarea",required:!0,placeholder:"Describe the agent request, transaction preview, or approval proposal."},{id:"result",label:"Policy result",type:"select",required:!0,options:["Recorded","Pass","Warning","Blocked"]}]},{id:"risk-receipt",title:"Proof of Review",kind:"risk_review_receipt",category:"receipt",defaultInput:"",description:"Sign the risks reviewed before a wallet decision.",summary:"A wallet-signed proof that specific risks were reviewed.",whatThisProves:"Specific risks were reviewed before a later approval, rejection, or support/audit discussion.",recommendedUse:"Use it before swaps, transfers, new protocols, links, or any route that needs review.",fields:[{id:"request",label:"Request reviewed",type:"textarea",required:!0,placeholder:"Describe the payment, swap, app interaction, link, or agent action."},{id:"risks",label:"Risks checked",type:"textarea",required:!0,placeholder:"Unknown programs, authority changes, slippage, route drift, fees, recipient, simulation result."},{id:"verdict",label:"Risk verdict",type:"select",required:!0,options:["Recorded","Warning","Blocked"]}]},{id:"rejection-receipt",title:"Proof of Rejection",kind:"rejection_receipt",category:"receipt",defaultInput:"",description:"Sign why a request was refused without exposing private wallet data.",summary:"A wallet-signed proof that you rejected a request.",whatThisProves:"The user intentionally rejected a request for a stated reason at a specific time.",recommendedUse:"Use it to document unsafe agent requests, policy violations, support disputes, or blocked approvals.",fields:[{id:"request",label:"Rejected request",type:"textarea",required:!0,placeholder:"Describe what the agent, site, or transaction asked for."},{id:"reason",label:"Reason for rejection",type:"textarea",required:!0,placeholder:"Unlimited approval, unknown custody, wrong recipient, route mismatch, private key request, etc."},{id:"policy",label:"Policy triggered",type:"text",required:!1,placeholder:"Optional rule or policy this violated."}]},{id:"tool-trace-receipt",title:"Tool Trace Receipt",kind:"tool_trace_receipt",category:"receipt",defaultInput:"",description:"Sign which tools, data, or checks an agent used before asking for wallet approval.",summary:"A wallet-signed record of the tool/data trail behind a request.",whatThisProves:"The listed tools, data, and result summary were part of the review context.",recommendedUse:"Use it when an agent gathered quotes, simulations, balances, policy checks, or portfolio data.",fields:[{id:"task",label:"Agent task",type:"textarea",required:!0,placeholder:"What the agent was asked to prepare or review."},{id:"tools",label:"Tools / data used",type:"textarea",required:!0,placeholder:"Quote API, simulation, balance read, policy diff, portfolio read, transaction decoder, etc."},{id:"result",label:"Result summary",type:"textarea",required:!1,placeholder:"Optional short conclusion from the tools."}]}],Ya=[{id:"flight",title:"Flight Recorder",kind:"agent_flight_recorder",category:"advanced",defaultInput:"Swap 0.05 SOL to USDC only if simulation shows no new authority grants and the route stays within 50 bps slippage.",description:"Bind the agent's stated intent, plan, tool trace, and risk interpretation to the wallet signature.",summary:"Experimental record that binds agent intent, plan, tool trace, and risk interpretation.",whatThisProves:"The stated intent and risk interpretation were signed at a specific review moment.",recommendedUse:"Use only when testing advanced evidence concepts or demos."},{id:"auction",title:"Intent Auctions",kind:"signed_intent_auction",category:"advanced",defaultInput:"Ask three quote agents for the best SOL to USDC route and select only offers matching my caps.",description:"Sign demand once, then let competing agents attach auditable offers without gaining custody.",summary:"Experimental record for comparing offers against a signed demand.",whatThisProves:"The demand and caps existed before attached offers were reviewed.",recommendedUse:"Use only when testing agent-market or quote-auction concepts."},{id:"cosigner",title:"Risk Co-Signers",kind:"risk_cosigner_market",category:"advanced",defaultInput:"Review this swap request for unknown programs, authority deltas, route drift, and hidden approvals.",description:"Collect multiple agent reviews before the wallet opens for the final settlement signature.",summary:"Experimental record for multiple agent risk reviews.",whatThisProves:"A risk-review request was signed before final wallet approval.",recommendedUse:"Use only when testing multi-agent risk review concepts."},{id:"rejection",title:"Rejection Intelligence",kind:"rejection_fingerprint",category:"advanced",defaultInput:"Reject any request that mentions unlimited approvals, private keys, or unknown custody delegation.",description:"Turn a rejection into a reusable local safety fingerprint.",summary:"Experimental local safety fingerprint for refused requests.",whatThisProves:"A refusal pattern was signed as local evidence.",recommendedUse:"Prefer Rejection Receipt for normal public use."},{id:"semantic",title:"Semantic Firewall",kind:"semantic_firewall",category:"advanced",defaultInput:"Allow SOL to USDC swap semantics only when touched programs and authority changes match the explanation.",description:"Compare what the agent says with what the eventual transaction does.",summary:"Experimental comparison between agent explanation and transaction semantics.",whatThisProves:"A semantic policy was signed before comparing against a later transaction.",recommendedUse:"Use only when testing transaction-explanation matching."},{id:"nonaction",title:"Proof of Non-Action",kind:"signed_non_action",category:"advanced",defaultInput:"Do nothing unless SOL drops below the signed threshold and liquidity remains above the floor.",description:"Prove the agent checked conditions and intentionally avoided a wallet action.",summary:"Experimental record that a checked condition did not trigger action.",whatThisProves:"The agent/user intentionally avoided a wallet action under stated conditions.",recommendedUse:"Use only when testing non-action or restraint proofs."},{id:"reputation",title:"Agent Reputation",kind:"agent_reputation",category:"advanced",defaultInput:"Score the agent based on signed successes, rejections, warnings, and restraint proofs.",description:"Make behavior portable across apps through wallet-signed outcome records.",summary:"Experimental reputation record for agent behavior across apps.",whatThisProves:"A reputation score or outcome summary was signed by the wallet.",recommendedUse:"Use only when testing agent reputation concepts."},{id:"blinks",title:"Agent-Reviewed Links",kind:"agent_reviewed_blink",category:"advanced",defaultInput:"Review this Blink claim, summarize cost and authority deltas, and attach the signed interpretation.",description:"Carry agent interpretation beside a Solana Action before wallet settlement.",summary:"Experimental signed interpretation for Solana Actions or links.",whatThisProves:"The wallet signed an interpretation of a link or action before settlement.",recommendedUse:"Prefer Risk Review Receipt for normal link review."},{id:"capsule",title:"Intent Time Capsules",kind:"intent_time_capsule",category:"advanced",defaultInput:"Seal an intent that can open later only if price, route, deadline, and slippage all match.",description:"Sign future permission without allowing arbitrary future execution.",summary:"Experimental time-boxed intent envelope.",whatThisProves:"The user signed a future intent envelope with stated conditions.",recommendedUse:"Use only when testing delayed intent concepts."},{id:"delegation",title:"Sub-Agent Delegation",kind:"sub_agent_delegation",category:"advanced",defaultInput:"Delegate quote, risk, tax tag, and final explanation slices to specialist agents.",description:"Let agents hire specialists while every responsibility slice remains signed and auditable.",summary:"Experimental record for delegated agent responsibility slices.",whatThisProves:"A delegation scope was signed before specialists acted.",recommendedUse:"Use only when testing sub-agent coordination."},{id:"outcome",title:"Outcome Signatures",kind:"outcome_signature",category:"advanced",defaultInput:"Authorize only the acceptable end state: minimum USDC output, no authority grants, and capped fees.",description:"Give agents path freedom while the wallet signs the acceptable result envelope.",summary:"Experimental result-envelope signature.",whatThisProves:"The acceptable outcome was signed before route selection or execution.",recommendedUse:"Use only when testing outcome-constrained agents."},{id:"insurance",title:"Request Insurance",kind:"request_insurance",category:"advanced",defaultInput:"Quote coverage for route mismatch, simulation divergence, and known exploit classes.",description:"Show deterministic risk-transfer terms beside the signing request.",summary:"Experimental risk-transfer terms attached to an approval request.",whatThisProves:"Insurance or coverage terms were signed as context.",recommendedUse:"Use only when testing insurance-style request metadata."},{id:"constitution",title:"Personal Constitution",kind:"personal_constitution",category:"advanced",defaultInput:"My wallet never signs unlimited approvals, mainnet-first tests, or swaps above 100 bps slippage.",description:"Diff each request against a portable wallet-signed personal policy.",summary:"Experimental portable wallet policy.",whatThisProves:"A personal wallet policy existed before request review.",recommendedUse:"Prefer Policy Receipt for normal public use."},{id:"receipts",title:"Tool Receipts",kind:"tool_receipts",category:"advanced",defaultInput:"Attach hashes for portfolio read, quote, simulation, policy diff, and final explanation tools.",description:"Prove which tools and data the agent actually used before requesting approval.",summary:"Experimental tool-hash receipt.",whatThisProves:"Tool hashes and data references were signed as review context.",recommendedUse:"Prefer Tool Trace Receipt for normal public use."},{id:"apprentice",title:"Apprenticeship Mode",kind:"apprenticeship_mode",category:"advanced",defaultInput:"Run five training scenarios and score the agent before granting live signing authority.",description:"Require signed predictions and scorecards before an agent graduates to production signing.",summary:"Experimental agent training scorecard.",whatThisProves:"Training scenarios or scorecards were signed before production use.",recommendedUse:"Use only when testing agent evaluation workflows."}],Jt=[...sa,...Ya],Rr=yw(),Ef=Ee?Rr.cluster??"mainnet-beta":"mainnet-beta",xs=Vt("swap"),jl="agent",_f=Xb(Rr),yn=os(),Lf=["SOL","USDC","PYUSD"],Ni=[{id:"scheduled-transfer",title:"Scheduled transfer",badge:"Payment",description:"Send the same token amount to one recipient on a recurring schedule. Each due item still needs approval.",draft:{token:"SOL",amount:"0.01",cadence:"weekly",note:"Recurring scheduled transfer"}},{id:"subscription",title:"Subscription / allowance",badge:"Allowance",description:"Create a capped recurring payment without granting unlimited authority.",draft:{token:"USDC",amount:"5",cadence:"monthly",note:"Recurring user-approved payment"}}],Wi=[{id:"transfer",eyebrow:"One-time transfer",title:"0.2 SOL transfer",prompt:"Prepare a 0.2 SOL transfer. Don't send until I approve.",detail:"The agent prepares the payment terms, but the wallet still owns the final approve or deny step.",planTitle:"Prepared SOL transfer for wallet review",route:"Create One-Time Plan -> Approval Inbox",risk:"Confirm the recipient, amount, cluster, and network fee before approving the final wallet request.",approvalBoundary:"No transaction is signed or submitted until you approve it from the wallet review step.",receiptType:"one_time_transfer_receipt",receiptSummary:"A bounded SOL transfer was prepared and reviewed before wallet approval.",constraints:["Amount is capped at 0.2 SOL.","Recipient must match the final wallet review.","No recurring allowance or delegated signer is created.","User approval is required before any send."],facts:[{label:"Action",value:"Send SOL"},{label:"Amount",value:"0.2 SOL max"},{label:"Custody",value:"User wallet"}]},{id:"swap",eyebrow:"Swap review",title:"SOL to USDC swap",prompt:"Swap SOL to USDC if slippage stays under 1%.",detail:"The agent turns a plain-English swap into a route, limits, and wallet approval boundary.",planTitle:"Prepared Jupiter-style swap review",route:"Create One-Time Plan -> Approval Inbox",risk:"Review price impact, route programs, minimum output, and final quote before approving.",approvalBoundary:"The agent can prepare route context, but only the wallet can approve the swap signature.",receiptType:"swap_review_receipt",receiptSummary:"A swap request was constrained by a 1% slippage cap before review.",constraints:["Maximum slippage is 100 bps.","Final wallet quote must show the actual minimum output.","Unexpected authority grants should be rejected.","Route changes require a fresh wallet review."],facts:[{label:"Route",value:"SOL -> USDC"},{label:"Limit",value:"1% slippage"},{label:"Signer",value:"Wallet only"}]},{id:"dca",eyebrow:"Recurring plan",title:"Weekly capped DCA",prompt:"Create a weekly DCA plan with a max spend cap. Each run waits for my approval.",detail:"The agent prepares the recurring schedule; every due occurrence still returns for approve or deny.",planTitle:"Prepared weekly DCA schedule",route:"Create Recurring Plan -> Approval Inbox occurrence",risk:"Recurring schedules should keep a clear max spend, cadence, token pair, and manual review rule.",approvalBoundary:"The schedule only prepares future requests. Each occurrence still requires wallet approval before funds move.",receiptType:"recurring_schedule_receipt",receiptSummary:"A weekly DCA schedule was prepared with a spend cap and manual approval on each run.",constraints:["Weekly cadence only.","Spend cap must be visible before schedule creation.","Each future run still needs explicit approval.","Every occurrence appears in Approval Inbox.","User can pause, resume, or delete the schedule."],facts:[{label:"Cadence",value:"Weekly"},{label:"Limit",value:"Capped spend"},{label:"Review",value:"Every run"}]},{id:"payouts",eyebrow:"Team payouts",title:"Contributor queue",prompt:"Queue contributor payouts for wallet review. Let me approve each payout individually.",detail:"The agent prepares the payout queue, but each recipient payment stays individually reviewable.",planTitle:"Prepared contributor payout queue",route:"Create One-Time Plan -> Approval Inbox batch",risk:"Check every recipient, memo, token, and payout amount before approving individual requests.",approvalBoundary:"The agent can prepare the payout list; each payout still needs wallet approval before sending.",receiptType:"payout_queue_receipt",receiptSummary:"Contributor payouts were queued for individual wallet review instead of auto-sending.",constraints:["Each recipient needs a visible payout line.","No unlimited token approval is requested.","Each payout can be approved or denied individually.","Receipts stay attached to the approval decision."],facts:[{label:"Workload",value:"Batch queue"},{label:"Control",value:"Per payout"},{label:"Record",value:"Receipt kept"}]}];function _n(e="transfer"){return{selectedScenarioId:e,stage:"request",decision:"pending",receiptId:"",receiptCreatedAt:"",receiptJson:"",signedReceipt:""}}const a={activeTab:jl,oneTimePlanView:"create",artifactView:"create",completedPlanFilter:"all",selectedRuntimePath:"exec",recentCopyId:"",guidedDemo:_n(),inboxFilter:"all",workflowModePreference:Rr.workflowModePreference??"auto",cloudSession:{status:"unknown",walletAddress:"",expiresAt:"",error:""},wallets:[],selectedWalletName:Rr.selectedWalletName??"",androidNativeEnvironment:fl(),androidAuthCacheCount:0,androidNativeStatus:"Android native MWA idle.",iosNativeEnvironment:Ul(),iosWallets:ql(),selectedIosWalletId:Rr.selectedIosWalletId??"phantom",iosAuthCacheCount:0,iosNativeStatus:"iOS native wallet idle.",address:"",signature:"",txSignature:"",txid:"",customTransactionBase64:"",transactionStatus:"",agentPrompt:gf,selectedTemplateId:xs.id,templateOutcomeFilter:"queueable",templateFields:Rt(xs),templateFieldErrors:{},agentPlan:null,agentSignature:"",agentPreparedActionId:"",generatedPlans:[],selectedGeneratedPlanId:"",generatedPlanAuditId:"",showArchivedGeneratedPlans:!1,aiSettings:{..._f,apiKey:""},aiSettingsPanelOpen:null,aiStatus:null,aiDiagnostics:[],aiPlannerConfirmation:{status:"untested",key:"",message:"",checkedAt:""},toasts:[],capabilities:null,error:"",busy:!1,activeOperation:null,cluster:Ef,bridgeUrl:Rr.bridgeUrl??pf,bridgeToken:Rr.bridgeToken??ff,bridgeActive:!1,bridgeStatus:"Bridge idle.",bridgeRpcUrl:"",health:null,balances:null,preparedActions:yn.preparedActions,materializedActions:yn.preparedActions,recurringPayments:yn.recurringPayments,receipts:yn.receipts,cloudCompletedPlans:[],cloudLastSync:"",lastCompletedFocusId:"",recurringDraft:ro(),recurringPreset:"scheduled-transfer",recurringErrors:{},recurringOccurrenceHistory:{},recurringNotificationStatus:{},recurringWebhookSecretOnce:null,mwaEnvironment:nu(),mwaRegistration:null,activeLab:Jt[0].id,labInputs:Yb(),labFieldValues:Vb(),labFieldErrors:{},labArtifacts:Fd(),labArchiveStatus:"Browser archive loading.",cloudEvidenceStatus:"Cloud evidence archive: sign in to also store receipts in Agentic Cloud.",cloudEvidenceLastSyncAt:0,artifactFilter:"all",artifactTypeFilter:"all",artifactSearch:"",auditOpen:{},auditActivity:{},steps:{discover:"idle",connect:"idle",sign:"idle",transaction:"idle",bridge:"idle",inbox:"idle",lab:"idle",ai:"idle"}};let qe=null,Je=null,ks=1,Cn=null,yi=!1,Ps=0,vn=null,Vr=null,Jr=null;const Ln=document.querySelector("#app");Of();async function Of(){try{if(!Ln)throw new Error("Missing #app");bl(),Uf(),Nf(),M(),window.addEventListener("popstate",()=>M()),window.addEventListener("keydown",Df),await Mf()}catch(e){Wf(e)}}function Df(e){e.key==="Escape"&&a.generatedPlanAuditId&&(e.preventDefault(),Ki())}function Nf(){var e,t;try{const r=vw();a.generatedPlans=r,a.selectedGeneratedPlanId=((e=r.find(n=>n.status!=="archived"))==null?void 0:e.id)??((t=r[0])==null?void 0:t.id)??""}catch(r){a.generatedPlans=[],a.selectedGeneratedPlanId="",console.warn("Generated plan storage could not be loaded.",r)}}function Wf(e){const t=e instanceof Error?e.message:String(e),r=s(t||"Unknown startup error."),n=Ln??document.body;n.innerHTML=`
|
|
5
|
+
<section data-agentic-startup-failure style="
|
|
6
|
+
min-height: 100vh;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
display: grid;
|
|
9
|
+
place-items: center;
|
|
10
|
+
padding: 24px;
|
|
11
|
+
background: #020504;
|
|
12
|
+
color: #eef8f2;
|
|
13
|
+
font-family: Space Grotesk, Inter, system-ui, sans-serif;
|
|
14
|
+
">
|
|
15
|
+
<div style="
|
|
16
|
+
max-width: 620px;
|
|
17
|
+
border: 1px solid rgba(94, 231, 158, 0.35);
|
|
18
|
+
border-radius: 12px;
|
|
19
|
+
background: rgba(9, 18, 15, 0.94);
|
|
20
|
+
box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
|
|
21
|
+
padding: 22px;
|
|
22
|
+
">
|
|
23
|
+
<p style="
|
|
24
|
+
margin: 0 0 8px;
|
|
25
|
+
color: #8bcdaa;
|
|
26
|
+
font-size: 0.75rem;
|
|
27
|
+
font-weight: 900;
|
|
28
|
+
letter-spacing: 0.08em;
|
|
29
|
+
text-transform: uppercase;
|
|
30
|
+
">Agentic startup failed</p>
|
|
31
|
+
<h1 style="margin: 0 0 10px; font-size: 1.35rem; line-height: 1.2;">Refresh loaded the shell, but the app could not start.</h1>
|
|
32
|
+
<p style="margin: 0; color: rgba(218, 229, 224, 0.84); line-height: 1.5;">${r}</p>
|
|
33
|
+
</div>
|
|
34
|
+
</section>
|
|
35
|
+
`,console.error("Agentic startup failed.",e)}async function Mf(){a.mwaRegistration=await iu({appIdentity:{name:"Agentic",uri:window.location.origin},chains:["solana:devnet","solana:mainnet-beta"],logLevel:"info"}),a.mwaEnvironment=a.mwaRegistration.environment,a.androidNativeEnvironment=fl(),a.androidNativeEnvironment.isAndroidNative&&a.cluster==="localnet"&&(a.cluster="devnet",ke()),await sn(),a.androidNativeEnvironment.isAndroidNative&&await Gv(),a.iosNativeEnvironment=Ul(),await va(),a.iosNativeEnvironment.isIosNative&&await Kv(),await qo(),await jd(),Pt()&&await He().catch(()=>{}),Zb()&&(await Qi(!1),a.aiSettings.mode==="bridge"&&await on(!1)),M()}function M(){if(!Ln)return;const e=Mi();jf(e),Rp(e??an(window.location.pathname),document.title),Bi(),Fi(),Ln.innerHTML=Bf(Ff(e),e),kh()}function Uf(){const e=Sf.get(window.location.hash);if(e){window.history.replaceState({},"",e);return}const t=an(window.location.pathname);if(t==="/browser"){window.history.replaceState({},"","/app");return}if(t==="/dos"){window.history.replaceState({},"","/docs");return}$o(t)&&window.location.pathname!==t&&window.history.replaceState({},"",t)}function Mi(){const e=an(window.location.pathname);return $o(e)?e:null}function qf(e){an(window.location.pathname)!==e&&window.history.pushState({},"",e),M(),window.scrollTo({top:0,behavior:"auto"})}function an(e){return e==="/"?"/":e.replace(/\/+$/,"")||"/"}function $o(e){return Af.has(e)}function Bf(e,t){const r=t?`route-${t==="/"?"home":t.slice(1).replace(/[^a-z0-9-]/g,"-")}`:"route-unknown",n=a.iosNativeEnvironment.isIosNative?"ios-native-shell":a.androidNativeEnvironment.bridgeAvailable?"android-shell":"";return`
|
|
36
|
+
<section class="shell homepage-shell ${r} ${n}">
|
|
37
|
+
${pw()}
|
|
38
|
+
${Xf(t)}
|
|
39
|
+
${e}
|
|
40
|
+
${kg()}
|
|
41
|
+
</section>
|
|
42
|
+
`}function Ff(e){switch(e){case"/":return Hf();case"/docs":return zf();case"/app":return Gf();case"/cli":return Kf();case"/desktop":return Yf();case"/android":return Vf();case"/demo":return Jf();case"/mwa-test":return Ao?xg():Cs();case"/privacy":return Zf();case"/terms":return Qf();default:return Cs()}}function jf(e){document.title=xf[e??""]??"Agentic | Solana Agent Wallet Adapter"}function Hf(){return`
|
|
43
|
+
${tg()}
|
|
44
|
+
${Hl()}
|
|
45
|
+
${zl()}
|
|
46
|
+
${mg()}
|
|
47
|
+
`}function zf(){return`
|
|
48
|
+
${og()}
|
|
49
|
+
${Hl()}
|
|
50
|
+
${zl()}
|
|
51
|
+
`}function Gf(){return Cg("app")}function Kf(){return`
|
|
52
|
+
${pg()}
|
|
53
|
+
${Pg()}
|
|
54
|
+
`}function Yf(){return fg()}function Vf(){return gg()}function Jf(){return hg()}function Cs(){return`
|
|
55
|
+
<section class="docs-section page-not-found" aria-labelledby="not-found-title">
|
|
56
|
+
<div class="section-heading">
|
|
57
|
+
<p class="eyebrow mini">Not found</p>
|
|
58
|
+
<h2 id="not-found-title">This Agentic page does not exist.</h2>
|
|
59
|
+
<p>Use the navigation bar to open docs, install paths, the guided demo, or the hosted app.</p>
|
|
60
|
+
</div>
|
|
61
|
+
</section>
|
|
62
|
+
`}function Zf(){return`
|
|
63
|
+
<section class="docs-section legal-page" aria-labelledby="privacy-title">
|
|
64
|
+
<div class="section-heading">
|
|
65
|
+
<p class="eyebrow mini">Legal</p>
|
|
66
|
+
<h2 id="privacy-title">Privacy Policy</h2>
|
|
67
|
+
<p class="legal-meta">Last updated: 2026-05-07</p>
|
|
68
|
+
</div>
|
|
69
|
+
<article class="legal-prose">
|
|
70
|
+
<p>SolPulse LLC ("SolPulse," "we," "our," or "us") values your privacy and is committed to protecting your information. This Privacy Policy describes how we collect, use, store, and disclose information when you access or use the Agentic websites, command-line interface, desktop app, browser app, mobile clients, runtime bridge, APIs, or related services (collectively, the "Platform" or "Agentic"). Agentic is a non-custodial wallet authority adapter — we do not take possession of your assets or private keys. You remain in full control of your wallets and signatures at all times, but certain data you provide or that we collect may still constitute personal data under applicable privacy laws.</p>
|
|
71
|
+
<p>By accessing or using Agentic, you acknowledge that you have read, understood, and agree to this Privacy Policy. If you disagree with any portion of this Policy, please discontinue use of the Platform.</p>
|
|
72
|
+
|
|
73
|
+
<h3>Quick Summary</h3>
|
|
74
|
+
<ul>
|
|
75
|
+
<li><strong>No private keys:</strong> Agentic does not ask for, collect, store, transmit, recover, or custody seed phrases, private keys, or wallet recovery credentials.</li>
|
|
76
|
+
<li><strong>No hosted account required:</strong> the current public app does not require an Agentic account.</li>
|
|
77
|
+
<li><strong>Local-first runtime:</strong> CLI, desktop, bridge settings, approval queues, bridge tokens, Android MWA authorization cache, and app logs are designed to stay on your device unless you choose to send information to us for support or connect them to third-party services.</li>
|
|
78
|
+
<li><strong>Android permissions:</strong> the Android app currently requests Internet access and foreground data-sync service permissions for wallet approval and bridge polling. It does not request camera, microphone, contacts, SMS, phone, precise location, health, calendar, or file-system permissions.</li>
|
|
79
|
+
<li><strong>No ad sale:</strong> we do not sell personal information and do not share it for cross-context behavioral advertising.</li>
|
|
80
|
+
<li><strong>Public blockchain:</strong> wallet addresses, transaction IDs, signatures, balances, token activity, timing, and other on-chain data may be public, permanent, and outside our control.</li>
|
|
81
|
+
</ul>
|
|
82
|
+
|
|
83
|
+
<h3>1. Information We Collect</h3>
|
|
84
|
+
<p><strong>A. Information You Provide</strong></p>
|
|
85
|
+
<ul>
|
|
86
|
+
<li>Contact details such as your email address (when you contact support)</li>
|
|
87
|
+
<li>Wallet information such as your Solana public key when you connect a wallet to a demo or web flow (which may be considered personal data when linked to other identifiers)</li>
|
|
88
|
+
<li>Any content you submit via forms, customer support, feedback surveys, community channels, or app-store review communications</li>
|
|
89
|
+
<li>AI planner prompts, templates, parameters, policy notes, and model settings you enter when you use the optional planner features</li>
|
|
90
|
+
<li>AI provider keys you choose to enter. Browser session keys stay in the current browser runtime, bridge keys are intended to stay in local bridge process memory unless you configure otherwise, and Hosted BYOK keys are relayed through the same-origin Agentic server only for the current draft request and are not stored by Agentic.</li>
|
|
91
|
+
</ul>
|
|
92
|
+
<p>We do not require know-your-customer (KYC) verification because the Platform is non-custodial and does not match, settle, or take the other side of any trade. However, regulations may change; we reserve the right to request additional information to comply with applicable laws or to prevent fraud, money laundering, or other illicit activity.</p>
|
|
93
|
+
<p><strong>B. Information We Collect Automatically</strong></p>
|
|
94
|
+
<ul>
|
|
95
|
+
<li>Technical data such as your IP address, browser type, device operating system, and user-agent information</li>
|
|
96
|
+
<li>Usage data such as access timestamps, referral URLs, pages visited, and actions taken on the public website</li>
|
|
97
|
+
<li>Wallet-connection events on the website (for example, when you connect, approve, or disconnect a wallet for a demo)</li>
|
|
98
|
+
<li>Approximate geolocation information inferred from your IP address, to comply with sanctions and jurisdictional restrictions</li>
|
|
99
|
+
<li>Android app technical data needed for Mobile Wallet Adapter operation, such as wallet package or URI availability checks, public wallet address, account label if supplied by the wallet, cluster, wallet capabilities, shortened signatures or transaction IDs in local logs, foreground service status, and bridge polling status</li>
|
|
100
|
+
<li>App diagnostics, errors, and security telemetry such as request IDs, timestamps, status codes, rejected wallet operations, and redacted log metadata</li>
|
|
101
|
+
</ul>
|
|
102
|
+
<p>The Agentic CLI, desktop runtime, Android MWA surface, and bridge run <strong>locally on your device</strong> and are not telemetered to SolPulse by default. Approval rails, prepared-action queues, Android authorization cache, signing flows, bridge tokens, and local logs execute or persist on your machine; we do not receive telemetry on transaction content unless you contact us with a support request that you elect to attach.</p>
|
|
103
|
+
<p><strong>C. Public Blockchain Data</strong></p>
|
|
104
|
+
<p>Transactions you broadcast to the Solana blockchain are publicly accessible and cannot be erased. We do not control or store on-chain data, but we may analyse publicly available blockchain information to detect suspicious activity, debug issues, or improve documentation.</p>
|
|
105
|
+
|
|
106
|
+
<h3>2. How We Use Your Information</h3>
|
|
107
|
+
<ul>
|
|
108
|
+
<li>To provide, operate, maintain, and improve the Platform and its tooling</li>
|
|
109
|
+
<li>To respond to support requests and feedback</li>
|
|
110
|
+
<li>To analyse usage patterns and improve performance and reliability of the public website</li>
|
|
111
|
+
<li>To enforce our Terms of Service, detect and prevent fraud, abuse, or other misuse</li>
|
|
112
|
+
<li>To communicate with you about updates, new features, or regulatory notices (with your consent where required)</li>
|
|
113
|
+
<li>To comply with applicable laws, regulations, and legal processes</li>
|
|
114
|
+
</ul>
|
|
115
|
+
<p>We do not sell your personal data. We may share it with service providers who help us operate the Platform under strict confidentiality obligations, and with regulators or law enforcement if required by law.</p>
|
|
116
|
+
|
|
117
|
+
<h3>3. Cookies, Local Storage & Analytics</h3>
|
|
118
|
+
<p>The Agentic website uses browser-based storage methods such as IndexedDB and localStorage to maintain app state, selected wallet name, selected cluster, bridge URL, bridge token, lab artifacts, UI preferences, and similar local workspace data. When a local bridge is connected, signed lab artifacts may also be mirrored to a local bridge archive file. The Android app may store Mobile Wallet Adapter authorization records in app-private storage so you can reconnect a previously approved wallet. You may clear browser storage, app storage, or local runtime files, but doing so may remove preferences, authorization cache, receipts, or local artifacts.</p>
|
|
119
|
+
<p>We use Google Analytics 4 on the public marketing site and hosted app when a measurement ID is configured. Google Analytics may collect or process page views, route changes, download clicks, navigation clicks, wallet-connect events, planner button clicks, device/browser information, approximate location, and related identifiers according to Google's terms and settings. We do not send wallet addresses, signatures, transaction IDs, AI prompts, AI keys, bridge tokens, or raw user-entered planner values to Google Analytics, and we do not use Google Analytics to sell personal information or for cross-context behavioral advertising.</p>
|
|
120
|
+
|
|
121
|
+
<h3>4. Data Storage & Security</h3>
|
|
122
|
+
<p>We implement reasonable technical and organizational measures designed to protect your personal information. Examples include encryption in transit via SSL/TLS, secure infrastructure, and access controls. Despite these measures, no method of transmission or storage is completely secure; you use the Platform at your own risk.</p>
|
|
123
|
+
<p>We retain your information only as long as necessary to provide the Platform, comply with our legal obligations, resolve disputes, and enforce our agreements. Where feasible, we minimize data and may anonymize or aggregate information to further protect your privacy. You remain responsible for securing your device, browser profile, wallet app, seed phrase, bridge token, AI provider key, and any third-party agent software you connect.</p>
|
|
124
|
+
|
|
125
|
+
<h3>5. Children's Privacy</h3>
|
|
126
|
+
<p>Agentic does not knowingly collect or store data from anyone under the age of 18. If you are a parent or guardian and believe your child has submitted information to us, contact us at support@solpulse.trade and we'll promptly delete it.</p>
|
|
127
|
+
|
|
128
|
+
<h3>6. Information Sharing</h3>
|
|
129
|
+
<p>We may share your data with service providers who support our infrastructure, analytics, or communications; legal authorities, if required by law or in connection with a legal investigation; and third-party tools, only when necessary and never for marketing resale purposes.</p>
|
|
130
|
+
|
|
131
|
+
<h3>7. International Data Transfers</h3>
|
|
132
|
+
<p>SolPulse LLC operates globally. Your information may be processed in countries outside of your jurisdiction of residence, which may have different data protection laws. Where required by law, we use appropriate safeguards, such as standard contractual clauses, to protect cross-border data transfers. By using the Platform, you consent to this processing and transfer of your information.</p>
|
|
133
|
+
|
|
134
|
+
<h3>8. Your Rights</h3>
|
|
135
|
+
<p>Depending on your jurisdiction, you may have the right to request access to your personal information, request deletion of your personal data, or opt out of email communications. To exercise these rights, email us at support@solpulse.trade. We will remove your personal data within 30 days of a verified request, except where retention is required by law (e.g., compliance logs).</p>
|
|
136
|
+
|
|
137
|
+
<h3>9. Updates to This Policy</h3>
|
|
138
|
+
<p>We may update this Privacy Policy from time to time. The most current version will always be available at https://agenticwalletadapter.com/privacy. Your continued use of Agentic after changes are posted signifies your acceptance of those changes.</p>
|
|
139
|
+
|
|
140
|
+
<h3>10. Contact Us</h3>
|
|
141
|
+
<p>If you have any questions or requests regarding this Privacy Policy, you can reach us at:</p>
|
|
142
|
+
<ul>
|
|
143
|
+
<li>📧 Email: support@solpulse.trade</li>
|
|
144
|
+
<li>📍 Location: SolPulse LLC, 1621 Central Ave, Cheyenne, WY 82001</li>
|
|
145
|
+
</ul>
|
|
146
|
+
|
|
147
|
+
<h3>11. Do Not Sell or Share Personal Information</h3>
|
|
148
|
+
<p>We do not sell your personal information and we do not share it for cross-context behavioral advertising. We disclose personal information only to service providers and processors under written agreements to operate the Platform, or where required by law.</p>
|
|
149
|
+
|
|
150
|
+
<h3>12. Legal Bases for Processing (where applicable)</h3>
|
|
151
|
+
<ul>
|
|
152
|
+
<li><strong>Contract:</strong> to provide and support the Platform you request.</li>
|
|
153
|
+
<li><strong>Legitimate Interests:</strong> to secure, improve, and support the Platform; prevent fraud and abuse; understand usage.</li>
|
|
154
|
+
<li><strong>Consent:</strong> for optional diagnostics, marketing communications, or non-essential cookies.</li>
|
|
155
|
+
<li><strong>Legal Obligation:</strong> to satisfy regulatory, tax, accounting, and law-enforcement requirements.</li>
|
|
156
|
+
</ul>
|
|
157
|
+
|
|
158
|
+
<h3>13. Data Retention & Deletion</h3>
|
|
159
|
+
<ul>
|
|
160
|
+
<li><strong>Public-website usage logs:</strong> approximately 30–90 days, extendable for security or abuse investigations.</li>
|
|
161
|
+
<li><strong>Support tickets & attachments:</strong> active ticket duration plus up to 24 months.</li>
|
|
162
|
+
<li><strong>Google Analytics 4 data, when enabled:</strong> retained according to the configured Google Analytics property retention settings and applicable Google controls.</li>
|
|
163
|
+
<li><strong>Local-device data (CLI, runtime, desktop bridge, Android MWA app, local logs, authorization cache, bridge tokens, session AI keys, and receipts):</strong> stays on your device under your control; we do not retain it unless you send it to us.</li>
|
|
164
|
+
<li><strong>Public blockchain data:</strong> may be permanent and cannot be deleted or modified by SolPulse.</li>
|
|
165
|
+
<li><strong>Legal, safety, and compliance records:</strong> retained as long as necessary to satisfy legal obligations, sanctions controls, fraud prevention, security, dispute resolution, or legal defense.</li>
|
|
166
|
+
</ul>
|
|
167
|
+
|
|
168
|
+
<h3>14. Third-Party Services & Processors</h3>
|
|
169
|
+
<p>We rely on third-party providers to operate the public-facing parts of the Platform. These providers act as processors or service providers under contracts that restrict their use of personal information to the services we request.</p>
|
|
170
|
+
<ul>
|
|
171
|
+
<li><strong>Wallet Standard wallets</strong> (Phantom, Solflare, Backpack, Glow, etc.) — chosen by you. When you connect a wallet, that wallet provider's privacy policy applies to wallet-side data, including key custody and recovery.</li>
|
|
172
|
+
<li><strong>Mobile Wallet Adapter wallets and Android platform services</strong> — chosen by you or provided by the Android/browser environment to route approvals, foreground data-sync behavior, and wallet handoffs.</li>
|
|
173
|
+
<li><strong>Solana RPC providers</strong> (e.g., Helius, public mainnet RPC, or configured RPC endpoints) — for on-chain reads, simulations, balance checks, and transaction submission initiated by you, your wallet, or your agent.</li>
|
|
174
|
+
<li><strong>Hosting (Render), Google Play, Chrome/Custom Tabs/TWA, and app-store services</strong> — to distribute or serve the public website and Android app surfaces.</li>
|
|
175
|
+
<li><strong>Optional AI clients and providers</strong> (Anthropic Claude, OpenAI/Codex, Vercel AI SDK, third-party MCP servers, or OpenAI-compatible providers you configure) — your chosen agent client, browser session key, local bridge, or hosted BYOK request calls them under its own terms and privacy policy. Hosted BYOK relays your API key to the selected provider for that request and does not store it.</li>
|
|
176
|
+
<li><strong>Google Analytics 4</strong> — aggregated usage measurement for product and reliability analysis when configured, subject to Google Analytics configuration and applicable consent requirements.</li>
|
|
177
|
+
</ul>
|
|
178
|
+
|
|
179
|
+
<h3>15. Additional Rights by Jurisdiction</h3>
|
|
180
|
+
<p>Depending on where you live (e.g., EEA/UK, California), you may have additional rights, such as portability, restriction, objection to certain processing, and the right to appeal automated decisions. To exercise any rights beyond those listed above, contact us using the details in the "Contact Us" section.</p>
|
|
181
|
+
|
|
182
|
+
<h3>16. AML / CTF & Sanctions Processing</h3>
|
|
183
|
+
<p>Although Agentic is a non-custodial software interface and is not itself a regulated financial intermediary, we may collect and process limited identifiers, contact information, wallet addresses, approximate location signals, device or session identifiers, and screening results from compliance service providers to comply with anti-money-laundering (AML), counter-terrorist-financing (CTF), and sanctions requirements. Where required, we may request additional verification or documentation. Processing is based on our legal obligations and our legitimate interests in maintaining Platform integrity and compliance. We may disclose relevant information to competent authorities or service providers when legally required or to prevent fraud or abuse.</p>
|
|
184
|
+
|
|
185
|
+
<h3>17. Geographic Restrictions</h3>
|
|
186
|
+
<p>We may use IP address, coarse location, and related technical signals to determine feature availability and to restrict access from prohibited or high-risk jurisdictions for compliance and safety purposes. These signals are approximate and do not constitute precise geolocation. We may retain logs necessary to demonstrate compliance with sanctions and other legal requirements.</p>
|
|
187
|
+
|
|
188
|
+
<h3>18. Third-Party Data, Content & Links</h3>
|
|
189
|
+
<p>The Platform may display market data, token metadata, pricing, RPC results, or other content provided by third parties and may include links to external websites. We do not control third-party content and are not responsible for its accuracy or availability. Your interactions with third-party services are governed by their own terms and policies. Where technically necessary, we may transmit limited identifiers to such services to enable functionality.</p>
|
|
190
|
+
|
|
191
|
+
<h3>19. Security Telemetry & Malicious Code</h3>
|
|
192
|
+
<p>While we employ reasonable safeguards, we cannot guarantee that files or data available through the Platform are free from viruses, malware, or other harmful components, or that services will be immune to denial-of-service or similar attacks. To protect the Platform, we may collect security telemetry such as error codes, request metadata, and limited device signals for detection, prevention, and response. You remain responsible for appropriate device and account security measures.</p>
|
|
193
|
+
|
|
194
|
+
<h3>20. Tutorials, Documentation & Help Resources</h3>
|
|
195
|
+
<p>Tutorials, videos, FAQs, and helpdesk responses describe Platform functionality only and are not personalized advice, suitability assessments, or recommendations. We may process the content of your help requests and attachments to resolve issues and improve quality. Aggregated, de-identified analytics may be used to improve support resources.</p>
|
|
196
|
+
|
|
197
|
+
<h3>21. Google Play Data Safety & Financial Features</h3>
|
|
198
|
+
<p>If Agentic is distributed through Google Play, the Google Play Data Safety form and any Financial features declaration must be kept consistent with this Privacy Policy and the actual Android app behavior. Because Agentic involves cryptocurrency wallet actions, SolPulse may disclose financial-feature information to Google Play and may update app availability, disclosures, or functionality to satisfy store policy or applicable law.</p>
|
|
199
|
+
</article>
|
|
200
|
+
</section>
|
|
201
|
+
`}function Qf(){return`
|
|
202
|
+
<section class="docs-section legal-page" aria-labelledby="terms-title">
|
|
203
|
+
<div class="section-heading">
|
|
204
|
+
<p class="eyebrow mini">Legal</p>
|
|
205
|
+
<h2 id="terms-title">Terms of Service</h2>
|
|
206
|
+
<p class="legal-meta">Last updated: 2026-05-07</p>
|
|
207
|
+
</div>
|
|
208
|
+
<article class="legal-prose">
|
|
209
|
+
<p>These Terms of Service ("Terms") constitute a legally binding agreement between you ("you" or "User") and SolPulse LLC ("SolPulse," "we," "our," or "us"). These Terms govern your use of the Agentic websites, command-line interface, desktop app, browser app, mobile clients, runtime bridge, APIs, and other services provided by SolPulse (collectively, the "Platform" or "Agentic"). By accessing or using the Platform, you acknowledge that you have read, understood, and agree to be bound by these Terms. If you do not agree, you must not use the Platform.</p>
|
|
210
|
+
|
|
211
|
+
<h3>1. Eligibility</h3>
|
|
212
|
+
<p>You may use the Platform only if you are at least 18 years of age and have the legal capacity to enter into a binding contract. You are solely responsible for ensuring that your use of the Platform complies with all laws and regulations applicable to you. Access to the Platform may not be legal for certain persons or in certain countries. If use of the Platform is prohibited by law in your jurisdiction, you must not use it.</p>
|
|
213
|
+
|
|
214
|
+
<h3>2. Use of the Platform</h3>
|
|
215
|
+
<p>The Platform is provided for your personal and lawful use only. You agree that you will not:</p>
|
|
216
|
+
<ul>
|
|
217
|
+
<li>Use the Platform for any unlawful or fraudulent purpose, including activities that violate anti-money laundering or sanctions laws</li>
|
|
218
|
+
<li>Interfere with or disrupt the integrity or performance of the Platform, or attempt to circumvent any measures we use to prevent or restrict access</li>
|
|
219
|
+
<li>Transmit viruses, worms, or other malicious code</li>
|
|
220
|
+
<li>Use robots, scrapers, or other automated means not provided by us to access the public website in a manner that sends more requests to our servers than a human can reasonably produce in the same period</li>
|
|
221
|
+
<li>Use another User's account or session credentials without permission, or share your own</li>
|
|
222
|
+
</ul>
|
|
223
|
+
<p><strong>2a. License Grant.</strong> Subject to your continued compliance with these Terms, SolPulse grants you a limited, revocable, non-exclusive, non-transferable, non-sublicensable license to access and use the Platform for your personal, non-commercial activity. No other rights are granted. Any rights not expressly granted are reserved. You may not rent, lease, resell, sublicense, or commercially exploit the Platform, or any part of it, without our prior written consent.</p>
|
|
224
|
+
|
|
225
|
+
<h3>3. Web3 Access & Wallets</h3>
|
|
226
|
+
<p>Agentic is a <strong>non-custodial wallet authority adapter</strong>: we do not hold or control your cryptocurrency, your private keys, or your seed phrase. You connect your own Wallet Standard, Mobile Wallet Adapter, or other supported wallet (such as Phantom, Solflare, Backpack, or Glow), and you remain responsible for:</p>
|
|
227
|
+
<ul>
|
|
228
|
+
<li>Generating, maintaining, and safeguarding your own private keys, seed phrases, and wallet credentials</li>
|
|
229
|
+
<li>Reviewing every prepared transaction surfaced by the Platform — including transfers, approvals, swaps, and any agent-initiated action — before signing it</li>
|
|
230
|
+
<li>Configuring and revoking any caps, allowlists, recurring payments, or pre-approved categories you enable</li>
|
|
231
|
+
</ul>
|
|
232
|
+
<p>Because the Platform is non-custodial, <strong>losing access to your private keys will permanently prevent you from accessing your assets</strong>. We have no ability to reset, retrieve, or restore lost keys or funds.</p>
|
|
233
|
+
<p>If you use a third-party embedded wallet, hardware wallet, or wallet-as-a-service product, key recovery and custody are subject to that provider's terms and infrastructure. We do not control third-party wallet providers and are not liable for their unavailability, security breaches, or loss of access.</p>
|
|
234
|
+
|
|
235
|
+
<p><strong>3a. Agent / MCP Risk.</strong> Agentic exists to let AI agents — including but not limited to large language models, MCP servers, third-party agent frameworks, scheduled bots, and any automation you connect to the Platform — propose wallet actions for your review. <strong>The agent's request is a proposal; your click is the authority.</strong> You acknowledge and accept that:</p>
|
|
236
|
+
<ul>
|
|
237
|
+
<li>AI agents and LLMs can hallucinate, be prompt-injected, behave unexpectedly, or be authored by malicious third parties</li>
|
|
238
|
+
<li>A buggy or hostile agent could attempt to author transactions that drain, lock, or otherwise harm your wallet if signed</li>
|
|
239
|
+
<li>Agentic's role is to surface the proposed action so you can review it; the Platform does not auto-approve and does not vet the agent's intent</li>
|
|
240
|
+
<li>AI providers (Anthropic, OpenAI, third-party MCP authors, Vercel AI, etc.) are not SolPulse's agents, employees, or representatives; their behavior is not under our control</li>
|
|
241
|
+
<li>Optional AI planner features only prepare plans or explanations; they do not make a transaction safe, signed, submitted, profitable, reversible, or suitable for you</li>
|
|
242
|
+
<li>You remain solely responsible for what you sign, including approvals issued by automation or pre-authorized categories you enabled</li>
|
|
243
|
+
</ul>
|
|
244
|
+
|
|
245
|
+
<p><strong>3b. What Agentic Does Not Do.</strong> Agentic does <strong>not</strong>:</p>
|
|
246
|
+
<ul>
|
|
247
|
+
<li>Custody, hold, or escrow your digital assets</li>
|
|
248
|
+
<li>Generate, store, or recover seed phrases or private keys</li>
|
|
249
|
+
<li>Auto-approve transactions on your behalf</li>
|
|
250
|
+
<li>Call AI providers without your chosen AI path. Hosted BYOK relays only the draft request you submit; browser session, local bridge, and external agent clients call providers under their own configuration and provider policies</li>
|
|
251
|
+
<li>Match, settle, or take the other side of any trade</li>
|
|
252
|
+
<li>Operate an order book, an exchange, or a liquidity pool</li>
|
|
253
|
+
</ul>
|
|
254
|
+
|
|
255
|
+
<p><strong>3c. Bring-Your-Own AI Keys.</strong> If you paste or configure an AI provider key, base URL, model name, prompt, template, or plan parameter in Agentic, you are instructing the selected AI path to contact that provider. Hosted BYOK sends the key and draft request through the same-origin Agentic server for that request only; browser session and local bridge paths use your browser or local runtime. You are responsible for the provider you choose, its terms, its privacy practices, its billing, and the content you send to it. SolPulse does not guarantee that provider responses are accurate, secure, compliant, or fit for any purpose. Never enter a wallet seed phrase, private key, recovery phrase, or unrestricted credential into any AI prompt, MCP server, bridge, or support request.</p>
|
|
256
|
+
|
|
257
|
+
<h3>4. Future Paid Features</h3>
|
|
258
|
+
<p>The Platform is currently provided without subscription fees. SolPulse may, in the future, offer paid features, subscriptions, or premium tiers. If we do, the pricing, billing terms, and payment schedule will be presented at signup, and your use of those paid features will be subject to these Terms together with any additional, feature-specific terms posted at the time of purchase. Network fees, RPC fees, protocol fees, and any other third-party fees you incur when broadcasting transactions through the Platform are set by third parties and not by SolPulse.</p>
|
|
259
|
+
|
|
260
|
+
<h3>5. Risk Disclosure</h3>
|
|
261
|
+
<p><strong>Crypto and agent-action risk.</strong> The cryptocurrency market is extremely volatile, and the use of AI agents to interact with on-chain protocols is novel and carries unique risk. By using the Platform, you acknowledge and agree that:</p>
|
|
262
|
+
<ul>
|
|
263
|
+
<li>You are solely responsible for your transactions and decisions and assume all risk associated with them</li>
|
|
264
|
+
<li>You may lose some or all of your capital; there is no guarantee of profit or asset preservation</li>
|
|
265
|
+
<li>An AI agent or MCP server can prepare transactions you did not intend; reviewing each approval is your responsibility</li>
|
|
266
|
+
<li>Past performance of any strategy, agent, market, or protocol does not guarantee future results</li>
|
|
267
|
+
<li>Market manipulation, pump-and-dump schemes, prompt injection, hostile MCP servers, and other fraudulent or adversarial activities may affect your outcomes; you should conduct your own due diligence and remain vigilant</li>
|
|
268
|
+
</ul>
|
|
269
|
+
<p>SolPulse provides software and a consent rail. We are <strong>not</strong> a broker-dealer, investment adviser, or financial advisor. Nothing on the Platform constitutes financial advice. Please consult a qualified professional before making financial decisions.</p>
|
|
270
|
+
<p><strong>Voluntary assumption of risk.</strong> By using the Platform, you voluntarily assume all risks associated with cryptocurrency activity and agent-mediated transactions, including the risk of total and permanent loss of all funds in your wallet. You acknowledge that digital assets are not legal tender, are not backed by any government, and are not insured by any federal or state agency (including the FDIC or SIPC). You agree not to hold SolPulse liable for any losses, missed actions, failed transactions, or adverse outcomes resulting from your use of the Platform or from agents you connect to it.</p>
|
|
271
|
+
|
|
272
|
+
<h3>6. Compliance & Regulatory Status</h3>
|
|
273
|
+
<p>Agentic is a non-custodial software interface that brokers wallet authority between you and the agents you choose to connect. We do not operate an exchange, an order book, a matching engine, or a liquidity pool. We do not take the other side of any trade. We do not hold, custody, or control your funds or private keys at any time. All transactions are signed by you in your own wallet and broadcast to public networks (such as Solana) through third-party RPC providers and on-chain protocols.</p>
|
|
274
|
+
<p>SolPulse intends Agentic to operate as non-custodial software and not as a money transmitter, broker, dealer, exchange, investment adviser, bank, fiduciary, payment processor, or other regulated financial intermediary. Laws and regulations regarding digital assets, wallets, AI agents, and automated approvals are evolving and may be interpreted differently by different authorities. You are responsible for determining whether use of the Platform is permitted under the laws of your jurisdiction and for complying with any applicable licensing, registration, tax, accounting, or reporting obligations. We reserve the right to implement KYC/AML procedures, sanctions screening, geoblocking, app-store declarations, feature restrictions, or other compliance measures as necessary to meet legal requirements or risk controls.</p>
|
|
275
|
+
|
|
276
|
+
<h3>7. No Warranty</h3>
|
|
277
|
+
<p>The Platform and all related services are provided on an "as is" and "as available" basis without warranty of any kind. To the fullest extent permitted by law, SolPulse disclaims all warranties, express or implied, including but not limited to warranties of merchantability, fitness for a particular purpose, accuracy, non-infringement, and uninterrupted or error-free operation. We do not guarantee the availability, timeliness, completeness, or reliability of any information, agent integration, or feature offered through the Platform. You use the Platform at your own risk.</p>
|
|
278
|
+
|
|
279
|
+
<h3>8. Limitation of Liability</h3>
|
|
280
|
+
<p>To the maximum extent permitted by law, SolPulse and its directors, employees, agents, and affiliates will not be liable to you for any indirect, incidental, special, punitive, or consequential damages arising out of or in connection with your use of the Platform, even if we have been advised of the possibility of such damages. This limitation applies to, but is not limited to: any loss of profits, revenue, or data; loss of digital assets or cryptocurrency; trading or position losses; missed or failed transactions; liquidation events; losses from rug pulls, scams, exploits, prompt injection, hostile agents, or malicious MCP servers; losses caused by third-party protocol failures; losses due to network congestion, RPC outages, or MEV; losses from automation or agent malfunction; business interruption; or any other economic disadvantage. In no event shall our aggregate liability exceed the greater of (a) the amount you paid to us in the twelve months preceding the claim, or (b) one hundred US dollars (USD $100). Some jurisdictions do not allow limitations on implied warranties or liability; in such jurisdictions, our liability shall be limited to the greatest extent permitted by law.</p>
|
|
281
|
+
<p><strong>Claims Only Against the Company.</strong> You agree that any claim you may have in connection with the Platform may be brought only against SolPulse LLC and not against its owners, officers, directors, employees, contractors, affiliates, service providers, or licensors in their personal or individual capacity. This limitation applies to the fullest extent permitted by law.</p>
|
|
282
|
+
|
|
283
|
+
<h3>9. Intellectual Property</h3>
|
|
284
|
+
<p>All intellectual property rights in the Platform, including but not limited to branding, UI, documentation, hosted service configuration, app-store listings, images, names, logos, and non-open-source assets, remain the property of SolPulse or its licensors. Open-source code published by SolPulse is governed by the open-source license included with that code, currently Apache-2.0 for this repository. These Terms do not reduce rights granted to you under that open-source license, but they do not grant rights to use SolPulse names, logos, trade dress, hosted services, app listings, or other brand assets except as expressly permitted in writing.</p>
|
|
285
|
+
<p>All trademarks, service marks, trade names, logos, and brand identifiers appearing on the Platform that are not owned by SolPulse are the property of their respective owners. Reference to any third-party mark, protocol, token, or service is for identification only and does not imply endorsement, partnership, or affiliation.</p>
|
|
286
|
+
<p><strong>9a. Copyright & DMCA.</strong> SolPulse respects the intellectual property rights of others and expects users of the Platform to do the same. If you believe material accessible on or from the Platform infringes your copyright, you may request its removal by sending a written notice of infringement to our designated agent that includes: (a) a physical or electronic signature of the copyright owner or a person authorized to act on their behalf; (b) identification of the copyrighted work claimed to be infringed; (c) identification of the allegedly infringing material and information reasonably sufficient to locate it on the Platform; (d) your contact information (name, address, telephone number, and email); (e) a statement that you have a good-faith belief that the use is not authorized by the copyright owner, its agent, or the law; and (f) a statement, made under penalty of perjury, that the information in your notice is accurate and that you are the copyright owner or authorized to act on the owner's behalf. Send notices to our DMCA agent at support@solpulse.trade with the subject line "DMCA Notice." We may, in appropriate circumstances and at our discretion, terminate the accounts of users who are repeat infringers. Knowingly submitting a false or misleading notice of infringement may subject you to liability under applicable law.</p>
|
|
287
|
+
|
|
288
|
+
<h3>10. Termination & Suspension</h3>
|
|
289
|
+
<p>We may suspend, restrict, or terminate your access to the Platform at any time, with or without notice, if we believe you have violated these Terms, engaged in fraudulent or illegal activity, or if your use of the Platform poses a security or regulatory risk. You agree that we will not be liable to you or any third party for any termination of your access. Upon termination, your right to use the Platform ceases immediately. Any provisions of these Terms that by their nature should survive termination (including ownership rights, warranty disclaimers, limitation of liability, indemnification, and dispute resolution) shall remain in effect.</p>
|
|
290
|
+
|
|
291
|
+
<h3>11. Indemnification</h3>
|
|
292
|
+
<p>You agree to indemnify, defend, and hold harmless SolPulse and its directors, officers, employees, and agents from and against any claims, liabilities, damages, losses, and expenses (including reasonable attorney's fees) arising out of or related to (a) your use or misuse of the Platform, (b) your violation of these Terms, (c) your violation of any rights of another person or entity, or (d) your violation of any applicable law or regulation. We reserve the right to assume exclusive control of any matter otherwise subject to indemnification by you, in which case you agree to cooperate with our defence.</p>
|
|
293
|
+
|
|
294
|
+
<h3>12. Governing Law & Dispute Resolution</h3>
|
|
295
|
+
<p>These Terms, and any dispute arising out of or in connection with the Platform or these Terms, shall be governed by and construed in accordance with the laws of the State of Wyoming, without regard to conflict of law principles. You agree that any dispute, claim, or controversy arising out of or relating to these Terms or the breach, termination, enforcement, interpretation, or validity thereof (collectively, "Disputes") shall be resolved by binding arbitration administered by the American Arbitration Association (AAA) under its Consumer Arbitration Rules, conducted remotely or in the State of Wyoming. Either party may bring claims in small claims court if the claim qualifies. The arbitration shall be conducted on an individual basis and not on a class or representative basis. <strong>YOU AGREE THAT ANY CLAIMS WILL BE RESOLVED ON AN INDIVIDUAL BASIS AND NOT AS PART OF ANY CLASS, CONSOLIDATED, OR REPRESENTATIVE ACTION.</strong> You understand that by agreeing to arbitrate disputes, you are waiving your right to a jury trial and to participate in a class action. If this arbitration clause is found to be unenforceable, then all Disputes shall be subject to the exclusive jurisdiction of the federal and state courts located in the State of Wyoming, and you consent to the personal jurisdiction of such courts.</p>
|
|
296
|
+
<p><strong>Thirty-Day Opt-Out.</strong> You have the right to opt out of the arbitration and class-action waiver provisions set forth above by sending written notice to support@solpulse.trade with the subject line "Arbitration Opt-Out" within thirty (30) days of the date you first accept these Terms. Your notice must include your full legal name, the email address associated with your account or contact, and a clear statement that you wish to opt out of arbitration. Opting out does not affect any other provision of these Terms, including the governing-law and venue selections.</p>
|
|
297
|
+
<p><strong>Prevailing Party Fees.</strong> In any arbitration or legal proceeding arising out of or relating to these Terms, the prevailing party shall be entitled to recover its reasonable attorneys' fees, expert fees, arbitration filing fees, and costs, to the extent permitted by applicable law and the rules of the forum.</p>
|
|
298
|
+
|
|
299
|
+
<h3>13. Changes to Terms</h3>
|
|
300
|
+
<p>We may update these Terms from time to time. The latest version will always be posted at https://agenticwalletadapter.com/terms. Continued use after changes constitutes acceptance.</p>
|
|
301
|
+
|
|
302
|
+
<h3>14. Contact</h3>
|
|
303
|
+
<ul>
|
|
304
|
+
<li>📧 Email: support@solpulse.trade</li>
|
|
305
|
+
<li>📍 Location: SolPulse LLC, 1621 Central Ave, Cheyenne, WY 82001</li>
|
|
306
|
+
</ul>
|
|
307
|
+
<p><strong>14a. Privacy.</strong> Your use of the Platform is also governed by our <a href="/privacy">Privacy Policy</a>, which is incorporated into these Terms by reference. The Privacy Policy describes what data we collect, how we use it, with whom we share it, and your rights regarding your personal information. By using the Platform you consent to the collection, use, and sharing of your data as described in the Privacy Policy. If you do not agree with the Privacy Policy, you must not use the Platform.</p>
|
|
308
|
+
<p><strong>14b. Electronic Communications & Signatures.</strong> By using the Platform, you consent to receive communications from SolPulse electronically, including by email, in-app notice, or other channel where you have provided contact information, and you agree that all agreements, notices, disclosures, and other communications we provide to you electronically satisfy any legal requirement that such communications be in writing. You further agree that your electronic acceptance of these Terms — for example, by clicking "I accept," connecting a wallet, or continuing to use the Platform after notice of updates — constitutes a legally binding signature under the U.S. Electronic Signatures in Global and National Commerce Act (15 U.S.C. § 7001 et seq.) and any applicable state Uniform Electronic Transactions Act. You may withdraw this consent only by discontinuing use of the Platform.</p>
|
|
309
|
+
|
|
310
|
+
<h3>15. Action Approval & Execution</h3>
|
|
311
|
+
<p>Actions surfaced by the Platform are prepared off-chain by the agent or other software you connect, displayed for your review, signed by your wallet, and broadcast to the relevant blockchain network through third-party RPC providers and on-chain protocols. Any pre-action estimate displayed by the Platform — including price, slippage, fees, route, or expected outcome — is for informational convenience only and may differ from the actual on-chain result due to network conditions, slippage, routing changes, MEV activity, or third-party protocol behavior. Approvals can expire, fail to land, partial-fill, or be re-ordered, front-run, censored, or delayed by the network or validators. Adjusting compute unit prices or priority tips may improve inclusion probabilities but does not guarantee execution or price. SolPulse does not guarantee that any signed transaction will land or settle, and is not responsible for the outcomes of transactions you authorize.</p>
|
|
312
|
+
|
|
313
|
+
<h3>16. Third-Party Services & Data Sources</h3>
|
|
314
|
+
<p>The Platform may rely on third-party services and data sources such as wallet providers, RPC nodes, AI clients, MCP servers, DEX aggregators/routers, market data providers, block explorers, messaging services, and email providers. We do not control and are not responsible for their availability, accuracy, performance, security, or legality. Outages, inaccuracies, or changes in those services may affect your experience and outcomes. Your use of third-party services may be governed by their own terms and privacy policies.</p>
|
|
315
|
+
|
|
316
|
+
<h3>17. Automation, Caps & Pre-Authorized Categories</h3>
|
|
317
|
+
<p>If you enable automated approvals, spend caps, recurring payments, allowlisted recipients, bridge polling, Android foreground wallet-approval flows, or any "always allow" / pre-authorized category in the Platform, you authorize the Platform to prepare, queue, poll for, or submit transactions via your connected wallet in accordance with your parameters. You are responsible for maintaining adequate balances, monitoring the automation, and disabling or revoking it when desired. We may implement idempotency or duplicate-protection mechanisms, but they cannot prevent all race conditions, retries, stale authorizations, wallet bugs, bridge failures, or double-submissions across networks, devices, agents, or wallets.</p>
|
|
318
|
+
|
|
319
|
+
<h3>18. Safety Checks & Heuristics</h3>
|
|
320
|
+
<p>Any safety, simulation, cap, allowlist, balance, slippage, or risk check surfaced by the Platform is heuristic and informational only. Such checks do not constitute a guarantee that an action is safe, that a token is legitimate, that liquidity is sufficient, or that an agent is non-malicious. You should conduct your own due diligence before approving any action and understand that heuristic checks can be incomplete, stale, or bypassed. We are not liable for losses arising from rug pulls, honeypots, scam tokens, exploits, prompt-injected agents, or any fraudulent activity that you authorize through the Platform, even if our safety checks failed to detect it.</p>
|
|
321
|
+
<p><strong>18a. Smart Contract & On-Chain Risk.</strong> The Platform interacts with third-party blockchain networks, decentralized protocols, smart contracts, and routers (including but not limited to Jupiter Aggregator, Raydium, Orca, Meteora, and other on-chain venues that an agent may select). We do not develop, audit, or control these smart contracts. Smart contracts may contain bugs, vulnerabilities, or exploits that could result in partial or total loss of funds. You acknowledge that interacting with on-chain protocols carries inherent risk, and SolPulse is not liable for any losses caused by smart contract failures, exploits, hacks, or vulnerabilities in third-party protocols, regardless of whether the transaction was initiated manually or via agent automation.</p>
|
|
322
|
+
<p><strong>Public & Permanent.</strong> Every transaction you submit through the Platform is broadcast to the relevant blockchain network and recorded on a public, immutable ledger. You acknowledge that your wallet address, counterparty addresses, transaction amounts, slippage tolerances, and timing metadata may be observed, indexed, copied, or exploited by any third party with access to the network, including searcher bots, MEV actors, block explorers, and analytics platforms. SolPulse cannot and does not guarantee the privacy, reversibility, or anonymity of any on-chain activity.</p>
|
|
323
|
+
|
|
324
|
+
<h3>19. Taxes & Recordkeeping</h3>
|
|
325
|
+
<p>You are solely responsible for all taxes, reporting, and recordkeeping related to your use of the Platform, including gains, losses, fees, and other taxable events. We do not provide tax advice. You should consult a qualified tax professional regarding your obligations.</p>
|
|
326
|
+
|
|
327
|
+
<h3>20. Service Availability, Maintenance & Incidents</h3>
|
|
328
|
+
<p>We may perform maintenance, upgrades, or changes that temporarily affect availability. We may also activate read-only or maintenance modes to preserve system integrity or comply with legal requirements. Status information may be communicated through in-app notices or external status pages. We are not liable for losses arising from downtime, maintenance windows, or incidents. Except as expressly agreed in writing, SolPulse has no obligation to provide support, bug fixes, updates, or customer service in connection with the Platform, and any assistance we do provide is on a best-effort, as-available basis.</p>
|
|
329
|
+
|
|
330
|
+
<h3>21. Beta / Experimental Features</h3>
|
|
331
|
+
<p>Certain features may be labeled beta or experimental. Such features may be incomplete, change without notice, or be withdrawn. They may have reduced reliability or performance. Your use of beta features is at your own risk and subject to these Terms.</p>
|
|
332
|
+
|
|
333
|
+
<h3>22. Account Deletion, Data Export & Retention</h3>
|
|
334
|
+
<p>Where provided, you may request deletion of any data we hold about you and export of certain data. Deletion requests may be subject to verification and limitations where retention is required by law, security, or dispute resolution. Additional details about retention periods and processing are described in our Privacy Policy.</p>
|
|
335
|
+
|
|
336
|
+
<h3>23. Changes to the Platform</h3>
|
|
337
|
+
<p>We may add, modify, or discontinue features, components, or access methods of the Platform at any time. Where changes materially affect any paid access, we will provide reasonable notice consistent with Section 4. We are not responsible for third-party withdrawals of service or feature changes outside our control.</p>
|
|
338
|
+
|
|
339
|
+
<h3>24. Third-Party Links</h3>
|
|
340
|
+
<p>The Platform may contain links to third-party websites or resources. We provide these links as a convenience and are not responsible for the content, products, or services on or available from those websites or resources. Accessing any third-party site is at your own risk and may be subject to separate terms and privacy policies established by those third parties.</p>
|
|
341
|
+
|
|
342
|
+
<h3>25. Export Controls & Sanctions</h3>
|
|
343
|
+
<p>You agree to comply with all applicable export control and economic sanctions laws and regulations, including those administered by the U.S. Department of the Treasury's Office of Foreign Assets Control (OFAC) and the U.S. Department of Commerce. You represent that you are not located in, under the control of, or a national or resident of any country or region subject to comprehensive sanctions, and that you are not identified on any government restricted party list. You will not use the Platform to transact with or benefit any such person, entity, country, or region.</p>
|
|
344
|
+
|
|
345
|
+
<h3>26. Geographic Restrictions & Prohibited Jurisdictions</h3>
|
|
346
|
+
<p>We may restrict access to the Platform where we believe it is necessary to comply with laws, regulations, or risk controls. We may employ geoblocking or other measures to prevent access from prohibited jurisdictions. You are responsible for ensuring that your use of the Platform is lawful in your location and for ceasing use if it becomes unlawful.</p>
|
|
347
|
+
|
|
348
|
+
<h3>27. Force Majeure</h3>
|
|
349
|
+
<p>We will not be liable for any delay or failure to perform resulting from causes beyond our reasonable control, including acts of God, natural disasters, war, terrorism, civil unrest, labor disputes, government actions, power or internet failures, failures of third-party service providers, or network/validator disruptions.</p>
|
|
350
|
+
|
|
351
|
+
<h3>28. Assignment; No Agency</h3>
|
|
352
|
+
<p>You may not assign or transfer any rights or obligations under these Terms without our prior written consent. We may assign these Terms without restriction. Nothing in these Terms shall be construed to create a partnership, joint venture, fiduciary, or agency relationship between you and SolPulse; neither party has authority to bind the other.</p>
|
|
353
|
+
|
|
354
|
+
<h3>29. Severability; Entire Agreement; Waiver; Interpretation</h3>
|
|
355
|
+
<p>If any provision of these Terms is held to be invalid or unenforceable, that provision will be enforced to the maximum extent permissible and the remaining provisions will remain in full force and effect. These Terms constitute the entire agreement between you and SolPulse regarding the Platform and supersede any prior or contemporaneous agreements on the same subject. No waiver of any provision shall be effective unless in writing and signed by the waiving party, and no waiver shall be deemed a waiver of any other provision or of the same provision on another occasion. Headings are for convenience only and do not affect interpretation.</p>
|
|
356
|
+
<p><strong>No Third-Party Beneficiaries.</strong> These Terms are solely for the benefit of you and SolPulse. Nothing in these Terms, express or implied, is intended to or shall confer upon any other person or entity any legal or equitable right, benefit, or remedy of any nature.</p>
|
|
357
|
+
|
|
358
|
+
<h3>30. Sanctions Screening</h3>
|
|
359
|
+
<p>Access to or use of the Platform may be restricted or prohibited in certain jurisdictions. You represent and warrant that you are not located in, organized under the laws of, or ordinarily resident in any jurisdiction subject to comprehensive sanctions, and that you are not listed on any government sanctions or restricted party list. You agree that you will not use the Platform to benefit any sanctioned person or jurisdiction or for any unlawful purpose. We may implement geoblocking, sanctions screening, and other compliance measures and may suspend or terminate access where we believe it is necessary to comply with law.</p>
|
|
360
|
+
|
|
361
|
+
<h3>31. No Offer; No Suitability Determination</h3>
|
|
362
|
+
<p>All content and functionality on the Platform are provided for informational and operational purposes only and do not constitute an offer, solicitation, recommendation, or endorsement of any digital asset, strategy, agent, or course of action. We do not assess the suitability of any action, asset, or strategy for you, and we do not provide investment, legal, tax, or accounting advice. You are solely responsible for your decisions and should obtain independent professional advice tailored to your circumstances.</p>
|
|
363
|
+
|
|
364
|
+
<h3>32. User-Directed Agents; No Discretion</h3>
|
|
365
|
+
<p>Any AI agents, LLMs, MCP servers, automation, schedulers, or "bots" connected to the Platform operate strictly according to the parameters you configure and authorize. The Platform does not exercise discretionary authority over your account, funds, or strategy. SolPulse does not owe you a fiduciary duty. We do not act as your agent, advisor, or fiduciary. All automation is user-directed and parameter-driven. You may stop or revoke any agent at any time, subject to on-chain conditions and network availability. Enabling automation or pre-authorized categories authorizes the Platform to prepare or submit transactions via your connected wallet pursuant to your parameters; you remain responsible for monitoring positions, risk, and outcomes.</p>
|
|
366
|
+
|
|
367
|
+
<h3>33. Protocol Changes, Forks, and Unsupported Assets</h3>
|
|
368
|
+
<p>Blockchain networks and protocols may change, fork, experience re-organizations, fee spikes, congestion, or failures. We do not control any blockchain and make no guarantees regarding network security, functionality, or availability. We may determine, in our sole discretion, how to respond to protocol changes (including whether to support particular forks, airdrops, or tokens) and have no obligation to support any asset or distribution. Because Agentic is non-custodial, we do not relay, distribute, or hold airdrops, forked assets, or protocol distributions on your behalf. You acknowledge you are not entitled to any forked assets, airdrops, or protocol distributions via the Platform unless we explicitly state otherwise.</p>
|
|
369
|
+
|
|
370
|
+
<h3>34. Third-Party Content, Data, and Links</h3>
|
|
371
|
+
<p>The Platform may display or rely on third-party information and services, including pricing, market data, routing, wallets, RPC, analytics, messaging, and external websites. We do not guarantee the accuracy, completeness, timeliness, reliability, or availability of any third-party content or services. Links to third-party sites are provided for convenience only, and your use of them is at your own risk and subject to their terms and policies.</p>
|
|
372
|
+
|
|
373
|
+
<h3>35. Security, Malicious Code, and Network Attacks</h3>
|
|
374
|
+
<p>You are solely responsible for securing your devices and accounts. We do not warrant that the Platform or any files or data available through it are free of viruses, worms, trojans, logic bombs, or other harmful components, or that services will be immune to denial-of-service or similar attacks. We are not liable for losses arising from such events. Use reputable security software and follow best practices when interacting with digital assets, wallets, and downloads.</p>
|
|
375
|
+
|
|
376
|
+
<h3>36. Availability; Internet, Devices & Support</h3>
|
|
377
|
+
<p>The Platform operates over the internet and mobile networks and may be affected by factors outside our control, including connectivity, device or operating system versions, and app store policies. We do not guarantee continuous, uninterrupted access, and we have no obligation to provide device-level or operating system support. We may update, modify, or suspend functionality from time to time to maintain security and performance. Tutorials, videos, FAQs, and helpdesk materials describe Platform functionality only and do not contain personalized advice or recommendations.</p>
|
|
378
|
+
|
|
379
|
+
<h3>37. Release of Claims</h3>
|
|
380
|
+
<p>To the fullest extent permitted by law, you hereby release and forever discharge SolPulse and its owners, directors, officers, employees, agents, successors, and assigns from any and all claims, demands, damages, losses, costs, and expenses (including attorneys' fees) of every kind and nature, known or unknown, arising out of or in any way connected with: (a) your transaction activity or financial decisions; (b) the performance or non-performance of any agent, strategy, or automation; (c) any interaction with third-party protocols, smart contracts, or decentralized exchanges; (d) the loss, theft, or unauthorized access to your wallet, private keys, or digital assets; (e) any token you interacted with that turned out to be fraudulent, a rug pull, or otherwise worthless; or (f) any other use of the Platform. If applicable law does not allow the release of unknown claims, you waive the protections of any statute or doctrine that limits the scope of a release to known claims.</p>
|
|
381
|
+
|
|
382
|
+
<h3>38. Acknowledgment</h3>
|
|
383
|
+
<p>By using the Platform, you acknowledge that you have read, understood, and agree to all of these Terms. You confirm that you are not relying on any representation or warranty not expressly set out in these Terms. You understand that cryptocurrency activity is speculative, that you may lose all funds, and that Agentic is a software tool — not a financial institution, broker, exchange, or advisor.</p>
|
|
384
|
+
</article>
|
|
385
|
+
</section>
|
|
386
|
+
`}function Xf(e){return`
|
|
387
|
+
<header class="homepage-nav" aria-label="Agentic navigation">
|
|
388
|
+
<a class="homepage-brand" href="/" aria-label="Agentic home" ${e==="/"?'aria-current="page"':""}>
|
|
389
|
+
${Co()}
|
|
390
|
+
<span>Agentic</span>
|
|
391
|
+
</a>
|
|
392
|
+
<nav class="homepage-links" aria-label="Primary navigation">
|
|
393
|
+
${$f.map(t=>eg(t,e)).join("")}
|
|
394
|
+
</nav>
|
|
395
|
+
</header>
|
|
396
|
+
`}function eg(e,t){const r=e.route===t,n=[e.pill?"nav-pill-link":"",e.route==="/app"?"launch-app-link":"",e.mobileHidden?"mobile-nav-hidden":"",e.mobileLabel?"has-mobile-label":""].filter(Boolean).join(" "),o=e.mobileLabel?`<span class="nav-label nav-label-full">${s(e.label)}</span><span class="nav-label nav-label-mobile">${s(e.mobileLabel)}</span>`:`<span class="nav-label">${s(e.label)}</span>`;return`
|
|
397
|
+
<a href="${s(e.route)}" class="${n}" ${r?'aria-current="page"':""}>
|
|
398
|
+
${o}
|
|
399
|
+
</a>
|
|
400
|
+
`}function tg(){return`
|
|
401
|
+
<section id="top" class="homepage-hero" aria-labelledby="hero-title">
|
|
402
|
+
<div class="hero-copy">
|
|
403
|
+
<div class="chain-strip" aria-label="Network and signing layer">
|
|
404
|
+
<span class="logo-chip solana-chip">${Fa("solana","logo-chip-icon")}<span>Solana</span></span>
|
|
405
|
+
<span class="logo-chip" aria-label="Wallet Standard">${Fa("solana","logo-chip-icon")}<span class="chip-label chip-label-full">Wallet Standard</span><span class="chip-label chip-label-mobile" aria-hidden="true">Wallet Std</span></span>
|
|
406
|
+
<span class="logo-chip" aria-label="Mobile Wallet Adapter">${Fa("solanaMobile","logo-chip-icon")}<span class="chip-label chip-label-full">Mobile Wallet Adapter</span><span class="chip-label chip-label-mobile" aria-hidden="true">MWA</span></span>
|
|
407
|
+
</div>
|
|
408
|
+
<p class="eyebrow mini">Wallet authority for agents</p>
|
|
409
|
+
<h1 id="hero-title">
|
|
410
|
+
<span>Let agents use your</span>
|
|
411
|
+
<span>Solana wallet</span>
|
|
412
|
+
<span>without giving</span>
|
|
413
|
+
<span>them one.</span>
|
|
414
|
+
</h1>
|
|
415
|
+
<p class="hero-lede">
|
|
416
|
+
<span>Agentic gives Claude, Codex, local MCP servers,</span>
|
|
417
|
+
<span>and app runtimes a single approval path</span>
|
|
418
|
+
<span>through the wallet you already trust.</span>
|
|
419
|
+
<span>Agents prepare the action;</span>
|
|
420
|
+
<span>your wallet remains the signer.</span>
|
|
421
|
+
</p>
|
|
422
|
+
<div class="hero-command-area">
|
|
423
|
+
${rg()}
|
|
424
|
+
<a class="button-link hero-app-link nav-pill-link launch-app-link mobile-redundant-nav" href="/app">Launch App</a>
|
|
425
|
+
<a class="button-link hero-demo-link mobile-redundant-nav" href="/demo">Launch Demo</a>
|
|
426
|
+
</div>
|
|
427
|
+
${cg()}
|
|
428
|
+
${dg()}
|
|
429
|
+
</div>
|
|
430
|
+
${sg()}
|
|
431
|
+
</section>
|
|
432
|
+
`}function rg(){const e=zn(),t=zg("hero",e),r=a.recentCopyId===t;return`
|
|
433
|
+
<div class="command-deck" aria-label="Runtime command deck">
|
|
434
|
+
<div class="command-deck-options" aria-label="Choose runtime path">
|
|
435
|
+
${Ka.map(ng).join("")}
|
|
436
|
+
</div>
|
|
437
|
+
<div class="command-readout ${r?"copied":""}">
|
|
438
|
+
${ag(e)}
|
|
439
|
+
<span class="command-status-pill">${s(e.badge)}</span>
|
|
440
|
+
${ig(e,t,r)}
|
|
441
|
+
</div>
|
|
442
|
+
</div>
|
|
443
|
+
`}function ag(e){return e.actionKind==="link"?`
|
|
444
|
+
<div class="command-readout-line link-readout">
|
|
445
|
+
<span class="command-prompt" aria-hidden="true">→</span>
|
|
446
|
+
<span class="readout-label">Download route</span>
|
|
447
|
+
<code>${s(e.href??e.command)}</code>
|
|
448
|
+
</div>
|
|
449
|
+
`:`
|
|
450
|
+
<div class="command-readout-line">
|
|
451
|
+
<span class="command-prompt" aria-hidden="true">$</span>
|
|
452
|
+
<code>${s(e.command)}</code>
|
|
453
|
+
<span class="command-caret" aria-hidden="true"></span>
|
|
454
|
+
</div>
|
|
455
|
+
`}function ng(e){const t=e.id===a.selectedRuntimePath;return`
|
|
456
|
+
<button
|
|
457
|
+
type="button"
|
|
458
|
+
class="command-path ${t?"active":""}"
|
|
459
|
+
data-runtime-path="${s(e.id)}"
|
|
460
|
+
aria-pressed="${t?"true":"false"}"
|
|
461
|
+
>
|
|
462
|
+
<span>${s(e.eyebrow)}</span>
|
|
463
|
+
<strong>${s(e.label)}</strong>
|
|
464
|
+
<small>${s(e.detail)}</small>
|
|
465
|
+
</button>
|
|
466
|
+
`}function ig(e,t,r){return e.actionKind==="link"?`
|
|
467
|
+
<a class="command-deck-action" href="${s(e.href??"/desktop")}">
|
|
468
|
+
${s(e.actionLabel)}
|
|
469
|
+
</a>
|
|
470
|
+
`:`
|
|
471
|
+
<button
|
|
472
|
+
class="command-copy-button ${r?"copied":""}"
|
|
473
|
+
data-copy="${s(e.command)}"
|
|
474
|
+
data-copy-id="${s(t)}"
|
|
475
|
+
data-copy-name="${s(e.copyName??e.label)}"
|
|
476
|
+
title="Copy command: ${s(e.command)}"
|
|
477
|
+
>
|
|
478
|
+
${r?"Copied":s(e.actionLabel)}
|
|
479
|
+
</button>
|
|
480
|
+
`}function vi(e,t){return`
|
|
481
|
+
<article class="browser-app-card">
|
|
482
|
+
<h3>${s(e)}</h3>
|
|
483
|
+
<p>${s(t)}</p>
|
|
484
|
+
</article>
|
|
485
|
+
`}function og(){return`
|
|
486
|
+
<section id="docs" class="docs-section" aria-labelledby="docs-title">
|
|
487
|
+
<div class="section-heading">
|
|
488
|
+
<!-- Docs eyebrow intentionally hidden. -->
|
|
489
|
+
<h2 id="docs-title">A local signing boundary for agent runtimes.</h2>
|
|
490
|
+
<p>
|
|
491
|
+
Render serves this website, but Agentic's bridge, CLI, and Desktop App run locally beside the user's wallet.
|
|
492
|
+
Android users can use the hosted app in mobile browser surfaces that support Mobile Wallet Adapter. Agents
|
|
493
|
+
can ask for signatures, swaps, transfers, receipts, and inbox approvals without receiving a seed phrase,
|
|
494
|
+
keypair file, or server-side private key.
|
|
495
|
+
</p>
|
|
496
|
+
</div>
|
|
497
|
+
<div class="docs-grid">
|
|
498
|
+
${bi("1. Launch the app","Use the hosted app and guided demo to see wallet discovery, connection, signing, and Mobile Wallet Adapter readiness.")}
|
|
499
|
+
${bi("2. Install a local runtime","Use the npm CLI, a standalone CLI binary, or the Desktop App when Codex, Claude, or an MCP client needs a persistent local bridge.")}
|
|
500
|
+
${bi("3. Let agents request approval","Claude, Codex, MCP clients, and framework adapters send bounded actions to the local bridge; the wallet still signs every request.")}
|
|
501
|
+
</div>
|
|
502
|
+
</section>
|
|
503
|
+
`}function bi(e,t){return`
|
|
504
|
+
<article class="docs-card">
|
|
505
|
+
<h3>${s(e)}</h3>
|
|
506
|
+
<p>${s(t)}</p>
|
|
507
|
+
</article>
|
|
508
|
+
`}function sg(){const e=zn(),t=Ql(e);return`
|
|
509
|
+
<aside class="hero-terminal" aria-label="Agentic terminal preview">
|
|
510
|
+
<div class="terminal-preview-window hero-terminal-window">
|
|
511
|
+
<div class="terminal-preview-bar">
|
|
512
|
+
<span></span>
|
|
513
|
+
<span></span>
|
|
514
|
+
<span></span>
|
|
515
|
+
<strong>agentic</strong>
|
|
516
|
+
</div>
|
|
517
|
+
<div class="terminal-preview-body">
|
|
518
|
+
${lg(e)}
|
|
519
|
+
<p class="${t.bridgeTone}">${s(t.bridgeLine)}</p>
|
|
520
|
+
<p class="${t.walletTone}">${s(t.walletLine)}</p>
|
|
521
|
+
<p><span>agent</span> prepare swap SOL to USDC</p>
|
|
522
|
+
<p><span>wallet</span> user approval required</p>
|
|
523
|
+
<p class="ok"><span>result</span> no private key handed to agent</p>
|
|
524
|
+
</div>
|
|
525
|
+
</div>
|
|
526
|
+
<div class="hero-proof-panel" aria-label="Authority model">
|
|
527
|
+
${wi("Agent requests","Intent, route, limits, and transaction bytes.")}
|
|
528
|
+
${wi("Wallet approves",a.address?_(a.address):"Existing user wallet signs.")}
|
|
529
|
+
${wi("Adapter records","Receipt, policy context, bridge state, and evidence receipts.")}
|
|
530
|
+
</div>
|
|
531
|
+
</aside>
|
|
532
|
+
`}function lg(e){return e.actionKind==="link"?`<p><span>route</span> ${s(e.href??e.terminalCommand)}</p>`:`<p><span>$</span> ${s(e.terminalCommand)}<i class="terminal-caret" aria-hidden="true"></i></p>`}function wi(e,t){return`
|
|
533
|
+
<div class="hero-proof">
|
|
534
|
+
<span>${s(e)}</span>
|
|
535
|
+
<strong>${s(t)}</strong>
|
|
536
|
+
</div>
|
|
537
|
+
`}function cg(){return`
|
|
538
|
+
<div class="integration-strip" aria-label="Agent runtimes">
|
|
539
|
+
${[{name:"Claude",logoId:"claude"},{name:"Codex",logoId:"codex"},{name:"MCP"},{name:"Vercel AI",logoId:"vercel"},{name:"Solana Agent Kit",logoId:"solana"}].map(t=>`
|
|
540
|
+
<span>
|
|
541
|
+
${t.logoId?Fa(t.logoId,"runtime-logo"):""}
|
|
542
|
+
<span>${s(t.name)}</span>
|
|
543
|
+
</span>
|
|
544
|
+
`).join("")}
|
|
545
|
+
</div>
|
|
546
|
+
`}function dg(){return`
|
|
547
|
+
<div class="wallet-chip-strip" aria-label="Supported wallet examples">
|
|
548
|
+
${[{name:"Phantom",logoId:"phantom"},{name:"Solflare",logoId:"solflare"},{name:"Backpack",logoId:"backpack"},{name:"Jupiter Mobile",logoId:"jupiter"},{name:"Seed Vault",logoId:"solanaMobile"}].map(t=>ug(t.name,t.logoId)).join("")}
|
|
549
|
+
<span class="wallet-chip standard-chip">
|
|
550
|
+
${Fa("solana","wallet-chip-icon")}
|
|
551
|
+
<span>Wallet Standard / MWA</span>
|
|
552
|
+
</span>
|
|
553
|
+
</div>
|
|
554
|
+
`}function ug(e,t){const r=On(e);return`
|
|
555
|
+
<span class="wallet-chip ${r?"detected":""}">
|
|
556
|
+
${Vl(r,ja(e),"wallet-chip-icon",t)}
|
|
557
|
+
<span>${s((r==null?void 0:r.name)??e)}</span>
|
|
558
|
+
</span>
|
|
559
|
+
`}function Hl(){return`
|
|
560
|
+
<section class="gap-section" aria-labelledby="gap-title">
|
|
561
|
+
<div class="gap-copy">
|
|
562
|
+
<p class="eyebrow mini">The gap</p>
|
|
563
|
+
<h2 id="gap-title">
|
|
564
|
+
<span>Solana agents need wallet approval.</span>
|
|
565
|
+
<span>Solana lacked a universal agent-to-wallet approval layer.</span>
|
|
566
|
+
</h2>
|
|
567
|
+
<p class="gap-risks">
|
|
568
|
+
Private keys inside agents are unsafe.<br>
|
|
569
|
+
Funded agent wallets fragment users.<br>
|
|
570
|
+
Single-wallet flows do not scale.
|
|
571
|
+
</p>
|
|
572
|
+
<p class="gap-accent">Agentic is the multi-wallet approval layer.</p>
|
|
573
|
+
<p class="gap-close">Agents prepare.<br><strong>Your wallet signs.</strong></p>
|
|
574
|
+
</div>
|
|
575
|
+
<div class="gap-body">
|
|
576
|
+
<div class="gap-proof-grid" aria-label="Current signing models">
|
|
577
|
+
${Si("Private-key MCP","SOLANA_PRIVATE_KEY=... makes the agent or server the signer.","Custody")}
|
|
578
|
+
${Si("Phantom MCP","Creates a new dedicated agent wallet, then asks the user to fund it.","Separate signer")}
|
|
579
|
+
${Si("Read-only / link MCP","Can quote or hand off to a product page, but has no reusable signing backend.","No generic signing")}
|
|
580
|
+
</div>
|
|
581
|
+
<p class="gap-answer">
|
|
582
|
+
Agentic routes each request to the user's existing Solana wallet: Phantom, Solflare, Backpack,
|
|
583
|
+
Seed Vault, Wallet Standard, MWA, and iOS wallet links. The agent gets the approved result,
|
|
584
|
+
never the key.
|
|
585
|
+
</p>
|
|
586
|
+
</div>
|
|
587
|
+
</section>
|
|
588
|
+
`}function zl(){return`
|
|
589
|
+
<section id="wallets" class="wallet-directory-section" aria-labelledby="wallet-directory-title">
|
|
590
|
+
<div class="section-heading">
|
|
591
|
+
<p class="eyebrow mini">Wallet directory</p>
|
|
592
|
+
<h2 id="wallet-directory-title">Use the wallet users already picked.</h2>
|
|
593
|
+
<p>
|
|
594
|
+
Agentic targets Solana wallet authority through Wallet Standard, Mobile Wallet Adapter, Seed Vault,
|
|
595
|
+
and compatible provider surfaces. Discovered wallets use their provider-supplied icons.
|
|
596
|
+
</p>
|
|
597
|
+
</div>
|
|
598
|
+
<div class="wallet-directory-grid">
|
|
599
|
+
${Hr("Phantom","Browser and mobile approvals through the user-owned Phantom signer.",["phantom"],"phantom")}
|
|
600
|
+
${Hr("Solflare","Wallet Standard signing without moving custody into an agent runtime.",["solflare"],"solflare")}
|
|
601
|
+
${Hr("Backpack","Installed wallet approval for agent-prepared messages and transactions.",["backpack"],"backpack")}
|
|
602
|
+
${Hr("Jupiter Mobile","Mobile approval path for swap-aware wallet flows and prepared actions.",["jupiter"],"jupiter")}
|
|
603
|
+
${Hr("Seed Vault","Android hardware-backed custody through Mobile Wallet Adapter surfaces.",["seed vault","seedvault"],"solanaMobile")}
|
|
604
|
+
${Hr("Wallet Standard / MWA","One adapter surface for browser wallets, Android MWA, and wallet in-app browsers.",["wallet standard","mobile wallet adapter","mwa"],"solana",!0)}
|
|
605
|
+
</div>
|
|
606
|
+
<div class="wallet-directory-action">
|
|
607
|
+
<button data-start-action="discover" class="${a.wallets.length?"":"primary"}" ${a.busy?"disabled":""}>
|
|
608
|
+
${a.wallets.length?"Refresh Wallet Directory":"Discover Wallets"}
|
|
609
|
+
</button>
|
|
610
|
+
<span>${a.wallets.length?`${a.wallets.length} provider(s) discovered in this browser.`:"Provider icons appear after discovery."}</span>
|
|
611
|
+
</div>
|
|
612
|
+
</section>
|
|
613
|
+
`}function Hr(e,t,r,n,o=!1){const c=r.map(On).find(m=>!!m),d=!!c;return`
|
|
614
|
+
<article class="wallet-directory-card ${d?"detected":""}">
|
|
615
|
+
<div class="wallet-directory-head">
|
|
616
|
+
${Vl(c,ja(e),"wallet-directory-icon",n)}
|
|
617
|
+
<div>
|
|
618
|
+
<h3>${s((c==null?void 0:c.name)??e)}</h3>
|
|
619
|
+
<span>${d?"Detected provider":o?"Adapter surface":"Supported path"}</span>
|
|
620
|
+
</div>
|
|
621
|
+
</div>
|
|
622
|
+
<p>${s(t)}</p>
|
|
623
|
+
</article>
|
|
624
|
+
`}function pg(){return`
|
|
625
|
+
<section id="cli" class="runtime-section cli-section" aria-labelledby="cli-title">
|
|
626
|
+
<div class="section-heading runtime-heading">
|
|
627
|
+
<!-- CLI eyebrow intentionally hidden. -->
|
|
628
|
+
<h2 id="cli-title">Install the local approval CLI.</h2>
|
|
629
|
+
<p>
|
|
630
|
+
The public CLI path is npm first, with standalone binaries for users who prefer a direct download.
|
|
631
|
+
The CLI starts the local bridge and wallet host; this website only copies commands or links releases.
|
|
632
|
+
</p>
|
|
633
|
+
</div>
|
|
634
|
+
<div class="runtime-grid">
|
|
635
|
+
<article class="runtime-card">
|
|
636
|
+
<span class="runtime-kicker">npm global</span>
|
|
637
|
+
<h3>Install once</h3>
|
|
638
|
+
<p>Install the command globally, then run <code>solana-agent-wallet app</code> from any terminal.</p>
|
|
639
|
+
${Ba("Global install",oa,"Copy command")}
|
|
640
|
+
</article>
|
|
641
|
+
<article class="runtime-card">
|
|
642
|
+
<span class="runtime-kicker">npm exec</span>
|
|
643
|
+
<h3>Run without installing</h3>
|
|
644
|
+
<p>Use npm's one-shot execution path to start the terminal approval app.</p>
|
|
645
|
+
${Ba("One-shot app",ct,"Copy command")}
|
|
646
|
+
</article>
|
|
647
|
+
</div>
|
|
648
|
+
<div class="download-section">
|
|
649
|
+
<div class="download-section-head">
|
|
650
|
+
<h3>Standalone CLI binaries</h3>
|
|
651
|
+
<a href="${wo}" target="_blank" rel="noreferrer">View all releases</a>
|
|
652
|
+
</div>
|
|
653
|
+
<div class="download-grid">
|
|
654
|
+
${kf.map(([e,t])=>ko(e,t,"CLI binary")).join("")}
|
|
655
|
+
</div>
|
|
656
|
+
</div>
|
|
657
|
+
</section>
|
|
658
|
+
`}function fg(){return`
|
|
659
|
+
<section id="desktop" class="desktop-section" aria-labelledby="desktop-title">
|
|
660
|
+
<div class="section-heading">
|
|
661
|
+
<!-- Desktop App eyebrow intentionally hidden. -->
|
|
662
|
+
<h2 id="desktop-title">Download the Agentic Desktop App.</h2>
|
|
663
|
+
<p>
|
|
664
|
+
The Desktop App is optional easy mode for the local bridge, Approval Inbox queue, logs, and diagnostics. Use it
|
|
665
|
+
when you want app controls instead of terminal commands. Browser extension wallets still approve every
|
|
666
|
+
signing request through the external wallet host.
|
|
667
|
+
</p>
|
|
668
|
+
</div>
|
|
669
|
+
<div class="download-grid desktop-download-grid">
|
|
670
|
+
${Pf.map(([e,t])=>ko(e,t,"Desktop installer")).join("")}
|
|
671
|
+
</div>
|
|
672
|
+
<p class="download-note">
|
|
673
|
+
Release artifacts are attached to GitHub Releases. If a platform build is not available yet, use the CLI install path above.
|
|
674
|
+
</p>
|
|
675
|
+
</section>
|
|
676
|
+
`}function gg(){return`
|
|
677
|
+
<section id="android" class="android-section" aria-labelledby="android-title">
|
|
678
|
+
<div class="section-heading">
|
|
679
|
+
<!-- Android eyebrow intentionally hidden. -->
|
|
680
|
+
<h2 id="android-title">Install the Agentic Android app.</h2>
|
|
681
|
+
<p>
|
|
682
|
+
The Android build is a Trusted Web Activity for the Render-hosted Agentic site. It keeps the browser-based
|
|
683
|
+
Solana Mobile Wallet Adapter path available without turning the app into a private-key custodian.
|
|
684
|
+
</p>
|
|
685
|
+
</div>
|
|
686
|
+
<div class="download-section">
|
|
687
|
+
<div class="download-section-head">
|
|
688
|
+
<h3>Android release artifacts</h3>
|
|
689
|
+
<a href="${wo}" target="_blank" rel="noreferrer">View all releases</a>
|
|
690
|
+
</div>
|
|
691
|
+
<div class="download-grid android-download-grid">
|
|
692
|
+
${Cf.map(([e,t])=>ko(e,t,e.includes("Bundle")?"Play release":"Android install")).join("")}
|
|
693
|
+
</div>
|
|
694
|
+
</div>
|
|
695
|
+
<p class="download-note">
|
|
696
|
+
Use the APK for direct install testing and the AAB for Play or managed release pipelines. Production trusted
|
|
697
|
+
mode requires the deployed site to serve Digital Asset Links for the signing certificate.
|
|
698
|
+
</p>
|
|
699
|
+
</section>
|
|
700
|
+
`}function mg(){return`
|
|
701
|
+
<section class="homepage-demo-cta" aria-labelledby="homepage-demo-title">
|
|
702
|
+
<div>
|
|
703
|
+
<p class="eyebrow mini">Approval workspace</p>
|
|
704
|
+
<h2 id="homepage-demo-title">Open the real wallet approval workspace.</h2>
|
|
705
|
+
<p>
|
|
706
|
+
Launch App opens the browser and mobile-web approval surface. The demo stays available when you want a guided
|
|
707
|
+
preview before connecting a wallet.
|
|
708
|
+
</p>
|
|
709
|
+
</div>
|
|
710
|
+
<div class="homepage-cta-actions">
|
|
711
|
+
<a class="button-link nav-pill-link launch-app-link mobile-redundant-nav" href="/app">Launch App</a>
|
|
712
|
+
<a class="button-link mobile-redundant-nav" href="/demo">Preview Demo</a>
|
|
713
|
+
</div>
|
|
714
|
+
</section>
|
|
715
|
+
`}function hg(){const e=xo();return`
|
|
716
|
+
<section id="demo-guide" class="guided-demo-page" aria-labelledby="guided-demo-title">
|
|
717
|
+
<div class="guided-demo-hero">
|
|
718
|
+
<div class="guided-demo-hero-copy">
|
|
719
|
+
<p class="eyebrow mini">Guided demo</p>
|
|
720
|
+
<h1 id="guided-demo-title">The agent prepares. You approve.</h1>
|
|
721
|
+
<p>
|
|
722
|
+
Pick a practical Solana request and watch Agentic turn it into a bounded wallet review. This demo
|
|
723
|
+
simulates the approval flow, does not move funds, and never asks you to start the local bridge.
|
|
724
|
+
</p>
|
|
725
|
+
</div>
|
|
726
|
+
<div class="guided-demo-trust-grid" aria-label="Demo safety model">
|
|
727
|
+
${Ai("No key handoff","The agent never receives your seed phrase, private key, or unlimited signer.")}
|
|
728
|
+
${Ai("Explicit approval","Prepared actions wait until the wallet owner approves or denies them.")}
|
|
729
|
+
${Ai("Receipt trail","Every demo decision ends with a receipt you can inspect or copy.")}
|
|
730
|
+
</div>
|
|
731
|
+
</div>
|
|
732
|
+
|
|
733
|
+
<div class="guided-demo-shell">
|
|
734
|
+
<aside class="guided-demo-scenarios" aria-label="Choose a demo scenario">
|
|
735
|
+
<div>
|
|
736
|
+
<p class="eyebrow mini">Use cases</p>
|
|
737
|
+
<h2>Start with a real request.</h2>
|
|
738
|
+
<p>These are the approval moments Agentic is built for: the agent drafts, the wallet decides.</p>
|
|
739
|
+
</div>
|
|
740
|
+
<div class="guided-demo-scenario-list">
|
|
741
|
+
${Wi.map(t=>yg(t)).join("")}
|
|
742
|
+
</div>
|
|
743
|
+
</aside>
|
|
744
|
+
|
|
745
|
+
<section class="guided-demo-runner" aria-label="Simulated approval walkthrough">
|
|
746
|
+
${vg()}
|
|
747
|
+
<div class="guided-demo-runner-body">
|
|
748
|
+
${bg(e)}
|
|
749
|
+
${wg(e)}
|
|
750
|
+
${Ag(e)}
|
|
751
|
+
${Sg(e)}
|
|
752
|
+
</div>
|
|
753
|
+
${$g()}
|
|
754
|
+
</section>
|
|
755
|
+
</div>
|
|
756
|
+
|
|
757
|
+
<div class="guided-demo-footer-cta">
|
|
758
|
+
<div>
|
|
759
|
+
<span>Ready for the real workspace?</span>
|
|
760
|
+
<strong>Create plans, connect optional AI, review inbox items, and keep signed receipts in /app.</strong>
|
|
761
|
+
</div>
|
|
762
|
+
<a class="button-link launch-app-link mobile-redundant-nav" href="/app">Launch full app</a>
|
|
763
|
+
<a class="button-link mobile-redundant-nav" href="/docs">Read docs</a>
|
|
764
|
+
</div>
|
|
765
|
+
</section>
|
|
766
|
+
`}function Ai(e,t){return`
|
|
767
|
+
<article class="guided-demo-trust-item">
|
|
768
|
+
<strong>${s(e)}</strong>
|
|
769
|
+
<p>${s(t)}</p>
|
|
770
|
+
</article>
|
|
771
|
+
`}function yg(e){const t=e.id===a.guidedDemo.selectedScenarioId;return`
|
|
772
|
+
<button
|
|
773
|
+
class="guided-demo-scenario-card ${t?"active":""}"
|
|
774
|
+
data-demo-scenario="${s(e.id)}"
|
|
775
|
+
aria-pressed="${t?"true":"false"}"
|
|
776
|
+
${a.busy?"disabled":""}
|
|
777
|
+
>
|
|
778
|
+
<span>${s(e.eyebrow)}</span>
|
|
779
|
+
<strong>${s(e.title)}</strong>
|
|
780
|
+
<em>${s(e.prompt)}</em>
|
|
781
|
+
</button>
|
|
782
|
+
`}function vg(){const e=a.guidedDemo.stage==="receipt",t=[{id:"request",label:"Request",detail:"Choose a use case"},{id:"prepared",label:"Prepared plan",detail:"Agent drafts limits"},{id:"queued",label:"Wallet review",detail:"Approve or deny"},{id:"receipt",label:e?"Demo complete":"Receipt",detail:e?"Receipt ready":"Decision recorded"}],r=Ui(a.guidedDemo.stage);return`
|
|
783
|
+
<div class="guided-demo-step-rail" aria-label="Demo progress">
|
|
784
|
+
${t.map((n,o)=>{const c=o<r||a.guidedDemo.stage==="receipt",d=o===r&&a.guidedDemo.stage!=="receipt";return`
|
|
785
|
+
<div class="guided-demo-step ${c?"complete":""} ${d?"active":""}">
|
|
786
|
+
<span>${o+1}</span>
|
|
787
|
+
<div>
|
|
788
|
+
<strong>${s(n.label)}</strong>
|
|
789
|
+
<p>${s(n.detail)}</p>
|
|
790
|
+
</div>
|
|
791
|
+
</div>
|
|
792
|
+
`}).join("")}
|
|
793
|
+
</div>
|
|
794
|
+
`}function bg(e){return`
|
|
795
|
+
<article class="guided-demo-request-card">
|
|
796
|
+
<div>
|
|
797
|
+
<span>User request</span>
|
|
798
|
+
<p>${s(e.prompt)}</p>
|
|
799
|
+
</div>
|
|
800
|
+
<strong>Simulation only</strong>
|
|
801
|
+
</article>
|
|
802
|
+
`}function wg(e){return Kl("prepared")?`
|
|
803
|
+
<article class="guided-demo-plan-card">
|
|
804
|
+
<div class="guided-demo-card-heading">
|
|
805
|
+
<span>Prepared plan</span>
|
|
806
|
+
<h3>${s(e.planTitle)}</h3>
|
|
807
|
+
<p>${s(e.detail)}</p>
|
|
808
|
+
</div>
|
|
809
|
+
<div class="guided-demo-fact-grid">
|
|
810
|
+
${e.facts.map(t=>_r(t.label,t.value)).join("")}
|
|
811
|
+
</div>
|
|
812
|
+
<div class="guided-demo-constraint-list">
|
|
813
|
+
<span>Approval constraints</span>
|
|
814
|
+
<ul>
|
|
815
|
+
${e.constraints.map(t=>`<li>${s(t)}</li>`).join("")}
|
|
816
|
+
</ul>
|
|
817
|
+
</div>
|
|
818
|
+
<div class="guided-demo-risk-note">
|
|
819
|
+
<span>Risk check</span>
|
|
820
|
+
<p>${s(e.risk)}</p>
|
|
821
|
+
</div>
|
|
822
|
+
</article>
|
|
823
|
+
`:`
|
|
824
|
+
<article class="guided-demo-placeholder">
|
|
825
|
+
<span>Next</span>
|
|
826
|
+
<h3>Prepare the request</h3>
|
|
827
|
+
<p>Click Prepare request to see the structured plan the agent would hand back for wallet review.</p>
|
|
828
|
+
</article>
|
|
829
|
+
`}function Ag(e){if(!Kl("queued"))return"";const t=a.guidedDemo.stage==="receipt",r=a.guidedDemo.decision==="approved",n=t?r?"Approved":"Denied":"Waiting for you";return`
|
|
830
|
+
<article class="guided-demo-review-card ${t?a.guidedDemo.decision:""}">
|
|
831
|
+
<div class="guided-demo-card-heading">
|
|
832
|
+
<span>Wallet review</span>
|
|
833
|
+
<h3>${s(n)}</h3>
|
|
834
|
+
<p>${s(e.approvalBoundary)}</p>
|
|
835
|
+
</div>
|
|
836
|
+
<div class="guided-demo-review-route">
|
|
837
|
+
${_r("Route",e.route)}
|
|
838
|
+
${_r("Signer",a.address?_(a.address):"Demo wallet")}
|
|
839
|
+
${_r("Result",t?n:"Pending decision")}
|
|
840
|
+
</div>
|
|
841
|
+
</article>
|
|
842
|
+
`}function Sg(e){if(a.guidedDemo.stage!=="receipt")return"";const t=!!a.guidedDemo.signedReceipt,r=a.guidedDemo.decision==="approved",n=r?"You approved the simulated wallet review.":"You denied the simulated wallet review.";return`
|
|
843
|
+
<article class="guided-demo-receipt-card ${a.guidedDemo.decision}">
|
|
844
|
+
<div class="guided-demo-card-heading">
|
|
845
|
+
<span>${s(r?"Approval receipt":"Denial receipt")}</span>
|
|
846
|
+
<h3>${s(e.receiptSummary)}</h3>
|
|
847
|
+
<p>This is demo output only. It shows the record a real approval flow would preserve for review.</p>
|
|
848
|
+
</div>
|
|
849
|
+
<div class="guided-demo-human-summary">
|
|
850
|
+
<span>Human-readable summary</span>
|
|
851
|
+
<p>${s(`${n} ${e.receiptSummary} No funds moved in this demo.`)}</p>
|
|
852
|
+
</div>
|
|
853
|
+
<div class="guided-demo-review-route">
|
|
854
|
+
${_r("Receipt",a.guidedDemo.receiptId||"demo")}
|
|
855
|
+
${_r("Created",Y(a.guidedDemo.receiptCreatedAt))}
|
|
856
|
+
${_r("Signature",t?_(a.guidedDemo.signedReceipt):"Optional")}
|
|
857
|
+
</div>
|
|
858
|
+
<details class="guided-demo-json">
|
|
859
|
+
<summary>Technical receipt JSON</summary>
|
|
860
|
+
<pre>${s(a.guidedDemo.receiptJson)}</pre>
|
|
861
|
+
</details>
|
|
862
|
+
</article>
|
|
863
|
+
`}function _r(e,t){return`
|
|
864
|
+
<div class="guided-demo-fact">
|
|
865
|
+
<span>${s(e)}</span>
|
|
866
|
+
<strong>${s(t)}</strong>
|
|
867
|
+
</div>
|
|
868
|
+
`}function $g(){const e=a.guidedDemo,t=a.busy?"disabled":"";return e.stage==="request"?`
|
|
869
|
+
<div class="guided-demo-actions">
|
|
870
|
+
<button class="primary" data-demo-action="prepare" ${t}>Prepare request</button>
|
|
871
|
+
</div>
|
|
872
|
+
`:e.stage==="prepared"?`
|
|
873
|
+
<div class="guided-demo-actions">
|
|
874
|
+
<button class="primary" data-demo-action="queue" ${t}>Move to wallet review</button>
|
|
875
|
+
<button data-demo-action="reset" ${t}>Reset demo</button>
|
|
876
|
+
</div>
|
|
877
|
+
`:e.stage==="queued"?`
|
|
878
|
+
<div class="guided-demo-actions">
|
|
879
|
+
<button class="primary" data-demo-action="approve" ${t}>Approve simulation</button>
|
|
880
|
+
<button data-demo-action="deny" ${t}>Deny simulation</button>
|
|
881
|
+
<button data-demo-action="reset" ${t}>Reset demo</button>
|
|
882
|
+
</div>
|
|
883
|
+
`:`
|
|
884
|
+
<div class="guided-demo-actions receipt-actions">
|
|
885
|
+
<button
|
|
886
|
+
data-copy="${s(e.receiptJson)}"
|
|
887
|
+
data-copy-name="Demo receipt JSON"
|
|
888
|
+
data-copy-toast="Demo receipt copied"
|
|
889
|
+
data-copy-message="Receipt JSON is on your clipboard."
|
|
890
|
+
${e.receiptJson?"":"disabled"}
|
|
891
|
+
>Copy receipt</button>
|
|
892
|
+
${a.address?`<button data-demo-action="sign-receipt" ${t||e.signedReceipt?"disabled":""}>${e.signedReceipt?"Receipt signed":"Sign demo receipt"}</button>`:'<span class="guided-demo-action-note">Real wallet signing happens in the full app. This demo never moves funds.</span>'}
|
|
893
|
+
<button data-demo-action="reset" ${t}>Reset demo</button>
|
|
894
|
+
<a class="button-link launch-app-link mobile-redundant-nav" href="/app">Try in full app</a>
|
|
895
|
+
</div>
|
|
896
|
+
`}function xo(){return Gl(a.guidedDemo.selectedScenarioId)}function Gl(e){return Wi.find(t=>t.id===e)??Wi[0]}function Ui(e){switch(e){case"request":return 0;case"prepared":return 1;case"queued":return 2;case"receipt":return 3}}function Kl(e){return Ui(a.guidedDemo.stage)>=Ui(e)}function xg(){var t;const e=!!((t=ns())!=null&&t.openMwaExample);return`
|
|
897
|
+
<section id="mwa-test" class="browser-app-section" aria-labelledby="mwa-test-title">
|
|
898
|
+
<div class="section-heading">
|
|
899
|
+
<p class="eyebrow mini">Android MWA</p>
|
|
900
|
+
<h2 id="mwa-test-title">Raw Mobile Wallet Adapter controls.</h2>
|
|
901
|
+
<p>
|
|
902
|
+
This tab is available only in Android builds with the example tab flag enabled. It opens the native MWA
|
|
903
|
+
tester for wallet connect, SIWS, message signing, transaction signing, bridge polling, and reset smokes.
|
|
904
|
+
</p>
|
|
905
|
+
</div>
|
|
906
|
+
<div class="browser-app-grid demo-guide-grid">
|
|
907
|
+
${vi("Native tester","Use the old Android MWA test surface without making it the app launcher.")}
|
|
908
|
+
${vi("Wallet handoff","Exercise Solana Mobile Wallet Adapter connect, reconnect, and signing paths.")}
|
|
909
|
+
${vi("Bridge smoke","Connect to the local Agentic bridge and resolve agent requests with a real wallet.")}
|
|
910
|
+
</div>
|
|
911
|
+
<div class="browser-app-actions">
|
|
912
|
+
<button id="openAndroidMwaTest" class="nav-pill-link" ${e?"":"disabled"}>
|
|
913
|
+
Open MWA
|
|
914
|
+
</button>
|
|
915
|
+
<a class="button-link" href="/app">Back to Launch App</a>
|
|
916
|
+
</div>
|
|
917
|
+
${e?"":'<p class="inline-status warning">MWA is only available inside the Android app build.</p>'}
|
|
918
|
+
</section>
|
|
919
|
+
`}function kg(){return`
|
|
920
|
+
<footer class="homepage-footer" aria-label="Agentic footer">
|
|
921
|
+
<div>
|
|
922
|
+
<span class="footer-brand">${Co("mini-mark")} Agentic</span>
|
|
923
|
+
<p>Render serves the web app and hosted BYOK AI proxy. CLI, Desktop App, local bridge, and wallet approvals run on your device.</p>
|
|
924
|
+
<p class="footer-contact">
|
|
925
|
+
<span>SolPulse LLC</span>
|
|
926
|
+
<a href="mailto:support@solpulse.trade">support@solpulse.trade</a>
|
|
927
|
+
</p>
|
|
928
|
+
</div>
|
|
929
|
+
<nav aria-label="Footer navigation">
|
|
930
|
+
<a href="/docs">Docs</a>
|
|
931
|
+
<a href="${wo}" target="_blank" rel="noreferrer">Releases</a>
|
|
932
|
+
<a href="/terms">Terms</a>
|
|
933
|
+
<a href="/privacy">Privacy</a>
|
|
934
|
+
</nav>
|
|
935
|
+
</footer>
|
|
936
|
+
`}function Pg(){return`
|
|
937
|
+
<section id="local-development" class="local-dev-section" aria-labelledby="local-dev-title">
|
|
938
|
+
<div class="section-heading">
|
|
939
|
+
<p class="eyebrow mini">Local repo development</p>
|
|
940
|
+
<h2 id="local-dev-title">Contributor commands stay separate from public install paths.</h2>
|
|
941
|
+
<p>
|
|
942
|
+
These commands are for developers running this monorepo locally. They are not required for public website visitors.
|
|
943
|
+
</p>
|
|
944
|
+
</div>
|
|
945
|
+
<div class="runtime-grid">
|
|
946
|
+
<article class="runtime-card">
|
|
947
|
+
<span class="runtime-kicker">Launch App</span>
|
|
948
|
+
<h3>Develop the hosted app</h3>
|
|
949
|
+
${Ba("Browser dev server","pnpm demo:browser","Copy command")}
|
|
950
|
+
</article>
|
|
951
|
+
<article class="runtime-card">
|
|
952
|
+
<span class="runtime-kicker">Repo fallback</span>
|
|
953
|
+
<h3>Run unreleased local runtimes</h3>
|
|
954
|
+
${Ba("Desktop App dev","pnpm desktop:dev","Copy command")}
|
|
955
|
+
${Ba("CLI from repo","pnpm cli -- app","Copy command")}
|
|
956
|
+
</article>
|
|
957
|
+
</div>
|
|
958
|
+
</section>
|
|
959
|
+
`}function ko(e,t,r){const n=`${bf}/${t}`;return`
|
|
960
|
+
<a
|
|
961
|
+
class="download-card"
|
|
962
|
+
href="${s(n)}"
|
|
963
|
+
target="_blank"
|
|
964
|
+
rel="noreferrer"
|
|
965
|
+
data-download-kind="${s(r)}"
|
|
966
|
+
data-download-platform="${s(e)}"
|
|
967
|
+
data-download-asset="${s(t)}"
|
|
968
|
+
>
|
|
969
|
+
<span>${s(r)}</span>
|
|
970
|
+
<strong>${s(e)}</strong>
|
|
971
|
+
<code>${s(t)}</code>
|
|
972
|
+
</a>
|
|
973
|
+
`}function Ba(e,t,r){const n=Gn("runtime",e,t),o=a.recentCopyId===n;return`
|
|
974
|
+
<div class="runtime-command-row ${o?"copied":""}">
|
|
975
|
+
<div>
|
|
976
|
+
<span>${s(e)}</span>
|
|
977
|
+
<code>${s(t)}</code>
|
|
978
|
+
</div>
|
|
979
|
+
<button
|
|
980
|
+
class="${o?"copied":""}"
|
|
981
|
+
data-copy="${s(t)}"
|
|
982
|
+
data-copy-id="${s(n)}"
|
|
983
|
+
data-copy-name="${s(e)}"
|
|
984
|
+
title="Copy command: ${s(t)}"
|
|
985
|
+
>
|
|
986
|
+
${o?"Copied":s(r)}
|
|
987
|
+
</button>
|
|
988
|
+
</div>
|
|
989
|
+
`}function Cg(e="app"){const t=Ee?"dev-app":"public-app",r=e==="demo"?"demo-workspace":"workspace",n=e==="demo"?"demo-workspace-title":"workspace-title";return`
|
|
990
|
+
<section id="${r}" class="app-workspace-section ${t} ${e==="demo"?"demo-workspace-mode":"launch-workspace-mode"}" aria-labelledby="${n}">
|
|
991
|
+
<div class="workspace-intro">
|
|
992
|
+
<div>
|
|
993
|
+
${e==="demo"?'<p class="eyebrow mini">Interactive demo</p>':"<!-- Launch App eyebrow intentionally hidden. -->"}
|
|
994
|
+
<h2 id="${n}">${e==="demo"?"Live approval demo.":"Agentic approval workspace."}</h2>
|
|
995
|
+
${e==="demo"?"":"<p>Draft agent actions, route approvals through your real wallet, and keep signed receipts in one place.</p>"}
|
|
996
|
+
</div>
|
|
997
|
+
${Ee?Ts():""}
|
|
998
|
+
</div>
|
|
999
|
+
${Ee?Dg():""}
|
|
1000
|
+
${Ee?`<header class="app-header command-bar">
|
|
1001
|
+
<div class="brand-lockup">
|
|
1002
|
+
<span class="brand-mark">${Co("mini-mark")}</span>
|
|
1003
|
+
<div>
|
|
1004
|
+
<p class="eyebrow mini">Solana Agent Wallet Adapter</p>
|
|
1005
|
+
<h1>Wallet approval workspace</h1>
|
|
1006
|
+
</div>
|
|
1007
|
+
</div>
|
|
1008
|
+
${Ts()}
|
|
1009
|
+
</header>`:""}
|
|
1010
|
+
|
|
1011
|
+
<section class="workspace ${Ee?"dev-workspace":"public-workspace"}">
|
|
1012
|
+
${Ng()}
|
|
1013
|
+
<section class="panel main-panel">
|
|
1014
|
+
<div class="surface-topbar">
|
|
1015
|
+
<div>
|
|
1016
|
+
<h2>${Tb()}</h2>
|
|
1017
|
+
</div>
|
|
1018
|
+
<nav class="nav-cluster tabs workspace-tabs" aria-label="Workspace navigation">
|
|
1019
|
+
|
|
1020
|
+
${Ua("agent","Create One-Time Plan","One-Time")}
|
|
1021
|
+
${Ua("schedule","Create Recurring Plan","Recurring")}
|
|
1022
|
+
${Ua("inbox","Approval Inbox","Inbox")}
|
|
1023
|
+
${Ua("completed","Completed Plans","Completed")}
|
|
1024
|
+
${Ua("labs","Receipt Proofs","Proofs")}
|
|
1025
|
+
</nav>
|
|
1026
|
+
</div>
|
|
1027
|
+
${Ee?"":Ig()}
|
|
1028
|
+
${Ee?"":Tg()}
|
|
1029
|
+
${Zg()}
|
|
1030
|
+
</section>
|
|
1031
|
+
${Ee?$h():xh()}
|
|
1032
|
+
</section>
|
|
1033
|
+
</section>
|
|
1034
|
+
`}function Tg(){const e=te();return`
|
|
1035
|
+
<section class="trust-layer-panel" aria-label="Agentic trust boundary">
|
|
1036
|
+
${[["No key custody","Wallet keeps private keys"],["No unlimited signer","Every action has a boundary"],["AI drafts only","Wallet decides approve or deny"],[e==="agentic-cloud"?"Cloud receipts":"Local receipts","Proofs persist after review"]].map(([r,n])=>`
|
|
1037
|
+
<div>
|
|
1038
|
+
<strong>${s(r)}</strong>
|
|
1039
|
+
<span>${s(n)}</span>
|
|
1040
|
+
</div>
|
|
1041
|
+
`).join("")}
|
|
1042
|
+
</section>
|
|
1043
|
+
`}function Ig(){const e=Yl(),t=_g(e),r=Lg(),n=Og(r.id),o=e.find(m=>m.active)??e[e.length-1],c=t?"Receipt saved":`Next: ${r.label}`,d=t?"Your latest approval proof or receipt is saved in Completed Plans.":r.detail;return`
|
|
1044
|
+
<section class="first-run-band ${t?"complete":""}" aria-label="First-time approval flow">
|
|
1045
|
+
<div class="first-run-copy">
|
|
1046
|
+
<span>First run</span>
|
|
1047
|
+
<h3>${s(c)}</h3>
|
|
1048
|
+
<p>${s(d)}</p>
|
|
1049
|
+
<small>Active workflow: ${s(Ve())}</small>
|
|
1050
|
+
</div>
|
|
1051
|
+
<div class="first-run-progress" role="list" aria-label="First-time progress">
|
|
1052
|
+
${e.map((m,A)=>Rg(m,A,o.id)).join("")}
|
|
1053
|
+
</div>
|
|
1054
|
+
<div class="first-run-actions">
|
|
1055
|
+
<button
|
|
1056
|
+
type="button"
|
|
1057
|
+
class="primary"
|
|
1058
|
+
data-first-run-action="${s(r.id)}"
|
|
1059
|
+
${r.disabled?"disabled":""}
|
|
1060
|
+
title="${s(r.detail)}"
|
|
1061
|
+
>
|
|
1062
|
+
${s(r.label)}
|
|
1063
|
+
</button>
|
|
1064
|
+
${n?`
|
|
1065
|
+
<button
|
|
1066
|
+
type="button"
|
|
1067
|
+
class="utility"
|
|
1068
|
+
data-first-run-action="${s(n.id)}"
|
|
1069
|
+
${n.disabled?"disabled":""}
|
|
1070
|
+
title="${s(n.detail)}"
|
|
1071
|
+
>
|
|
1072
|
+
${s(n.label)}
|
|
1073
|
+
</button>
|
|
1074
|
+
`:""}
|
|
1075
|
+
</div>
|
|
1076
|
+
</section>
|
|
1077
|
+
`}function Rg(e,t,r){return`
|
|
1078
|
+
<div
|
|
1079
|
+
class="first-run-step ${e.complete?"complete":e.id===r?"active":"idle"}"
|
|
1080
|
+
data-first-run-step="${s(e.id)}"
|
|
1081
|
+
role="listitem"
|
|
1082
|
+
aria-current="${e.id===r?"step":"false"}"
|
|
1083
|
+
title="${s(e.detail)}"
|
|
1084
|
+
>
|
|
1085
|
+
<span>${t+1}</span>
|
|
1086
|
+
<strong>${s(e.label)}</strong>
|
|
1087
|
+
<p>${s(e.detail)}</p>
|
|
1088
|
+
</div>
|
|
1089
|
+
`}function Yl(){const e=Po(),t=Eg(e);return[{id:"wallet",label:"Connect",detail:e.hasWallet?_(a.address):"Use your wallet signer.",complete:e.hasWallet},{id:"plan",label:"Create",detail:e.hasPlan?"Plan saved for review.":"Draft from template.",complete:e.hasPlan},{id:"review",label:"Review",detail:e.hasReview?"Wallet action is visible.":"Check route and limits.",complete:e.hasReview},{id:"decision",label:"Approve / Deny",detail:e.hasReceipt?"Decision recorded.":e.activeApprovalCount?"Inbox item waiting.":"Send to Inbox.",complete:e.hasReceipt},{id:"receipt",label:"Receipt",detail:e.hasReceipt?"Saved in history.":"Saved after decision.",complete:e.hasReceipt}].map(n=>({...n,active:n.id===t}))}function Po(){const e=pa(!0).filter(d=>d.status!=="archived"),t=Zn(),r=Dt().filter(d=>!d.archived&&es(d)).length,n=tr().length,o=e.some(Jn),c=!!(n>0||r>0||o||t&&Yn(t)&&a.oneTimePlanView==="review");return{hasWallet:!!a.address,hasPlan:!!(a.agentPlan||e.length>0||n>0||r>0),hasReview:c,hasReceipt:n>0,activeApprovalCount:r}}function Eg(e=Po()){return e.hasWallet?e.hasPlan?e.activeApprovalCount>0&&!e.hasReceipt?"decision":!e.hasReview||!e.hasReceipt?"review":"receipt":"plan":"wallet"}function _g(e=Yl()){return e.every(t=>t.complete)}function Lg(){const e=Po();if(!e.hasWallet){const t=a.androidNativeEnvironment.isAndroidNative||a.iosNativeEnvironment.isIosNative,r=ri();return t||a.wallets.length>0&&r?{id:"connect-wallet",label:"Connect wallet",detail:"Authorize Agentic in your wallet. This grants no spending authority."}:{id:"discover-wallets",label:"Discover wallets",detail:"Find installed Solana wallet providers in this browser."}}return e.hasPlan?e.activeApprovalCount>0&&!e.hasReceipt?{id:"open-inbox",label:"Open Approval Inbox",detail:"Approve or deny the queued request from your wallet boundary."}:e.hasReceipt?{id:"open-completed",label:"Open Completed Plans",detail:"Review saved receipts and decision proofs."}:{id:"open-review",label:"Review & Finish",detail:"Check the wallet action, route, limits, and destination before queueing."}:{id:"open-create-plan",label:"Open Create Plan",detail:"Use the default template path. AI setup is optional."}}function Og(e){return a.address&&e!=="cloud-sign-in"&&a.cloudSession.status==="signed-out"&&!Pt()?{id:"cloud-sign-in",label:"Sign in to Cloud",detail:"Optional sync for plans, approvals, recurring schedules, and receipts."}:null}function Si(e,t,r){return`
|
|
1090
|
+
<article class="gap-proof">
|
|
1091
|
+
<div class="gap-proof-header">
|
|
1092
|
+
<strong>${s(e)}</strong>
|
|
1093
|
+
<span>${s(r)}</span>
|
|
1094
|
+
</div>
|
|
1095
|
+
<p>${s(t)}</p>
|
|
1096
|
+
</article>
|
|
1097
|
+
`}function Co(e=""){const t=["agentic-mark",e].filter(Boolean).join(" ");return`
|
|
1098
|
+
<img class="${s(t)}" src="${s(Tf)}" alt="" aria-hidden="true" decoding="async" />
|
|
1099
|
+
`}function Fa(e,t){return`
|
|
1100
|
+
<span class="${s(t)} brand-logo" aria-hidden="true">
|
|
1101
|
+
<img src="${s(So[e])}" alt="" />
|
|
1102
|
+
</span>
|
|
1103
|
+
`}function Vl(e,t,r,n){const o=(e==null?void 0:e.icon)??(n?So[n]:void 0);return o?`
|
|
1104
|
+
<span class="${s(r)} wallet-provider-icon" aria-hidden="true">
|
|
1105
|
+
<img src="${s(o)}" alt="" />
|
|
1106
|
+
</span>
|
|
1107
|
+
`:`<span class="${s(r)} wallet-provider-fallback" aria-hidden="true">${s(t)}</span>`}function On(e){const t=e.toLowerCase();return a.wallets.find(r=>r.name.toLowerCase().includes(t))}function ja(e){return e.split(/[\s/-]+/).filter(Boolean).slice(0,2).map(t=>{var r;return((r=t[0])==null?void 0:r.toUpperCase())??""}).join("")}function $i(e){const t=e.toLowerCase();if(t.includes("backpack"))return"backpack";if(t.includes("phantom"))return"phantom";if(t.includes("solflare"))return"solflare";if(t.includes("jupiter"))return"jupiter"}function Dg(){const e=a.preparedActions.filter(t=>!Lt(t)).length;return`
|
|
1108
|
+
<section class="mission-strip">
|
|
1109
|
+
${wn("Wallet",a.address?_(a.address):"Not connected",a.address?"online":"")}
|
|
1110
|
+
${wn("Cluster",a.cluster,a.cluster==="mainnet-beta"?"warn":"")}
|
|
1111
|
+
${wn("Bridge",a.bridgeActive?"Ready":"Offline",a.bridgeActive?"online":"")}
|
|
1112
|
+
${wn("Approvals",`${e} queued`,e>0?"warn":"")}
|
|
1113
|
+
</section>
|
|
1114
|
+
`}function Ts(){const e=a.preparedActions.filter(t=>!Lt(t)).length;return`
|
|
1115
|
+
<div class="system-spine" aria-label="System status">
|
|
1116
|
+
${bn("Wallet",a.address?_(a.address):"Connect wallet",a.address?"online":"")}
|
|
1117
|
+
${bn("Network",ft(a.cluster),a.cluster==="mainnet-beta"?"warn":"")}
|
|
1118
|
+
${bn("Bridge",a.bridgeActive?"Ready":"Offline",a.bridgeActive?"online":"")}
|
|
1119
|
+
${bn("Queue",`${e}`,e>0?"warn":"")}
|
|
1120
|
+
</div>
|
|
1121
|
+
`}function bn(e,t,r=""){return`
|
|
1122
|
+
<div class="spine-node ${r}">
|
|
1123
|
+
<span>${s(e)}</span>
|
|
1124
|
+
<strong>${s(t)}</strong>
|
|
1125
|
+
</div>
|
|
1126
|
+
`}function wn(e,t,r=""){return`
|
|
1127
|
+
<div class="mission-metric ${r}">
|
|
1128
|
+
<span>${s(e)}</span>
|
|
1129
|
+
<strong>${s(t)}</strong>
|
|
1130
|
+
</div>
|
|
1131
|
+
`}function Ng(){const e=Ee&&!a.address,t=!Ee&&!a.address&&!a.androidNativeEnvironment.isAndroidNative&&!a.iosNativeEnvironment.isIosNative&&a.wallets.length>1,r=!Ee&&!a.address&&a.iosNativeEnvironment.isIosNative,n=Jv();return`
|
|
1132
|
+
<aside class="panel custody-panel custody-module">
|
|
1133
|
+
<div class="rail-heading custody-heading">
|
|
1134
|
+
${qg(n)}
|
|
1135
|
+
<div>
|
|
1136
|
+
<p class="eyebrow mini">Signer</p>
|
|
1137
|
+
<h2>${s(n.title)}</h2>
|
|
1138
|
+
</div>
|
|
1139
|
+
</div>
|
|
1140
|
+
|
|
1141
|
+
<div class="connection-summary custody-card">
|
|
1142
|
+
<span class="status-dot ${a.address?"online":""}"></span>
|
|
1143
|
+
<div>
|
|
1144
|
+
<strong>${s(n.summary)}</strong>
|
|
1145
|
+
<p>${s(n.detail)}</p>
|
|
1146
|
+
</div>
|
|
1147
|
+
</div>
|
|
1148
|
+
|
|
1149
|
+
${Ee&&a.address?`<button id="disconnect" class="text-button" ${a.busy?"disabled":""}>Disconnect wallet</button>`:""}
|
|
1150
|
+
${Ee?"":Bg()}
|
|
1151
|
+
|
|
1152
|
+
${t?`
|
|
1153
|
+
<details class="rail-details wallet-picker-details" open>
|
|
1154
|
+
<summary>Choose wallet</summary>
|
|
1155
|
+
<label class="field">
|
|
1156
|
+
<span>Selected wallet</span>
|
|
1157
|
+
<select id="walletSelect" ${a.busy?"disabled":""}>
|
|
1158
|
+
${sd()}
|
|
1159
|
+
</select>
|
|
1160
|
+
</label>
|
|
1161
|
+
</details>`:""}
|
|
1162
|
+
|
|
1163
|
+
${r?`
|
|
1164
|
+
<details class="rail-details wallet-picker-details" open>
|
|
1165
|
+
<summary>Choose iOS wallet</summary>
|
|
1166
|
+
<label class="field">
|
|
1167
|
+
<span>Selected wallet</span>
|
|
1168
|
+
<select id="iosWalletSelect" ${a.busy?"disabled":""}>
|
|
1169
|
+
${ld()}
|
|
1170
|
+
</select>
|
|
1171
|
+
</label>
|
|
1172
|
+
</details>`:""}
|
|
1173
|
+
|
|
1174
|
+
${Wg()}
|
|
1175
|
+
${$m("rail")}
|
|
1176
|
+
${Ee?"":Mg()}
|
|
1177
|
+
|
|
1178
|
+
${Ee?`
|
|
1179
|
+
<details class="rail-details developer-settings" ${e?"open":""}>
|
|
1180
|
+
<summary>Developer settings</summary>
|
|
1181
|
+
${Fg()}
|
|
1182
|
+
</details>`:""}
|
|
1183
|
+
|
|
1184
|
+
${Ee&&a.address?`
|
|
1185
|
+
<details class="rail-details bridge-details" ${a.bridgeActive?"open":""}>
|
|
1186
|
+
<summary>Bridge operations</summary>
|
|
1187
|
+
${jg()}
|
|
1188
|
+
</details>`:""}
|
|
1189
|
+
${Ee&&a.address?`
|
|
1190
|
+
<details class="rail-details">
|
|
1191
|
+
<summary>Environment</summary>
|
|
1192
|
+
${Zl()}
|
|
1193
|
+
</details>`:""}
|
|
1194
|
+
</aside>
|
|
1195
|
+
`}function Wg(){const e=te(),t=a.cloudSession.status==="signed-in",r=Pt(),n=Sy(),o=a.cloudSession.status==="unavailable",c=o?"Browser fallback":t?r?"Signed in":"Wallet mismatch":"Signed out",d=o?"Agentic Cloud is unavailable from this host, so browser workflow is active. No localhost or local bridge is required.":t?r?"One-time drafts, approvals, and completed history sync through Agentic Cloud.":`Signed in as ${_(a.cloudSession.walletAddress)}. Connect that wallet to use cloud workflow.`:"Signed-out workflow data stays in this browser on this device.";return`
|
|
1196
|
+
<section class="rail-cloud-card ${s(e)} ${t?"signed-in":""}" aria-label="Cloud workspace status">
|
|
1197
|
+
<div class="rail-cloud-head">
|
|
1198
|
+
<span>Cloud workspace</span>
|
|
1199
|
+
<strong>${s(c)}</strong>
|
|
1200
|
+
</div>
|
|
1201
|
+
<p>${s(d)}</p>
|
|
1202
|
+
<div class="rail-cloud-facts">
|
|
1203
|
+
<span>Active <strong>${s(Ve())}</strong></span>
|
|
1204
|
+
${r?`<span>Wallet <strong>${s(_(a.cloudSession.walletAddress))}</strong></span>`:""}
|
|
1205
|
+
${a.cloudLastSync&&r?`<span>Synced <strong>${s(Y(a.cloudLastSync))}</strong></span>`:""}
|
|
1206
|
+
</div>
|
|
1207
|
+
<div class="rail-cloud-actions">
|
|
1208
|
+
${t?`
|
|
1209
|
+
<button id="cloudLogout" class="utility" ${a.busy?"disabled":""}>Sign out</button>
|
|
1210
|
+
`:`
|
|
1211
|
+
<button id="cloudSignIn" class="primary" ${!a.address||a.busy||o?"disabled":""} title="${a.address?o?"Cloud APIs are unavailable from this host.":"Sign in with a wallet ownership proof.":"Connect a wallet before signing in."}">Sign in</button>
|
|
1212
|
+
`}
|
|
1213
|
+
</div>
|
|
1214
|
+
${n?'<p class="rail-cloud-warning">Cloud sessions prove wallet ownership only. They do not grant spending authority.</p>':""}
|
|
1215
|
+
</section>
|
|
1216
|
+
`}function Mg(){const e=a.bridgeActive,t=te()==="local-bridge",r=t?"online":e?"connected":a.busy?"checking":"offline",n=t?"Active":e?"Connected":a.busy?"Checking":"Offline",o=e?t?"Private local mode owns new workflow actions on this device.":"Bridge is connected. Select private local mode only when you want local-only workflow storage.":"Private local mode is optional. Start the local runtime only if you want local-only workflow storage.";return`
|
|
1217
|
+
<section class="rail-bridge-card ${r}" aria-label="Private local mode status">
|
|
1218
|
+
<div class="rail-bridge-head">
|
|
1219
|
+
<span>Private local mode</span>
|
|
1220
|
+
<strong>${s(n)}</strong>
|
|
1221
|
+
</div>
|
|
1222
|
+
<p>${s(o)}</p>
|
|
1223
|
+
${e?`
|
|
1224
|
+
<div class="rail-bridge-facts">
|
|
1225
|
+
<span>Endpoint <strong>${s(hr(a.bridgeUrl))}</strong></span>
|
|
1226
|
+
<span>Wallet <strong>${s(a.address?_(a.address):"Not connected")}</strong></span>
|
|
1227
|
+
</div>
|
|
1228
|
+
<div class="rail-bridge-actions">
|
|
1229
|
+
${t?`<button type="button" data-workflow-mode="auto" ${a.busy?"disabled":""}>Use cloud or browser</button>`:`<button type="button" class="utility" data-workflow-mode="local-bridge" ${!a.address||a.busy?"disabled":""}>Use private local mode</button>`}
|
|
1230
|
+
</div>
|
|
1231
|
+
`:`
|
|
1232
|
+
<div class="rail-bridge-actions">
|
|
1233
|
+
<button type="button" class="utility" data-bridge-action="connect" ${!a.address||a.busy?"disabled":""}>Check local bridge</button>
|
|
1234
|
+
${Ug()}
|
|
1235
|
+
</div>
|
|
1236
|
+
`}
|
|
1237
|
+
</section>
|
|
1238
|
+
`}function Ug(){return`
|
|
1239
|
+
<details class="bridge-setup-details optional-local-runtime">
|
|
1240
|
+
<summary>Use private local mode</summary>
|
|
1241
|
+
<div class="local-runtime-guide rail-runtime-guide optional-runtime-guide">
|
|
1242
|
+
<div class="local-runtime-guide-head">
|
|
1243
|
+
<span>Optional on this computer</span>
|
|
1244
|
+
<strong>${s(hr(a.bridgeUrl))}</strong>
|
|
1245
|
+
</div>
|
|
1246
|
+
<p>Use the local runtime only when you want workflow storage to stay on this machine. The normal web app can use Agentic Cloud or browser workflow without localhost.</p>
|
|
1247
|
+
<ol class="local-runtime-steps">
|
|
1248
|
+
<li>Run the one-shot command in Terminal.</li>
|
|
1249
|
+
<li>Connect the same wallet in the local browser tab.</li>
|
|
1250
|
+
<li>Return here and check the local bridge.</li>
|
|
1251
|
+
</ol>
|
|
1252
|
+
<div class="bridge-command-row primary-runtime-command">
|
|
1253
|
+
<code>${s(ct)}</code>
|
|
1254
|
+
<button type="button" data-copy="${s(ct)}" data-copy-name="local runtime command">Copy</button>
|
|
1255
|
+
</div>
|
|
1256
|
+
</div>
|
|
1257
|
+
</details>
|
|
1258
|
+
`}function qg(e){var r;const t=e.logoId?So[e.logoId]:(r=e.discoveredWallet)==null?void 0:r.icon;return t?`
|
|
1259
|
+
<span class="rail-icon wallet-provider-icon" aria-hidden="true">
|
|
1260
|
+
<img src="${s(t)}" alt="" />
|
|
1261
|
+
</span>
|
|
1262
|
+
`:`<span class="rail-icon" aria-hidden="true">${s(e.icon)}</span>`}function Bg(){const e=ri(),t=a.androidNativeEnvironment.isAndroidNative,r=a.iosNativeEnvironment.isIosNative,n=t||r;return a.address?`
|
|
1263
|
+
<div class="wallet-actions public-wallet-actions connected">
|
|
1264
|
+
<button id="disconnect" ${a.busy?"disabled":""}>Disconnect wallet</button>
|
|
1265
|
+
</div>
|
|
1266
|
+
`:n?`
|
|
1267
|
+
<div class="wallet-actions public-wallet-actions native-wallet-actions">
|
|
1268
|
+
<button data-start-action="connect" class="primary wallet-connect-cta" ${a.busy?"disabled":""}>
|
|
1269
|
+
${Jl()}
|
|
1270
|
+
<span>Connect wallet</span>
|
|
1271
|
+
</button>
|
|
1272
|
+
</div>
|
|
1273
|
+
`:`
|
|
1274
|
+
<div class="wallet-actions public-wallet-actions">
|
|
1275
|
+
<button data-start-action="discover" class="${a.wallets.length?"":"primary"}" ${a.busy?"disabled":""}>
|
|
1276
|
+
${a.wallets.length?"Refresh":"Discover"}
|
|
1277
|
+
</button>
|
|
1278
|
+
<button data-start-action="connect" class="${a.wallets.length?"primary":""}" ${a.wallets.length===0||!e||a.busy?"disabled":""} title="${e?"":"Discover and select a wallet provider first."}">
|
|
1279
|
+
Connect wallet
|
|
1280
|
+
</button>
|
|
1281
|
+
</div>
|
|
1282
|
+
`}function Jl(){return`
|
|
1283
|
+
<svg class="wallet-button-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
1284
|
+
<path d="M19 7h-1V6.5A2.5 2.5 0 0 0 15.5 4H5.75A3.75 3.75 0 0 0 2 7.75v8.5A3.75 3.75 0 0 0 5.75 20H19a3 3 0 0 0 3-3v-7a3 3 0 0 0-3-3Zm-3-1a.5.5 0 0 1 .5.5V7H5.75a1.25 1.25 0 0 1 0-2.5h9.75ZM20 17a1 1 0 0 1-1 1H5.75A1.75 1.75 0 0 1 4 16.25V8.76c.52.16 1.08.24 1.75.24H19a1 1 0 0 1 1 1v7Zm-4.5-4.5a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5Z"></path>
|
|
1285
|
+
</svg>
|
|
1286
|
+
`}function Fg(){const e=a.androidNativeEnvironment.isAndroidNative;return`
|
|
1287
|
+
<label class="field">
|
|
1288
|
+
<span>Cluster</span>
|
|
1289
|
+
<select id="clusterSelect" ${a.busy||a.bridgeActive?"disabled":""}>
|
|
1290
|
+
${df.map(t=>`<option value="${t}" ${t===a.cluster?"selected":""} ${e&&t==="localnet"?"disabled":""}>${t}</option>`).join("")}
|
|
1291
|
+
</select>
|
|
1292
|
+
</label>
|
|
1293
|
+
|
|
1294
|
+
${e?"":a.iosNativeEnvironment.isIosNative?`
|
|
1295
|
+
<label class="field">
|
|
1296
|
+
<span>iOS wallet</span>
|
|
1297
|
+
<select id="iosWalletSelect" ${a.busy?"disabled":""}>
|
|
1298
|
+
${ld()}
|
|
1299
|
+
</select>
|
|
1300
|
+
</label>`:`
|
|
1301
|
+
<label class="field">
|
|
1302
|
+
<span>Selected wallet</span>
|
|
1303
|
+
<select id="walletSelect" ${a.wallets.length===0||a.busy?"disabled":""}>
|
|
1304
|
+
${sd()}
|
|
1305
|
+
</select>
|
|
1306
|
+
</label>`}
|
|
1307
|
+
|
|
1308
|
+
${a.capabilities?Qv(a.capabilities):""}
|
|
1309
|
+
${e||a.iosNativeEnvironment.isIosNative?Zl():""}
|
|
1310
|
+
`}function Zl(){return a.androidNativeEnvironment.isAndroidNative?`
|
|
1311
|
+
<div class="mobile-wallet-box android-native-box">
|
|
1312
|
+
<h3>Android Native MWA</h3>
|
|
1313
|
+
<p>${s(a.androidNativeStatus)}</p>
|
|
1314
|
+
<div class="capabilities compact-caps">
|
|
1315
|
+
<span>Android app</span>
|
|
1316
|
+
<span>MWA picker</span>
|
|
1317
|
+
<span>${a.androidAuthCacheCount} cached</span>
|
|
1318
|
+
</div>
|
|
1319
|
+
<div class="bridge-actions ios-state-actions">
|
|
1320
|
+
<button id="androidReconnectCached" ${a.busy?"disabled":""}>Reconnect cached</button>
|
|
1321
|
+
<button id="androidClearTransient" ${a.busy?"disabled":""}>Clear transient</button>
|
|
1322
|
+
<button id="androidFullReset" ${a.busy?"disabled":""}>Full reset</button>
|
|
1323
|
+
<button id="androidClearAllAccounts" ${a.busy?"disabled":""}>Clear all accounts</button>
|
|
1324
|
+
</div>
|
|
1325
|
+
</div>
|
|
1326
|
+
`:a.iosNativeEnvironment.isIosNative?`
|
|
1327
|
+
<div class="mobile-wallet-box ios-native-box">
|
|
1328
|
+
<h3>iOS Wallet Runtime</h3>
|
|
1329
|
+
<p>${s(a.iosNativeStatus)}</p>
|
|
1330
|
+
<div class="capabilities compact-caps">
|
|
1331
|
+
<span>Capacitor iOS</span>
|
|
1332
|
+
<span>${s(cn(a.selectedIosWalletId))}</span>
|
|
1333
|
+
<span>${a.iosAuthCacheCount} cached</span>
|
|
1334
|
+
</div>
|
|
1335
|
+
<div class="bridge-actions ios-state-actions">
|
|
1336
|
+
<button id="iosReconnectCached" ${a.busy?"disabled":""}>Reconnect cached</button>
|
|
1337
|
+
<button id="iosClearTransient" ${a.busy?"disabled":""}>Clear transient</button>
|
|
1338
|
+
<button id="iosFullReset" ${a.busy?"disabled":""}>Full reset</button>
|
|
1339
|
+
<button id="iosClearAllAccounts" ${a.busy?"disabled":""}>Clear all accounts</button>
|
|
1340
|
+
</div>
|
|
1341
|
+
</div>
|
|
1342
|
+
`:`
|
|
1343
|
+
<div class="mobile-wallet-box">
|
|
1344
|
+
<h3>Android MWA</h3>
|
|
1345
|
+
<p>${s(Db())}</p>
|
|
1346
|
+
<div class="capabilities compact-caps">
|
|
1347
|
+
<span>${a.mwaEnvironment.isAndroid?"Android":"Desktop"}</span>
|
|
1348
|
+
<span>${a.mwaEnvironment.supportsMwaMobileWeb?"MWA ready":"Browser wallet"}</span>
|
|
1349
|
+
</div>
|
|
1350
|
+
</div>
|
|
1351
|
+
`}function jg(){const e=a.bridgeActive?"online":a.busy?"checking":"",t=a.bridgeActive?"Connected":a.busy?"Checking":"Offline",r=te()==="local-bridge";return`
|
|
1352
|
+
<div class="bridge-box bridge-ops-card">
|
|
1353
|
+
<div class="bridge-ops-head">
|
|
1354
|
+
<div>
|
|
1355
|
+
<span>Local bridge</span>
|
|
1356
|
+
<h3>Bridge host</h3>
|
|
1357
|
+
</div>
|
|
1358
|
+
<strong class="${e}">${s(t)}</strong>
|
|
1359
|
+
</div>
|
|
1360
|
+
<div class="bridge-endpoint">
|
|
1361
|
+
<span>Endpoint</span>
|
|
1362
|
+
<code>${s(hr(a.bridgeUrl))}</code>
|
|
1363
|
+
</div>
|
|
1364
|
+
<div class="bridge-actions bridge-primary-actions">
|
|
1365
|
+
${a.bridgeActive?"":`
|
|
1366
|
+
<button id="connectBridge" class="primary" ${!a.address||a.busy?"disabled":""}>
|
|
1367
|
+
Check local bridge
|
|
1368
|
+
</button>
|
|
1369
|
+
`}
|
|
1370
|
+
${a.bridgeActive?r?`<button data-workflow-mode="auto" ${a.busy?"disabled":""}>Use cloud/browser</button>`:`<button data-workflow-mode="local-bridge" class="utility" ${a.busy?"disabled":""}>Use private local mode</button>`:""}
|
|
1371
|
+
<button id="disconnectBridge" ${!a.bridgeActive||a.busy?"disabled":""}>Disconnect</button>
|
|
1372
|
+
</div>
|
|
1373
|
+
<p class="bridge-ops-status">${s(a.bridgeStatus)}</p>
|
|
1374
|
+
<div class="bridge-terminal-hint">
|
|
1375
|
+
<span>Start local runtime</span>
|
|
1376
|
+
<code>${ct}</code>
|
|
1377
|
+
<button data-copy="${ct}" data-copy-name="CLI one-shot command" title="Copy terminal command">Copy</button>
|
|
1378
|
+
<p>Run this in Terminal and keep that window open. Pressing Ctrl+C stops the bridge.</p>
|
|
1379
|
+
</div>
|
|
1380
|
+
<details class="bridge-advanced-settings">
|
|
1381
|
+
<summary>Advanced bridge settings</summary>
|
|
1382
|
+
<label class="field compact">
|
|
1383
|
+
<span>Bridge URL</span>
|
|
1384
|
+
<input id="bridgeUrl" value="${s(a.bridgeUrl)}" ${a.busy||a.bridgeActive?"disabled":""} />
|
|
1385
|
+
</label>
|
|
1386
|
+
<label class="field compact">
|
|
1387
|
+
<span>Bridge token</span>
|
|
1388
|
+
<input id="bridgeToken" value="${s(a.bridgeToken)}" ${a.busy||a.bridgeActive?"disabled":""} />
|
|
1389
|
+
</label>
|
|
1390
|
+
</details>
|
|
1391
|
+
</div>
|
|
1392
|
+
`}function hr(e){try{const t=new URL(e);return`${t.hostname}${t.port?`:${t.port}`:""}`}catch{return _(e)}}function Hn(e,t){const r=ri(),n=a.androidNativeEnvironment.isAndroidNative,o=a.iosNativeEnvironment.isIosNative,c=n||o,d=cn(a.selectedIosWalletId);return`
|
|
1393
|
+
<section class="guided-start signature-stage stage-dormant">
|
|
1394
|
+
<div class="guided-start-copy">
|
|
1395
|
+
<h2>${s(e)}</h2>
|
|
1396
|
+
<p>${s(t)}</p>
|
|
1397
|
+
</div>
|
|
1398
|
+
<div class="guided-path" aria-label="Wallet connection path">
|
|
1399
|
+
${xi("1",n?"Discover":o?"iOS paths":"Discover",n?"Open the Android MWA wallet picker":o?`${a.iosWallets.length} wallet path(s) ready`:a.wallets.length?`${a.wallets.length} provider(s) found`:"Find installed Wallet Standard providers",c||a.wallets.length>0)}
|
|
1400
|
+
${xi("2","Select",n?"Choose from the MWA picker":o?d:r||(a.wallets.length?"Choose a discovered provider":"Choose a wallet provider"),n||(o?!!d:!!r))}
|
|
1401
|
+
${xi("3","Connect","Authorize this app in the wallet",!!a.address)}
|
|
1402
|
+
</div>
|
|
1403
|
+
<div class="guided-actions">
|
|
1404
|
+
${c?`
|
|
1405
|
+
<button data-start-action="connect" class="primary wallet-connect-cta" ${a.busy?"disabled":""}>
|
|
1406
|
+
${Jl()}
|
|
1407
|
+
<span>Connect wallet</span>
|
|
1408
|
+
</button>`:`
|
|
1409
|
+
<button data-start-action="discover" class="${a.wallets.length?"":"primary"}" ${a.busy?"disabled":""}>Discover wallets</button>
|
|
1410
|
+
<button data-start-action="connect" class="${a.wallets.length?"primary":""}" ${a.wallets.length===0||!r||a.busy?"disabled":""} title="${r?"":"Discover and select a wallet provider first."}">Connect wallet</button>`}
|
|
1411
|
+
</div>
|
|
1412
|
+
<p class="guided-note">Approval Inbox, recurring plans, evidence receipts, and transaction tools unlock after a wallet is connected.</p>
|
|
1413
|
+
</section>
|
|
1414
|
+
`}function xi(e,t,r,n){return`
|
|
1415
|
+
<div class="guided-step ${n?"complete":""}">
|
|
1416
|
+
<span>${s(e)}</span>
|
|
1417
|
+
<div>
|
|
1418
|
+
<strong>${s(t)}</strong>
|
|
1419
|
+
<p>${s(r)}</p>
|
|
1420
|
+
</div>
|
|
1421
|
+
</div>
|
|
1422
|
+
`}function Is(){const e=zn(),t=e.actionKind==="copy"?e:Ka[0],r=Ql(t);return`
|
|
1423
|
+
<section class="terminal-try-panel" aria-label="Terminal app quick start">
|
|
1424
|
+
<div class="terminal-try-copy">
|
|
1425
|
+
<span class="workbench-kicker">Try it now</span>
|
|
1426
|
+
<h2>Run the approval terminal</h2>
|
|
1427
|
+
<p>Copy one command into Terminal. The terminal controls the bridge and approval queue; your browser wallet still signs every request.</p>
|
|
1428
|
+
<div class="terminal-command-list">
|
|
1429
|
+
${ki("One-shot CLI",ct,"No install")}
|
|
1430
|
+
${ki("Global install",oa,"Install")}
|
|
1431
|
+
${ki("Installed app",Ga,"After install")}
|
|
1432
|
+
</div>
|
|
1433
|
+
</div>
|
|
1434
|
+
<div class="terminal-preview-window">
|
|
1435
|
+
<div class="terminal-preview-bar">
|
|
1436
|
+
<span></span>
|
|
1437
|
+
<span></span>
|
|
1438
|
+
<span></span>
|
|
1439
|
+
<strong>terminal</strong>
|
|
1440
|
+
</div>
|
|
1441
|
+
<div class="terminal-preview-body">
|
|
1442
|
+
<p><span>$</span> ${s(t.terminalCommand)}<i class="terminal-caret" aria-hidden="true"></i></p>
|
|
1443
|
+
<p class="${r.bridgeTone}">${s(r.bridgeLine)}</p>
|
|
1444
|
+
<p class="${r.walletTone}">${s(r.walletLine)}</p>
|
|
1445
|
+
<p><span>sawa></span> /connect</p>
|
|
1446
|
+
<p><span>sawa></span> /inbox</p>
|
|
1447
|
+
</div>
|
|
1448
|
+
</div>
|
|
1449
|
+
</section>
|
|
1450
|
+
`}function ki(e,t,r){const n=Gn("terminal",e,t),o=a.recentCopyId===n;return`
|
|
1451
|
+
<div class="terminal-command-row ${o?"copied":""}">
|
|
1452
|
+
<div>
|
|
1453
|
+
<span>${s(e)}</span>
|
|
1454
|
+
<code>${s(t)}</code>
|
|
1455
|
+
</div>
|
|
1456
|
+
<strong>${s(r)}</strong>
|
|
1457
|
+
<button
|
|
1458
|
+
class="${o?"copied":""}"
|
|
1459
|
+
data-copy="${s(t)}"
|
|
1460
|
+
data-copy-id="${s(n)}"
|
|
1461
|
+
data-copy-name="${s(e)} command"
|
|
1462
|
+
title="Copy ${s(e)} command"
|
|
1463
|
+
>
|
|
1464
|
+
${o?"Copied":"Copy"}
|
|
1465
|
+
</button>
|
|
1466
|
+
</div>
|
|
1467
|
+
`}function Ql(e=zn()){return a.bridgeActive&&a.address?{bridgeLine:"Bridge connected",bridgeTone:"ok",walletLine:`Wallet ${_(a.address)} ready`,walletTone:"ok"}:a.address?{bridgeLine:"Bridge offline, terminal app can start it",bridgeTone:"warn",walletLine:`Wallet ${_(a.address)} connected in browser`,walletTone:"ok"}:{bridgeLine:e.bridgeLine,bridgeTone:"warn",walletLine:e.walletLine,walletTone:""}}function zn(){return Ka.find(e=>e.id===a.selectedRuntimePath)??Ka[0]}function Hg(e){return Ka.find(t=>t.id===e)}function zg(e,t){return Gn(e,t.label,t.command)}function Gn(e,t,r){return`${e}:${t}:${r}`}function Gg(e){a.recentCopyId=e,vn!==null&&window.clearTimeout(vn),vn=window.setTimeout(()=>{a.recentCopyId===e&&(a.recentCopyId="",vn=null,M())},1600)}function Kg(e){return`
|
|
1468
|
+
<div class="signature-lifecycle signature-trace" aria-label="Signature lifecycle">
|
|
1469
|
+
${e.map(([t,r,n])=>`
|
|
1470
|
+
<div class="trace-node ${n?"complete":""}">
|
|
1471
|
+
<span class="trace-dot"></span>
|
|
1472
|
+
<div>
|
|
1473
|
+
<strong>${s(t)}</strong>
|
|
1474
|
+
<p>${s(r)}</p>
|
|
1475
|
+
</div>
|
|
1476
|
+
</div>
|
|
1477
|
+
`).join("")}
|
|
1478
|
+
</div>
|
|
1479
|
+
`}function To(e,t){return`
|
|
1480
|
+
<div class="signature-placeholder">
|
|
1481
|
+
<span>${s(e)}</span>
|
|
1482
|
+
<p>${s(t)}</p>
|
|
1483
|
+
</div>
|
|
1484
|
+
`}function Xt(e){return e.actionType==="read_only"?"audit":Yg(e)?"queueable":"proof"}function Yg(e){return["transfer_sol","transfer_spl","swap","recurring_payment"].includes(e.actionType)}function Xl(e){return e.actionType==="read_only"?"audit":_t(e)?"queueable":"proof"}function ec(e){switch(e){case"queueable":return"Can queue to Approval Inbox";case"proof":return"Proof only";case"audit":return"Evidence only"}}function Io(e){switch(e){case"queueable":return"Queueable";case"proof":return"Proof only";case"audit":return"Evidence only"}}function Vg(e){const t=Xt(e);if(e.actionType==="recurring_payment")return"This creates a recurring schedule. Each due occurrence appears in Approval Inbox for approve or deny.";switch(t){case"queueable":return"This plan can become an Approval Inbox item. Signed-in users use Agentic Cloud; signed-out workflow stays in this browser.";case"proof":return"This can be signed as review evidence, but it cannot be queued as a transaction.";case"audit":return"This records context or analysis only. It does not queue a wallet action."}}function tc(e){return`outcome-${e}`}function rc(e){return e.actionType==="recurring_payment"?"Create recurring schedule":"Send to Approval Inbox"}function ac(e=a.templateOutcomeFilter){const t=nc();return e==="all"?t:t.filter(r=>Xt(r)===e)}function Jg(e){return ac(e)[0]??nc()[0]??En[0]}function nc(){return En.filter(e=>e.actionType!=="recurring_payment")}function Zg(){switch(a.activeTab){case"wallet":return Qg();case"agent":return Rs();case"generated":return a.activeTab="agent",a.oneTimePlanView="review",Rs();case"inbox":return jm();case"completed":return Hm();case"schedule":return rh();case"labs":return ah()}}function Qg(){if(!a.address)return`
|
|
1485
|
+
${Hn("Wallet signing","Connect a browser wallet to open signing requests, approvals, and receipts.")}
|
|
1486
|
+
${Ee?Is():""}
|
|
1487
|
+
`;const e=a.signature?"primary resolved":"primary",t=a.signature?"Signed":"Sign message",r=a.signature||!a.address||a.busy?"disabled":"",n=a.signature?"Wallet signature captured. Receipt is ready for audit.":a.transactionStatus||"Ready for wallet approval.";return`
|
|
1488
|
+
<section class="approval-object signature-stage stage-wallet ${a.signature?"stage-complete":"stage-active"}">
|
|
1489
|
+
<div class="signature-object-head">
|
|
1490
|
+
<div>
|
|
1491
|
+
<h2>Message approval</h2>
|
|
1492
|
+
<p>Wallet-held key approval for a bounded agent message on ${s(ft(a.cluster))}.</p>
|
|
1493
|
+
</div>
|
|
1494
|
+
<span class="signature-state ${a.signature?"complete":"active"}">${a.signature?"signed":"ready"}</span>
|
|
1495
|
+
</div>
|
|
1496
|
+
|
|
1497
|
+
<div class="signature-capsule">
|
|
1498
|
+
<div class="capsule-main">
|
|
1499
|
+
<span>Request</span>
|
|
1500
|
+
<strong>${s(bo)}</strong>
|
|
1501
|
+
<p>Signer: ${s(a.selectedWalletName||"Connected wallet")} • ${s(_(a.address))}</p>
|
|
1502
|
+
</div>
|
|
1503
|
+
<button id="signMessage" class="${e}" ${r}>${t}</button>
|
|
1504
|
+
</div>
|
|
1505
|
+
|
|
1506
|
+
${Kg([["Provider",a.wallets.length?`${a.wallets.length} discovered`:"Ready",!0],["Signer",_(a.address),!0],["Approval",a.signature?"Wallet signed":"Waiting for action",!!a.signature],["Receipt",a.txid||a.txSignature?"Available":"Pending",!!(a.txid||a.txSignature)]])}
|
|
1507
|
+
|
|
1508
|
+
${Ee?`<details class="advanced-section" ${a.customTransactionBase64||a.txSignature||a.txid?"open":""}>
|
|
1509
|
+
<summary>
|
|
1510
|
+
<span>Advanced transaction tools</span>
|
|
1511
|
+
<strong>${a.cluster==="devnet"?"Devnet memo test":"Paste transaction bytes"}</strong>
|
|
1512
|
+
</summary>
|
|
1513
|
+
<div class="transaction-actions">
|
|
1514
|
+
<div class="transaction-action-row">
|
|
1515
|
+
<button id="createTx" ${!a.address||a.busy||a.cluster!=="devnet"?"disabled":""}>Create demo transaction</button>
|
|
1516
|
+
<button id="signTx" ${!a.address||!a.customTransactionBase64||a.busy?"disabled":""}>Sign transaction</button>
|
|
1517
|
+
<button id="sendTx" ${Vv()?"":"disabled"}>Sign and send</button>
|
|
1518
|
+
</div>
|
|
1519
|
+
<label class="field compact transaction-field">
|
|
1520
|
+
<span>Transaction base64</span>
|
|
1521
|
+
<textarea id="txInput" placeholder="Create a demo transaction or paste a transaction, base64 encoded" ${a.busy?"disabled":""}>${s(a.customTransactionBase64)}</textarea>
|
|
1522
|
+
</label>
|
|
1523
|
+
</div>
|
|
1524
|
+
</details>`:""}
|
|
1525
|
+
|
|
1526
|
+
<div class="signature-floor">
|
|
1527
|
+
<div>
|
|
1528
|
+
<span>Status</span>
|
|
1529
|
+
<strong>${s(n)}</strong>
|
|
1530
|
+
</div>
|
|
1531
|
+
${Ee?`<button id="airdrop" class="utility" ${!a.address||a.busy||a.cluster!=="devnet"?"disabled":""}>
|
|
1532
|
+
Request devnet SOL
|
|
1533
|
+
</button>`:""}
|
|
1534
|
+
</div>
|
|
1535
|
+
|
|
1536
|
+
${eb()}
|
|
1537
|
+
${Ee?Is():""}
|
|
1538
|
+
${a.error?`<div class="error">${s(a.error)}</div>`:""}
|
|
1539
|
+
</section>
|
|
1540
|
+
`}function Rs(){const e=pa(!0).filter(Vn).length;return`
|
|
1541
|
+
<section class="approval-object signature-stage stage-agent ${a.agentSignature?"stage-complete":a.agentPlan?"stage-active":"stage-draft"}">
|
|
1542
|
+
<div class="signature-object-head">
|
|
1543
|
+
<div>
|
|
1544
|
+
<h2>Create one-time plan</h2>
|
|
1545
|
+
<p>Create a bounded draft, review it, then either sign proof or send it to wallet review.</p>
|
|
1546
|
+
</div>
|
|
1547
|
+
<span class="signature-state ${a.agentSignature?"complete":a.agentPlan?"active":""}">${a.oneTimePlanView==="review"?`${e} plan${e===1?"":"s"}`:"create plan"}</span>
|
|
1548
|
+
</div>
|
|
1549
|
+
|
|
1550
|
+
${Xg()}
|
|
1551
|
+
${a.oneTimePlanView==="review"?tm(!0):em()}
|
|
1552
|
+
${a.oneTimePlanView==="create"&&a.error?`<div class="error">${s(a.error)}</div>`:""}
|
|
1553
|
+
</section>
|
|
1554
|
+
`}function Xg(){return`
|
|
1555
|
+
<div class="tabs compact-tabs one-time-plan-tabs" role="tablist" aria-label="One-time plan steps">
|
|
1556
|
+
${Es("create","Create Plan")}
|
|
1557
|
+
${Es("review","Review & Finish")}
|
|
1558
|
+
</div>
|
|
1559
|
+
`}function Es(e,t){const r=a.oneTimePlanView===e;return`
|
|
1560
|
+
<button
|
|
1561
|
+
data-one-time-view="${e}"
|
|
1562
|
+
class="${r?"active":""}"
|
|
1563
|
+
role="tab"
|
|
1564
|
+
aria-selected="${r?"true":"false"}"
|
|
1565
|
+
type="button"
|
|
1566
|
+
${a.busy?"disabled":""}
|
|
1567
|
+
>
|
|
1568
|
+
${s(t)}
|
|
1569
|
+
</button>
|
|
1570
|
+
`}function em(){const e=!!a.address,t=pa(!0).length>0;return`
|
|
1571
|
+
<div class="one-time-create-panel">
|
|
1572
|
+
${wm()}
|
|
1573
|
+
${km()}
|
|
1574
|
+
|
|
1575
|
+
${To("Create a plan first","Choose a one-time template or connect AI. New plans move to Review & Finish before anything can enter Approval Inbox.")}
|
|
1576
|
+
${t?'<div class="notice">Existing one-time plans are available in Review & Finish.</div>':""}
|
|
1577
|
+
${e?"":'<div class="notice">You can create a plan without a wallet. Connect a wallet when you are ready to queue an approval or sign an optional review proof.</div>'}
|
|
1578
|
+
</div>
|
|
1579
|
+
`}function tm(e=!1){const t=pa(e),r=xc(e),n=t.filter($=>$.status==="archived").length,o=t.filter(Vn).length,c=t.filter(Jn).length,d=Wt(a.generatedPlanAuditId),m=d&&(!e||Yn(d))?d:void 0,A=`
|
|
1580
|
+
<div class="signature-object-head">
|
|
1581
|
+
<div>
|
|
1582
|
+
<h2>Review & finish</h2>
|
|
1583
|
+
<p>Saved one-time plans. Queue an executable plan when you want it to wait in Approval Inbox; finished plans move to Completed Plans.</p>
|
|
1584
|
+
</div>
|
|
1585
|
+
<div class="generated-plans-toolbar signature-toolbar">
|
|
1586
|
+
<span class="signature-state">${s(`${o} active`)}</span>
|
|
1587
|
+
<button
|
|
1588
|
+
data-one-time-view="create"
|
|
1589
|
+
class="utility"
|
|
1590
|
+
${a.busy?"disabled":""}
|
|
1591
|
+
>
|
|
1592
|
+
Create another plan
|
|
1593
|
+
</button>
|
|
1594
|
+
<button
|
|
1595
|
+
id="toggleArchivedGeneratedPlans"
|
|
1596
|
+
class="utility"
|
|
1597
|
+
${n===0?"disabled":""}
|
|
1598
|
+
>
|
|
1599
|
+
${a.showArchivedGeneratedPlans?"Hide archived":`Show archived (${n})`}
|
|
1600
|
+
</button>
|
|
1601
|
+
</div>
|
|
1602
|
+
</div>
|
|
1603
|
+
|
|
1604
|
+
${rm(t.length,r.length,n,c)}
|
|
1605
|
+
${r.length?`
|
|
1606
|
+
<div class="generated-plan-grid" aria-label="Review and finish plans">
|
|
1607
|
+
${r.map($=>am($)).join("")}
|
|
1608
|
+
</div>
|
|
1609
|
+
`:bm(e)}
|
|
1610
|
+
${a.error?`<div class="error">${s(a.error)}</div>`:""}
|
|
1611
|
+
`;return e?`
|
|
1612
|
+
<div class="one-time-review-panel stage-generated stage-anchor ${t.length?"stage-active":"stage-draft"}">
|
|
1613
|
+
${A}
|
|
1614
|
+
</div>
|
|
1615
|
+
${m?_s(m):""}
|
|
1616
|
+
`:`
|
|
1617
|
+
<section class="approval-object signature-stage stage-generated stage-anchor ${t.length?"stage-active":"stage-draft"}">
|
|
1618
|
+
${A}
|
|
1619
|
+
</section>
|
|
1620
|
+
${m?_s(m):""}
|
|
1621
|
+
`}function rm(e,t,r,n){return`
|
|
1622
|
+
<div class="queue-status generated-plan-status">
|
|
1623
|
+
<span>${s(`${e} plan${e===1?"":"s"} saved`)}</span>
|
|
1624
|
+
<strong>${t} in review</strong>
|
|
1625
|
+
<span>${n} moved forward</span>
|
|
1626
|
+
<span>${r} archived</span>
|
|
1627
|
+
<span>Newest first</span>
|
|
1628
|
+
</div>
|
|
1629
|
+
`}function am(e){const t=e.plan,r=td(e),n=e.status==="archived",o=!a.address||a.busy||n?"disabled":"",c=!a.address||!r||a.busy||n?"disabled":"",d=a.selectedGeneratedPlanId===e.id,m=t.safeguards.length+t.fields.length+(t.userNotes?1:0),A=Xl(t),$=mm(e);return`
|
|
1630
|
+
<article class="generated-plan-card ${d?"selected":""} ${n?"archived":""}">
|
|
1631
|
+
<div class="generated-plan-card-top">
|
|
1632
|
+
<span class="status-pill ${Cc(e)}">${s(Uo(e))}</span>
|
|
1633
|
+
<span>${s(Y(e.createdAt))}</span>
|
|
1634
|
+
</div>
|
|
1635
|
+
<div class="generated-plan-card-title">
|
|
1636
|
+
<span class="workbench-kicker">${s(e.source==="ai"?"AI plan":"Template plan")}</span>
|
|
1637
|
+
<h3 title="${s(t.intent)}">${s(t.intent)}</h3>
|
|
1638
|
+
</div>
|
|
1639
|
+
<div class="generated-plan-card-chips">
|
|
1640
|
+
<span title="${s(t.templateTitle)}">${s(t.templateTitle)}</span>
|
|
1641
|
+
<span>${s(ni(t.category))}</span>
|
|
1642
|
+
<span>${s(Io(A))}</span>
|
|
1643
|
+
</div>
|
|
1644
|
+
${oc(t)}
|
|
1645
|
+
<div class="generated-plan-quick-facts">
|
|
1646
|
+
${Qr("Network",ft(e.cluster))}
|
|
1647
|
+
${Qr("Wallet",e.walletAddress?_(e.walletAddress):"No wallet")}
|
|
1648
|
+
${Qr("Action",t.actionType.replace(/_/g," "))}
|
|
1649
|
+
</div>
|
|
1650
|
+
<div class="generated-plan-decision-grid">
|
|
1651
|
+
${nm(t).map(([R,F])=>im(R,F)).join("")}
|
|
1652
|
+
</div>
|
|
1653
|
+
${ic(e)}
|
|
1654
|
+
${fm(t,m)}
|
|
1655
|
+
${gm(e)}
|
|
1656
|
+
${$}
|
|
1657
|
+
<div class="generated-plan-card-actions">
|
|
1658
|
+
<button
|
|
1659
|
+
data-generated-plan-action="reuse"
|
|
1660
|
+
data-generated-plan-id="${s(e.id)}"
|
|
1661
|
+
${a.busy?"disabled":""}
|
|
1662
|
+
>
|
|
1663
|
+
Use as starting point
|
|
1664
|
+
</button>
|
|
1665
|
+
<button
|
|
1666
|
+
class="utility"
|
|
1667
|
+
data-generated-plan-action="sign-proof"
|
|
1668
|
+
data-generated-plan-id="${s(e.id)}"
|
|
1669
|
+
${o}
|
|
1670
|
+
title="${s(Tc(e))}"
|
|
1671
|
+
>
|
|
1672
|
+
Sign review proof
|
|
1673
|
+
</button>
|
|
1674
|
+
<button
|
|
1675
|
+
class="${r?"primary":"utility"}"
|
|
1676
|
+
data-generated-plan-action="queue"
|
|
1677
|
+
data-generated-plan-id="${s(e.id)}"
|
|
1678
|
+
${c}
|
|
1679
|
+
title="${s(Ic(e))}"
|
|
1680
|
+
>
|
|
1681
|
+
${s(rc(t))}
|
|
1682
|
+
</button>
|
|
1683
|
+
<button
|
|
1684
|
+
class="utility"
|
|
1685
|
+
data-generated-plan-action="view"
|
|
1686
|
+
data-generated-plan-id="${s(e.id)}"
|
|
1687
|
+
>
|
|
1688
|
+
Details
|
|
1689
|
+
</button>
|
|
1690
|
+
</div>
|
|
1691
|
+
<details class="generated-plan-more">
|
|
1692
|
+
<summary>More</summary>
|
|
1693
|
+
<div>
|
|
1694
|
+
<button
|
|
1695
|
+
class="utility"
|
|
1696
|
+
data-generated-plan-action="${n?"restore":"archive"}"
|
|
1697
|
+
data-generated-plan-id="${s(e.id)}"
|
|
1698
|
+
${a.busy?"disabled":""}
|
|
1699
|
+
>
|
|
1700
|
+
${n?"Restore":"Archive"}
|
|
1701
|
+
</button>
|
|
1702
|
+
<button
|
|
1703
|
+
class="utility danger"
|
|
1704
|
+
data-generated-plan-action="delete"
|
|
1705
|
+
data-generated-plan-id="${s(e.id)}"
|
|
1706
|
+
${a.busy?"disabled":""}
|
|
1707
|
+
>
|
|
1708
|
+
Delete
|
|
1709
|
+
</button>
|
|
1710
|
+
</div>
|
|
1711
|
+
</details>
|
|
1712
|
+
</article>
|
|
1713
|
+
`}function nm(e){const t=e.fields.find(r=>/policy|cap|limit/i.test(r.label)&&r.value.trim().length>0);return[["Risk",e.risk],["Approval",e.approval],t?[t.label,t.value]:["Route",e.route]]}function im(e,t){return`
|
|
1714
|
+
<div title="${s(t)}">
|
|
1715
|
+
<span>${s(e)}</span>
|
|
1716
|
+
<p>${s(t)}</p>
|
|
1717
|
+
</div>
|
|
1718
|
+
`}function ic(e){const t=[["Wallet action",sm(e.plan)],["Amount",lm(e.plan)],["Recipient / route",cm(e.plan)],["Destination",dm(e)],["Effect",pm(e)]];return`
|
|
1719
|
+
<section class="wallet-action-summary" aria-label="Wallet action summary">
|
|
1720
|
+
<div class="wallet-action-summary-head">
|
|
1721
|
+
<span>Wallet action</span>
|
|
1722
|
+
<strong>${s(_t(e.plan)?"Review before queueing":"Evidence only")}</strong>
|
|
1723
|
+
</div>
|
|
1724
|
+
<dl class="wallet-action-grid">
|
|
1725
|
+
${t.map(([r,n])=>Yt(r,n)).join("")}
|
|
1726
|
+
</dl>
|
|
1727
|
+
</section>
|
|
1728
|
+
`}function oc(e){const t=ya(e);if(!t)return"";const r=t.verdict==="block"?"block":t.verdict==="warn"?"warn":"pass",n=t.verdict==="block"?"Blocked":t.verdict==="warn"?"Warnings":"Passed";return`
|
|
1729
|
+
<section class="plan-guardrail-strip ${r}" aria-label="Plan guardrails">
|
|
1730
|
+
<div>
|
|
1731
|
+
<span>Guardrails</span>
|
|
1732
|
+
<strong>${s(n)}</strong>
|
|
1733
|
+
</div>
|
|
1734
|
+
<p>${s(t.summary)}</p>
|
|
1735
|
+
<dl>
|
|
1736
|
+
${Yt("Final step",om(t.finalizationRequirement))}
|
|
1737
|
+
${Yt(t.constraintHash?"Constraint hash":"Constraint fingerprint",t.constraintHash??t.constraintFingerprint)}
|
|
1738
|
+
</dl>
|
|
1739
|
+
</section>
|
|
1740
|
+
`}function om(e){switch(e){case"transaction_preview":return"Refresh quote, simulate, wallet approve, receipt";case"wallet_decision_proof":return"Wallet decision proof";case"none":return"No wallet action";default:return e.replace(/_/g," ")}}function sm(e){switch(e.actionType){case"transfer_sol":return"SOL transfer";case"transfer_spl":return"SPL token transfer";case"swap":return"Swap review";case"recurring_payment":return"Recurring schedule";case"read_only":return"Read-only review";case"manual_review":return"Review proof";default:return e.actionType.replace(/_/g," ")}}function lm(e){if(e.actionType==="swap"){const n=e.parameters.inputToken||St(e,["token"])||"Input token",o=e.parameters.outputToken||"Output token";return`${St(e,["amount","inputAmount","plannedAmount"])||"Amount"} ${n} -> ${o}`}const t=St(e,["amountSol","amount","plannedAmount","maxAmount"])||"n/a",r=St(e,["token","inputToken"])||(e.actionType==="transfer_sol"?"SOL":"");return r?`${t} ${r}`:t}function cm(e){const t=St(e,["recipient","recipientAddress","settlementWallet"]);return t?_(t):e.actionType==="swap"?`${e.parameters.inputToken||"input"} -> ${e.parameters.outputToken||"output"}`:e.route}function dm(e){return e.preparedActionId?um(e.workflowSource):Ve()}function um(e){switch(e){case"cloud":return"Agentic Cloud workspace";case"local-bridge":return"Private local mode";case"browser":return"Browser workflow";default:return Ve()}}function pm(e){const t=e.plan,r=ya(t);if((r==null?void 0:r.verdict)==="block")return"Blocked by guardrails. Recreate or edit the plan before queueing.";if(!_t(t))return"Signs review evidence only. No approval, transaction, or funds movement.";if(t.actionType==="recurring_payment")return"Creates a recurring schedule. Each occurrence still needs wallet review.";const n=e.workflowSource??(te()==="agentic-cloud"?"cloud":te()==="local-bridge"?"local-bridge":"browser");return n==="local-bridge"?"Queues a local prepared action. The wallet still approves the final request.":n==="cloud"?"Queues a cloud approval request. A later wallet proof records approve or deny.":"Queues a browser-local approval request. A later wallet proof records approve or deny."}function Qr(e,t){return`
|
|
1741
|
+
<div title="${s(t)}">
|
|
1742
|
+
<span>${s(e)}</span>
|
|
1743
|
+
<strong>${s(t)}</strong>
|
|
1744
|
+
</div>
|
|
1745
|
+
`}function fm(e,t){return t===0?"":`
|
|
1746
|
+
<details class="generated-plan-inline-details">
|
|
1747
|
+
<summary>${s(`${t} review details`)}</summary>
|
|
1748
|
+
<div>
|
|
1749
|
+
${e.userNotes?Pi("User notes",[e.userNotes]):""}
|
|
1750
|
+
${e.fields.length?Pi("Fields",e.fields.map(r=>`${r.label}: ${r.value}`)):""}
|
|
1751
|
+
${e.safeguards.length?Pi("Safeguards",e.safeguards):""}
|
|
1752
|
+
</div>
|
|
1753
|
+
</details>
|
|
1754
|
+
`}function Pi(e,t){return`
|
|
1755
|
+
<section>
|
|
1756
|
+
<span>${s(e)}</span>
|
|
1757
|
+
<ul>
|
|
1758
|
+
${t.map(r=>`<li>${s(r)}</li>`).join("")}
|
|
1759
|
+
</ul>
|
|
1760
|
+
</section>
|
|
1761
|
+
`}function gm(e){return!e.signature&&!e.preparedActionId?"":`
|
|
1762
|
+
<div class="generated-plan-outcomes">
|
|
1763
|
+
${e.signature?`<span title="${s(e.signature)}">Proof ${s(_(e.signature))}</span>`:""}
|
|
1764
|
+
${e.preparedActionId?`<span title="${s(e.preparedActionId)}">Queued ${s(_(e.preparedActionId))}</span>`:""}
|
|
1765
|
+
</div>
|
|
1766
|
+
`}function mm(e){if(e.status==="archived")return"";const t=ya(e.plan);if((t==null?void 0:t.verdict)==="block")return`<p class="generated-plan-action-helper danger">${s(t.summary)}</p>`;if(!a.address)return'<p class="generated-plan-action-helper">Connect a wallet to sign a review proof or send this plan to Approval Inbox.</p>';const r=te();return _t(e.plan)&&r==="agentic-cloud"?'<p class="generated-plan-action-helper">Signed in: this will use Agentic Cloud and still require wallet approval.</p>':_t(e.plan)&&r==="browser-workflow"?'<p class="generated-plan-action-helper">Signed out: this will use browser workflow storage local to this device.</p>':_t(e.plan)?"":'<p class="generated-plan-action-helper">Review-only plan: sign a proof to complete it. It will not enter Approval Inbox.</p>'}function hm(e=""){return`
|
|
1767
|
+
<div class="local-runtime-guide ${s(e)}">
|
|
1768
|
+
<div class="local-runtime-guide-head">
|
|
1769
|
+
<span>Required on this computer</span>
|
|
1770
|
+
<strong>${s(hr(a.bridgeUrl))}</strong>
|
|
1771
|
+
</div>
|
|
1772
|
+
<p>This website cannot start the approval bridge directly. Start the local runtime, keep that terminal window open, then return here and click Check local bridge.</p>
|
|
1773
|
+
<ol class="local-runtime-steps">
|
|
1774
|
+
<li>Copy and run the one-shot command in Terminal.</li>
|
|
1775
|
+
<li>Connect your wallet in the browser tab it opens.</li>
|
|
1776
|
+
<li>Come back here and check the local bridge.</li>
|
|
1777
|
+
</ol>
|
|
1778
|
+
<div class="bridge-command-row primary-runtime-command">
|
|
1779
|
+
<code>${s(ct)}</code>
|
|
1780
|
+
<button type="button" data-copy="${s(ct)}" data-copy-name="local runtime command">Copy</button>
|
|
1781
|
+
</div>
|
|
1782
|
+
<details class="local-runtime-alt">
|
|
1783
|
+
<summary>Install once or use Desktop App</summary>
|
|
1784
|
+
<div class="local-runtime-alt-body">
|
|
1785
|
+
<div class="bridge-command-row">
|
|
1786
|
+
<code>${s(oa)}</code>
|
|
1787
|
+
<button type="button" data-copy="${s(oa)}" data-copy-name="CLI install command">Copy</button>
|
|
1788
|
+
</div>
|
|
1789
|
+
<div class="bridge-command-row">
|
|
1790
|
+
<code>${s(Ga)}</code>
|
|
1791
|
+
<button type="button" data-copy="${s(Ga)}" data-copy-name="installed CLI command">Copy</button>
|
|
1792
|
+
</div>
|
|
1793
|
+
<a class="button-link local-runtime-desktop-link" href="/desktop">Desktop App downloads</a>
|
|
1794
|
+
</div>
|
|
1795
|
+
</details>
|
|
1796
|
+
</div>
|
|
1797
|
+
`}function _s(e){const t=e.plan,r=td(e);return`
|
|
1798
|
+
<div class="generated-plan-modal-backdrop" role="presentation">
|
|
1799
|
+
<section class="generated-plan-modal" role="dialog" aria-modal="true" aria-labelledby="generated-plan-audit-title">
|
|
1800
|
+
<div class="generated-plan-modal-head">
|
|
1801
|
+
<div>
|
|
1802
|
+
<span class="workbench-kicker">${s(e.source==="ai"?"AI plan details":"Template plan details")}</span>
|
|
1803
|
+
<h2 id="generated-plan-audit-title">${s(t.intent)}</h2>
|
|
1804
|
+
<p>${s(fy(e))}</p>
|
|
1805
|
+
</div>
|
|
1806
|
+
<button class="utility" data-generated-plan-modal-close aria-label="Close plan details">Close</button>
|
|
1807
|
+
</div>
|
|
1808
|
+
<div class="generated-plan-modal-actions">
|
|
1809
|
+
<button
|
|
1810
|
+
data-generated-plan-action="reuse"
|
|
1811
|
+
data-generated-plan-id="${s(e.id)}"
|
|
1812
|
+
${a.busy?"disabled":""}
|
|
1813
|
+
>
|
|
1814
|
+
Use as starting point
|
|
1815
|
+
</button>
|
|
1816
|
+
<button
|
|
1817
|
+
class="utility"
|
|
1818
|
+
data-generated-plan-action="sign-proof"
|
|
1819
|
+
data-generated-plan-id="${s(e.id)}"
|
|
1820
|
+
${!a.address||a.busy||e.status==="archived"?"disabled":""}
|
|
1821
|
+
title="${s(Tc(e))}"
|
|
1822
|
+
>
|
|
1823
|
+
Sign review proof
|
|
1824
|
+
</button>
|
|
1825
|
+
<button
|
|
1826
|
+
class="${r?"primary":"utility"}"
|
|
1827
|
+
data-generated-plan-action="queue"
|
|
1828
|
+
data-generated-plan-id="${s(e.id)}"
|
|
1829
|
+
${!a.address||!r||a.busy||e.status==="archived"?"disabled":""}
|
|
1830
|
+
title="${s(Ic(e))}"
|
|
1831
|
+
>
|
|
1832
|
+
${s(rc(t))}
|
|
1833
|
+
</button>
|
|
1834
|
+
</div>
|
|
1835
|
+
<div class="generated-plan-audit-body">
|
|
1836
|
+
<section class="generated-plan-audit-section">
|
|
1837
|
+
<div class="generated-plan-audit-section-head">
|
|
1838
|
+
<h3>Decision</h3>
|
|
1839
|
+
<span class="status-pill ${Cc(e)}">${s(Uo(e))}</span>
|
|
1840
|
+
</div>
|
|
1841
|
+
<dl class="generated-plan-audit-grid">
|
|
1842
|
+
${Tr("Route",t.route)}
|
|
1843
|
+
${Tr("Risk",t.risk)}
|
|
1844
|
+
${Tr("Approval",t.approval)}
|
|
1845
|
+
</dl>
|
|
1846
|
+
${ic(e)}
|
|
1847
|
+
${oc(t)}
|
|
1848
|
+
</section>
|
|
1849
|
+
<section class="generated-plan-audit-section">
|
|
1850
|
+
<div class="generated-plan-audit-section-head">
|
|
1851
|
+
<h3>Plan facts</h3>
|
|
1852
|
+
</div>
|
|
1853
|
+
<dl class="generated-plan-audit-grid compact">
|
|
1854
|
+
${tb(t).map(([n,o])=>Tr(n,o)).join("")}
|
|
1855
|
+
${Tr("Created",Y(e.createdAt))}
|
|
1856
|
+
${Tr("Updated",Y(e.updatedAt))}
|
|
1857
|
+
${Tr("Outcome",ec(Xl(t)))}
|
|
1858
|
+
</dl>
|
|
1859
|
+
</section>
|
|
1860
|
+
${t.userNotes?ym("User notes",t.userNotes):""}
|
|
1861
|
+
${t.fields.length?Ls("Fields",t.fields.map(n=>`${n.label}: ${n.value}`)):""}
|
|
1862
|
+
${t.safeguards.length?Ls("Safeguards",t.safeguards):""}
|
|
1863
|
+
${vm(e)}
|
|
1864
|
+
</div>
|
|
1865
|
+
</section>
|
|
1866
|
+
</div>
|
|
1867
|
+
`}function Tr(e,t){return`
|
|
1868
|
+
<div>
|
|
1869
|
+
<dt>${s(e)}</dt>
|
|
1870
|
+
<dd>${s(t)}</dd>
|
|
1871
|
+
</div>
|
|
1872
|
+
`}function ym(e,t){return`
|
|
1873
|
+
<section class="generated-plan-audit-section">
|
|
1874
|
+
<div class="generated-plan-audit-section-head">
|
|
1875
|
+
<h3>${s(e)}</h3>
|
|
1876
|
+
</div>
|
|
1877
|
+
<p>${s(t)}</p>
|
|
1878
|
+
</section>
|
|
1879
|
+
`}function Ls(e,t){return`
|
|
1880
|
+
<section class="generated-plan-audit-section">
|
|
1881
|
+
<div class="generated-plan-audit-section-head">
|
|
1882
|
+
<h3>${s(e)}</h3>
|
|
1883
|
+
</div>
|
|
1884
|
+
<ul>
|
|
1885
|
+
${t.map(r=>`<li>${s(r)}</li>`).join("")}
|
|
1886
|
+
</ul>
|
|
1887
|
+
</section>
|
|
1888
|
+
`}function vm(e){return!e.signature&&!e.preparedActionId?'<div class="empty">Review proof signatures and queued approval ids appear here after action.</div>':`
|
|
1889
|
+
<div class="results generated-plan-results">
|
|
1890
|
+
${e.signature?`
|
|
1891
|
+
<div class="result-row">
|
|
1892
|
+
<span>Review proof</span>
|
|
1893
|
+
<code>${s(e.signature)}</code>
|
|
1894
|
+
<button data-copy="${s(e.signature)}" data-copy-name="Review proof">Copy</button>
|
|
1895
|
+
</div>
|
|
1896
|
+
`:""}
|
|
1897
|
+
${e.preparedActionId?`
|
|
1898
|
+
<div class="result-row">
|
|
1899
|
+
<span>Queued approval / recurring schedule</span>
|
|
1900
|
+
<code>${s(e.preparedActionId)}</code>
|
|
1901
|
+
<button data-copy="${s(e.preparedActionId)}" data-copy-name="Queued approval id">Copy</button>
|
|
1902
|
+
</div>
|
|
1903
|
+
`:""}
|
|
1904
|
+
</div>
|
|
1905
|
+
`}function bm(e=!1){const t=pa(e),r=t.filter(Vn).length,n=t.filter(Jn).length,o=t.filter(d=>d.status==="archived").length,c=t.length===0?"Create a plan from Create Plan. It stays here for review, then moves to Approval Inbox or Completed Plans.":r===0&&n>0?"All active plans have moved forward. Open Approval Inbox for queued work or Completed Plans for signed proofs and receipts.":o>0?"Archived plans are hidden. Show archived to inspect or restore them.":"Create another plan or check Approval Inbox and Completed Plans for work that already moved forward.";return To("No plans visible",c)}function wm(){const e=ha(),t=ed(e),r=gc(),n=Kn(),o=a.activeOperation==="generate-template-plan",c=a.activeOperation==="generate-ai-plan",d=Xt(e),m=t?"Custom request / notes":r?"Notes / AI instructions":"Notes for review record",A=t?"Describe what you want prepared or reviewed.":r?"Optional context, reason, policy note, or AI instruction for this plan.":"Optional context, reason, or policy note saved with this plan.";return`
|
|
1906
|
+
<div class="agent-planner-grid planner-single-column">
|
|
1907
|
+
<div class="intent-capsule intent-document-card planner-card ${a.agentPlan?"plan-linked":"draft"}">
|
|
1908
|
+
<div class="intent-document-head">
|
|
1909
|
+
<div>
|
|
1910
|
+
<span>Plan method</span>
|
|
1911
|
+
<h3>${s(e.title)}</h3>
|
|
1912
|
+
</div>
|
|
1913
|
+
<strong class="template-outcome-badge ${s(tc(d))}">${s(Io(d))}</strong>
|
|
1914
|
+
</div>
|
|
1915
|
+
${Am()}
|
|
1916
|
+
<div class="field compact planner-template-select">
|
|
1917
|
+
<span id="templatePickerLabel">Plan template</span>
|
|
1918
|
+
${Pm(e)}
|
|
1919
|
+
</div>
|
|
1920
|
+
${Sm(e)}
|
|
1921
|
+
<p class="template-description">${s(e.description)}</p>
|
|
1922
|
+
<div class="planner-fields">
|
|
1923
|
+
${e.fields.map(Tm).join("")}
|
|
1924
|
+
</div>
|
|
1925
|
+
<label class="intent-document planner-prompt">
|
|
1926
|
+
<span>${m}${t?" *":""}</span>
|
|
1927
|
+
<textarea id="agentPrompt" placeholder="${s(A)}" ${a.busy?"disabled":""}>${s(a.agentPrompt)}</textarea>
|
|
1928
|
+
${nn("__notes")}
|
|
1929
|
+
</label>
|
|
1930
|
+
<div class="intent-policy-strip">
|
|
1931
|
+
<span>Where this goes</span>
|
|
1932
|
+
<p>Plans are saved in Review & Finish. Queueable plans enter Approval Inbox only after you choose to queue them; finished plans appear in Completed Plans.</p>
|
|
1933
|
+
</div>
|
|
1934
|
+
<div class="agent-actions signature-actions intent-document-actions">
|
|
1935
|
+
<button id="generatePlan" class="primary" ${a.busy?"disabled":""}>${o?`${io()}Creating...`:"Create plan from template"}</button>
|
|
1936
|
+
<button id="generateAiPlan" class="${r?"primary":""}" ${!r||a.busy?"disabled":""} title="${s(r?"Create through your configured AI planner.":n)}">${c?`${io()}Creating...`:"Create plan with AI"}</button>
|
|
1937
|
+
</div>
|
|
1938
|
+
</div>
|
|
1939
|
+
</div>
|
|
1940
|
+
`}function Am(){return`
|
|
1941
|
+
<div class="template-filter-row" role="group" aria-label="Template outcome filter">
|
|
1942
|
+
${[["queueable","Queueable"],["proof","Proof only"],["audit","Evidence only"],["all","All"]].map(([t,r])=>`
|
|
1943
|
+
<button
|
|
1944
|
+
type="button"
|
|
1945
|
+
data-template-filter="${s(t)}"
|
|
1946
|
+
class="${a.templateOutcomeFilter===t?"active":""}"
|
|
1947
|
+
${a.busy?"disabled":""}
|
|
1948
|
+
>
|
|
1949
|
+
${s(r)}
|
|
1950
|
+
</button>
|
|
1951
|
+
`).join("")}
|
|
1952
|
+
</div>
|
|
1953
|
+
`}function Sm(e){const t=Xt(e);return`
|
|
1954
|
+
<div class="template-outcome-summary ${s(tc(t))}">
|
|
1955
|
+
<strong>${s(ec(t))}</strong>
|
|
1956
|
+
<p>${s(Vg(e))}</p>
|
|
1957
|
+
</div>
|
|
1958
|
+
`}function $m(e="planner"){const t=Lo(),r=Eo(),o=a.aiSettingsPanelOpen??(t&&!xm())?"open":"",c=mc(a.aiStatus),d=e==="rail"?t?`${c} - ${Dn()}`:"Plan drafting optional":t?`${c} - ${Dn()}`:"Optional AI planner; templates work without it.";return`
|
|
1959
|
+
<details class="ai-settings-panel ${t?"configured":"optional"} ${e==="rail"?"rail-ai-settings":""}" ${o}>
|
|
1960
|
+
<summary>
|
|
1961
|
+
<span class="ai-summary-copy">
|
|
1962
|
+
<span>AI Planner</span>
|
|
1963
|
+
<em>${s(d)}</em>
|
|
1964
|
+
</span>
|
|
1965
|
+
<strong>${r?"confirmed":t?"configured":"not configured"}</strong>
|
|
1966
|
+
</summary>
|
|
1967
|
+
${Im()}
|
|
1968
|
+
</details>
|
|
1969
|
+
`}function xm(){return window.matchMedia("(max-width: 700px)").matches}function km(){return`
|
|
1970
|
+
<aside class="agent-route-strip" aria-label="One-time plan route">
|
|
1971
|
+
${An("1","Create plan","Template or AI drafts a bounded request.")}
|
|
1972
|
+
${An("2","Review & Finish","Check limits, risk, route, and approval rule.")}
|
|
1973
|
+
${An("3","Send or sign","Send queueable work to Inbox or sign proof only.")}
|
|
1974
|
+
${An("4","Completed","Receipts and proofs stay in history.")}
|
|
1975
|
+
</aside>
|
|
1976
|
+
`}function An(e,t,r){return`
|
|
1977
|
+
<div>
|
|
1978
|
+
<span>${s(e)}</span>
|
|
1979
|
+
<strong>${s(t)}</strong>
|
|
1980
|
+
<p>${s(r)}</p>
|
|
1981
|
+
</div>
|
|
1982
|
+
`}function Pm(e){const t=sc(e),r=ac(),n=[["queueable","Can queue to Approval Inbox"],["proof","Proof only"],["audit","Evidence only"]];return`
|
|
1983
|
+
<div class="template-picker" data-template-picker>
|
|
1984
|
+
<button
|
|
1985
|
+
id="templatePickerButton"
|
|
1986
|
+
class="template-picker-trigger"
|
|
1987
|
+
type="button"
|
|
1988
|
+
aria-haspopup="listbox"
|
|
1989
|
+
aria-expanded="false"
|
|
1990
|
+
aria-labelledby="templatePickerLabel templatePickerValue"
|
|
1991
|
+
${a.busy?"disabled":""}
|
|
1992
|
+
>
|
|
1993
|
+
<span class="template-picker-current">
|
|
1994
|
+
<span class="template-picker-category">${s(ni(e.category))}</span>
|
|
1995
|
+
<strong id="templatePickerValue">${s(e.title)}</strong>
|
|
1996
|
+
</span>
|
|
1997
|
+
<span class="template-picker-caret" aria-hidden="true"></span>
|
|
1998
|
+
</button>
|
|
1999
|
+
<div
|
|
2000
|
+
id="templatePickerMenu"
|
|
2001
|
+
class="template-picker-menu"
|
|
2002
|
+
role="listbox"
|
|
2003
|
+
aria-labelledby="templatePickerLabel"
|
|
2004
|
+
hidden
|
|
2005
|
+
>
|
|
2006
|
+
${n.map(([o,c])=>{const d=r.filter(m=>Xt(m)===o);return d.length===0?"":`
|
|
2007
|
+
<div class="template-picker-group" role="presentation">
|
|
2008
|
+
<span>${s(c)}</span>
|
|
2009
|
+
${d.map(m=>Cm(m,e)).join("")}
|
|
2010
|
+
</div>
|
|
2011
|
+
`}).join("")}
|
|
2012
|
+
</div>
|
|
2013
|
+
<span class="template-picker-sr">${s(t)}</span>
|
|
2014
|
+
</div>
|
|
2015
|
+
`}function sc(e){return`${ni(e.category)} - ${e.title}`}function Cm(e,t){const r=e.id===t.id,n=Xt(e);return`
|
|
2016
|
+
<button
|
|
2017
|
+
id="template-option-${s(e.id)}"
|
|
2018
|
+
class="template-picker-option ${r?"selected":""}"
|
|
2019
|
+
type="button"
|
|
2020
|
+
role="option"
|
|
2021
|
+
aria-selected="${r?"true":"false"}"
|
|
2022
|
+
data-template-option="${s(e.id)}"
|
|
2023
|
+
title="${s(sc(e))}"
|
|
2024
|
+
>
|
|
2025
|
+
<span>${s(ni(e.category))} / ${s(Io(n))}</span>
|
|
2026
|
+
<strong>${s(e.title)}</strong>
|
|
2027
|
+
<em>${s(e.description)}</em>
|
|
2028
|
+
</button>
|
|
2029
|
+
`}function Tm(e){var c;const t=Cv(e.id),r=a.busy?"disabled":"",n=`${e.label}${e.required?" *":""}`,o=nn(e.id);return e.type==="textarea"||e.id==="policy"?`
|
|
2030
|
+
<label class="field compact planner-field ${a.templateFieldErrors[e.id]?"field-error":""}">
|
|
2031
|
+
<span>${s(n)}</span>
|
|
2032
|
+
<textarea data-template-field="${s(e.id)}" placeholder="${s(e.placeholder??"")}" ${r}>${s(t)}</textarea>
|
|
2033
|
+
${o}
|
|
2034
|
+
</label>
|
|
2035
|
+
`:e.type==="select"&&((c=e.options)!=null&&c.length)?`
|
|
2036
|
+
<label class="field compact planner-field ${a.templateFieldErrors[e.id]?"field-error":""}">
|
|
2037
|
+
<span>${s(n)}</span>
|
|
2038
|
+
<select data-template-field="${s(e.id)}" ${r}>
|
|
2039
|
+
${e.options.map(d=>`<option value="${s(d)}" ${d===t?"selected":""}>${s(d)}</option>`).join("")}
|
|
2040
|
+
</select>
|
|
2041
|
+
${o}
|
|
2042
|
+
</label>
|
|
2043
|
+
`:`
|
|
2044
|
+
<label class="field compact planner-field ${a.templateFieldErrors[e.id]?"field-error":""}">
|
|
2045
|
+
<span>${s(n)}</span>
|
|
2046
|
+
<input data-template-field="${s(e.id)}" value="${s(t)}" placeholder="${s(e.placeholder??"")}" ${r} />
|
|
2047
|
+
${o}
|
|
2048
|
+
</label>
|
|
2049
|
+
`}function nn(e){const t=a.templateFieldErrors[e]??a.recurringErrors[e];return t?`<em class="field-error-text">${s(t)}</em>`:""}function Im(){const e=a.aiStatus,t=bt(a.aiSettings.provider),r=qp(a.aiSettings.apiFormat),n=t.id==="custom-openai-compatible",c=!t.models.find(we=>we.id===a.aiSettings.model),d=Nm(e),m=mc(e),A=Dn(),$=uc(),R=a.activeOperation==="confirm-ai-planner",F=a.aiSettings.mode==="bridge"?"Bridge session key":a.aiSettings.mode==="hosted"?"Hosted BYOK key":"Browser session key",pe=a.aiSettings.mode==="hosted"?"Hosted BYOK relays this key only for AI draft requests. It cannot queue approvals, create recurring schedules, approve, submit, or sign.":a.aiSettings.mode==="bridge"?"Local bridge AI drafts from your machine only. Approval Inbox, recurring schedules, receipts, and wallet signatures remain separate workflow actions.":"Browser session keys stay in this tab and draft plans only. Queueing, recurring schedules, approvals, submissions, and signatures use the active workflow, not the AI key.";return`
|
|
2050
|
+
<aside class="ai-settings-card">
|
|
2051
|
+
<div>
|
|
2052
|
+
<span class="workbench-kicker">Connect AI Planner</span>
|
|
2053
|
+
<h3>AI drafts plans only</h3>
|
|
2054
|
+
<p>${s(pe)}</p>
|
|
2055
|
+
</div>
|
|
2056
|
+
<label class="field compact">
|
|
2057
|
+
<span>AI path</span>
|
|
2058
|
+
<select id="aiMode" ${a.busy?"disabled":""} ${Sn()?`title="${s(Sn())}"`:""}>
|
|
2059
|
+
${Rm()}
|
|
2060
|
+
</select>
|
|
2061
|
+
${Sn()?`<em class="ai-route-helper">${s(Sn())}</em>`:""}
|
|
2062
|
+
</label>
|
|
2063
|
+
<label class="field compact">
|
|
2064
|
+
<span>Provider preset</span>
|
|
2065
|
+
<select id="aiProvider" ${a.busy?"disabled":""} ${$n()?`title="${s($n())}"`:""}>
|
|
2066
|
+
${Em()}
|
|
2067
|
+
</select>
|
|
2068
|
+
${$n()?`<em class="ai-route-helper">${s($n())}</em>`:""}
|
|
2069
|
+
</label>
|
|
2070
|
+
<label class="field compact">
|
|
2071
|
+
<span>Model</span>
|
|
2072
|
+
<select id="aiModelSelect" ${a.busy?"disabled":""}>
|
|
2073
|
+
${t.models.map(we=>`
|
|
2074
|
+
<option value="${s(we.id)}" ${we.id===a.aiSettings.model?"selected":""}>
|
|
2075
|
+
${s(we.label)}
|
|
2076
|
+
</option>
|
|
2077
|
+
`).join("")}
|
|
2078
|
+
<option value="${Ml}" ${c?"selected":""}>Custom model</option>
|
|
2079
|
+
</select>
|
|
2080
|
+
</label>
|
|
2081
|
+
${c?`
|
|
2082
|
+
<label class="field compact">
|
|
2083
|
+
<span>Custom model</span>
|
|
2084
|
+
<input id="aiModelCustom" value="${s(a.aiSettings.model)}" placeholder="${s(t.model)}" ${a.busy?"disabled":""} />
|
|
2085
|
+
</label>
|
|
2086
|
+
`:""}
|
|
2087
|
+
${n?`
|
|
2088
|
+
<label class="field compact">
|
|
2089
|
+
<span>Gateway URL</span>
|
|
2090
|
+
<input id="aiBaseUrl" value="${s(a.aiSettings.baseUrl)}" placeholder="${s(t.baseUrl)}" ${a.busy?"disabled":""} />
|
|
2091
|
+
</label>
|
|
2092
|
+
`:""}
|
|
2093
|
+
<label class="field compact">
|
|
2094
|
+
<span>${s(F)}</span>
|
|
2095
|
+
<input id="aiApiKey" type="password" value="${s(a.aiSettings.apiKey)}" placeholder="Not saved by default" autocomplete="off" ${a.busy?"disabled":""} />
|
|
2096
|
+
</label>
|
|
2097
|
+
<div class="ai-actions">
|
|
2098
|
+
${a.aiSettings.mode==="bridge"?`<button id="saveBridgeAiKey" ${pc()?"":"disabled"}>Set bridge key</button>`:`<button id="saveDirectAiKey" ${_o()?"":"disabled"}>Use key for drafts</button>`}
|
|
2099
|
+
<button id="confirmAiPlanner" class="utility" ${Nn()?"":"disabled"} title="${s(Nn()?"Confirm planner readiness without creating a plan.":Wn())}">
|
|
2100
|
+
${R?`${io()}Confirming...`:"Confirm planner"}
|
|
2101
|
+
</button>
|
|
2102
|
+
<button id="clearAiKey" ${fc()?"":"disabled"}>Clear key</button>
|
|
2103
|
+
${a.aiSettings.mode==="bridge"?`<button id="refreshAiStatus" ${a.busy?"disabled":""}>Refresh</button>`:""}
|
|
2104
|
+
</div>
|
|
2105
|
+
${_m()}
|
|
2106
|
+
${a.aiSettings.mode==="bridge"?Lm(e):""}
|
|
2107
|
+
${a.aiSettings.mode==="bridge"&&!a.bridgeActive&&!(e!=null&&e.available)?hm("ai-runtime-guide"):""}
|
|
2108
|
+
<div class="ai-confirmation-line">
|
|
2109
|
+
<span>Planner check</span>
|
|
2110
|
+
<strong id="aiConfirmationStatus">${s(A)}</strong>
|
|
2111
|
+
<p id="aiConfirmationDetail">${s($)}</p>
|
|
2112
|
+
</div>
|
|
2113
|
+
<div class="ai-status-line">
|
|
2114
|
+
<span>Planner status</span>
|
|
2115
|
+
<strong>${s(m)}</strong>
|
|
2116
|
+
</div>
|
|
2117
|
+
<div class="ai-status-line">
|
|
2118
|
+
<span>Route</span>
|
|
2119
|
+
<strong>${s(d)}</strong>
|
|
2120
|
+
</div>
|
|
2121
|
+
<div class="ai-status-line">
|
|
2122
|
+
<span>Format</span>
|
|
2123
|
+
<strong>${s(r)}</strong>
|
|
2124
|
+
</div>
|
|
2125
|
+
<div class="ai-status-line">
|
|
2126
|
+
<span>Workflow impact</span>
|
|
2127
|
+
<strong>Drafting only</strong>
|
|
2128
|
+
</div>
|
|
2129
|
+
${Om()}
|
|
2130
|
+
<p class="ai-security-note">AI Planner only drafts. Templates, Approval Inbox, recurring schedules, and receipts use the active workflow; private local bridge is optional.</p>
|
|
2131
|
+
</aside>
|
|
2132
|
+
`}function Rm(){return[{id:"hosted",label:"Hosted BYOK - drafts only"},{id:"bridge",label:"Local bridge AI - draft via bridge"},{id:"session",label:"Browser session - drafts only"}].map(t=>{const r=lc(t.id);return`
|
|
2133
|
+
<option
|
|
2134
|
+
value="${s(t.id)}"
|
|
2135
|
+
${t.id===a.aiSettings.mode?"selected":""}
|
|
2136
|
+
${r?`disabled title="${s(r)}"`:""}
|
|
2137
|
+
>
|
|
2138
|
+
${s(t.label)}
|
|
2139
|
+
</option>
|
|
2140
|
+
`}).join("")}function Em(){return Rn.map(e=>{const t=cc(e.id);return`
|
|
2141
|
+
<option
|
|
2142
|
+
value="${s(e.id)}"
|
|
2143
|
+
${e.id===a.aiSettings.provider?"selected":""}
|
|
2144
|
+
${t?`disabled title="${s(t)}"`:""}
|
|
2145
|
+
>
|
|
2146
|
+
${s(e.label)}
|
|
2147
|
+
</option>
|
|
2148
|
+
`}).join("")}function lc(e){return e==="session"&&a.aiSettings.provider==="openai"?Or:""}function cc(e){return a.aiSettings.mode==="session"&&e==="openai"?Or:a.aiSettings.mode==="hosted"&&e==="custom-openai-compatible"?jn:""}function Sn(){return a.aiSettings.provider==="openai"?Or:""}function $n(){return a.aiSettings.mode==="session"?Or:a.aiSettings.mode==="hosted"?jn:""}function _m(){return a.aiSettings.mode==="session"?`
|
|
2149
|
+
<div class="ai-limitations">
|
|
2150
|
+
<span>Browser session limits</span>
|
|
2151
|
+
<ul>
|
|
2152
|
+
${Wl.map(e=>`<li>${s(e)}</li>`).join("")}
|
|
2153
|
+
</ul>
|
|
2154
|
+
</div>
|
|
2155
|
+
`:a.aiSettings.mode==="hosted"?`
|
|
2156
|
+
<div class="ai-limitations">
|
|
2157
|
+
<span>Hosted BYOK boundary</span>
|
|
2158
|
+
<ul>
|
|
2159
|
+
<li>Agentic relays the key only for the current draft request.</li>
|
|
2160
|
+
<li>No AI path can approve, submit, sign, or change workflow capability.</li>
|
|
2161
|
+
</ul>
|
|
2162
|
+
</div>
|
|
2163
|
+
`:`
|
|
2164
|
+
<div class="ai-limitations">
|
|
2165
|
+
<span>Local bridge AI boundary</span>
|
|
2166
|
+
<ul>
|
|
2167
|
+
<li>Local bridge AI drafts only from your machine.</li>
|
|
2168
|
+
<li>Private local workflow remains optional and separate from AI setup.</li>
|
|
2169
|
+
</ul>
|
|
2170
|
+
</div>
|
|
2171
|
+
`}function Lm(e){const t=a.bridgeActive,r=!!(e!=null&&e.available),n=t?"connected":r?"partial":"offline",o=t?"Local bridge connected":r?"Bridge AI key configured":"Local bridge not connected",c=t?"Approval queue, recurring plans, receipts, and local AI route are reachable from this browser.":r?"The AI key is set in the local bridge, but this wallet host still needs to connect to the approval bridge.":"Start the local runtime on this computer, then check the local bridge from this browser.",d=r?`${(e==null?void 0:e.provider)??(e==null?void 0:e.apiFormat)??"AI"} - ${(e==null?void 0:e.model)??"model configured"}`:"AI key not configured";return`
|
|
2172
|
+
<div class="local-bridge-connection-card ${n}">
|
|
2173
|
+
<div class="local-bridge-connection-head">
|
|
2174
|
+
<span>${s(t?"Connected":r?"Key set":"Setup needed")}</span>
|
|
2175
|
+
<strong>${s(o)}</strong>
|
|
2176
|
+
</div>
|
|
2177
|
+
<p>${s(c)}</p>
|
|
2178
|
+
<div class="local-bridge-facts">
|
|
2179
|
+
<span>Endpoint <strong>${s(hr(a.bridgeUrl))}</strong></span>
|
|
2180
|
+
<span>Wallet <strong>${s(a.address?_(a.address):"Not connected")}</strong></span>
|
|
2181
|
+
<span>AI <strong>${s(d)}</strong></span>
|
|
2182
|
+
</div>
|
|
2183
|
+
${t?"":`
|
|
2184
|
+
<button type="button" class="utility" data-bridge-action="connect" ${!a.address||a.busy?"disabled":""}>
|
|
2185
|
+
Check local bridge
|
|
2186
|
+
</button>
|
|
2187
|
+
`}
|
|
2188
|
+
</div>
|
|
2189
|
+
`}function Om(){return a.aiDiagnostics.length===0?"":`
|
|
2190
|
+
<div class="ai-diagnostics" aria-label="AI diagnostics">
|
|
2191
|
+
<span>Diagnostics</span>
|
|
2192
|
+
<div class="ai-diagnostics-list">
|
|
2193
|
+
${a.aiDiagnostics.map(e=>`
|
|
2194
|
+
<div class="ai-diagnostic-entry ${e.code==="AI_ROUTE_MISMATCH"||e.code==="AI_PROVIDER_ERROR"?"error":""}">
|
|
2195
|
+
<strong>${s(e.code)}</strong>
|
|
2196
|
+
<p>${s(Dm(e))}</p>
|
|
2197
|
+
</div>
|
|
2198
|
+
`).join("")}
|
|
2199
|
+
</div>
|
|
2200
|
+
</div>
|
|
2201
|
+
`}function Dm(e){const t=[e.message,e.detail,e.status!==void 0?`status=${e.status}`:"",e.contentType?`content-type=${e.contentType}`:"",e.path?`path=${e.path}`:""].filter(Boolean);return je(t.join(" | "),a.aiSettings.apiKey)}function Ro(){var c,d,m,A;const e=a.aiSettings.mode,t=e==="bridge"?((c=a.aiStatus)==null?void 0:c.provider)??a.aiSettings.provider:a.aiSettings.provider,r=e==="bridge"?((d=a.aiStatus)==null?void 0:d.apiFormat)??a.aiSettings.apiFormat:a.aiSettings.apiFormat,n=e==="bridge"?((m=a.aiStatus)==null?void 0:m.baseUrl)??a.aiSettings.baseUrl:a.aiSettings.baseUrl,o=e==="bridge"?((A=a.aiStatus)==null?void 0:A.model)??a.aiSettings.model:a.aiSettings.model;return[e,t,r,n.trim(),o.trim()].join("|")}function Eo(){return a.aiPlannerConfirmation.status==="confirmed"&&a.aiPlannerConfirmation.key===Ro()}function dc(){return a.aiPlannerConfirmation.status==="failed"&&a.aiPlannerConfirmation.key===Ro()}function Dn(){return Eo()?a.aiSettings.mode==="hosted"?"Route confirmed":a.aiSettings.mode==="session"?"Config checked":"Status confirmed":dc()?"Check failed":Lo()?"Confirm planner":"Not ready"}function uc(){if(Eo()){const e=a.aiPlannerConfirmation.checkedAt?` Checked ${Y(a.aiPlannerConfirmation.checkedAt)}.`:"";return`${a.aiPlannerConfirmation.message}${e}`.trim()}return dc()?a.aiPlannerConfirmation.message||"Planner confirmation failed. Templates still work without AI.":Lo()?"Confirm the planner route before generating if you want a readiness check. Templates still work without AI.":`${Kn()} Templates still work without AI.`}function Wa(e,t){a.aiPlannerConfirmation={status:e,key:Ro(),message:t,checkedAt:e==="untested"?"":new Date().toISOString()}}function It(e=""){a.aiPlannerConfirmation={status:"untested",key:"",message:e,checkedAt:""}}function Nn(){return a.busy?!1:a.aiSettings.mode==="bridge"?!0:!!(a.aiSettings.apiKey.trim()&&a.aiSettings.model.trim()&&er())}function Wn(){return a.busy?"Wait for the current action to finish.":a.aiSettings.mode==="bridge"?"Start the local runtime, then confirm planner status.":a.aiSettings.mode==="session"&&a.aiSettings.provider==="openai"?Or:a.aiSettings.apiKey.trim()?a.aiSettings.model.trim()?er()?"Confirm planner readiness before generating.":a.aiSettings.mode==="hosted"?jn:"Add a browser-compatible gateway URL for this provider.":"Choose or enter an AI model before confirming.":a.aiSettings.mode==="hosted"?"Add a Hosted BYOK request key before confirming.":"Add a browser-compatible session key before confirming."}function pc(){return a.aiSettings.mode==="bridge"&&!!a.aiSettings.apiKey.trim()&&!!a.aiSettings.model.trim()&&er()&&!a.busy}function _o(){return a.aiSettings.mode!=="bridge"&&!!a.aiSettings.apiKey.trim()&&!!a.aiSettings.model.trim()&&er()&&!a.busy}function fc(){var e;return!!(a.aiSettings.apiKey.trim()||a.aiSettings.mode==="bridge"&&((e=a.aiStatus)!=null&&e.available))}function gc(){var t;const e=!!a.aiSettings.model.trim();return a.aiSettings.mode==="bridge"?!!((t=a.aiStatus)!=null&&t.available&&!a.busy):!!(a.aiSettings.apiKey.trim()&&e&&er()&&!a.busy)}function Kn(){var t;const e=!!a.aiSettings.model.trim();return a.busy?"Wait for the current action to finish.":a.aiSettings.mode==="bridge"?(t=a.aiStatus)!=null&&t.available?"Bridge AI is ready.":"Start the local runtime, set a bridge key, then refresh AI status.":a.aiSettings.mode==="session"&&a.aiSettings.provider==="openai"?Or:a.aiSettings.apiKey.trim()?e?er()?"Configure the AI Planner first, or use templates without AI.":a.aiSettings.mode==="hosted"?jn:"Add a browser-compatible gateway URL for this provider.":"Choose or enter an AI model.":a.aiSettings.mode==="hosted"?"Add a Hosted BYOK request key.":"Add a browser-compatible session key."}function Lo(){var t;const e=!!a.aiSettings.model.trim();return a.aiSettings.mode==="bridge"?!!((t=a.aiStatus)!=null&&t.available):!!(a.aiSettings.apiKey.trim()&&e&&er())}function er(){const e=bt(a.aiSettings.provider);return a.aiSettings.mode==="session"&&e.id==="openai"?!1:a.aiSettings.mode==="hosted"?e.id!=="custom-openai-compatible":e.id!=="custom-openai-compatible"||!!a.aiSettings.baseUrl.trim()}function Nm(e){return a.aiSettings.mode==="hosted"?a.aiSettings.apiKey.trim()?`hosted draft route - ${a.aiSettings.provider} - ${a.aiSettings.model||"model configured"}`:"hosted draft - key required":a.aiSettings.mode==="session"?a.aiSettings.provider==="openai"?"browser draft - OpenAI requires hosted or bridge":a.aiSettings.apiKey.trim()?`browser draft - ${a.aiSettings.provider} - ${a.aiSettings.model||"model configured"}`:"browser draft - key required":e!=null&&e.available?`${e.source} - ${e.provider??e.apiFormat??"AI"} - ${e.model??"model configured"}`:"bridge - not configured"}function mc(e){return a.aiSettings.mode==="bridge"?e!=null&&e.available?"Bridge AI verified":"Bridge key required":a.aiSettings.mode==="session"&&a.aiSettings.provider==="openai"?"Use hosted or bridge for OpenAI":a.aiSettings.apiKey.trim()?a.aiSettings.model.trim()?er()?a.aiSettings.mode==="hosted"?"Hosted key entered":"Config ready for this tab":a.aiSettings.mode==="hosted"?"Choose hosted provider":"Gateway URL required":"Choose a model":a.aiSettings.mode==="hosted"?"Hosted key required":"Browser key required"}function Ha(e,t="POST"){return Bp(a.aiSettings,{path:e,method:t,origin:window.location.origin,bridgeBaseUrl:rs()})}function Oo(e){a.aiDiagnostics=[...a.aiDiagnostics,e].slice(-6)}function hc(e,t){var n;const r=xl(e);return r.length>0?a.aiDiagnostics=r.slice(-6):Oo({code:"AI_PROVIDER_ERROR",message:t,detail:`${a.aiSettings.provider} ${a.aiSettings.model||"model configured"}`}),((n=Do(e))==null?void 0:n.message)??t}function Wm(e){return Do(e)?"Hosted AI route failed":"AI plan failed"}function Mm(e){return Do(e)?"Hosted AI route failed":"Planner check failed"}function Do(e){return xl(e).find(t=>t.code==="AI_ROUTE_MISMATCH")}function Um(){if(a.aiSettings.mode==="session"&&a.aiSettings.provider==="openai"){const e=bt(Nl);a.aiSettings.provider=e.id,a.aiSettings.apiFormat=e.apiFormat,a.aiSettings.baseUrl=e.baseUrl,a.aiSettings.model=e.model;return}if(a.aiSettings.mode==="hosted"&&a.aiSettings.provider==="custom-openai-compatible"){const e=bt(mo);a.aiSettings.provider=e.id,a.aiSettings.apiFormat=e.apiFormat,a.aiSettings.baseUrl=e.baseUrl,a.aiSettings.model=e.model}}function Ci(){const e=document.querySelector("#saveBridgeAiKey"),t=document.querySelector("#saveDirectAiKey"),r=document.querySelector("#confirmAiPlanner"),n=document.querySelector("#clearAiKey"),o=document.querySelector("#generateAiPlan"),c=gc();if(e&&(e.disabled=!pc()),t&&(t.disabled=!_o()),r){const d=Nn();r.disabled=!d,r.title=d?"Confirm planner readiness without creating a plan.":Wn()}n&&(n.disabled=!fc()),o&&(o.disabled=!c,o.classList.toggle("primary",c),o.title=c?"Create a one-time draft through your configured AI planner.":Kn()),qm()}function qm(){const e=document.querySelector("#aiConfirmationStatus"),t=document.querySelector("#aiConfirmationDetail");e&&(e.textContent=Dn()),t&&(t.textContent=uc())}function Os(e){const t=e.dataset.labId||a.activeLab,r=e.dataset.labField;r&&(a.labFieldValues[t]={...a.labFieldValues[t]??{},[r]:e.value},delete a.labFieldErrors[la(t,r)],a.error="",yc())}function yc(){const e=document.querySelector("#createLabArtifact");e&&(e.disabled=!a.address||a.busy)}function Bm(){const e=document.querySelector("#recurringNextOccurrence");e&&(e.textContent=Sd(a.recurringDraft));const t=document.querySelector(".recurring-production-preview");t&&(t.outerHTML=pd(a.recurringDraft))}function Fm(){const e=a.artifactSearch.trim().toLowerCase();for(const t of document.querySelectorAll("[data-artifact-search-text]")){const r=t.dataset.artifactSearchText??"";t.hidden=!!e&&!r.includes(e)}}function jm(){if(!a.address)return Hn("Approval inbox","Connect a wallet before approving or denying queued requests.");const e=md();return`
|
|
2202
|
+
<section class="approval-object signature-stage stage-inbox stage-anchor ${e.length?"stage-active":"stage-draft"}">
|
|
2203
|
+
<div class="signature-object-head">
|
|
2204
|
+
<div>
|
|
2205
|
+
<h2>Approval inbox</h2>
|
|
2206
|
+
<p>${s(zm())}</p>
|
|
2207
|
+
</div>
|
|
2208
|
+
<div class="inbox-toolbar signature-toolbar">
|
|
2209
|
+
<select id="inboxFilter">
|
|
2210
|
+
${Gr("all","All active")}
|
|
2211
|
+
${Gr("ready","Ready")}
|
|
2212
|
+
${Gr("scheduled","Scheduled")}
|
|
2213
|
+
${Gr("attention","Needs attention")}
|
|
2214
|
+
${Gr("one-time","One-time")}
|
|
2215
|
+
${Gr("recurring","Recurring")}
|
|
2216
|
+
</select>
|
|
2217
|
+
<button id="refreshInbox" class="utility" ${a.busy?"disabled":""}>Refresh</button>
|
|
2218
|
+
</div>
|
|
2219
|
+
</div>
|
|
2220
|
+
|
|
2221
|
+
${rb(e.length)}
|
|
2222
|
+
${nb(e)}
|
|
2223
|
+
${a.error?`<div class="error">${s(a.error)}</div>`:""}
|
|
2224
|
+
</section>
|
|
2225
|
+
`}function Hm(){const e=tr(),t=oy(e),r=e.filter(c=>c.actionId).length,n=e.filter(c=>!!c.signature).length,o=e.filter(c=>c.kind==="recurring").length;return`
|
|
2226
|
+
<section class="approval-object signature-stage stage-completed stage-anchor ${e.length?"stage-active":"stage-draft"}">
|
|
2227
|
+
<div class="signature-object-head">
|
|
2228
|
+
<div>
|
|
2229
|
+
<h2>Completed plans</h2>
|
|
2230
|
+
<p>Approved, rejected, cancelled, signed, and ended work stays here until you delete it.</p>
|
|
2231
|
+
</div>
|
|
2232
|
+
<div class="generated-plans-toolbar signature-toolbar">
|
|
2233
|
+
<span class="signature-state">${s(`${e.length} completed`)}</span>
|
|
2234
|
+
<button id="refreshCompletedPlans" class="utility" ${a.busy?"disabled":""}>Refresh</button>
|
|
2235
|
+
</div>
|
|
2236
|
+
</div>
|
|
2237
|
+
|
|
2238
|
+
${Ym()}
|
|
2239
|
+
<div class="queue-status completed-plan-status">
|
|
2240
|
+
<span>${s(Km())}</span>
|
|
2241
|
+
<strong>${t.length} visible</strong>
|
|
2242
|
+
<span>${r} receipt${r===1?"":"s"}</span>
|
|
2243
|
+
<span>${n} proof${n===1?"":"s"}</span>
|
|
2244
|
+
<span>${o} recurring</span>
|
|
2245
|
+
</div>
|
|
2246
|
+
${Gm()}
|
|
2247
|
+
${t.length?`<div class="generated-plan-grid completed-plan-grid" aria-label="Completed plans">${t.map(Zm).join("")}</div>`:Vm(e.length)}
|
|
2248
|
+
${a.error?`<div class="error">${s(a.error)}</div>`:""}
|
|
2249
|
+
</section>
|
|
2250
|
+
`}function zm(){return te()==="agentic-cloud"?"Active one-time cloud approvals wait here for approve, deny, or cancel.":te()==="local-bridge"?"Private local one-time approvals and recurring occurrences wait here for approve or deny.":"Browser-local one-time approvals and recurring occurrences wait here for approve or deny."}function Gm(){return te()==="agentic-cloud"?`
|
|
2251
|
+
<p class="completed-bridge-hint">
|
|
2252
|
+
Completed cloud approvals are loaded from Agentic Cloud for the signed-in wallet.
|
|
2253
|
+
</p>
|
|
2254
|
+
`:te()==="local-bridge"?"":`
|
|
2255
|
+
<p class="completed-bridge-hint">
|
|
2256
|
+
Browser workflow history is local to this device. Sign in to Agentic Cloud to sync one-time approvals.
|
|
2257
|
+
</p>
|
|
2258
|
+
`}function Km(){return te()==="agentic-cloud"?"Cloud completed history":te()==="local-bridge"?"Private local receipts":"Browser workflow history"}function Ym(){return`
|
|
2259
|
+
<div class="template-filter-row completed-filter-row" role="group" aria-label="Completed plan filter">
|
|
2260
|
+
${[["all","All"],["one-time","One-time"],["recurring","Recurring"],["proofs","Proofs"],["receipts","Receipts"]].map(([t,r])=>`
|
|
2261
|
+
<button
|
|
2262
|
+
type="button"
|
|
2263
|
+
data-completed-filter="${s(t)}"
|
|
2264
|
+
class="${a.completedPlanFilter===t?"active":""}"
|
|
2265
|
+
${a.busy?"disabled":""}
|
|
2266
|
+
>
|
|
2267
|
+
${s(r)}
|
|
2268
|
+
</button>
|
|
2269
|
+
`).join("")}
|
|
2270
|
+
</div>
|
|
2271
|
+
`}function Vm(e){const t=e?"No completed plans match this filter.":te()==="agentic-cloud"?"Approve, deny, or cancel a cloud approval to create completed cloud history.":"Sign a review proof, approve or reject an inbox item, or finish a recurring schedule to create history here.";return To("No completed plans",t)}function Jm(e){if(!e.signature&&e.decisionProofVerified===void 0)return"";const t=e.decisionProofVerified===!0,r=e.signature?_(e.signature):"",n=Y(e.completedAt),o=e.walletAddress?_(e.walletAddress):"unknown wallet",c=t?"Decision signed by your wallet":e.signature?"Decision signature recorded":"";if(!c)return"";const d=e.decisionProofMessage?`<details class="decision-proof-message"><summary>What you signed</summary><pre class="decision-proof-text">${s(e.decisionProofMessage)}</pre></details>`:"",m=[e.signature?`<button data-copy="${s(e.signature)}" data-copy-name="Decision signature">Copy signature</button>`:"",e.decisionProofMessage?`<button data-copy="${s(e.decisionProofMessage)}" data-copy-name="Signed text">Copy signed text</button>`:""].filter(Boolean).join("");return`
|
|
2272
|
+
<div class="decision-proof-block ${t?"verified":""}" aria-label="Decision proof">
|
|
2273
|
+
<div class="decision-proof-headline">
|
|
2274
|
+
<span class="decision-proof-icon" aria-hidden="true">${t?"✓":"⚠"}</span>
|
|
2275
|
+
<strong>${s(c)}</strong>
|
|
2276
|
+
</div>
|
|
2277
|
+
<dl class="decision-proof-grid">
|
|
2278
|
+
<div><dt>Wallet</dt><dd title="${s(e.walletAddress)}">${s(o)}</dd></div>
|
|
2279
|
+
<div><dt>When</dt><dd>${s(n)}</dd></div>
|
|
2280
|
+
${r?`<div><dt>Signature</dt><dd title="${s(e.signature??"")}">${s(r)}</dd></div>`:""}
|
|
2281
|
+
</dl>
|
|
2282
|
+
${d}
|
|
2283
|
+
${m?`<div class="decision-proof-actions">${m}</div>`:""}
|
|
2284
|
+
</div>
|
|
2285
|
+
`}function Zm(e){const t=!!(e.workflowSource!=="cloud"&&!a.bridgeActive&&(e.actionId&&!De(e.actionId)||Gi(e)&&e.recurringId&&!De(e.recurringId))),r=e.txid?"Transaction":e.signature?"Review proof":e.actionId?"Receipt":"Schedule",n=e.actionId?"Copy receipt JSON":e.signature?"Copy proof JSON":"Copy schedule JSON",o=a.lastCompletedFocusId===e.id||!!(e.actionId&&a.lastCompletedFocusId===e.actionId),c=Jm(e);return`
|
|
2286
|
+
<article class="generated-plan-card completed-plan-card ${o?"focused":""}" ${o?'data-completed-focus="true"':""}>
|
|
2287
|
+
<div class="generated-plan-card-top">
|
|
2288
|
+
<span class="status-pill ${s(e.tone)}">${s(e.status)}</span>
|
|
2289
|
+
<span>${s(Y(e.completedAt))}</span>
|
|
2290
|
+
</div>
|
|
2291
|
+
<div class="generated-plan-card-title">
|
|
2292
|
+
<span class="workbench-kicker">${s(e.kind==="recurring"?"Recurring history":"One-time history")}</span>
|
|
2293
|
+
<h3 title="${s(e.summary)}">${s(e.title)}</h3>
|
|
2294
|
+
</div>
|
|
2295
|
+
<div class="generated-plan-card-chips">
|
|
2296
|
+
<span>${s(e.kind==="recurring"?"Recurring":"One-time")}</span>
|
|
2297
|
+
<span>${s(r)}</span>
|
|
2298
|
+
<span>${s(ft(e.cluster))}</span>
|
|
2299
|
+
</div>
|
|
2300
|
+
<div class="generated-plan-quick-facts">
|
|
2301
|
+
${Qr("Wallet",e.walletAddress?_(e.walletAddress):"No wallet")}
|
|
2302
|
+
${Qr("Amount",e.amount?`${e.amount} ${e.token??""}`.trim():"n/a")}
|
|
2303
|
+
${Qr("Completed",Y(e.completedAt))}
|
|
2304
|
+
</div>
|
|
2305
|
+
${e.summary?`<p class="template-description">${s(e.summary)}</p>`:""}
|
|
2306
|
+
${c}
|
|
2307
|
+
${e.actionId?vc(e.actionId):""}
|
|
2308
|
+
${e.actionId?qi("approval",e.actionId):qi("completed",e.id)}
|
|
2309
|
+
<div class="generated-plan-outcomes">
|
|
2310
|
+
${e.signature?`<span title="${s(e.signature)}">Proof ${s(_(e.signature))}</span>`:""}
|
|
2311
|
+
${e.txid?`<span title="${s(e.txid)}">Tx ${s(_(e.txid))}</span>`:""}
|
|
2312
|
+
${e.actionId?`<span title="${s(e.actionId)}">Receipt ${s(_(e.actionId))}</span>`:""}
|
|
2313
|
+
${e.recurringId?`<span title="${s(e.recurringId)}">Recurring ${s(_(e.recurringId))}</span>`:""}
|
|
2314
|
+
</div>
|
|
2315
|
+
<div class="generated-plan-card-actions completed-plan-actions">
|
|
2316
|
+
<button data-copy="${s(e.copyPayload)}" data-copy-name="Completed plan">${s(n)}</button>
|
|
2317
|
+
${e.trustBundlePayload?`<button data-copy="${s(e.trustBundlePayload)}" data-copy-name="Trust bundle">Copy trust bundle</button>`:""}
|
|
2318
|
+
${e.txid?`<button data-copy="${s(e.txid)}" data-copy-name="Transaction id">Copy transaction id</button>`:""}
|
|
2319
|
+
</div>
|
|
2320
|
+
<details class="generated-plan-inline-details completed-plan-details">
|
|
2321
|
+
<summary>View details</summary>
|
|
2322
|
+
<dl class="proof-grid compact">
|
|
2323
|
+
${e.detailRows.map(([d,m])=>Yt(d,m)).join("")}
|
|
2324
|
+
</dl>
|
|
2325
|
+
${e.txid?wd(e.txid,e.cluster):""}
|
|
2326
|
+
</details>
|
|
2327
|
+
<details class="generated-plan-more">
|
|
2328
|
+
<summary>More</summary>
|
|
2329
|
+
<div>
|
|
2330
|
+
<button
|
|
2331
|
+
class="utility danger"
|
|
2332
|
+
data-completed-delete="${s(e.id)}"
|
|
2333
|
+
${a.busy||t?"disabled":""}
|
|
2334
|
+
title="${t?"Connect the local bridge before deleting bridge-backed history.":"Delete this completed plan from history."}"
|
|
2335
|
+
>
|
|
2336
|
+
Delete history
|
|
2337
|
+
</button>
|
|
2338
|
+
</div>
|
|
2339
|
+
</details>
|
|
2340
|
+
</article>
|
|
2341
|
+
`}function vc(e){const t=bc(e);return t.length===0?"":`
|
|
2342
|
+
<div class="related-receipts" aria-label="Related evidence receipts">
|
|
2343
|
+
<div class="related-receipts-head">
|
|
2344
|
+
<strong>Related receipts</strong>
|
|
2345
|
+
<span>${t.length} wallet-signed</span>
|
|
2346
|
+
</div>
|
|
2347
|
+
<div class="related-receipt-list">
|
|
2348
|
+
${t.map(Qm).join("")}
|
|
2349
|
+
</div>
|
|
2350
|
+
</div>
|
|
2351
|
+
`}function Qm(e){return`
|
|
2352
|
+
<div class="related-receipt-row">
|
|
2353
|
+
<div>
|
|
2354
|
+
<strong>${s(e.title||ii(e.kind))}</strong>
|
|
2355
|
+
<span>${s(Y(e.createdAt))} · ${s(_(e.signature))}</span>
|
|
2356
|
+
</div>
|
|
2357
|
+
<div>
|
|
2358
|
+
<button data-copy="${s(e.signingMessage)}" data-copy-name="Related receipt signed text">Copy text</button>
|
|
2359
|
+
<button data-copy="${s(Pe(e))}" data-copy-name="Related receipt JSON">Copy JSON</button>
|
|
2360
|
+
<button data-share-receipt="${s(e.id)}">Share</button>
|
|
2361
|
+
</div>
|
|
2362
|
+
</div>
|
|
2363
|
+
`}function bc(e){return a.labArtifacts.filter(t=>{const r=t.metadata??{};return r.recordType==="approval"&&r.recordId===e||r.sourceRecordType==="approval"&&r.sourceRecordId===e||r.subjectType==="approval"&&r.subjectId===e||r.approvalId===e}).sort((t,r)=>r.createdAt.localeCompare(t.createdAt))}function qi(e,t){const r=Va(e,t),n=a.auditActivity[r]??{status:"idle",events:[]},o=a.auditOpen[r]===!0,c=Pt()?Xm(n):'<p class="activity-note">Cloud activity appears here after you sign in to Agentic Cloud. Browser receipts remain visible in this workspace.</p>';return`
|
|
2364
|
+
<details
|
|
2365
|
+
class="record-activity"
|
|
2366
|
+
data-audit-record-type="${s(e)}"
|
|
2367
|
+
data-audit-record-id="${s(t)}"
|
|
2368
|
+
${o?"open":""}
|
|
2369
|
+
>
|
|
2370
|
+
<summary>Activity</summary>
|
|
2371
|
+
${c}
|
|
2372
|
+
<div class="record-activity-actions">
|
|
2373
|
+
<button
|
|
2374
|
+
type="button"
|
|
2375
|
+
data-audit-refresh-record-type="${s(e)}"
|
|
2376
|
+
data-audit-refresh-record-id="${s(t)}"
|
|
2377
|
+
${a.busy||!Pt()?"disabled":""}
|
|
2378
|
+
>
|
|
2379
|
+
Refresh activity
|
|
2380
|
+
</button>
|
|
2381
|
+
</div>
|
|
2382
|
+
</details>
|
|
2383
|
+
`}function Xm(e){return e.status==="loading"?'<p class="activity-note">Loading cloud activity...</p>':e.status==="error"?`<p class="activity-note error-text">${s(e.error??"Activity could not be loaded.")}</p>`:e.status!=="loaded"?'<p class="activity-note">Open to load cloud activity for this record.</p>':e.events.length===0?'<p class="activity-note">No cloud activity found for this record yet.</p>':`
|
|
2384
|
+
<div class="activity-event-list">
|
|
2385
|
+
${e.events.map(eh).join("")}
|
|
2386
|
+
</div>
|
|
2387
|
+
`}function eh(e){const t=e.metadata??{},r=th(t);return`
|
|
2388
|
+
<div class="activity-event-row">
|
|
2389
|
+
<span>${s(Y(e.createdAt))}</span>
|
|
2390
|
+
<strong>${s(e.eventType??e.type)}</strong>
|
|
2391
|
+
${r?`<p>${s(r)}</p>`:""}
|
|
2392
|
+
</div>
|
|
2393
|
+
`}function th(e){return["status","kind","txid","finalizationId","completedId","recordType","recordId"].map(r=>{const n=e[r];return typeof n=="string"&&n?`${r}: ${n}`:""}).filter(Boolean).slice(0,4).join(" · ")}function Va(e,t){return`${e}:${t}`}function rh(){return a.address?`
|
|
2394
|
+
<section class="approval-object signature-stage stage-schedule stage-anchor ${ba().length?"stage-active":"stage-draft"}">
|
|
2395
|
+
<div class="signature-object-head">
|
|
2396
|
+
<div>
|
|
2397
|
+
<h2>Create recurring schedule</h2>
|
|
2398
|
+
<p>Create a supported payment or subscription schedule. Each due occurrence appears in Approval Inbox for approve or deny.</p>
|
|
2399
|
+
</div>
|
|
2400
|
+
<button id="refreshInbox" class="utility" ${a.busy?"disabled":""}>Refresh</button>
|
|
2401
|
+
</div>
|
|
2402
|
+
|
|
2403
|
+
${ab()}
|
|
2404
|
+
${pb()}
|
|
2405
|
+
${hb()}
|
|
2406
|
+
${a.error?`<div class="error">${s(a.error)}</div>`:""}
|
|
2407
|
+
</section>
|
|
2408
|
+
`:Hn("Create recurring schedule","Connect a wallet before creating recurring schedules.")}function ah(){const e=Aa(),t=xd(e.id),r=a.labArtifacts,n=a.artifactView==="signed"?r.length>0:!!t,o=a.artifactView==="signed"?`Review wallet-signed receipts saved on this device${a.bridgeActive?" and mirrored to the local bridge archive":""}.`:"Create wallet-signed proofs for intent, policy, review, rejection, and tool traces. Receipts do not queue, approve, or submit transactions.";return`
|
|
2409
|
+
<section class="approval-object signature-stage stage-labs stage-anchor ${n?"stage-complete":"stage-draft"}">
|
|
2410
|
+
<div class="signature-object-head artifact-workspace-head">
|
|
2411
|
+
<div>
|
|
2412
|
+
<h2>Receipt proofs</h2>
|
|
2413
|
+
<p>${s(o)}</p>
|
|
2414
|
+
</div>
|
|
2415
|
+
${nh()}
|
|
2416
|
+
</div>
|
|
2417
|
+
|
|
2418
|
+
${a.artifactView==="signed"?ch():ih()}
|
|
2419
|
+
${a.error?`<div class="error">${s(a.error)}</div>`:""}
|
|
2420
|
+
</section>
|
|
2421
|
+
`}function nh(){return`
|
|
2422
|
+
<div class="tabs compact-tabs artifact-view-tabs" role="tablist" aria-label="Receipt proof views">
|
|
2423
|
+
${Ds("create","Create Proof")}
|
|
2424
|
+
${Ds("signed","Receipt Archive")}
|
|
2425
|
+
</div>
|
|
2426
|
+
`}function Ds(e,t){const r=a.artifactView===e;return`
|
|
2427
|
+
<button
|
|
2428
|
+
data-artifact-view="${e}"
|
|
2429
|
+
class="${r?"active":""}"
|
|
2430
|
+
role="tab"
|
|
2431
|
+
aria-selected="${r?"true":"false"}"
|
|
2432
|
+
type="button"
|
|
2433
|
+
>
|
|
2434
|
+
${s(t)}
|
|
2435
|
+
</button>
|
|
2436
|
+
`}function ih(){if(!a.address)return Hn("Create receipt","Connect a wallet before creating signed receipt proofs.");const e=Aa(),t=xd(e.id),r=pt(e);return`
|
|
2437
|
+
<div class="lab-panel lab-workbench">
|
|
2438
|
+
<div class="artifact-create-status">
|
|
2439
|
+
<span class="signature-state">${s(Wb())}</span>
|
|
2440
|
+
</div>
|
|
2441
|
+
${wh(e)}
|
|
2442
|
+
<div class="lab-workbench-grid">
|
|
2443
|
+
<div class="lab-copy research-brief">
|
|
2444
|
+
<span class="workbench-kicker">${r?"Receipt purpose":"Advanced lab"}</span>
|
|
2445
|
+
<h3>${s(e.title.replace(/^\d+\.\s*/,""))}</h3>
|
|
2446
|
+
<p>${s(e.summary)}</p>
|
|
2447
|
+
<div class="receipt-explainer-stack">
|
|
2448
|
+
<div>
|
|
2449
|
+
<span>What this proves</span>
|
|
2450
|
+
<p>${s(e.whatThisProves)}</p>
|
|
2451
|
+
</div>
|
|
2452
|
+
<div>
|
|
2453
|
+
<span>Best use</span>
|
|
2454
|
+
<p>${s(e.recommendedUse)}</p>
|
|
2455
|
+
</div>
|
|
2456
|
+
</div>
|
|
2457
|
+
<div class="capabilities compact-caps">
|
|
2458
|
+
<span>${s(Sa(e.kind))}</span>
|
|
2459
|
+
<span>${t?"receipt signed":"ready to sign"}</span>
|
|
2460
|
+
</div>
|
|
2461
|
+
</div>
|
|
2462
|
+
|
|
2463
|
+
${r?oh(e):lh(e)}
|
|
2464
|
+
</div>
|
|
2465
|
+
|
|
2466
|
+
<div class="lab-actions lab-signature-action">
|
|
2467
|
+
<button id="createLabArtifact" class="primary" ${!a.address||a.busy?"disabled":""}>${r?"Sign receipt proof":"Sign advanced evidence"}</button>
|
|
2468
|
+
<span>Your wallet signs this record only. No transaction is submitted.</span>
|
|
2469
|
+
</div>
|
|
2470
|
+
|
|
2471
|
+
${t?$b(t):Sh()}
|
|
2472
|
+
</div>
|
|
2473
|
+
`}function oh(e){return`
|
|
2474
|
+
<div class="receipt-fields lab-intent-document">
|
|
2475
|
+
${(e.fields??[]).map(t=>sh(e,t)).join("")}
|
|
2476
|
+
</div>
|
|
2477
|
+
`}function sh(e,t){const r=Pd(e.id,t.id),n=la(e.id,t.id),o=a.labFieldErrors[n],c=`${t.label}${t.required?" *":""}`,d=`data-lab-field="${s(t.id)}" data-lab-id="${s(e.id)}" ${a.busy?"disabled":""}`;return t.type==="select"?`
|
|
2478
|
+
<label class="field compact receipt-field ${o?"field-error":""}">
|
|
2479
|
+
<span>${s(c)}</span>
|
|
2480
|
+
<select ${d}>
|
|
2481
|
+
${(t.options??[]).map(m=>`<option value="${s(m)}" ${m===r?"selected":""}>${s(m)}</option>`).join("")}
|
|
2482
|
+
</select>
|
|
2483
|
+
${o?`<em class="field-error-text">${s(o)}</em>`:""}
|
|
2484
|
+
</label>
|
|
2485
|
+
`:t.type==="textarea"?`
|
|
2486
|
+
<label class="field compact receipt-field ${o?"field-error":""}">
|
|
2487
|
+
<span>${s(c)}</span>
|
|
2488
|
+
<textarea ${d} placeholder="${s(t.placeholder??"")}">${s(r)}</textarea>
|
|
2489
|
+
${o?`<em class="field-error-text">${s(o)}</em>`:""}
|
|
2490
|
+
</label>
|
|
2491
|
+
`:`
|
|
2492
|
+
<label class="field compact receipt-field ${o?"field-error":""}">
|
|
2493
|
+
<span>${s(c)}</span>
|
|
2494
|
+
<input ${d} value="${s(r)}" placeholder="${s(t.placeholder??"")}" />
|
|
2495
|
+
${o?`<em class="field-error-text">${s(o)}</em>`:""}
|
|
2496
|
+
</label>
|
|
2497
|
+
`}function lh(e){const t=a.labFieldErrors[la(e.id,"__advanced")];return`
|
|
2498
|
+
<label class="field agent-prompt lab-intent-document ${t?"field-error":""}">
|
|
2499
|
+
<span>Evidence note *</span>
|
|
2500
|
+
<textarea id="labInput" ${a.busy?"disabled":""}>${s(ts(e.id))}</textarea>
|
|
2501
|
+
${t?`<em class="field-error-text">${s(t)}</em>`:""}
|
|
2502
|
+
</label>
|
|
2503
|
+
`}function ch(){const e=gh();return`
|
|
2504
|
+
<div class="lab-panel signed-artifacts-panel">
|
|
2505
|
+
<div class="inbox-toolbar signature-toolbar artifact-archive-toolbar">
|
|
2506
|
+
<span class="signature-state">${s(`${e.length} visible`)}</span>
|
|
2507
|
+
<button id="refreshLabArtifacts" class="utility" ${a.busy?"disabled":""}>Refresh</button>
|
|
2508
|
+
</div>
|
|
2509
|
+
${dh()}
|
|
2510
|
+
<p class="receipt-copy-helper">Receipt proofs only sign a record. They do not queue, approve, submit, or move funds.</p>
|
|
2511
|
+
<p class="receipt-copy-helper">Signed text is exactly what your wallet signed. JSON is for sharing or later verification.</p>
|
|
2512
|
+
${uh()}
|
|
2513
|
+
${e.length?fh(e):ph()}
|
|
2514
|
+
</div>
|
|
2515
|
+
`}function dh(){return`
|
|
2516
|
+
<div class="artifact-archive-controls">
|
|
2517
|
+
<div class="template-filter-row artifact-filter-row" role="group" aria-label="Receipt archive filter">
|
|
2518
|
+
${[["all","All"],["verified","Verified"],["warnings","Warnings"],["blocked","Blocked"]].map(([t,r])=>`
|
|
2519
|
+
<button
|
|
2520
|
+
type="button"
|
|
2521
|
+
data-artifact-filter="${s(t)}"
|
|
2522
|
+
class="${a.artifactFilter===t?"active":""}"
|
|
2523
|
+
${a.busy?"disabled":""}
|
|
2524
|
+
>
|
|
2525
|
+
${s(r)}
|
|
2526
|
+
</button>
|
|
2527
|
+
`).join("")}
|
|
2528
|
+
</div>
|
|
2529
|
+
<label class="field compact">
|
|
2530
|
+
<span>Type</span>
|
|
2531
|
+
<select id="artifactTypeFilter" ${a.busy?"disabled":""}>
|
|
2532
|
+
<option value="all" ${a.artifactTypeFilter==="all"?"selected":""}>All types</option>
|
|
2533
|
+
${sa.map(t=>`<option value="${s(t.id)}" ${a.artifactTypeFilter===t.id?"selected":""}>${s(t.title)}</option>`).join("")}
|
|
2534
|
+
${Ya.map(t=>`<option value="${s(t.id)}" ${a.artifactTypeFilter===t.id?"selected":""}>Legacy / ${s(t.title)}</option>`).join("")}
|
|
2535
|
+
</select>
|
|
2536
|
+
</label>
|
|
2537
|
+
<label class="field compact artifact-search-field">
|
|
2538
|
+
<span>Search</span>
|
|
2539
|
+
<input id="artifactSearch" value="${s(a.artifactSearch)}" placeholder="Search receipts, type, wallet, hash, or intent" ${a.busy?"disabled":""} />
|
|
2540
|
+
</label>
|
|
2541
|
+
</div>
|
|
2542
|
+
`}function uh(){var r;const e=a.bridgeActive?(r=a.health)!=null&&r.labArtifactStorePath?`Bridge file: ${a.health.labArtifactStorePath}`:"Bridge archive connected":"Bridge archive unavailable",t=Pt()?"cloud-active":"cloud-inactive";return`
|
|
2543
|
+
<div class="artifact-archive-status">
|
|
2544
|
+
<span>${s(a.labArchiveStatus)}</span>
|
|
2545
|
+
<span class="cloud-evidence-status ${t}">${s(a.cloudEvidenceStatus)}</span>
|
|
2546
|
+
<strong>${s(e)}</strong>
|
|
2547
|
+
</div>
|
|
2548
|
+
`}function ph(){return`
|
|
2549
|
+
<div class="empty lab-empty-state">
|
|
2550
|
+
<span>No signed receipts</span>
|
|
2551
|
+
<h3>Archive is empty</h3>
|
|
2552
|
+
<p>Use Create Proof to add the first wallet-bound receipt.</p>
|
|
2553
|
+
</div>
|
|
2554
|
+
`}function fh(e){return`
|
|
2555
|
+
<div class="signed-artifact-list">
|
|
2556
|
+
${e.map(t=>mh(t)).join("")}
|
|
2557
|
+
</div>
|
|
2558
|
+
`}function gh(){const e=a.artifactSearch.trim().toLowerCase();return a.labArtifacts.filter(t=>a.artifactFilter==="verified"&&!t.verified||a.artifactFilter==="warnings"&&t.payload.status!=="warn"||a.artifactFilter==="blocked"&&t.payload.status!=="blocked"||a.artifactTypeFilter!=="all"&&t.labId!==a.artifactTypeFilter?!1:e?wc(t).includes(e):!0)}function wc(e){return[e.title,e.kind,e.walletAddress,e.artifactHash,e.signature,e.signingMessage,e.input,e.payload.receiptType??"",e.payload.thesis,e.payload.summary??"",e.payload.whatThisProves??"",e.payload.recommendedUse??"",Pe(e.payload.fieldValues??{}),Pe(e.metadata??{})].join(" ").toLowerCase()}function mh(e){const t=wa(e.labId),r=!t||t.category==="advanced",n=r?"Legacy receipt":ii(e.kind),o=Ac(e),c=hh(e),d=`${_(e.signature)} / ${_(e.artifactHash)}`,m=wc(e);return`
|
|
2559
|
+
<article class="signed-artifact-row receipt-proof-card ${r?"legacy":""}" data-artifact-search-text="${s(m)}">
|
|
2560
|
+
<div class="receipt-proof-head">
|
|
2561
|
+
<div>
|
|
2562
|
+
<div class="artifact-meta-line">
|
|
2563
|
+
<span class="status-pill ${e.verified?"tx-confirmed":"tx-pending"}">${e.verified?"wallet verified":"signed"}</span>
|
|
2564
|
+
<span>${s(n)}</span>
|
|
2565
|
+
${vh(e)}
|
|
2566
|
+
</div>
|
|
2567
|
+
<h3>${s(e.title||n)}</h3>
|
|
2568
|
+
<p>${s(e.payload.summary??e.payload.thesis)}</p>
|
|
2569
|
+
</div>
|
|
2570
|
+
</div>
|
|
2571
|
+
<dl class="receipt-proof-grid">
|
|
2572
|
+
${zr("What was requested",o)}
|
|
2573
|
+
${zr("What the wallet signed",e.signingMessage,"pre")}
|
|
2574
|
+
${zr("What this proves",c)}
|
|
2575
|
+
${zr("Signed by",e.walletAddress)}
|
|
2576
|
+
${zr("When",Y(e.createdAt))}
|
|
2577
|
+
${zr("Signature / hash",d,"code",`${e.signature} / ${e.artifactHash}`)}
|
|
2578
|
+
</dl>
|
|
2579
|
+
<div class="signed-artifact-actions receipt-proof-actions">
|
|
2580
|
+
<button data-copy="${s(e.signingMessage)}" data-copy-name="Signed text">Copy signed text</button>
|
|
2581
|
+
<button data-copy="${s(e.signature)}" data-copy-name="Receipt signature">Copy signature</button>
|
|
2582
|
+
<button data-copy="${s(Pe(e))}" data-copy-name="Receipt JSON">Copy JSON</button>
|
|
2583
|
+
<button data-share-receipt="${s(e.id)}">Share receipt</button>
|
|
2584
|
+
<details class="generated-plan-more signed-artifact-more">
|
|
2585
|
+
<summary>More</summary>
|
|
2586
|
+
<div>
|
|
2587
|
+
<button class="utility danger" data-artifact-delete="${s(e.id)}" ${a.busy?"disabled":""}>Delete</button>
|
|
2588
|
+
</div>
|
|
2589
|
+
</details>
|
|
2590
|
+
</div>
|
|
2591
|
+
<details class="artifact-technical-details signed-artifact-details">
|
|
2592
|
+
<summary>
|
|
2593
|
+
<span>Technical details</span>
|
|
2594
|
+
<strong>Hashes, signature, and receipt fields</strong>
|
|
2595
|
+
</summary>
|
|
2596
|
+
${bh(e)}
|
|
2597
|
+
</details>
|
|
2598
|
+
</article>
|
|
2599
|
+
`}function zr(e,t,r="text",n=t){const o=r==="pre"?`<pre>${s(t)}</pre>`:r==="code"?`<code title="${s(n)}">${s(t)}</code>`:`<p title="${s(n)}">${s(t)}</p>`;return`
|
|
2600
|
+
<div class="${r==="pre"?"wide":""}">
|
|
2601
|
+
<dt>${s(e)}</dt>
|
|
2602
|
+
<dd>${o}</dd>
|
|
2603
|
+
</div>
|
|
2604
|
+
`}function Ac(e){const t=e.payload.fieldValues??{};return t.request||t.task||t.policy||t.risks||e.input||e.payload.summary||e.payload.thesis||"Signed receipt request"}function hh(e){var t;return e.payload.whatThisProves||((t=wa(e.labId))==null?void 0:t.whatThisProves)||"This wallet signed the displayed receipt text at the recorded time."}function yh(e){return[`${e.title||ii(e.kind)}`,`Requested: ${Ac(e)}`,`Signed by: ${e.walletAddress}`,`When: ${Y(e.createdAt)}`,`Signature: ${e.signature}`,`Receipt hash: ${e.artifactHash}`].join(`
|
|
2605
|
+
`)}function ir(e,t){return`
|
|
2606
|
+
<div>
|
|
2607
|
+
<span>${s(e)}</span>
|
|
2608
|
+
<strong>${s(t)}</strong>
|
|
2609
|
+
</div>
|
|
2610
|
+
`}function vh(e){const t=!!e.cloudReceiptId,r=!!e.bridgeArchived,n=t?"Archived in Agentic Cloud":"Not archived in Agentic Cloud",o=r?"Mirrored to local bridge archive":"Not in bridge archive";return`
|
|
2611
|
+
<span class="receipt-storage-badge browser" role="status" aria-label="Saved on this device" title="Saved on this device">Browser</span>
|
|
2612
|
+
<span class="receipt-storage-badge cloud ${t?"on":"off"}" role="status" aria-label="${s(n)}" title="${s(n)}">Cloud${t?"":" off"}</span>
|
|
2613
|
+
<span class="receipt-storage-badge bridge ${r?"on":"off"}" role="status" aria-label="${s(o)}" title="${s(o)}">Bridge${r?"":" off"}</span>
|
|
2614
|
+
`}function bh(e){return`
|
|
2615
|
+
<div class="artifact-detail-grid">
|
|
2616
|
+
${ir("Receipt type",e.title)}
|
|
2617
|
+
${ir("Kind",Sa(e.kind))}
|
|
2618
|
+
${ir("Created",Y(e.createdAt))}
|
|
2619
|
+
${ir("Cluster",ft(e.cluster))}
|
|
2620
|
+
${ir("Wallet",e.walletAddress)}
|
|
2621
|
+
${ir("Receipt hash",e.artifactHash)}
|
|
2622
|
+
</div>
|
|
2623
|
+
<div class="artifact-intent-block">
|
|
2624
|
+
<span>Signed request</span>
|
|
2625
|
+
<p>${s(e.input)}</p>
|
|
2626
|
+
</div>
|
|
2627
|
+
<div class="artifact-intent-block artifact-signed-message-block">
|
|
2628
|
+
<span>Exact signed text</span>
|
|
2629
|
+
<pre>${s(e.signingMessage)}</pre>
|
|
2630
|
+
</div>
|
|
2631
|
+
${e.payload.whatThisProves||e.payload.recommendedUse?`
|
|
2632
|
+
<div class="artifact-detail-grid">
|
|
2633
|
+
${e.payload.whatThisProves?ir("What this proves",e.payload.whatThisProves):""}
|
|
2634
|
+
${e.payload.recommendedUse?ir("Recommended use",e.payload.recommendedUse):""}
|
|
2635
|
+
</div>
|
|
2636
|
+
`:""}
|
|
2637
|
+
<div class="artifact-evidence-row">
|
|
2638
|
+
${ta(e,"Verdict")}
|
|
2639
|
+
${ta(e,"Custody")}
|
|
2640
|
+
${ta(e,"Effect")}
|
|
2641
|
+
</div>
|
|
2642
|
+
<div class="artifact-evidence-list">
|
|
2643
|
+
${e.payload.evidence.map(t=>`
|
|
2644
|
+
<div class="${s(t.tone)}">
|
|
2645
|
+
<span>${s(t.title)}</span>
|
|
2646
|
+
<p>${s(t.detail)}</p>
|
|
2647
|
+
<code>${s(_(t.hash))}</code>
|
|
2648
|
+
</div>
|
|
2649
|
+
`).join("")}
|
|
2650
|
+
</div>
|
|
2651
|
+
<div class="hash-grid">
|
|
2652
|
+
${dr("Pre-signature",e.preSignatureHash)}
|
|
2653
|
+
${dr("Receipt",e.artifactHash)}
|
|
2654
|
+
${dr("Signature",e.signature)}
|
|
2655
|
+
${dr("Wallet",e.walletAddress)}
|
|
2656
|
+
</div>
|
|
2657
|
+
`}function wh(e){return`
|
|
2658
|
+
<div class="field compact lab-select-field planner-template-select">
|
|
2659
|
+
<span id="artifactPickerLabel">Proof type</span>
|
|
2660
|
+
${Ah(e)}
|
|
2661
|
+
</div>
|
|
2662
|
+
`}function Ah(e){return`
|
|
2663
|
+
<div class="template-picker artifact-picker" data-artifact-picker>
|
|
2664
|
+
<button
|
|
2665
|
+
id="artifactPickerButton"
|
|
2666
|
+
class="template-picker-trigger"
|
|
2667
|
+
type="button"
|
|
2668
|
+
aria-haspopup="listbox"
|
|
2669
|
+
aria-expanded="false"
|
|
2670
|
+
aria-controls="artifactPickerMenu"
|
|
2671
|
+
aria-labelledby="artifactPickerLabel artifactPickerValue"
|
|
2672
|
+
${a.busy?"disabled":""}
|
|
2673
|
+
>
|
|
2674
|
+
<span class="template-picker-current">
|
|
2675
|
+
<span class="template-picker-category">${s(Sa(e.kind))}</span>
|
|
2676
|
+
<strong id="artifactPickerValue">${s(e.title)}</strong>
|
|
2677
|
+
</span>
|
|
2678
|
+
<span class="template-picker-caret" aria-hidden="true"></span>
|
|
2679
|
+
</button>
|
|
2680
|
+
<div
|
|
2681
|
+
id="artifactPickerMenu"
|
|
2682
|
+
class="template-picker-menu"
|
|
2683
|
+
role="listbox"
|
|
2684
|
+
aria-labelledby="artifactPickerLabel"
|
|
2685
|
+
hidden
|
|
2686
|
+
>
|
|
2687
|
+
<div class="template-picker-group">
|
|
2688
|
+
<span>Receipt proofs</span>
|
|
2689
|
+
${sa.map(t=>Ns(t,e)).join("")}
|
|
2690
|
+
</div>
|
|
2691
|
+
<details class="template-picker-group advanced-evidence-picker">
|
|
2692
|
+
<summary>Advanced Evidence Labs</summary>
|
|
2693
|
+
<div>
|
|
2694
|
+
${Ya.map(t=>Ns(t,e)).join("")}
|
|
2695
|
+
</div>
|
|
2696
|
+
</details>
|
|
2697
|
+
</div>
|
|
2698
|
+
</div>
|
|
2699
|
+
`}function Ns(e,t){const r=e.id===t.id;return`
|
|
2700
|
+
<button
|
|
2701
|
+
class="template-picker-option ${r?"selected active":""}"
|
|
2702
|
+
type="button"
|
|
2703
|
+
role="option"
|
|
2704
|
+
aria-selected="${r?"true":"false"}"
|
|
2705
|
+
data-artifact-option="${s(e.id)}"
|
|
2706
|
+
tabindex="${r?"0":"-1"}"
|
|
2707
|
+
>
|
|
2708
|
+
<span>${s(Sa(e.kind))}</span>
|
|
2709
|
+
<strong>${s(e.title)}</strong>
|
|
2710
|
+
<em>${s(e.description)}</em>
|
|
2711
|
+
</button>
|
|
2712
|
+
`}function Sh(){return`
|
|
2713
|
+
<div class="empty lab-empty-state">
|
|
2714
|
+
<span>No receipt yet</span>
|
|
2715
|
+
<h3>Sign an evidence receipt</h3>
|
|
2716
|
+
<p>Your wallet signs a record for your archive only. No transaction is created, approved, or submitted.</p>
|
|
2717
|
+
</div>
|
|
2718
|
+
`}function $h(){const e=a.labArtifacts[0],t=a.busy?"Waiting on wallet response":a.address?a.activeTab==="agent"&&a.oneTimePlanView==="review"?"Review and finish one-time plans":a.activeTab==="agent"?"Create a one-time plan":a.activeTab==="generated"?"Review saved plans":a.activeTab==="inbox"?"Review approval inbox":a.activeTab==="schedule"?"Create recurring schedule":a.activeTab==="completed"?"Review completed plans":a.activeTab==="labs"&&a.artifactView==="signed"?"Review signed receipts":a.activeTab==="labs"?"Create a receipt proof":"Review current request":"Connect a wallet";return`
|
|
2719
|
+
<aside class="panel context-panel evidence-panel">
|
|
2720
|
+
<div class="evidence-header">
|
|
2721
|
+
<h2>${a.address?"Wallet connected":"Wallet required"}</h2>
|
|
2722
|
+
<p>${s(t)}</p>
|
|
2723
|
+
</div>
|
|
2724
|
+
<div class="evidence-rail" aria-label="Approval evidence">
|
|
2725
|
+
${lr("Intent",hd(),cr("intent"))}
|
|
2726
|
+
${lr("Policy",yd(),cr("policy"))}
|
|
2727
|
+
${lr("Wallet",vd(),cr("wallet"))}
|
|
2728
|
+
${lr("Receipt",bd(e),cr("receipt"))}
|
|
2729
|
+
</div>
|
|
2730
|
+
<details class="evidence-details">
|
|
2731
|
+
<summary>Runtime details</summary>
|
|
2732
|
+
<div class="context-stack compact-context">
|
|
2733
|
+
${Ir("Wallet",a.address?_(a.address):"Not connected",a.address?"good":"")}
|
|
2734
|
+
${Ir("Cluster",ft(a.cluster),a.cluster==="mainnet-beta"?"warn":"")}
|
|
2735
|
+
${Ir("Bridge",a.bridgeActive?"Ready":"Disconnected",a.bridgeActive?"good":"")}
|
|
2736
|
+
${Ir("Workflow inbox",`${Dt().filter(r=>!r.archived).length} action(s)`,Dt().length?"warn":"")}
|
|
2737
|
+
${Ir("Agent proof",a.agentSignature?_(a.agentSignature):"Unsigned")}
|
|
2738
|
+
${Ir("Last tx",a.txid?_(a.txid):Nb())}
|
|
2739
|
+
${Ir("Latest receipt",e?_(e.artifactHash):"No receipt")}
|
|
2740
|
+
</div>
|
|
2741
|
+
</details>
|
|
2742
|
+
<div class="custody-manifest">
|
|
2743
|
+
<h3>Signing boundary</h3>
|
|
2744
|
+
<p>Agents can prepare intent, policy, simulation, receipts, and transaction bytes. A wallet approval is still required before signing.</p>
|
|
2745
|
+
</div>
|
|
2746
|
+
</aside>
|
|
2747
|
+
`}function xh(){const e=a.labArtifacts[0],t=Dt().filter(n=>!n.archived).length;return!!a.address||t>0||!!a.agentPlan||!!a.agentSignature||!!a.signature||!!a.txid||!!e?`
|
|
2748
|
+
<details class="panel public-request-context evidence-details">
|
|
2749
|
+
<summary>Request context</summary>
|
|
2750
|
+
<div class="evidence-rail" aria-label="Approval evidence">
|
|
2751
|
+
${lr("Intent",hd(),cr("intent"))}
|
|
2752
|
+
${lr("Policy",yd(),cr("policy"))}
|
|
2753
|
+
${lr("Wallet",vd(),cr("wallet"))}
|
|
2754
|
+
${lr("Receipt",bd(e),cr("receipt"))}
|
|
2755
|
+
</div>
|
|
2756
|
+
<div class="custody-manifest compact-manifest">
|
|
2757
|
+
<h3>Signing boundary</h3>
|
|
2758
|
+
<p>Agents can prepare intent, policy, simulation, receipts, and transaction bytes. A wallet approval is still required before signing.</p>
|
|
2759
|
+
</div>
|
|
2760
|
+
</details>
|
|
2761
|
+
`:""}function kh(){var e,t,r,n,o,c,d,m,A,$,R,F,pe,we,Ce,Le,Me,Ue,Ze,xe,mt,ht,at,Se,nt,Mt,Ut,qt,ar,wr,Wr,Mr,yt,Ur,Bt,Ft,$a,xa,qr,it,ot,de,Qe,ka,Pa,Ar,Sr,Ca,$r,Ta,pn,fn,gn,Ia,Ra,Ct,xr;Ph(),Rh(),Eh();for(const h of document.querySelectorAll("[data-tab]"))h.addEventListener("click",()=>{const S=h.dataset.tab;Pn(`${Mi()??"/app"}#${S}`,"workspace"),a.activeTab=S,a.activeTab==="labs"&&(a.artifactView="create"),a.error="",M()});for(const h of document.querySelectorAll("[data-one-time-view]"))h.addEventListener("click",()=>{const S=h.dataset.oneTimeView;S&&(a.activeTab="agent",a.oneTimePlanView=S,S==="create"&&(a.generatedPlanAuditId=""),Pn(`${Mi()??"/app"}#one-time-${S}`,"one_time_plan"),M())});for(const h of document.querySelectorAll("[data-demo-scenario]"))h.addEventListener("click",()=>{const S=Gl(h.dataset.demoScenario);a.guidedDemo=_n(S.id),a.error="",M()});for(const h of document.querySelectorAll("[data-demo-action]"))h.addEventListener("click",()=>{const S=h.dataset.demoAction;if(S){if(S==="sign-receipt"){jh();return}Fh(S)}});for(const h of document.querySelectorAll("[data-first-run-action]"))h.addEventListener("click",()=>{const S=h.dataset.firstRunAction;S&&_h(S)});for(const h of document.querySelectorAll("[data-template-filter]"))h.addEventListener("click",()=>{const S=h.dataset.templateFilter;if(!S)return;a.templateOutcomeFilter=S;const ue=ha();if(S!=="all"&&Xt(ue)!==S){ji(Jg(S).id);return}M()});for(const h of document.querySelectorAll("[data-completed-filter]"))h.addEventListener("click",()=>{const S=h.dataset.completedFilter;S&&(a.completedPlanFilter=S,a.error="",M())});(e=document.querySelector("#discover"))==null||e.addEventListener("click",Hi),(t=document.querySelector("#connect"))==null||t.addEventListener("click",zi),(r=document.querySelector("#disconnect"))==null||r.addEventListener("click",Lh),(n=document.querySelector("#androidReconnectCached"))==null||n.addEventListener("click",Oh),(o=document.querySelector("#androidClearTransient"))==null||o.addEventListener("click",Dh),(c=document.querySelector("#androidFullReset"))==null||c.addEventListener("click",Nh),(d=document.querySelector("#androidClearAllAccounts"))==null||d.addEventListener("click",Wh),(m=document.querySelector("#iosReconnectCached"))==null||m.addEventListener("click",Mh),(A=document.querySelector("#iosClearTransient"))==null||A.addEventListener("click",Uh),($=document.querySelector("#iosFullReset"))==null||$.addEventListener("click",qh),(R=document.querySelector("#iosClearAllAccounts"))==null||R.addEventListener("click",Bh),(F=document.querySelector("#signMessage"))==null||F.addEventListener("click",Hh),(pe=document.querySelector("#airdrop"))==null||pe.addEventListener("click",zh),(we=document.querySelector("#createTx"))==null||we.addEventListener("click",Gh),(Ce=document.querySelector("#signTx"))==null||Ce.addEventListener("click",Kh),(Le=document.querySelector("#sendTx"))==null||Le.addEventListener("click",Yh),(Me=document.querySelector("#generatePlan"))==null||Me.addEventListener("click",Vh),(Ue=document.querySelector("#generateAiPlan"))==null||Ue.addEventListener("click",Jh),(Ze=document.querySelector("#signAgentPlan"))==null||Ze.addEventListener("click",Zh),(xe=document.querySelector("#queueAgentPlan"))==null||xe.addEventListener("click",Qh),(mt=document.querySelector("#refreshCompletedPlans"))==null||mt.addEventListener("click",Bs),(ht=document.querySelector("#toggleArchivedGeneratedPlans"))==null||ht.addEventListener("click",()=>{a.showArchivedGeneratedPlans=!a.showArchivedGeneratedPlans;const h=Wt(a.generatedPlanAuditId);!a.showArchivedGeneratedPlans&&(h==null?void 0:h.status)==="archived"&&(a.generatedPlanAuditId=""),Ot(),a.error="",M()});for(const h of document.querySelectorAll("[data-generated-plan-action]"))h.addEventListener("click",()=>{const S=h.dataset.generatedPlanAction,ue=h.dataset.generatedPlanId;!S||!ue||Xh(ue,S)});for(const h of document.querySelectorAll("[data-completed-delete]"))h.addEventListener("click",()=>{const S=h.dataset.completedDelete;S&&ey(S)});for(const h of document.querySelectorAll("[data-generated-plan-modal-close]"))h.addEventListener("click",Ki);(at=document.querySelector(".generated-plan-modal-backdrop"))==null||at.addEventListener("click",h=>{h.target===h.currentTarget&&Ki()}),(Se=document.querySelector("#saveBridgeAiKey"))==null||Se.addEventListener("click",my),(nt=document.querySelector("#saveDirectAiKey"))==null||nt.addEventListener("click",hy),(Mt=document.querySelector("#confirmAiPlanner"))==null||Mt.addEventListener("click",yy),(Ut=document.querySelector("#clearAiKey"))==null||Ut.addEventListener("click",vy),(qt=document.querySelector("#refreshAiStatus"))==null||qt.addEventListener("click",by),(ar=document.querySelector(".ai-settings-panel"))==null||ar.addEventListener("toggle",h=>{a.aiSettingsPanelOpen=h.currentTarget.open}),(wr=document.querySelector("#cloudSignIn"))==null||wr.addEventListener("click",Ec),(Wr=document.querySelector("#cloudLogout"))==null||Wr.addEventListener("click",$y);for(const h of document.querySelectorAll("[data-workflow-mode]"))h.addEventListener("click",()=>{const S=h.dataset.workflowMode;!S||!Ld(S)||xy(S)});(Mr=document.querySelector("#connectBridge"))==null||Mr.addEventListener("click",qs);for(const h of document.querySelectorAll('[data-bridge-action="connect"]'))h.addEventListener("click",qs);(yt=document.querySelector("#disconnectBridge"))==null||yt.addEventListener("click",Yy),(Ur=document.querySelector("#refreshInbox"))==null||Ur.addEventListener("click",Bs),(Bt=document.querySelector("#createRecurring"))==null||Bt.addEventListener("click",Vy),(Ft=document.querySelector("#createLabArtifact"))==null||Ft.addEventListener("click",iv),($a=document.querySelector("#refreshLabArtifacts"))==null||$a.addEventListener("click",gv),(xa=document.querySelector("#openAndroidMwaTest"))==null||xa.addEventListener("click",_d);for(const h of document.querySelectorAll("[data-start-action]"))h.addEventListener("click",()=>{h.dataset.startAction==="discover"&&Hi(),h.dataset.startAction==="connect"&&zi()});for(const h of document.querySelectorAll("[data-demo-tab]"))h.addEventListener("click",()=>{const S=h.dataset.demoTab;S&&(Pn(`/demo#${S}`,"demo_guide"),a.activeTab=S,S==="labs"&&(a.artifactView="create"),a.error="",M(),window.requestAnimationFrame(()=>{var ue;(ue=document.querySelector("#demo-workspace"))==null||ue.scrollIntoView({behavior:"smooth",block:"start"})}))});(qr=document.querySelector("#clusterSelect"))==null||qr.addEventListener("change",h=>{const S=h.currentTarget.value;gt(S)&&(a.cluster=S,fr(),a.error="",ke(),M())}),(it=document.querySelector("#walletSelect"))==null||it.addEventListener("change",h=>{a.selectedWalletName=h.currentTarget.value,fr(),a.error="",ke(),M()}),(ot=document.querySelector("#iosWalletSelect"))==null||ot.addEventListener("change",h=>{const S=h.currentTarget.value;Zv(S)&&(a.selectedIosWalletId=S,a.selectedWalletName=cn(S),fr(),a.error="",ke(),M())}),(de=document.querySelector("#bridgeUrl"))==null||de.addEventListener("input",h=>{a.bridgeUrl=h.currentTarget.value.trim(),ke()}),(Qe=document.querySelector("#bridgeToken"))==null||Qe.addEventListener("input",h=>{a.bridgeToken=h.currentTarget.value.trim(),ke()}),(ka=document.querySelector("#agentPrompt"))==null||ka.addEventListener("input",h=>{a.agentPrompt=h.currentTarget.value,delete a.templateFieldErrors.__notes,a.agentPlan=null,a.agentSignature="",a.agentPreparedActionId=""});for(const h of document.querySelectorAll("[data-template-field]"))h.addEventListener("input",()=>{const S=h.dataset.templateField;S&&(a.templateFields[S]=h.value,delete a.templateFieldErrors[S],a.agentPlan=null,a.agentSignature="",a.agentPreparedActionId="")}),h.addEventListener("change",()=>{const S=h.dataset.templateField;S&&(a.templateFields[S]=h.value)});(Pa=document.querySelector("#aiMode"))==null||Pa.addEventListener("change",h=>{const S=h.currentTarget.value,ue=S==="session"||S==="hosted"?S:"bridge";if(lc(ue)){M();return}a.aiSettings.mode=ue,Um(),It("AI path changed. Workflow capability is unchanged."),ke(),T("success","AI Planner path changed",Ay(ue)),M()}),(Ar=document.querySelector("#aiProvider"))==null||Ar.addEventListener("change",h=>{const S=bt(h.currentTarget.value);if(cc(S.id)){M();return}a.aiSettings.provider=S.id,a.aiSettings.apiFormat=S.apiFormat,a.aiSettings.baseUrl=S.baseUrl,a.aiSettings.model=S.model,It("AI provider changed. Confirm planner again if needed."),ke(),M()}),(Sr=document.querySelector("#aiBaseUrl"))==null||Sr.addEventListener("input",h=>{a.aiSettings.baseUrl=h.currentTarget.value.trim(),It("Gateway changed. Confirm planner again if needed."),ke(),Ci()}),(Ca=document.querySelector("#aiModelSelect"))==null||Ca.addEventListener("change",h=>{const S=h.currentTarget.value;a.aiSettings.model=S===Ml?"":S,It("Model changed. Confirm planner again if needed."),ke(),M()}),($r=document.querySelector("#aiModelCustom"))==null||$r.addEventListener("input",h=>{a.aiSettings.model=h.currentTarget.value.trim(),It("Model changed. Confirm planner again if needed."),ke(),Ci()}),(Ta=document.querySelector("#aiApiKey"))==null||Ta.addEventListener("input",h=>{a.aiSettings.apiKey=h.currentTarget.value,It("AI key changed. Confirm planner again if needed."),Ci()}),(pn=document.querySelector("#labInput"))==null||pn.addEventListener("input",h=>{a.labInputs[a.activeLab]=h.currentTarget.value,delete a.labFieldErrors[la(a.activeLab,"__advanced")],yc()}),(fn=document.querySelector("#labSelect"))==null||fn.addEventListener("change",h=>{a.activeLab=h.currentTarget.value,a.error="",M()});for(const h of document.querySelectorAll("[data-lab-field]"))h.addEventListener("input",()=>Os(h)),h.addEventListener("change",()=>Os(h));for(const h of document.querySelectorAll("[data-lab-action]"))h.addEventListener("click",()=>{h.dataset.labAction==="create-another"&&(qb(),a.error="",M())});for(const h of document.querySelectorAll("[data-artifact-view]"))h.addEventListener("click",()=>{const S=h.dataset.artifactView;S!=="create"&&S!=="signed"||(a.artifactView=S,a.error="",M())});for(const h of document.querySelectorAll("[data-artifact-filter]"))h.addEventListener("click",()=>{const S=h.dataset.artifactFilter;S&&(a.artifactFilter=S,a.error="",M())});(gn=document.querySelector("#artifactTypeFilter"))==null||gn.addEventListener("change",h=>{a.artifactTypeFilter=h.currentTarget.value,a.error="",M()}),(Ia=document.querySelector("#artifactSearch"))==null||Ia.addEventListener("input",h=>{a.artifactSearch=h.currentTarget.value,Fm()}),(Ra=document.querySelector("#artifactSearch"))==null||Ra.addEventListener("change",h=>{a.artifactSearch=h.currentTarget.value,a.error="",M()});for(const h of document.querySelectorAll("[data-artifact-delete]"))h.addEventListener("click",()=>{const S=h.dataset.artifactDelete;S&&mv(S)});for(const h of document.querySelectorAll("[data-share-receipt]"))h.addEventListener("click",()=>{const S=h.dataset.shareReceipt;S&&hv(S)});(Ct=document.querySelector("#txInput"))==null||Ct.addEventListener("input",h=>{a.customTransactionBase64=h.currentTarget.value.trim(),a.txSignature="",a.txid=""}),(xr=document.querySelector("#inboxFilter"))==null||xr.addEventListener("change",h=>{a.inboxFilter=h.currentTarget.value,M()});for(const h of document.querySelectorAll("[data-recurring-preset]"))h.addEventListener("click",()=>{const S=h.dataset.recurringPreset;S&&(Gb(S),M())});for(const h of document.querySelectorAll("[data-recurring-action]"))h.addEventListener("click",()=>{h.dataset.recurringAction==="dca-proof"&&ny()});for(const h of document.querySelectorAll("[data-recurring-field]"))h.addEventListener("input",()=>{const S=h.dataset.recurringField;a.recurringDraft=to(),S&&delete a.recurringErrors[`recurring${S.charAt(0).toUpperCase()}${S.slice(1)}`],Bm()}),h.addEventListener("change",()=>{const S=h.dataset.recurringField;a.recurringDraft=to(),S&&delete a.recurringErrors[`recurring${S.charAt(0).toUpperCase()}${S.slice(1)}`],M()});for(const h of document.querySelectorAll("[data-action-op]"))h.addEventListener("click",()=>{const S=h.dataset.actionId,ue=h.dataset.actionOp;!S||!ue||Jy(S,ue)});for(const h of document.querySelectorAll("[data-inline-receipt-kind]"))h.addEventListener("click",()=>{const S=h.dataset.inlineReceiptActionId,ue=h.dataset.inlineReceiptKind;!S||!ue||sv(S,ue)});for(const h of document.querySelectorAll("[data-audit-record-type][data-audit-record-id]")){const S=h.dataset.auditRecordType,ue=h.dataset.auditRecordId;h.addEventListener("toggle",()=>{if(!S||!ue)return;const vt=Va(S,ue);a.auditOpen[vt]=h.open,h.open&&Ti(S,ue)}),h.open&&S&&ue&&Ti(S,ue)}for(const h of document.querySelectorAll("[data-audit-refresh-record-type][data-audit-refresh-record-id]"))h.addEventListener("click",S=>{S.preventDefault(),S.stopPropagation();const ue=h.dataset.auditRefreshRecordType,vt=h.dataset.auditRefreshRecordId;!ue||!vt||(a.auditOpen[Va(ue,vt)]=!0,Ti(ue,vt,{force:!0}))});for(const h of document.querySelectorAll("[data-recurring-op]"))h.addEventListener("click",()=>{const S=h.dataset.recurringId,ue=h.dataset.recurringOp;!S||!ue||av(S,ue,h.dataset.recurringCursor)});for(const h of document.querySelectorAll("[data-lab]"))h.addEventListener("click",()=>{a.activeLab=h.dataset.lab??Jt[0].id,a.error="",M()});for(const h of document.querySelectorAll("[data-runtime-path]"))h.addEventListener("click",()=>{const S=Hg(h.dataset.runtimePath);S&&(a.selectedRuntimePath=S.id,a.recentCopyId="",a.error="",M())});for(const h of document.querySelectorAll("[data-copy]"))h.addEventListener("click",async()=>{const S=h.dataset.copy??"",ue=h.dataset.copyName??"Value",vt=h.dataset.copyId??Gn("copy",ue,S),Ea=h.dataset.copyToast??`${ue} copied`,Br=h.dataset.copyMessage??S;try{await navigator.clipboard.writeText(S),Gg(vt),T("success",Ea,Br);const jt=Th(S);jt&&_p(jt)}catch(jt){const _a=jt instanceof Error?jt.message:"Clipboard permission was denied.";T("error","Copy failed",_a)}M()});for(const h of document.querySelectorAll("[data-toast-dismiss]"))h.addEventListener("click",()=>is(Number(h.dataset.toastDismiss)));for(const h of document.querySelectorAll("[data-download-asset]"))h.addEventListener("click",()=>{Ep(h.dataset.downloadKind??"download",h.dataset.downloadPlatform??"unknown",h.dataset.downloadAsset??"unknown")})}function Ph(){for(const e of document.querySelectorAll("a[href]"))e.addEventListener("click",t=>{var o;if(t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;const r=new URL(e.href);if(r.origin!==window.location.origin)return;const n=an(r.pathname);if($o(n)){if(t.preventDefault(),Pn(n,Ch(e)),n==="/mwa-test"&&Ao&&((o=ns())!=null&&o.openMwaExample)){_d();return}qf(n)}})}function Ch(e){return e.closest(".homepage-nav")?"header":e.closest(".homepage-footer")?"footer":e.closest(".hero-command-area")?"hero":e.closest(".homepage-cta-actions")?"homepage_cta":e.closest(".browser-app-actions")?"workspace_cta":e.closest(".command-deck")?"runtime_deck":"internal_link"}function Th(e){return e===oa?"npm_global_install":e===ct?"npm_exec_app":e===Ga?"installed_app":null}function Ih(){return a.androidNativeEnvironment.isAndroidNative?"android_native":a.iosNativeEnvironment.isIosNative?"ios_native":"wallet_standard"}function Rh(){const e=document.querySelector("[data-template-picker]");if(!e)return;const t=e.querySelector("#templatePickerButton"),r=e.querySelector("#templatePickerMenu"),n=[...e.querySelectorAll("[data-template-option]")];if(!t||!r||n.length===0)return;const o=(d=!1)=>{var R;if(t.disabled)return;Bi(),e.classList.add("open"),t.setAttribute("aria-expanded","true"),r.hidden=!1,or(t,r),window.requestAnimationFrame(()=>or(t,r));const m=n.find(F=>F.dataset.templateOption===a.selectedTemplateId)??n[0],A=d==="first"?n[0]:d==="last"?n[n.length-1]:m;Kt(n,A,!!d),Vr=new AbortController;const{signal:$}=Vr;window.addEventListener("pointerdown",F=>{F.target instanceof Node&&e.contains(F.target)||c(!1)},{signal:$}),window.addEventListener("keydown",F=>{F.key==="Escape"&&(F.preventDefault(),c(!0))},{signal:$}),window.addEventListener("resize",()=>or(t,r),{signal:$}),(R=window.visualViewport)==null||R.addEventListener("resize",()=>or(t,r),{signal:$})},c=d=>{e.classList.remove("open"),t.setAttribute("aria-expanded","false"),r.hidden=!0,Bi(),d&&t.focus({preventScroll:!0})};t.addEventListener("click",d=>{d.stopPropagation(),r.hidden?o(!1):c(!1)}),t.addEventListener("keydown",d=>{d.key==="ArrowDown"&&(d.preventDefault(),o("selected"),sr(n,1)),d.key==="ArrowUp"&&(d.preventDefault(),o("selected"),sr(n,-1)),(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),o("selected"))}),r.addEventListener("keydown",d=>{if(d.key==="ArrowDown"&&(d.preventDefault(),sr(n,1)),d.key==="ArrowUp"&&(d.preventDefault(),sr(n,-1)),d.key==="Home"&&(d.preventDefault(),Kt(n,n[0],!0)),d.key==="End"&&(d.preventDefault(),Kt(n,n[n.length-1],!0)),d.key==="Enter"||d.key===" "){d.preventDefault();const A=(document.activeElement instanceof HTMLButtonElement?document.activeElement:n.find($=>$.classList.contains("active"))??n[0]).dataset.templateOption;if(!A)return;ji(A)||c(!0)}});for(const d of n)d.addEventListener("click",()=>{const m=d.dataset.templateOption;m&&(ji(m)||c(!0))}),d.addEventListener("pointermove",()=>Kt(n,d,!1))}function Bi(){Vr==null||Vr.abort(),Vr=null}function Eh(){const e=document.querySelector("[data-artifact-picker]");if(!e)return;const t=e.querySelector("#artifactPickerButton"),r=e.querySelector("#artifactPickerMenu"),n=[...e.querySelectorAll("[data-artifact-option]")];if(!t||!r||n.length===0)return;const o=(d=!1)=>{var R;if(t.disabled)return;Fi(),e.classList.add("open"),t.setAttribute("aria-expanded","true"),r.hidden=!1,or(t,r),window.requestAnimationFrame(()=>or(t,r));const m=n.find(F=>F.dataset.artifactOption===a.activeLab)??n[0],A=d==="first"?n[0]:d==="last"?n[n.length-1]:m;Kt(n,A,!!d),Jr=new AbortController;const{signal:$}=Jr;window.addEventListener("pointerdown",F=>{F.target instanceof Node&&e.contains(F.target)||c(!1)},{signal:$}),window.addEventListener("keydown",F=>{F.key==="Escape"&&(F.preventDefault(),c(!0))},{signal:$}),window.addEventListener("resize",()=>or(t,r),{signal:$}),(R=window.visualViewport)==null||R.addEventListener("resize",()=>or(t,r),{signal:$})},c=d=>{e.classList.remove("open"),t.setAttribute("aria-expanded","false"),r.hidden=!0,Fi(),d&&t.focus({preventScroll:!0})};t.addEventListener("click",d=>{d.stopPropagation(),r.hidden?o(!1):c(!1)}),t.addEventListener("keydown",d=>{d.key==="ArrowDown"&&(d.preventDefault(),o("selected"),sr(n,1)),d.key==="ArrowUp"&&(d.preventDefault(),o("selected"),sr(n,-1)),(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),o("selected"))}),r.addEventListener("keydown",d=>{if(d.key==="ArrowDown"&&(d.preventDefault(),sr(n,1)),d.key==="ArrowUp"&&(d.preventDefault(),sr(n,-1)),d.key==="Home"&&(d.preventDefault(),Kt(n,n[0],!0)),d.key==="End"&&(d.preventDefault(),Kt(n,n[n.length-1],!0)),d.key==="Enter"||d.key===" "){d.preventDefault();const A=(document.activeElement instanceof HTMLButtonElement?document.activeElement:n.find($=>$.classList.contains("active"))??n[0]).dataset.artifactOption;if(!A)return;Ws(A)||c(!0)}});for(const d of n)d.addEventListener("click",()=>{const m=d.dataset.artifactOption;m&&(Ws(m)||c(!0))}),d.addEventListener("pointermove",()=>Kt(n,d,!1))}function Fi(){Jr==null||Jr.abort(),Jr=null}function Ws(e){const t=Jt.find(r=>r.id===e);return!t||t.id===a.activeLab?!1:(a.activeLab=t.id,a.error="",a.labFieldErrors={},M(),!0)}function ji(e){const t=Vt(e);return t.id===a.selectedTemplateId?!1:(a.selectedTemplateId=t.id,a.templateFields={...Rt(t),...a.templateFields},a.templateFieldErrors={},a.agentPlan=null,a.agentSignature="",a.agentPreparedActionId="",M(),!0)}function or(e,t){const r=window.visualViewport,n=(r==null?void 0:r.offsetTop)??0,o=(r==null?void 0:r.width)??window.innerWidth,c=(r==null?void 0:r.height)??window.innerHeight,d=e.getBoundingClientRect(),m=n+c-10,A=Math.max(0,Math.floor(m-d.bottom-8)),$=Math.min(420,Math.max(160,A));t.classList.remove("drop-up"),t.style.setProperty("--template-menu-max-height",`${$}px`),t.style.setProperty("--template-menu-max-width",`${Math.max(220,Math.floor(o-20))}px`)}function Kt(e,t,r){for(const n of e){const o=n===t;n.classList.toggle("active",o),n.tabIndex=o?0:-1}r&&t.focus({preventScroll:!0}),t.scrollIntoView({block:"nearest"})}function sr(e,t){const r=e.findIndex(o=>o===document.activeElement||o.classList.contains("active")),n=r<0?0:(r+t+e.length)%e.length;Kt(e,e[n],!0)}async function _h(e){switch(e){case"discover-wallets":await Hi();return;case"connect-wallet":await zi();return;case"cloud-sign-in":await Ec();return;case"open-create-plan":a.activeTab="agent",a.oneTimePlanView="create",a.generatedPlanAuditId="",a.error="",M();return;case"open-review":a.activeTab="agent",a.oneTimePlanView="review",Ot(),a.error="",M();return;case"open-inbox":a.activeTab="inbox",a.inboxFilter="ready",a.error="",M();return;case"open-completed":a.activeTab="completed",a.completedPlanFilter="receipts",a.error="",M();return}}async function Hi(){await X("discover",async()=>{var e;if(a.androidNativeEnvironment.isAndroidNative){Fn("android_native","discover_button"),await id(!0),await Xr(),Zr("android_native",a.cluster,"discover_button"),T("success","Android MWA connected",_(a.address));return}if(a.iosNativeEnvironment.isIosNative){a.iosWallets=ql(),await va(),a.iosNativeStatus=`${a.iosWallets.length} iOS wallet path(s) available. Cached authorizations: ${a.iosAuthCacheCount}.`,ke(),T("success","iOS wallets ready",`${a.iosWallets.length} wallet path(s) available.`);return}if(a.wallets=[...Qd()],a.wallets.some(t=>t.name===a.selectedWalletName)||(a.selectedWalletName=((e=a.wallets[0])==null?void 0:e.name)??""),a.wallets.length===0)throw new Error("No Wallet Standard Solana wallets are registered in this browser.");ke(),T("success","Wallets discovered",`${a.wallets.length} provider(s) found.`)})}async function zi(){const e=Ih();Fn(e,"connect_button"),await X("connect",async()=>{if(a.androidNativeEnvironment.isAndroidNative){await id(!0),a.transactionStatus=`Android MWA wallet connected on ${a.cluster}.`,a.bridgeActive&&await ea(),await Xr(),ke(),Zr(e,a.cluster,"connect_button"),T("success","Android MWA connected",_(a.address));return}if(a.iosNativeEnvironment.isIosNative){Je=new Fl({walletId:a.selectedIosWalletId,cluster:a.cluster,appUrl:window.location.origin,rpcUrl:Xa(),logLevel:"info"}),qe=new ra({backend:Je}),a.address=await qe.getAddress(),a.capabilities=await qe.capabilities(),a.selectedWalletName=cn(a.selectedIosWalletId),a.iosNativeStatus=`iOS ${a.selectedWalletName} connected on ${a.cluster}.`,a.transactionStatus=`iOS wallet connected on ${a.cluster}.`,await va(),a.bridgeActive&&await ea(),await Xr(),ke(),Zr(e,a.cluster,"connect_button"),T("success","iOS wallet connected",_(a.address));return}const t=zv();Je=new Xd({wallet:t,cluster:a.cluster,rpcUrl:Xa()}),qe=new ra({backend:Je}),a.address=await qe.getAddress(),a.capabilities=await qe.capabilities(),a.transactionStatus=`Wallet connected on ${a.cluster}.`,a.bridgeActive&&await ea(),await Xr(),ke(),Zr(e,a.cluster,"connect_button"),T("success","Wallet connected",_(a.address))})}async function Lh(){await X("connect",async()=>{a.bridgeActive&&await ga().catch(()=>{}),await Yv().catch(()=>{}),fr(),await sn(),a.androidNativeEnvironment.isAndroidNative&&(a.androidNativeStatus=a.androidAuthCacheCount>0?"Android MWA disconnected locally. Cached authorization retained.":"Android MWA disconnected."),await va(),T("success","Wallet disconnected","Local signing session cleared.")})}async function Oh(){Fn("android_native","reconnect_cached"),await X("connect",async()=>{ln();const e=await gl({cluster:ei()});if(!e)throw new Error("No cached Android MWA authorization found.");await od(e),a.bridgeActive&&await ea(),await Xr(),Zr("android_native",a.cluster,"reconnect_cached"),T("success","Android MWA restored",_(a.address))})}async function Dh(){await X("connect",async()=>{ln(),await Jo().clearTransientState(),a.androidNativeStatus="Android MWA transient state cleared. Cached authorization retained.",await sn(),T("success","Android state cleared","Cached authorization retained.")})}async function Nh(){await X("connect",async()=>{ln(),a.bridgeActive&&await ga().catch(()=>{}),await Jo().clearStateFullReset(),fr(),await sn(),a.androidNativeStatus="Android MWA authorization reset. Discover again to authorize.",T("success","Android wallet reset","Authorization cleared.")})}async function Wh(){await X("connect",async()=>{ln(),a.bridgeActive&&await ga().catch(()=>{}),await Jo().clearAllCachedAuthorizations(),fr(),await sn(),a.androidNativeStatus="All Android MWA cached authorizations cleared.",T("success","Android cache cleared","All cached accounts removed.")})}async function Mh(){Fn("ios_native","reconnect_cached"),await X("connect",async()=>{ti();const e=await Bl({cluster:a.cluster,appUrl:window.location.origin,rpcUrl:Xa(),logLevel:"info"});if(!e)throw new Error("No cached iOS wallet authorization is available. Connect once first.");Je=e.backend,qe=new ra({backend:Je}),a.address=e.address,a.selectedIosWalletId=e.walletId,a.selectedWalletName=e.walletName,a.capabilities=await qe.capabilities(),a.iosAuthCacheCount=e.cacheCount,a.iosNativeStatus=`Restored cached ${e.walletName} authorization on ${a.cluster}.`,a.bridgeActive&&await ea(),await Xr(),ke(),Zr("ios_native",a.cluster,"reconnect_cached"),T("success","iOS cache restored",_(a.address))})}async function Uh(){await X("connect",async()=>{ti(),await Zo().clearTransientState("browser_demo"),a.iosNativeStatus="iOS transient callback state cleared. Auth cache retained.",T("success","iOS transient state cleared","Cached authorizations were retained.")})}async function qh(){await X("connect",async()=>{ti(),a.bridgeActive&&await ga().catch(()=>{}),await Zo().clearStateFullReset("browser_demo"),fr(),await va(),a.iosNativeStatus="iOS wallet state reset. Connect again to authorize.",T("success","iOS wallet reset","Latest authorization cleared.")})}async function Bh(){await X("connect",async()=>{ti(),a.bridgeActive&&await ga().catch(()=>{}),await Zo().clearAllCachedAuthorizations(),fr(),await va(),a.iosNativeStatus="All cached iOS wallet authorizations cleared.",T("success","iOS auth cache cleared","All cached accounts were removed.")})}function Fh(e){const t=a.guidedDemo.selectedScenarioId;switch(e){case"prepare":a.guidedDemo={..._n(t),stage:"prepared"},T("success","Demo request prepared","Review the constraints, then move it to wallet review."),M();return;case"queue":a.guidedDemo={...a.guidedDemo,stage:"queued",decision:"pending",receiptId:"",receiptCreatedAt:"",receiptJson:"",signedReceipt:""},T("success","Moved to wallet review","Approve or deny the simulated request."),M();return;case"approve":Ms("approved");return;case"deny":Ms("denied");return;case"reset":a.guidedDemo=_n(t),T("success","Demo reset","Choose a scenario or prepare the current one again."),M();return;default:return}}function Ms(e){const t=xo(),r=Nr("demo"),n=new Date().toISOString();a.guidedDemo={...a.guidedDemo,stage:"receipt",decision:e,receiptId:r,receiptCreatedAt:n,receiptJson:Pe(Sc(t,e,r,n)),signedReceipt:""},T("success",e==="approved"?"Simulation approved":"Simulation denied","Demo receipt created. Nothing was signed or submitted."),M()}function Sc(e,t,r,n,o=""){return{version:"agentic-demo-v1",demoOnly:!0,receiptId:r,receiptType:e.receiptType,createdAt:n,cluster:a.cluster,wallet:a.address||"demo-wallet",decision:t,scenario:{id:e.id,title:e.title,request:e.prompt},route:e.route,constraints:e.constraints,risk:e.risk,approvalBoundary:e.approvalBoundary,summary:e.receiptSummary,signature:o||void 0}}async function jh(){await X("sign",async()=>{if(a.guidedDemo.stage!=="receipt"||!a.guidedDemo.receiptJson)throw new Error("Complete the demo decision before signing a demo receipt.");const e=wt(),t=["Agentic demo receipt",`Receipt: ${a.guidedDemo.receiptId}`,a.guidedDemo.receiptJson].join(`
|
|
2762
|
+
`),r=await e.signMessage(t,rr("Demo receipt signature")),n=xo();a.guidedDemo.signedReceipt=r.signature,a.guidedDemo.receiptJson=Pe(Sc(n,a.guidedDemo.decision,a.guidedDemo.receiptId,a.guidedDemo.receiptCreatedAt,r.signature)),T("success","Demo receipt signed","Signature saved only inside this simulated demo.")})}async function Hh(){await X("sign",async()=>{const t=await wt().signMessage(bo,rr("Command center message signature"));a.signature=t.signature,T("success","Message signed",_(t.signature))})}async function zh(){await X("transaction",async()=>{if(a.cluster!=="devnet")throw new Error("Devnet SOL is available only when the cluster is devnet.");const e=Qo();a.transactionStatus="Requesting 1 devnet SOL from the Solana faucet...",M();const t=new oo(oi("devnet"),"confirmed"),r=await t.requestAirdrop(e,1e9);await t.confirmTransaction(r,"confirmed"),a.transactionStatus=`Airdrop confirmed: ${_(r)}. Create and sign a demo transaction now.`,T("success","Devnet SOL requested",_(r))})}async function Gh(){await X("transaction",async()=>{if(a.cluster!=="devnet")throw new Error("The built-in memo transaction is devnet-only.");const e=Qo(),t=new oo(oi("devnet"),"confirmed");if(await t.getBalance(e,"confirmed")===0)throw a.transactionStatus="This devnet account has 0 SOL. Request devnet SOL before signing the demo transaction.",new Error("Not enough devnet SOL for transaction fees. Click Request devnet SOL, then try again.");const{blockhash:n}=await t.getLatestBlockhash(),o=new ru({feePayer:e,recentBlockhash:n}).add(new au({keys:[{pubkey:e,isSigner:!0,isWritable:!1}],programId:vf,data:new TextEncoder().encode(uf)}));a.customTransactionBase64=hw(o.serialize({requireAllSignatures:!1,verifySignatures:!1})),a.txSignature="",a.txid="",a.transactionStatus="Demo transaction created. Sign it without broadcasting, or sign and send it on devnet.",T("success","Transaction created","Demo transaction ready.")})}async function Kh(){await X("transaction",async()=>{const e=wt();a.transactionStatus="Opening wallet approval for transaction signature...";const t=await e.signTransaction(a.customTransactionBase64,rr("Transaction signature request"));a.txSignature=t.signature,a.txid="",a.transactionStatus="Transaction signed by wallet. The signed transaction bytes were not broadcast.",T("success","Transaction signed","Signed bytes returned.")})}async function Yh(){await X("transaction",async()=>{var r;const e=wt();if(!((r=a.capabilities)!=null&&r.supports.signAndSendTransaction))throw new Error("Selected wallet does not support sign and send.");a.transactionStatus=`Opening wallet approval to sign and send on ${a.cluster}...`;const t=await e.signAndSendTransaction(a.customTransactionBase64,rr("Transaction broadcast request"));a.txid=t.txid??t.signature,a.txSignature="",a.transactionStatus="Transaction sent. The transaction id is shown below.",T("success","Transaction sent",_(a.txid))})}async function Vh(){const e=ha();Lp(e.id),a.activeOperation="generate-template-plan";const t=T("pending","Creating template plan","Preparing a saved plan for review.");try{await X("sign",async()=>{const r=Qc(e),n=a.agentPrompt.trim();Xc(e,r,n);const o=Al(e,r,"template",n);a.agentPlan=o,a.agentSignature="",a.agentPreparedActionId="";const c=await No(o,e,n||e.description);a.selectedGeneratedPlanId=c.id,a.oneTimePlanView="review",ur(t,"success","Plan created",`${e.title} is ready in Review & Finish.`)},{onError:r=>ur(t,"error","Template plan failed",r)})}finally{a.activeOperation=null,M()}}async function Jh(){const e=ha();Op(e.id,a.aiSettings.mode,a.aiSettings.provider),a.activeOperation="generate-ai-plan";const t=T("pending","Creating AI plan","Preparing through your configured AI Planner.");try{await X("ai",async()=>{const r=Qc(e),n=a.agentPrompt.trim();Xc(e,r,n);const o={prompt:n||e.description,userNotes:n,template:{id:e.id,category:e.category,title:e.title,description:e.description,actionType:e.actionType,risk:e.risk},parameters:r};a.aiDiagnostics=[Ha(a.aiSettings.mode==="bridge"?"/bridge/ai/generate-plan":"/api/ai/generate-plan")],M();const c=a.aiSettings.mode==="bridge"?await be("/bridge/ai/generate-plan",{method:"POST",body:JSON.stringify(o)}):a.aiSettings.mode==="hosted"?await jp(a.aiSettings,o):await Fp(a.aiSettings,o);a.agentPlan=c,a.agentSignature="",a.agentPreparedActionId="";const d=await No(c,e,o.prompt);a.selectedGeneratedPlanId=d.id,a.oneTimePlanView="review",Oo({code:"AI_PLAN_READY",message:"AI Planner returned a valid plan.",detail:`${a.aiSettings.provider} ${a.aiSettings.model||"model configured"}`}),ur(t,"success","AI plan created",`${c.templateTitle} is ready in Review & Finish.`)},{onError:(r,n)=>{const o=hc(n,r);ur(t,"error",Wm(n),o)}})}finally{a.activeOperation=null,M()}}async function Zh(){await X("sign",async()=>{if(!a.agentPlan)throw new Error("Create a plan before signing a review proof.");const e=await Rc(a.agentPlan,"Plan review proof"),t=Wt(a.selectedGeneratedPlanId);a.agentSignature=e,await $c({signature:e,status:"signed"}),t&&Lr(t.plan,a.agentPlan)&&(a.generatedPlanAuditId===t.id&&(a.generatedPlanAuditId=""),Ot()),T("success","Plan completed","Review proof saved in Completed Plans.")})}async function Qh(){await X("inbox",async()=>{if(!a.agentPlan)throw new Error("Create a plan before queueing.");const e=Wt(a.selectedGeneratedPlanId),t=await ad(a.agentPlan,e);a.agentPreparedActionId=t.id,t.mode==="agentic-cloud"&&t.planRecordId?a.selectedGeneratedPlanId=t.planRecordId:await $c({preparedActionId:t.id,status:"queued"});const r=t.planRecordId??(e==null?void 0:e.id)??"";r&&e&&Lr(e.plan,a.agentPlan)&&((a.generatedPlanAuditId===r||a.generatedPlanAuditId===e.id)&&(a.generatedPlanAuditId=""),Ot()),a.agentPlan.actionType==="recurring_payment"?a.activeTab="schedule":(a.activeTab="inbox",a.inboxFilter="ready"),t.mode==="local-bridge"?await tt():t.mode==="agentic-cloud"&&await He(),T("success",a.agentPlan.actionType==="recurring_payment"?"Recurring schedule created":"Sent to Approval Inbox",a.agentPlan.actionType==="recurring_payment"?t.mode==="browser-workflow"?"Created one local approval now. Browser workflow does not run background schedules after this tab closes.":"Future occurrences will appear in Approval Inbox.":t.mode==="agentic-cloud"?"Saved to Agentic Cloud. No localhost required.":t.mode==="browser-workflow"?"Saved to the browser workflow on this device.":t.id)})}async function Xh(e,t){const r=Wt(e);if(r){if(t==="view"){a.selectedGeneratedPlanId=e,a.generatedPlanAuditId=e,a.error="",M();return}if(t==="reuse"||t==="make-active"){ay(r),T("success","Starting point loaded",`${r.plan.templateTitle} is ready in Create Plan.`),M();return}if(t==="archive"){await Ja(e,{status:"archived"}),a.generatedPlanAuditId===e&&(a.generatedPlanAuditId=""),Ot(),T("success","Plan archived",r.plan.templateTitle),M();return}if(t==="restore"){await Ja(e,{status:py(r)}),a.selectedGeneratedPlanId=e,T("success","Plan restored",r.plan.templateTitle),M();return}if(t==="delete"){if(!window.confirm("Delete this plan permanently?"))return;r.workflowSource==="cloud"&&await fe(`/api/plans/${encodeURIComponent(e)}`,{method:"DELETE"}),a.generatedPlans=a.generatedPlans.filter(n=>n.id!==e),a.generatedPlanAuditId===e&&(a.generatedPlanAuditId=""),si(),Ot(),T("success","Plan deleted",r.plan.templateTitle),M();return}if(t==="sign-proof"){await ty(e);return}t==="queue"&&await ry(e)}}async function ey(e){const t=tr().find(r=>r.id===e);t&&window.confirm("Delete this completed plan from history?")&&await X("inbox",async()=>{if(t.workflowSource==="cloud"&&t.kind==="recurring"&&t.recurringId&&t.id.startsWith("recurring:")){await Mc(t.recurringId),a.cloudCompletedPlans=a.cloudCompletedPlans.filter(r=>r.id!==t.id),await He().catch(()=>{}),T("success","Completed plan deleted",t.title);return}if(t.workflowSource==="cloud"){await fe(`/api/completed/${encodeURIComponent(t.id)}`,{method:"DELETE"}),a.cloudCompletedPlans=a.cloudCompletedPlans.filter(r=>r.id!==t.id),await He().catch(()=>{}),T("success","Completed plan deleted",t.title);return}if(t.actionId)if(De(t.actionId))a.preparedActions=a.preparedActions.filter(r=>r.id!==t.actionId),a.materializedActions=a.preparedActions,a.receipts=a.receipts.filter(r=>r.actionId!==t.actionId),kt();else{if(!a.bridgeActive)throw new Error("Connect the local bridge before deleting bridge-backed history.");await be("/bridge/prepared-actions/delete",{method:"POST",body:JSON.stringify({actionId:t.actionId})})}if(Gi(t)&&t.recurringId)if(t.workflowSource==="browser"||De(t.recurringId))a.recurringPayments=a.recurringPayments.filter(r=>r.id!==t.recurringId),kt();else{if(!a.bridgeActive)throw new Error("Connect the local bridge before deleting recurring history.");await be("/bridge/recurring-payments/delete",{method:"POST",body:JSON.stringify({recurringId:t.recurringId})})}t.generatedPlanId&&(a.generatedPlans=a.generatedPlans.filter(r=>r.id!==t.generatedPlanId),a.selectedGeneratedPlanId===t.generatedPlanId&&Ot(),a.generatedPlanAuditId===t.generatedPlanId&&(a.generatedPlanAuditId=""),si()),a.bridgeActive&&(t.actionId||Gi(t))&&await tt(),T("success","Completed plan deleted",t.title)})}async function ty(e){await X("sign",async()=>{const t=Pc(e);if(t.status==="archived")throw new Error("Restore this plan before signing a review proof.");const r=await Rc(t.plan,"Plan review proof");await Ja(e,{signature:r,status:"signed"}),a.generatedPlanAuditId===e&&(a.generatedPlanAuditId=""),Ot(),a.agentPlan&&Lr(a.agentPlan,t.plan)&&(a.agentSignature=r),T("success","Plan completed","Review proof saved in Completed Plans.")})}async function ry(e){await X("inbox",async()=>{const t=Pc(e);if(t.status==="archived")throw new Error("Restore this plan before queueing it.");rd(t.plan);const r=await ad(t.plan,t);r.mode==="agentic-cloud"&&r.planRecordId?a.selectedGeneratedPlanId=r.planRecordId:await Ja(e,{preparedActionId:r.id,status:"queued"}),(a.generatedPlanAuditId===e||r.planRecordId&&a.generatedPlanAuditId===r.planRecordId)&&(a.generatedPlanAuditId=""),Ot(),a.agentPlan&&Lr(a.agentPlan,t.plan)&&(a.agentPreparedActionId=r.id),t.plan.actionType==="recurring_payment"?a.activeTab="schedule":(a.activeTab="inbox",a.inboxFilter="ready"),r.mode==="local-bridge"?await tt():r.mode==="agentic-cloud"&&await He(),T("success",t.plan.actionType==="recurring_payment"?"Recurring schedule created":"Sent to Approval Inbox",t.plan.actionType==="recurring_payment"?r.mode==="browser-workflow"?"Created one local approval now. Browser workflow does not run background schedules after this tab closes.":"Future occurrences will appear in Approval Inbox.":r.mode==="agentic-cloud"?"Saved to Agentic Cloud. No localhost required.":r.mode==="browser-workflow"?"Saved to the browser workflow on this device.":r.id)})}async function No(e,t,r){if(te()==="agentic-cloud"&&e.actionType!=="recurring_payment"){const c=Lc(await fe("/api/plans",{method:"POST",body:JSON.stringify({plan:e,source:e.source,templateId:t.id,templateTitle:t.title,prompt:r,cluster:a.cluster,status:"draft"})})),d=Ho(c);if(!d)throw new Error("Agentic Cloud did not return a valid plan draft.");return a.generatedPlans=da([d],a.generatedPlans.filter(m=>m.id!==d.id)),d}const n=new Date().toISOString(),o={id:Nr("plan"),plan:e,createdAt:n,updatedAt:n,source:e.source,templateId:t.id,templateTitle:t.title,prompt:r,walletAddress:a.address,cluster:a.cluster,status:"draft",workflowSource:te()==="local-bridge"?"local-bridge":"browser"};return a.generatedPlans=da([o],a.generatedPlans),si(),o}async function Ja(e,t){const r=Wt(e);if((r==null?void 0:r.workflowSource)==="cloud"){const o=Lc(await fe(`/api/plans/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify({...t.status!==void 0&&{status:t.status},...t.signature!==void 0&&{signature:t.signature},...t.preparedActionId!==void 0&&{approvalRequestId:t.preparedActionId}})})),c=Ho(o);if(!c)throw new Error("Agentic Cloud did not return a valid plan update.");a.generatedPlans=da([c],a.generatedPlans.filter(d=>d.id!==e));return}const n=new Date().toISOString();a.generatedPlans=a.generatedPlans.map(o=>o.id!==e?o:{...o,...t,updatedAt:n}),si()}async function $c(e){if(!a.agentPlan)return;const t=Wt(a.selectedGeneratedPlanId);t&&Lr(t.plan,a.agentPlan)&&await Ja(t.id,e)}function ay(e){const t=Vt(e.templateId);a.selectedTemplateId=t.id,a.templateOutcomeFilter=Xt(t),a.templateFields={...Rt(t),...e.plan.parameters},a.templateFieldErrors={},a.agentPrompt=e.plan.userNotes||e.prompt||t.description,a.agentPlan=null,a.agentSignature="",a.agentPreparedActionId="",a.selectedGeneratedPlanId=e.id,a.generatedPlanAuditId="",a.activeTab="agent",a.oneTimePlanView="create",a.error=""}function ny(){const e=Vt("dca");a.selectedTemplateId=e.id,a.templateOutcomeFilter=Xt(e),a.templateFields={...Rt(e),token:a.recurringDraft.token||Rt(e).token||"",amount:a.recurringDraft.amount||Rt(e).amount||"",recipient:a.recurringDraft.recipient||"",cadence:a.recurringDraft.cadence||Rt(e).cadence||"weekly",memo:a.recurringDraft.note||Rt(e).memo||"Recurring DCA approval"},a.templateFieldErrors={},a.agentPrompt="Create a review proof for this recurring DCA strategy before any active schedule is created.",a.agentPlan=null,a.agentSignature="",a.agentPreparedActionId="",a.activeTab="agent",a.oneTimePlanView="create",a.error="",T("success","DCA review proof selected","This creates evidence only. Active recurring schedules use the selected workflow and each run still returns to Approval Inbox."),M()}function pa(e=!1){const t=te(),r=t==="agentic-cloud"?a.generatedPlans.filter(n=>n.workflowSource==="cloud"):t==="local-bridge"?a.generatedPlans.filter(n=>n.workflowSource==="local-bridge"):a.generatedPlans.filter(n=>n.workflowSource==="browser"||!n.workflowSource);return e?r.filter(Yn):r}function Yn(e){return e.plan.actionType!=="recurring_payment"}function xc(e=!1){return pa(e).filter(iy)}function iy(e){return e.status==="archived"?a.showArchivedGeneratedPlans:Vn(e)}function Vn(e){return e.status!=="archived"&&!Jn(e)}function Jn(e){return!!(e.signature||e.preparedActionId||e.status==="signed"||e.status==="queued")}function tr(){const e=te();if(e==="agentic-cloud")return[...a.cloudCompletedPlans].sort(($,R)=>R.completedAt.localeCompare($.completedAt));const t=e==="browser-workflow"?a.preparedActions.filter($=>De($.id)):a.preparedActions.filter($=>$.workflowSource==="local-bridge"),r=e==="browser-workflow"?a.receipts.filter($=>De($.actionId)):a.receipts.filter($=>!De($.actionId)),n=e==="browser-workflow"?a.generatedPlans.filter($=>$.workflowSource==="browser"||!$.workflowSource):a.generatedPlans.filter($=>$.workflowSource==="local-bridge"),o=new Map(r.map($=>[$.actionId,$])),c=new Map(t.map($=>[$.id,$])),d=new Set,m=[];for(const $ of n.filter(Yn)){const R=$.preparedActionId?c.get($.preparedActionId):void 0,F=$.preparedActionId?o.get($.preparedActionId):void 0,pe=!!(R&&Lt(R)),we=!!($.preparedActionId&&!F&&!pe);(F||pe||$.signature&&!we)&&(m.push(sy($,F,R)),$.preparedActionId&&d.add($.preparedActionId))}for(const $ of r)d.has($.actionId)||(m.push(ly($,c.get($.actionId))),d.add($.actionId));for(const $ of t)d.has($.id)||!Lt($)||(m.push(cy($)),d.add($.id));const A=ba();for(const $ of A.filter(Za))m.push(dy($));return m.sort(($,R)=>R.completedAt.localeCompare($.completedAt))}function lt(e){var n;const t=tr(),r=e?t.find(o=>o.actionId===e||o.id.includes(e)):t[0];a.activeTab="completed",a.completedPlanFilter="receipts",a.lastCompletedFocusId=(r==null?void 0:r.id)??e??((n=t[0])==null?void 0:n.id)??""}function oy(e=tr()){switch(a.completedPlanFilter){case"one-time":return e.filter(t=>t.kind==="one-time");case"recurring":return e.filter(t=>t.kind==="recurring");case"proofs":return e.filter(t=>!!t.signature);case"receipts":return e.filter(t=>!!(t.actionId||t.txid));case"all":return e}}function sy(e,t,r){const n=(t==null?void 0:t.status)??(r&&Lt(r)?r.status:void 0),o=(t==null?void 0:t.txStatus)??(r==null?void 0:r.txStatus),c=(t==null?void 0:t.txid)??(r==null?void 0:r.txid),d=(t==null?void 0:t.actionId)??(r==null?void 0:r.id)??e.preparedActionId,m=n?Wo(n,o):e.status==="archived"?"archived":"proof signed",A=(t==null?void 0:t.completedAt)??kc(r)??e.updatedAt,$=(t==null?void 0:t.amount)??(r?Zt(r):St(e.plan,["amountSol","amount","inputAmount","plannedAmount"])),R=(t==null?void 0:t.token)??(r?Qt(r):St(e.plan,["token","inputToken","outputToken"])),F=(t==null?void 0:t.recipient)??(r?yr(r):St(e.plan,["recipient","recipientAddress"])),pe=e.workflowSource??(r==null?void 0:r.workflowSource)??(d&&De(d)?"browser":void 0),we={type:"completed_one_time_plan",status:m,plan:e.plan,signature:e.signature,actionId:(t==null?void 0:t.actionId)??(r==null?void 0:r.id)??e.preparedActionId,txid:(t==null?void 0:t.txid)??(r==null?void 0:r.txid),completedAt:A};return{id:`generated:${e.id}`,kind:"one-time",status:m,tone:n?Mo(n,o):e.status==="archived"?"neutral":"tx-confirmed",title:e.plan.intent,summary:e.plan.risk,completedAt:A,createdAt:e.createdAt,walletAddress:(t==null?void 0:t.walletAddress)??(r==null?void 0:r.walletAddress)??e.walletAddress,cluster:(t==null?void 0:t.cluster)??(r==null?void 0:r.cluster)??e.cluster,...$&&{amount:$},...R&&{token:R},...F&&{recipient:F},...e.signature&&{signature:e.signature},...c?{txid:c}:{},...(t==null?void 0:t.explorerUrl)&&{explorerUrl:t.explorerUrl},generatedPlanId:e.id,...d?{actionId:d}:{},...pe?{workflowSource:pe}:{},copyPayload:Pe(we),detailRows:fa([["Type","One-time plan"],["Status",m],["Template",e.templateTitle],["Action",e.plan.actionType.replace(/_/g," ")],["Source",dd(e.plan)],["Wallet",((t==null?void 0:t.walletAddress)??(r==null?void 0:r.walletAddress)??e.walletAddress)||"No wallet at creation"],["Created",Y(e.createdAt)],["Completed",Y(A)],d?["Approval id",d]:void 0,e.signature?["Review proof",e.signature]:void 0,c?["Transaction",c]:void 0,["Approval rule",e.plan.approval],["Route",e.plan.route]])}}function ly(e,t){const r=e.recurringId||t!=null&&t.recurringId?"recurring":"one-time",n=Wo(e.status,e.txStatus),o=e.recurringId??(t==null?void 0:t.recurringId),c=e.occurrenceKey??(t==null?void 0:t.occurrenceKey),d=(t==null?void 0:t.workflowSource)??(De(e.actionId)?"browser":void 0),m={type:r==="recurring"?"completed_recurring_occurrence":"completed_one_time_approval",receipt:e,action:t};return{id:`receipt:${e.actionId}`,kind:r,status:n,tone:Mo(e.status,e.txStatus),title:e.summary,summary:e.note??e.summary,completedAt:e.completedAt,createdAt:e.createdAt,walletAddress:e.walletAddress,cluster:e.cluster,...e.amount&&{amount:e.amount},...e.token&&{token:e.token},...e.recipient&&{recipient:e.recipient},...e.txid&&{txid:e.txid},...e.explorerUrl&&{explorerUrl:e.explorerUrl},...e.proofSignature&&{signature:e.proofSignature},actionId:e.actionId,...o?{recurringId:o}:{},...c?{occurrenceKey:c}:{},...d?{workflowSource:d}:{},copyPayload:Pe(m),detailRows:fa([["Type",r==="recurring"?"Recurring occurrence":"One-time approval"],["Status",n],["Action id",e.actionId],o?["Recurring id",o]:void 0,c?["Occurrence",c]:void 0,["Wallet",e.walletAddress],e.recipient?["Recipient",e.recipient]:void 0,e.amount?["Amount",`${e.amount} ${e.token??""}`.trim()]:void 0,["Created",Y(e.createdAt)],["Completed",Y(e.completedAt)],e.proofSignature?["Decision proof",e.proofSignature]:void 0,e.txid?["Transaction",e.txid]:void 0,e.error?["Error",e.error]:void 0])}}function cy(e){const t=e.recurringId?"recurring":"one-time",r=e.archived?"cancelled":Wo(e.status,e.txStatus),n=kc(e)??e.updatedAt,o=yr(e),c=Zt(e),d=Qt(e);return{id:`action:${e.id}`,kind:t,status:r,tone:e.archived?"neutral":Mo(e.status,e.txStatus),title:e.summary,summary:e.note??e.summary,completedAt:n,createdAt:e.createdAt,walletAddress:e.walletAddress,cluster:e.cluster,...c!=="n/a"&&{amount:c},...d!=="n/a"&&{token:d},...o&&{recipient:o},...e.txid&&{txid:e.txid},actionId:e.id,...e.recurringId&&{recurringId:e.recurringId},...e.occurrenceKey&&{occurrenceKey:e.occurrenceKey},...e.workflowSource?{workflowSource:e.workflowSource}:{},copyPayload:Pe({type:t==="recurring"?"completed_recurring_occurrence":"completed_one_time_approval",action:e}),detailRows:fa([["Type",t==="recurring"?"Recurring occurrence":"One-time approval"],["Status",r],["Action id",e.id],e.recurringId?["Recurring id",e.recurringId]:void 0,e.occurrenceKey?["Occurrence",e.occurrenceKey]:void 0,["Wallet",e.walletAddress],o?["Recipient",o]:void 0,c!=="n/a"?["Amount",`${c} ${d!=="n/a"?d:""}`.trim()]:void 0,["Created",Y(e.createdAt)],["Completed",Y(n)],e.txid?["Transaction",e.txid]:void 0,e.error?["Error",e.error]:void 0])}}function dy(e){const t=e.occurrencesCreated??0,r=e.maxOccurrences??t,n=`${e.amount} ${e.token} recurring plan completed`;return{id:`recurring-schedule:${e.id}`,kind:"recurring",status:"schedule complete",tone:"tx-confirmed",title:n,summary:`Reached ${t} of ${r} scheduled occurrence${r===1?"":"s"}.`,completedAt:e.updatedAt,createdAt:e.createdAt,walletAddress:e.walletAddress,cluster:e.cluster,amount:e.amount,token:e.token,recipient:e.recipient,recurringId:e.id,workflowSource:gr(e),copyPayload:Pe({type:"completed_recurring_schedule",recurringPayment:e}),detailRows:fa([["Type","Recurring schedule"],["Status","schedule complete"],["Recurring id",e.id],["Wallet",e.walletAddress],["Recipient",e.recipient],["Amount",`${e.amount} ${e.token}`],["Cadence",e.cadence],["Schedule",Ad(e)],["Occurrences",`${t} of ${r}`],["Created",Y(e.createdAt)],["Completed",Y(e.updatedAt)],e.note?["Note",e.note]:void 0])}}function fa(e){return e.filter(t=>!!(t&&t[1]))}function Lt(e){return!!e.archived||uy(e.status)}function uy(e){return e==="approved"||e==="rejected"||e==="cancelled"||e==="blocked"||e==="failed"||e==="expired"}function kc(e){if(!(!e||!Lt(e)))return e.archived?e.updatedAt:e.confirmedAt??e.updatedAt}function Wo(e,t){return t==="confirmed"?"approved":t==="failed"?"failed":e}function Mo(e,t){return t==="failed"||e==="failed"||e==="blocked"||e==="rejected"||e==="cancelled"||e==="expired"?"tx-failed":e==="approved"||t==="confirmed"?"tx-confirmed":"neutral"}function Za(e){return e.maxOccurrences!==void 0&&(e.occurrencesCreated??0)>=e.maxOccurrences}function Gi(e){return e.id.startsWith("recurring-schedule:")}function St(e,t){for(const r of t){const n=e.parameters[r];if(n!=null&&n.trim())return n}return""}function Zn(){const e=Wt(a.selectedGeneratedPlanId);if(e&&!(!a.showArchivedGeneratedPlans&&e.status==="archived"))return e}function Wt(e){return a.generatedPlans.find(t=>t.id===e)}function Pc(e){const t=Wt(e);if(!t)throw new Error("Plan was not found.");return t}function Ot(){const e=xc()[0]??a.generatedPlans[0];a.selectedGeneratedPlanId=(e==null?void 0:e.id)??"",a.generatedPlanAuditId&&!Wt(a.generatedPlanAuditId)&&(a.generatedPlanAuditId="")}function Ki(){a.generatedPlanAuditId="",M()}function py(e){return e.preparedActionId?"queued":e.signature?"signed":"draft"}function Uo(e){return e.status==="archived"?"archived":e.preparedActionId||e.status==="queued"?"queued":e.signature||e.status==="signed"?"proof signed":"needs review"}function Cc(e){return e.status==="archived"?"neutral":e.preparedActionId||e.status==="queued"?"tx-pending":e.signature||e.status==="signed"?"tx-confirmed":"neutral"}function fy(e){const t=e.walletAddress?_(e.walletAddress):"No wallet at creation";return`${Y(e.createdAt)} · ${ft(e.cluster)} · ${t}`}function Tc(e){return e.status==="archived"?"Restore this plan before signing review evidence.":a.address?e.signature?"Sign a fresh review proof. This does not queue, approve, or submit a transaction.":"Sign that you reviewed this plan. This creates audit evidence only.":"Connect a wallet before signing a review proof."}function Ic(e){if(e.status==="archived")return"Restore this plan before queueing it.";if(!a.address)return"Connect a wallet before queueing.";if(!_t(e.plan))return"Only transfers, swaps, and recurring schedules can be queued.";const t=ya(e.plan);if((t==null?void 0:t.verdict)==="block")return t.summary;const r=te();return e.plan.actionType==="recurring_payment"?r==="agentic-cloud"?"Create an Agentic Cloud recurring schedule. Each due occurrence appears in Approval Inbox.":r==="local-bridge"?"Create a local recurring schedule. Each due occurrence appears in Approval Inbox.":"Create one browser-local recurring approval now. Background scheduling needs Agentic Cloud or Private local mode.":r==="agentic-cloud"?"Send this plan to Agentic Cloud Approval Inbox for wallet review.":r==="local-bridge"?"Send this plan to the local Approval Inbox for wallet review.":"Send this plan to the browser Approval Inbox. It stays local to this device."}function Lr(e,t){return Pe(e)===Pe(t)}async function Rc(e,t){return(await wt().signMessage(gy(e),rr(t))).signature}function gy(e){return["Solana Agent Wallet Adapter plan review proof",`Address: ${a.address}`,`Cluster: ${a.cluster}`,`Source: ${e.source}`,`Template: ${e.templateTitle}`,`Action: ${e.actionType}`,`Prepared by: ${cd(e)}`,`Intent: ${e.intent}`,`Route: ${e.route}`,`Risk: ${e.risk}`,`Approval: ${e.approval}`,`Parameters: ${Pe(e.parameters)}`,`User notes: ${e.userNotes||"None"}`,`Safeguards: ${e.safeguards.join(" | ")}`,`Time: ${new Date().toISOString()}`].join(`
|
|
2763
|
+
`)}async function my(){await X("ai",async()=>{await be("/bridge/ai/session-key",{method:"POST",body:JSON.stringify({apiKey:a.aiSettings.apiKey,baseUrl:a.aiSettings.baseUrl,model:a.aiSettings.model,provider:a.aiSettings.provider,apiFormat:a.aiSettings.apiFormat})}),await on(!0),It("Bridge key changed. Confirm planner again if needed.");const e=await Zc();T("success","Bridge AI key set",e?"The key is held in local bridge memory and the approval bridge is connected.":"The key is held in local bridge memory. Connect a wallet, then check the local bridge.")},{async onError(e){if(a.error="",Xn(e)){await Vo("AI bridge offline");return}T("error","AI setup failed",e)}})}async function hy(){if(!_o()){T("error","AI setup incomplete",Kn()),M();return}await X("ai",async()=>{It("AI draft key saved. Confirm planner before generating if you want a route or config check."),Oo(Ha("/api/ai/generate-plan")),T("success",a.aiSettings.mode==="hosted"?"Hosted BYOK key entered":"Browser session key entered",a.aiSettings.mode==="hosted"?"Hosted BYOK will relay only submitted AI draft requests. Queueing, schedules, and signing stay in the active workflow.":"Browser session AI can draft plans in this tab. Queueing, schedules, and signing stay in the active workflow.")})}async function yy(){if(!Nn()){const t=Wn();Wa("failed",t),T("error","Planner check unavailable",t),M();return}a.activeOperation="confirm-ai-planner";const e=T("pending","Confirming planner","Checking the selected AI draft route.");try{await X("ai",async()=>{var t;if(a.aiSettings.mode==="bridge"){if(a.aiDiagnostics=[Ha("/bridge/ai/status","GET")],await on(!0),!((t=a.aiStatus)!=null&&t.available))throw new Error("Local bridge AI is not configured. Set a bridge key or AGENTIC_AI_API_KEY, then confirm again.");const r=`${a.aiStatus.source} - ${a.aiStatus.provider??a.aiStatus.apiFormat??"AI"} - ${a.aiStatus.model??"model configured"}`;a.aiDiagnostics=[Ha("/bridge/ai/status","GET"),{code:"AI_PLAN_READY",message:"Local bridge AI planner confirmed. No plan was generated.",detail:r,method:"GET",path:"/bridge/ai/status"}],Wa("confirmed","Local bridge AI is configured and reachable for drafts only. Workflow capability is unchanged."),ur(e,"success","Planner confirmed","Local bridge AI can draft plans only.");return}if(a.aiSettings.mode==="hosted"){a.aiDiagnostics=await Hp(a.aiSettings),Wa("confirmed","Hosted BYOK route is reachable for draft requests only. Provider key validity is checked on the first AI draft. Workflow capability is unchanged."),ur(e,"success","Planner confirmed","Hosted BYOK can draft plans only.");return}if(a.aiSettings.provider==="openai")throw new Error(Or);if(!a.aiSettings.apiKey.trim()||!a.aiSettings.model.trim()||!er())throw new Error(Wn());a.aiDiagnostics=[Ha("browser-session"),{code:"AI_PLAN_READY",message:"Browser session planner configuration confirmed. No provider request was made.",detail:Wl.join(" ")}],Wa("confirmed","Browser session AI config was checked for this tab. No provider request was made; it drafts only and workflow capability is unchanged."),ur(e,"success","Planner confirmed","Browser session AI can draft plans only.")},{onError(t,r){const n=hc(r,t);Wa("failed",n),ur(e,"error",Mm(r),n)}})}finally{a.activeOperation=null,M()}}async function vy(){await X("ai",async()=>{a.aiSettings.apiKey="",It("AI key cleared."),a.aiSettings.mode==="bridge"&&(await be("/bridge/ai/session-key",{method:"POST",body:JSON.stringify({clear:!0})}).catch(()=>{}),await on(!1)),T("success","AI key cleared",wy())})}async function by(){await X("ai",async()=>{var t;await on(!0),a.aiSettings.apiKey="",It("Bridge AI status refreshed. Confirm planner again if needed.");const e=await Zc();T("success","AI status refreshed",(t=a.aiStatus)!=null&&t.available?e?"Bridge AI is available and the approval bridge is connected.":"Bridge AI is available. Connect a wallet, then check the local bridge.":"Bridge AI is not configured.")},{async onError(e){if(a.error="",Xn(e)){await Vo("AI bridge offline");return}T("error","AI status unavailable",e)}})}function wy(){return a.aiSettings.mode==="hosted"?"Hosted BYOK key removed from this browser session.":a.aiSettings.mode==="session"?"Browser session key removed from this app.":"Session key removed from this app and local bridge memory."}function Ay(e){return e==="bridge"?"Local bridge AI can draft plans in private local mode.":e==="hosted"?"Hosted BYOK drafts plans only. Workflow actions still require explicit wallet review.":"Browser session AI drafts plans only and keeps the key in this tab."}function te(){return a.workflowModePreference==="local-bridge"&&a.bridgeActive?"local-bridge":Pt()?"agentic-cloud":"browser-workflow"}function Ve(){switch(te()){case"agentic-cloud":return"Agentic Cloud workspace";case"local-bridge":return"Private local mode";case"browser-workflow":return"Browser workflow"}}function Pt(){return!!(a.address&&a.cloudSession.status==="signed-in"&&a.cloudSession.walletAddress===a.address)}function Sy(){return!!(a.address&&a.cloudSession.status==="signed-in"&&a.cloudSession.walletAddress&&a.cloudSession.walletAddress!==a.address)}async function Xr(){await qo(),Pt()?await He().catch(e=>{a.cloudSession={...a.cloudSession,error:e instanceof Error?e.message:String(e)}}):te()==="browser-workflow"&&Fo()}async function Ec(){await X("connect",async()=>{if(!a.address)throw new Error("Connect a wallet before signing in to Agentic Cloud.");const e=wt(),t=zu(await fe("/api/auth/nonce",{method:"POST",body:JSON.stringify({walletAddress:a.address})})),r=Kr(t.message,"Auth message"),n=Kr(t.nonce,"Auth nonce"),o=await e.signMessage(r,rr("Agentic Cloud sign-in")),c=sl(await fe("/api/auth/verify-wallet",{method:"POST",body:JSON.stringify({walletAddress:a.address,nonce:n,message:r,signature:o.signature,domain:Kr(t.domain,"Auth domain"),issuedAt:Kr(t.issuedAt,"Auth issued time"),expiresAt:Kr(t.expiresAt,"Auth expiration time"),signatureEncoding:"base58"})}));a.cloudSession=_c(c),a.workflowModePreference="auto",ke(),await He(),T("success","Cloud workspace signed in",_(a.address))})}async function $y(){await X("connect",async()=>{await fe("/api/auth/logout",{method:"POST"}).catch(()=>{}),a.cloudSession=jo("signed-out"),a.cloudCompletedPlans=[],a.cloudLastSync="",a.cloudEvidenceStatus="Cloud evidence archive: sign in to also store receipts in Agentic Cloud.",Fo(),T("success","Cloud workspace signed out","Browser workflow fallback is active on this device.")})}async function xy(e){await X("bridge",async()=>{if(e==="local-bridge"&&!a.bridgeActive)throw new Error("Connect the local bridge before using private local mode.");a.workflowModePreference=e,ke(),await Bo(),T("success",e==="local-bridge"?"Private local mode active":"Workspace mode updated",`${Ve()} will handle new one-time workflow actions.`)})}async function qo(e){try{const t=sl(await fe("/api/session",{method:"GET"}));a.cloudSession=_c(t)}catch(t){const r=t instanceof Error?t.message:String(t);a.cloudSession={status:"unavailable",walletAddress:"",expiresAt:"",error:r}}}async function Bo(){switch(te()){case"agentic-cloud":await He();return;case"local-bridge":await tt();return;case"browser-workflow":Fo();return}}function Fo(){const e=os();a.preparedActions=e.preparedActions,a.materializedActions=e.preparedActions,a.recurringPayments=e.recurringPayments,a.receipts=e.receipts}async function He(){if(a.cloudSession.status!=="signed-in")throw new Error("Sign in to Agentic Cloud before loading cloud workflow data.");const e=await Oy().catch(R=>(console.warn("Cloud recurring API unavailable:",R),{schedules:[],occurrences:[],views:void 0})),[t,r,n]=await Promise.all([fe("/api/plans",{method:"GET"}).then(R=>Gu(R)),fe("/api/approvals",{method:"GET"}).then(R=>Ku(R)),fe("/api/completed",{method:"GET"}).then(R=>Vu(R))]),o=t.plans.map(Ho).filter(cs),c=a.generatedPlans.filter(R=>R.workflowSource!=="cloud");a.generatedPlans=da(o,c);const d=new Map;for(const R of e.schedules)R&&typeof R=="object"&&typeof R.id=="string"&&d.set(R.id,R);const m=r.approvals.map(Oc).filter(ls);a.preparedActions=vr(m),a.materializedActions=a.preparedActions,a.recurringPayments=e.schedules.filter(R=>R.status==="active"||R.status==="paused").map(R=>{var F;return Dc(R,(F=e.views)==null?void 0:F[R.id])}).filter(R=>!!R);const A=n.completed.map(Ey).filter(R=>!!R),$=e.schedules.filter(R=>R.status==="completed"||R.status==="cancelled").map(_y).filter(R=>!!R);a.cloudCompletedPlans=[...A,...$].sort((R,F)=>F.completedAt.localeCompare(R.completedAt)),a.cloudLastSync=new Date().toISOString(),Ot(),Date.now()-a.cloudEvidenceLastSyncAt>ky&&await zc().catch(()=>{})}const ky=6e4;async function fe(e,t={}){const r=new Headers(t.headers);t.body!==void 0&&!r.has("content-type")&&r.set("content-type","application/json");let n;try{n=await fetch(e,{...t,credentials:"include",headers:r})}catch{throw new Error("Agentic Cloud is not reachable from this page.")}const o=await n.json().catch(()=>null);if(!n.ok)throw n.status===401&&(a.cloudSession=jo("signed-out")),new Error(Py(o,n.status));if(o===null)throw new Error("Agentic Cloud did not return JSON. Use the same-origin Render app for cloud workflow APIs.");return o}async function Ti(e,t,r={}){if(!Pt())return;const n=Va(e,t),o=a.auditActivity[n];if(!((o==null?void 0:o.status)==="loading"||(o==null?void 0:o.status)==="loaded"&&!r.force)){a.auditActivity[n]={status:"loading",events:[]},M();try{const c=await fe(`/api/audit?recordType=${encodeURIComponent(e)}&recordId=${encodeURIComponent(t)}&limit=25`,{method:"GET"}),d=Array.isArray(c.events)?c.events.map((m,A)=>Hu(m,`$.events[${A}]`)):[];a.auditActivity[n]={status:"loaded",events:d,loadedAt:new Date().toISOString()}}catch(c){a.auditActivity[n]={status:"error",events:[],error:c instanceof Error?c.message:String(c)}}M()}}function _c(e){var n,o;const t=typeof((n=e.user)==null?void 0:n.walletAddress)=="string"?e.user.walletAddress:"",r=typeof((o=e.session)==null?void 0:o.expiresAt)=="string"?e.session.expiresAt:typeof e.expiresAt=="string"?e.expiresAt:"";return e.signedIn&&t?{status:"signed-in",walletAddress:t,expiresAt:r,error:""}:jo("signed-out")}function jo(e){return{status:e,walletAddress:"",expiresAt:"",error:""}}function Py(e,t){if(e&&typeof e=="object"){const r=e;if(typeof r.message=="string"&&r.message.trim())return r.message;if(typeof r.error=="string"&&r.error.trim())return t===404&&r.error==="not_found"?"Agentic Cloud workflow APIs are not available from this host yet.":r.error}return t===404?"Agentic Cloud workflow APIs are not available from this host yet.":t===401?"Sign in to Agentic Cloud before using cloud workflow actions.":`Agentic Cloud request failed with HTTP ${t}.`}function Kr(e,t){if(typeof e=="string"&&e.trim())return e;throw new Error(`${t} was missing from Agentic Cloud.`)}function Lc(e){const t=Dr(e,"plan draft response");return nl(t.plan,"$.plan")}function Cy(e){const t=Dr(e,"approval response");return il(t.approval,"$.approval")}function Ty(e){const t=Dr(e,"recurring schedule response");return uo(t.schedule,"$.schedule")}function Dr(e,t){if(e&&typeof e=="object"&&!Array.isArray(e))return e;throw new Error(`Agentic Cloud returned an invalid ${t}.`)}function Ho(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.id!="string"||typeof t.walletAddress!="string"||!qd(t.plan)||typeof t.createdAt!="string"||typeof t.updatedAt!="string"||t.source!=="template"&&t.source!=="ai"||typeof t.templateId!="string"||typeof t.templateTitle!="string"||typeof t.prompt!="string"||!Bd(t.status))return null;const r=typeof t.cluster=="string"&>(t.cluster)?t.cluster:a.cluster,n=Iy(t.plan,t.riskMetadata);return{id:t.id,plan:n,createdAt:t.createdAt,updatedAt:t.updatedAt,source:t.source,templateId:t.templateId,templateTitle:t.templateTitle,prompt:t.prompt,walletAddress:t.walletAddress,cluster:r,status:t.status,...typeof t.signature=="string"&&{signature:t.signature},...typeof t.approvalRequestId=="string"&&{preparedActionId:t.approvalRequestId},workflowSource:"cloud"}}function Iy(e,t){const r=Ry(t),n=se(t)&&typeof t.constraintFingerprint=="string"?t.constraintFingerprint:r==null?void 0:r.constraintFingerprint,o=se(t)&&typeof t.constraintHash=="string"?t.constraintHash:r==null?void 0:r.constraintHash;return!r&&!n&&!o?e:{...e,...r?{guardrailReport:r}:{},...n?{constraintFingerprint:n}:{},...o?{constraintHash:o}:{}}}function Ry(e){if(se(e))return Uc(e.aiGuardrails)?e.aiGuardrails:void 0}function Oc(e){var m,A;if(!e||typeof e!="object")return null;const t=e;if(typeof t.id!="string"||typeof t.walletAddress!="string"||typeof t.kind!="string"||typeof t.summary!="string"||!se(t.params)||typeof t.dueAt!="string"||typeof t.createdAt!="string"||typeof t.updatedAt!="string")return null;const r=zy(t.kind),n=typeof t.cluster=="string"&>(t.cluster)?t.cluster:a.cluster,o=Gy(t.status),c=typeof t.planDraftId=="string"?t.planDraftId:typeof t.planId=="string"?t.planId:void 0,d=qc(t.metadata);return{id:t.id,kind:r,status:o,walletAddress:t.walletAddress,cluster:n,summary:t.summary,params:Ky(t),...se(t.params)&&{decisionProofParams:{...t.params}},dueAt:t.dueAt,createdAt:t.createdAt,updatedAt:t.updatedAt,...c&&{planDraftId:c},...typeof t.recurringScheduleId=="string"&&{recurringId:t.recurringScheduleId},...typeof t.occurrenceKey=="string"&&{occurrenceKey:t.occurrenceKey},...typeof t.txid=="string"&&{txid:t.txid},...typeof t.txStatus=="string"&&iw(t.txStatus)&&{txStatus:t.txStatus},...d&&{finalization:d},...(d==null?void 0:d.id)&&{finalizationId:d.id},...(d==null?void 0:d.status)&&{finalizationStatus:d.status},...(d==null?void 0:d.transactionHash)&&{transactionHash:d.transactionHash},...(d==null?void 0:d.messageHash)&&{messageHash:d.messageHash},...((m=d==null?void 0:d.quote)==null?void 0:m.quoteHash)&&{quoteHash:d.quote.quoteHash},...((A=d==null?void 0:d.simulation)==null?void 0:A.simulationHash)&&{simulationHash:d.simulation.simulationHash},...(d==null?void 0:d.confirmationStatus)&&{confirmationStatus:d.confirmationStatus},...typeof t.error=="string"&&{error:t.error},...typeof t.note=="string"&&{note:t.note},...t.status==="cancelled"&&{archived:!0},workflowSource:"cloud"}}function Ey(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.id!="string"||typeof t.status!="string"||typeof t.title!="string"||typeof t.summary!="string"||typeof t.walletAddress!="string"||typeof t.createdAt!="string"||typeof t.completedAt!="string")return null;const r=typeof t.cluster=="string"&>(t.cluster)?t.cluster:a.cluster,n=typeof t.signature=="string"?t.signature:typeof t.proofSignature=="string"?t.proofSignature:void 0,o=typeof t.planDraftId=="string"?t.planDraftId:typeof t.planId=="string"?t.planId:void 0,c=typeof t.approvalRequestId=="string"?t.approvalRequestId:typeof t.approvalId=="string"?t.approvalId:void 0,d=t.kind==="recurring_occurrence"?"recurring":"one-time",m=t.metadata&&typeof t.metadata=="object"&&!Array.isArray(t.metadata)?t.metadata:void 0,A=typeof(m==null?void 0:m.decisionProofVerified)=="boolean"?m.decisionProofVerified:void 0,$=typeof(m==null?void 0:m.decisionProofMessage)=="string"?m.decisionProofMessage:void 0,R=Ly(t,m,n,$);return{id:t.id,kind:d,status:t.status,tone:Bc(t.status),title:t.title,summary:t.summary,completedAt:t.completedAt,createdAt:t.createdAt,walletAddress:t.walletAddress,cluster:r,...typeof t.amount=="string"&&{amount:t.amount},...typeof t.token=="string"&&{token:t.token},...typeof t.recipient=="string"&&{recipient:t.recipient},...n&&{signature:n},...typeof t.txid=="string"&&{txid:t.txid},...typeof t.explorerUrl=="string"&&{explorerUrl:t.explorerUrl},...o&&{generatedPlanId:o},...c&&{actionId:c},...typeof t.recurringScheduleId=="string"&&{recurringId:t.recurringScheduleId},...typeof t.occurrenceKey=="string"&&{occurrenceKey:t.occurrenceKey},...A!==void 0&&{decisionProofVerified:A},...$!==void 0&&{decisionProofMessage:$},copyPayload:Pe(t.payload??t.copyPayload??t),...R?{trustBundlePayload:R}:{},detailRows:Array.isArray(t.detailRows)&&t.detailRows.every(Hy)?t.detailRows:fa([["Type",d==="recurring"?"Cloud recurring approval":"Cloud one-time approval"],["Status",t.status],c?["Approval id",c]:void 0,o?["Plan id",o]:void 0,["Wallet",t.walletAddress],["Created",Y(t.createdAt)],["Completed",Y(t.completedAt)],n?["Decision proof",n]:void 0,typeof t.txid=="string"?["Transaction",t.txid]:void 0]),workflowSource:"cloud"}}function _y(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.id!="string"||typeof t.walletAddress!="string"||typeof t.cluster!="string"||typeof t.token!="string"||typeof t.recipient!="string"||typeof t.amount!="string"||typeof t.cadence!="string"||typeof t.createdAt!="string"||typeof t.updatedAt!="string"||t.status!=="completed"&&t.status!=="cancelled")return null;const r=gt(t.cluster)?t.cluster:a.cluster,n=t.status==="completed"?"Schedule completed":"Schedule cancelled",o=Bc(t.status),c=typeof t.occurrencesCreated=="number"?`${t.occurrencesCreated} occurrence${t.occurrencesCreated===1?"":"s"} materialized`:"No occurrences materialized";return{id:`recurring:${t.id}`,kind:"recurring",status:t.status,tone:o,title:`${t.amount} ${t.token} recurring schedule`,summary:n,completedAt:t.updatedAt,createdAt:t.createdAt,walletAddress:t.walletAddress,cluster:r,amount:t.amount,token:t.token,recipient:t.recipient,recurringId:t.id,copyPayload:Pe(t),detailRows:fa([["Type","Cloud recurring schedule"],["Status",t.status],["Cadence",t.cadence],["Recipient",t.recipient],[`Amount ${t.token}`,t.amount],["Wallet",t.walletAddress],["Created",Y(t.createdAt)],["Ended",Y(t.updatedAt)],["Occurrences",c]]),workflowSource:"cloud"}}function Ly(e,t,r,n){const o=se(e.payload)?e.payload:{},c=se(o.finalization)?o.finalization:se(t==null?void 0:t.finalization)?t.finalization:void 0;if(!!!(r||n||c||e.txid))return;const m={receiptType:"agentic_trust_bundle_v1",approvalRequestId:e.approvalRequestId,planDraftId:e.planDraftId??e.planId,completedRecordId:e.id,walletAddress:e.walletAddress,cluster:e.cluster,kind:e.kind,status:e.status,executionMode:c?"wallet_execute":"proof_only",finalizationId:se(c)?c.id:void 0,transactionHash:se(c)?c.transactionHash:e.transactionHash,messageHash:se(c)?c.messageHash:e.messageHash,quoteHash:se(c)&&se(c.quote)?c.quote.quoteHash:e.quoteHash,simulationHash:se(c)&&se(c.simulation)?c.simulation.simulationHash:e.simulationHash,txid:e.txid,explorerUrl:e.explorerUrl,decisionProofSignature:r,decisionProofMessage:n,decisionProofVerified:t==null?void 0:t.decisionProofVerified,verification:se(c)&&se(c.metadata)&&se(c.metadata.verification)?c.metadata.verification:void 0,trustBoundary:{noKeyCustody:!0,noUnlimitedSigner:!0,aiCannotApprove:!0,walletApprovalRequiredForExecution:!0,serverVerificationRequiredForTransactionReceipt:!!c},finalization:c};return Pe(Un(m))}function Dc(e,t){if(!e||typeof e!="object")return null;const r=e;if(typeof r.id!="string"||typeof r.walletAddress!="string"||typeof r.cluster!="string"||typeof r.token!="string"||typeof r.recipient!="string"||typeof r.amount!="string"||typeof r.cadence!="string"||typeof r.createdAt!="string"||typeof r.updatedAt!="string")return null;const n=r.status==="paused"?"paused":"active";return{id:r.id,status:n,walletAddress:r.walletAddress,cluster:r.cluster,token:r.token,recipient:r.recipient,amount:r.amount,cadence:r.cadence,...typeof r.dayOfWeek=="number"&&{dayOfWeek:r.dayOfWeek},...typeof r.dayOfMonth=="number"&&{dayOfMonth:r.dayOfMonth},...typeof r.intervalDays=="number"&&{intervalDays:r.intervalDays},...typeof r.intervalHours=="number"&&{intervalHours:r.intervalHours},...typeof r.intervalMinutes=="number"&&{intervalMinutes:r.intervalMinutes},...typeof r.localTime=="string"&&{localTime:r.localTime},...typeof r.startAt=="string"&&{startAt:r.startAt},...typeof r.maxOccurrences=="number"&&{maxOccurrences:r.maxOccurrences},...typeof r.occurrencesCreated=="number"&&{occurrencesCreated:r.occurrencesCreated},...typeof r.expiresAt=="string"&&{expiresAt:r.expiresAt},...se(r.notifications)&&{notifications:{...typeof r.notifications.inApp=="boolean"&&{inApp:r.notifications.inApp},...typeof r.notifications.webhookUrl=="string"&&{webhookUrl:r.notifications.webhookUrl}}},...(t==null?void 0:t.lifetimeSpend)&&{lifetimeSpend:t.lifetimeSpend},...(t==null?void 0:t.nextRuns)&&{nextRuns:t.nextRuns},...typeof r.note=="string"&&{note:r.note},createdAt:r.createdAt,updatedAt:r.updatedAt,...typeof r.nextDueAt=="string"&&{nextDueAt:r.nextDueAt},workflowSource:"cloud"}}async function Oy(){const e=await fe("/api/recurring",{method:"GET"});return{...Yu(e),views:Dy(e)}}function Dy(e){if(!se(e)||!se(e.views))return;const t={};for(const[r,n]of Object.entries(e.views)){if(!se(n))continue;const o={};Array.isArray(n.nextRuns)&&n.nextRuns.every(c=>typeof c=="string")&&(o.nextRuns=n.nextRuns),Nc(n.lifetimeSpend)&&(o.lifetimeSpend=n.lifetimeSpend),t[r]=o}return t}function Nc(e){return!(!se(e)||typeof e.bounded!="boolean"||typeof e.perWeek!="string"||typeof e.perMonth!="string"||e.totalRuns!==void 0&&typeof e.totalRuns!="number"||e.totalAmount!==void 0&&typeof e.totalAmount!="string")}async function Ny(e){const t=await fe("/api/recurring",{method:"POST",body:JSON.stringify(e)});return Wc(t)}async function Wy(e){await fe(`/api/recurring/${encodeURIComponent(e)}/pause`,{method:"POST",body:"{}"})}async function My(e){await fe(`/api/recurring/${encodeURIComponent(e)}/resume`,{method:"POST",body:"{}"})}async function Uy(e){const t=await fe(`/api/recurring/${encodeURIComponent(e)}/notifications/rotate`,{method:"POST",body:"{}"});return Wc(t)}async function qy(e){const t=await fe(`/api/recurring/${encodeURIComponent(e)}/notifications?limit=10`,{method:"GET"});if(!se(t))throw new Error("Agentic Cloud returned invalid notification status.");const r=Array.isArray(t.deliveries)?t.deliveries.map(Us).filter(o=>!!o):[],n=Us(t.lastDelivery);return{enabled:t.enabled===!0,...typeof t.webhookUrl=="string"&&{webhookUrl:t.webhookUrl},...n&&{lastDelivery:n},deliveries:r,loadedAt:new Date().toISOString()}}function Wc(e){const t=Dr(e,"recurring schedule response");return{schedule:uo(t.schedule,"$.schedule"),...Nc(t.lifetimeSpend)&&{lifetimeSpend:t.lifetimeSpend},...Array.isArray(t.nextRuns)&&t.nextRuns.every(n=>typeof n=="string")&&{nextRuns:t.nextRuns},...typeof t.webhookSecretOnce=="string"&&{webhookSecretOnce:t.webhookSecretOnce}}}function Us(e){return!se(e)||typeof e.id!="string"||typeof e.type!="string"||typeof e.scheduleId!="string"||typeof e.occurrenceId!="string"||typeof e.status!="string"||typeof e.attempts!="number"||typeof e.nextAttemptAt!="string"||typeof e.createdAt!="string"||typeof e.updatedAt!="string"||!["pending","delivered","failed","abandoned"].includes(e.status)?null:{id:e.id,type:e.type,scheduleId:e.scheduleId,occurrenceId:e.occurrenceId,status:e.status,attempts:e.attempts,nextAttemptAt:e.nextAttemptAt,createdAt:e.createdAt,updatedAt:e.updatedAt,...typeof e.lastError=="string"&&{lastError:e.lastError},...typeof e.deliveredAt=="string"&&{deliveredAt:e.deliveredAt}}}async function Mc(e){await fe(`/api/recurring/${encodeURIComponent(e)}`,{method:"DELETE"})}async function By(){await fe("/api/recurring/materialize-due",{method:"POST",body:"{}"})}async function Fy(e,t){const r=new URLSearchParams({limit:"25"});t&&r.set("cursor",t);const n=await fe(`/api/recurring/${encodeURIComponent(e)}/occurrences?${r.toString()}`,{method:"GET"});if(!se(n)||!Array.isArray(n.occurrences))throw new Error("Agentic Cloud returned invalid recurring occurrence history.");return{occurrences:n.occurrences.map(jy).filter(c=>!!c),...typeof n.nextCursor=="string"&&{nextCursor:n.nextCursor}}}function jy(e){if(!se(e))return null;const t=ol(e),r=se(e.approval)?{id:typeof e.approval.id=="string"?e.approval.id:"",status:typeof e.approval.status=="string"?e.approval.status:"",...typeof e.approval.decidedAt=="string"&&{decidedAt:e.approval.decidedAt},...typeof e.approval.txid=="string"&&{txid:e.approval.txid},...typeof e.approval.txStatus=="string"&&{txStatus:e.approval.txStatus},...typeof e.approval.explorerUrl=="string"&&{explorerUrl:e.approval.explorerUrl}}:void 0,n=se(e.completed)?{id:typeof e.completed.id=="string"?e.completed.id:"",status:typeof e.completed.status=="string"?e.completed.status:"",completedAt:typeof e.completed.completedAt=="string"?e.completed.completedAt:"",...typeof e.completed.txid=="string"&&{txid:e.completed.txid},...typeof e.completed.explorerUrl=="string"&&{explorerUrl:e.completed.explorerUrl}}:void 0,o=se(e.statusLabel)&&typeof e.statusLabel.label=="string"&&typeof e.statusLabel.tone=="string"?{label:e.statusLabel.label,tone:e.statusLabel.tone}:co(t.status,r);return{...t,statusLabel:o,...r!=null&&r.id&&r.status?{approval:r}:{},...n!=null&&n.id&&n.status&&n.completedAt?{completed:n}:{}}}function Hy(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&typeof e[1]=="string"}function se(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function Uc(e){return se(e)?(e.verdict==="pass"||e.verdict==="warn"||e.verdict==="block")&&typeof e.source=="string"&&typeof e.actionType=="string"&&typeof e.finalizationRequirement=="string"&&typeof e.constraintFingerprint=="string"&&Array.isArray(e.violations)&&typeof e.summary=="string":!1}function qc(e){if(!se(e)||!se(e.finalization))return;const t=e.finalization;if(!(typeof t.id!="string"||typeof t.approvalRequestId!="string"||typeof t.walletAddress!="string"||typeof t.kind!="string"||typeof t.status!="string"||typeof t.cluster!="string"||typeof t.transactionHash!="string"||typeof t.createdAt!="string"||typeof t.updatedAt!="string"||typeof t.expiresAt!="string"||!se(t.walletAction)))return t}function zy(e){return Md(e)?e:"custom"}function Gy(e){return e==="scheduled"?"scheduled":e==="overdue"?"overdue":e==="approval_pending"?"approval_pending":e==="approved"?"approved":e==="rejected"||e==="denied"?"rejected":e==="cancelled"?"cancelled":e==="expired"?"expired":e==="blocked"?"blocked":e==="failed"?"failed":"ready"}function Ky(e){const t={...e.params??{}};return typeof e.amount=="string"&&t.amount===void 0&&t.amountSol===void 0&&(t[e.kind==="transfer_sol"?"amountSol":"amount"]=e.amount),typeof e.token=="string"&&t.token===void 0&&(t.token=e.token),typeof e.recipient=="string"&&t.recipient===void 0&&(t.recipient=e.recipient),t}function Bc(e){return e==="approved"||e==="completed"?"tx-confirmed":e==="denied"||e==="rejected"||e==="failed"?"tx-failed":"neutral"}async function qs(){await X("bridge",async()=>{a.bridgeUrl=Fe("#bridgeUrl")||a.bridgeUrl,a.bridgeToken=Fe("#bridgeToken")||a.bridgeToken,await Jc({refreshConfig:!0,strictSync:!0}),te()!=="local-bridge"&&await Bo(),T("success","Bridge connected","Select private local mode to route workflow storage through the bridge.")},{async onError(e){if(a.bridgeActive=!1,ma(),a.bridgeStatus=e,Xn(e)){a.error="",await Vo("Approval bridge offline");return}T("error","Bridge connection failed",e)}})}async function Yy(){await X("bridge",async()=>{await ga(),a.bridgeActive=!1,a.bridgeStatus="Bridge disconnected.",a.workflowModePreference==="local-bridge"&&(a.workflowModePreference="auto",ke()),ma(),T("success","Bridge disconnected","Local approval host stopped polling.")})}async function Bs(){await X("inbox",async()=>{te()==="local-bridge"?await Promise.all([tt(),Yc(),Vc().catch(()=>{}),Ko()]):await Bo(),T("success","Workspace refreshed",`${Dt().length} approval request(s) loaded from ${Ve()}.`)})}async function Vy(){await X("inbox",async()=>{a.recurringDraft=to(),Kb(a.recurringDraft);const e=te(),t=Td(a.recurringDraft);if(e==="local-bridge")await be("/bridge/recurring-payments",{method:"POST",body:JSON.stringify(t)}),await tt();else if(e==="agentic-cloud"){const r=await Ny({...t,cluster:a.cluster});r.webhookSecretOnce&&(a.recurringWebhookSecretOnce={scheduleId:r.schedule.id,secret:r.webhookSecretOnce,createdAt:new Date().toISOString()}),await He()}else{const r=Mv(a.recurringDraft),n=nd(r);a.recurringPayments=ca([r],a.recurringPayments),a.preparedActions=vr([n],a.preparedActions),a.materializedActions=a.preparedActions,kt()}a.activeTab="schedule",T("success","Recurring schedule created",e==="local-bridge"?"Future occurrences will appear in Approval Inbox.":e==="agentic-cloud"?"Each run returns to your wallet for review.":"Created one local approval now. Browser workflow does not run background schedules after this tab closes.")})}async function Jy(e,t){if(t==="copy"){const n=a.preparedActions.find(o=>o.id===e);n&&(await navigator.clipboard.writeText(Pe(n)),T("success","Receipt copied",e));return}const r=a.preparedActions.find(n=>n.id===e);if((r==null?void 0:r.workflowSource)==="cloud"){await X("inbox",async()=>{await Zy(r,t)});return}if(De(e)){await X("inbox",async()=>{await tv(e,t)});return}await X("inbox",async()=>{switch(t){case"execute":await be("/bridge/prepared-actions/execute",{method:"POST",body:JSON.stringify({actionId:e})}),await tt(),lt(e),T("success","Approval completed","Receipt saved in Completed Plans.");break;case"reject":await be("/bridge/prepared-actions/reject",{method:"POST",body:JSON.stringify({actionId:e,reason:"Rejected in browser wallet UI."})}),await tt(),lt(e),T("success","Request rejected","Saved in Completed Plans.");break;case"archive":await be("/bridge/prepared-actions/archive",{method:"POST",body:JSON.stringify({actionId:e})}),await tt(),lt(e),T("success","Request cancelled","Saved in Completed Plans.");break;case"delete":await be("/bridge/prepared-actions/delete",{method:"POST",body:JSON.stringify({actionId:e})}),T("success","Deleted permanently",e);break;default:throw new Error(`Unknown action operation: ${t}`)}a.activeTab!=="completed"&&await tt()})}async function Zy(e,t){switch(t){case"confirm":{if(!ud(e))throw new Error("This request does not have a submitted cloud transaction to confirm.");await Xy(e);return}case"execute":{if(Xo(e)){await Qy(e);return}const r=Qa(e);if(r)throw new Error(r);const n=await Yi(e,"approved");await fe(`/api/approvals/${encodeURIComponent(e.id)}/approve`,{method:"POST",body:JSON.stringify({proofSignature:n.signature,decisionProofMessage:n.message,signatureEncoding:"base58",note:"Proof-only approval recorded in Agentic Cloud workspace. No transaction was submitted."})}),await He(),lt(e.id),T("success","Approval recorded","Cloud receipt saved in Completed Plans.");return}case"reject":{const r=await Yi(e,"rejected");await fe(`/api/approvals/${encodeURIComponent(e.id)}/deny`,{method:"POST",body:JSON.stringify({proofSignature:r.signature,decisionProofMessage:r.message,signatureEncoding:"base58",note:"Denied in Agentic Cloud workspace."})}),await He(),lt(e.id),T("success","Request denied","Cloud denial receipt saved in Completed Plans.");return}case"archive":case"delete":await fe(`/api/approvals/${encodeURIComponent(e.id)}/cancel`,{method:"POST",body:JSON.stringify({note:"Cancelled in Agentic Cloud workspace."})}),await He(),lt(e.id),T("success","Request cancelled","Cloud cancellation receipt saved in Completed Plans.");return;default:throw new Error(`Unknown action operation: ${t}`)}}async function Qy(e){var Ue,Ze;const t=await fe(`/api/approvals/${encodeURIComponent(e.id)}/finalization/prepare`,{method:"POST",body:"{}"}),{finalization:r,transactionBase64:n}=ev(t),o=r.id,c=await rv(e,r),d=wt();let m="";try{const xe=await d.signAndSendTransaction(n,{cluster:e.cluster,summary:r.walletAction.summary});m=xe.txid??xe.signature}catch(xe){throw await fe(`/api/approvals/${encodeURIComponent(e.id)}/finalization/${encodeURIComponent(o)}/fail`,{method:"POST",body:JSON.stringify({error:xe instanceof Error?xe.message:String(xe),note:"Wallet approval did not complete."})}).catch(()=>{}),await He().catch(()=>{}),xe}let A=!0,$="";const R=new oo(e.cluster===a.cluster?Xa():oi(e.cluster),"confirmed"),F=se(r.walletAction.metadata)?r.walletAction.metadata:{},pe=typeof F.blockhash=="string"?F.blockhash:"",we=typeof F.lastValidBlockHeight=="number"?F.lastValidBlockHeight:void 0;try{pe&&we?await R.confirmTransaction({signature:m,blockhash:pe,lastValidBlockHeight:we},"confirmed"):await R.confirmTransaction(m,"confirmed")}catch(xe){A=!1,$=xe instanceof Error?xe.message:String(xe)}const Ce=await fe(`/api/approvals/${encodeURIComponent(e.id)}/finalization/${encodeURIComponent(o)}/submit`,{method:"POST",body:JSON.stringify({finalizationStatus:A?"confirmed":"submitted",txStatus:A?"confirmed":"pending",txid:m,transactionHash:r.transactionHash,...r.messageHash?{messageHash:r.messageHash}:{},...(Ue=r.quote)!=null&&Ue.quoteHash?{quoteHash:r.quote.quoteHash}:{},...(Ze=r.simulation)!=null&&Ze.simulationHash?{simulationHash:r.simulation.simulationHash}:{},explorerUrl:Rd(m,e.cluster),proofSignature:c.signature,decisionProofMessage:c.message,signatureEncoding:"base58",note:A?"Wallet approved and transaction finalization receipt was saved.":"Wallet submitted a transaction and confirmation is still pending.",...$?{error:$}:{},metadata:{transactionBoundary:"server_wallet_finalization_v1",transactionHash:r.transactionHash}})}),Le=Dr(Ce,"finalization submit response"),Me=zo(Le.finalization);if(await He(),(Me==null?void 0:Me.status)==="failed")throw new Error(Me.error??"Submitted transaction failed server verification.");if(!se(Le.completed)){T("pending","Transaction submitted",`Server verification is still pending: ${_(m)}`);return}lt(e.id),T("success","Transaction finalized","Wallet receipt saved in Completed Plans.")}async function Xy(e){if(!e.finalizationId)throw new Error("Finalization id is missing.");const t=await fe(`/api/approvals/${encodeURIComponent(e.id)}/finalization/${encodeURIComponent(e.finalizationId)}/confirm`,{method:"POST",body:"{}"}),r=Dr(t,"finalization confirm response"),n=zo(r.finalization);if(await He(),(n==null?void 0:n.status)==="failed")throw new Error(n.error??"Submitted transaction failed server verification.");if(!se(r.completed)){T("pending","Still confirming",e.txid?`Server verification is still pending: ${_(e.txid)}`:e.id);return}lt(e.id),T("success","Transaction finalized","Wallet receipt saved in Completed Plans.")}function ev(e){const t=Dr(e,"finalization prepare response"),r=zo(t.finalization);if(!r)throw new Error("Finalization prepare response was missing finalization.");return{finalization:r,transactionBase64:Kr(t.transactionBase64,"Prepared transaction")}}function zo(e){if(se(e))return qc({finalization:e})}async function tv(e,t){const r=a.preparedActions.find(n=>n.id===e);if(!r)throw new Error("Approval request was not found.");switch(t){case"execute":{const n=await Vi(r,"approved");Ji(r,"approved",n),lt(r.id),T("success","Approval recorded","Wallet proof saved in Completed Plans.");return}case"reject":{const n=await Vi(r,"rejected");Ji(r,"rejected",n),lt(r.id),T("success","Request rejected","Wallet rejection proof saved in Completed Plans.");return}case"archive":a.preparedActions=a.preparedActions.map(n=>n.id===r.id?{...n,archived:!0,updatedAt:new Date().toISOString()}:n),a.materializedActions=a.preparedActions,kt(),lt(r.id),T("success","Request cancelled","Saved in Completed Plans.");return;case"delete":a.preparedActions=a.preparedActions.filter(n=>n.id!==r.id),a.materializedActions=a.preparedActions,a.receipts=a.receipts.filter(n=>n.actionId!==r.id),kt(),T("success","Deleted permanently",r.id);return;default:throw new Error(`Unknown action operation: ${t}`)}}async function Yi(e,t){const r=wt(),n=Wu({approval:{id:e.id,walletAddress:e.walletAddress,cluster:e.cluster,summary:e.summary,kind:e.kind,params:Fc(e)},decision:t});return{signature:(await r.signMessage(n,rr(`Agentic Cloud ${t}`))).signature,message:n}}async function rv(e,t){const r=wt(),n=Mu({approval:{id:e.id,walletAddress:e.walletAddress,cluster:e.cluster,summary:e.summary,kind:e.kind,params:Fc(e)},finalization:t});return{signature:(await r.signMessage(n,{cluster:e.cluster,summary:"Agentic Cloud transaction finalization"})).signature,message:n}}function Fc(e){return Un(e.decisionProofParams??e.params)}async function Vi(e,t){const r=wt(),n=["Agentic browser workflow decision",`Decision: ${t}`,`Approval: ${e.id}`,`Wallet: ${a.address}`,`Cluster: ${a.cluster}`,`Summary: ${e.summary}`,`Kind: ${e.kind}`,`Params: ${Pe(e.params)}`,`Time: ${new Date().toISOString()}`,"This signature records a browser workflow decision only. It does not submit a transaction."].join(`
|
|
2764
|
+
`);return(await r.signMessage(n,rr(`Browser workflow ${t}`))).signature}function Ji(e,t,r){const n=new Date().toISOString(),o={...e,status:t,updatedAt:n,confirmedAt:n},c={actionId:e.id,status:t,summary:e.summary,note:e.note,walletAddress:e.walletAddress,recipient:Xi(e,"recipient")||void 0,amount:Zt(e)==="n/a"?void 0:Zt(e),token:Qt(e)==="n/a"?void 0:Qt(e),cluster:e.cluster,createdAt:e.createdAt,completedAt:n,proofSignature:r,...e.recurringId&&{recurringId:e.recurringId},...e.occurrenceKey&&{occurrenceKey:e.occurrenceKey}};a.preparedActions=vr([o],a.preparedActions),a.materializedActions=a.preparedActions,a.receipts=ss([c],a.receipts),kt()}async function Fs(e,t){const r=a.recurringOccurrenceHistory[e],n=await Fy(e,t);a.recurringOccurrenceHistory[e]={occurrences:t?[...(r==null?void 0:r.occurrences)??[],...n.occurrences]:n.occurrences,...n.nextCursor?{nextCursor:n.nextCursor}:{},loadedAt:new Date().toISOString()}}async function js(e){a.recurringNotificationStatus[e]=await qy(e)}function Hs(e){return a.preparedActions.filter(t=>t.recurringId===e).map(t=>{const r=t.status==="approved"?"completed":t.status==="rejected"||t.status==="cancelled"?"cancelled":t.status==="failed"||t.status==="blocked"||t.status==="expired"?"failed":"approval_pending";return{id:t.id,recurringScheduleId:e,walletAddress:t.walletAddress,cluster:t.cluster,status:r,occurrenceKey:t.occurrenceKey??t.id,dueAt:t.dueAt,createdAt:t.createdAt,updatedAt:t.updatedAt,...t.error?{error:t.error}:{},statusLabel:co(r,{status:t.status,...t.txStatus?{txStatus:t.txStatus}:{}}),approval:{id:t.id,status:t.status,...t.confirmedAt?{decidedAt:t.confirmedAt}:{},...t.txid?{txid:t.txid}:{},...t.txStatus?{txStatus:t.txStatus}:{}}}}).sort((t,r)=>r.createdAt.localeCompare(t.createdAt))}async function av(e,t,r){const n=a.recurringPayments.find(c=>c.id===e),o=n?gr(n):De(e)?"browser":te()==="agentic-cloud"?"cloud":"local-bridge";if(o==="browser"){await X("inbox",async()=>{if(t==="history"||t==="history-more"){a.recurringOccurrenceHistory[e]={occurrences:Hs(e),loadedAt:new Date().toISOString()},T("success","Recurring history loaded",e);return}nv(e,t)});return}if(o==="cloud"){await X("inbox",async()=>{switch(t){case"pause":await Wy(e);break;case"resume":await My(e);break;case"history":await Fs(e);break;case"history-more":await Fs(e,r);break;case"notifications":await js(e);break;case"rotate-secret":{const c=await Uy(e);c.webhookSecretOnce&&(a.recurringWebhookSecretOnce={scheduleId:c.schedule.id,secret:c.webhookSecretOnce,createdAt:new Date().toISOString()}),await js(e).catch(()=>{});break}case"delete":await Mc(e);break;default:throw new Error(`Unknown recurring operation: ${t}`)}t!=="history"&&t!=="history-more"&&t!=="notifications"&&await He(),T("success",t==="delete"?"Deleted permanently":t.startsWith("history")?"Recurring history loaded":t==="notifications"?"Notifications loaded":t==="rotate-secret"?"Webhook secret rotated":`Recurring ${t}`,e)});return}await X("inbox",async()=>{if(t==="history"||t==="history-more"){a.recurringOccurrenceHistory[e]={occurrences:Hs(e),loadedAt:new Date().toISOString()},T("success","Recurring history loaded",e);return}const c=t==="pause"?"/bridge/recurring-payments/pause":t==="resume"?"/bridge/recurring-payments/resume":t==="delete"?"/bridge/recurring-payments/delete":"";if(!c)throw new Error(`Unknown recurring operation: ${t}`);await be(c,{method:"POST",body:JSON.stringify({recurringId:e})}),await tt(),T("success",t==="delete"?"Deleted permanently":`Recurring ${t}`,e)})}function nv(e,t){const r=a.recurringPayments.find(o=>o.id===e&&gr(o)==="browser");if(!r)throw new Error("Recurring schedule was not found.");const n=new Date().toISOString();switch(t){case"pause":a.recurringPayments=ca([{...r,status:"paused",updatedAt:n}],a.recurringPayments),kt(),T("success","Recurring paused",e);return;case"resume":a.recurringPayments=ca([{...r,status:"active",updatedAt:n}],a.recurringPayments),kt(),T("success","Recurring resumed",e);return;case"delete":a.recurringPayments=a.recurringPayments.filter(o=>o.id!==e),a.preparedActions=a.preparedActions.filter(o=>o.recurringId!==e||Lt(o)),a.materializedActions=a.preparedActions,kt(),T("success","Deleted permanently",e);return;default:throw new Error(`Unknown recurring operation: ${t}`)}}async function iv(){await X("lab",async()=>{const e=Aa(),t=pt(e)?Mb(e):{};Ub(e,t);const r=pt(e)?Cd(e,t):ts(e.id).trim(),{archiveResult:n}=await jc({lab:e,input:r,fieldValues:t,signSummary:pt(e)?e.title:`${e.title} evidence`});T("success",pt(e)?"Receipt signed":"Evidence signed",Zi(n,e))})}async function jc(e){const t=wt(),r=new Date().toISOString(),n=await Bb(e.lab.id,e.input,r,e.fieldValues),o=Nr(e.lab.id.slice(0,3).replace(/[^a-z]/g,"")||"lab"),c={version:"labs-ui-v1",id:o,labId:e.lab.id,kind:e.lab.kind,createdAt:r,walletAddress:a.address,cluster:a.cluster,title:e.lab.title,input:e.input,payload:n,...e.metadata?{metadata:e.metadata}:{}},d=await ao(Pe(c)),m=ov(e,o,d),A=await t.signMessage(m,rr(e.signSummary??e.lab.title)),$=Dd(m,A.signature),R={...c,preSignatureHash:d,signingMessage:m,signature:A.signature,verified:$},F={...R,artifactHash:await ao(Pe(R))},pe=await vv(F);return{artifact:F,archiveResult:pe}}function ov(e,t,r){var c;const n=typeof((c=e.metadata)==null?void 0:c.proofUseCase)=="string"?e.metadata.proofUseCase.replace(/_/g," "):e.lab.title,o=(e.lab.fields??[]).map(d=>{var A;const m=(A=e.fieldValues[d.id])==null?void 0:A.trim();return m?`${d.label}: ${m}`:""}).filter(Boolean);return["Solana Agent Wallet Adapter",`Receipt proof: ${e.lab.title}`,`Use case: ${n}`,`Receipt: ${t}`,`Wallet: ${a.address}`,`Cluster: ${a.cluster}`,"What was requested:",e.input||"(no request text)","Receipt fields:",...o.length?o:["(no receipt fields)"],"What this proves:",e.lab.whatThisProves??e.lab.summary??"Wallet signed this evidence receipt.","Effect: evidence only; no transaction submitted; no custody or delegated authority granted.",`Pre-signature hash: ${r}`].join(`
|
|
2765
|
+
`)}async function sv(e,t){const r=a.preparedActions.find(n=>n.id===e);if(!r){T("error","Approval not found",e);return}await X("lab",async()=>{if(!a.address||a.address!==r.walletAddress)throw new Error("Connect the approval wallet before signing this receipt.");const n=wa(kd(t));if(!n)throw new Error("Receipt type is not available.");const o=cv(r,t),c=Cd(n,o),{archiveResult:d}=await jc({lab:n,input:c,fieldValues:o,metadata:dv(r,t),signSummary:`${n.title} for ${_(r.id)}`});if(delete a.auditActivity[Va("approval",r.id)],t==="rejection"&&!Lt(r)){await lv(r),T("success","Request denied with proof",Zi(d,n));return}T("success",`${n.title} signed`,Zi(d,n))})}async function lv(e){if(e.workflowSource==="cloud"){const t=await Yi(e,"rejected");await fe(`/api/approvals/${encodeURIComponent(e.id)}/deny`,{method:"POST",body:JSON.stringify({proofSignature:t.signature,decisionProofMessage:t.message,signatureEncoding:"base58",note:"Denied with a wallet-signed rejection receipt."})}),await He(),lt(e.id);return}if(De(e.id)){const t=await Vi(e,"rejected");Ji(e,"rejected",t),lt(e.id);return}await be("/bridge/prepared-actions/reject",{method:"POST",body:JSON.stringify({actionId:e.id,reason:"Denied with a wallet-signed rejection receipt."})}),await tt(),lt(e.id)}function cv(e,t){const r=uv(e),n=pv(e);switch(t){case"intent":return{request:r,constraints:n,context:e.recurringId?`Approval ${e.id}; recurring schedule ${e.recurringId}${e.occurrenceKey?`; occurrence ${e.occurrenceKey}`:""}`:`Approval ${e.id}`};case"rejection":return{request:r,reason:e.error||Qa(e)||"User chose Deny with proof for this wallet request.",policy:"No wallet action should proceed unless the request matches the visible constraints and the user approves in-wallet."};case"policy":return{policy:"Check recipient, amount, token, cluster, finalization requirement, and no delegated or unlimited signing authority.",request:r,result:"Pass"};case"review":return{request:r,risks:fv(e),verdict:Qa(e)?"Warning":"Recorded"}}}function dv(e,t){const r={source:"inline-proof",recordType:"approval",recordId:e.id,sourceRecordType:"approval",sourceRecordId:e.id,subjectType:"approval",subjectId:e.id,approvalId:e.id,proofUseCase:t,approvalKind:e.kind,workflowSource:e.workflowSource??(De(e.id)?"browser":"local-bridge")};return e.planDraftId&&(r.planDraftId=e.planDraftId),e.recurringId&&(r.recurringScheduleId=e.recurringId),e.occurrenceKey&&(r.occurrenceKey=e.occurrenceKey),e.finalizationId&&(r.finalizationId=e.finalizationId),r}function uv(e){return[e.summary,`Approval: ${e.id}`,`Kind: ${e.kind.replace(/_/g," ")}`,`Cluster: ${ft(e.cluster)}`,yr(e)?`Recipient: ${yr(e)}`:"",Zt(e)!=="n/a"?`Amount: ${Zt(e)}`:"",Qt(e)!=="n/a"?`Token: ${Qt(e)}`:"",e.recurringId?`Recurring schedule: ${e.recurringId}`:"",e.occurrenceKey?`Occurrence: ${e.occurrenceKey}`:""].filter(Boolean).join(`
|
|
2766
|
+
`)}function pv(e){return[yr(e)?`Recipient must match ${yr(e)}.`:"",Zt(e)!=="n/a"?`Amount must match ${Zt(e)}.`:"",Qt(e)!=="n/a"?`Token route must match ${Qt(e)}.`:"",`Cluster must be ${ft(e.cluster)}.`,dn(e)?"Fresh quote/fixed transfer preview, successful simulation, wallet approval, and final receipt are required before funds move.":"This proof alone does not submit a transaction or grant spending authority.","No private key, delegated signer, server signer, or unlimited approval is granted."].filter(Boolean).join(`
|
|
2767
|
+
`)}function fv(e){var n,o,c,d,m,A;const t=["Recipient mismatch","Amount/token mismatch","Wrong cluster","Unexpected authority grant","Route or quote drift","Simulation failure","Wallet capability mismatch"],r=Qa(e);return r&&t.push(`Current blocker: ${r}`),(o=(n=e.finalization)==null?void 0:n.simulation)!=null&&o.status&&t.push(`Simulation status: ${e.finalization.simulation.status}`),((d=(c=e.finalization)==null?void 0:c.quote)!=null&&d.quoteHash||e.quoteHash)&&t.push(`Quote hash: ${((A=(m=e.finalization)==null?void 0:m.quote)==null?void 0:A.quoteHash)??e.quoteHash}`),t.join(`
|
|
2768
|
+
`)}function Zi(e,t){if(e.savedToCloud&&e.savedToBridge)return"Saved locally, to Agentic Cloud, and to the bridge archive.";if(e.savedToCloud)return"Saved locally and to the Agentic Cloud archive.";if(e.savedToBridge)return"Saved locally and to the bridge archive.";const r=te();return r==="local-bridge"&&pt(t)?"Saved to the local device archive. Private local mode keeps receipts off Agentic Cloud.":r!=="agentic-cloud"&&pt(t)?"Saved to the local device archive. Sign in to also archive to Agentic Cloud.":"Saved to the local device archive."}async function gv(){await X("lab",async()=>{await qo(!1),await jd(),a.bridgeActive&&await Ko(),te()==="agentic-cloud"&&await zc(),T("success","Receipts refreshed",`${a.labArtifacts.length} receipt${a.labArtifacts.length===1?"":"s"} loaded.`)})}async function mv(e){const t=a.labArtifacts.find(r=>r.id===e);t&&window.confirm(yv(t))&&await X("lab",async()=>{a.labArtifacts=a.labArtifacts.filter(n=>n.id!==e),await ua(),a.bridgeActive&&await $v(e);let r={kind:"skipped"};te()==="agentic-cloud"&&(r=await Av(t)),T("success","Receipt deleted",t.title),r.kind==="failed"?T("error","Cloud delete failed",`Receipt removed locally but still in Agentic Cloud: ${r.message}`):r.kind==="missing-id"&&T("error","Cloud delete skipped","Cloud receipt id was missing locally — refresh the archive to retry.")})}async function hv(e){const t=a.labArtifacts.find(n=>n.id===e);if(!t)return;const r=yh(t);try{if(navigator.share){await navigator.share({title:t.title||ii(t.kind),text:r}),T("success","Receipt shared",_(t.artifactHash));return}await navigator.clipboard.writeText(r),T("success","Receipt share text copied",_(t.artifactHash))}catch(n){const o=n instanceof Error?n.message:"Share was cancelled or blocked.";T("error","Share failed",o)}}function yv(e){const t=["this device"];return te()==="agentic-cloud"&&e.cloudReceiptId&&t.push("Agentic Cloud"),a.bridgeActive&&t.push("the local bridge archive"),`Delete this evidence receipt permanently from ${t.join(", ")}?`}async function X(e,t,r={}){a.error="",a.busy=!0,a.steps[e]="active",M();try{await t(),a.steps[e]="done"}catch(n){a.steps[e]="error",a.error=je(n instanceof Error?n.message:String(n)),r.onError?await r.onError(a.error,n):T("error","Action failed",a.error)}finally{a.busy=!1,M()}}async function vv(e){var o;let t=e;a.labArtifacts=Nt([t],a.labArtifacts),await ua();const r={savedToCloud:!1,savedToBridge:!1};if(te()==="agentic-cloud"&&Go(t.kind))try{const c=await fe("/api/evidence",{method:"POST",body:JSON.stringify(Hc(t))}),d=typeof((o=c.receipt)==null?void 0:o.id)=="string"&&c.receipt.id?c.receipt.id:void 0;d?(t={...t,cloudReceiptId:d},a.cloudEvidenceStatus="Cloud evidence archive synced for the signed-in wallet."):a.cloudEvidenceStatus="Cloud archive accepted the receipt but did not return an id — refresh archive to recover it.",r.savedToCloud=!0}catch(c){a.cloudEvidenceStatus=`Cloud evidence archive failed: ${c instanceof Error?c.message:String(c)}`}if(a.bridgeActive)try{await Kc(t),t={...t,bridgeArchived:!0},r.savedToBridge=!0}catch(c){a.bridgeStatus=`Receipt bridge archive failed: ${c instanceof Error?c.message:String(c)}`}return t!==e&&(a.labArtifacts=Nt([t],a.labArtifacts),await ua()),r}function Hc(e){return{title:e.title,kind:e.kind,status:e.payload.status,cluster:e.cluster,payload:e.payload,preSignatureHash:e.preSignatureHash,signingMessage:e.signingMessage,signature:e.signature,artifactHash:e.artifactHash,receiptType:e.payload.receiptType??e.kind,summary:e.payload.summary??e.input,verdict:e.payload.verdict,effect:e.payload.effect,metadata:{...e.metadata??{},labId:e.labId,browserArtifactId:e.id,input:e.input}}}async function zc(){var e;if(te()==="agentic-cloud")try{const t=await Gc(),r=a.labArtifacts,n=new Set(t.map(d=>d.id)),o=r.filter(d=>!n.has(d.id)&&d.walletAddress===a.address&&Go(d.kind)&&!d.cloudReceiptId),c=[];for(const d of o)try{const m=await fe("/api/evidence",{method:"POST",body:JSON.stringify(Hc(d))}),A=typeof((e=m.receipt)==null?void 0:e.id)=="string"&&m.receipt.id?m.receipt.id:void 0;A&&c.push({...d,cloudReceiptId:A})}catch(m){a.cloudEvidenceStatus=`Cloud evidence archive failed: ${m instanceof Error?m.message:String(m)}`}a.labArtifacts=Nt(t,c,r),await ua(),a.cloudEvidenceLastSyncAt=Date.now(),a.cloudEvidenceStatus=`Cloud evidence archive synced (${t.length} receipt${t.length===1?"":"s"}).`}catch(t){a.cloudEvidenceStatus=`Cloud evidence archive unavailable: ${t instanceof Error?t.message:String(t)}`}}async function Gc(){const e=await fe("/api/evidence",{method:"GET"}),t=Array.isArray(e.receipts)?e.receipts:[],r=[];for(const n of t){const o=bv(n);o&&r.push(o)}return r}function bv(e){if(!e||typeof e!="object")return null;const t=e,r=t.metadata&&typeof t.metadata=="object"?t.metadata:{},n=typeof t.id=="string"?t.id:"",o=typeof r.browserArtifactId=="string"&&r.browserArtifactId?r.browserArtifactId:n,c=typeof r.labId=="string"&&r.labId?r.labId:wv(t.kind),d=typeof t.cluster=="string"&>(t.cluster)?t.cluster:a.cluster,m=t.payload;if(!m||typeof m!="object")return null;const A=ut(t.signingMessage)??"",$=ut(t.signature)??"",R=A&&$?Dd(A,$):!1,F={id:o,labId:c,title:ut(t.title)??"",kind:ut(t.kind)??"",createdAt:ut(t.createdAt)??new Date().toISOString(),walletAddress:ut(t.walletAddress)??a.address,cluster:d,input:ut(r.input)??ut(t.summary)??ut(m.summary)??ut(m.thesis)??"",payload:m,preSignatureHash:ut(t.preSignatureHash)??"",signingMessage:A,signature:$,verified:R,artifactHash:ut(t.artifactHash)??ut(t.preSignatureHash)??"",...n?{cloudReceiptId:n}:{},...se(r)?{metadata:r}:{}};return un(F)?F:null}function wv(e){switch(typeof e=="string"?e:""){case"intent_receipt":return"intent-receipt";case"policy_receipt":return"policy-receipt";case"risk_review_receipt":return"risk-receipt";case"rejection_receipt":return"rejection-receipt";case"tool_trace_receipt":return"tool-trace-receipt";default:return"intent-receipt"}}function ut(e){return typeof e=="string"&&e?e:void 0}async function Av(e){if(te()!=="agentic-cloud"||!Go(e.kind))return{kind:"skipped"};if(!e.cloudReceiptId)return a.cloudEvidenceStatus="Cloud receipt id missing — refresh archive then retry delete.",{kind:"missing-id"};try{return await fe(`/api/evidence/${encodeURIComponent(e.cloudReceiptId)}`,{method:"DELETE"}),{kind:"deleted"}}catch(t){const r=t instanceof Error?t.message:String(t);return a.cloudEvidenceStatus=`Cloud evidence delete failed: ${r}`,{kind:"failed",message:r}}}function Go(e){return Tu.includes(e)}async function Ko(){if(a.bridgeActive)try{const e=await Sv(),t=a.labArtifacts,r=new Set(e.map(o=>o.id)),n=t.filter(o=>!r.has(o.id));for(const o of n)await Kc(o);a.labArtifacts=Nt(e,t),await ua(),a.labArchiveStatus="Browser archive synced with bridge."}catch(e){a.bridgeStatus=`Receipt bridge archive unavailable: ${e instanceof Error?e.message:String(e)}`}}async function Sv(){const e=await be("/bridge/lab-artifacts");return Nt(Array.isArray(e.artifacts)?e.artifacts.filter(un):[])}async function Kc(e){await be("/bridge/lab-artifacts",{method:"POST",body:JSON.stringify({artifact:e})})}async function $v(e){await be("/bridge/lab-artifacts/delete",{method:"POST",body:JSON.stringify({artifactId:e})})}async function tt(){const e=os(),[t,r,n,o]=await Promise.all([be("/bridge/prepared-actions"),be("/bridge/recurring-payments"),be("/bridge/receipts"),be("/bridge/prepared-actions/tx-status").catch(()=>null)]);a.materializedActions=vr(Vs(t.materialized??[],"local-bridge"),e.preparedActions),a.preparedActions=vr(Vs((o==null?void 0:o.actions)??t.actions??[],"local-bridge"),e.preparedActions),a.recurringPayments=ca(Wd(r.recurringPayments??[],"local-bridge"),e.recurringPayments),a.receipts=ss(n.receipts??[],e.receipts)}async function Yc(){a.health=await be("/bridge/health")}async function Vc(){a.balances=await be("/bridge/action/balances")}async function Qi(e){try{const t=await be("/bridge/config");if(!gt(t.cluster)||!t.rpcUrl)throw new Error("Local bridge returned an invalid runtime config.");a.cluster=t.cluster,a.bridgeRpcUrl=t.rpcUrl,ke()}catch(t){if(a.bridgeRpcUrl="",e)throw t}}async function ea(){if(!a.address||!a.capabilities)throw new Error("Connect a wallet before connecting the bridge.");await be("/bridge/connect",{method:"POST",body:JSON.stringify({address:a.address,capabilities:a.capabilities})}),await Tn("browser.bridge.connected",{address:a.address,cluster:a.cluster,rpcHost:a.bridgeRpcUrl?Id():null})}async function Jc(e={}){e.refreshConfig?await Qi(!0):await Qi(!1),await ea(),a.bridgeActive=!0,a.bridgeStatus="Connected to local bridge. Waiting for agent requests.",kv(),await xv(!!e.strictSync),ke()}async function xv(e){const t=[tt(),Yc(),Vc().catch(()=>{}),Ko()];if(e){await Promise.all(t);return}await Promise.all(t.map(r=>r.catch(()=>{})))}async function Zc(){if(!a.address||!a.capabilities)return!1;try{return await Jc({refreshConfig:!1,strictSync:!1}),!0}catch(e){return a.bridgeActive=!1,ma(),a.bridgeStatus=e instanceof Error?e.message:String(e),!1}}async function ga(){await be("/bridge/disconnect",{method:"POST"}).catch(()=>{})}function kv(){ma(),Cn=window.setInterval(()=>{zs()},1e3),zs()}function ma(){Cn!==null&&(window.clearInterval(Cn),Cn=null)}async function zs(){if(!(!a.bridgeActive||!qe||yi))try{const e=await be("/bridge/next");if(e.request){yi=!0,await Pv(e.request);return}const t=Date.now();te()==="local-bridge"&&(a.activeTab==="inbox"||a.activeTab==="schedule")&&t-Ps>5e3&&(Ps=t,await tt().catch(()=>{}),M())}catch(e){a.bridgeStatus=e instanceof Error?e.message:String(e),Xn(a.bridgeStatus)&&(a.bridgeActive=!1,ma()),M()}finally{yi=!1}}async function Pv(e){var r,n;const t=wt();a.bridgeStatus=`Opening wallet for ${e.kind}: ${((r=e.display)==null?void 0:r.summary)??e.id}`,await Tn("browser.approval.start",{requestId:e.id,kind:e.kind,cluster:e.cluster,summary:(n=e.display)==null?void 0:n.summary}),M();try{let o;switch(e.kind){case"sign_message":o=await t.signMessage(e.payload.data,_i(e));break;case"sign_transaction":o=await t.signTransaction(e.payload.data,_i(e));break;case"sign_and_send_transaction":o=await t.signAndSendTransaction(e.payload.data,_i(e));break}await be("/bridge/resolve",{method:"POST",body:JSON.stringify({requestId:e.id,signature:o.signature,...o.txid!==void 0&&{txid:o.txid}})}),a.bridgeStatus=`Approved ${e.kind}: ${_(o.txid??o.signature)}`,await Tn("browser.approval.success",{requestId:e.id,kind:e.kind,signature:o.signature,txid:o.txid}),T("success","Bridge request approved",_(o.txid??o.signature))}catch(o){const c=dw(o);await be("/bridge/reject",{method:"POST",body:JSON.stringify({requestId:e.id,error:c})}).catch(()=>{}),a.bridgeStatus=`Rejected ${e.kind}: ${c.message}`,await Tn("browser.approval.error",{requestId:e.id,kind:e.kind,code:c.code,message:c.message}),T("error","Bridge request failed",c.message)}finally{await tt().catch(()=>{}),M()}}async function Tn(e,t){a.bridgeToken&&await be("/bridge/trace",{method:"POST",body:JSON.stringify({event:e,payload:t})}).catch(()=>{})}async function on(e){try{a.aiStatus=await be("/bridge/ai/status")}catch(t){if(a.aiStatus=null,e)throw t}}function ha(){return Vt(a.selectedTemplateId)}function Qc(e=ha()){const t={...Rt(e),...a.templateFields};for(const r of document.querySelectorAll("[data-template-field]")){const n=r.dataset.templateField;n&&(t[n]=r.value)}return a.templateFields=t,t}function Cv(e){const t=ha();return a.templateFields[e]??Rt(t)[e]??""}function Xc(e,t,r){var o;const n={};for(const c of e.fields)c.required&&!((o=t[c.id])!=null&&o.trim())&&(n[c.id]=`${c.label} is required.`);if(ed(e)&&!r.trim()&&(n.__notes="Describe the custom request before creating this plan."),a.templateFieldErrors=n,Object.keys(n).length>0)throw new Error("Complete required fields before creating this plan.")}function ed(e){return e.id==="custom-request"}function ya(e){return Uc(e.guardrailReport)?e.guardrailReport:void 0}function Tv(e){var t;return((t=ya(e))==null?void 0:t.verdict)??"unknown"}function _t(e){return["transfer_sol","transfer_spl","swap","recurring_payment"].includes(e.actionType)}function Iv(e){return _t(e)&&Tv(e)!=="block"&&!(te()==="agentic-cloud"&&Qn(e))}function td(e){return e.status!=="archived"&&Iv(e.plan)}function rd(e){if(!_t(e))throw new Error("Only transfer, swap, and recurring schedules can be queued.");const t=ya(e);if((t==null?void 0:t.verdict)==="block")throw new Error(t.summary||"This plan is blocked by Agentic guardrails.");if(te()==="agentic-cloud"){const r=Qn(e);if(r)throw new Error(r)}}async function Rv(e){var r,n;const t=e.intent.slice(0,500);switch(e.actionType){case"transfer_sol":return{id:(await be("/bridge/action/prepare-transfer-sol",{method:"POST",body:JSON.stringify({recipient:Oe(e,"recipient"),amountSol:Oe(e,"amount"),note:t})})).preparedAction.id};case"transfer_spl":return{id:(await be("/bridge/action/prepare-transfer-spl",{method:"POST",body:JSON.stringify({token:Oe(e,"token"),recipient:Oe(e,"recipient"),amount:Oe(e,"amount"),note:t})})).preparedAction.id};case"swap":{const o=Number(e.parameters.slippageBps||"50");return{id:(await be("/bridge/action/prepare-swap",{method:"POST",body:JSON.stringify({inputToken:e.parameters.inputToken||"SOL",outputToken:e.parameters.outputToken||"USDC",amount:Oe(e,"amount"),slippageBps:Number.isFinite(o)?o:50,note:t})})).preparedAction.id}}case"recurring_payment":{const o=await be("/bridge/recurring-payments",{method:"POST",body:JSON.stringify({token:Oe(e,"token"),recipient:Oe(e,"recipient"),amount:Oe(e,"amount"),...Yo(e),note:t})});return{id:((r=o.recurringPayment)==null?void 0:r.id)??((n=o.payment)==null?void 0:n.id)??"recurring-payment"}}default:throw new Error("This plan type creates a review/proof only and cannot be queued as a bridge action yet.")}}async function ad(e,t){rd(e);const r=te();if(r==="local-bridge")return{...await Rv(e),mode:"local-bridge"};if(r==="agentic-cloud"){const o=Qn(e);if(o)throw new Error(o);return{...e.actionType==="recurring_payment"?await _v(e):await Ev(e,t),mode:"agentic-cloud"}}return{...Lv(e),mode:"browser-workflow"}}async function Ev(e,t){if(!Pt())throw new Error("Sign in to Agentic Cloud with the connected wallet before queueing to cloud.");const r=Qn(e);if(r)throw new Error(r);const n=(t==null?void 0:t.workflowSource)==="cloud"&&Lr(t.plan,e)?t:a.generatedPlans.find(A=>A.workflowSource==="cloud"&&A.status!=="archived"&&Lr(A.plan,e)),o=Vt(t?t.templateId:a.selectedTemplateId),c=n?n.id:(await No(e,o,(t==null?void 0:t.prompt)||e.userNotes||e.intent)).id,d=Cy(await fe("/api/approvals",{method:"POST",body:JSON.stringify({planDraftId:c,kind:e.actionType,summary:e.intent,params:e.parameters,cluster:a.cluster,note:e.userNotes||e.approval,amount:St(e,["amountSol","amount","inputAmount","plannedAmount"]),token:St(e,["token","inputToken"]),recipient:St(e,["recipient","recipientAddress"])})})),m=Oc(d);if(!m)throw new Error("Agentic Cloud did not return a valid approval request.");return{id:m.id,planRecordId:c}}function Qn(e){if(e.actionType!=="transfer_sol"&&!(e.actionType==="recurring_payment"&&(e.parameters.token??"SOL").toUpperCase()==="SOL")){if(e.actionType==="transfer_spl"||e.actionType==="swap")return"Agentic Cloud currently finalizes SOL transfers only. Use Private local mode for SPL transfers and swaps.";if(e.actionType==="custom_transaction")return"Agentic Cloud does not accept custom executable transactions yet. Use a proof-only review or Private local mode.";if(e.actionType==="recurring_payment")return"Agentic Cloud recurring execution currently supports SOL payments only. Use Private local mode for token schedules."}}async function _v(e){if(!Pt())throw new Error("Sign in to Agentic Cloud with the connected wallet before creating cloud recurring schedules.");const t={cluster:a.cluster,token:Oe(e,"token"),recipient:Oe(e,"recipient"),amount:Oe(e,"amount"),...Yo(e),note:e.userNotes||e.intent},r=Ty(await fe("/api/recurring",{method:"POST",body:JSON.stringify(t)})),n=Dc(r);if(!n)throw new Error("Agentic Cloud did not return a valid recurring schedule.");return await By().catch(()=>{}),{id:n.id}}function Lv(e){if(!a.address)throw new Error("Connect a wallet before queueing.");if(e.actionType==="recurring_payment"){const r=Wv(e),n=nd(r,e.intent);return a.recurringPayments=ca([r],a.recurringPayments),a.preparedActions=vr([n],a.preparedActions),a.materializedActions=a.preparedActions,kt(),{id:r.id}}const t=Ov(e);return a.preparedActions=vr([t],a.preparedActions),a.materializedActions=a.preparedActions,kt(),{id:t.id}}function Ov(e){const t=new Date().toISOString(),r=Nr("browser-action"),n=Dv(e);return{id:r,kind:n,status:"ready",walletAddress:a.address,cluster:a.cluster,summary:e.intent,params:Nv(e,n),dueAt:t,createdAt:t,updatedAt:t,note:e.userNotes||e.approval,workflowSource:"browser"}}function Dv(e){if(e.actionType==="transfer_sol")return"transfer_sol";if(e.actionType==="transfer_spl")return"transfer_spl";if(e.actionType==="swap")return"swap";throw new Error("Only transfers, swaps, and recurring schedules can be queued.")}function Nv(e,t){return t==="transfer_sol"?{recipient:Oe(e,"recipient"),amountSol:Oe(e,"amount"),memo:e.parameters.memo??""}:t==="transfer_spl"?{token:Oe(e,"token"),recipient:Oe(e,"recipient"),amount:Oe(e,"amount"),memo:e.parameters.memo??""}:t==="swap"?{inputToken:e.parameters.inputToken||"SOL",outputToken:e.parameters.outputToken||"USDC",amount:Oe(e,"amount"),slippageBps:e.parameters.slippageBps||"50"}:{reason:e.userNotes||e.intent}}function Wv(e){const t=new Date().toISOString(),r=Yo(e),n=Number(e.parameters.maxOccurrences);return{id:Nr("browser-recurring"),status:"active",walletAddress:a.address,cluster:a.cluster,token:e.parameters.token||"SOL",recipient:Oe(e,"recipient"),amount:Oe(e,"amount"),...r,...Number.isInteger(n)&&n>0?{maxOccurrences:n}:{},occurrencesCreated:1,note:e.userNotes||e.intent,createdAt:t,updatedAt:t,nextDueAt:Uv(r),workflowSource:"browser"}}function Mv(e){const t=new Date().toISOString(),r=Td(e),n=r,o=Number(e.maxOccurrences);return{id:Nr("browser-recurring"),status:"active",walletAddress:a.address,cluster:a.cluster,token:e.token,recipient:e.recipient,amount:e.amount,...n,...Number.isInteger(o)&&o>0?{maxOccurrences:o}:{},occurrencesCreated:1,...typeof r.expiresAt=="string"&&{expiresAt:r.expiresAt},...se(r.notifications)&&{notifications:{...typeof r.notifications.inApp=="boolean"&&{inApp:r.notifications.inApp},...typeof r.notifications.webhookUrl=="string"&&{webhookUrl:r.notifications.webhookUrl}}},note:e.note||"Browser recurring schedule",createdAt:t,updatedAt:t,nextDueAt:ai(e)[0],workflowSource:"browser"}}function nd(e,t){const r=new Date().toISOString(),n=Nr("browser-action"),o=e.token||"SOL";return{id:n,kind:o.toUpperCase()==="SOL"?"transfer_sol":"transfer_spl",status:"ready",walletAddress:e.walletAddress,cluster:e.cluster,summary:t||`${e.amount} ${e.token} recurring approval`,params:o.toUpperCase()==="SOL"?{recipient:e.recipient,amountSol:e.amount,memo:e.note??""}:{token:e.token,recipient:e.recipient,amount:e.amount,memo:e.note??""},dueAt:r,createdAt:r,updatedAt:r,note:e.note,recurringId:e.id,occurrenceKey:`browser-${r}`,workflowSource:"browser"}}function Uv(e){const t={...ro(),cadence:e.cadence,dayOfWeek:e.dayOfWeek===void 0?"":String(e.dayOfWeek),dayOfMonth:e.dayOfMonth===void 0?"":String(e.dayOfMonth),intervalDays:e.intervalDays===void 0?"":String(e.intervalDays),intervalHours:e.intervalHours===void 0?"":String(e.intervalHours),intervalMinutes:e.intervalMinutes===void 0?"":String(e.intervalMinutes),localTime:e.localTime??"09:00",startAt:e.startAt?Od(new Date(e.startAt)):ro().startAt};return ai(t)[0]}function Yo(e){var n,o,c,d;const t=qv(e.parameters.cadence),r=((n=e.parameters.localTime)==null?void 0:n.trim())||"09:00";switch(t){case"weekly":return{cadence:t,dayOfWeek:Ma(e,"dayOfWeek",1,0,6),localTime:r};case"monthly":return{cadence:t,dayOfMonth:Ma(e,"dayOfMonth",1,1,31),localTime:r};case"interval_days":return{cadence:t,intervalDays:Ma(e,"intervalDays",7,1,365),startAt:((o=e.parameters.startAt)==null?void 0:o.trim())||Ii()};case"interval_hours":return{cadence:t,intervalHours:Ma(e,"intervalHours",24,1,8760),startAt:((c=e.parameters.startAt)==null?void 0:c.trim())||Ii()};case"interval_minutes":return{cadence:t,intervalMinutes:Ma(e,"intervalMinutes",60,1,525600),startAt:((d=e.parameters.startAt)==null?void 0:d.trim())||Ii()}}}function qv(e){const t=e==null?void 0:e.trim();return t==="weekly"||t==="monthly"||t==="interval_days"||t==="interval_hours"||t==="interval_minutes"?t:"weekly"}function Ma(e,t,r,n,o){const c=Number(e.parameters[t]);return!Number.isInteger(c)||c<n||c>o?r:c}function Ii(){return new Date(Date.now()+6e4).toISOString()}function Oe(e,t){var n;const r=(n=e.parameters[t])==null?void 0:n.trim();if(!r)throw new Error(`Plan is missing ${Up(Vt(a.selectedTemplateId),t)}.`);return r}async function be(e,t){if(!a.bridgeToken)throw new Error("Bridge token is required.");const r=new URL(e,rs()),n=new Headers(t==null?void 0:t.headers);n.set("x-agent-wallet-token",a.bridgeToken),(t==null?void 0:t.body)!==void 0&&!n.has("content-type")&&n.set("content-type","application/json");let o;try{o=await fetch(r,{...t,headers:n})}catch{throw new Error(Bv())}const c=await o.json().catch(()=>({}));if(!o.ok){const d=uw(c);throw o.status===401?new Error("Wrong bridge token. Use the token printed by the bridge process."):new Error(d)}return c}function Bv(){return`Local approval bridge is not running at ${hr(a.bridgeUrl)}. Run ${ct}, keep that terminal open, then click Check local bridge.`}function Xn(e){return e.startsWith("Local approval bridge is not running at ")}async function Vo(e){const t=await Fv();a.bridgeStatus=t,T("error",e,t)}async function Fv(){const e=hr(a.bridgeUrl),t=jv();return(t?await Hv(t):!1)?`Wallet host is running at ${hr(t)}, but the approval bridge is stopped at ${e}. Run ${ct}, keep that terminal open, then click Check local bridge.`:`Local approval bridge is not running at ${e}. Run ${ct}, keep that terminal open, then click Check local bridge.`}function jv(){try{const e=new URL(rs());return e.port="5174",e.pathname="/",e.search="",e.hash="",e.toString()}catch{return"http://127.0.0.1:5174/"}}async function Hv(e){const t=new AbortController,r=window.setTimeout(()=>t.abort(),1200);try{return await fetch(e,{cache:"no-store",mode:"no-cors",signal:t.signal}),!0}catch{return!1}finally{window.clearTimeout(r)}}function zv(){const e=a.wallets.find(t=>t.name===a.selectedWalletName);if(!e)throw new Error("Select a wallet first.");return e}async function id(e){ln();const t=new In({cluster:ei()});Je=t,qe=new ra({backend:t}),a.address=await t.connect(),a.capabilities=await qe.capabilities(),a.selectedWalletName=t.walletName(),a.wallets=[],a.androidAuthCacheCount=t.cacheCount(),a.androidNativeStatus=`Android ${a.selectedWalletName} connected on ${a.cluster}.`,a.transactionStatus=`Android MWA wallet connected on ${a.cluster}.`,a.steps.connect="done",ke()}async function od(e){Je=e.backend,qe=new ra({backend:Je}),a.address=e.address,a.selectedWalletName=e.walletName,a.wallets=[],a.capabilities=await qe.capabilities(),a.androidAuthCacheCount=e.cacheCount,a.androidNativeStatus=`Restored cached ${e.walletName} authorization on ${a.cluster}.`,a.transactionStatus=`Android MWA wallet connected on ${a.cluster}.`,a.steps.connect="done",ke()}async function Gv(){if(a.cluster==="localnet"){a.androidNativeStatus="Android native MWA supports mainnet-beta, devnet, and testnet. Select devnet for local testing.";return}const e=await gl({cluster:ei()});if(!e){a.androidNativeStatus="No cached Android MWA authorization found. Tap Discover to open the wallet picker.";return}await od(e)}async function sn(){if(!a.androidNativeEnvironment.isAndroidNative)return;const e=await vp().catch(()=>({count:0}));a.androidAuthCacheCount=e.count}function Jo(){return Je instanceof In?Je:new In({cluster:ei()})}function ei(){return a.cluster==="localnet"&&(a.cluster="devnet",ke()),a.cluster}function ln(){if(!a.androidNativeEnvironment.isAndroidNative)throw new Error("Android native MWA controls are available only inside the Android app.")}async function Kv(){const e=await Bl();if(!e){a.iosNativeStatus="No cached iOS authorization found.";return}Je=e.backend,qe=new ra({backend:Je}),a.address=e.address,a.selectedIosWalletId=e.walletId,a.selectedWalletName=e.walletName,a.capabilities=await qe.capabilities(),a.iosAuthCacheCount=e.cacheCount,a.iosNativeStatus=`Restored cached ${e.walletName} authorization on ${a.cluster}.`}async function va(){if(!a.iosNativeEnvironment.isIos)return;const e=await Rf().catch(()=>({count:0}));a.iosAuthCacheCount=e.count}function Zo(){const e=Je;return e!=null&&e.clearTransientState&&e.clearStateFullReset&&e.clearAllCachedAuthorizations?e:new Fl({walletId:a.selectedIosWalletId,cluster:a.cluster,appUrl:window.location.origin,rpcUrl:Xa(),logLevel:"info"})}async function Yv(){var t;const e=Je;await((t=e==null?void 0:e.disconnect)==null?void 0:t.call(e))}function ti(){if(!a.iosNativeEnvironment.isIosNative)throw new Error("iOS native wallet controls are available only inside the Capacitor iOS app.")}function wt(){if(!qe)throw new Error("Connect a wallet before requesting a signature.");return qe}function Vv(){var e;return!!(a.address&&a.customTransactionBase64&&!a.busy&&((e=a.capabilities)!=null&&e.supports.signAndSendTransaction))}function Qo(){try{return new Js(a.address)}catch{throw new Error("Connected wallet address is not a valid Solana public key.")}}function fr(){qe=null,Je=null,a.activeTab=jl,a.address="",a.signature="",a.txSignature="",a.txid="",a.customTransactionBase64="",a.transactionStatus="",a.agentPlan=null,a.agentSignature="",a.agentPreparedActionId="",a.capabilities=null,a.bridgeActive=!1,a.bridgeStatus="Bridge idle.",ma(),a.steps.connect="idle",a.steps.sign="idle",a.steps.transaction="idle",a.steps.bridge="idle"}function ri(){return a.wallets.some(e=>e.name===a.selectedWalletName)?a.selectedWalletName:""}function Jv(){const e=ri(),t=a.wallets.length;if(a.address){const r=e||a.selectedWalletName||"Connected wallet";return{icon:ja(r),logoId:$i(r),discoveredWallet:On(r),title:r,summary:_(a.address),detail:`${ft(a.cluster)} signer`}}if(a.androidNativeEnvironment.isAndroidNative)return{icon:"MW",logoId:"solanaMobile",title:"Android MWA standby",summary:"Mobile Wallet Adapter",detail:a.androidAuthCacheCount>0?`${a.androidAuthCacheCount} cached authorization(s)`:"Tap Discover to open the wallet picker"};if(a.iosNativeEnvironment.isIosNative){const r=cn(a.selectedIosWalletId);return{icon:ja(r),logoId:$i(r),title:"iOS wallet standby",summary:r,detail:a.iosAuthCacheCount>0?`${a.iosAuthCacheCount} cached authorization(s)`:"Encrypted links and WalletConnect ready"}}return t>0&&e?{icon:ja(e),logoId:$i(e),discoveredWallet:On(e),title:"Wallet standby",summary:e,detail:`${t} provider(s) discovered`}:{icon:"SA",title:"Wallet standby",summary:"No signer connected",detail:t>0?`${t} provider(s) discovered`:"No providers discovered"}}function sd(){return a.wallets.length===0?'<option value="">No wallets discovered</option>':a.wallets.map(e=>`<option value="${s(e.name)}" ${e.name===a.selectedWalletName?"selected":""}>${s(e.name)}</option>`).join("")}function ld(){return a.iosWallets.map(e=>`<option value="${s(e.id)}" ${e.id===a.selectedIosWalletId?"selected":""}>${s(e.name)} - ${s(e.detail)}</option>`).join("")}function cn(e){var t;return((t=a.iosWallets.find(r=>r.id===e))==null?void 0:t.name)??e}function Zv(e){return a.iosWallets.some(t=>t.id===e)}function Qv(e){const t=e.supports;return`
|
|
2769
|
+
<div class="capabilities">
|
|
2770
|
+
<span>${s(e.backend)}</span>
|
|
2771
|
+
<span>${e.cluster.map(ft).join(", ")}</span>
|
|
2772
|
+
<span>message ${t.signMessage?"yes":"no"}</span>
|
|
2773
|
+
<span>transaction ${t.signTransaction?"yes":"no"}</span>
|
|
2774
|
+
<span>send ${t.signAndSendTransaction?"yes":"no"}</span>
|
|
2775
|
+
</div>
|
|
2776
|
+
`}function Xv(e){const t=[e.supports.signMessage?"message":"",e.supports.signTransaction?"transaction":"",e.supports.signAndSendTransaction?"send":""].filter(Boolean);return t.length?`${e.backend}: ${t.join(", ")}`:e.backend}function Ua(e,t,r){const n=!a.address&&e!=="wallet"&&e!=="agent"&&e!=="generated"&&e!=="labs",o=[a.activeTab===e?"active":"",r?"has-mobile-label":""].filter(Boolean).join(" "),c=r?`<span class="nav-label nav-label-full">${s(t)}</span><span class="nav-label nav-label-mobile">${s(r)}</span>`:`<span class="nav-label">${s(t)}</span>`;return`<button data-tab="${e}" class="${o}" aria-label="${s(t)}" ${n?'disabled title="Connect a wallet to unlock this workspace."':""}>${c}</button>`}function eb(){const e=[a.address?["Address",a.address]:null,a.signature?["Message signature",a.signature]:null,a.customTransactionBase64&&!a.txSignature?["Generated transaction",a.customTransactionBase64]:null,a.txSignature?["Signed transaction",a.txSignature]:null,a.txid?["Transaction id",a.txid]:null].filter(Boolean);return e.length===0?'<div class="empty">Results appear here after wallet approval.</div>':`
|
|
2777
|
+
<div class="results">
|
|
2778
|
+
${e.map(([t,r])=>`
|
|
2779
|
+
<div class="result-row">
|
|
2780
|
+
<span>${s(t)}</span>
|
|
2781
|
+
<code>${s(r)}</code>
|
|
2782
|
+
<button data-copy="${s(r)}">Copy</button>
|
|
2783
|
+
</div>
|
|
2784
|
+
`).join("")}
|
|
2785
|
+
</div>
|
|
2786
|
+
`}function tb(e){return[["Prepared by",cd(e)],["Source",dd(e)],["Wallet",a.address?_(a.address):"Connect wallet to sign"],["Network",ft(a.cluster)],["Template",e.templateTitle],["Action",e.actionType.replace(/_/g," ")]]}function cd(e){return e.source==="ai"?"AI plan reviewed in Agentic":"You in Agentic"}function dd(e){return e.source==="ai"?"Bring-your-own-key AI plan":"Keyless template, no AI"}function rb(e){const t=Dt().filter(es).length,r=Ve(),n=xb(a.inboxFilter);return`
|
|
2787
|
+
<div class="queue-status">
|
|
2788
|
+
<span>${s(r)}</span>
|
|
2789
|
+
<strong>${e} awaiting review</strong>
|
|
2790
|
+
<span>${t} in queue</span>
|
|
2791
|
+
<span>${s(n)}</span>
|
|
2792
|
+
</div>
|
|
2793
|
+
`}function ab(){const e=ba(),t=e.filter(c=>c.status==="active"&&!Za(c)).length,r=e.filter(Za).length,n=e.length,o=te()==="agentic-cloud"?"Agentic Cloud recurring":te()==="local-bridge"?"Private local mode":"Browser local fallback";return`
|
|
2794
|
+
<div class="queue-status">
|
|
2795
|
+
<span>${s(o)}</span>
|
|
2796
|
+
<strong>${t} active recurring plan${t===1?"":"s"}</strong>
|
|
2797
|
+
<span>${n} saved</span>
|
|
2798
|
+
<span>${r} completed</span>
|
|
2799
|
+
<span>Each run still needs wallet approval</span>
|
|
2800
|
+
</div>
|
|
2801
|
+
`}function nb(e=md()){return te()!=="local-bridge"&&e.length===0?Gs("bridge"):e.length===0?Gs("clear"):`
|
|
2802
|
+
<div class="inbox-list">
|
|
2803
|
+
${e.map(ib).join("")}
|
|
2804
|
+
</div>
|
|
2805
|
+
`}function Gs(e){const t=e==="bridge",r="No approvals waiting",n=t?te()==="agentic-cloud"?"Queue a one-time plan to Agentic Cloud. No localhost is required.":"Queue a one-time plan or create a recurring schedule. Browser workflow stays local to this device.":Ib();return`
|
|
2806
|
+
<div class="empty queue-empty queue-empty-state">
|
|
2807
|
+
<div>
|
|
2808
|
+
<span>${s("Queue clear")}</span>
|
|
2809
|
+
<h3>${s(r)}</h3>
|
|
2810
|
+
<p>${s(n)}</p>
|
|
2811
|
+
</div>
|
|
2812
|
+
</div>
|
|
2813
|
+
`}function ib(e){const t=["ready","overdue","failed"].includes(e.status),r=De(e.id),n=e.workflowSource==="cloud",o=sb(e),c=lb(e),d=Qa(e),m=ud(e),A=!a.bridgeActive&&!r&&!n||a.busy||!t||!!d;return`
|
|
2814
|
+
<article class="inbox-item approval-ticket ${e.status}">
|
|
2815
|
+
<div class="ticket-status-rail ${Ks(e.status)}"></div>
|
|
2816
|
+
<div class="ticket-body">
|
|
2817
|
+
<div class="pill-row">
|
|
2818
|
+
<span class="status-pill ${Ks(e.status)}">${s(e.status)}</span>
|
|
2819
|
+
<span class="status-pill neutral">${s(e.kind.replace("_"," "))}</span>
|
|
2820
|
+
${e.recurringId?'<span class="status-pill neutral">recurring</span>':""}
|
|
2821
|
+
${e.txStatus?`<span class="status-pill ${Lb(e.txStatus)}">tx ${s(e.txStatus)}</span>`:""}
|
|
2822
|
+
</div>
|
|
2823
|
+
<h3>${s(e.summary)}</h3>
|
|
2824
|
+
${e.note?`<p class="action-note">${s(e.note)}</p>`:""}
|
|
2825
|
+
${ub(e)}
|
|
2826
|
+
${db(e)}
|
|
2827
|
+
${ob(e)}
|
|
2828
|
+
${vc(e.id)}
|
|
2829
|
+
${qi("approval",e.id)}
|
|
2830
|
+
<p>${s(e.kind)} on ${s(e.cluster)} - due ${Y(e.dueAt)}</p>
|
|
2831
|
+
${e.error?`<p class="error-text">${s(e.error)}</p>`:""}
|
|
2832
|
+
${e.txError?`<p class="error-text">${s(e.txError)}</p>`:""}
|
|
2833
|
+
${e.txid?wd(e.txid,e.cluster):""}
|
|
2834
|
+
<div class="approval-effect" data-approval-effect="${s(e.workflowSource??(r?"browser":"local-bridge"))}">
|
|
2835
|
+
<strong>What this decision does</strong>
|
|
2836
|
+
<p>${s(c)}</p>
|
|
2837
|
+
</div>
|
|
2838
|
+
${d?`<p class="error-text">${s(d)}</p>`:""}
|
|
2839
|
+
</div>
|
|
2840
|
+
<div class="inbox-actions">
|
|
2841
|
+
<button data-action-op="execute" data-action-id="${e.id}" class="primary" ${A?"disabled":""} ${d?`title="${s(d)}"`:""}>${s(o.approve)}</button>
|
|
2842
|
+
${m?`<button data-action-op="confirm" data-action-id="${e.id}" class="primary" ${a.busy?"disabled":""}>Check confirmation</button>`:""}
|
|
2843
|
+
<button data-action-op="reject" data-action-id="${e.id}" ${a.busy||Lt(e)?"disabled":""}>${s(o.reject)}</button>
|
|
2844
|
+
<button data-action-op="copy" data-action-id="${e.id}">Copy request</button>
|
|
2845
|
+
<details class="generated-plan-more inbox-more-actions">
|
|
2846
|
+
<summary>More</summary>
|
|
2847
|
+
<div>
|
|
2848
|
+
<button data-action-op="archive" data-action-id="${e.id}" ${a.busy?"disabled":""}>Cancel request</button>
|
|
2849
|
+
<button class="utility danger" data-action-op="delete" data-action-id="${e.id}" ${a.busy?"disabled":""}>Delete permanently</button>
|
|
2850
|
+
</div>
|
|
2851
|
+
</details>
|
|
2852
|
+
</div>
|
|
2853
|
+
</article>
|
|
2854
|
+
`}function ob(e){const t=!a.address||a.address!==e.walletAddress||a.busy,r=bc(e.id),n=new Set(r.map(c=>c.kind));return`
|
|
2855
|
+
<div class="inline-receipt-actions" aria-label="Receipt proof actions">
|
|
2856
|
+
<div>
|
|
2857
|
+
<strong>Receipt proofs</strong>
|
|
2858
|
+
<p>Optional wallet-signed records for this approval. They do not approve, submit, or move funds.</p>
|
|
2859
|
+
</div>
|
|
2860
|
+
<div class="inline-receipt-button-grid">
|
|
2861
|
+
${[["intent","Sign proof of intent","Record the exact request before deciding.","Proof of intent signed"],["policy","Sign proof of policy","Record the caps and wallet rules checked.","Proof of policy signed"],["review","Sign proof of review","Record the risks reviewed before the wallet opens.","Proof of review signed"],["rejection","Deny with proof","Sign a rejection receipt, then deny this request.","Rejection proof signed"]].map(([c,d,m,A])=>{const $=wa(kd(c)),R=$?n.has($.kind):!1;return`
|
|
2862
|
+
<button
|
|
2863
|
+
type="button"
|
|
2864
|
+
data-inline-receipt-kind="${s(c)}"
|
|
2865
|
+
data-inline-receipt-action-id="${s(e.id)}"
|
|
2866
|
+
title="${s(m)}"
|
|
2867
|
+
${t||R?"disabled":""}
|
|
2868
|
+
>
|
|
2869
|
+
${s(R?A:d)}
|
|
2870
|
+
</button>
|
|
2871
|
+
`}).join("")}
|
|
2872
|
+
</div>
|
|
2873
|
+
</div>
|
|
2874
|
+
`}function sb(e){return Xo(e)?{approve:"Review and send",reject:"Deny request"}:dn(e)?{approve:"Use private local mode",reject:"Deny request"}:e.workflowSource==="cloud"||De(e.id)?{approve:"Sign approval proof",reject:"Deny request"}:{approve:"Approve in wallet",reject:"Reject"}}function lb(e){return Xo(e)?"Agentic Cloud prepares and simulates the exact SOL transfer, your browser opens your wallet for that transaction only, then Agentic saves a finalization receipt. Agentic never receives signing authority.":dn(e)?e.kind==="transfer_sol"?"This cloud transfer requires transaction finalization, but the connected wallet cannot sign and send it from this browser session.":"This money-moving request requires transaction finalization. Cloud finalization for this action type is not live yet, so proof-only approval is blocked.":e.workflowSource==="cloud"?"Your wallet signs a decision proof bound to this approval. Agentic Cloud saves the receipt; this proof does not submit a transaction.":De(e.id)?"Your wallet signs a browser-local decision proof. The receipt stays on this device; no transaction is submitted by this proof.":"Private local mode sends the prepared action to your local runtime. The connected wallet still controls the final signature or send request."}const cb=new Set(["transfer_sol","transfer_spl","swap","custom_transaction"]);function Xo(e){var t;return e.workflowSource==="cloud"&&e.kind==="transfer_sol"&&((t=a.capabilities)==null?void 0:t.supports.signAndSendTransaction)===!0&&!!(a.address&&a.address===e.walletAddress)}function ud(e){return e.workflowSource==="cloud"&&!!(e.finalizationId&&e.txid)&&(e.status==="approval_pending"||e.finalizationStatus==="submitted"||e.txStatus==="pending")}function dn(e){return e.workflowSource==="cloud"&&cb.has(e.kind)}function Qa(e){var t;return dn(e)?e.kind==="transfer_sol"?!a.address||a.address!==e.walletAddress?"Connect the approval wallet before finalizing this cloud SOL transfer.":((t=a.capabilities)==null?void 0:t.supports.signAndSendTransaction)!==!0?"This wallet cannot sign and send transactions from the browser. Use private local mode or reject this request.":null:"Cloud transaction finalization for this action is not live yet. Use private local mode or reject this request.":null}function db(e){var o,c,d,m;if(!dn(e)&&!e.finalization)return"";const r=((o=e.finalization)==null?void 0:o.status)??e.finalizationStatus??"not_started";return`
|
|
2875
|
+
<div class="finalization-checklist" aria-label="Transaction finalization checklist">
|
|
2876
|
+
${[{label:"Constraints locked",complete:!0,detail:e.transactionHash?_(e.transactionHash):"Approval parameters are bound to this request."},{label:"Quote refreshed",complete:!!((c=e.finalization)!=null&&c.quote||r==="simulation_passed"||r==="submitted"||r==="confirmed"),detail:e.quoteHash?_(e.quoteHash):"Refreshed at final review."},{label:"Simulation passed",complete:((m=(d=e.finalization)==null?void 0:d.simulation)==null?void 0:m.status)==="ok"||r==="simulation_passed"||r==="submitted"||r==="confirmed",detail:e.simulationHash?_(e.simulationHash):"Required before wallet opens."},{label:"Receipt saved",complete:!!(e.txid||r==="confirmed"),detail:e.txid?_(e.txid):"Saved after wallet approval."}].map(A=>`
|
|
2877
|
+
<div class="${A.complete?"complete":""}">
|
|
2878
|
+
<span>${A.complete?"ok":""}</span>
|
|
2879
|
+
<strong>${s(A.label)}</strong>
|
|
2880
|
+
<p>${s(A.detail)}</p>
|
|
2881
|
+
</div>
|
|
2882
|
+
`).join("")}
|
|
2883
|
+
</div>
|
|
2884
|
+
`}function ub(e){return`
|
|
2885
|
+
<dl class="action-preview">
|
|
2886
|
+
${[["Wallet",_(e.walletAddress)],["Recipient",yr(e)?_(yr(e)):"n/a"],["Amount",Zt(e)],["Token",Qt(e)],["Caps","Checked before wallet opens"],["Fee","Estimated by wallet at approval"]].map(([r,n])=>Yt(r,n)).join("")}
|
|
2887
|
+
</dl>
|
|
2888
|
+
`}function pb(){const e=a.recurringDraft,t=e.recipient?_(e.recipient):"Recipient required",r=fb(e),n=!a.address||a.busy,c=te()==="browser-workflow",d=c?"Define a device-local recurring fallback. It creates an immediate Approval Inbox item here, but does not run background schedules after this tab closes.":"Define a supported recurring payment or subscription. Each occurrence returns to Approval Inbox before wallet signing.",m=c?"Browser workflow stores this schedule on this device and creates one local approval item now. Use Agentic Cloud or Private local mode for background scheduling.":`${Ve()} owns this schedule. No transaction signs until you approve an occurrence.`,A=a.address?c?"Creates one local Approval Inbox item now. No background scheduler runs after this tab closes.":"Future occurrences will appear in Approval Inbox.":"Connect a wallet before creating a recurring schedule.";return`
|
|
2889
|
+
<div class="recurring-panel recurring-contract">
|
|
2890
|
+
<div class="contract-head">
|
|
2891
|
+
<div>
|
|
2892
|
+
<span>Recurring setup</span>
|
|
2893
|
+
<h3>Create recurring schedule</h3>
|
|
2894
|
+
<p class="recurring-help">${s(d)}</p>
|
|
2895
|
+
</div>
|
|
2896
|
+
<strong>${s(kb(e.cadence))}</strong>
|
|
2897
|
+
</div>
|
|
2898
|
+
<div class="recurring-boundary-note">
|
|
2899
|
+
<strong>Signing boundary</strong>
|
|
2900
|
+
<p>${s(m)}</p>
|
|
2901
|
+
</div>
|
|
2902
|
+
<dl class="contract-summary">
|
|
2903
|
+
${Yt("Asset",`${e.amount||"Amount"} ${e.token||"Token"}`)}
|
|
2904
|
+
${Yt("Recipient",t)}
|
|
2905
|
+
${Yt("Cadence",Pb(e))}
|
|
2906
|
+
${Yt("Limit",r)}
|
|
2907
|
+
</dl>
|
|
2908
|
+
${gb()}
|
|
2909
|
+
<div class="contract-section">
|
|
2910
|
+
<div>
|
|
2911
|
+
<span>Payment terms</span>
|
|
2912
|
+
<p>What the prepared action will request from the wallet.</p>
|
|
2913
|
+
</div>
|
|
2914
|
+
<div class="recurring-grid">
|
|
2915
|
+
${mb(e.token)}
|
|
2916
|
+
${st("recurringAmount","Amount *",e.amount)}
|
|
2917
|
+
${st("recurringRecipient","Recipient *",e.recipient)}
|
|
2918
|
+
</div>
|
|
2919
|
+
</div>
|
|
2920
|
+
<div class="contract-section">
|
|
2921
|
+
<div>
|
|
2922
|
+
<span>Schedule terms</span>
|
|
2923
|
+
<p>When new requests should appear in Approval Inbox.</p>
|
|
2924
|
+
</div>
|
|
2925
|
+
<div class="recurring-grid schedule-grid">
|
|
2926
|
+
<label class="field compact">
|
|
2927
|
+
<span>Cadence</span>
|
|
2928
|
+
<select id="recurringCadence" data-recurring-field="cadence">
|
|
2929
|
+
${qa("weekly","Weekly")}
|
|
2930
|
+
${qa("monthly","Monthly")}
|
|
2931
|
+
${qa("interval_days","Interval days")}
|
|
2932
|
+
${qa("interval_hours","Interval hours")}
|
|
2933
|
+
${qa("interval_minutes","Interval minutes")}
|
|
2934
|
+
</select>
|
|
2935
|
+
</label>
|
|
2936
|
+
${Cb(e)}
|
|
2937
|
+
</div>
|
|
2938
|
+
</div>
|
|
2939
|
+
<div class="contract-section">
|
|
2940
|
+
<div>
|
|
2941
|
+
<span>Caps and reminders</span>
|
|
2942
|
+
<p>Optional stop time and webhook reminder path.</p>
|
|
2943
|
+
</div>
|
|
2944
|
+
<div class="recurring-grid">
|
|
2945
|
+
${st("recurringExpiresAt","Expires at",e.expiresAt,"","datetime-local")}
|
|
2946
|
+
${st("recurringWebhookUrl","Webhook URL",e.webhookUrl,"https://example.com/agentic-webhook")}
|
|
2947
|
+
</div>
|
|
2948
|
+
</div>
|
|
2949
|
+
<label class="field compact approval-memo">
|
|
2950
|
+
<span>Approval memo</span>
|
|
2951
|
+
<input id="recurringNote" data-recurring-field="note" value="${s(e.note)}" placeholder="Reason shown when this appears in Approval Inbox" />
|
|
2952
|
+
</label>
|
|
2953
|
+
${pd(e)}
|
|
2954
|
+
<div class="recurring-form-actions contract-actions">
|
|
2955
|
+
<button id="createRecurring" class="primary" ${n?"disabled":""}>Create recurring schedule</button>
|
|
2956
|
+
<button type="button" class="utility" data-recurring-action="dca-proof">Create DCA review proof instead</button>
|
|
2957
|
+
<span class="contract-helper">${s(A)}</span>
|
|
2958
|
+
</div>
|
|
2959
|
+
</div>
|
|
2960
|
+
`}function fb(e){const t=[];if(e.maxOccurrences.trim()&&t.push(`${e.maxOccurrences.trim()} occurrence${e.maxOccurrences.trim()==="1"?"":"s"}`),e.expiresAt.trim()){const r=eo(e.expiresAt);t.push(r?`expires ${Y(r)}`:"expiry needs a valid date")}return t.length?t.join(" · "):"Manual review every time"}function pd(e){const t=ai(e),r=Rb(e);return`
|
|
2961
|
+
<div class="recurring-next-preview recurring-production-preview">
|
|
2962
|
+
<div>
|
|
2963
|
+
<span>Next runs</span>
|
|
2964
|
+
<strong id="recurringNextOccurrence">${s(t[0]?Y(t[0]):Sd(e))}</strong>
|
|
2965
|
+
</div>
|
|
2966
|
+
${t.length?`<ol>${t.map(n=>`<li>${s(Y(n))}</li>`).join("")}</ol>`:""}
|
|
2967
|
+
${r?`<p>${s(fd(r,e.token))}</p>`:""}
|
|
2968
|
+
</div>
|
|
2969
|
+
`}function fd(e,t){const r=`${e.perWeek} ${t}/week · ${e.perMonth} ${t}/month`;return e.bounded&&e.totalAmount!==void 0&&e.totalRuns!==void 0?`Runs up to ${e.totalRuns} time${e.totalRuns===1?"":"s"} and spends up to ${e.totalAmount} ${t}. ${r}.`:`No lifetime cap set. Current rate estimate: ${r}.`}function gb(){return`
|
|
2970
|
+
<div class="template-filter-row recurring-preset-row" role="group" aria-label="Recurring plan presets">
|
|
2971
|
+
${Ni.map(e=>`
|
|
2972
|
+
<button
|
|
2973
|
+
type="button"
|
|
2974
|
+
data-recurring-preset="${s(e.id)}"
|
|
2975
|
+
class="${a.recurringPreset===e.id?"active":""}"
|
|
2976
|
+
${a.busy?"disabled":""}
|
|
2977
|
+
title="${s(e.description)}"
|
|
2978
|
+
>
|
|
2979
|
+
${s(e.title)}
|
|
2980
|
+
</button>
|
|
2981
|
+
`).join("")}
|
|
2982
|
+
</div>
|
|
2983
|
+
`}function mb(e){const t=nn("recurringToken");return`
|
|
2984
|
+
<label class="field compact ${a.recurringErrors.recurringToken?"field-error":""}">
|
|
2985
|
+
<span>Token</span>
|
|
2986
|
+
<select id="recurringToken" data-recurring-field="token">
|
|
2987
|
+
${Lf.map(r=>`<option value="${s(r)}" ${r===e?"selected":""}>${s(r)}</option>`).join("")}
|
|
2988
|
+
</select>
|
|
2989
|
+
${t}
|
|
2990
|
+
</label>
|
|
2991
|
+
`}function hb(){const e=ba();return e.length===0?"":`
|
|
2992
|
+
<div class="recurring-list">
|
|
2993
|
+
${e.map(yb).join("")}
|
|
2994
|
+
</div>
|
|
2995
|
+
`}function yb(e){var $,R;const t=Za(e),r=hs(t?"completed":e.status),n=Eb(e),o=_b(e),c=e.status==="active"?"pause":"resume",d=a.recurringOccurrenceHistory[e.id],m=a.recurringNotificationStatus[e.id],A=gr(e);return`
|
|
2996
|
+
<article class="recurring-item">
|
|
2997
|
+
<div>
|
|
2998
|
+
<div class="pill-row">
|
|
2999
|
+
<span class="status-pill ${gd(r.tone)}">${s(r.label)}</span>
|
|
3000
|
+
<span class="status-pill neutral">${s(e.cadence)}</span>
|
|
3001
|
+
<span class="recurring-count">${e.occurrencesCreated??0}${e.maxOccurrences?` of ${e.maxOccurrences}`:""}</span>
|
|
3002
|
+
</div>
|
|
3003
|
+
<h3>${s(e.amount)} ${s(e.token)} to ${s(_(e.recipient))}</h3>
|
|
3004
|
+
<p>${s(Ad(e))}</p>
|
|
3005
|
+
<div class="recurring-card-metrics">
|
|
3006
|
+
<span>${s(n[0]?`Next ${Y(n[0])}`:"No future run preview")}</span>
|
|
3007
|
+
<span>${s(fd(o,e.token))}</span>
|
|
3008
|
+
${e.expiresAt?`<span>${s(`Expires ${Y(e.expiresAt)}`)}</span>`:""}
|
|
3009
|
+
${($=e.notifications)!=null&&$.webhookUrl?`<span>${s(`Webhook ${_(e.notifications.webhookUrl)}`)}</span>`:""}
|
|
3010
|
+
</div>
|
|
3011
|
+
${n.length?`
|
|
3012
|
+
<details class="recurring-upcoming-runs">
|
|
3013
|
+
<summary>Upcoming runs</summary>
|
|
3014
|
+
<ol>${n.map(F=>`<li>${s(Y(F))}</li>`).join("")}</ol>
|
|
3015
|
+
</details>
|
|
3016
|
+
`:""}
|
|
3017
|
+
${vb(e,d)}
|
|
3018
|
+
${bb(e,m,A)}
|
|
3019
|
+
${e.note?`<p class="action-note">${s(e.note)}</p>`:""}
|
|
3020
|
+
</div>
|
|
3021
|
+
<div class="recurring-actions">
|
|
3022
|
+
<button data-recurring-op="${c}" data-recurring-id="${e.id}" ${t||a.busy?"disabled":""}>${e.status==="active"?"Pause":"Resume"}</button>
|
|
3023
|
+
<button data-recurring-op="history" data-recurring-id="${e.id}" ${a.busy?"disabled":""}>${d?"Refresh history":"Load history"}</button>
|
|
3024
|
+
${A==="cloud"&&((R=e.notifications)!=null&&R.webhookUrl)?`<button data-recurring-op="notifications" data-recurring-id="${e.id}" ${a.busy?"disabled":""}>${m?"Refresh notifications":"Notifications"}</button>`:""}
|
|
3025
|
+
<button data-recurring-op="delete" data-recurring-id="${e.id}" ${a.busy?"disabled":""}>Delete</button>
|
|
3026
|
+
</div>
|
|
3027
|
+
</article>
|
|
3028
|
+
`}function vb(e,t){return t?t.error?`<div class="recurring-history-strip error-text">${s(t.error)}</div>`:t.occurrences.length===0?`
|
|
3029
|
+
<div class="recurring-history-strip">
|
|
3030
|
+
<strong>No runs yet</strong>
|
|
3031
|
+
<span>${s(e.nextDueAt?`First run is scheduled for ${Y(e.nextDueAt)}.`:"Runs appear here after they materialize.")}</span>
|
|
3032
|
+
</div>
|
|
3033
|
+
`:`
|
|
3034
|
+
<div class="recurring-history-list">
|
|
3035
|
+
<div class="recurring-history-head">
|
|
3036
|
+
<strong>Occurrence history</strong>
|
|
3037
|
+
${t.loadedAt?`<span>Updated ${s(Y(t.loadedAt))}</span>`:""}
|
|
3038
|
+
</div>
|
|
3039
|
+
${t.occurrences.map(Sb).join("")}
|
|
3040
|
+
${t.nextCursor?`<button data-recurring-op="history-more" data-recurring-id="${e.id}" data-recurring-cursor="${s(t.nextCursor)}" ${a.busy?"disabled":""}>Show older</button>`:""}
|
|
3041
|
+
</div>
|
|
3042
|
+
`:`
|
|
3043
|
+
<div class="recurring-history-strip">
|
|
3044
|
+
<strong>Occurrence history</strong>
|
|
3045
|
+
<span>Load completed and pending runs for this schedule.</span>
|
|
3046
|
+
</div>
|
|
3047
|
+
`}function bb(e,t,r){var c,d;if(r!=="cloud"||!((c=e.notifications)!=null&&c.webhookUrl))return"";const n=((d=a.recurringWebhookSecretOnce)==null?void 0:d.scheduleId)===e.id?a.recurringWebhookSecretOnce:null,o=t==null?void 0:t.lastDelivery;return`
|
|
3048
|
+
<div class="recurring-notifications-panel">
|
|
3049
|
+
<div class="recurring-history-head">
|
|
3050
|
+
<strong>Notifications</strong>
|
|
3051
|
+
<span>${s(_(e.notifications.webhookUrl))}</span>
|
|
3052
|
+
</div>
|
|
3053
|
+
${n?`
|
|
3054
|
+
<div class="recurring-secret-reveal">
|
|
3055
|
+
<span>Webhook secret shown once</span>
|
|
3056
|
+
<code>${s(n.secret)}</code>
|
|
3057
|
+
<button data-copy="${s(n.secret)}" data-copy-name="Webhook secret">Copy secret</button>
|
|
3058
|
+
</div>
|
|
3059
|
+
`:""}
|
|
3060
|
+
${t!=null&&t.error?`<p class="error-text">${s(t.error)}</p>`:""}
|
|
3061
|
+
${o?`
|
|
3062
|
+
<div class="recurring-history-strip">
|
|
3063
|
+
<strong>${s(wb(o))}</strong>
|
|
3064
|
+
<span>${s(Ab(o))}</span>
|
|
3065
|
+
</div>
|
|
3066
|
+
`:`
|
|
3067
|
+
<div class="recurring-history-strip">
|
|
3068
|
+
<strong>Delivery status not loaded</strong>
|
|
3069
|
+
<span>Refresh notifications to see webhook attempts and retries.</span>
|
|
3070
|
+
</div>
|
|
3071
|
+
`}
|
|
3072
|
+
<div class="recurring-actions inline-actions">
|
|
3073
|
+
<button data-recurring-op="notifications" data-recurring-id="${e.id}" ${a.busy?"disabled":""}>Refresh</button>
|
|
3074
|
+
<button data-recurring-op="rotate-secret" data-recurring-id="${e.id}" ${a.busy?"disabled":""}>Rotate secret</button>
|
|
3075
|
+
</div>
|
|
3076
|
+
</div>
|
|
3077
|
+
`}function wb(e){switch(e.status){case"delivered":return"Webhook delivered";case"pending":return"Webhook pending";case"failed":return"Webhook retry scheduled";case"abandoned":return"Webhook abandoned"}}function Ab(e){if(e.status==="delivered")return`Delivered ${e.deliveredAt?Y(e.deliveredAt):Y(e.updatedAt)} after ${e.attempts} attempt${e.attempts===1?"":"s"}.`;const t=e.status==="pending"||e.status==="failed"?` Next attempt ${Y(e.nextAttemptAt)}.`:"";return`${e.attempts} attempt${e.attempts===1?"":"s"}.${t}${e.lastError?` ${e.lastError}`:""}`}function Sb(e){var n,o;const t=e.statusLabel??co(e.status,e.approval),r=((n=e.completed)==null?void 0:n.txid)??((o=e.approval)==null?void 0:o.txid);return`
|
|
3078
|
+
<div class="recurring-history-row">
|
|
3079
|
+
<span class="status-pill ${gd(t.tone)}">${s(t.label)}</span>
|
|
3080
|
+
<strong>${s(Y(e.dueAt))}</strong>
|
|
3081
|
+
${e.approval?`<span>${s(`Approval ${_(e.approval.id)}`)}</span>`:""}
|
|
3082
|
+
${r?`<button data-copy="${s(r)}" data-copy-name="Transaction id">Copy txid</button>`:""}
|
|
3083
|
+
${e.error?`<p class="error-text">${s(e.error)}</p>`:""}
|
|
3084
|
+
</div>
|
|
3085
|
+
`}function gd(e){return e==="success"?"tx-confirmed":e==="danger"?"tx-failed":e==="warning"||e==="info"?"tx-pending":"neutral"}function $b(e){var r;const t=((r=wa(e.labId))==null?void 0:r.category)==="advanced";return`
|
|
3086
|
+
<article class="lab-artifact artifact-summary-card">
|
|
3087
|
+
<div class="artifact-summary-head">
|
|
3088
|
+
<div class="artifact-meta-line">
|
|
3089
|
+
<span class="status-pill ${e.verified?"tx-confirmed":"tx-pending"}">${e.verified?"verified":"signed"}</span>
|
|
3090
|
+
<span>${s(Sa(e.kind))}</span>
|
|
3091
|
+
</div>
|
|
3092
|
+
<span>${s(Y(e.createdAt))}</span>
|
|
3093
|
+
</div>
|
|
3094
|
+
<h3>${s(t?"Legacy receipt signed and saved":"Receipt signed and saved")}</h3>
|
|
3095
|
+
<p class="lab-thesis">No further action is required. Use this record for your own audit trail or share it with an agent, auditor, support thread, or teammate.</p>
|
|
3096
|
+
<div class="artifact-intent-block">
|
|
3097
|
+
<span>Signed request</span>
|
|
3098
|
+
<p>${s(e.input)}</p>
|
|
3099
|
+
</div>
|
|
3100
|
+
<div class="artifact-evidence-row">
|
|
3101
|
+
${ta(e,"Verdict")}
|
|
3102
|
+
${ta(e,"Custody")}
|
|
3103
|
+
${ta(e,"Effect")}
|
|
3104
|
+
</div>
|
|
3105
|
+
<div class="lab-actions lab-signature-action">
|
|
3106
|
+
<button type="button" class="utility" data-artifact-view="signed">View in archive</button>
|
|
3107
|
+
<button type="button" data-copy="${s(Pe(e))}" data-copy-name="Receipt JSON">Copy receipt JSON</button>
|
|
3108
|
+
<button type="button" data-copy="${s(e.signingMessage)}" data-copy-name="Copy signed message">Copy signed message</button>
|
|
3109
|
+
<button type="button" class="utility" data-lab-action="create-another">Create another</button>
|
|
3110
|
+
</div>
|
|
3111
|
+
<details class="artifact-technical-details">
|
|
3112
|
+
<summary>
|
|
3113
|
+
<span>Technical details</span>
|
|
3114
|
+
<strong>Hashes and signed message</strong>
|
|
3115
|
+
</summary>
|
|
3116
|
+
<div class="hash-grid">
|
|
3117
|
+
${dr("Pre-signature",e.preSignatureHash)}
|
|
3118
|
+
${dr("Receipt",e.artifactHash)}
|
|
3119
|
+
${dr("Signature",e.signature)}
|
|
3120
|
+
${dr("Wallet",e.walletAddress)}
|
|
3121
|
+
</div>
|
|
3122
|
+
<div class="results compact-results">
|
|
3123
|
+
<div class="result-row">
|
|
3124
|
+
<span>Signing message</span>
|
|
3125
|
+
<code>${s(e.signingMessage)}</code>
|
|
3126
|
+
<button data-copy="${s(e.signingMessage)}" data-copy-name="Copy signed message">Copy</button>
|
|
3127
|
+
</div>
|
|
3128
|
+
</div>
|
|
3129
|
+
</details>
|
|
3130
|
+
</article>
|
|
3131
|
+
`}function ta(e,t){const r=e.payload.metrics.find(c=>c.label.toLowerCase()===t.toLowerCase()),n=(r==null?void 0:r.value)??"Recorded";return`
|
|
3132
|
+
<div class="${(r==null?void 0:r.tone)??"neutral"}">
|
|
3133
|
+
<span>${s(t)}</span>
|
|
3134
|
+
<strong>${s(n)}</strong>
|
|
3135
|
+
</div>
|
|
3136
|
+
`}function md(){const e=Dt().filter(es);switch(a.inboxFilter){case"one-time":return e.filter(t=>!t.recurringId);case"recurring":return e.filter(t=>!!t.recurringId);case"ready":return e.filter(t=>t.status==="ready"||t.status==="overdue");case"scheduled":return e.filter(t=>t.status==="scheduled");case"attention":return e.filter(t=>t.status==="failed"||t.status==="blocked");case"all":return e}}function Dt(){switch(te()){case"agentic-cloud":return a.preparedActions.filter(e=>e.workflowSource==="cloud");case"browser-workflow":return a.preparedActions.filter(e=>De(e.id));case"local-bridge":return a.preparedActions.filter(e=>e.workflowSource==="local-bridge")}}function ba(){switch(te()){case"agentic-cloud":return a.recurringPayments.filter(e=>gr(e)==="cloud");case"browser-workflow":return a.recurringPayments.filter(e=>gr(e)==="browser");case"local-bridge":return a.recurringPayments.filter(e=>gr(e)==="local-bridge")}}function es(e){return!Lt(e)}function Gr(e,t){return`<option value="${e}" ${a.inboxFilter===e?"selected":""}>${s(t)}</option>`}function xb(e){switch(e){case"ready":return"Showing ready approvals";case"scheduled":return"Showing scheduled items";case"attention":return"Showing needs attention";case"one-time":return"Showing one-time approvals";case"recurring":return"Showing recurring plans";case"all":return"Showing all active"}}function qa(e,t){return`<option value="${e}" ${a.recurringDraft.cadence===e?"selected":""}>${s(t)}</option>`}function kb(e){switch(e){case"weekly":return"Weekly";case"monthly":return"Monthly";case"interval_days":return"Every few days";case"interval_hours":return"Hourly interval";case"interval_minutes":return"Minute interval"}}function Pb(e){const t=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];return e.cadence==="weekly"?`${t[Number(e.dayOfWeek)]??"Selected day"} at ${e.localTime||"09:00"}`:e.cadence==="monthly"?`Day ${e.dayOfMonth||"1"} at ${e.localTime||"09:00"}`:e.cadence==="interval_hours"?`Every ${e.intervalHours||"1"} hour(s)`:e.cadence==="interval_minutes"?`Every ${e.intervalMinutes||"60"} minute(s)`:`Every ${e.intervalDays||"1"} day(s)`}function Cb(e){const t=st("recurringMaxOccurrences","Max occurrences",e.maxOccurrences,"empty for indefinite");return e.cadence==="weekly"?`
|
|
3137
|
+
<label class="field compact">
|
|
3138
|
+
<span>Day</span>
|
|
3139
|
+
<select id="recurringDayOfWeek" data-recurring-field="dayOfWeek">
|
|
3140
|
+
${["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"].map((r,n)=>`<option value="${n}" ${e.dayOfWeek===String(n)?"selected":""}>${r}</option>`).join("")}
|
|
3141
|
+
</select>
|
|
3142
|
+
${nn("recurringDayOfWeek")}
|
|
3143
|
+
</label>
|
|
3144
|
+
${st("recurringLocalTime","Local time",e.localTime,"09:00")}
|
|
3145
|
+
${t}
|
|
3146
|
+
`:e.cadence==="monthly"?`
|
|
3147
|
+
${st("recurringDayOfMonth","Day of month",e.dayOfMonth,"1-31")}
|
|
3148
|
+
${st("recurringLocalTime","Local time",e.localTime,"09:00")}
|
|
3149
|
+
${t}
|
|
3150
|
+
`:e.cadence==="interval_hours"?`
|
|
3151
|
+
${st("recurringIntervalHours","Every hours",e.intervalHours,"1")}
|
|
3152
|
+
${st("recurringStartAt","Start at",e.startAt,"","datetime-local")}
|
|
3153
|
+
${t}
|
|
3154
|
+
`:e.cadence==="interval_minutes"?`
|
|
3155
|
+
${st("recurringIntervalMinutes","Every minutes",e.intervalMinutes,"60")}
|
|
3156
|
+
${st("recurringStartAt","Start at",e.startAt,"","datetime-local")}
|
|
3157
|
+
${t}
|
|
3158
|
+
`:`
|
|
3159
|
+
${st("recurringIntervalDays","Every days",e.intervalDays,"1")}
|
|
3160
|
+
${st("recurringStartAt","Start at",e.startAt,"","datetime-local")}
|
|
3161
|
+
${t}
|
|
3162
|
+
`}function st(e,t,r,n="",o="text"){const c=nn(e);return`
|
|
3163
|
+
<label class="field compact ${a.recurringErrors[e]?"field-error":""}">
|
|
3164
|
+
<span>${s(t)}</span>
|
|
3165
|
+
<input id="${e}" data-recurring-field="${s(e.replace(/^recurring/,"").replace(/^[A-Z]/,d=>d.toLowerCase()))}" type="${o}" value="${s(r)}" placeholder="${s(n)}" />
|
|
3166
|
+
${c}
|
|
3167
|
+
</label>
|
|
3168
|
+
`}function lr(e,t,r){return`
|
|
3169
|
+
<article class="evidence-step ${r}">
|
|
3170
|
+
<div class="evidence-indicator"><span></span></div>
|
|
3171
|
+
<div>
|
|
3172
|
+
<div class="evidence-title">
|
|
3173
|
+
<strong>${s(e)}</strong>
|
|
3174
|
+
<span>${s(t.status)}</span>
|
|
3175
|
+
</div>
|
|
3176
|
+
<p>${s(t.detail)}</p>
|
|
3177
|
+
${t.meta?`<small>${s(t.meta)}</small>`:""}
|
|
3178
|
+
</div>
|
|
3179
|
+
</article>
|
|
3180
|
+
`}function hd(){var e;if(a.activeTab==="generated"){const t=Zn();return{status:a.generatedPlans.length?"Saved":"Empty",detail:(t==null?void 0:t.plan.intent)??"Template and AI plans are saved here for later review.",meta:t?`${Uo(t)} · ${Y(t.createdAt)}`:void 0}}if(a.activeTab==="wallet")return{status:a.signature?"Signed":"Ready",detail:a.signature?"Message approval returned a wallet signature.":bo,meta:a.signature?_(a.signature):`${ft(a.cluster)} message request`};if(a.agentPlan)return{status:"Prepared",detail:a.agentPlan.intent,meta:"Plan is ready for review."};if(a.signature)return{status:"Signed",detail:"Message intent was approved by the connected wallet.",meta:_(a.signature)};if(a.customTransactionBase64)return{status:"Transaction ready",detail:"Transaction bytes are staged for wallet approval.",meta:_(a.customTransactionBase64)};if(a.activeTab==="inbox"){const t=Dt().filter(r=>!r.archived).length;return{status:t?"Queued":"Empty",detail:t?`${t} request(s) are waiting in Approval Inbox.`:"No queued approvals are currently waiting.",meta:Ve()}}if(a.activeTab==="completed"){const t=tr();return{status:t.length?"Completed":"Empty",detail:((e=t[0])==null?void 0:e.title)??"Completed proofs, approvals, and recurring occurrences appear here.",meta:t[0]?`${t[0].status} · ${Y(t[0].completedAt)}`:void 0}}if(a.activeTab==="schedule"){const t=ba().filter(r=>r.status==="active"&&!Za(r)).length;return{status:t?"Recurring":"Draft",detail:t?`${t} recurring plan${t===1?"":"s"} active.`:"Create a recurring plan for future wallet review.",meta:Ve()}}if(a.activeTab==="labs"){if(a.artifactView==="signed")return{status:a.labArtifacts.length?"Archived":"Empty",detail:a.labArtifacts.length?`${a.labArtifacts.length} signed receipt${a.labArtifacts.length===1?"":"s"} are available for review.`:"No signed receipts have been created yet.",meta:a.labArtifacts[0]?_(a.labArtifacts[0].artifactHash):void 0};const t=Aa();return{status:"Receipt proof",detail:t.summary,meta:t.title}}return{status:a.address?"Ready":"Waiting",detail:a.address?"Select a workflow to prepare intent.":"Connect a wallet before intent can be reviewed."}}function yd(){var t,r;const e=Dt().filter(n=>!n.archived).length;if(a.activeTab==="wallet")return{status:a.cluster==="mainnet-beta"?"Mainnet caution":"Local policy",detail:a.cluster==="mainnet-beta"?"Only explicit wallet approval can produce a signature on mainnet.":"Wallet Standard approval gates every message and transaction request.",meta:a.capabilities?Xv(a.capabilities):void 0};if(a.activeTab==="agent")return{status:a.agentPlan?"Plan scoped":"Plan",detail:((t=a.agentPlan)==null?void 0:t.risk)??"Create a plan to expose route and risk before queueing.",meta:`Queue path: ${Ve()}`};if(a.activeTab==="generated"){const n=Zn();return{status:n?"Review scoped":"No plans",detail:(n==null?void 0:n.plan.risk)??"Plans stay separate from Approval Inbox until you queue them.",meta:n&&_t(n.plan)?`Queueable through ${Ve()}`:"Proof-only review"}}if(a.activeTab==="schedule"){const n=ba().length;return{status:"Recurring ready",detail:"Recurring plans create future Approval Inbox items, not automatic signatures.",meta:n?`${n} recurring plan(s) · ${Ve()}`:Ve()}}if(a.activeTab==="completed"){const n=tr();return{status:n.length?"Terminal history":"No completed plans",detail:n.length?"Completed history is read-only unless you explicitly delete a card.":"Plans stay out of history until a proof is signed, an approval is terminal, or a recurring schedule ends.",meta:n.length?`${n.length} completed plan(s)`:void 0}}return a.activeTab==="labs"?a.artifactView==="signed"?{status:a.bridgeActive?"Bridge mirrored":"Local archive",detail:a.labArchiveStatus,meta:((r=a.health)==null?void 0:r.labArtifactStorePath)??(a.bridgeActive?"Bridge archive connected":"Browser durable storage")}:{status:"Local verification",detail:"Receipt proofs bind payload hash, wallet, cluster, and signature for review.",meta:a.labArtifacts.length?`${a.labArtifacts.length} receipt${a.labArtifacts.length===1?"":"s"}`:"No receipts yet"}:e>0?{status:"Queued",detail:`${e} prepared action(s) are waiting for review.`,meta:`${Ve()} policy is active.`}:a.bridgeActive?{status:"Active",detail:"Local bridge is connected and ready to enforce prepared-action policy.",meta:Id()}:{status:a.cluster==="mainnet-beta"?"Caution":"Idle",detail:a.cluster==="mainnet-beta"?"Mainnet requests require explicit wallet approval and visible receipts.":`${Ve()} will hold queued work until explicit wallet approval.`}}function vd(){return a.address?{status:"Connected",detail:a.selectedWalletName||"Browser wallet signer is connected.",meta:_(a.address)}:{status:"Not connected",detail:"The app cannot sign or approve until a user wallet is connected.",meta:Ob()}}function bd(e){var t,r,n;if(a.activeTab==="wallet"&&a.signature)return{status:"Message proof",detail:"The wallet signature is ready to copy or verify downstream.",meta:_(a.signature)};if(a.activeTab==="agent"&&a.agentSignature)return{status:"Review proof",detail:"The signed plan review proof is available for audit.",meta:_(a.agentSignature)};if(a.activeTab==="generated"){const o=Zn();if(o!=null&&o.signature)return{status:"Proof signed",detail:"This plan has a wallet-signed review proof.",meta:_(o.signature)};if(o!=null&&o.preparedActionId)return{status:"Queued",detail:"This plan has been sent to Approval Inbox or recurring setup.",meta:o.preparedActionId}}if(a.activeTab==="completed"){const o=tr();if(o.length){const c=((t=o[0])==null?void 0:t.actionId)??((r=o[0])==null?void 0:r.signature)??"";return{status:"History ready",detail:`${o.length} completed plan record(s) are available.`,meta:c?_(c):void 0}}}return a.txid?{status:"Broadcast",detail:"A transaction id is available for external verification.",meta:_(a.txid)}:a.txSignature?{status:"Signed bytes",detail:"The wallet returned signed transaction bytes without broadcasting.",meta:_(a.txSignature)}:a.agentSignature?{status:"Proof signed",detail:"The plan review proof is available for copy or audit.",meta:_(a.agentSignature)}:a.receipts.length>0?{status:"Receipt ready",detail:`${a.receipts.length} local receipt(s) are available from the bridge.`,meta:(n=a.receipts[0])==null?void 0:n.actionId}:a.activeTab==="labs"&&e?{status:"Receipt proof",detail:"A signed receipt proof is available for review.",meta:_(e.artifactHash)}:{status:"Pending",detail:a.activeTab==="inbox"||a.activeTab==="schedule"?"Receipts appear after an approval is approved, rejected, or archived.":"Receipts appear after wallet approval or receipt proof signing."}}function cr(e){switch(e){case"intent":return a.agentPlan||a.generatedPlans.length||a.signature||a.customTransactionBase64?"good":a.address?"active":"idle";case"policy":return Dt().length||a.bridgeActive?"good":a.cluster==="mainnet-beta"?"warn":"idle";case"wallet":return a.address?"good":"idle";case"receipt":return a.txid||a.txSignature||a.agentSignature||a.receipts.length||tr().length||a.labArtifacts.length?"good":"idle"}}function Ir(e,t,r=""){return`
|
|
3181
|
+
<div class="context-row ${r}">
|
|
3182
|
+
<span>${s(e)}</span>
|
|
3183
|
+
<strong>${s(t)}</strong>
|
|
3184
|
+
</div>
|
|
3185
|
+
`}function wd(e,t){const r=Rd(e,t);return`
|
|
3186
|
+
<div class="tx-block">
|
|
3187
|
+
<code>${s(e)}</code>
|
|
3188
|
+
<a href="${s(r)}" target="_blank" rel="noreferrer">Explorer</a>
|
|
3189
|
+
<button data-copy="${s(e)}">Copy</button>
|
|
3190
|
+
</div>
|
|
3191
|
+
`}function dr(e,t){return`
|
|
3192
|
+
<div>
|
|
3193
|
+
<span>${s(e)}</span>
|
|
3194
|
+
<code>${s(_(t))}</code>
|
|
3195
|
+
</div>
|
|
3196
|
+
`}function Yt(e,t){return`
|
|
3197
|
+
<div>
|
|
3198
|
+
<dt>${s(e)}</dt>
|
|
3199
|
+
<dd>${s(t)}</dd>
|
|
3200
|
+
</div>
|
|
3201
|
+
`}function Tb(){switch(a.activeTab){case"wallet":return"Wallet signing";case"agent":return"Create One-Time Plan";case"generated":return"Review & Finish";case"inbox":return"Approval Inbox";case"completed":return"Completed Plans";case"schedule":return"Create Recurring Plan";case"labs":return"Receipt Proofs"}}function Ib(){return a.inboxFilter==="one-time"?"No one-time approvals. Queue a send or swap plan when you want a wallet decision.":a.inboxFilter==="recurring"?"No recurring occurrences waiting. Create a recurring plan first.":"No approvals waiting. Queue a one-time plan or create a recurring plan. Due recurring occurrences appear here for approve or deny."}function Zt(e){return typeof e.params.amountSol=="string"?`${e.params.amountSol} SOL`:typeof e.params.amount=="string"?e.params.amount:"n/a"}function Qt(e){return e.kind==="transfer_sol"?"SOL":typeof e.params.token=="string"?e.params.token:typeof e.params.inputToken=="string"&&typeof e.params.outputToken=="string"?`${e.params.inputToken} to ${e.params.outputToken}`:"n/a"}function Xi(e,t){const r=e.params[t];return typeof r=="string"?r:""}function yr(e){return Xi(e,"recipient")||Xi(e,"recipientAddress")}function Ad(e){const t=e.maxOccurrences?`, ${e.occurrencesCreated??0} of ${e.maxOccurrences} created`:", indefinite",r=e.expiresAt?`, expires ${Y(e.expiresAt)}`:"";return e.cadence==="weekly"?`Weekly on ${["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.dayOfWeek??-1]??"unknown day"} at ${e.localTime??"?"}${t}${r}.`:e.cadence==="monthly"?`Monthly on day ${e.dayOfMonth??"?"} at ${e.localTime??"?"}${t}${r}.`:e.cadence==="interval_hours"?`Every ${e.intervalHours??"?"} hour(s) starting ${Y(e.startAt??"")}${t}${r}.`:e.cadence==="interval_minutes"?`Every ${e.intervalMinutes??"?"} minute(s) starting ${Y(e.startAt??"")}${t}${r}.`:`Every ${e.intervalDays??"?"} day(s) starting ${Y(e.startAt??"")}${t}${r}.`}function Sd(e){const[t]=ai(e);return t?Y(t):"Complete schedule fields to preview"}function ai(e){const t=$d(e);return t?so(t,new Date,5).map(r=>r.dueAt.toISOString()):[]}function Rb(e){const t=$d(e);return!t||!(Number(e.amount)>0)?null:el(t,e.amount,new Date)}function $d(e){const t=new Date().toISOString(),r=Number(e.maxOccurrences),n=eo(e.expiresAt),o={cadence:e.cadence,createdAt:t,occurrencesCreated:0,...Number.isInteger(r)&&r>0?{maxOccurrences:r}:{},...n?{expiresAt:n}:{}};if(e.cadence==="weekly"){const m=Number(e.dayOfWeek);return!Number.isInteger(m)||!Mn(e.localTime)?null:{...o,dayOfWeek:m,localTime:e.localTime}}if(e.cadence==="monthly"){const m=Number(e.dayOfMonth);return!Number.isInteger(m)||!Mn(e.localTime)?null:{...o,dayOfMonth:m,localTime:e.localTime}}const c=eo(e.startAt);if(!c)return null;if(e.cadence==="interval_hours"){const m=Number(e.intervalHours);return Number.isInteger(m)&&m>0?{...o,intervalHours:m,startAt:c}:null}if(e.cadence==="interval_minutes"){const m=Number(e.intervalMinutes);return Number.isInteger(m)&&m>0?{...o,intervalMinutes:m,startAt:c}:null}const d=Number(e.intervalDays);return Number.isInteger(d)&&d>0?{...o,intervalDays:d,startAt:c}:null}function Eb(e){var t;return(t=e.nextRuns)!=null&&t.length?e.nextRuns:so(e,new Date,5).map(r=>r.dueAt.toISOString())}function _b(e){return e.lifetimeSpend??el(e,e.amount,new Date)}function eo(e){if(!e.trim())return;const t=new Date(e);return Number.isNaN(t.getTime())?void 0:t.toISOString()}function Ks(e){return e==="approved"||e==="ready"||e==="overdue"?"tx-confirmed":e==="approval_pending"||e==="scheduled"?"tx-pending":e==="failed"||e==="blocked"||e==="rejected"||e==="cancelled"||e==="expired"?"tx-failed":"neutral"}function Lb(e){return e==="confirmed"?"tx-confirmed":e==="failed"?"tx-failed":"tx-pending"}function ni(e){return e.replace(/[-_]+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase())}function Ob(){return a.androidNativeEnvironment.isAndroidNative?"Android native MWA ready":a.iosNativeEnvironment.isIosNative?"iOS native wallet ready":a.mwaEnvironment.supportsMwaMobileWeb?"Android MWA ready":a.mwaEnvironment.supportsIosWalletStandardFallback?"iOS wallet browser":"Desktop browser wallet"}function Db(){const e=a.mwaRegistration;if(!e)return a.mwaEnvironment.supportsMwaMobileWeb?"Android Chrome can register Mobile Wallet Adapter.":"MWA unavailable here. Browser Wallet Standard providers still work when injected.";if(e.registered)return"Registered. Android Chrome users can select Mobile Wallet Adapter.";switch(e.skippedReason){case"already_registered":return"Already registered. Android MWA remains available if this browser supports it.";case"not_browser":return"Skipped outside browser. Desktop wallets still work.";case"registration_failed":return"Registration failed. Desktop browser wallets still work.";case"unsupported_environment":return e.environment.supportsIosWalletStandardFallback?"MWA is Android-only. On iOS, open this page inside a wallet in-app browser or use a wallet Safari extension.":e.environment.isAndroid?"Android detected, but MWA mobile web requires Chrome or a Chrome PWA.":"MWA unavailable here. Browser Wallet Standard providers still work when injected.";default:return"Desktop browser mode. Android MWA appears only on Android Chrome or PWA."}}function Nb(){var t;const e=(t=a.preparedActions.find(r=>r.txid))==null?void 0:t.txid;return e?_(e):"None"}function xd(e){return a.labArtifacts.find(t=>t.labId===e)??null}function wa(e){return Jt.find(t=>t.id===e)??null}function Aa(){return Jt.find(e=>e.id===a.activeLab)??Jt[0]}function pt(e){return e.category==="receipt"}function ii(e){switch(e){case"intent_receipt":return"Proof of Intent";case"policy_receipt":return"Proof of Policy";case"risk_review_receipt":return"Proof of Review";case"rejection_receipt":return"Proof of Rejection";case"tool_trace_receipt":return"Tool Trace Receipt";default:return Sa(e)}}function kd(e){switch(e){case"intent":return"intent-receipt";case"rejection":return"rejection-receipt";case"policy":return"policy-receipt";case"review":return"risk-receipt"}}function ts(e){var t;return a.labInputs[e]??((t=Jt.find(r=>r.id===e))==null?void 0:t.defaultInput)??""}function Wb(){const e=Aa();if(pt(e)){const r=sa.findIndex(n=>n.id===e.id);return r>=0?`receipt ${r+1} of ${sa.length}`:"receipt"}const t=Ya.findIndex(r=>r.id===e.id);return t>=0?`advanced lab ${t+1} of ${Ya.length}`:"legacy lab"}function Pd(e,t){var r;return((r=a.labFieldValues[e])==null?void 0:r[t])??""}function la(e,t){return`${e}.${t}`}function Mb(e){const t={};for(const r of e.fields??[]){const n=`[data-lab-id="${CSS.escape(e.id)}"][data-lab-field="${CSS.escape(r.id)}"]`,o=document.querySelector(n);t[r.id]=((o==null?void 0:o.value)??Pd(e.id,r.id)).trim()}return a.labFieldValues[e.id]=t,t}function Ub(e,t){var r;if(a.labFieldErrors={},pt(e))for(const n of e.fields??[])n.required&&!((r=t[n.id])!=null&&r.trim())&&(a.labFieldErrors[la(e.id,n.id)]=`${n.label} is required.`);else{const n=ts(e.id).trim();(!n||n===e.defaultInput.trim())&&(a.labFieldErrors[la(e.id,"__advanced")]="Add your own evidence note before signing this advanced lab.")}if(Object.keys(a.labFieldErrors).length>0)throw new Error("Complete the required evidence fields before signing.")}function qb(){const e=Aa();pt(e)?a.labFieldValues[e.id]={}:a.labInputs[e.id]="",a.labFieldErrors={}}function Cd(e,t){return(e.fields??[]).map(r=>{var n;return[r.label,(n=t[r.id])==null?void 0:n.trim()]}).filter(([,r])=>!!r).map(([r,n])=>`${r}: ${n}`).join(`
|
|
3202
|
+
`)}async function Bb(e,t,r,n={}){const o=wa(e),c=/\bunlimited\b|seed phrase|private key|unknown custody/i.test(t),d=Fb(o,n,t,c),m=[...Hb(o,n,t,d),["Wallet boundary","This receipt is evidence only. It does not approve or submit a transaction.","good"],["Integrity",`Receipt time ${r} binds this record to one review moment.`,"good"]],A=await Promise.all(m.map(async([R,F,pe])=>({title:R,detail:F,tone:pe,hash:await ao(Pe({title:R,detail:F,tone:pe}))}))),$=jb(d);return{status:d,thesis:zb(e,d),nextSignatureGate:d==="blocked"?"Receipt complete. Use it to explain why matching requests should be rejected.":"Receipt complete. Compare future wallet requests against this signed record before approving.",receiptType:o?`${o.kind}_v1`:e,summary:o==null?void 0:o.summary,verdict:$,effect:"evidence only, no transaction",whatThisProves:o==null?void 0:o.whatThisProves,recommendedUse:o==null?void 0:o.recommendedUse,fieldValues:n,metrics:[{label:"Verdict",value:$,tone:d==="blocked"?"danger":d==="warn"?"warn":d==="observed"?"neutral":"good"},{label:"Custody",value:"user wallet",tone:"good"},{label:"Effect",value:"evidence only",tone:"neutral"}],evidence:A}}function Fb(e,t,r,n){if(n||(e==null?void 0:e.id)==="rejection-receipt")return"blocked";const o=(t.verdict||t.result||"").toLowerCase();return o.includes("blocked")?"blocked":o.includes("warning")?"warn":o.includes("pass")?"approved":/unknown|authority|insurance|override/i.test(r)?"warn":(e==null?void 0:e.category)==="receipt"?"observed":"approved"}function jb(e){switch(e){case"approved":return"approved";case"blocked":return"blocked";case"warn":return"warning";case"observed":return"recorded"}}function Hb(e,t,r,n){var o;return!e||!pt(e)||!((o=e.fields)!=null&&o.length)?[["Evidence note",r,n==="blocked"?"danger":n==="warn"?"warn":"neutral"]]:e.fields.map(c=>{var A;const d=(A=t[c.id])==null?void 0:A.trim();if(!d)return null;const m=n==="blocked"&&/reason|policy|request/i.test(c.id)?"danger":n==="warn"&&/risk|verdict|result|request/i.test(c.id)?"warn":"neutral";return[c.label,d,m]}).filter(c=>!!c)}function zb(e,t){const r=Jt.find(n=>n.id===e);return r?pt(r)?t==="blocked"?`${r.title} signed and saved as a blocked evidence record.`:t==="warn"?`${r.title} signed and saved with a warning verdict.`:t==="observed"?`${r.title} signed and saved as evidence only.`:`${r.title} signed and saved with an approved verdict.`:t==="blocked"?"The request becomes a refusal fingerprint without exposing private wallet data.":t==="warn"?"The advanced evidence lab was signed with a warning. No transaction was submitted.":r.description:"Signed evidence record created."}function to(){return{token:Fe("#recurringToken")||a.recurringDraft.token,recipient:Fe("#recurringRecipient")||a.recurringDraft.recipient,amount:Fe("#recurringAmount")||a.recurringDraft.amount,cadence:Fe("#recurringCadence")||a.recurringDraft.cadence,localTime:Fe("#recurringLocalTime")||a.recurringDraft.localTime,dayOfWeek:Fe("#recurringDayOfWeek")||a.recurringDraft.dayOfWeek,dayOfMonth:Fe("#recurringDayOfMonth")||a.recurringDraft.dayOfMonth,intervalDays:Fe("#recurringIntervalDays")||a.recurringDraft.intervalDays,intervalHours:Fe("#recurringIntervalHours")||a.recurringDraft.intervalHours,intervalMinutes:Fe("#recurringIntervalMinutes")||a.recurringDraft.intervalMinutes,startAt:Fe("#recurringStartAt")||a.recurringDraft.startAt,maxOccurrences:Fe("#recurringMaxOccurrences")||a.recurringDraft.maxOccurrences,expiresAt:Fe("#recurringExpiresAt")||a.recurringDraft.expiresAt,webhookUrl:Fe("#recurringWebhookUrl")||a.recurringDraft.webhookUrl,note:Fe("#recurringNote")||a.recurringDraft.note}}function Gb(e){const t=Ni.find(r=>r.id===e)??Ni[0];a.recurringPreset=t.id,a.recurringDraft={...a.recurringDraft,...t.draft},a.recurringErrors={},a.error=""}function Kb(e){const t={};if(e.recipient.trim()||(t.recurringRecipient="Recipient is required."),e.amount.trim()?Number(e.amount)>0||(t.recurringAmount="Amount must be greater than zero."):t.recurringAmount="Amount is required.",e.maxOccurrences.trim()){const r=Number(e.maxOccurrences);(!Number.isInteger(r)||r<=0)&&(t.recurringMaxOccurrences="Use a positive whole number or leave empty.")}if(e.expiresAt.trim()){const r=new Date(e.expiresAt);Number.isNaN(r.getTime())&&(t.recurringExpiresAt="Expiry must be a valid local date and time.")}if(e.webhookUrl.trim())try{const r=new URL(e.webhookUrl);r.protocol!=="https:"&&r.protocol!=="http:"&&(t.recurringWebhookUrl="Webhook URL must start with http:// or https://.")}catch{t.recurringWebhookUrl="Webhook URL must be valid."}if(e.cadence==="weekly"){const r=Number(e.dayOfWeek);(!Number.isInteger(r)||r<0||r>6)&&(t.recurringDayOfWeek="Choose a valid weekday."),Mn(e.localTime)||(t.recurringLocalTime="Use HH:MM local time.")}else if(e.cadence==="monthly"){const r=Number(e.dayOfMonth);(!Number.isInteger(r)||r<1||r>31)&&(t.recurringDayOfMonth="Use a day from 1 to 31."),Mn(e.localTime)||(t.recurringLocalTime="Use HH:MM local time.")}else e.cadence==="interval_hours"?(Ri(t,"recurringIntervalHours",e.intervalHours,"Hours must be a positive whole number."),Ei(t,e.startAt)):e.cadence==="interval_minutes"?(Ri(t,"recurringIntervalMinutes",e.intervalMinutes,"Minutes must be a positive whole number."),Ei(t,e.startAt)):(Ri(t,"recurringIntervalDays",e.intervalDays,"Days must be a positive whole number."),Ei(t,e.startAt));if(a.recurringErrors=t,Object.keys(t).length>0)throw new Error("Complete required recurring fields before creating this schedule.")}function Ri(e,t,r,n){const o=Number(r);(!Number.isInteger(o)||o<=0)&&(e[t]=n)}function Ei(e,t){const r=new Date(t);(!t||Number.isNaN(r.getTime()))&&(e.recurringStartAt="Start time must be valid.")}function Mn(e){return/^([01]\d|2[0-3]):[0-5]\d$/.test(e)}function Td(e){const t={token:e.token,recipient:e.recipient,amount:e.amount,cadence:e.cadence};e.note&&(t.note=e.note);const r=Number(e.maxOccurrences);return Number.isInteger(r)&&r>0&&(t.maxOccurrences=r),e.expiresAt.trim()&&(t.expiresAt=xn(e.expiresAt)),e.webhookUrl.trim()&&(t.notifications={inApp:!0,webhookUrl:e.webhookUrl.trim()}),e.cadence==="weekly"?(t.dayOfWeek=Number(e.dayOfWeek),t.localTime=e.localTime):e.cadence==="monthly"?(t.dayOfMonth=Number(e.dayOfMonth),t.localTime=e.localTime):e.cadence==="interval_hours"?(t.intervalHours=Number(e.intervalHours),t.startAt=xn(e.startAt)):e.cadence==="interval_minutes"?(t.intervalMinutes=Number(e.intervalMinutes),t.startAt=xn(e.startAt)):(t.intervalDays=Number(e.intervalDays),t.startAt=xn(e.startAt)),t}function ro(){return{token:"SOL",recipient:"",amount:"0.01",cadence:"weekly",localTime:"09:00",dayOfWeek:"1",dayOfMonth:"1",intervalDays:"1",intervalHours:"24",intervalMinutes:"60",startAt:Od(new Date(Date.now()+6e4)),maxOccurrences:"",expiresAt:"",webhookUrl:"",note:""}}function Yb(){return Object.fromEntries(Jt.map(e=>[e.id,pt(e)?"":e.defaultInput]))}function Vb(){return Object.fromEntries(sa.map(e=>[e.id,Object.fromEntries((e.fields??[]).map(t=>{var r;return[t.id,t.type==="select"?((r=t.options)==null?void 0:r[0])??"":""]}))]))}function _i(e){var t;return((t=e.display)==null?void 0:t.summary)!==void 0?{cluster:e.cluster,summary:e.display.summary}:{cluster:e.cluster}}function rr(e){return{cluster:a.cluster,summary:e}}function Xa(){return a.bridgeRpcUrl||oi(a.cluster)}function oi(e){switch(e){case"mainnet-beta":return"https://api.mainnet-beta.solana.com";case"devnet":return"https://api.devnet.solana.com";case"testnet":return"https://api.testnet.solana.com";case"localnet":return"http://127.0.0.1:8899"}}function rs(){return a.bridgeUrl.endsWith("/")?a.bridgeUrl:`${a.bridgeUrl}/`}function Id(){try{return new URL(a.bridgeUrl).host}catch{return a.bridgeUrl}}function ft(e){return e==="mainnet-beta"?"Mainnet-Beta":e[0].toUpperCase()+e.slice(1)}function Sa(e){switch(e){case"intent_receipt":return"Proof of Intent";case"policy_receipt":return"Proof of Policy";case"risk_review_receipt":return"Proof of Review";case"rejection_receipt":return"Proof of Rejection";case"tool_trace_receipt":return"Tool Trace Receipt"}return e.split("_").filter(Boolean).map(t=>t[0].toUpperCase()+t.slice(1)).join(" ")}function Rd(e,t){const r=t==="mainnet-beta"?"":`?cluster=${t}`;return`https://solscan.io/tx/${e}${r}`}function Jb(){var n;const e=El,t=String((e==null?void 0:e.VITE_AGENTIC_DEV_CONTROLS)??"").trim().toLowerCase();if(["1","true","yes","on"].includes(t))return!0;if(["0","false","no","off"].includes(t))return!1;const r=((n=globalThis.location)==null?void 0:n.hostname)??"";return r==="localhost"||r==="127.0.0.1"||r==="::1"}function Zb(){var e;return tw(((e=globalThis.location)==null?void 0:e.hostname)??"")}function Qb(){return ew()?"bridge":"hosted"}function Xb(e){var d,m;const t=bt(mo),r=e.aiProvider?bt(e.aiProvider):t,n=e.aiMode??Qb(),o=((d=e.aiModel)==null?void 0:d.trim())||r.model,c={mode:n,provider:r.id,apiFormat:e.aiApiFormat??r.apiFormat,baseUrl:((m=e.aiBaseUrl)==null?void 0:m.trim())||r.baseUrl,model:o};if(c.mode==="hosted"&&c.provider==="custom-openai-compatible")return{mode:c.mode,provider:t.id,apiFormat:t.apiFormat,baseUrl:t.baseUrl,model:t.model};if(c.mode==="session"&&c.provider==="openai"){const A=bt(Nl);return{mode:c.mode,provider:A.id,apiFormat:A.apiFormat,baseUrl:A.baseUrl,model:A.model}}return c}function ew(){var t;const e=((t=globalThis.location)==null?void 0:t.hostname)??"";return Ed(e)||as(e)===""}function tw(e){const t=as(e);return Ed(t)||t.endsWith(".local")||rw(t)||aw(t)}function Ed(e){const t=as(e);return t==="localhost"||t==="127.0.0.1"||t==="::1"||t===""}function as(e){return e.trim().toLowerCase().replace(/^\[|\]$/g,"").replace(/\.$/,"")}function rw(e){const t=e.split(".");if(t.length!==4)return!1;const r=t.map(c=>{if(!/^\d{1,3}$/.test(c))return Number.NaN;const d=Number(c);return d>=0&&d<=255?d:Number.NaN});if(r.some(c=>Number.isNaN(c)))return!1;const[n,o]=r;return n===10||n===127||n===172&&o>=16&&o<=31||n===192&&o===168||n===169&&o===254}function aw(e){return e.includes(":")?e==="::1"||e.startsWith("fc")||e.startsWith("fd")||e.startsWith("fe80:"):!1}function nw(){const e=El,t=String(e==null?void 0:e.VITE_AGENTIC_ANDROID_SHOW_EXAMPLE_TAB).trim().toLowerCase();return["1","true","yes","on"].includes(t)}function ns(){return globalThis.AgenticAndroid}function _d(){const e=ns();if(!(e!=null&&e.openMwaExample)){T("error","MWA unavailable","Open this tab inside an Android build with the MWA tab enabled.");return}e.openMwaExample()}function gt(e){return e==="mainnet-beta"||e==="devnet"||e==="testnet"||e==="localnet"}function iw(e){return e==="pending"||e==="confirmed"||e==="failed"}function ow(e){return e==="hosted"||e==="session"||e==="bridge"}function Ld(e){return e==="auto"||e==="local-bridge"}function sw(e){return e==="openai-compatible"||e==="anthropic"}function lw(e){return Rn.some(t=>t.id===e)}function cw(e){return e==="phantom"||e==="solflare"||e==="backpack"||e==="jupiter"}function Fe(e){const t=document.querySelector(e);return(t==null?void 0:t.value.trim())??""}function xn(e){const t=new Date(e);if(Number.isNaN(t.getTime()))throw new Error("Start time must be a valid local date and time.");return t.toISOString()}function Od(e){const t=e.getTimezoneOffset()*6e4;return new Date(e.getTime()-t).toISOString().slice(0,16)}function Y(e){const t=new Date(e);return Number.isNaN(t.getTime())?e||"n/a":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(t)}function dw(e){return e instanceof $t?e.toPayload():{code:"wallet_unreachable",message:e instanceof Error?e.message:"Wallet request failed.",recoverable:!0}}function uw(e){if(e&&typeof e=="object"&&"error"in e){const t=e.error;if(typeof t=="string")return je(t);if(t&&typeof t=="object"&&"message"in t){const r=t.message;if(typeof r=="string")return je(r)}return je(Pe(t))}return je(Pe(e))}async function ao(e){const t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e));return Array.from(new Uint8Array(t),r=>r.toString(16).padStart(2,"0")).join("")}function Pe(e){return JSON.stringify(no(e),null,2)}function Un(e){if(Array.isArray(e))return e.map(Un);if(e&&typeof e=="object"){const t={};for(const[r,n]of Object.entries(e))n!==void 0&&(t[r]=Un(n));return t}return e}function no(e){if(Array.isArray(e))return e.map(no);if(e&&typeof e=="object"){const t={};for(const r of Object.keys(e).sort()){const n=e[r];n!==void 0&&(t[r]=no(n))}return t}return e}function Dd(e,t){try{return lu.sign.detached.verify(new TextEncoder().encode(e),Zd.decode(t),Qo().toBytes())}catch{return!1}}function Nr(e){const t=new Uint8Array(8);globalThis.crypto.getRandomValues(t);const r=Array.from(t,n=>n.toString(16).padStart(2,"0")).join("");return`${e}_${r}`}function pw(){return a.toasts.length===0?"":`
|
|
3203
|
+
<div class="toast-stack" aria-live="polite">
|
|
3204
|
+
${a.toasts.map(e=>`
|
|
3205
|
+
<div class="toast ${e.kind}">
|
|
3206
|
+
<span class="toast-icon" aria-hidden="true">${mw(e.kind)}</span>
|
|
3207
|
+
<div>
|
|
3208
|
+
<strong>${s(e.title)}</strong>
|
|
3209
|
+
<p>${s(e.message)}</p>
|
|
3210
|
+
</div>
|
|
3211
|
+
<button data-toast-dismiss="${e.id}" aria-label="Dismiss notification">x</button>
|
|
3212
|
+
</div>
|
|
3213
|
+
`).join("")}
|
|
3214
|
+
</div>
|
|
3215
|
+
`}function T(e,t,r){const n={id:ks,kind:e,title:t,message:r};return ks+=1,a.toasts=[n,...a.toasts].slice(0,2),e!=="pending"&&window.setTimeout(()=>{is(n.id)},4e3),n.id}function ur(e,t,r,n){a.toasts=a.toasts.map(o=>o.id===e?{...o,kind:t,title:r,message:n}:o),t!=="pending"&&window.setTimeout(()=>{is(e)},4e3),M()}function is(e){const t=a.toasts.filter(r=>r.id!==e);t.length!==a.toasts.length&&(a.toasts=t,M())}function fw(){return'<svg viewBox="0 0 24 24" focusable="false"><path d="M9.4 16.6 5.8 13l1.4-1.4 2.2 2.2 7.4-7.4L18.2 8 9.4 16.6Z"></path></svg>'}function gw(){return'<svg viewBox="0 0 24 24" focusable="false"><path d="m12 10.6 4.1-4.1 1.4 1.4-4.1 4.1 4.1 4.1-1.4 1.4-4.1-4.1-4.1 4.1-1.4-1.4 4.1-4.1-4.1-4.1 1.4-1.4 4.1 4.1Z"></path></svg>'}function mw(e){return e==="pending"?'<span class="toast-spinner"></span>':e==="error"?gw():fw()}function io(){return'<span class="button-spinner" aria-hidden="true"></span>'}function _(e){return e.length<=16?e:`${e.slice(0,8)}...${e.slice(-8)}`}function s(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function hw(e){let t="";for(const r of e)t+=String.fromCharCode(r);return btoa(t)}function yw(){try{const e=window.localStorage.getItem(_l);if(!e)return{};const t=JSON.parse(e);return{...typeof t.selectedWalletName=="string"&&{selectedWalletName:t.selectedWalletName},...typeof t.selectedIosWalletId=="string"&&cw(t.selectedIosWalletId)&&{selectedIosWalletId:t.selectedIosWalletId},...typeof t.workflowModePreference=="string"&&Ld(t.workflowModePreference)&&{workflowModePreference:t.workflowModePreference},...typeof t.cluster=="string"&>(t.cluster)&&{cluster:t.cluster},...typeof t.bridgeUrl=="string"&&{bridgeUrl:t.bridgeUrl},...typeof t.bridgeToken=="string"&&{bridgeToken:t.bridgeToken},...typeof t.aiMode=="string"&&ow(t.aiMode)&&{aiMode:t.aiMode},...typeof t.aiProvider=="string"&&lw(t.aiProvider)&&{aiProvider:t.aiProvider},...typeof t.aiApiFormat=="string"&&sw(t.aiApiFormat)&&{aiApiFormat:t.aiApiFormat},...typeof t.aiBaseUrl=="string"&&{aiBaseUrl:t.aiBaseUrl},...typeof t.aiModel=="string"&&{aiModel:t.aiModel}}}catch{return{}}}function ke(){try{window.localStorage.setItem(_l,JSON.stringify({selectedWalletName:a.selectedWalletName,selectedIosWalletId:a.selectedIosWalletId,workflowModePreference:a.workflowModePreference,cluster:a.cluster,bridgeUrl:a.bridgeUrl,bridgeToken:a.bridgeToken,aiMode:a.aiSettings.mode,aiProvider:a.aiSettings.provider,aiApiFormat:a.aiSettings.apiFormat,aiBaseUrl:a.aiSettings.baseUrl,aiModel:a.aiSettings.model}))}catch{}}function vw(){try{const e=window.localStorage.getItem(Ll);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?da(t.filter(cs).map(r=>({...r,workflowSource:r.workflowSource??"browser"}))):[]}catch{return[]}}function si(){try{a.generatedPlans=da(a.generatedPlans),window.localStorage.setItem(Ll,JSON.stringify(a.generatedPlans.filter(e=>e.workflowSource!=="cloud")))}catch{}}function os(){try{const e=window.localStorage.getItem(Ol);if(!e)return Ys();const t=JSON.parse(e);return Nd(t)}catch{return Ys()}}function Ys(){return{preparedActions:[],recurringPayments:[],receipts:[]}}function Nd(e){return{preparedActions:vr((e.preparedActions??[]).filter(ls).map(t=>({...t,workflowSource:"browser"}))),recurringPayments:ca(Wd(e.recurringPayments??[],"browser")),receipts:ss((e.receipts??[]).filter(ww))}}function kt(){try{const e=Nd({preparedActions:a.preparedActions.filter(De),recurringPayments:a.recurringPayments.filter(t=>gr(t)==="browser"),receipts:a.receipts.filter(t=>De(t.actionId))});window.localStorage.setItem(Ol,JSON.stringify(e))}catch{}}function vr(...e){const t=new Map;for(const r of e)for(const n of r){const o=t.get(n.id);(!o||n.updatedAt.localeCompare(o.updatedAt)>=0)&&t.set(n.id,n)}return[...t.values()].sort((r,n)=>n.createdAt.localeCompare(r.createdAt))}function Vs(e,t){return e.filter(ls).map(r=>({...r,workflowSource:t}))}function Wd(e,t){return e.filter(bw).map(r=>({...r,workflowSource:t}))}function ca(...e){const t=new Map;for(const r of e)for(const n of r){const o=t.get(n.id);(!o||n.updatedAt.localeCompare(o.updatedAt)>=0)&&t.set(n.id,n)}return[...t.values()].sort((r,n)=>n.createdAt.localeCompare(r.createdAt))}function ss(...e){const t=new Map;for(const r of e)for(const n of r){const o=t.get(n.actionId);(!o||n.completedAt.localeCompare(o.completedAt)>=0)&&t.set(n.actionId,n)}return[...t.values()].sort((r,n)=>n.completedAt.localeCompare(r.completedAt))}function ls(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&Md(t.kind)&&Ud(t.status)&&typeof t.walletAddress=="string"&>(t.cluster??"")&&typeof t.summary=="string"&&!!t.params&&typeof t.params=="object"&&!Array.isArray(t.params)&&typeof t.dueAt=="string"&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string"}function Md(e){return e==="transfer_sol"||e==="transfer_spl"||e==="swap"||e==="manual_review"||e==="read_only"||e==="custom_transaction"||e==="custom"}function bw(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&(t.status==="active"||t.status==="paused")&&typeof t.walletAddress=="string"&>(t.cluster??"")&&typeof t.token=="string"&&typeof t.recipient=="string"&&typeof t.amount=="string"&&Aw(t.cadence)&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string"}function ww(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.actionId=="string"&&Ud(t.status)&&typeof t.summary=="string"&&typeof t.walletAddress=="string"&>(t.cluster??"")&&typeof t.createdAt=="string"&&typeof t.completedAt=="string"&&(t.proofSignature===void 0||typeof t.proofSignature=="string")}function Ud(e){return e==="scheduled"||e==="ready"||e==="overdue"||e==="approval_pending"||e==="approved"||e==="rejected"||e==="cancelled"||e==="blocked"||e==="failed"||e==="expired"}function Aw(e){return e==="weekly"||e==="monthly"||e==="interval_days"||e==="interval_hours"||e==="interval_minutes"}function De(e){return(typeof e=="string"?e:e.id).startsWith("browser-")}function gr(e){return e.workflowSource?e.workflowSource:De(e.id)?"browser":"local-bridge"}function da(...e){const t=new Map;for(const r of e)for(const n of r){if(!cs(n))continue;const o=t.get(n.id);(!o||n.updatedAt.localeCompare(o.updatedAt)>=0)&&t.set(n.id,n)}return[...t.values()].sort((r,n)=>n.createdAt.localeCompare(r.createdAt)).slice(0,mf)}function cs(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&qd(t.plan)&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string"&&(t.source==="template"||t.source==="ai")&&typeof t.templateId=="string"&&typeof t.templateTitle=="string"&&typeof t.prompt=="string"&&typeof t.walletAddress=="string"&>(t.cluster??"")&&Bd(t.status)&&(t.signature===void 0||typeof t.signature=="string")&&(t.preparedActionId===void 0||typeof t.preparedActionId=="string")}function qd(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.intent=="string"&&typeof t.route=="string"&&typeof t.risk=="string"&&typeof t.approval=="string"&&(t.source==="template"||t.source==="ai")&&typeof t.category=="string"&&typeof t.actionType=="string"&&typeof t.templateTitle=="string"&&(t.userNotes===void 0||typeof t.userNotes=="string")&&!!t.parameters&&typeof t.parameters=="object"&&!Array.isArray(t.parameters)&&Object.values(t.parameters).every(r=>typeof r=="string")&&Array.isArray(t.fields)&&t.fields.every(Sw)&&Array.isArray(t.safeguards)&&t.safeguards.every(r=>typeof r=="string")}function Sw(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.label=="string"&&typeof t.value=="string"}function Bd(e){return e==="draft"||e==="signed"||e==="queued"||e==="archived"}function Fd(){try{const e=window.localStorage.getItem(Dl);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?Nt(t.filter(un)):[]}catch{return[]}}async function jd(){const e=Fd(),t=await kw().catch(()=>[]),r=te(),n=r==="agentic-cloud"?await Gc().catch(o=>(a.cloudEvidenceStatus=`Cloud evidence archive unavailable: ${o instanceof Error?o.message:String(o)}`,[])):[];a.labArtifacts=Nt(a.labArtifacts,e,t,n),r==="agentic-cloud"?(a.cloudEvidenceLastSyncAt=Date.now(),a.cloudEvidenceStatus=n.length>0?`Cloud evidence archive synced (${n.length} receipt${n.length===1?"":"s"}).`:"Cloud evidence archive ready (no receipts yet)."):r==="local-bridge"?a.cloudEvidenceStatus="Private local mode: receipts stay off Agentic Cloud.":a.cloudEvidenceStatus="Cloud evidence archive: sign in to also store receipts in Agentic Cloud.",await xw(),await ua()}async function ua(){a.labArtifacts=Nt(a.labArtifacts),await Pw(a.labArtifacts).catch(()=>{});try{window.localStorage.setItem(Dl,JSON.stringify(a.labArtifacts))}catch{}}function Nt(...e){const t=new Map;for(const r of e)for(const n of r){if(!un(n))continue;const o=t.get(n.id);(!o||n.createdAt.localeCompare(o.createdAt)>=0)&&t.set(n.id,n)}return[...t.values()].sort((r,n)=>n.createdAt.localeCompare(r.createdAt))}function un(e){if(!e||typeof e!="object")return!1;const t=e;return t.cloudReceiptId!==void 0&&(typeof t.cloudReceiptId!="string"||t.cloudReceiptId.length===0)||t.bridgeArchived!==void 0&&typeof t.bridgeArchived!="boolean"||t.metadata!==void 0&&!se(t.metadata)?!1:typeof t.id=="string"&&typeof t.labId=="string"&&typeof t.title=="string"&&typeof t.kind=="string"&&typeof t.createdAt=="string"&&typeof t.walletAddress=="string"&>(t.cluster??"")&&typeof t.input=="string"&&typeof t.preSignatureHash=="string"&&typeof t.signingMessage=="string"&&typeof t.signature=="string"&&typeof t.verified=="boolean"&&typeof t.artifactHash=="string"&&$w(t.payload)}function $w(e){if(!e||typeof e!="object")return!1;const t=e;return(t.status==="approved"||t.status==="blocked"||t.status==="warn"||t.status==="observed")&&typeof t.thesis=="string"&&typeof t.nextSignatureGate=="string"&&Array.isArray(t.metrics)&&Array.isArray(t.evidence)}async function xw(){var e,t,r;try{if(!((e=navigator.storage)!=null&&e.persist)){a.labArchiveStatus="Browser archive ready.";return}if(await((r=(t=navigator.storage).persisted)==null?void 0:r.call(t))){a.labArchiveStatus="Persistent browser archive ready.";return}const o=await navigator.storage.persist();a.labArchiveStatus=o?"Persistent browser archive ready.":"Browser archive ready."}catch{a.labArchiveStatus="Browser archive ready."}}async function kw(){const e=await Hd();return new Promise((t,r)=>{const n=e.transaction(ia,"readonly"),c=n.objectStore(ia).getAll();c.onsuccess=()=>t(Nt(c.result.filter(un))),c.onerror=()=>r(c.error??new Error("Unable to load lab artifact archive.")),n.oncomplete=()=>e.close(),n.onerror=()=>{e.close(),r(n.error??new Error("Unable to load lab artifact archive."))}})}async function Pw(e){const t=await Hd();await new Promise((r,n)=>{const o=t.transaction(ia,"readwrite"),c=o.objectStore(ia),d=c.clear();d.onsuccess=()=>{for(const m of Nt(e))c.put(m)},d.onerror=()=>n(d.error??new Error("Unable to clear lab artifact archive.")),o.oncomplete=()=>{t.close(),r()},o.onerror=()=>{t.close(),n(o.error??new Error("Unable to save lab artifact archive."))}})}function Hd(){return new Promise((e,t)=>{if(!window.indexedDB){t(new Error("IndexedDB is unavailable."));return}const r=window.indexedDB.open(hf,yf);r.onupgradeneeded=()=>{const n=r.result;n.objectStoreNames.contains(ia)||n.createObjectStore(ia,{keyPath:"id"}).createIndex("createdAt","createdAt")},r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error??new Error("Unable to open lab artifact archive."))})}
|