@event4u/agent-config 9.15.0 → 9.16.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.
Files changed (38) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +21 -0
  3. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  4. package/dist/cli/mcp/content.js +1 -1
  5. package/dist/cli/mcp/content.js.map +1 -1
  6. package/dist/discovery/deprecation-report.md +1 -1
  7. package/dist/discovery/discovery-manifest.json +1 -1
  8. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  9. package/dist/discovery/discovery-manifest.summary.md +1 -1
  10. package/dist/discovery/orphan-report.md +1 -1
  11. package/dist/discovery/packs.json +1 -1
  12. package/dist/discovery/trust-report.md +1 -1
  13. package/dist/discovery/workspaces.json +1 -1
  14. package/dist/mcp/registry-manifest.json +1 -1
  15. package/dist/mcp/server.json +2 -2
  16. package/dist/server/routes/workspace.js +1 -1
  17. package/dist/server/routes/workspace.js.map +1 -1
  18. package/dist/shared/userMd/utils.js +1 -1
  19. package/dist/shared/userMd/utils.js.map +1 -1
  20. package/dist/ui/assets/index-DmR0mbk4.js +26 -0
  21. package/dist/ui/assets/index-DmR0mbk4.js.map +1 -0
  22. package/dist/ui/index.html +1 -1
  23. package/package.json +4 -4
  24. package/src/config/agent-settings.template.yml +3 -1
  25. package/src/config/budget-routing.json +7 -0
  26. package/src/scripts/_lib/tier_budget_routing.ts +154 -28
  27. package/src/scripts/anchor_scoring_run.ts +1 -1
  28. package/src/scripts/bench_persona_placebo.ts +1 -1
  29. package/src/scripts/bench_quality_run.ts +1 -1
  30. package/src/scripts/check_cli_registry_budget_sync.ts +168 -0
  31. package/src/scripts/check_gate_coverage.ts +1 -1
  32. package/src/scripts/check_token_quality_golden.ts +1 -1
  33. package/src/scripts/cost/budget.mjs +18 -4
  34. package/src/scripts/release.ts +110 -7
  35. package/src/scripts/routing_doctor.ts +76 -1
  36. package/src/shared/userMd/utils.ts +1 -1
  37. package/dist/ui/assets/index-DJY_vQVn.js +0 -40
  38. package/dist/ui/assets/index-DJY_vQVn.js.map +0 -1
@@ -1,40 +0,0 @@
1
- (function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&l(s)}).observe(document,{childList:!0,subtree:!0});function i(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function l(o){if(o.ep)return;o.ep=!0;const a=i(o);fetch(o.href,a)}})();var zt,H,Ul,Bl,Ie,jr,Hl,ql,pi,dt,wn,Wl,pr,Hi,qi,kt={},wt=[],po=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Kt=Array.isArray;function ke(e,n){for(var i in n)e[i]=n[i];return e}function vr(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function vo(e,n,i){var l,o,a,s={};for(a in n)a=="key"?l=n[a]:a=="ref"?o=n[a]:s[a]=n[a];if(arguments.length>2&&(s.children=arguments.length>3?zt.call(arguments,2):i),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)s[a]===void 0&&(s[a]=e.defaultProps[a]);return ft(e,s,l,o,null)}function ft(e,n,i,l,o){var a={type:e,props:n,key:i,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++Ul,__i:-1,__u:0};return o==null&&H.vnode!=null&&H.vnode(a),a}function te(e){return e.children}function Sn(e,n){this.props=e,this.context=n}function fn(e,n){if(n==null)return e.__?fn(e.__,e.__i+1):null;for(var i;n<e.__k.length;n++)if((i=e.__k[n])!=null&&i.__e!=null)return i.__e;return typeof e.type=="function"?fn(e):null}function _o(e){if(e.__P&&e.__d){var n=e.__v,i=n.__e,l=[],o=[],a=ke({},n);a.__v=n.__v+1,H.vnode&&H.vnode(a),_r(e.__P,a,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,l,i??fn(n),!!(32&n.__u),o),a.__v=n.__v,a.__.__k[a.__i]=a,Vl(l,a,o),n.__e=n.__=null,a.__e!=i&&Yl(a)}}function Yl(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(n){if(n!=null&&n.__e!=null)return e.__e=e.__c.base=n.__e}),Yl(e)}function Dr(e){(!e.__d&&(e.__d=!0)&&Ie.push(e)&&!St.__r++||jr!=H.debounceRendering)&&((jr=H.debounceRendering)||Hl)(St)}function St(){try{for(var e,n=1;Ie.length;)Ie.length>n&&Ie.sort(ql),e=Ie.shift(),n=Ie.length,_o(e)}finally{Ie.length=St.__r=0}}function zl(e,n,i,l,o,a,s,d,f,u,h){var g,p,b,O,R,j,D,M=l&&l.__k||wt,B=n.length;for(f=mo(i,n,M,f,B),g=0;g<B;g++)(b=i.__k[g])!=null&&(p=b.__i!=-1&&M[b.__i]||kt,b.__i=g,j=_r(e,b,p,o,a,s,d,f,u,h),O=b.__e,b.ref&&p.ref!=b.ref&&(p.ref&&mr(p.ref,null,b),h.push(b.ref,b.__c||O,b)),R==null&&O!=null&&(R=O),(D=!!(4&b.__u))||p.__k===b.__k?(f=Kl(b,f,e,D),D&&p.__e&&(p.__e=null)):typeof b.type=="function"&&j!==void 0?f=j:O&&(f=O.nextSibling),b.__u&=-7);return i.__e=R,f}function mo(e,n,i,l,o){var a,s,d,f,u,h=i.length,g=h,p=0;for(e.__k=new Array(o),a=0;a<o;a++)(s=n[a])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[a]=ft(null,s,null,null,null):Kt(s)?s=e.__k[a]=ft(te,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[a]=ft(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[a]=s,f=a+p,s.__=e,s.__b=e.__b+1,d=null,(u=s.__i=go(s,i,f,g))!=-1&&(g--,(d=i[u])&&(d.__u|=2)),d==null||d.__v==null?(u==-1&&(o>h?p--:o<h&&p++),typeof s.type!="function"&&(s.__u|=4)):u!=f&&(u==f-1?p--:u==f+1?p++:(u>f?p--:p++,s.__u|=4))):e.__k[a]=null;if(g)for(a=0;a<h;a++)(d=i[a])!=null&&!(2&d.__u)&&(d.__e==l&&(l=fn(d)),Ql(d,d));return l}function Kl(e,n,i,l){var o,a;if(typeof e.type=="function"){for(o=e.__k,a=0;o&&a<o.length;a++)o[a]&&(o[a].__=e,n=Kl(o[a],n,i,l));return n}e.__e!=n&&(l&&(n&&e.type&&!n.parentNode&&(n=fn(e)),i.insertBefore(e.__e,n||null)),n=e.__e);do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function go(e,n,i,l){var o,a,s,d=e.key,f=e.type,u=n[i],h=u!=null&&(2&u.__u)==0;if(u===null&&d==null||h&&d==u.key&&f==u.type)return i;if(l>(h?1:0)){for(o=i-1,a=i+1;o>=0||a<n.length;)if((u=n[s=o>=0?o--:a++])!=null&&!(2&u.__u)&&d==u.key&&f==u.type)return s}return-1}function Ur(e,n,i){n[0]=="-"?e.setProperty(n,i??""):e[n]=i==null?"":typeof i!="number"||po.test(n)?i:i+"px"}function at(e,n,i,l,o){var a,s;e:if(n=="style")if(typeof i=="string")e.style.cssText=i;else{if(typeof l=="string"&&(e.style.cssText=l=""),l)for(n in l)i&&n in i||Ur(e.style,n,"");if(i)for(n in i)l&&i[n]==l[n]||Ur(e.style,n,i[n])}else if(n[0]=="o"&&n[1]=="n")a=n!=(n=n.replace(Wl,"$1")),s=n.toLowerCase(),n=s in e||n=="onFocusOut"||n=="onFocusIn"?s.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+a]=i,i?l?i[wn]=l[wn]:(i[wn]=pr,e.addEventListener(n,a?qi:Hi,a)):e.removeEventListener(n,a?qi:Hi,a);else{if(o=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=i??"";break e}catch{}typeof i=="function"||(i==null||i===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&i==1?"":i))}}function Br(e){return function(n){if(this.l){var i=this.l[n.type+e];if(n[dt]==null)n[dt]=pr++;else if(n[dt]<i[wn])return;return i(H.event?H.event(n):n)}}}function _r(e,n,i,l,o,a,s,d,f,u){var h,g,p,b,O,R,j,D,M,B,Y,ee,fe,Ve,he,pe,le=n.type;if(n.constructor!==void 0)return null;128&i.__u&&(f=!!(32&i.__u),a=[d=n.__e=i.__e]),(h=H.__b)&&h(n);e:if(typeof le=="function"){g=s.length;try{if(M=n.props,B=le.prototype&&le.prototype.render,Y=(h=le.contextType)&&l[h.__c],ee=h?Y?Y.props.value:h.__:l,i.__c?D=(p=n.__c=i.__c).__=p.__E:(B?n.__c=p=new le(M,ee):(n.__c=p=new Sn(M,ee),p.constructor=le,p.render=bo),Y&&Y.sub(p),p.state||(p.state={}),p.__n=l,b=p.__d=!0,p.__h=[],p._sb=[]),B&&p.__s==null&&(p.__s=p.state),B&&le.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=ke({},p.__s)),ke(p.__s,le.getDerivedStateFromProps(M,p.__s))),O=p.props,R=p.state,p.__v=n,b)B&&le.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),B&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(B&&le.getDerivedStateFromProps==null&&M!==O&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(M,ee),n.__v==i.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(M,p.__s,ee)===!1){n.__v!=i.__v&&(p.props=M,p.state=p.__s,p.__d=!1),n.__e=i.__e,n.__k=i.__k,n.__k.some(function(ce){ce&&(ce.__=n)}),wt.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(M,p.__s,ee),B&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(O,R,j)})}if(p.context=ee,p.props=M,p.__P=e,p.__e=!1,fe=H.__r,Ve=0,B)p.state=p.__s,p.__d=!1,fe&&fe(n),h=p.render(p.props,p.state,p.context),wt.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,fe&&fe(n),h=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++Ve<25);p.state=p.__s,p.getChildContext!=null&&(l=ke(ke({},l),p.getChildContext())),B&&!b&&p.getSnapshotBeforeUpdate!=null&&(j=p.getSnapshotBeforeUpdate(O,R)),he=h!=null&&h.type===te&&h.key==null?Jl(h.props.children):h,d=zl(e,Kt(he)?he:[he],n,i,l,o,a,s,d,f,u),p.base=n.__e,n.__u&=-161,p.__h.length&&s.push(p),D&&(p.__E=p.__=null)}catch(ce){if(s.length=g,n.__v=null,f||a!=null){if(ce.then){for(n.__u|=f?160:128;d&&d.nodeType==8&&d.nextSibling;)d=d.nextSibling;a!=null&&(a[a.indexOf(d)]=null),n.__e=d}else if(a!=null)for(pe=a.length;pe--;)vr(a[pe])}else n.__e=i.__e;n.__k==null&&(n.__k=i.__k||[]),ce.then||Gl(n),H.__e(ce,n,i)}}else a==null&&n.__v==i.__v?(n.__k=i.__k,n.__e=i.__e):d=n.__e=yo(i.__e,n,i,l,o,a,s,f,u);return(h=H.diffed)&&h(n),128&n.__u?void 0:d}function Gl(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Gl))}function Vl(e,n,i){for(var l=0;l<i.length;l++)mr(i[l],i[++l],i[++l]);H.__c&&H.__c(n,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(a){a.call(o)})}catch(a){H.__e(a,o.__v)}})}function Jl(e){return typeof e!="object"||e==null||e.__b>0?e:Kt(e)?e.map(Jl):e.constructor!==void 0?null:ke({},e)}function yo(e,n,i,l,o,a,s,d,f){var u,h,g,p,b,O,R,j=i.props||kt,D=n.props,M=n.type;if(M=="svg"?o="http://www.w3.org/2000/svg":M=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),a!=null){for(u=0;u<a.length;u++)if((b=a[u])&&"setAttribute"in b==!!M&&(M?b.localName==M:b.nodeType==3)){e=b,a[u]=null;break}}if(e==null){if(M==null)return document.createTextNode(D);e=document.createElementNS(o,M,D.is&&D),d&&(H.__m&&H.__m(n,a),d=!1),a=null}if(M==null)j===D||d&&e.data==D||(e.data=D);else{if(a=M=="textarea"&&D.defaultValue!=null?null:a&&zt.call(e.childNodes),!d&&a!=null)for(j={},u=0;u<e.attributes.length;u++)j[(b=e.attributes[u]).name]=b.value;for(u in j)b=j[u],u=="dangerouslySetInnerHTML"?g=b:u=="children"||u in D||u=="value"&&"defaultValue"in D||u=="checked"&&"defaultChecked"in D||at(e,u,null,b,o);for(u in D)b=D[u],u=="children"?p=b:u=="dangerouslySetInnerHTML"?h=b:u=="value"?O=b:u=="checked"?R=b:d&&typeof b!="function"||j[u]===b||at(e,u,b,j[u],o);if(h)d||g&&(h.__html==g.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),n.__k=[];else if(g&&(e.innerHTML=""),zl(n.type=="template"?e.content:e,Kt(p)?p:[p],n,i,l,M=="foreignObject"?"http://www.w3.org/1999/xhtml":o,a,s,a?a[0]:i.__k&&fn(i,0),d,f),a!=null)for(u=a.length;u--;)vr(a[u]);d&&M!="textarea"||(u="value",M=="progress"&&O==null?e.removeAttribute("value"):O!=null&&(O!==e[u]||M=="progress"&&!O||M=="option"&&O!=j[u])&&at(e,u,O,j[u],o),u="checked",R!=null&&R!=e[u]&&at(e,u,R,j[u],o))}return e}function mr(e,n,i){try{if(typeof e=="function"){var l=typeof e.__u=="function";l&&e.__u(),l&&n==null||(e.__u=e(n))}else e.current=n}catch(o){H.__e(o,i)}}function Ql(e,n,i){var l,o;if(H.unmount&&H.unmount(e),(l=e.ref)&&(l.current&&l.current!=e.__e||mr(l,null,n)),(l=e.__c)!=null){if(l.componentWillUnmount)try{l.componentWillUnmount()}catch(a){H.__e(a,n)}l.base=l.__P=l.__n=null}if(l=e.__k)for(o=0;o<l.length;o++)l[o]&&Ql(l[o],n,i||typeof e.type!="function");i||vr(e.__e),e.__c=e.__=e.__e=void 0}function bo(e,n,i){return this.constructor(e,i)}function ko(e,n,i){var l,o,a,s;n==document&&(n=document.documentElement),H.__&&H.__(e,n),o=(l=!1)?null:n.__k,a=[],s=[],_r(n,e=n.__k=vo(te,null,[e]),o||kt,kt,n.namespaceURI,o?null:n.firstChild?zt.call(n.childNodes):null,a,o?o.__e:n.firstChild,l,s),Vl(a,e,s),e.props.children=null}zt=wt.slice,H={__e:function(e,n,i,l){for(var o,a,s;n=n.__;)if((o=n.__c)&&!o.__)try{if((a=o.constructor)&&a.getDerivedStateFromError!=null&&(o.setState(a.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,l||{}),s=o.__d),s)return o.__E=o}catch(d){e=d}throw e}},Ul=0,Bl=function(e){return e!=null&&e.constructor===void 0},Sn.prototype.setState=function(e,n){var i;i=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ke({},this.state),typeof e=="function"&&(e=e(ke({},i),this.props)),e&&ke(i,e),e!=null&&this.__v&&(n&&this._sb.push(n),Dr(this))},Sn.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Dr(this))},Sn.prototype.render=te,Ie=[],Hl=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ql=function(e,n){return e.__v.__b-n.__v.__b},St.__r=0,pi=Math.random().toString(8),dt="__d"+pi,wn="__a"+pi,Wl=/(PointerCapture)$|Capture$/i,pr=0,Hi=Br(!1),qi=Br(!0);var wo=0;function r(e,n,i,l,o,a){n||(n={});var s,d,f=n;if("ref"in f)for(d in f={},n)d=="ref"?s=n[d]:f[d]=n[d];var u={type:e,props:f,key:i,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--wo,__i:-1,__u:0,__source:o,__self:a};if(typeof e=="function"&&(s=e.defaultProps))for(d in s)f[d]===void 0&&(f[d]=s[d]);return H.vnode&&H.vnode(u),u}var In,G,vi,Hr,Wi=0,Zl=[],J=H,qr=J.__b,Wr=J.__r,Yr=J.diffed,zr=J.__c,Kr=J.unmount,Gr=J.__;function gr(e,n){J.__h&&J.__h(G,e,Wi||n),Wi=0;var i=G.__H||(G.__H={__:[],__h:[]});return e>=i.__.length&&i.__.push({}),i.__[e]}function yr(e){return Wi=1,So(na,e)}function So(e,n,i){var l=gr(In++,2);if(l.t=e,!l.__c&&(l.__=[na(void 0,n),function(d){var f=l.__N?l.__N[0]:l.__[0],u=l.t(f,d);f!==u&&(l.__N=[u,l.__[1]],l.__c.setState({}))}],l.__c=G,!G.__f)){var o=function(d,f,u){if(!l.__c.__H)return!0;var h=!1,g=l.__c.props!==d;if(l.__c.__H.__.some(function(b){if(b.__N){h=!0;var O=b.__[0];b.__=b.__N,b.__N=void 0,O!==b.__[0]&&(g=!0)}}),a){var p=a.call(this,d,f,u);return h?p||g:p}return!h||g};G.__f=!0;var a=G.shouldComponentUpdate,s=G.componentWillUpdate;G.componentWillUpdate=function(d,f,u){if(this.__e){var h=a;a=void 0,o(d,f,u),a=h}s&&s.call(this,d,f,u)},G.shouldComponentUpdate=o}return l.__N||l.__}function Te(e,n){var i=gr(In++,3);!J.__s&&ea(i.__H,n)&&(i.__=e,i.u=n,G.__H.__h.push(i))}function Xl(e,n){var i=gr(In++,7);return ea(i.__H,n)&&(i.__=e(),i.__H=n,i.__h=e),i.__}function Ao(){for(var e;e=Zl.shift();){var n=e.__H;if(e.__P&&n)try{n.__h.some(ht),n.__h.some(Yi),n.__h=[]}catch(i){n.__h=[],J.__e(i,e.__v)}}}J.__b=function(e){G=null,qr&&qr(e)},J.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),Gr&&Gr(e,n)},J.__r=function(e){Wr&&Wr(e),In=0;var n=(G=e.__c).__H;n&&(vi===G?(n.__h=[],G.__h=[],n.__.some(function(i){i.__N&&(i.__=i.__N),i.u=i.__N=void 0})):(n.__h.some(ht),n.__h.some(Yi),n.__h=[],In=0)),vi=G},J.diffed=function(e){Yr&&Yr(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(Zl.push(n)!==1&&Hr===J.requestAnimationFrame||((Hr=J.requestAnimationFrame)||Co)(Ao)),n.__H.__.some(function(i){i.u&&(i.__H=i.u,i.u=void 0)})),vi=G=null},J.__c=function(e,n){n.some(function(i){try{i.__h.some(ht),i.__h=i.__h.filter(function(l){return!l.__||Yi(l)})}catch(l){n.some(function(o){o.__h&&(o.__h=[])}),n=[],J.__e(l,i.__v)}}),zr&&zr(e,n)},J.unmount=function(e){Kr&&Kr(e);var n,i=e.__c;i&&i.__H&&(i.__H.__.some(function(l){try{ht(l)}catch(o){n=o}}),i.__H=void 0,n&&J.__e(n,i.__v))};var Vr=typeof requestAnimationFrame=="function";function Co(e){var n,i=function(){clearTimeout(l),Vr&&cancelAnimationFrame(n),setTimeout(e)},l=setTimeout(i,35);Vr&&(n=requestAnimationFrame(i))}function ht(e){var n=G,i=e.__c;typeof i=="function"&&(e.__c=void 0,i()),G=n}function Yi(e){var n=G;e.__c=e.__(),G=n}function ea(e,n){return!e||e.length!==n.length||n.some(function(i,l){return i!==e[l]})}function na(e,n){return typeof n=="function"?n(e):n}var xo=Symbol.for("preact-signals");function Gt(){if(Se>1)Se--;else{var e,n=!1;for(function(){var o=Ct;for(Ct=void 0;o!==void 0;){var a=o.S;if(a.v===o.v)for(var s=a.t;s!==void 0;s=s.x)s.i===o.i&&(s.i=a.i);o=o.o}}();Cn!==void 0;){var i=Cn;for(Cn=void 0,At++;i!==void 0;){var l=i.u;if(i.u=void 0,i.f&=-3,!(8&i.f)&&ia(i))try{i.c()}catch(o){n||(e=o,n=!0)}i=l}}if(At=0,Se--,n)throw e}}function To(e){if(Se>0)return e();zi=++Eo,Se++;try{return e()}finally{Gt()}}var An,W=void 0;function Vt(e){var n=W,i=An;W=void 0,An=void 0;try{return e()}finally{W=n,An=i}}var Cn=void 0,Se=0,At=0,Eo=0,zi=0,Ct=void 0,xt=0;function ta(e){if(W!==void 0){var n=e.n;if(n===void 0||n.t!==W)return n={i:0,S:e,p:W.s,n:void 0,t:W,e:void 0,x:void 0,r:n},W.s!==void 0&&(W.s.n=n),W.s=n,e.n=n,32&W.f&&e.S(n),n;if(n.i===-1)return n.i=0,n.n!==void 0&&(n.n.p=n.p,n.p!==void 0&&(n.p.n=n.n),n.p=W.s,n.n=void 0,W.s.n=n,W.s=n),n}}function X(e,n){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=n?.watched,this.Z=n?.unwatched,this.name=n?.name}X.prototype.brand=xo;X.prototype.h=function(){return!0};X.prototype.S=function(e){var n=this,i=this.t;i!==e&&e.e===void 0&&(e.x=i,this.t=e,i!==void 0?i.e=e:Vt(function(){var l;(l=n.W)==null||l.call(n)}))};X.prototype.U=function(e){var n=this;if(this.t!==void 0){var i=e.e,l=e.x;i!==void 0&&(i.x=l,e.e=void 0),l!==void 0&&(l.e=i,e.x=void 0),e===this.t&&(this.t=l,l===void 0&&Vt(function(){var o;(o=n.Z)==null||o.call(n)}))}};X.prototype.subscribe=function(e){var n=this;return Hn(function(){var i=n.value;Vt(function(){return e(i)})},{name:"sub"})};X.prototype.valueOf=function(){return this.value};X.prototype.toString=function(){return this.value+""};X.prototype.toJSON=function(){return this.value};X.prototype.peek=function(){var e=this;return Vt(function(){return e.value})};Object.defineProperty(X.prototype,"value",{get:function(){var e=ta(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(At>100)throw new Error("Cycle detected");(function(i){Se!==0&&At===0&&i.l!==zi&&(i.l=zi,Ct={S:i,v:i.v,i:i.i,o:Ct})})(this),this.v=e,this.i++,xt++,Se++;try{for(var n=this.t;n!==void 0;n=n.x)n.t.N()}finally{Gt()}}}});function m(e,n){return new X(e,n)}function ia(e){for(var n=e.s;n!==void 0;n=n.n)if(n.S.i!==n.i||!n.S.h()||n.S.i!==n.i)return!0;return!1}function ra(e){for(var n=e.s;n!==void 0;n=n.n){var i=n.S.n;if(i!==void 0&&(n.r=i),n.S.n=n,n.i=-1,n.n===void 0){e.s=n;break}}}function la(e){for(var n=e.s,i=void 0;n!==void 0;){var l=n.p;n.i===-1?(n.S.U(n),l!==void 0&&(l.n=n.n),n.n!==void 0&&(n.n.p=l)):i=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=l}e.s=i}function Ke(e,n){X.call(this,void 0,n),this.x=e,this.s=void 0,this.g=xt-1,this.f=4}Ke.prototype=new X;Ke.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===xt))return!0;if(this.g=xt,this.f|=1,this.i>0&&!ia(this))return this.f&=-2,!0;var e=W;try{ra(this),W=this;var n=this.x();(16&this.f||this.v!==n||this.i===0)&&(this.v=n,this.f&=-17,this.i++)}catch(i){this.v=i,this.f|=16,this.i++}return W=e,la(this),this.f&=-2,!0};Ke.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var n=this.s;n!==void 0;n=n.n)n.S.S(n)}X.prototype.S.call(this,e)};Ke.prototype.U=function(e){if(this.t!==void 0&&(X.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var n=this.s;n!==void 0;n=n.n)n.S.U(n)}};Ke.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(Ke.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=ta(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Jr(e,n){return new Ke(e,n)}function aa(e){var n=e.m;if(e.m=void 0,typeof n=="function"){Se++;var i=W;W=void 0;try{n()}catch(l){throw e.f&=-2,e.f|=8,br(e),l}finally{W=i,Gt()}}}function br(e){for(var n=e.s;n!==void 0;n=n.n)n.S.U(n);e.x=void 0,e.s=void 0,aa(e)}function Oo(e){if(W!==this)throw new Error("Out-of-order effect");la(this),W=e,this.f&=-2,8&this.f&&br(this),Gt()}function vn(e,n){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=n?.name,An&&An.push(this)}vn.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var n=this.x();typeof n=="function"&&(this.m=n)}finally{e()}};vn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,aa(this),ra(this),Se++;var e=W;return W=this,Oo.bind(this,e)};vn.prototype.N=function(){2&this.f||(this.f|=2,this.u=Cn,Cn=this)};vn.prototype.d=function(){this.f|=8,1&this.f||br(this)};vn.prototype.dispose=function(){this.d()};function Hn(e,n){var i=new vn(e,n);try{i.c()}catch(o){throw i.d(),o}var l=i.d.bind(i);return l[Symbol.dispose]=l,l}var oa,ot,No=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,ca=[];Hn(function(){oa=this.N})();function _n(e,n){H[e]=n.bind(null,H[e]||function(){})}function Tt(e){if(ot){var n=ot;ot=void 0,n()}ot=e&&e.S()}function sa(e){var n=this,i=e.data,l=Ro(i);l.name="ReactiveDom",l.value=i;var o=Xl(function(){for(var d=n,f=n.__v;f=f.__;)if(f.__c){f.__c.__$f|=4;break}var u=Jr(function(){var b=l.value.value;return b===0?0:b===!0?"":b||""}),h=Jr(function(){return!Array.isArray(u.value)&&!Bl(u.value)}),g=Hn(function(){if(this.N=ua,h.value){var b=u.value;d.__v&&d.__v.__e&&d.__v.__e.nodeType===3&&(d.__v.__e.data=b)}}),p=n.__$u.d;return n.__$u.d=function(){g(),p.call(this)},[h,u]},[]),a=o[0],s=o[1];return a.value?s.peek():s.value}sa.displayName="ReactiveTextNode";Object.defineProperties(X.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:sa},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});_n("__b",function(e,n){if(typeof n.type=="string"){var i,l=n.props;for(var o in l)if(o!=="children"){var a=l[o];a instanceof X&&(i||(n.__np=i={}),i[o]=a,l[o]=a.peek())}}e(n)});_n("__r",function(e,n){if(e(n),n.type!==te){Tt();var i,l=n.__c;l&&(l.__$f&=-2,(i=l.__$u)===void 0&&(l.__$u=i=function(o,a){var s;return Hn(function(){s=this},{name:a}),s.c=o,s}(function(){var o;No&&((o=i.y)==null||o.call(i)),l.__$f|=1,l.setState({})},typeof n.type=="function"?n.type.displayName||n.type.name:""))),Tt(i)}});_n("__e",function(e,n,i,l){Tt(),e(n,i,l)});_n("diffed",function(e,n){Tt();var i;if(typeof n.type=="string"&&(i=n.__e)){var l=n.__np,o=n.props,a=i.U;if(a)for(var s in a){var d=a[s];d===void 0||l&&s in l||(d.d(),a[s]=void 0)}if(l){a||(a={},i.U=a);for(var f in l){var u=a[f],h=l[f];u===void 0?(u=Io(i,f,h,o),a[f]=u):u.o(h,o)}}}e(n)});function Io(e,n,i,l){var o=n in e&&e.ownerSVGElement===void 0,a=m(i);return{o:function(s,d){a.value=s,l=d},d:Hn(function(){this.N=ua;var s=a.value.value;l[n]!==s&&(l[n]=s,o?e[n]=s:s!=null&&(s!==!1||n[4]==="-")?e.setAttribute(n,s):e.removeAttribute(n))})}}_n("unmount",function(e,n){if(typeof n.type=="string"){var i=n.__e;if(i){var l=i.U;if(l){i.U=void 0;for(var o in l){var a=l[o];a&&a.d()}}}var s=n.__np;if(s){var d=n.props;for(var f in s)d[f]=s[f]}n.__np=void 0}else{var u=n.__c;if(u){var h=u.__$u;h&&(u.__$u=void 0,h.d())}}e(n)});_n("__h",function(e,n,i,l){l<3&&(n.__$f|=2),e(n,i,l)});Sn.prototype.shouldComponentUpdate=function(e,n){if(this.__R)return!0;var i=this.__$u,l=i&&i.s!==void 0;for(var o in n)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(l||a||4&this.__$f)||1&this.__$f)return!0}else if(!(l||4&this.__$f)||3&this.__$f)return!0;for(var s in e)if(s!=="__source"&&e[s]!==this.props[s])return!0;for(var d in this.props)if(!(d in e))return!0;return!1};function Ro(e,n){return Xl(function(){return m(e,n)},[])}var Lo=function(e){queueMicrotask(function(){queueMicrotask(e)})};function $o(){To(function(){for(var e;e=ca.shift();)oa.call(e)})}function ua(){ca.push(this)===1&&(H.requestAnimationFrame||Lo)($o)}function da(){const e=window.location.hash;return e===""||e==="#"?"/":e.startsWith("#")?e.slice(1):e}const Et=m(da());function Jt(e){const n=e.startsWith("/")?e:`/${e}`;`#${n}`!==window.location.hash&&(window.location.hash=n)}let Qr=!1;function Po(){Qr||(Qr=!0,window.addEventListener("hashchange",()=>{Et.value=da()}))}let Rn=null;function Mo(e){Rn=e}class V extends Error{status;body;constructor(n,i,l){super(l),this.status=n,this.body=i}}async function F(e,n={}){const i={Accept:"application/json",...n.headers??{}};Rn!==null&&(i.Authorization=`Bearer ${Rn}`);const{body:l,...o}=n,a={...o,headers:i};l!==void 0&&(a.body=JSON.stringify(l),i["Content-Type"]="application/json");const s=await fetch(e,a),d=await s.text(),f=d===""?{}:JSON.parse(d);if(!s.ok){const u=f.error?.message??`request failed (${s.status})`;throw new V(s.status,f,u)}return f}async function Fo(e,n,i,l={}){const o={Accept:"text/event-stream","Content-Type":"application/json",...l.headers??{}};Rn!==null&&(o.Authorization=`Bearer ${Rn}`);const a=await fetch(e,{...l,method:"POST",headers:o,body:JSON.stringify(n)});if(!a.ok||a.body===null){const h=await a.text().catch(()=>"");let g={};try{g=h===""?{}:JSON.parse(h)}catch{}throw new V(a.status,g,g.error?.message??`stream failed (${a.status})`)}const s=a.body.getReader(),d=new TextDecoder;let f="";const u=h=>{for(const g of h.split(`
2
- `)){if(!g.startsWith("data:"))continue;const p=g.slice(5).trim();if(p!=="")try{i(JSON.parse(p))}catch{}}};for(;;){const{done:h,value:g}=await s.read();if(h)break;f+=d.decode(g,{stream:!0});let p=f.indexOf(`
3
-
4
- `);for(;p!==-1;)u(f.slice(0,p)),f=f.slice(p+2),p=f.indexOf(`
5
-
6
- `)}f.trim()!==""&&u(f)}const He=m(null);async function jo(){try{const e=await F("/api/v1/ping");He.value={...e,projectScopeAvailable:e.projectScopeAvailable===!0,projectSurface:e.projectSurface===!0,devSurfaces:e.devSurfaces===!0}}catch{He.value=null}}function se(e){switch(e.code){case"VALIDATION":return"Some fields need attention before saving.";case"CONFLICT":return"This file changed on disk while you were editing. Review the latest version and re-save.";case"PRECONDITION_REQUIRED":return"Reload the page once — the optimistic-lock token is missing.";case"NOT_FOUND":return"The file does not exist yet. Use the wizard to create it.";case"ATOMIC_WRITE":return"Write failed mid-flight. The file was not partially modified.";case"YAML_PARSE":return"YAML parse error — fix the file by hand, then reload.";default:return e.message}}function Do(e){return/expected (boolean|string|number)/i.test(e)?e.replace(/^expected/i,"Expected"):e}function Qt(e){const n={};for(const i of e.fields??[])n[i.path]=Do(i.message);return n}function Uo({id:e,children:n}){return r("p",{class:"ac-field__description",id:e,children:n})}function Bo({id:e,children:n}){return r("p",{class:"ac-field__error",id:e,role:"alert","aria-live":"polite",children:n})}function Ge({id:e,label:n,description:i,error:l,children:o}){const a=i!==void 0?`${e}-desc`:void 0,s=l!==void 0?`${e}-err`:void 0;return r("div",{class:"ac-field","data-invalid":l!==void 0?"true":void 0,children:[r("label",{class:"ac-field__label",for:e,children:n}),i!==void 0?r(Uo,{id:a,children:i}):null,r("div",{class:"ac-field__control","aria-describedby":a,"aria-errormessage":s,children:o}),l!==void 0?r(Bo,{id:s,children:l}):null]})}function fa(e){return r(Ge,{id:e.id,label:e.label,description:e.description,error:e.error,children:r("input",{class:"ac-input",type:"text",id:e.id,name:e.name,value:e.value,placeholder:e.placeholder,"aria-invalid":e.error!==void 0?"true":void 0,onInput:n=>e.onChange(n.currentTarget.value)})})}function Ho(e){const n=e.step??(e.integer===!0?1:"any");return r(Ge,{id:e.id,label:e.label,description:e.description,error:e.error,children:r("input",{class:"ac-input",type:"number",id:e.id,name:e.name,value:Number.isFinite(e.value)?String(e.value):"0",min:e.min,max:e.max,step:n,"aria-invalid":e.error!==void 0?"true":void 0,onInput:i=>{const l=i.currentTarget.value,o=l===""?0:Number(l);e.onChange(Number.isFinite(o)?o:0)}})})}function qo(e){return r(Ge,{id:e.id,label:e.label,description:e.description,error:e.error,children:r("label",{class:"ac-toggle",children:[r("input",{type:"checkbox",id:e.id,name:e.name,checked:e.value,"aria-invalid":e.error!==void 0?"true":void 0,onChange:n=>e.onChange(n.currentTarget.checked)}),r("span",{class:"ac-toggle__track","aria-hidden":"true"}),r("span",{class:"ac-toggle__state",children:e.value?"On":"Off"})]})})}function ha(e){const n=e.options.length>3;return r(Ge,{id:e.id,label:e.label,description:e.description,error:e.error,children:n?r("select",{class:"ac-input",id:e.id,name:e.name,value:e.value,"aria-invalid":e.error!==void 0?"true":void 0,onChange:i=>e.onChange(i.currentTarget.value),children:e.options.map(i=>r("option",{value:i.value,children:i.label??(i.value===""?"(none)":i.value)},i.value))}):r("div",{class:"ac-radio-group",role:"radiogroup","aria-labelledby":`${e.id}-label`,children:e.options.map(i=>{const l=`${e.id}-${i.value||"none"}`;return r("label",{class:"ac-radio",for:l,children:[r("input",{type:"radio",id:l,name:e.name,value:i.value,checked:i.value===e.value,onChange:()=>e.onChange(i.value)}),r("span",{children:i.label??(i.value===""?"(none)":i.value)})]},i.value)})})})}function Ot(e){return r(Ge,{id:e.id,label:e.label,description:e.description,error:e.error,children:r("textarea",{class:"ac-textarea",id:e.id,name:e.name,rows:e.rows??6,placeholder:e.placeholder,"aria-invalid":e.error!==void 0?"true":void 0,onInput:n=>e.onChange(n.currentTarget.value),children:e.value})})}function pa(e){return e.replace(/_/g," ").replace(/\./g," › ").replace(/\b\w/g,n=>n.toUpperCase())}function Wo(e){return e.enum!==void 0&&e.enum.length>0?"enum":e.type==="integer"?"integer":e.type==="number"?"number":e.type==="boolean"?"boolean":e.type==="string"?"string":e.type==="array"&&e.items?.type==="string"?"array-of-strings":"unsupported"}function _i(e,n){const i=Wo(n);return{path:e,kind:i,label:pa(e[e.length-1]??""),description:n.description,options:n.enum,min:n.minimum,max:n.maximum,defaultValue:n.default}}function va(e){const n=[],i=e.properties??{};for(const[l,o]of Object.entries(i))if(o.type==="object"&&o.properties!==void 0){const a=[];for(const[s,d]of Object.entries(o.properties))if(d.type==="object"&&d.properties!==void 0)for(const[f,u]of Object.entries(d.properties))a.push(_i([l,s,f],u));else a.push(_i([l,s],d));n.push({path:[l],label:pa(l),description:o.description,fields:a})}else{const a=n.find(d=>d.path[0]==="__general"),s=_i([l],o);a===void 0?n.unshift({path:["__general"],label:"General",fields:[s]}):a.fields.push(s)}return n}function qn(e,n){let i=e;for(const l of n){if(i===null||typeof i!="object"||Array.isArray(i))return;i=i[l]}return i}function Ln(e,n,i){if(n.length===0)return e;const[l,...o]=n;if(l===void 0)return e;const a={...e};if(o.length===0)return a[l]=i,a;const s=a[l],d=s!==null&&typeof s=="object"&&!Array.isArray(s)?s:{};return a[l]=Ln(d,o,i),a}function on(e){return e.join(".")}function Zr(e,n,i,l){const o=on(e.path),a=o,s=qn(n,e.path),d=i[o],f=u=>{l(Ln(n,e.path,u))};switch(e.kind){case"string":{const u=typeof s=="string"?s:"";return u.length>80?r(Ot,{id:o,name:a,label:e.label,description:e.description,error:d,value:u,onChange:f}):r(fa,{id:o,name:a,label:e.label,description:e.description,error:d,value:u,onChange:f})}case"enum":{const u=typeof s=="string"||typeof s=="number"?String(s):"",h=(e.options??[]).map(g=>({value:String(g)}));return r(ha,{id:o,name:a,label:e.label,description:e.description,error:d,value:u,options:h,onChange:f})}case"number":case"integer":{const u=typeof s=="number"?s:0;return r(Ho,{id:o,name:a,label:e.label,description:e.description,error:d,value:u,integer:e.kind==="integer",min:e.min,max:e.max,onChange:f})}case"boolean":{const u=typeof s=="boolean"?s:!1;return r(qo,{id:o,name:a,label:e.label,description:e.description,error:d,value:u,onChange:f})}case"array-of-strings":{const h=(Array.isArray(s)?s.filter(g=>typeof g=="string"):[]).join(`
7
- `);return r(Ot,{id:o,name:a,label:e.label,description:`${e.description??""} (one entry per line)`.trim(),error:d,value:h,onChange:g=>{const p=g.split(`
8
- `).map(b=>b.trim()).filter(b=>b!=="");f(p)}})}default:return null}}function Yo({field:e,values:n,errors:i,onChange:l,decorate:o}){const a=on(e.path),s=o?.(a,e);return s===void 0?r("div",{children:Zr(e,n,i,l)},a):r("div",{class:`ac-field-row${s.modified?" ac-field-row--modified":""}`,children:[r("div",{class:"ac-field-row__body",children:Zr(e,n,i,l)}),r("div",{class:"ac-field-row__meta",children:[s.sourceLabel!==void 0?r("span",{class:"ac-badge ac-badge--source",title:`Value set in the ${s.sourceLabel} layer`,children:s.sourceLabel}):null,s.modified&&s.onReset!==void 0?r("button",{type:"button",class:"ac-field-row__reset",title:"Reset to default",onClick:s.onReset,children:"Reset"}):null]})]})}function _a({section:e,values:n,errors:i,onChange:l,decorate:o,footer:a}){return r("section",{class:"ac-section","aria-labelledby":`section-${on(e.path)}`,children:[r("h2",{class:"ac-section__title",id:`section-${on(e.path)}`,children:e.label}),e.description!==void 0?r("p",{class:"ac-section__description",children:e.description}):null,r("div",{class:"ac-section__fields",children:e.fields.map(s=>r(Yo,{field:s,values:n,errors:i,onChange:l,decorate:o},on(s.path)))}),a]})}function zo(e){const n=va(e.schema),i=e.errors??{};return r("form",{class:"ac-form",onSubmit:l=>l.preventDefault(),children:[n.map(l=>r(_a,{section:l,values:e.values,errors:i,onChange:e.onChange,decorate:e.decorate},on(l.path))),e.actions!==void 0?r("div",{class:"ac-form__actions",children:e.actions}):null]})}function Ko(e){const[n]=yr(()=>`${e.id}-list`);return r(Ge,{id:e.id,label:e.label,description:e.description,error:e.error,children:[r("input",{class:"ac-input",type:"text",id:e.id,name:e.name,value:e.value,placeholder:e.placeholder,list:n,"aria-invalid":e.error!==void 0?"true":void 0,onInput:i=>e.onChange(i.currentTarget.value)}),r("datalist",{id:n,children:e.suggestions.map(i=>r("option",{value:i},i))})]})}const Go=["developer","reviewer","designer","product-manager","ops","qa","maintainer"],Vo=["de","en","en-US","en-GB","fr","es","it","nl","pt","pt-BR"];function Xr(){return new Date().toISOString().slice(0,10)}function en(e,n){return e?.[n]}function Jo({value:e,onChange:n,errors:i,hideRole:l,hideIdentityBasics:o}){const[a,s]=yr(""),d="umd-role-suggestions";function f(O){n({...e,...O,last_updated:Xr()})}const u=e.role.filter(O=>O.trim()!=="");function h(O){const R=O.trim();if(R===""||u.includes(R)){s("");return}f({role:[...u,R]}),s("")}function g(O){u.length<=1||f({role:u.filter(R=>R!==O)})}function p(O){const R={...e,last_updated:Xr()};O===""?delete R.notes:R.notes=O,n(R)}const b=Go.filter(O=>!u.includes(O));return r("div",{class:"ac-user-md-form",children:[o?null:r(fa,{id:"umd-name",name:"identity.name",label:"Name",description:'How the agent addresses you in chat (e.g. "Matze", "Sarah"). Required.',value:e.identity.name,error:en(i,"identity.name"),onChange:O=>f({identity:{...e.identity,name:O}})}),o?null:r(Ko,{id:"umd-language",name:"language",label:"Language",description:"BCP-47 tag the agent mirrors in replies (e.g. 'de', 'en', 'en-US').",value:e.language,suggestions:Vo,error:en(i,"language"),onChange:O=>f({language:O})}),l?null:r(Ge,{id:"umd-role-input",label:"Roles",description:"One or more roles. Seeded suggestions are non-binding — type anything and press Enter.",error:en(i,"role"),children:[r("ul",{class:"ac-chip-list","data-testid":"umd-role-list",children:u.map(O=>r("li",{class:"ac-chip",children:[r("span",{children:O}),r("button",{type:"button",class:"ac-chip__remove","aria-label":`Remove ${O}`,disabled:u.length<=1,onClick:()=>g(O),children:"×"})]},O))}),r("div",{class:"ac-role-add",children:[r("input",{class:"ac-input",type:"text",id:"umd-role-input",name:"role-add",list:d,placeholder:"Add a role and press Enter",value:a,onInput:O=>s(O.currentTarget.value),onKeyDown:O=>{(O.key==="Enter"||O.key===",")&&(O.preventDefault(),h(a))}}),r("datalist",{id:d,children:b.map(O=>r("option",{value:O},O))}),r("button",{type:"button",class:"ac-button",onClick:()=>h(a),children:"Add role"})]})]}),r(ha,{id:"umd-pace",name:"style.pace",label:"Pace",value:e.style.pace,error:en(i,"style.pace"),options:[{value:"pragmatic",label:"Pragmatic"},{value:"thorough",label:"Thorough"},{value:"rapid",label:"Rapid"}],onChange:O=>f({style:{...e.style,pace:O}})}),r(Ot,{id:"umd-voice",name:"voice_sample",label:"Voice sample",description:"One to three sentences in your own style. The agent uses it as a tone anchor.",rows:4,value:e.voice_sample,error:en(i,"voice_sample"),onChange:O=>f({voice_sample:O})}),r(Ot,{id:"umd-notes",name:"notes",label:"Notes",description:"Optional free-form prose the agent remembers across sessions.",rows:6,value:e.notes??"",error:en(i,"notes"),onChange:p})]})}function ma(){return{version:1,identity:{name:""},language:"en",role:[],style:{pace:"pragmatic"},voice_sample:"",last_updated:"1970-01-01"}}function el(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ct(e,n){return typeof e=="string"?e:n}function Qo(e){return e==="thorough"||e==="rapid"?e:"pragmatic"}function Zo(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"&&n.trim()!==""):[]}function Xo(e){if(typeof e=="string")return e===""?void 0:e}function nl(e){const n=ma(),i=el(e.identity)?e.identity:{},l=el(e.style)?e.style:{},o=Xo(e.notes),a={version:1,identity:{name:ct(i.name,n.identity.name)},language:ct(e.language,n.language),role:Zo(e.role),style:{pace:Qo(l.pace)},voice_sample:ct(e.voice_sample,n.voice_sample),last_updated:ct(e.last_updated,n.last_updated)};return o!==void 0&&(a.notes=o),a}function ec(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ne={},st={},Oe={},tl;function Wn(){if(tl)return Oe;tl=1;function e(s){return typeof s>"u"||s===null}function n(s){return typeof s=="object"&&s!==null}function i(s){return Array.isArray(s)?s:e(s)?[]:[s]}function l(s,d){if(d){const f=Object.keys(d);for(let u=0,h=f.length;u<h;u+=1){const g=f[u];s[g]=d[g]}}return s}function o(s,d){let f="";for(let u=0;u<d;u+=1)f+=s;return f}function a(s){return s===0&&Number.NEGATIVE_INFINITY===1/s}return Oe.isNothing=e,Oe.isObject=n,Oe.toArray=i,Oe.repeat=o,Oe.isNegativeZero=a,Oe.extend=l,Oe}var mi,il;function Yn(){if(il)return mi;il=1;function e(i,l){let o="";const a=i.reason||"(unknown reason)";return i.mark?(i.mark.name&&(o+='in "'+i.mark.name+'" '),o+="("+(i.mark.line+1)+":"+(i.mark.column+1)+")",!l&&i.mark.snippet&&(o+=`
9
-
10
- `+i.mark.snippet),a+" "+o):a}function n(i,l){Error.call(this),this.name="YAMLException",this.reason=i,this.mark=l,this.message=e(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n.prototype.toString=function(l){return this.name+": "+e(this,l)},mi=n,mi}var gi,rl;function nc(){if(rl)return gi;rl=1;const e=Wn();function n(o,a,s,d,f){let u="",h="";const g=Math.floor(f/2)-1;return d-a>g&&(u=" ... ",a=d-g+u.length),s-d>g&&(h=" ...",s=d+g-h.length),{str:u+o.slice(a,s).replace(/\t/g,"→")+h,pos:d-a+u.length}}function i(o,a){return e.repeat(" ",a-o.length)+o}function l(o,a){if(a=Object.create(a||null),!o.buffer)return null;a.maxLength||(a.maxLength=79),typeof a.indent!="number"&&(a.indent=1),typeof a.linesBefore!="number"&&(a.linesBefore=3),typeof a.linesAfter!="number"&&(a.linesAfter=2);const s=/\r?\n|\r|\0/g,d=[0],f=[];let u,h=-1;for(;u=s.exec(o.buffer);)f.push(u.index),d.push(u.index+u[0].length),o.position<=u.index&&h<0&&(h=d.length-2);h<0&&(h=d.length-1);let g="";const p=Math.min(o.line+a.linesAfter,f.length).toString().length,b=a.maxLength-(a.indent+p+3);for(let R=1;R<=a.linesBefore&&!(h-R<0);R++){const j=n(o.buffer,d[h-R],f[h-R],o.position-(d[h]-d[h-R]),b);g=e.repeat(" ",a.indent)+i((o.line-R+1).toString(),p)+" | "+j.str+`
11
- `+g}const O=n(o.buffer,d[h],f[h],o.position,b);g+=e.repeat(" ",a.indent)+i((o.line+1).toString(),p)+" | "+O.str+`
12
- `,g+=e.repeat("-",a.indent+p+3+O.pos)+`^
13
- `;for(let R=1;R<=a.linesAfter&&!(h+R>=f.length);R++){const j=n(o.buffer,d[h+R],f[h+R],o.position-(d[h]-d[h+R]),b);g+=e.repeat(" ",a.indent)+i((o.line+R+1).toString(),p)+" | "+j.str+`
14
- `}return g.replace(/\n$/,"")}return gi=l,gi}var yi,ll;function re(){if(ll)return yi;ll=1;const e=Yn(),n=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],i=["scalar","sequence","mapping"];function l(a){const s={};return a!==null&&Object.keys(a).forEach(function(d){a[d].forEach(function(f){s[String(f)]=d})}),s}function o(a,s){if(s=s||{},Object.keys(s).forEach(function(d){if(n.indexOf(d)===-1)throw new e('Unknown option "'+d+'" is met in definition of "'+a+'" YAML type.')}),this.options=s,this.tag=a,this.kind=s.kind||null,this.resolve=s.resolve||function(){return!0},this.construct=s.construct||function(d){return d},this.instanceOf=s.instanceOf||null,this.predicate=s.predicate||null,this.represent=s.represent||null,this.representName=s.representName||null,this.defaultStyle=s.defaultStyle||null,this.multi=s.multi||!1,this.styleAliases=l(s.styleAliases||null),i.indexOf(this.kind)===-1)throw new e('Unknown kind "'+this.kind+'" is specified for "'+a+'" YAML type.')}return yi=o,yi}var bi,al;function ga(){if(al)return bi;al=1;const e=Yn(),n=re();function i(a,s){const d=[];return a[s].forEach(function(f){let u=d.length;d.forEach(function(h,g){h.tag===f.tag&&h.kind===f.kind&&h.multi===f.multi&&(u=g)}),d[u]=f}),d}function l(){const a={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function s(d){d.multi?(a.multi[d.kind].push(d),a.multi.fallback.push(d)):a[d.kind][d.tag]=a.fallback[d.tag]=d}for(let d=0,f=arguments.length;d<f;d+=1)arguments[d].forEach(s);return a}function o(a){return this.extend(a)}return o.prototype.extend=function(s){let d=[],f=[];if(s instanceof n)f.push(s);else if(Array.isArray(s))f=f.concat(s);else if(s&&(Array.isArray(s.implicit)||Array.isArray(s.explicit)))s.implicit&&(d=d.concat(s.implicit)),s.explicit&&(f=f.concat(s.explicit));else throw new e("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");d.forEach(function(h){if(!(h instanceof n))throw new e("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(h.loadKind&&h.loadKind!=="scalar")throw new e("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(h.multi)throw new e("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),f.forEach(function(h){if(!(h instanceof n))throw new e("Specified list of YAML types (or a single Type object) contains a non-Type object.")});const u=Object.create(o.prototype);return u.implicit=(this.implicit||[]).concat(d),u.explicit=(this.explicit||[]).concat(f),u.compiledImplicit=i(u,"implicit"),u.compiledExplicit=i(u,"explicit"),u.compiledTypeMap=l(u.compiledImplicit,u.compiledExplicit),u},bi=o,bi}var ki,ol;function ya(){if(ol)return ki;ol=1;const e=re();return ki=new e("tag:yaml.org,2002:str",{kind:"scalar",construct:function(n){return n!==null?n:""}}),ki}var wi,cl;function ba(){if(cl)return wi;cl=1;const e=re();return wi=new e("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(n){return n!==null?n:[]}}),wi}var Si,sl;function ka(){if(sl)return Si;sl=1;const e=re();return Si=new e("tag:yaml.org,2002:map",{kind:"mapping",construct:function(n){return n!==null?n:{}}}),Si}var Ai,ul;function wa(){if(ul)return Ai;ul=1;const e=ga();return Ai=new e({explicit:[ya(),ba(),ka()]}),Ai}var Ci,dl;function Sa(){if(dl)return Ci;dl=1;const e=re();function n(o){if(o===null)return!0;const a=o.length;return a===1&&o==="~"||a===4&&(o==="null"||o==="Null"||o==="NULL")}function i(){return null}function l(o){return o===null}return Ci=new e("tag:yaml.org,2002:null",{kind:"scalar",resolve:n,construct:i,predicate:l,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"}),Ci}var xi,fl;function Aa(){if(fl)return xi;fl=1;const e=re();function n(o){if(o===null)return!1;const a=o.length;return a===4&&(o==="true"||o==="True"||o==="TRUE")||a===5&&(o==="false"||o==="False"||o==="FALSE")}function i(o){return o==="true"||o==="True"||o==="TRUE"}function l(o){return Object.prototype.toString.call(o)==="[object Boolean]"}return xi=new e("tag:yaml.org,2002:bool",{kind:"scalar",resolve:n,construct:i,predicate:l,represent:{lowercase:function(o){return o?"true":"false"},uppercase:function(o){return o?"TRUE":"FALSE"},camelcase:function(o){return o?"True":"False"}},defaultStyle:"lowercase"}),xi}var Ti,hl;function Ca(){if(hl)return Ti;hl=1;const e=Wn(),n=re();function i(u){return u>=48&&u<=57||u>=65&&u<=70||u>=97&&u<=102}function l(u){return u>=48&&u<=55}function o(u){return u>=48&&u<=57}function a(u){if(u===null)return!1;const h=u.length;let g=0,p=!1;if(!h)return!1;let b=u[g];if((b==="-"||b==="+")&&(b=u[++g]),b==="0"){if(g+1===h)return!0;if(b=u[++g],b==="b"){for(g++;g<h;g++){if(b=u[g],b!=="0"&&b!=="1")return!1;p=!0}return p&&isFinite(s(u))}if(b==="x"){for(g++;g<h;g++){if(!i(u.charCodeAt(g)))return!1;p=!0}return p&&isFinite(s(u))}if(b==="o"){for(g++;g<h;g++){if(!l(u.charCodeAt(g)))return!1;p=!0}return p&&isFinite(s(u))}}for(;g<h;g++){if(!o(u.charCodeAt(g)))return!1;p=!0}return p?isFinite(s(u)):!1}function s(u){let h=u,g=1,p=h[0];if((p==="-"||p==="+")&&(p==="-"&&(g=-1),h=h.slice(1),p=h[0]),h==="0")return 0;if(p==="0"){if(h[1]==="b")return g*parseInt(h.slice(2),2);if(h[1]==="x")return g*parseInt(h.slice(2),16);if(h[1]==="o")return g*parseInt(h.slice(2),8)}return g*parseInt(h,10)}function d(u){return s(u)}function f(u){return Object.prototype.toString.call(u)==="[object Number]"&&u%1===0&&!e.isNegativeZero(u)}return Ti=new n("tag:yaml.org,2002:int",{kind:"scalar",resolve:a,construct:d,predicate:f,represent:{binary:function(u){return u>=0?"0b"+u.toString(2):"-0b"+u.toString(2).slice(1)},octal:function(u){return u>=0?"0o"+u.toString(8):"-0o"+u.toString(8).slice(1)},decimal:function(u){return u.toString(10)},hexadecimal:function(u){return u>=0?"0x"+u.toString(16).toUpperCase():"-0x"+u.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Ti}var Ei,pl;function xa(){if(pl)return Ei;pl=1;const e=Wn(),n=re(),i=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),l=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function o(u){return u===null||!i.test(u)?!1:isFinite(parseFloat(u,10))?!0:l.test(u)}function a(u){let h=u.toLowerCase();const g=h[0]==="-"?-1:1;return"+-".indexOf(h[0])>=0&&(h=h.slice(1)),h===".inf"?g===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:h===".nan"?NaN:g*parseFloat(h,10)}const s=/^[-+]?[0-9]+e/;function d(u,h){if(isNaN(u))switch(h){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===u)switch(h){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===u)switch(h){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(e.isNegativeZero(u))return"-0.0";const g=u.toString(10);return s.test(g)?g.replace("e",".e"):g}function f(u){return Object.prototype.toString.call(u)==="[object Number]"&&(u%1!==0||e.isNegativeZero(u))}return Ei=new n("tag:yaml.org,2002:float",{kind:"scalar",resolve:o,construct:a,predicate:f,represent:d,defaultStyle:"lowercase"}),Ei}var Oi,vl;function Ta(){return vl||(vl=1,Oi=wa().extend({implicit:[Sa(),Aa(),Ca(),xa()]})),Oi}var Ni,_l;function Ea(){return _l||(_l=1,Ni=Ta()),Ni}var Ii,ml;function Oa(){if(ml)return Ii;ml=1;const e=re(),n=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),i=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function l(s){return s===null?!1:n.exec(s)!==null||i.exec(s)!==null}function o(s){let d=0,f=null,u=n.exec(s);if(u===null&&(u=i.exec(s)),u===null)throw new Error("Date resolve error");const h=+u[1],g=+u[2]-1,p=+u[3];if(!u[4])return new Date(Date.UTC(h,g,p));const b=+u[4],O=+u[5],R=+u[6];if(u[7]){for(d=u[7].slice(0,3);d.length<3;)d+="0";d=+d}if(u[9]){const D=+u[10],M=+(u[11]||0);f=(D*60+M)*6e4,u[9]==="-"&&(f=-f)}const j=new Date(Date.UTC(h,g,p,b,O,R,d));return f&&j.setTime(j.getTime()-f),j}function a(s){return s.toISOString()}return Ii=new e("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:l,construct:o,instanceOf:Date,represent:a}),Ii}var Ri,gl;function Na(){if(gl)return Ri;gl=1;const e=re();function n(i){return i==="<<"||i===null}return Ri=new e("tag:yaml.org,2002:merge",{kind:"scalar",resolve:n}),Ri}var Li,yl;function Ia(){if(yl)return Li;yl=1;const e=re(),n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
15
- \r`;function i(s){if(s===null)return!1;let d=0;const f=s.length,u=n;for(let h=0;h<f;h++){const g=u.indexOf(s.charAt(h));if(!(g>64)){if(g<0)return!1;d+=6}}return d%8===0}function l(s){const d=s.replace(/[\r\n=]/g,""),f=d.length,u=n;let h=0;const g=[];for(let b=0;b<f;b++)b%4===0&&b&&(g.push(h>>16&255),g.push(h>>8&255),g.push(h&255)),h=h<<6|u.indexOf(d.charAt(b));const p=f%4*6;return p===0?(g.push(h>>16&255),g.push(h>>8&255),g.push(h&255)):p===18?(g.push(h>>10&255),g.push(h>>2&255)):p===12&&g.push(h>>4&255),new Uint8Array(g)}function o(s){let d="",f=0;const u=s.length,h=n;for(let p=0;p<u;p++)p%3===0&&p&&(d+=h[f>>18&63],d+=h[f>>12&63],d+=h[f>>6&63],d+=h[f&63]),f=(f<<8)+s[p];const g=u%3;return g===0?(d+=h[f>>18&63],d+=h[f>>12&63],d+=h[f>>6&63],d+=h[f&63]):g===2?(d+=h[f>>10&63],d+=h[f>>4&63],d+=h[f<<2&63],d+=h[64]):g===1&&(d+=h[f>>2&63],d+=h[f<<4&63],d+=h[64],d+=h[64]),d}function a(s){return Object.prototype.toString.call(s)==="[object Uint8Array]"}return Li=new e("tag:yaml.org,2002:binary",{kind:"scalar",resolve:i,construct:l,predicate:a,represent:o}),Li}var $i,bl;function Ra(){if(bl)return $i;bl=1;const e=re(),n=Object.prototype.hasOwnProperty,i=Object.prototype.toString;function l(a){if(a===null)return!0;const s=[],d=a;for(let f=0,u=d.length;f<u;f+=1){const h=d[f];let g=!1;if(i.call(h)!=="[object Object]")return!1;let p;for(p in h)if(n.call(h,p))if(!g)g=!0;else return!1;if(!g)return!1;if(s.indexOf(p)===-1)s.push(p);else return!1}return!0}function o(a){return a!==null?a:[]}return $i=new e("tag:yaml.org,2002:omap",{kind:"sequence",resolve:l,construct:o}),$i}var Pi,kl;function La(){if(kl)return Pi;kl=1;const e=re(),n=Object.prototype.toString;function i(o){if(o===null)return!0;const a=o,s=new Array(a.length);for(let d=0,f=a.length;d<f;d+=1){const u=a[d];if(n.call(u)!=="[object Object]")return!1;const h=Object.keys(u);if(h.length!==1)return!1;s[d]=[h[0],u[h[0]]]}return!0}function l(o){if(o===null)return[];const a=o,s=new Array(a.length);for(let d=0,f=a.length;d<f;d+=1){const u=a[d],h=Object.keys(u);s[d]=[h[0],u[h[0]]]}return s}return Pi=new e("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:i,construct:l}),Pi}var Mi,wl;function $a(){if(wl)return Mi;wl=1;const e=re(),n=Object.prototype.hasOwnProperty;function i(o){if(o===null)return!0;const a=o;for(const s in a)if(n.call(a,s)&&a[s]!==null)return!1;return!0}function l(o){return o!==null?o:{}}return Mi=new e("tag:yaml.org,2002:set",{kind:"mapping",resolve:i,construct:l}),Mi}var Fi,Sl;function kr(){return Sl||(Sl=1,Fi=Ea().extend({implicit:[Oa(),Na()],explicit:[Ia(),Ra(),La(),$a()]})),Fi}var Al;function tc(){if(Al)return st;Al=1;const e=Wn(),n=Yn(),i=nc(),l=kr(),o=Object.prototype.hasOwnProperty,a=1,s=2,d=3,f=4,u=1,h=2,g=3,p=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,b=/[\x85\u2028\u2029]/,O=/[,\[\]{}]/,R=/^(?:!|!!|![0-9A-Za-z-]+!)$/,j=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function D(t){return Object.prototype.toString.call(t)}function M(t){return t===10||t===13}function B(t){return t===9||t===32}function Y(t){return t===9||t===32||t===10||t===13}function ee(t){return t===44||t===91||t===93||t===123||t===125}function fe(t){if(t>=48&&t<=57)return t-48;const v=t|32;return v>=97&&v<=102?v-97+10:-1}function Ve(t){return t===120?2:t===117?4:t===85?8:0}function he(t){return t>=48&&t<=57?t-48:-1}function pe(t){switch(t){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
16
- `;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"…";case 95:return" ";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function le(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}function ce(t,v,k){v==="__proto__"?Object.defineProperty(t,v,{configurable:!0,enumerable:!0,writable:!0,value:k}):t[v]=k}const Gn=new Array(256),mn=new Array(256);for(let t=0;t<256;t++)Gn[t]=pe(t)?1:0,mn[t]=pe(t);function Z(t,v){this.input=t,this.filename=v.filename||null,this.schema=v.schema||l,this.onWarning=v.onWarning||null,this.legacy=v.legacy||!1,this.json=v.json||!1,this.listener=v.listener||null,this.maxDepth=typeof v.maxDepth=="number"?v.maxDepth:100,this.maxTotalMergeKeys=typeof v.maxTotalMergeKeys=="number"?v.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function Vn(t,v){const k={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return k.snippet=i(k),new n(v,k)}function L(t,v){throw Vn(t,v)}function Je(t,v){t.onWarning&&t.onWarning.call(null,Vn(t,v))}function ve(t,v,k){const A=t.anchorMapTransactions;if(A.length!==0){const y=A[A.length-1];o.call(y,v)||(y[v]={existed:o.call(t.anchorMap,v),value:t.anchorMap[v]})}t.anchorMap[v]=k}function ci(t){t.anchorMapTransactions.push(Object.create(null))}function $e(t){const v=t.anchorMapTransactions.pop(),k=t.anchorMapTransactions;if(k.length===0)return;const A=k[k.length-1],y=Object.keys(v);for(let E=0,c=y.length;E<c;E+=1){const _=y[E];o.call(A,_)||(A[_]=v[_])}}function si(t){const v=t.anchorMapTransactions.pop(),k=Object.keys(v);for(let A=k.length-1;A>=0;A-=1){const y=v[k[A]];y.existed?t.anchorMap[k[A]]=y.value:delete t.anchorMap[k[A]]}}function gn(t){return{position:t.position,line:t.line,lineStart:t.lineStart,lineIndent:t.lineIndent,firstTabInLine:t.firstTabInLine,tag:t.tag,anchor:t.anchor,kind:t.kind,result:t.result}}function Qe(t,v){t.position=v.position,t.line=v.line,t.lineStart=v.lineStart,t.lineIndent=v.lineIndent,t.firstTabInLine=v.firstTabInLine,t.tag=v.tag,t.anchor=v.anchor,t.kind=v.kind,t.result=v.result}const Jn={YAML:function(v,k,A){v.version!==null&&L(v,"duplication of %YAML directive"),A.length!==1&&L(v,"YAML directive accepts exactly one argument");const y=/^([0-9]+)\.([0-9]+)$/.exec(A[0]);y===null&&L(v,"ill-formed argument of the YAML directive");const E=parseInt(y[1],10),c=parseInt(y[2],10);E!==1&&L(v,"unacceptable YAML version of the document"),v.version=A[0],v.checkLineBreaks=c<2,c!==1&&c!==2&&Je(v,"unsupported YAML version of the document")},TAG:function(v,k,A){let y;A.length!==2&&L(v,"TAG directive accepts exactly two arguments");const E=A[0];y=A[1],R.test(E)||L(v,"ill-formed tag handle (first argument) of the TAG directive"),o.call(v.tagMap,E)&&L(v,'there is a previously declared suffix for "'+E+'" tag handle'),j.test(y)||L(v,"ill-formed tag prefix (second argument) of the TAG directive");try{y=decodeURIComponent(y)}catch{L(v,"tag prefix is malformed: "+y)}v.tagMap[E]=y}};function ae(t,v,k,A){if(v<k){const y=t.input.slice(v,k);if(A)for(let E=0,c=y.length;E<c;E+=1){const _=y.charCodeAt(E);_===9||_>=32&&_<=1114111||L(t,"expected valid JSON character")}else p.test(y)&&L(t,"the stream contains non-printable characters");t.result+=y}}function Ee(t,v,k,A){e.isObject(k)||L(t,"cannot merge mappings; the provided source object is unacceptable");const y=Object.keys(k);for(let E=0,c=y.length;E<c;E+=1){const _=y[E];t.maxTotalMergeKeys!==-1&&++t.totalMergeKeys>t.maxTotalMergeKeys&&L(t,"merge keys exceeded maxTotalMergeKeys ("+t.maxTotalMergeKeys+")"),o.call(v,_)||(ce(v,_,k[_]),A[_]=!0)}}function _e(t,v,k,A,y,E,c,_,x){if(Array.isArray(y)){y=Array.prototype.slice.call(y);for(let w=0,S=y.length;w<S;w+=1)Array.isArray(y[w])&&L(t,"nested arrays are not supported inside keys"),typeof y=="object"&&D(y[w])==="[object Object]"&&(y[w]="[object Object]")}if(typeof y=="object"&&D(y)==="[object Object]"&&(y="[object Object]"),y=String(y),v===null&&(v={}),A==="tag:yaml.org,2002:merge")if(Array.isArray(E))for(let w=0,S=E.length;w<S;w+=1)Ee(t,v,E[w],k);else Ee(t,v,E,k);else!t.json&&!o.call(k,y)&&o.call(v,y)&&(t.line=c||t.line,t.lineStart=_||t.lineStart,t.position=x||t.position,L(t,"duplicated mapping key")),ce(v,y,E),delete k[y];return v}function Ze(t){const v=t.input.charCodeAt(t.position);v===10?t.position++:v===13?(t.position++,t.input.charCodeAt(t.position)===10&&t.position++):L(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}function z(t,v,k){let A=0,y=t.input.charCodeAt(t.position);for(;y!==0;){for(;B(y);)y===9&&t.firstTabInLine===-1&&(t.firstTabInLine=t.position),y=t.input.charCodeAt(++t.position);if(v&&y===35)do y=t.input.charCodeAt(++t.position);while(y!==10&&y!==13&&y!==0);if(M(y))for(Ze(t),y=t.input.charCodeAt(t.position),A++,t.lineIndent=0;y===32;)t.lineIndent++,y=t.input.charCodeAt(++t.position);else break}return k!==-1&&A!==0&&t.lineIndent<k&&Je(t,"deficient indentation"),A}function Xe(t){let v=t.position,k=t.input.charCodeAt(v);return!!((k===45||k===46)&&k===t.input.charCodeAt(v+1)&&k===t.input.charCodeAt(v+2)&&(v+=3,k=t.input.charCodeAt(v),k===0||Y(k)))}function me(t,v){v===1?t.result+=" ":v>1&&(t.result+=e.repeat(`
17
- `,v-1))}function Qn(t,v,k){let A,y,E,c,_,x;const w=t.kind,S=t.result;let T=t.input.charCodeAt(t.position);if(Y(T)||ee(T)||T===35||T===38||T===42||T===33||T===124||T===62||T===39||T===34||T===37||T===64||T===96)return!1;if(T===63||T===45){const C=t.input.charCodeAt(t.position+1);if(Y(C)||k&&ee(C))return!1}for(t.kind="scalar",t.result="",A=y=t.position,E=!1;T!==0;){if(T===58){const C=t.input.charCodeAt(t.position+1);if(Y(C)||k&&ee(C))break}else if(T===35){const C=t.input.charCodeAt(t.position-1);if(Y(C))break}else{if(t.position===t.lineStart&&Xe(t)||k&&ee(T))break;if(M(T))if(c=t.line,_=t.lineStart,x=t.lineIndent,z(t,!1,-1),t.lineIndent>=v){E=!0,T=t.input.charCodeAt(t.position);continue}else{t.position=y,t.line=c,t.lineStart=_,t.lineIndent=x;break}}E&&(ae(t,A,y,!1),me(t,t.line-c),A=y=t.position,E=!1),B(T)||(y=t.position+1),T=t.input.charCodeAt(++t.position)}return ae(t,A,y,!1),t.result?!0:(t.kind=w,t.result=S,!1)}function Zn(t,v){let k,A,y=t.input.charCodeAt(t.position);if(y!==39)return!1;for(t.kind="scalar",t.result="",t.position++,k=A=t.position;(y=t.input.charCodeAt(t.position))!==0;)if(y===39)if(ae(t,k,t.position,!0),y=t.input.charCodeAt(++t.position),y===39)k=t.position,t.position++,A=t.position;else return!0;else M(y)?(ae(t,k,A,!0),me(t,z(t,!1,v)),k=A=t.position):t.position===t.lineStart&&Xe(t)?L(t,"unexpected end of the document within a single quoted scalar"):(t.position++,B(y)||(A=t.position));L(t,"unexpected end of the stream within a single quoted scalar")}function yn(t,v){let k,A,y,E=t.input.charCodeAt(t.position);if(E!==34)return!1;for(t.kind="scalar",t.result="",t.position++,k=A=t.position;(E=t.input.charCodeAt(t.position))!==0;){if(E===34)return ae(t,k,t.position,!0),t.position++,!0;if(E===92){if(ae(t,k,t.position,!0),E=t.input.charCodeAt(++t.position),M(E))z(t,!1,v);else if(E<256&&Gn[E])t.result+=mn[E],t.position++;else if((y=Ve(E))>0){let c=y,_=0;for(;c>0;c--)E=t.input.charCodeAt(++t.position),(y=fe(E))>=0?_=(_<<4)+y:L(t,"expected hexadecimal character");t.result+=le(_),t.position++}else L(t,"unknown escape sequence");k=A=t.position}else M(E)?(ae(t,k,A,!0),me(t,z(t,!1,v)),k=A=t.position):t.position===t.lineStart&&Xe(t)?L(t,"unexpected end of the document within a double quoted scalar"):(t.position++,B(E)||(A=t.position))}L(t,"unexpected end of the stream within a double quoted scalar")}function Xn(t,v){let k=!0,A,y,E;const c=t.tag;let _;const x=t.anchor;let w,S,T,C;const I=Object.create(null);let N,$,P,U=t.input.charCodeAt(t.position);if(U===91)w=93,C=!1,_=[];else if(U===123)w=125,C=!0,_={};else return!1;for(t.anchor!==null&&ve(t,t.anchor,_),U=t.input.charCodeAt(++t.position);U!==0;){if(z(t,!0,v),U=t.input.charCodeAt(t.position),U===w)return t.position++,t.tag=c,t.anchor=x,t.kind=C?"mapping":"sequence",t.result=_,!0;if(k?U===44&&L(t,"expected the node content, but found ','"):L(t,"missed comma between flow collection entries"),$=N=P=null,S=T=!1,U===63){const q=t.input.charCodeAt(t.position+1);Y(q)&&(S=T=!0,t.position++,z(t,!0,v))}A=t.line,y=t.lineStart,E=t.position,ye(t,v,a,!1,!0),$=t.tag,N=t.result,z(t,!0,v),U=t.input.charCodeAt(t.position),(T||t.line===A)&&U===58&&(S=!0,U=t.input.charCodeAt(++t.position),z(t,!0,v),ye(t,v,a,!1,!0),P=t.result),C?_e(t,_,I,$,N,P,A,y,E):S?_.push(_e(t,null,I,$,N,P,A,y,E)):_.push(N),z(t,!0,v),U=t.input.charCodeAt(t.position),U===44?(k=!0,U=t.input.charCodeAt(++t.position)):k=!1}L(t,"unexpected end of the stream within a flow collection")}function et(t,v){let k,A=u,y=!1,E=!1,c=v,_=0,x=!1,w,S=t.input.charCodeAt(t.position);if(S===124)k=!1;else if(S===62)k=!0;else return!1;for(t.kind="scalar",t.result="";S!==0;)if(S=t.input.charCodeAt(++t.position),S===43||S===45)u===A?A=S===43?g:h:L(t,"repeat of a chomping mode identifier");else if((w=he(S))>=0)w===0?L(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):E?L(t,"repeat of an indentation width identifier"):(c=v+w-1,E=!0);else break;if(B(S)){do S=t.input.charCodeAt(++t.position);while(B(S));if(S===35)do S=t.input.charCodeAt(++t.position);while(!M(S)&&S!==0)}for(;S!==0;){for(Ze(t),t.lineIndent=0,S=t.input.charCodeAt(t.position);(!E||t.lineIndent<c)&&S===32;)t.lineIndent++,S=t.input.charCodeAt(++t.position);if(!E&&t.lineIndent>c&&(c=t.lineIndent),M(S)){_++;continue}if(!E&&c===0&&L(t,"missing indentation for block scalar"),t.lineIndent<c){A===g?t.result+=e.repeat(`
18
- `,y?1+_:_):A===u&&y&&(t.result+=`
19
- `);break}k?B(S)?(x=!0,t.result+=e.repeat(`
20
- `,y?1+_:_)):x?(x=!1,t.result+=e.repeat(`
21
- `,_+1)):_===0?y&&(t.result+=" "):t.result+=e.repeat(`
22
- `,_):t.result+=e.repeat(`
23
- `,y?1+_:_),y=!0,E=!0,_=0;const T=t.position;for(;!M(S)&&S!==0;)S=t.input.charCodeAt(++t.position);ae(t,T,t.position,!1)}return!0}function ge(t,v){const k=t.tag,A=t.anchor,y=[];let E=!1;if(t.firstTabInLine!==-1)return!1;t.anchor!==null&&ve(t,t.anchor,y);let c=t.input.charCodeAt(t.position);for(;c!==0&&(t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,L(t,"tab characters must not be used in indentation")),c===45);){const _=t.input.charCodeAt(t.position+1);if(!Y(_))break;if(E=!0,t.position++,z(t,!0,-1)&&t.lineIndent<=v){y.push(null),c=t.input.charCodeAt(t.position);continue}const x=t.line;if(ye(t,v,d,!1,!0),y.push(t.result),z(t,!0,-1),c=t.input.charCodeAt(t.position),(t.line===x||t.lineIndent>v)&&c!==0)L(t,"bad indentation of a sequence entry");else if(t.lineIndent<v)break}return E?(t.tag=k,t.anchor=A,t.kind="sequence",t.result=y,!0):!1}function nt(t,v,k){let A,y,E,c;const _=t.tag,x=t.anchor,w={},S=Object.create(null);let T=null,C=null,I=null,N=!1,$=!1;if(t.firstTabInLine!==-1)return!1;t.anchor!==null&&ve(t,t.anchor,w);let P=t.input.charCodeAt(t.position);for(;P!==0;){!N&&t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,L(t,"tab characters must not be used in indentation"));const U=t.input.charCodeAt(t.position+1),q=t.line;if((P===63||P===58)&&Y(U))P===63?(N&&(_e(t,w,S,T,C,null,y,E,c),T=C=I=null),$=!0,N=!0,A=!0):N?(N=!1,A=!0):L(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,P=U;else{if(y=t.line,E=t.lineStart,c=t.position,!ye(t,k,s,!1,!0))break;if(t.line===q){for(P=t.input.charCodeAt(t.position);B(P);)P=t.input.charCodeAt(++t.position);if(P===58)P=t.input.charCodeAt(++t.position),Y(P)||L(t,"a whitespace character is expected after the key-value separator within a block mapping"),N&&(_e(t,w,S,T,C,null,y,E,c),T=C=I=null),$=!0,N=!1,A=!1,T=t.tag,C=t.result;else if($)L(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=_,t.anchor=x,!0}else if($)L(t,"can not read a block mapping entry; a multiline key may not be an implicit key");else return t.tag=_,t.anchor=x,!0}if((t.line===q||t.lineIndent>v)&&(N&&(y=t.line,E=t.lineStart,c=t.position),ye(t,v,f,!0,A)&&(N?C=t.result:I=t.result),N||(_e(t,w,S,T,C,I,y,E,c),T=C=I=null),z(t,!0,-1),P=t.input.charCodeAt(t.position)),(t.line===q||t.lineIndent>v)&&P!==0)L(t,"bad indentation of a mapping entry");else if(t.lineIndent<v)break}return N&&_e(t,w,S,T,C,null,y,E,c),$&&(t.tag=_,t.anchor=x,t.kind="mapping",t.result=w),$}function ui(t){let v=!1,k=!1,A,y,E=t.input.charCodeAt(t.position);if(E!==33)return!1;t.tag!==null&&L(t,"duplication of a tag property"),E=t.input.charCodeAt(++t.position),E===60?(v=!0,E=t.input.charCodeAt(++t.position)):E===33?(k=!0,A="!!",E=t.input.charCodeAt(++t.position)):A="!";let c=t.position;if(v){do E=t.input.charCodeAt(++t.position);while(E!==0&&E!==62);t.position<t.length?(y=t.input.slice(c,t.position),E=t.input.charCodeAt(++t.position)):L(t,"unexpected end of the stream within a verbatim tag")}else{for(;E!==0&&!Y(E);)E===33&&(k?L(t,"tag suffix cannot contain exclamation marks"):(A=t.input.slice(c-1,t.position+1),R.test(A)||L(t,"named tag handle cannot contain such characters"),k=!0,c=t.position+1)),E=t.input.charCodeAt(++t.position);y=t.input.slice(c,t.position),O.test(y)&&L(t,"tag suffix cannot contain flow indicator characters")}y&&!j.test(y)&&L(t,"tag name cannot contain such characters: "+y);try{y=decodeURIComponent(y)}catch{L(t,"tag name is malformed: "+y)}return v?t.tag=y:o.call(t.tagMap,A)?t.tag=t.tagMap[A]+y:A==="!"?t.tag="!"+y:A==="!!"?t.tag="tag:yaml.org,2002:"+y:L(t,'undeclared tag handle "'+A+'"'),!0}function tt(t){let v=t.input.charCodeAt(t.position);if(v!==38)return!1;t.anchor!==null&&L(t,"duplication of an anchor property"),v=t.input.charCodeAt(++t.position);const k=t.position;for(;v!==0&&!Y(v)&&!ee(v);)v=t.input.charCodeAt(++t.position);return t.position===k&&L(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(k,t.position),!0}function it(t){let v=t.input.charCodeAt(t.position);if(v!==42)return!1;v=t.input.charCodeAt(++t.position);const k=t.position;for(;v!==0&&!Y(v)&&!ee(v);)v=t.input.charCodeAt(++t.position);t.position===k&&L(t,"name of an alias node must contain at least one character");const A=t.input.slice(k,t.position);return o.call(t.anchorMap,A)||L(t,'unidentified alias "'+A+'"'),t.result=t.anchorMap[A],z(t,!0,-1),!0}function di(t,v,k,A){const y=gn(t);return ci(t),Qe(t,v),t.tag=null,t.anchor=null,t.kind=null,t.result=null,nt(t,k,A)&&t.kind==="mapping"?($e(t),!0):(si(t),Qe(t,y),!1)}function ye(t,v,k,A,y){let E,c,_=1,x=!1,w=!1,S=null,T,C,I;t.depth>=t.maxDepth&&L(t,"nesting exceeded maxDepth ("+t.maxDepth+")"),t.depth+=1,t.listener!==null&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null;const N=E=c=f===k||d===k;if(A&&z(t,!0,-1)&&(x=!0,t.lineIndent>v?_=1:t.lineIndent===v?_=0:t.lineIndent<v&&(_=-1)),_===1)for(;;){const $=t.input.charCodeAt(t.position),P=gn(t);if(x&&($===33&&t.tag!==null||$===38&&t.anchor!==null)||!ui(t)&&!tt(t))break;S===null&&(S=P),z(t,!0,-1)?(x=!0,c=N,t.lineIndent>v?_=1:t.lineIndent===v?_=0:t.lineIndent<v&&(_=-1)):c=!1}if(c&&(c=x||y),_===1||f===k)if(a===k||s===k?C=v:C=v+1,I=t.position-t.lineStart,_===1)if(c&&(ge(t,I)||nt(t,I,C))||Xn(t,C))w=!0;else{const $=t.input.charCodeAt(t.position);S!==null&&N&&!c&&$!==124&&$!==62&&di(t,S,S.position-S.lineStart,C)||E&&et(t,C)||Zn(t,C)||yn(t,C)?w=!0:it(t)?(w=!0,(t.tag!==null||t.anchor!==null)&&L(t,"alias node should not have any properties")):Qn(t,C,a===k)&&(w=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&ve(t,t.anchor,t.result)}else _===0&&(w=c&&ge(t,I));if(t.tag===null)t.anchor!==null&&ve(t,t.anchor,t.result);else if(t.tag==="?"){t.result!==null&&t.kind!=="scalar"&&L(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"');for(let $=0,P=t.implicitTypes.length;$<P;$+=1)if(T=t.implicitTypes[$],T.resolve(t.result)){t.result=T.construct(t.result),t.tag=T.tag,t.anchor!==null&&ve(t,t.anchor,t.result);break}}else if(t.tag!=="!"){if(o.call(t.typeMap[t.kind||"fallback"],t.tag))T=t.typeMap[t.kind||"fallback"][t.tag];else{T=null;const $=t.typeMap.multi[t.kind||"fallback"];for(let P=0,U=$.length;P<U;P+=1)if(t.tag.slice(0,$[P].tag.length)===$[P].tag){T=$[P];break}}T||L(t,"unknown tag !<"+t.tag+">"),t.result!==null&&T.kind!==t.kind&&L(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+T.kind+'", not "'+t.kind+'"'),T.resolve(t.result,t.tag)?(t.result=T.construct(t.result,t.tag),t.anchor!==null&&ve(t,t.anchor,t.result)):L(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return t.listener!==null&&t.listener("close",t),t.depth-=1,t.tag!==null||t.anchor!==null||w}function fi(t){const v=t.position;let k=!1,A;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);(A=t.input.charCodeAt(t.position))!==0&&(z(t,!0,-1),A=t.input.charCodeAt(t.position),!(t.lineIndent>0||A!==37));){k=!0,A=t.input.charCodeAt(++t.position);let y=t.position;for(;A!==0&&!Y(A);)A=t.input.charCodeAt(++t.position);const E=t.input.slice(y,t.position),c=[];for(E.length<1&&L(t,"directive name must not be less than one character in length");A!==0;){for(;B(A);)A=t.input.charCodeAt(++t.position);if(A===35){do A=t.input.charCodeAt(++t.position);while(A!==0&&!M(A));break}if(M(A))break;for(y=t.position;A!==0&&!Y(A);)A=t.input.charCodeAt(++t.position);c.push(t.input.slice(y,t.position))}A!==0&&Ze(t),o.call(Jn,E)?Jn[E](t,E,c):Je(t,'unknown document directive "'+E+'"')}if(z(t,!0,-1),t.lineIndent===0&&t.input.charCodeAt(t.position)===45&&t.input.charCodeAt(t.position+1)===45&&t.input.charCodeAt(t.position+2)===45?(t.position+=3,z(t,!0,-1)):k&&L(t,"directives end mark is expected"),ye(t,t.lineIndent-1,f,!1,!0),z(t,!0,-1),t.checkLineBreaks&&b.test(t.input.slice(v,t.position))&&Je(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&Xe(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,z(t,!0,-1));return}t.position<t.length-1&&L(t,"end of the stream or a document separator is expected")}function rt(t,v){t=String(t),v=v||{},t.length!==0&&(t.charCodeAt(t.length-1)!==10&&t.charCodeAt(t.length-1)!==13&&(t+=`
24
- `),t.charCodeAt(0)===65279&&(t=t.slice(1)));const k=new Z(t,v),A=t.indexOf("\0");for(A!==-1&&(k.position=A,L(k,"null byte is not allowed in input")),k.input+="\0";k.input.charCodeAt(k.position)===32;)k.lineIndent+=1,k.position+=1;for(;k.position<k.length-1;)fi(k);return k.documents}function lt(t,v,k){v!==null&&typeof v=="object"&&typeof k>"u"&&(k=v,v=null);const A=rt(t,k);if(typeof v!="function")return A;for(let y=0,E=A.length;y<E;y+=1)v(A[y])}function hi(t,v){const k=rt(t,v);if(k.length!==0){if(k.length===1)return k[0];throw new n("expected a single document in the stream, but found more")}}return st.loadAll=lt,st.load=hi,st}var ji={},Cl;function ic(){if(Cl)return ji;Cl=1;const e=Wn(),n=Yn(),i=kr(),l=Object.prototype.toString,o=Object.prototype.hasOwnProperty,a=65279,s=9,d=10,f=13,u=32,h=33,g=34,p=35,b=37,O=38,R=39,j=42,D=44,M=45,B=58,Y=61,ee=62,fe=63,Ve=64,he=91,pe=93,le=96,ce=123,Gn=124,mn=125,Z={};Z[0]="\\0",Z[7]="\\a",Z[8]="\\b",Z[9]="\\t",Z[10]="\\n",Z[11]="\\v",Z[12]="\\f",Z[13]="\\r",Z[27]="\\e",Z[34]='\\"',Z[92]="\\\\",Z[133]="\\N",Z[160]="\\_",Z[8232]="\\L",Z[8233]="\\P";const Vn=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],L=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Je(c,_){if(_===null)return{};const x={},w=Object.keys(_);for(let S=0,T=w.length;S<T;S+=1){let C=w[S],I=String(_[C]);C.slice(0,2)==="!!"&&(C="tag:yaml.org,2002:"+C.slice(2));const N=c.compiledTypeMap.fallback[C];N&&o.call(N.styleAliases,I)&&(I=N.styleAliases[I]),x[C]=I}return x}function ve(c){let _,x;const w=c.toString(16).toUpperCase();if(c<=255)_="x",x=2;else if(c<=65535)_="u",x=4;else if(c<=4294967295)_="U",x=8;else throw new n("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+_+e.repeat("0",x-w.length)+w}const ci=1,$e=2;function si(c){this.schema=c.schema||i,this.indent=Math.max(1,c.indent||2),this.noArrayIndent=c.noArrayIndent||!1,this.skipInvalid=c.skipInvalid||!1,this.flowLevel=e.isNothing(c.flowLevel)?-1:c.flowLevel,this.styleMap=Je(this.schema,c.styles||null),this.sortKeys=c.sortKeys||!1,this.lineWidth=c.lineWidth||80,this.noRefs=c.noRefs||!1,this.noCompatMode=c.noCompatMode||!1,this.condenseFlow=c.condenseFlow||!1,this.quotingType=c.quotingType==='"'?$e:ci,this.forceQuotes=c.forceQuotes||!1,this.replacer=typeof c.replacer=="function"?c.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function gn(c,_){const x=e.repeat(" ",_);let w=0,S="";const T=c.length;for(;w<T;){let C;const I=c.indexOf(`
25
- `,w);I===-1?(C=c.slice(w),w=T):(C=c.slice(w,I+1),w=I+1),C.length&&C!==`
26
- `&&(S+=x),S+=C}return S}function Qe(c,_){return`
27
- `+e.repeat(" ",c.indent*_)}function Jn(c,_){for(let x=0,w=c.implicitTypes.length;x<w;x+=1)if(c.implicitTypes[x].resolve(_))return!0;return!1}function ae(c){return c===u||c===s}function Ee(c){return c>=32&&c<=126||c>=161&&c<=55295&&c!==8232&&c!==8233||c>=57344&&c<=65533&&c!==a||c>=65536&&c<=1114111}function _e(c){return Ee(c)&&c!==a&&c!==f&&c!==d}function Ze(c,_,x){const w=_e(c),S=w&&!ae(c);return(x?w:w&&c!==D&&c!==he&&c!==pe&&c!==ce&&c!==mn)&&c!==p&&!(_===B&&!S)||_e(_)&&!ae(_)&&c===p||_===B&&S}function z(c){return Ee(c)&&c!==a&&!ae(c)&&c!==M&&c!==fe&&c!==B&&c!==D&&c!==he&&c!==pe&&c!==ce&&c!==mn&&c!==p&&c!==O&&c!==j&&c!==h&&c!==Gn&&c!==Y&&c!==ee&&c!==R&&c!==g&&c!==b&&c!==Ve&&c!==le}function Xe(c){return!ae(c)&&c!==B}function me(c,_){const x=c.charCodeAt(_);let w;return x>=55296&&x<=56319&&_+1<c.length&&(w=c.charCodeAt(_+1),w>=56320&&w<=57343)?(x-55296)*1024+w-56320+65536:x}function Qn(c){return/^\n* /.test(c)}const Zn=1,yn=2,Xn=3,et=4,ge=5;function nt(c,_,x,w,S,T,C,I){let N,$=0,P=null,U=!1,q=!1;const Fr=w!==-1;let bn=-1,kn=z(me(c,0))&&Xe(me(c,c.length-1));if(_||C)for(N=0;N<c.length;$>=65536?N+=2:N++){if($=me(c,N),!Ee($))return ge;kn=kn&&Ze($,P,I),P=$}else{for(N=0;N<c.length;$>=65536?N+=2:N++){if($=me(c,N),$===d)U=!0,Fr&&(q=q||N-bn-1>w&&c[bn+1]!==" ",bn=N);else if(!Ee($))return ge;kn=kn&&Ze($,P,I),P=$}q=q||Fr&&N-bn-1>w&&c[bn+1]!==" "}return!U&&!q?kn&&!C&&!S(c)?Zn:T===$e?ge:yn:x>9&&Qn(c)?ge:C?T===$e?ge:yn:q?et:Xn}function ui(c,_,x,w,S){c.dump=function(){if(_.length===0)return c.quotingType===$e?'""':"''";if(!c.noCompatMode&&(Vn.indexOf(_)!==-1||L.test(_)))return c.quotingType===$e?'"'+_+'"':"'"+_+"'";const T=c.indent*Math.max(1,x),C=c.lineWidth===-1?-1:Math.max(Math.min(c.lineWidth,40),c.lineWidth-T),I=w||c.flowLevel>-1&&x>=c.flowLevel;function N($){return Jn(c,$)}switch(nt(_,I,c.indent,C,N,c.quotingType,c.forceQuotes&&!w,S)){case Zn:return _;case yn:return"'"+_.replace(/'/g,"''")+"'";case Xn:return"|"+tt(_,c.indent)+it(gn(_,T));case et:return">"+tt(_,c.indent)+it(gn(di(_,C),T));case ge:return'"'+fi(_)+'"';default:throw new n("impossible error: invalid scalar style")}}()}function tt(c,_){const x=Qn(c)?String(_):"",w=c[c.length-1]===`
28
- `,T=w&&(c[c.length-2]===`
29
- `||c===`
30
- `)?"+":w?"":"-";return x+T+`
31
- `}function it(c){return c[c.length-1]===`
32
- `?c.slice(0,-1):c}function di(c,_){const x=/(\n+)([^\n]*)/g;let w=function(){let I=c.indexOf(`
33
- `);return I=I!==-1?I:c.length,x.lastIndex=I,ye(c.slice(0,I),_)}(),S=c[0]===`
34
- `||c[0]===" ",T,C;for(;C=x.exec(c);){const I=C[1],N=C[2];T=N[0]===" ",w+=I+(!S&&!T&&N!==""?`
35
- `:"")+ye(N,_),S=T}return w}function ye(c,_){if(c===""||c[0]===" ")return c;const x=/ [^ ]/g;let w,S=0,T,C=0,I=0,N="";for(;w=x.exec(c);)I=w.index,I-S>_&&(T=C>S?C:I,N+=`
36
- `+c.slice(S,T),S=T+1),C=I;return N+=`
37
- `,c.length-S>_&&C>S?N+=c.slice(S,C)+`
38
- `+c.slice(C+1):N+=c.slice(S),N.slice(1)}function fi(c){let _="",x=0;for(let w=0;w<c.length;x>=65536?w+=2:w++){x=me(c,w);const S=Z[x];!S&&Ee(x)?(_+=c[w],x>=65536&&(_+=c[w+1])):_+=S||ve(x)}return _}function rt(c,_,x){let w="";const S=c.tag;for(let T=0,C=x.length;T<C;T+=1){let I=x[T];c.replacer&&(I=c.replacer.call(x,String(T),I)),(k(c,_,I,!1,!1)||typeof I>"u"&&k(c,_,null,!1,!1))&&(w!==""&&(w+=","+(c.condenseFlow?"":" ")),w+=c.dump)}c.tag=S,c.dump="["+w+"]"}function lt(c,_,x,w){let S="";const T=c.tag;for(let C=0,I=x.length;C<I;C+=1){let N=x[C];c.replacer&&(N=c.replacer.call(x,String(C),N)),(k(c,_+1,N,!0,!0,!1,!0)||typeof N>"u"&&k(c,_+1,null,!0,!0,!1,!0))&&((!w||S!=="")&&(S+=Qe(c,_)),c.dump&&d===c.dump.charCodeAt(0)?S+="-":S+="- ",S+=c.dump)}c.tag=T,c.dump=S||"[]"}function hi(c,_,x){let w="";const S=c.tag,T=Object.keys(x);for(let C=0,I=T.length;C<I;C+=1){let N="";w!==""&&(N+=", "),c.condenseFlow&&(N+='"');const $=T[C];let P=x[$];c.replacer&&(P=c.replacer.call(x,$,P)),k(c,_,$,!1,!1)&&(c.dump.length>1024&&(N+="? "),N+=c.dump+(c.condenseFlow?'"':"")+":"+(c.condenseFlow?"":" "),k(c,_,P,!1,!1)&&(N+=c.dump,w+=N))}c.tag=S,c.dump="{"+w+"}"}function t(c,_,x,w){let S="";const T=c.tag,C=Object.keys(x);if(c.sortKeys===!0)C.sort();else if(typeof c.sortKeys=="function")C.sort(c.sortKeys);else if(c.sortKeys)throw new n("sortKeys must be a boolean or a function");for(let I=0,N=C.length;I<N;I+=1){let $="";(!w||S!=="")&&($+=Qe(c,_));const P=C[I];let U=x[P];if(c.replacer&&(U=c.replacer.call(x,P,U)),!k(c,_+1,P,!0,!0,!0))continue;const q=c.tag!==null&&c.tag!=="?"||c.dump&&c.dump.length>1024;q&&(c.dump&&d===c.dump.charCodeAt(0)?$+="?":$+="? "),$+=c.dump,q&&($+=Qe(c,_)),k(c,_+1,U,!0,q)&&(c.dump&&d===c.dump.charCodeAt(0)?$+=":":$+=": ",$+=c.dump,S+=$)}c.tag=T,c.dump=S||"{}"}function v(c,_,x){const w=x?c.explicitTypes:c.implicitTypes;for(let S=0,T=w.length;S<T;S+=1){const C=w[S];if((C.instanceOf||C.predicate)&&(!C.instanceOf||typeof _=="object"&&_ instanceof C.instanceOf)&&(!C.predicate||C.predicate(_))){if(x?C.multi&&C.representName?c.tag=C.representName(_):c.tag=C.tag:c.tag="?",C.represent){const I=c.styleMap[C.tag]||C.defaultStyle;let N;if(l.call(C.represent)==="[object Function]")N=C.represent(_,I);else if(o.call(C.represent,I))N=C.represent[I](_,I);else throw new n("!<"+C.tag+'> tag resolver accepts not "'+I+'" style');c.dump=N}return!0}}return!1}function k(c,_,x,w,S,T,C){c.tag=null,c.dump=x,v(c,x,!1)||v(c,x,!0);const I=l.call(c.dump),N=w;w&&(w=c.flowLevel<0||c.flowLevel>_);const $=I==="[object Object]"||I==="[object Array]";let P,U;if($&&(P=c.duplicates.indexOf(x),U=P!==-1),(c.tag!==null&&c.tag!=="?"||U||c.indent!==2&&_>0)&&(S=!1),U&&c.usedDuplicates[P])c.dump="*ref_"+P;else{if($&&U&&!c.usedDuplicates[P]&&(c.usedDuplicates[P]=!0),I==="[object Object]")w&&Object.keys(c.dump).length!==0?(t(c,_,c.dump,S),U&&(c.dump="&ref_"+P+c.dump)):(hi(c,_,c.dump),U&&(c.dump="&ref_"+P+" "+c.dump));else if(I==="[object Array]")w&&c.dump.length!==0?(c.noArrayIndent&&!C&&_>0?lt(c,_-1,c.dump,S):lt(c,_,c.dump,S),U&&(c.dump="&ref_"+P+c.dump)):(rt(c,_,c.dump),U&&(c.dump="&ref_"+P+" "+c.dump));else if(I==="[object String]")c.tag!=="?"&&ui(c,c.dump,_,T,N);else{if(I==="[object Undefined]")return!1;if(c.skipInvalid)return!1;throw new n("unacceptable kind of an object to dump "+I)}if(c.tag!==null&&c.tag!=="?"){let q=encodeURI(c.tag[0]==="!"?c.tag.slice(1):c.tag).replace(/!/g,"%21");c.tag[0]==="!"?q="!"+q:q.slice(0,18)==="tag:yaml.org,2002:"?q="!!"+q.slice(18):q="!<"+q+">",c.dump=q+" "+c.dump}}return!0}function A(c,_){const x=[],w=[];y(c,x,w);const S=w.length;for(let T=0;T<S;T+=1)_.duplicates.push(x[w[T]]);_.usedDuplicates=new Array(S)}function y(c,_,x){if(c!==null&&typeof c=="object"){const w=_.indexOf(c);if(w!==-1)x.indexOf(w)===-1&&x.push(w);else if(_.push(c),Array.isArray(c))for(let S=0,T=c.length;S<T;S+=1)y(c[S],_,x);else{const S=Object.keys(c);for(let T=0,C=S.length;T<C;T+=1)y(c[S[T]],_,x)}}}function E(c,_){_=_||{};const x=new si(_);x.noRefs||A(c,x);let w=c;return x.replacer&&(w=x.replacer.call({"":w},"",w)),k(x,0,w,!0,!0)?x.dump+`
39
- `:""}return ji.dump=E,ji}var xl;function rc(){if(xl)return ne;xl=1;const e=tc(),n=ic();function i(l,o){return function(){throw new Error("Function yaml."+l+" is removed in js-yaml 4. Use yaml."+o+" instead, which is now safe by default.")}}return ne.Type=re(),ne.Schema=ga(),ne.FAILSAFE_SCHEMA=wa(),ne.JSON_SCHEMA=Ta(),ne.CORE_SCHEMA=Ea(),ne.DEFAULT_SCHEMA=kr(),ne.load=e.load,ne.loadAll=e.loadAll,ne.dump=n.dump,ne.YAMLException=Yn(),ne.types={binary:Ia(),float:xa(),map:ka(),null:Sa(),pairs:La(),set:$a(),timestamp:Oa(),bool:Aa(),int:Ca(),merge:Na(),omap:Ra(),seq:ba(),str:ya()},ne.safeLoad=i("safeLoad","load"),ne.safeLoadAll=i("safeLoadAll","loadAll"),ne.safeDump=i("safeDump","dump"),ne}var lc=rc();const Pa=ec(lc),{Type:ou,Schema:cu,FAILSAFE_SCHEMA:su,JSON_SCHEMA:uu,CORE_SCHEMA:du,DEFAULT_SCHEMA:fu,load:hu,loadAll:pu,dump:vu,YAMLException:_u,types:mu,safeLoad:gu,safeLoadAll:yu,safeDump:bu}=Pa;function ac(e){if(e.trim()==="")return{};const i=Pa.load(e);if(i==null)return{};if(typeof i!="object"||Array.isArray(i))throw new Error(".agent-user.yml must parse to an object");return i}const Tl={id:"welcome",title:"Welcome — who are you?",navLabel:"You",subtitle:"Your name and language. Stored in .agent-user.yml; we pre-fill what we can detect.",kind:"welcome"},El={id:"profile",title:"Which experience?",navLabel:"Experience",subtitle:"Pick the experience that fits you — developer · content · founder · agency · finance · ops. It selects your default command/skill surface and persona pre-selection. Cost tier is a secondary knob on a later step. You can switch later with `agent-config use --profile=<id>`.",kind:"form",paths:["profile.id"]},oc=[{id:"ai-tools",title:"Which AI tools do you use?",navLabel:"AI tools",subtitle:"Pick the editors and CLIs that should pick up this config. Auto-detect runs first; you can override.",kind:"aiTools"},{id:"roles",title:"What do you work on?",navLabel:"Roles",subtitle:"Pick the areas you work in. We use them to recommend capability packs on the next step, and they become your roles in .agent-user.yml.",kind:"roles"},{id:"packs",title:"Which capability packs do you want?",navLabel:"Packs",subtitle:"Founder-strategy, finance-basic, gtm-sales, ops-people, ai-video — pick zero or more. You can change this later.",kind:"packs"},{id:"legal-consent",title:"Legal review-prep — not legal advice",navLabel:"Legal consent",subtitle:"Only relevant if you picked the legal-review-prep pack. It provides templates and general information, never legal advice — check the box to acknowledge before it activates. Leave unchecked otherwise; the pack stays inactive.",kind:"form",paths:["legal_review_prep.acknowledged"]}],Ol=[{id:"identity",title:"Editor & behaviour",navLabel:"Preferences",subtitle:"Your IDE plus how the agent behaves: autonomy, output verbosity, PR-comment style. rtk presence is auto-detected (see the rtk row). Your name lives in .agent-user.yml (later step).",kind:"form",paths:["personal.ide","personal.open_edited_files","personal.autonomy","personal.minimal_output","personal.play_by_play","personal.pr_comment_bot_icon"]},{id:"cost",title:"Budgets, rules & cadence",navLabel:"Budgets & cadence",subtitle:"Independent levers: rule_loading_tier (how many behavioural rules load — token footprint), cost.budgets (optional USD ceilings), model.auto_switch (per-skill model tier), plus quality/roadmap cadence and memory thresholds.",kind:"form",paths:["rule_loading_tier","cost.budgets.daily","cost.budgets.weekly","cost.budgets.monthly","cost.enforcement","model.auto_switch","tokens.rich_skills","roadmap.quality_cadence","roadmap.dashboard_regen_cadence","quality.local_auto_run","quality.wait_for_remote_ci","memory.review_threshold","memory.redact_patterns"]},{id:"user-md",title:"Your .agent-user.yml",navLabel:"User profile",subtitle:"Identity, voice, preferences. Stored at agents/settings/.agent-user.yml. Skip to leave empty.",kind:"userMd"},{id:"review",title:"Review & finish",navLabel:"Review",subtitle:"These keys will change. Confirm to write .agent-settings.yml and .agent-user.yml atomically.",kind:"review"}];function Ma(e={}){return e.extended===!0?[Tl,El,...oc,...Ol]:[Tl,El,...Ol]}function Zt(e,n={}){const i=Ma(n),l=Math.max(0,Math.min(i.length-1,e));return i[l]}function cc(e){const n={},i=l=>{n[l]=!0;const o=e.clusterOf.get(l);o!==void 0&&(n[o]=!0)};for(const l of e.installed)i(l);for(const l of e.roleDefaults)i(l);for(const l of e.detected)i(l);return n}function sc(e,n){const i=new Set(n);return e.filter(l=>l!=="engineering-base"&&!i.has(l)).sort()}function uc(e,n){const i={type:"object",properties:{},...e.description!==void 0?{description:e.description}:{}},l=i.properties,o=e.properties??{};for(const a of n){const s=a.split(".").filter(B=>B.length>0);if(s.length===0)continue;const[d,f,u]=s;if(d===void 0)continue;const h=o[d];if(h===void 0)continue;if(f===void 0){l[d]=h;continue}const g=h.properties?.[f];if(g===void 0)continue;const b=l[d]??{type:"object",properties:{},...h.description!==void 0?{description:h.description}:{}},O=b.properties??={};if(u===void 0){O[f]=g,l[d]=b;continue}const R=g.properties?.[u];if(R===void 0)continue;const D=O[f]??{type:"object",properties:{},...g.description!==void 0?{description:g.description}:{}},M=D.properties??={};M[u]=R,O[f]=D,l[d]=b}return i}function dc({current:e,total:n}){const i=Math.max(1,n),l=Math.max(0,Math.min(i-1,e)),o=Array.from({length:i},(s,d)=>d<=l),a=Math.round((l+1)/i*100);return r("div",{class:"ac-wizard__progress",role:"progressbar","aria-valuenow":l+1,"aria-valuemin":1,"aria-valuemax":i,"aria-valuetext":`Step ${l+1} of ${i} (${a}%)`,children:o.map((s,d)=>r("span",{class:`ac-wizard__progress-segment${s?" ac-wizard__progress-segment--filled":""}`,"aria-hidden":"true"},d))})}function fc({step:e,index:n,total:i}){return r("header",{class:"ac-page__header ac-wizard__header",children:[r("p",{class:"ac-wizard__step-count",children:["Step ",n+1," of ",i]}),r("div",{class:"ac-wizard__header-text",children:[r("h1",{children:e.title}),r("p",{class:"ac-wizard__subtitle",children:e.subtitle})]}),r(dc,{current:n,total:i})]})}function hc(e){const n=e.canFinish??!0,i=e.completed??!1;return r("div",{class:"ac-form__actions ac-wizard__nav",children:[r("button",{type:"button",class:"ac-button",disabled:!e.canGoPrev||e.busy,onClick:e.onPrev,children:"Back"}),e.canSkip&&e.onSkip!==void 0?r("button",{type:"button",class:"ac-button ac-wizard__skip",disabled:e.busy,onClick:e.onSkip,children:e.skipLabel??"Skip"}):null,e.isLast?i?null:r("button",{type:"button",class:"ac-button ac-button--primary",disabled:e.busy||!n,onClick:e.onFinish,children:e.busy?"Saving…":"Finish & save"}):r("button",{type:"button",class:"ac-button ac-button--primary",disabled:!e.canGoNext||e.busy,onClick:e.onNext,children:e.nextLabel??"Next"})]})}function Fa(e,n){return e.kind!=="form"||e.paths===void 0?!1:!!(e.paths.includes(n)||e.id==="cost"&&(n.startsWith("telegraph.")||n.startsWith("verbosity.")))}function pc(e,n){return e.kind==="userMd"?n==="body"||n.startsWith("body."):Fa(e,n)}function vc(e,n){for(const i of Object.keys(n.errors))if(pc(e,i))return!0;return!1}function _c(e,n){if(vc(e,n))return{label:"needs attention",tone:"error"};if(e.kind==="userMd")return n.userMdChanged?{label:n.userMdAction==="create"?"will create":"will replace",tone:"changed"}:{label:"",tone:"idle"};if(e.kind==="form"){const i=n.changes.filter(l=>Fa(e,l.path)).length;return i===0?{label:"",tone:"idle"}:{label:`${i} change${i===1?"":"s"}`,tone:"changed"}}if(e.kind==="aiTools"){const i=n.selectedToolsCount??0;return i===0?{label:"",tone:"idle"}:{label:`${i} tool${i===1?"":"s"}`,tone:"changed"}}if(e.kind==="packs"){const i=n.selectedPacksCount??0;return i===0?{label:"",tone:"idle"}:{label:`${i} pack${i===1?"":"s"}`,tone:"changed"}}return{label:"",tone:"idle"}}function mc(e){const n=e.steps.filter((d,f)=>f!==e.currentIndex),i=e.packRemovals??[],l=e.selectedToolIds??[],o=e.packAdditions??[],a=e.changes.length,s=l.length>0||o.length>0||a>0||e.userMdChanged;return r(te,{children:[s?r("section",{class:"ac-review-summary","aria-label":"What happens on Finish",children:[r("h2",{class:"ac-review-summary__title",children:"What happens on Finish"}),r("ul",{class:"ac-review-summary__list",children:[a>0?r("li",{children:[r("strong",{children:a})," setting",a===1?"":"s"," will change"," ","in ",r("code",{children:".agent-settings.yml"}),"."]}):r("li",{children:"No settings change."}),e.userMdChanged?r("li",{children:[r("code",{children:".agent-user.yml"})," will be"," ",e.userMdAction==="create"?"created":"updated","."]}):null,l.length>0?r("li",{children:["Config is installed for ",l.length," tool",l.length===1?"":"s",":",r("span",{class:"ac-review-summary__chips",children:l.map(d=>r("code",{class:"ac-review-summary__chip",children:d},d))})]}):null,o.length>0?r("li",{children:["New pack",o.length===1?"":"s",":",r("span",{class:"ac-review-summary__chips",children:o.map(d=>r("code",{class:"ac-review-summary__chip",children:d},d))})]}):null]})]}):null,i.length>0?r("div",{class:"ac-review-removals",role:"alert",children:[r("p",{class:"ac-review-removals__title",children:["⚠️ ",i.length===1?"1 installed pack will be removed":`${i.length} installed packs will be removed`]}),r("ul",{class:"ac-review-removals__list",children:i.map(d=>r("li",{children:r("code",{children:d})},d))}),r("label",{class:"ac-review-removals__confirm",children:[r("input",{type:"checkbox",checked:e.removalsConfirmed??!1,onChange:d=>{e.onConfirmRemovals?.(d.currentTarget.checked)}}),r("span",{children:"I understand these packs will no longer be installed. Re-check them on the packs step to keep them."})]})]}):null,r("nav",{class:"ac-wizard__review-nav","aria-label":"Jump back to a step",children:[r("p",{class:"ac-wizard__review-nav-label",children:"Jump back to a step:"}),r("ul",{class:"ac-wizard__review-nav-list",children:n.map(d=>{const f=e.steps.indexOf(d),u=_c(d,e),h=u.tone==="error"?"ac-wizard__review-nav-button ac-wizard__review-nav-button--error":"ac-wizard__review-nav-button";return r("li",{children:r("button",{type:"button",class:h,onClick:()=>{e.onJump(f)},children:[r("span",{class:"ac-wizard__review-nav-index",children:f+1}),r("span",{class:"ac-wizard__review-nav-text",children:d.navLabel}),u.label!==""?r("span",{class:`ac-wizard__review-nav-status ac-wizard__review-nav-status--${u.tone}`,children:u.label}):null]})},d.id)})})]})]})}function gc(e){const n=e.abortedAt??"unknown time",i=e.abortNote??"no further detail recorded",l=e.writesSinceRollback;return r("aside",{class:"ac-banner ac-banner--recovery",role:"alert",children:[r("strong",{children:"Previous install was interrupted."}),r("p",{children:["Aborted at ",r("code",{children:n})," — ",i,". ",l," write",l===1?"":"s"," landed before the abort marker."]}),r("p",{children:"Pick how to recover before continuing. Resume reopens the wizard fresh, Rollback discards the abort state, Ignore hides this banner without touching the log."}),r("div",{class:"ac-banner__actions",children:[r("button",{type:"button",disabled:e.busy,onClick:()=>e.onResume(),children:"Resume install"}),r("button",{type:"button",disabled:e.busy,onClick:()=>e.onRollback(),children:"Rollback"}),r("button",{type:"button",disabled:e.busy,onClick:()=>e.onIgnore(),children:"Ignore"})]})]})}function yc(){return r("section",{class:"ac-continue-screen","aria-labelledby":"ac-continue-title",children:[r("h2",{id:"ac-continue-title",children:"Install complete — continue with setup?"}),r("p",{children:"Your install selections (AI tools, roles, capability packs) are captured. Use the footer to continue:"}),r("ul",{children:[r("li",{children:[r("strong",{children:"Next"})," — go through the remaining personalisation steps: editor + tooling, personality, cost profile, roadmap & quality, memory, your",r("code",{children:" .agent-user.yml"}),", and finally the project module roots."]}),r("li",{children:[r("strong",{children:"Finish install here"})," — skip the rest and write ",r("code",{children:".agent-settings.yml"})," with the install-only selections. You can re-run ",r("code",{children:"agent-config setup"}),"later to pick up the personalisation steps."]})]})]})}function bc(e){const n=e.version??"unknown";return r("section",{class:"ac-backup-screen","aria-labelledby":"ac-backup-title",children:[r("h2",{id:"ac-backup-title",children:"Existing v3 install detected"}),r("p",{children:["Found a v3.x install at ",r("code",{children:e.sourcePath})," ","(VERSION: ",r("code",{children:n}),"). v4 is a hard-cut release with no auto-migration — settings, identity, and history layouts changed. The wizard can back up the v3 tree before writing the v4 layout so you can roll back manually if needed."]}),e.error!==null?r("p",{class:"ac-banner ac-banner--error",children:["Backup failed: ",e.error]}):null,r("ul",{children:[r("li",{children:[r("strong",{children:"Backup v3 and proceed"})," — copies the tree to ",r("code",{children:e.backupTarget}),", then runs the v4 install. Restore later with",r("code",{children:[" mv ",e.backupTarget," ",e.sourcePath]}),"."]}),r("li",{children:[r("strong",{children:"Abort, uninstall v3 first"})," — closes the wizard. You decide what to keep."]})]}),r("div",{class:"ac-backup-screen__actions",children:[r("button",{type:"button",class:"ac-button ac-button--primary",disabled:e.busy,onClick:()=>e.onBackupAndProceed(),children:e.busy?"Backing up…":"Backup v3 and proceed"}),r("button",{type:"button",class:"ac-button",disabled:e.busy,onClick:()=>e.onAbort(),children:"Abort, uninstall v3 first"})]})]})}const kc=[{title:"Restart your AI tools",detail:"Editors and CLIs pick up the new skills, rules, and commands on their next start."},{title:"Verify the installation",detail:"A read-only health report — scope, deployed files, drift.",command:"agent-config doctor"},{title:"Tune your settings any time",detail:"Opens the configuration GUI (global settings; --project for a project).",command:"agent-config config"},{title:"Initialize a project",detail:"Adds the minimal agents/ bridge + .gitignore block to a repository.",command:"agent-config init --project"},{title:"Stay up to date",detail:"Upgrades the global install and additively syncs your settings.",command:"agent-config upgrade"}];function wc({text:e}){const[n,i]=yr(!1);return r("button",{type:"button",class:"ac-button ac-checklist__copy",onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{i(!0),setTimeout(()=>{i(!1)},1500)})},children:n?"Copied ✓":"Copy"})}function Sc({message:e}){return r("div",{class:"ac-checklist",children:[r("div",{class:"ac-checklist__hero",children:[r("h2",{class:"ac-checklist__headline",children:"Setup complete"}),e!==null?r("p",{class:"ac-checklist__message",children:e}):null]}),r("ol",{class:"ac-checklist__items",children:kc.map(n=>r("li",{class:"ac-checklist__item",children:[r("div",{class:"ac-checklist__text",children:[r("span",{class:"ac-checklist__item-title",children:n.title}),r("span",{class:"ac-checklist__item-detail",children:n.detail})]}),n.command!==void 0?r("div",{class:"ac-checklist__cmd-row",children:[r("code",{class:"ac-checklist__cmd",children:n.command}),r(wc,{text:n.command})]}):null]},n.title))}),r("p",{class:"ac-checklist__close-hint",children:"You can close this browser window — the local server shuts down on its own."})]})}const ja=m(!1),xn=m(null),K=m(null),Nt=m(!1),It=m(!1),qe=m(0),wr=m(null),ue=m({}),Da=m({}),Ua=m(0),cn=m({}),Q=m(null),Me=m(null),Sr=m(!1),Ki=m(!1),Xt=m(!1),Ba=m({}),ei=m([]);m("global");const rn=m(!1),ie=m(!1),Ac=m(!1),Rt=m(!1),Lt=m(null),Ar=m([]),$t=m({}),Pt=m(!0),Mt=m(""),Ft=m("agents");m(!1);const Ha=m(null),Cc=[{id:"claude-code",label:"Claude Code"},{id:"claude-desktop",label:"Claude Desktop"},{id:"cursor",label:"Cursor"},{id:"windsurf",label:"Windsurf"},{id:"cline",label:"Cline"},{id:"gemini-cli",label:"Gemini CLI"},{id:"copilot",label:"GitHub Copilot"},{id:"augment",label:"Augment"},{id:"aider",label:"Aider"},{id:"codex",label:"Codex"},{id:"roocode",label:"Roo Code"},{id:"continue",label:"Continue"},{id:"kilocode",label:"Kilo Code"},{id:"zed",label:"Zed"},{id:"jetbrains",label:"JetBrains"},{id:"kiro",label:"Kiro"},{id:"qoder",label:"Qoder"},{id:"opencode",label:"OpenCode"},{id:"trae",label:"Trae"},{id:"antigravity",label:"Antigravity"},{id:"codebuddy",label:"CodeBuddy"},{id:"droid",label:"Droid"},{id:"warp",label:"Warp"}],Gi=m(!1),sn=m(!1),Fe=m(null),ni=m([]),ti=m([]),We=m([]),Vi=m(!1),zn=m([]),Ae=m({}),qa=m(!1),Ji=m(!1),pt=m(!1),Cr=m({}),Nl=m(!1),Wa=m(null),Ya=m(null),za=m(null),Ka=m(null),Qi=m(null),Ga=m(null),Zi=m("https://github.com/rtk-ai/rtk"),Xi=m(!1),Va=m(null),xc=m(null),er=m(null),Ja=m("event4u-app/agent-switch"),xr=m(!1);m(!1);m(null);m([]);m({});m({});const xe=m({}),Re=m({}),nr=m(!1),Il=m(!1);m({});m(null);m(null);m(!1);m(null);const jt=m(null),Qa=m(!1),tr=m(null),ir=m(!1),rr=m(!1),lr=m(null),un=m(null),vt=m(!1),Tr=m(!1);function Za(){return Ma({extended:ie.value})}function hn(){return Za().length}function Tc(e){return e??new Date().toISOString()}function Er(e){return Math.max(0,Math.min(hn()-1,e))}function Ec(e){if("$ref"in e&&e.$ref!==void 0&&"definitions"in e&&e.definitions!==void 0){const n=e.$ref.replace("#/definitions/",""),i=e.definitions[n];if(i!==void 0)return i}return e}async function Oc(){try{return await F("/api/v1/settings")}catch(e){if(e instanceof V&&e.status===404&&e.body.error?.code==="NOT_FOUND"){const n=e.body;if(n.defaults!==void 0&&n.schema!==void 0)return{values:n.defaults,lastModified:n.lastModified??0,path:n.path??".agent-settings.yml",schema:n.schema};const i=await F("/api/v1/schema");return{values:{},lastModified:0,path:".agent-settings.yml",schema:i.settings}}throw e}}async function Nc(){try{const e=await F("/api/v1/install/recovery");jt.value=e.incomplete?e:null}catch{jt.value=null}}async function Ic(){try{const e=await F("/api/v1/install/legacy-v3");tr.value=e.present?e:null}catch{tr.value=null}}async function Rc(){rr.value=!0,lr.value=null;try{await F("/api/v1/install/backup-v3",{method:"POST"}),ir.value=!0}catch(e){lr.value=e instanceof V?se(e.body.error??{code:"UNKNOWN",message:e.message}):e instanceof Error?e.message:String(e)}finally{rr.value=!1}}async function Di(e){try{await F("/api/v1/install/recovery/dismiss",{method:"POST",body:{reason:e}})}catch(n){K.value={message:n instanceof Error?n.message:String(n),tone:"error"};return}jt.value=null,Qa.value=!0}async function Lc(){xn.value=null;try{Nc(),Ic();const[e,n]=await Promise.all([F("/api/v1/wizard/state"),Oc()]);wr.value=Ec(n.schema),Ua.value=n.lastModified,Da.value=n.values,Ba.value=n.legacyHints??{},ie.value=e.extendedSteps===!0,un.value=e.wizardMode??null;const i=Object.keys(e.partial??{});ue.value=i.length>0?{...n.values,...e.partial}:n.values,qe.value=Er(e.step),rn.value=!1,ja.value=!0;const l=Zt(qe.value,{extended:ie.value});(l.kind==="welcome"||l.kind==="userMd"||l.kind==="review")&&Or(),(l.kind==="roles"||l.kind==="aiTools"||l.kind==="packs")&&Kn(),l.kind==="roles"&&Nr(),l.kind==="aiTools"&&ii(),l.id==="identity"&&(Xa(),eo()),l.kind==="review"&&no()}catch(e){e instanceof V?xn.value=se(e.body.error??{code:"UNKNOWN",message:e.message}):xn.value=e instanceof Error?e.message:String(e)}}function $c(e,n){return e.identity.name.trim()!==""?e:{...e,identity:{...e.identity,name:n}}}async function Or(){if(!Ki.value)try{const e=await F("/api/v1/user-md");if(Sr.value=e.exists,e.exists&&e.identity!==null){const n=nl(e.identity);Me.value=n,Q.value=n}else{let n;try{const l=await F("/api/v1/user-md/template");n=nl(ac(l.body))}catch{n=ma()}const i=Ba.value.user_name;typeof i=="string"&&i.trim()!==""&&(n=$c(n,i)),Me.value=n,Q.value=n}}catch(e){K.value={message:e instanceof Error?e.message:String(e),tone:"error"}}finally{Ki.value=!0}}const Pc=new Set(["python"]);async function Kn(){if(!(Gi.value||sn.value)){sn.value=!0,Fe.value=null;try{const[e,n]=await Promise.all([F("/api/v1/wizard/manifest"),F("/api/v1/wizard/auto-detect")]),i=(e.packs??[]).map(a=>({id:a.id,label:a.label??a.id,description:a.description??"",requires_hint:a.requires_hint,cluster:a.cluster??void 0,workspaces:a.workspaces}));ni.value=i,zn.value=(e.workspaces??[]).filter(a=>a.id!=="agent-config-maintainer").map(a=>({id:a.id,label:a.label??a.id,description:a.description??"",default_packs:a.default_packs??[],optional_packs:a.optional_packs??[],...a.example_roles!==void 0?{example_roles:a.example_roles}:{}}));const l=new Set(i.map(a=>a.id)),o=n.signals.map(a=>a.id.startsWith("pack-")?a.id.slice(5):a.id).filter(a=>l.has(a)).filter(a=>!Pc.has(a));ti.value=o,We.value=(e.installedPacks??[]).filter(a=>l.has(a))}catch(e){e instanceof V?Fe.value=se(e.body.error??{code:"UNKNOWN",message:e.message}):Fe.value=e instanceof Error?e.message:String(e)}finally{sn.value=!1,Gi.value=!0}}}async function ii(){if(!(Ji.value||pt.value)){pt.value=!0;try{const e=await F("/api/v1/wizard/detect-tools"),n=e.tools??{},i=e.configured??[];if(Cr.value=n,Object.keys(xe.value).length===0){const l={};if(i.length>0)for(const o of i)l[o]=!0;else for(const[o,a]of Object.entries(n))a&&(l[o]=!0);xe.value=l}}catch{}finally{pt.value=!1,Ji.value=!0}}}async function Xa(){if(!Nl.value){Nl.value=!0;try{const e=await F("/api/v1/wizard/detect-rtk"),n=e.installed===!0;Wa.value=n,Ya.value=e.present===!0,za.value=e.identity??null,Ka.value=e.version??null,Qi.value=e.installCommand??null,Ga.value=e.installCommands??null,typeof e.repo=="string"&&(Zi.value=e.repo);const i=ue.value.personal??{};ue.value={...ue.value,personal:{...i,rtk_installed:n}}}catch{}}}async function eo(){if(!Xi.value){Xi.value=!0;try{const e=await F("/api/v1/wizard/detect-agent-switch");Va.value=e.installed===!0,xc.value=e.version??null,er.value=e.installCommand??null,typeof e.repo=="string"&&(Ja.value=e.repo),xr.value=e.dismissed===!0}catch{}}}async function Mc(e,n){try{await F("/api/v1/wizard/state",{method:"POST",body:{step:e,totalSteps:hn(),partial:n,startedAt:Tc(null)}})}catch(i){K.value={message:i instanceof Error?i.message:String(i),tone:"error"}}}async function no(){It.value=!0;try{const e=await F("/api/v1/settings/diff",{method:"POST",body:{values:ue.value,ifUnmodifiedSince:Ua.value}});ei.value=e.changes,cn.value={}}catch(e){e instanceof V?(cn.value=Qt(e.body.error??{message:e.message}),K.value={message:se(e.body.error??{code:"UNKNOWN",message:e.message}),tone:"error"}):K.value={message:e instanceof Error?e.message:String(e),tone:"error"}}finally{It.value=!1}}function Dt(){return Xt.value?!1:Q.value===null||Me.value===null?Q.value!==Me.value:JSON.stringify(Q.value)!==JSON.stringify(Me.value)}async function ln(e){const n=Er(e);await Mc(n,ue.value),qe.value=n,K.value=null;const i=Zt(n,{extended:ie.value});(i.kind==="welcome"||i.kind==="userMd")&&Or(),(i.kind==="roles"||i.kind==="aiTools"||i.kind==="packs")&&Kn(),i.kind==="roles"&&Nr(),i.kind==="packs"&&li(),i.kind==="aiTools"&&ii(),i.id==="identity"&&(Xa(),eo()),i.kind==="review"&&no()}function ri(){const e=Re.value,n=new Map(ni.value.map(a=>[a.id,a])),i=Object.entries(e).filter(([,a])=>a===!0).map(([a])=>a).filter(a=>{const s=n.get(a)?.cluster;return s===void 0||e[s]===!0}),l=new Set,o=a=>{if(!l.has(a)){l.add(a);for(const s of n.get(a)?.requires_hint??[])o(s)}};for(const a of i)o(a);return[...l].sort()}async function Nr(){if(await Promise.all([Kn(),Or()]),qa.value||Object.values(Ae.value).some(Boolean))return;const e=Q.value?.role??[];if(e.length===0)return;const n=new Set(zn.value.map(l=>l.id)),i={};for(const l of e)n.has(l)&&(i[l]=!0);Object.keys(i).length!==0&&(Ae.value=i,li())}function li(){if(nr.value)return;const e=Object.entries(Ae.value).filter(([,o])=>o===!0).map(([o])=>o),n=new Map(zn.value.map(o=>[o.id,o])),i=[];for(const o of e)for(const a of n.get(o)?.default_packs??[])i.push(a);const l=new Map;for(const o of ni.value)o.cluster!==void 0&&l.set(o.id,o.cluster);Re.value=cc({installed:We.value,roleDefaults:i,detected:ti.value,clusterOf:l})}function Fc(){const e=Object.entries(xe.value).filter(([,l])=>l===!0).map(([l])=>l);if(e.length===0)return null;const n=ri(),i={schema_version:"wizard-v2",tools:e,packs:n,settings:ue.value};return He.value?.dryRun===!0&&(i.dry_run=!0),i}async function jc(){Nt.value=!0,K.value=null;try{const e={settings:ue.value},n=Object.entries(Ae.value).filter(([,f])=>f===!0).map(([f])=>f),i=Q.value!==null&&typeof Q.value.identity?.name=="string"&&Q.value.identity.name.trim().length>0;Q.value!==null&&i&&(Dt()||n.length>0)&&(e.identity=n.length>0?{...Q.value,role:n}:Q.value);const l=await F("/api/v1/wizard/finish",{method:"POST",body:e}),o="You can close this browser window now.",a=l.dryRun===!0?"Dry-run complete — no files written. Settings would be saved.":Array.isArray(l.writtenPaths)?`Saved (${l.writtenPaths.join(", ")}). Wizard complete.`:"Wizard complete.",s=ie.value?Fc():null;let d="";if(s!==null&&s.dry_run===!0)try{await F("/api/v1/wizard/apply",{method:"POST",body:s}),d=" Installer preview OK (dry-run) — no files written."}catch(f){d=` Installer preview failed: ${f instanceof V?se(f.body.error??{code:"UNKNOWN",message:f.message}):f instanceof Error?f.message:String(f)}.`}else if(s!==null)try{let f=null;await Fo("/api/v1/wizard/apply",s,g=>{g.type==="error"&&(f=typeof g.message=="string"?g.message:"install failed")});const u=s.tools.length,h=s.packs.length;d=f!==null?` Installer failed: ${f}. Settings were saved; re-run the wizard to retry.`:` Installer applied ${u} tool${u===1?"":"s"}`+(h>0?` and ${h} pack${h===1?"":"s"}.`:".")}catch(f){d=` Installer bridge failed: ${f instanceof V?se(f.body.error??{code:"UNKNOWN",message:f.message}):f instanceof Error?f.message:String(f)}. Settings were saved; re-run the wizard to retry the install plan.`}K.value={message:`${a}${d} ${o}`,tone:"success"},qe.value=Er(hn()-1),Da.value=ue.value,Me.value=Dt()?Q.value:Me.value,ei.value=[],rn.value=!0}catch(e){e instanceof V?(cn.value=Qt(e.body.error??{message:e.message}),K.value={message:se(e.body.error??{code:"UNKNOWN",message:e.message}),tone:"error"}):K.value={message:e instanceof Error?e.message:String(e),tone:"error"}}finally{Nt.value=!1}}async function Dc(){Tr.value=!0,await Promise.all([Kn(),ii()]),await Nr(),li(),await ln(hn()-1)}function Uc(){Te(()=>{Kn(),ii()},[]);const e=sn.value||pt.value||!Gi.value||!Ji.value,n=Object.values(Cr.value).filter(Boolean).length,i=We.value.length,l=ti.value.filter(o=>!We.value.includes(o)).length;return r("div",{class:"ac-start",children:[r("section",{class:"ac-start__card ac-start__card--primary",children:[r("h2",{class:"ac-start__title",children:"Recommended setup"}),r("p",{class:"ac-start__desc",children:"The fastest path — we pre-select everything we can detect and you confirm one review screen before anything is written."}),r("ul",{class:"ac-start__facts",children:[r("li",{children:e?"Detecting your AI tools…":n===0?"No AI tools detected — pick them on the review screen.":`${n} AI tool${n===1?"":"s"} detected and pre-selected.`}),r("li",{children:e?"Detecting capability packs…":i>0?`${i} installed pack${i===1?"":"s"} kept${l>0?`, ${l} more auto-detected`:""}.`:l>0?`${l} capability pack${l===1?"":"s"} auto-detected.`:"No packs pre-selected — add them any time later."}),r("li",{children:"Settings keep their current values (or safe defaults on a first run)."}),r("li",{children:"Nothing is written until you confirm the review screen."})]}),r("button",{type:"button",class:"ac-button ac-button--primary ac-start__cta",disabled:e,onClick:()=>{Dc()},children:e?"Detecting…":"Use recommended setup"})]}),r("section",{class:"ac-start__card",children:[r("h2",{class:"ac-start__title",children:"Customize"}),r("p",{class:"ac-start__desc",children:"Walk through every step — tools, roles, packs, behaviour, budgets — and tune each choice yourself."}),r("button",{type:"button",class:"ac-button ac-start__cta",onClick:()=>{Tr.value=!0},children:"Customize step by step"})]})]})}const Bc=["de","en","en-US","en-GB","fr","es","it","nl","pt","pt-BR"];function Hc(){if(Il.value)return;const e=Q.value;if(e===null)return;Il.value=!0;let n=e;if(e.identity.name.trim()===""){const i=He.value?.systemUser;i!==void 0&&i.trim()!==""&&(n={...n,identity:{...n.identity,name:i}})}if(!Sr.value&&typeof navigator<"u"){const i=(navigator.language||"").split("-")[0];i.length>=2&&(n={...n,language:i})}n!==e&&(Q.value=n)}function qc(){const e=Q.value;if(Te(()=>{Hc()},[e]),e===null)return r("p",{children:"Loading…"});const n=i=>{Q.value={...i,last_updated:new Date().toISOString().slice(0,10)},Xt.value=!1};return r("div",{class:"ac-wizard-step-stub ac-wizard__module-fields",children:[r("p",{children:["Tell the agent who you are. We pre-filled what we could detect — adjust freely. Stored in ",r("code",{children:".agent-user.yml"}),"."]}),r("div",{class:"ac-field",children:[r("label",{class:"ac-field__label",for:"welcome-name",children:"Name"}),r("input",{class:"ac-input",id:"welcome-name",type:"text",placeholder:"How should the agent address you?",value:e.identity.name,onInput:i=>n({...e,identity:{...e.identity,name:i.currentTarget.value}})})]}),r("div",{class:"ac-field",children:[r("label",{class:"ac-field__label",for:"welcome-lang",children:"Language"}),r("input",{class:"ac-input",id:"welcome-lang",type:"text",list:"welcome-lang-list",placeholder:"BCP-47 code, e.g. de, en, en-US",value:e.language,onInput:i=>n({...e,language:i.currentTarget.value})}),r("datalist",{id:"welcome-lang-list",children:Bc.map(i=>r("option",{value:i},i))})]})]})}function Wc(){const e=xe.value,n=Cr.value;return r("div",{class:"ac-wizard-step-stub",children:[r("p",{children:"Pick the AI tools you use. Tools detected on this machine are pre-selected on first run. The installer wires each selected tool's surface (skills, rules, commands) on apply; you can change this list later by re-running the wizard."}),r("ul",{class:"ac-wizard__tool-list",children:Cc.map(i=>{const l=n[i.id]===!0;return r("li",{class:"ac-wizard__tool-row",children:[r("label",{class:"ac-wizard__tool-label",children:[r("input",{type:"checkbox",checked:e[i.id]??!1,onChange:o=>{const a=o.currentTarget.checked;xe.value={...e,[i.id]:a}}})," ",i.label]}),r("span",{class:`ac-badge ${l?"ac-badge--installed":"ac-badge--missing"}`,title:l?"Detected on this machine":"Not detected on this machine",children:l?"installed":"not installed"})]},i.id)})})]})}function Yc(){if(sn.value)return r("p",{children:"Loading roles…"});if(Fe.value!==null)return r("div",{class:"ac-wizard-step-stub",children:r("p",{class:"ac-banner ac-banner--error",children:["Discovery failed: ",Fe.value]})});const e=Ae.value,n=zn.value,i=(l,o)=>{qa.value=!0,Ae.value={...Ae.value,[l]:o},li()};return r("div",{class:"ac-wizard-step-stub",children:[r("p",{children:["Pick the areas you work in. We use them to recommend capability packs on the next step, and they become your roles in",r("code",{children:" .agent-user.yml"}),"."]}),n.length===0?r("p",{children:r("em",{children:"No roles available in the manifest."})}):r("div",{class:"ac-wizard__pack-grid",children:n.map(l=>r("section",{class:"ac-pack-tile",children:[r("label",{class:"ac-pack-tile__head",children:[r("input",{type:"checkbox",checked:e[l.id]??!1,onChange:o=>{i(l.id,o.currentTarget.checked)}}),r("span",{class:"ac-pack-tile__title",children:l.label})]}),(l.example_roles??[]).length>0?r("p",{class:"ac-pack-tile__role",children:["e.g. ",(l.example_roles??[]).join(", ")]}):null,l.description!==""?r("p",{class:"ac-pack-tile__desc",children:l.description}):null]},l.id))})]})}function zc(){if(sn.value)return r("p",{children:"Loading discovery manifest…"});if(Fe.value!==null)return r("div",{class:"ac-wizard-step-stub",children:[r("p",{class:"ac-banner ac-banner--error",children:["Discovery failed: ",Fe.value]}),r("p",{children:"The manifest endpoint is gated on extended-mode. Re-run the server with extended steps enabled to populate this list."})]});const e=Re.value,n=new Set(ti.value),i=new Set(We.value),l=b=>i.has(b)?r("span",{class:"ac-badge ac-badge--installed",children:"installed"}):n.has(b)?r("span",{class:"ac-badge ac-badge--detected",children:"auto-detected"}):null,o=new Map(zn.value.map(b=>[b.id,b.label])),a=Ae.value,s=b=>{const O=(b??[]).filter(R=>R!=="agent-config-maintainer");return O.length===0?null:r("span",{class:"ac-pack-tile__ws",children:O.map(R=>r("span",{class:`ac-badge ac-badge--ws${a[R]===!0?" ac-badge--ws-active":""}`,title:a[R]===!0?"Matches a role you picked":"Workspace / area",children:o.get(R)??R},R))})},d=ni.value.filter(b=>b.id!=="engineering-base"),f=new Map;for(const b of d)if(b.cluster!==void 0){const O=f.get(b.cluster)??[];O.push(b),f.set(b.cluster,O)}const u=new Set(d.filter(b=>b.cluster!==void 0).map(b=>b.id)),h=d.filter(b=>!u.has(b.id)),g=(b,O)=>{nr.value=!0,Re.value={...Re.value,[b]:O}},p=(b,O)=>{nr.value=!0;const R={...Re.value,[b]:O};if(O)for(const j of f.get(b)??[])R[j.id]===void 0&&(R[j.id]=!0);Re.value=R};return r("div",{class:"ac-wizard-step-stub",children:[r("p",{children:"Pick the capability packs to install. Auto-detected packs are pre-selected; engineering hygiene is included automatically when a pack needs it. A language tile expands to its frameworks — turn the language off to skip them all."}),h.length===0?r("p",{children:r("em",{children:"No packs available in the manifest."})}):r("div",{class:"ac-wizard__pack-grid",children:h.map(b=>{const O=f.get(b.id)??[],R=O.length>0,j=e[b.id]??!1;return r("section",{class:"ac-pack-tile",children:[r("label",{class:"ac-pack-tile__head",children:[r("input",{type:"checkbox",checked:j,onChange:D=>{const M=D.currentTarget.checked;R?p(b.id,M):g(b.id,M)}}),r("span",{class:"ac-pack-tile__title",children:b.label}),l(b.id)]}),s(b.workspaces),b.description!==""?r("p",{class:"ac-pack-tile__desc",children:b.description}):null,R?r("fieldset",{class:"ac-pack-tile__children",disabled:!j,children:O.map(D=>r("label",{class:"ac-pack-tile__child",children:[r("input",{type:"checkbox",checked:e[D.id]??!1,disabled:!j,onChange:M=>{g(D.id,M.currentTarget.checked)}}),r("span",{children:D.label}),l(D.id)]},D.id))}):null]},b.id)})})]})}function Kc(){const e=Wa.value,n=Ya.value,i=za.value,l=Ka.value,o=Ga.value,a=e===null?r("span",{class:"ac-badge ac-badge--missing",children:"detecting…"}):e?r("span",{class:"ac-badge ac-badge--installed",children:["installed",l!==null?` (v${l})`:""]}):n===!0?r("span",{class:"ac-badge ac-badge--missing",children:i==="unknown-rtk"?"different tool":"unverified"}):r("span",{class:"ac-badge ac-badge--missing",children:"not installed"});return r("div",{class:"ac-rtk-row",children:[r("div",{class:"ac-rtk-row__head",children:[r("span",{class:"ac-rtk-row__label",children:["rtk ",r("small",{children:"(Rust Token Killer — third-party, Apache-2.0)"})]}),a]}),n===!0&&i==="unknown-rtk"?r("div",{class:"ac-rtk-row__install",children:[r("p",{class:"ac-field__description",children:["A binary named ",r("code",{children:"rtk"})," is on PATH, but it is not Rust Token Killer — two unrelated projects share the name (the other is Rust Type Kit). The token-saving integration stays off. See the upstream name-collision guidance:"]}),r("a",{class:"ac-button",href:`${Zi.value}/blob/master/INSTALL.md`,target:"_blank",rel:"noreferrer noopener",children:"Open rtk install guide"})]}):null,n===!0&&i==="unverified"?r("p",{class:"ac-field__description",children:["rtk found but the identity check failed — verify manually with ",r("code",{children:"rtk gain"})," (Rust Token Killer renders a token-savings dashboard; the colliding Rust Type Kit does not)."]}):null,n===!1?r("div",{class:"ac-rtk-row__install",children:[r("p",{class:"ac-field__description",children:"rtk wraps verbose CLI output — upstream reports 60–90% token savings (their estimate). Install it, then re-open the wizard to pick up detection:"}),o!==null?r(te,{children:[o.recommendedLabel!==void 0?r("p",{class:"ac-field__description",children:[o.recommendedLabel,":"]}):null,r("code",{class:"ac-rtk-row__cmd",children:o.recommended}),o.manual!==void 0?r(te,{children:[r("p",{class:"ac-field__description",children:[o.manualLabel??"Manual",":"]}),r("code",{class:"ac-rtk-row__cmd",children:o.manual})]}):null,o.note!==void 0?r("p",{class:"ac-field__description",children:o.note}):null]}):Qi.value!==null?r("code",{class:"ac-rtk-row__cmd",children:Qi.value}):null,r("a",{class:"ac-button",href:Zi.value,target:"_blank",rel:"noreferrer noopener",children:"Open rtk repo"})]}):null]})}async function Gc(){try{await F("/api/v1/wizard/dismiss-recommendation",{method:"POST",body:{id:"agent-switch"}})}catch(e){K.value={message:e instanceof Error?e.message:String(e),tone:"error"};return}xr.value=!0}function Vc(){return!Xi.value||Va.value!==!1||xr.value?null:r("div",{class:"ac-rtk-row",children:[r("div",{class:"ac-rtk-row__head",children:[r("span",{class:"ac-rtk-row__label",children:["agent-switch ",r("small",{children:"(third-party, MIT)"})]}),r("span",{class:"ac-badge ac-badge--missing",children:"not installed"})]}),r("div",{class:"ac-rtk-row__install",children:[r("p",{class:"ac-field__description",children:["agent-switch isolates multiple agent accounts into per-account profiles (",r("code",{children:"CLAUDE_CONFIG_DIR"}),") so switching accounts never requires a re-login. Free and MIT-licensed."]}),er.value!==null?r("code",{class:"ac-rtk-row__cmd",children:er.value}):null,r("a",{class:"ac-button",href:`https://github.com/${Ja.value}`,target:"_blank",rel:"noreferrer noopener",children:"Open agent-switch repo"}),r("button",{type:"button",class:"ac-button ac-button--small",onClick:()=>{Gc()},children:"Don't show again"})]})]})}function Jc(){const e=Zt(qe.value,{extended:ie.value});if(ie.value&&un.value==="install"&&e.id==="identity"&&!vt.value)return r(yc,{});if(e.kind==="form"){const i=uc(wr.value,e.paths??[]);return r(te,{children:[e.id==="identity"?r(Kc,{}):null,e.id==="identity"?r(Vc,{}):null,r(zo,{schema:i,values:ue.value,errors:cn.value,onChange:l=>{ue.value=l}})]})}return e.kind==="userMd"?!Ki.value||Q.value===null?r("p",{children:"Loading .agent-user.yml…"}):r(Jo,{value:Q.value,errors:cn.value,hideRole:ie.value&&un.value==="install",hideIdentityBasics:ie.value&&un.value==="install",onChange:i=>{Q.value=i,Xt.value=!1}}):e.kind==="welcome"?r(qc,{}):e.kind==="aiTools"?r(Wc,{}):e.kind==="roles"?r(Yc,{}):e.kind==="packs"?r(zc,{}):r(mc,{steps:Za(),currentIndex:qe.value,changes:ei.value,errors:cn.value,userMdChanged:Dt(),userMdAction:Sr.value?"replace":"create",loading:It.value,onJump:i=>{ln(i)},selectedToolsCount:Object.values(xe.value).filter(Boolean).length,selectedPacksCount:Object.values(Re.value).filter(Boolean).length,packRemovals:ar(),removalsConfirmed:Vi.value,onConfirmRemovals:i=>{Vi.value=i},selectedToolIds:Object.entries(xe.value).filter(([,i])=>i).map(([i])=>i),packAdditions:ie.value?ri().filter(i=>i!=="engineering-base"&&!We.value.includes(i)):[]})}function ar(){return ie.value?sc(We.value,ri()):[]}function Rl({path:e}){if(Te(()=>{Lc()},[]),!ja.value||wr.value===null)return r("div",{class:"ac-page",children:[r("h1",{children:"Setup wizard"}),xn.value!==null?r("p",{class:"ac-banner ac-banner--error",children:xn.value}):r("p",{children:"Loading…"})]});const n=qe.value,i=hn(),l=Zt(n,{extended:ie.value}),o=n===i-1,a=l.kind==="aiTools"&&Object.values(xe.value).filter(Boolean).length===0||l.kind==="roles"&&Object.values(Ae.value).filter(Boolean).length===0||l.kind==="packs"&&ri().length===0,s=ie.value&&un.value==="install"&&l.id==="identity"&&!vt.value,d=jt.value,f=d!==null&&!Qa.value,u=tr.value,h=u!==null&&u.present&&!ir.value,g=ie.value&&un.value==="install"&&n===0&&!Tr.value&&!rn.value;return h?r("div",{class:"ac-page",children:r(bc,{sourcePath:u.path,backupTarget:u.backupTarget,version:u.version,busy:rr.value,error:lr.value,onBackupAndProceed:()=>{Rc()},onAbort:()=>{K.value={tone:"info",message:"Aborted. Uninstall v3 manually, then re-run `agent-config install`."},ir.value=!0}})}):g?r("div",{class:"ac-page",children:[r("header",{class:"ac-page__header",children:r("h1",{children:"Set up agent-config"})}),K.value!==null?r("p",{class:`ac-banner${K.value.tone==="error"?" ac-banner--error":""}`,children:K.value.message}):null,r(Uc,{})]}):r("div",{class:"ac-page",children:[r(fc,{step:l,index:n,total:i}),f?r(gc,{abortedAt:d.abortedAt,abortNote:d.abortNote,writesSinceRollback:d.writesSinceRollback,busy:Nt.value,onResume:()=>{Di("resume")},onRollback:()=>{Di("rollback")},onIgnore:()=>{Di("ignore")}}):null,K.value!==null&&!(rn.value&&o&&K.value.tone==="success")?r("p",{class:`ac-banner${K.value.tone==="error"?" ac-banner--error":""}`,children:K.value.message}):null,r("div",{class:"ac-wizard__step",children:rn.value&&o?r(Sc,{message:K.value?.tone==="success"?K.value.message:null}):r(Jc,{})}),a?r("p",{class:"ac-wizard__hint",children:l.kind==="aiTools"?"Select at least one AI tool to continue.":l.kind==="roles"?"Select at least one role to continue.":"Select at least one capability pack to continue."}):null,r(hc,{canGoPrev:n>0,canGoNext:!o&&!a,canSkip:s||l.kind==="userMd",skipLabel:s?"Finish install here":"Skip",isLast:o,busy:Nt.value||It.value,canFinish:(ei.value.length>0||Dt()||ar().length>0||ie.value&&Object.values(xe.value).some(Boolean))&&(ar().length===0||Vi.value),completed:rn.value,onPrev:()=>{ln(n-1)},onNext:()=>{if(s){vt.value=!0;return}ln(n+1)},onSkip:()=>{if(s){vt.value=!0,ln(hn()-1);return}Xt.value=!0,ln(n+1)},onFinish:()=>{jc()}})]})}const Qc=new Set(["profile.id","rule_loading_tier","discipline_profile","personal.ide","personal.open_edited_files","personal.autonomy","personal.minimal_output","personal.play_by_play","personal.pr_comment_bot_icon","personal.pr_progress_comments","cost.budgets.daily","cost.budgets.weekly","cost.budgets.monthly","cost.enforcement","model.auto_switch","tokens.rich_skills","roadmap.quality_cadence","roadmap.dashboard_regen_cadence","quality.local_auto_run","quality.wait_for_remote_ci","memory.review_threshold","memory.redact_patterns","memory.cadence","chat_history.enabled","update_check.enabled","subagents.enabled","subagents.auto","worktrees.mode","legal_review_prep.acknowledged"]);function Ll(e){return Qc.has(e)}function Zc(e,n){return JSON.stringify(e??null)===JSON.stringify(n??null)}function to(e,n){if(e.kind==="enum_removed"){const i=new Set(e.values??[]);return n!==void 0&&i.has(n)?"must_fix":"info"}return e.kind==="type_changed"?"must_fix":e.kind==="default_changed"?n===void 0||Zc(n,e.old?.default)?"adopt":"review":e.kind==="added"&&e.new?.default===void 0?"must_fix":"info"}const or=m(!0),Ut=m(null),cr=m(!1),ai=m(null),pn=m({}),sr=m(0),Ye=m({}),Le=m(null),Ce=m(!1),$n=m(!1);function je(e){return`${e.key}:${e.kind}`}async function Xc(){or.value=!0,Ut.value=null,cr.value=!1,$n.value=!1;try{const e=await F("/api/v1/settings/changes"),n=await F("/api/v1/settings");ai.value=e.delta,pn.value=n.values,sr.value=n.lastModified,es(e.delta,n.values)}catch(e){e instanceof V&&e.status===404?cr.value=!0:Ut.value=e instanceof Error?e.message:String(e)}finally{or.value=!1}}function es(e,n){const i={};for(const l of e.changes){const o=to(l,qn(n,l.key.split(".")));o==="adopt"?i[je(l)]={mode:"adopt"}:o==="review"?i[je(l)]={mode:"keep"}:o==="must_fix"&&(i[je(l)]={mode:null})}Ye.value=i}function Ir(e){return to(e,qn(pn.value,e.key.split(".")))}function Tn(e,n){Ye.value={...Ye.value,[e]:n}}function Rr(){const e=ai.value;return e===null?[]:e.changes.filter(n=>{if(Ir(n)!=="must_fix")return!1;const i=Ye.value[je(n)];return i===void 0||i.mode===null||i.mode==="custom"&&(i.value===void 0||i.value==="")})}function ns(){const e=ai.value;let n=pn.value;if(e===null)return n;for(const i of e.changes){const l=Ye.value[je(i)];if(l===void 0||l.mode===null||l.mode==="keep")continue;const o=i.key.split(".");l.mode==="adopt"&&i.new?.default!==void 0?n=Ln(n,o,i.new.default):l.mode==="custom"&&l.value!==void 0&&(n=Ln(n,o,l.value))}return n}async function ts(){if(Ce.value)return;const e=Rr();if(e.length>0){Le.value=`Resolve the ${e.length} “Must fix” item${e.length===1?"":"s"} first.`;return}Ce.value=!0,Le.value=null;try{const n=ns();if(JSON.stringify(n)!==JSON.stringify(pn.value)){const i=await F("/api/v1/settings",{method:"PUT",headers:{"If-Unmodified-Since":String(sr.value)},body:{values:n}});pn.value=n,sr.value=i.lastModified}await F("/api/v1/settings/changes/ack",{method:"POST"}),$n.value=!0}catch(n){n instanceof V?Le.value=se(n.body.error??{code:"UNKNOWN",message:n.message}):Le.value=n instanceof Error?n.message:String(n)}finally{Ce.value=!1}}async function is(){if(Ce.value)return;if(Rr().length>0){Le.value="Cannot dismiss — “Must fix” items would leave invalid values in place.";return}Ce.value=!0;try{await F("/api/v1/settings/changes/ack",{method:"POST"}),$n.value=!0}catch(n){Le.value=n instanceof Error?n.message:String(n)}finally{Ce.value=!1}}function Ne(e){return e===void 0?"—":typeof e=="string"?e:JSON.stringify(e)}function Ui({change:e,id:n}){const i=e.new,o=Ye.value[n]?.value;return i?.enum!==void 0?r("select",{class:"ac-input","aria-label":`New value for ${e.key}`,value:o===void 0?"":String(o),onChange:a=>{const s=a.currentTarget.value;Tn(n,{mode:"custom",value:s})},children:[r("option",{value:"",disabled:!0,children:"Choose a value…"}),i.enum.map(a=>r("option",{value:String(a),children:String(a)},String(a)))]}):i?.type==="boolean"?r("select",{class:"ac-input","aria-label":`New value for ${e.key}`,value:o===void 0?"":String(o),onChange:a=>{Tn(n,{mode:"custom",value:a.currentTarget.value==="true"})},children:[r("option",{value:"",disabled:!0,children:"Choose…"}),r("option",{value:"true",children:"true"}),r("option",{value:"false",children:"false"})]}):r("input",{class:"ac-input",type:i?.type==="number"||i?.type==="integer"?"number":"text","aria-label":`New value for ${e.key}`,value:o===void 0?"":String(o),onInput:a=>{const s=a.currentTarget.value,d=i?.type==="number"||i?.type==="integer"?Number(s):s;Tn(n,{mode:"custom",value:d})}})}function rs({change:e}){const n=Ir(e),i=je(e),l=Ye.value[i],o=qn(pn.value,e.key.split("."));return r("li",{class:`ac-change-card ac-change-card--${n}`,"data-key":e.key,"data-kind":e.kind,children:[r("div",{class:"ac-change-card__head",children:[r("code",{class:"ac-change-card__key",children:e.key}),r("span",{class:`ac-change-card__badge ac-change-card__badge--${n}`,children:n==="must_fix"?"Must fix":n==="adopt"?"New default":n==="review"?"Review":"Info"})]}),e.new?.description!==void 0?r("p",{class:"ac-change-card__desc",children:e.new.description}):null,e.kind==="default_changed"?r(te,{children:[r("p",{class:"ac-change-card__detail",children:["Default changed: ",r("code",{children:Ne(e.old?.default)})," → ",r("code",{children:Ne(e.new?.default)}),n==="review"?r(te,{children:[" · your value: ",r("code",{children:Ne(o)})]}):null]}),r("div",{class:"ac-change-card__choices",role:"radiogroup","aria-label":`Resolution for ${e.key}`,children:[r("label",{class:"ac-change-card__choice",children:[r("input",{type:"radio",name:i,checked:l?.mode==="adopt",onChange:()=>{Tn(i,{mode:"adopt"})}}),r("span",{children:["Adopt new default (",r("code",{children:Ne(e.new?.default)}),")"]})]}),r("label",{class:"ac-change-card__choice",children:[r("input",{type:"radio",name:i,checked:l?.mode==="keep",onChange:()=>{Tn(i,{mode:"keep"})}}),r("span",{children:["Keep current (",r("code",{children:Ne(o??e.old?.default)}),")"]})]})]})]}):null,e.kind==="enum_removed"?n==="must_fix"?r(te,{children:[r("p",{class:"ac-change-card__detail",children:["Your value ",r("code",{children:Ne(o)})," is no longer valid — removed option",(e.values?.length??0)===1?"":"s",": ",r("code",{children:(e.values??[]).join(", ")}),". Pick a replacement:"]}),r(Ui,{change:e,id:i})]}):r("p",{class:"ac-change-card__detail",children:["Removed option",(e.values?.length??0)===1?"":"s",": ",r("code",{children:(e.values??[]).join(", ")})," — your value ",r("code",{children:Ne(o??e.new?.default)})," is unaffected."]}):null,e.kind==="enum_added"?r("p",{class:"ac-change-card__detail",children:["New option",(e.values?.length??0)===1?"":"s"," available: ",r("code",{children:(e.values??[]).join(", ")})]}):null,e.kind==="added"?n==="must_fix"?r(te,{children:[r("p",{class:"ac-change-card__detail",children:"New setting without a shipped default — define a value:"}),r(Ui,{change:e,id:i})]}):r("p",{class:"ac-change-card__detail",children:["New setting · default: ",r("code",{children:Ne(e.new?.default)}),e.new?.enum!==void 0?r(te,{children:[" · options: ",r("code",{children:e.new.enum.join(", ")})]}):null]}):null,e.kind==="removed"?r("p",{class:"ac-change-card__detail",children:"This setting no longer exists. Your stored value is kept in place and ignored (nothing is deleted)."}):null,e.kind==="type_changed"?r(te,{children:[r("p",{class:"ac-change-card__detail",children:["Type changed: ",r("code",{children:e.old?.type})," → ",r("code",{children:e.new?.type}),". Define a new value:"]}),r(Ui,{change:e,id:i})]}):null]})}function ls(e){const n=new Map;for(const u of e.changes){const h=Ir(u);n.set(h,[...n.get(h)??[],u])}const i=[],l=n.get("must_fix")??[];l.length>0&&i.push({title:"Must fix",hint:"These stored values are invalid after the upgrade — saving is blocked until each has a valid value.",changes:l});const o=[...n.get("adopt")??[],...n.get("review")??[]];o.length>0&&i.push({title:"Changed defaults",hint:"Values you never customized are preselected to adopt the new default; customized values are kept unless you choose otherwise.",changes:o});const a=n.get("info")??[],s=a.filter(u=>u.kind==="added"),d=a.filter(u=>u.kind==="enum_added"),f=a.filter(u=>u.kind!=="added"&&u.kind!=="enum_added");return s.length>0&&i.push({title:"New settings",changes:s}),d.length>0&&i.push({title:"New options",changes:d}),f.length>0&&i.push({title:"Removed / other",changes:f}),i}function as(){if(Te(()=>{Xc()},[]),or.value)return r("div",{class:"ac-page",children:[r("h1",{children:"Settings changes"}),r("p",{children:"Loading…"})]});if(Ut.value!==null)return r("div",{class:"ac-page",children:[r("h1",{children:"Settings changes"}),r("p",{class:"ac-banner ac-banner--error",children:Ut.value})]});if($n.value||cr.value)return r("div",{class:"ac-page ac-settings-changes",children:[r("h1",{children:"Settings changes"}),r("p",{class:"ac-banner",children:$n.value?"Review complete — all changes resolved.":"Nothing to review — your settings are up to date."}),r("button",{type:"button",class:"ac-button",onClick:()=>Jt("/settings"),children:"Back to Settings"})]});const e=ai.value;if(e===null)return r("div",{class:"ac-page",children:r("h1",{children:"Settings changes"})});const n=ls(e),i=Rr().length;return r("div",{class:"ac-page ac-settings-changes",children:[r("header",{class:"ac-page__header",children:[r("h1",{children:"Settings changes"}),r("p",{class:"ac-page__lede",children:["The upgrade ",r("code",{children:e.oldVersion})," → ",r("code",{children:e.newVersion})," changed the available settings. Review below — nothing was changed automatically."]})]}),Le.value!==null?r("p",{class:"ac-banner ac-banner--error",role:"alert",children:Le.value}):null,n.map(l=>r("section",{class:"ac-settings-changes__group",children:[r("h2",{children:[l.title," ",r("span",{class:"ac-settings-changes__count",children:["(",l.changes.length,")"]})]}),l.hint!==void 0?r("p",{class:"ac-settings-changes__hint",children:l.hint}):null,r("ul",{class:"ac-settings-changes__list",children:l.changes.map(o=>r(rs,{change:o},je(o)))})]},l.title)),r("div",{class:"ac-form__actions",children:[r("button",{type:"button",class:"ac-button",disabled:Ce.value,onClick:()=>{is()},children:"Dismiss (keep everything)"}),r("button",{type:"button",class:"ac-button ac-button--primary",disabled:Ce.value||i>0,title:i>0?`${i} “Must fix” item${i===1?"":"s"} unresolved`:void 0,onClick:()=>{ts()},children:Ce.value?"Saving…":"Apply & finish review"})]})]})}const nn=m(null);function os(){return Te(()=>{(async()=>{try{const e=await F("/api/v1/settings/changes");nn.value=e.delta.changes.length}catch{nn.value=null}})()},[]),nn.value===null||nn.value===0?null:r("div",{class:"ac-banner ac-banner--pending",role:"status",children:[r("span",{children:["An upgrade changed ",nn.value," setting",nn.value===1?"":"s"," — review recommended."]}),r("button",{type:"button",class:"ac-button ac-button--small",onClick:()=>Jt("/settings/changes"),children:"Review changes"})]})}const ur=m(!1),Bt=m(null),de=m({}),Ht=m(null),Pn=m(0),Mn=m({}),we=m(null),ze=m(!1),De=m(null),Fn=m(null),_t=m(""),tn=m(!1),mt=m({}),gt=m({global:new Set,project:new Set});function $l(e){if("$ref"in e&&e.$ref!==void 0&&"definitions"in e&&e.definitions!==void 0){const n=e.$ref.replace("#/definitions/",""),i=e.definitions[n];if(i!==void 0)return i}return e}async function Pl(){Bt.value=null;try{const e=await F("/api/v1/settings");de.value=e.values,Ht.value=$l(e.schema),Pn.value=e.lastModified,gt.value={global:new Set(e.sources?.global??[]),project:new Set(e.sources?.project??[])},ur.value=!0}catch(e){if(e instanceof V&&e.status===404&&e.body.error?.code==="NOT_FOUND"){const n=e.body;if(n.defaults!==void 0&&n.schema!==void 0){de.value=n.defaults,Ht.value=$l(n.schema),Pn.value=n.lastModified??0,ur.value=!0;return}}Bt.value=e instanceof Error?e.message:String(e)}}async function cs(){if(!ze.value){we.value=null,Mn.value={};try{const e=await F("/api/v1/settings/diff",{method:"POST",body:{values:de.value,ifUnmodifiedSince:Pn.value}});if(e.changes.length===0){we.value="No changes to save.";return}De.value=e.changes}catch(e){e instanceof V?(Mn.value=Qt(e.body.error??{message:e.message}),we.value=se(e.body.error??{code:"UNKNOWN",message:e.message})):we.value=e instanceof Error?e.message:String(e)}}}async function io(e=!1){ze.value=!0;try{const n=await F("/api/v1/settings",{method:"PUT",headers:{"If-Unmodified-Since":String(Pn.value)},body:e?{values:de.value,confirmSharedWrite:!0}:{values:de.value}});Pn.value=n.lastModified,De.value=null,Fn.value=null,we.value=`Saved (${n.writtenPaths.join(", ")}).`}catch(n){if(n instanceof V){const i=n.body;if(n.status===409&&i.error==="shared-write"){De.value=null,Fn.value={sharedPath:typeof i.sharedPath=="string"?i.sharedPath:"",message:typeof i.message=="string"?i.message:"This write affects a shared agent-switch profile."};return}const l=n.body.error??{code:"UNKNOWN",message:n.message};Mn.value=Qt(l),we.value=se(l),De.value=null;const o=Object.keys(Mn.value)[0];o!==void 0&&queueMicrotask(()=>{const a=document.getElementById(o);a!==null&&a.focus()})}else we.value=n instanceof Error?n.message:String(n)}finally{ze.value=!1}}function Lr(e){if(e.defaultValue===void 0)return!1;const n=qn(de.value,e.path);return n===void 0?!1:JSON.stringify(n)!==JSON.stringify(e.defaultValue)}function ss(e,n){const i=Lr(n),l=gt.value.project.has(e)?"project":gt.value.global.has(e)&&gt.value.project.size>0?"global":void 0;return{modified:i,onReset:i&&n.defaultValue!==void 0?()=>{de.value=Ln(de.value,n.path,n.defaultValue)}:void 0,sourceLabel:l}}function us(e,n){const i=n.toLowerCase();return e.path.join(".").toLowerCase().includes(i)||e.label.toLowerCase().includes(i)||(e.description??"").toLowerCase().includes(i)}function ds(e){const n=_t.value.trim(),i=tn.value,l=e.path.join("."),o=mt.value[l]===!0;let a=e.fields.filter(u=>u.kind!=="unsupported");if(n!==""&&(a=a.filter(u=>us(u,n))),i&&(a=a.filter(u=>Lr(u))),n!==""||i)return a.length===0?null:{section:e,visible:a,hiddenAdvancedCount:0,expanded:o};const s=a.filter(u=>Ll(u.path.join("."))),d=a.filter(u=>!Ll(u.path.join("."))),f=o?[...s,...d]:s;return f.length===0&&d.length===0?null:{section:e,visible:f,hiddenAdvancedCount:o?0:d.length,expanded:o}}function fs(e){mt.value={...mt.value,[e]:mt.value[e]!==!0}}function hs(){const e=He.value?.agentSwitchProfile;if(e===void 0||e.active!==!0)return null;const n=e.provider!==null&&e.profile!==null?`${e.provider}/${e.profile}`:"an unidentified profile";return r("div",{class:"ac-banner",role:"status",children:r("span",{children:["Running under agent-switch profile ",r("code",{children:n})," — settings shown and saved here are profile-scoped. Switching profiles shows that profile's own settings; nothing is lost."]})})}function ps({block:e}){return r("div",{class:"ac-modal",role:"dialog","aria-modal":"true","aria-labelledby":"shared-write-title",children:r("div",{class:"ac-modal__panel",children:[r("h2",{id:"shared-write-title",children:"Shared write — affects all profiles"}),r("p",{children:e.message}),r("p",{children:r("code",{children:e.sharedPath})}),r("div",{class:"ac-modal__actions",children:[r("button",{type:"button",class:"ac-button",onClick:()=>{Fn.value=null},children:"Cancel"}),r("button",{type:"button",class:"ac-button ac-button--primary",disabled:ze.value,onClick:()=>{io(!0)},children:ze.value?"Writing…":"Write (affects all profiles)"})]})]})})}function vs({changes:e}){return r("div",{class:"ac-modal",role:"dialog","aria-modal":"true","aria-labelledby":"diff-title",children:r("div",{class:"ac-modal__panel",children:[r("h2",{id:"diff-title",children:"Confirm changes"}),r("ul",{class:"ac-diff",children:e.map(n=>r("li",{children:[r("code",{children:n.path}),r("span",{class:"ac-diff__before",children:JSON.stringify(n.from)}),r("span",{class:"ac-diff__arrow",children:"→"}),r("span",{class:"ac-diff__after",children:JSON.stringify(n.to)})]},n.path))}),r("div",{class:"ac-modal__actions",children:[r("button",{type:"button",class:"ac-button",onClick:()=>{De.value=null},children:"Cancel"}),r("button",{type:"button",class:"ac-button ac-button--primary",disabled:ze.value,onClick:()=>{io()},children:ze.value?"Saving…":"Save"})]})]})})}function _s(){if(Te(()=>{Pl()},[]),!ur.value||Ht.value===null)return r("div",{class:"ac-page",children:[r("h1",{children:"Settings"}),Bt.value!==null?r("p",{class:"ac-banner ac-banner--error",children:Bt.value}):r("p",{children:"Loading…"})]});const e=va(Ht.value),n=e.map(ds).filter(o=>o!==null),i=e.flatMap(o=>o.fields).filter(o=>Lr(o)).length,l=_t.value.trim()!==""||tn.value;return r("div",{class:"ac-page ac-settings-hub",children:[r("header",{class:"ac-page__header",children:[r("h1",{children:"Settings"}),r("nav",{class:"ac-page__nav",children:r("a",{href:"#/settings/user",children:"Edit .agent-user.yml →"})})]}),r(os,{}),r(hs,{}),r("div",{class:"ac-settings-hub__toolbar",role:"search",children:[r("input",{class:"ac-input ac-settings-hub__search",type:"search",placeholder:"Search all settings (basic and advanced)…",value:_t.value,onInput:o=>{_t.value=o.currentTarget.value}}),r("button",{type:"button",class:`ac-chip-toggle${tn.value?" ac-chip-toggle--active":""}`,"aria-pressed":tn.value,onClick:()=>{tn.value=!tn.value},children:["@modified",i>0?` (${i})`:""]})]}),we.value!==null?r("p",{class:"ac-banner",children:we.value}):null,r("form",{class:"ac-form",onSubmit:o=>o.preventDefault(),children:[n.length===0?r("p",{class:"ac-settings-hub__empty",children:"No settings match."}):n.map(o=>{const a=o.section.path.join(".");return r(_a,{section:{...o.section,fields:o.visible},values:de.value,errors:Mn.value,onChange:s=>{de.value=s},decorate:ss,footer:!l&&(o.hiddenAdvancedCount>0||o.expanded)?r("button",{type:"button",class:"ac-settings-hub__disclosure","aria-expanded":o.expanded,onClick:()=>{fs(a)},children:o.expanded?"Hide advanced settings":`Show ${o.hiddenAdvancedCount} advanced setting${o.hiddenAdvancedCount===1?"":"s"}`}):void 0},a)}),r("div",{class:"ac-form__actions",children:[r("button",{type:"button",class:"ac-button",onClick:()=>{Pl()},children:"Reload"}),r("button",{type:"button",class:"ac-button ac-button--primary",onClick:()=>{cs()},children:"Preview & Save"})]})]}),De.value!==null?r(vs,{changes:De.value}):null,Fn.value!==null?r(ps,{block:Fn.value}):null]})}const qt=m(!1),dn=m(null);async function ms(){Rt.value=!0,Lt.value=null;try{const e=await F("/api/v1/modules/detect");Ar.value=e.candidates,Ha.value=e.project_root;const n={};for(const i of e.candidates)n[i.path]=!0;$t.value=n,Pt.value=e.proposed_block.enabled,Mt.value=e.proposed_block.namespace_template??"",Ft.value=e.proposed_block.agent_folder??"agents"}catch(e){Lt.value=e instanceof V?se(e.body.error??{code:"UNKNOWN",message:e.message}):e instanceof Error?e.message:String(e)}finally{Rt.value=!1,Ac.value=!0}}function gs(){const e=new Set(Ar.value.map(l=>l.path)),n=$t.value,i=Object.keys(n).filter(l=>n[l]===!0&&e.has(l));return{enabled:Pt.value,root_paths:i,namespace_template:Mt.value,agent_folder:Ft.value||"agents"}}async function ys(){qt.value=!0,dn.value=null;try{const e=await F("/api/v1/modules/apply",{method:"POST",body:gs()});dn.value={message:e.appliedTo!==null?`Saved project settings to ${e.appliedTo}.`:`Saved project settings to ${e.projectRoot}.`,tone:"success"}}catch(e){const n=e instanceof V?se(e.body.error??{code:"UNKNOWN",message:e.message}):e instanceof Error?e.message:String(e);dn.value={message:`Could not save project settings: ${n}`,tone:"error"}}finally{qt.value=!1}}function bs(){if(Rt.value)return r("p",{children:"Detecting module roots…"});if(Lt.value!==null)return r("p",{class:"ac-banner ac-banner--error",children:["Module detection failed: ",Lt.value]});const e=Ar.value,n=$t.value,i=Ha.value;return r("div",{class:"ac-section",children:[i!==null?r("p",{class:"ac-section__description",children:["Scanning ",r("code",{children:i}),". Pick which detected roots the agent should treat as modules. These write to",r("code",{children:" .agent-project-settings.yml"})," in this repo only."]}):null,r("label",{children:[r("input",{type:"checkbox",checked:Pt.value,onChange:l=>{Pt.value=l.currentTarget.checked}})," ","Enable module discovery (writes ",r("code",{children:"modules.enabled"}),")"]}),e.length===0?r("p",{children:[r("em",{children:"No module roots detected."})," The scan found no common module layouts (Laravel ",r("code",{children:"app/Modules/"}),", Symfony",r("code",{children:" src/Module/"}),", Node ",r("code",{children:"packages/"}),", Python",r("code",{children:" src/"}),", Go ",r("code",{children:"internal/"}),")."]}):r("ul",{style:"list-style: none; padding-left: 0;",children:e.map(l=>r("li",{children:r("label",{children:[r("input",{type:"checkbox",checked:n[l.path]??!1,onChange:o=>{const a=o.currentTarget.checked;$t.value={...n,[l.path]:a}}})," ",r("code",{children:l.path})," — ",l.stack," ",r("small",{children:["(",l.confidence," confidence)"]})]})},l.path))}),r("div",{class:"ac-wizard__module-fields",children:[r("div",{class:"ac-field",children:[r("label",{class:"ac-field__label",for:"ac-modules-namespace",children:"Namespace template"}),r("input",{id:"ac-modules-namespace",class:"ac-input",type:"text",value:Mt.value,placeholder:"e.g. App\\\\Modules\\\\{ModuleName}\\\\App",onInput:l=>{Mt.value=l.currentTarget.value}}),r("span",{class:"ac-field__description",children:"How a module path maps to its namespace. Leave blank to skip namespacing."})]}),r("div",{class:"ac-field",children:[r("label",{class:"ac-field__label",for:"ac-modules-agent-folder",children:"Agent folder"}),r("input",{id:"ac-modules-agent-folder",class:"ac-input",type:"text",value:Ft.value,placeholder:"agents",onInput:l=>{Ft.value=l.currentTarget.value}}),r("span",{class:"ac-field__description",children:["Folder name that holds per-module agent docs (default ",r("code",{children:"agents"}),")."]})]})]})]})}function ks(){return Te(()=>{ms()},[]),r("div",{class:"ac-page",children:[r("header",{class:"ac-page__header",children:[r("h1",{children:"Project settings"}),r("p",{class:"ac-section__description",children:["Configuration scoped to this repository — written to",r("code",{children:" .agent-project-settings.yml"}),", not the global tree."]})]}),dn.value!==null?r("p",{class:`ac-banner ac-banner--${dn.value.tone==="success"?"success":"error"}`,children:dn.value.message}):null,r("section",{class:"ac-section",children:[r("h2",{class:"ac-section__title",children:"Modules"}),r(bs,{})]}),r("div",{class:"ac-form__actions ac-wizard__nav",children:r("button",{type:"button",class:"ac-button ac-button--primary",disabled:qt.value||Rt.value,onClick:()=>{ys()},children:qt.value?"Saving…":"Save project settings"})})]})}const yt=m([]),jn=m([]),dr=m([]),fr=m([]),Wt=m(null),ro=m(!1),En=m(null),oe=m(null),Bi=m("plain"),Yt=m({}),lo=m([]),Ml={"claude-code":"Claude Code",codex:"Codex",gemini:"Gemini"};function ws(){try{return globalThis.sessionStorage?.getItem("ac-workspace-host")??"claude-code"}catch{return"claude-code"}}const $r=m(ws());function Ss(e){$r.value=e;try{globalThis.sessionStorage?.setItem("ac-workspace-host",e)}catch{}}const Dn=m([]),be=m(null),an=m({}),Ue=m(!1),Un=m(null),Pe=m(""),On=m(!1),oi=m(!1),hr=m(null),Be=m(null),Bn=m([]),bt=m(new Set),ao="claude-code",Fl=2e3;async function As(){En.value=null;try{const[e,n,i,l,o,a]=await Promise.all([F("/api/v1/workspace/roles"),F("/api/v1/workspace/sessions?limit=20"),F("/api/v1/workspace/knowledge?limit=20"),F("/api/v1/workspace/documents?limit=20"),F("/api/v1/workspace/drive-health").catch(()=>({health:{}})),F("/api/v1/workspace/hosts").catch(()=>({hosts:[]}))]);yt.value=e.roles,jn.value=n.sessions,dr.value=i.chunks,fr.value=l.documents,Yt.value=o.health??{},lo.value=a.hosts??[],ro.value=!0}catch(e){e instanceof V?En.value=e.body?.error?.message??e.message:En.value=e instanceof Error?e.message:String(e)}}async function Cs(e,n){try{const i=await F(`/api/v1/workspace/roles/${e}/tasks`);Dn.value=i.tasks}catch{Dn.value=n}}async function Pr(e){Be.value=e,bt.value=new Set;try{const n=await F(`/api/v1/workspace/sessions/${e}`);Bn.value=Array.isArray(n.log)?n.log:[]}catch{Bn.value=[]}}async function xs(e){oe.value=null,oi.value=!1,Pe.value="",be.value=null,await Pr(e)}async function oo(e,n,i){oe.value=null,Ue.value=!0,Pe.value="",oi.value=!1,hr.value={role:e,task:n,inputs:i};try{const l=await F("/api/v1/workspace/launch",{method:"POST",body:{role:e,task:n,inputs:i,host:$r.value}});Un.value=l,oe.value=co(l),be.value=null,await Pr(l.id);const o=await F("/api/v1/workspace/sessions?limit=20");jn.value=o.sessions,await Mr()}catch(l){Un.value=null,l instanceof V?oe.value=l.body?.error?.message??l.message:oe.value=l instanceof Error?l.message:String(l)}finally{Ue.value=!1}}async function Ts(e,n){if(!(n.trim()===""||On.value)){On.value=!0,oe.value=null;try{const i=await F(`/api/v1/workspace/sessions/${e}/continue`,{method:"POST",body:{prompt:n}});Un.value=i,oe.value=co(i),i.driven&&(Pe.value=""),await Pr(e);const l=await F("/api/v1/workspace/sessions?limit=20");jn.value=l.sessions,await Mr()}catch(i){i instanceof V&&i.status===410?(oi.value=!0,oe.value="Host session expired — start a new conversation."):i instanceof V?oe.value=i.body?.error?.message??i.message:oe.value=i instanceof Error?i.message:String(i)}finally{On.value=!1}}}async function Mr(){try{const e=await F("/api/v1/workspace/drive-health");Yt.value=e.health??{}}catch{}}async function Es(e){try{await F(`/api/v1/workspace/drive-health/${e}/reset`,{method:"POST"}),await Mr()}catch{}}function co(e){return e.driven?e.recovered===!0?`Host recovered — drove the turn for ${e.role} · ${e.task}.`:`Drove the turn for ${e.role} · ${e.task}.`:e.host_killed===!0?`Host ${ao} is paused after repeated failures — handed off to the inbox.`:e.error_kind==="render-error"?`Couldn't fill the prompt: ${e.error??"missing input"}.`:e.reason==="no-prompt-for-task"?"Recorded the session — this task has no runnable prompt yet.":typeof e.handoff=="string"?`Prepared a hand-off — open ${e.handoff} and paste it into your host.`:`Recorded the session ${e.id} (${e.role} · ${e.task}).`}function Os({role:e}){const n=Wt.value===e.slug;return r("button",{type:"button",class:`ac-workspace__role${n?" ac-workspace__role--active":""}`,"aria-current":n?"true":void 0,"aria-label":`Pick role ${e.display_name}`,onClick:()=>{Wt.value=e.slug,oe.value=null,Un.value=null,be.value=null,an.value={},Dn.value=e.first_tasks,Cs(e.slug,e.first_tasks)},children:[r("span",{class:"ac-workspace__role-name",children:e.display_name}),r("span",{class:"ac-workspace__role-status","data-status":e.status,children:e.status}),r("span",{class:"ac-workspace__role-tagline",children:e.tagline})]})}function Ns({role:e,task:n}){const i=n.inputs??[],l=an.value,o=i.some(a=>a.required&&(l[a.name]??"").trim()==="");return r("form",{class:"ac-workspace__task-form",onSubmit:a=>{a.preventDefault(),!o&&!Ue.value&&oo(e,n.name,an.value)},children:[i.length===0?r("p",{class:"ac-workspace__form-note",children:"No inputs — runs the prompt as-is."}):i.map(a=>r("label",{class:"ac-workspace__field",children:[r("span",{class:"ac-workspace__field-label",children:[a.name,a.required?r("span",{class:"ac-workspace__req","aria-hidden":"true",children:" *"}):null]}),r("textarea",{class:"ac-workspace__field-input",placeholder:a.shape,required:a.required,"aria-label":`${a.name}${a.required?" (required)":""}`,value:l[a.name]??"",onInput:s=>{an.value={...an.value,[a.name]:s.target.value}}})]},a.name)),r("div",{class:"ac-workspace__form-actions",children:[r("button",{type:"submit",class:"ac-button ac-button--primary",disabled:o||Ue.value,children:Ue.value?"Running…":"Run task"}),r("button",{type:"button",class:"ac-button",onClick:()=>{be.value=null},children:"Cancel"})]})]})}function Is(e){const n=[];for(const i of e){const l=i.data??{};if(i.kind==="launcher.input")l.followup===!0?n.push({kind:"user",text:typeof l.prompt=="string"?l.prompt:""}):n.push({kind:"task",text:typeof l.task=="string"?l.task:""});else if(i.kind==="host.turn"){const o=l.usage,a=o!=null?`${typeof l.model=="string"?l.model:ao} · in ${o.input_tokens??0} / out ${o.output_tokens??0} tokens`:void 0;n.push({kind:"assistant",text:typeof l.text=="string"?l.text:"",meta:a})}else if(i.kind==="host.error"){const o=typeof l.error_kind=="string"?l.error_kind:"error";n.push({kind:"error",text:`${o}: ${typeof l.error=="string"?l.error:""}`})}}return n}function Rs(){if(Be.value===null)return null;const e=Is(Bn.value),n=Bn.value.some(i=>i.kind==="host.turn");return r("section",{class:"ac-workspace__thread","aria-label":"Conversation thread",children:[r("h2",{class:"ac-workspace__heading",children:"Conversation"}),e.length===0?r("p",{class:"ac-workspace__empty",children:"No turns yet."}):r("ol",{class:"ac-workspace__thread-list",children:e.map((i,l)=>{const o=i.kind==="assistant"&&i.text.length>Fl,a=bt.value.has(l),s=o&&!a?`${i.text.slice(0,Fl)}…`:i.text;return r("li",{class:`ac-workspace__thread-block ac-workspace__thread-block--${i.kind}`,children:[r("span",{class:"ac-workspace__thread-role",children:i.kind==="task"?"Task":i.kind==="user"?"You":i.kind==="assistant"?"Host":"Error"}),r("pre",{class:"ac-workspace__thread-text",children:s}),o?r("button",{type:"button",class:"ac-button",onClick:()=>{const d=new Set(bt.value);d.has(l)?d.delete(l):d.add(l),bt.value=d},children:a?"Show less":"Show full"}):null,i.meta!=null?r("p",{class:"ac-workspace__turn-meta",children:i.meta}):null]},l)})}),oi.value?r("div",{class:"ac-workspace__followup-gone",role:"status",children:[r("p",{children:"Host session expired."}),hr.value!==null?r("button",{type:"button",class:"ac-button ac-button--primary",disabled:Ue.value,onClick:()=>{const i=hr.value;i!==null&&oo(i.role,i.task,i.inputs)},children:Ue.value?"Starting…":"Start a new conversation"}):r("p",{children:"Pick a task above to start a new conversation."})]}):n?r("form",{class:"ac-workspace__followup",onSubmit:i=>{i.preventDefault(),Be.value!==null&&Ts(Be.value,Pe.value)},children:[r("label",{class:"ac-workspace__field",children:[r("span",{class:"ac-workspace__field-label",children:"Follow up"}),r("textarea",{class:"ac-workspace__field-input",placeholder:"Continue this conversation — e.g. make it shorter","aria-label":"Follow-up prompt",value:Pe.value,onInput:i=>{Pe.value=i.target.value}})]}),r("button",{type:"submit",class:"ac-button ac-button--primary",disabled:Pe.value.trim()===""||On.value,children:On.value?"Continuing…":"Send follow-up"})]}):null]})}function Ls({role:e}){const n=Dn.value.length>0?Dn.value:e.first_tasks;return r("section",{class:"ac-workspace__tasks","aria-labelledby":"task-heading",children:[r("h2",{id:"task-heading",class:"ac-workspace__heading",children:["First tasks · ",e.display_name]}),n.length===0?r("p",{class:"ac-workspace__empty",children:"No tasks scaffolded yet for this role."}):r("ul",{class:"ac-workspace__task-list",children:n.map(i=>r("li",{class:"ac-workspace__task",children:[r("div",{class:"ac-workspace__task-head",children:[r("span",{class:"ac-workspace__task-name",children:i.name}),r("button",{type:"button",class:"ac-button ac-button--primary","aria-expanded":be.value===i.name,onClick:()=>{be.value=be.value===i.name?null:i.name,an.value={},Un.value=null,Be.value=null,Bn.value=[]},children:be.value===i.name?"Close":"Start session"})]}),r("p",{class:"ac-workspace__task-intent",children:i.intent}),i.prompt!==""?r("code",{class:"ac-workspace__task-prompt",children:["prompts/",i.prompt]}):null,be.value===i.name?r(Ns,{role:e.slug,task:i}):null]},i.name))}),e.skills.length>0?r("details",{class:"ac-workspace__skills",children:[r("summary",{children:["Skill shortlist (",e.skills.length,")"]}),r("ul",{class:"ac-workspace__skill-list",children:[e.skills.slice(0,5).map(i=>r("li",{class:"ac-workspace__skill",children:[r("code",{children:i.id})," — ",i.why]},i.id)),e.skills.length>5?r("li",{class:"ac-workspace__skill-more",children:["+ ",e.skills.length-5," more"]}):null]})]}):null]})}function $s(){return r("section",{class:"ac-workspace__sessions","aria-labelledby":"sessions-heading",children:[r("h2",{id:"sessions-heading",class:"ac-workspace__heading",children:"Recent sessions"}),jn.value.length===0?r("p",{class:"ac-workspace__empty",children:"No sessions yet — pick a role and start one."}):r("ul",{class:"ac-workspace__session-list",children:jn.value.map(e=>r("li",{class:"ac-workspace__session",children:r("button",{type:"button",class:`ac-workspace__session-open${Be.value===e.id?" ac-workspace__session-open--active":""}`,"aria-label":`Open session ${e.task}`,"aria-current":Be.value===e.id?"true":void 0,onClick:()=>{xs(e.id)},children:[r("span",{class:"ac-workspace__session-id",children:e.id.slice(0,16)}),r("span",{class:"ac-workspace__session-role",children:e.role}),r("span",{class:"ac-workspace__session-task",children:e.task})]})},e.id))})]})}function Ps(){return r("section",{class:"ac-workspace__knowledge","aria-labelledby":"knowledge-heading",children:[r("h2",{id:"knowledge-heading",class:"ac-workspace__heading",children:"Knowledge sources"}),dr.value.length===0?r("p",{class:"ac-workspace__empty",children:["No sources yet. Run ",r("code",{children:"/knowledge:ingest <path>"})," to add documents."]}):r("ol",{class:"ac-workspace__citation-list",children:dr.value.map((e,n)=>r("li",{class:"ac-workspace__citation",children:[r("span",{class:"ac-workspace__citation-marker","aria-label":`Citation ${n+1}`,children:["[",n+1,"]"]}),r("a",{href:`file://${e.source}`,class:"ac-workspace__citation-source",title:"Open source in OS default app",children:e.source.split("/").pop()??e.source}),e.pinned?r("span",{class:"ac-workspace__citation-pin","aria-label":"pinned",children:"★"}):null,r("p",{class:"ac-workspace__citation-excerpt",children:[e.excerpt.slice(0,200),e.excerpt.length>200?"…":""]})]},e.id))})]})}function Ms(){return r("section",{class:"ac-workspace__recent","aria-labelledby":"recent-heading",children:[r("h2",{id:"recent-heading",class:"ac-workspace__heading",children:"Recent documents"}),fr.value.length===0?r("p",{class:"ac-workspace__empty",children:"No documents yet. Saved drafts land here."}):r("ul",{class:"ac-workspace__doc-list",children:fr.value.map(e=>r("li",{class:"ac-workspace__doc",children:[r("span",{class:"ac-workspace__doc-type","data-type":e.type,children:e.type}),r("span",{class:"ac-workspace__doc-title",children:e.title}),r("time",{class:"ac-workspace__doc-time",dateTime:e.updated_at,children:e.updated_at.slice(0,10)})]},`${e.type}/${e.slug}`))})]})}function Fs(){const n=Object.values(Yt.value).filter(i=>i.killed||i.consecutive_failures>0);return r("section",{class:"ac-workspace__drive-health","aria-labelledby":"drive-health-heading",children:[r("h2",{id:"drive-health-heading",class:"ac-workspace__heading",children:"Host health"}),n.length===0?r("p",{class:"ac-workspace__empty",children:"All hosts healthy."}):r("ul",{class:"ac-workspace__health-list",children:Object.entries(Yt.value).filter(([,i])=>i.killed||i.consecutive_failures>0).map(([i,l])=>{const o=l.killed?l.kill_reason==="manual"?"paused (manual)":"paused — auto-recovering":"degraded";return r("li",{class:"ac-workspace__health","data-killed":l.killed?"true":"false",children:[r("span",{class:"ac-workspace__health-host",children:i}),r("span",{class:"ac-workspace__health-state",children:o}),r("span",{class:"ac-workspace__health-meta",children:[l.consecutive_failures," fail streak",l.last_error_kind!=null?` · ${l.last_error_kind}`:""]}),l.killed?r("button",{type:"button",class:"ac-button ac-workspace__health-reset","aria-label":`Reset ${i}`,onClick:()=>{Es(i)},children:"Reset"}):null]},i)})})]})}function js(){const e=Bi.value;return r("fieldset",{class:"ac-workspace__explain",children:[r("legend",{class:"ac-workspace__heading",children:"Explanation style"}),r("label",{class:"ac-workspace__explain-option",children:[r("input",{type:"radio",name:"explain-mode",value:"plain",checked:e==="plain",onChange:()=>{Bi.value="plain"},"aria-label":"Plain language"}),r("span",{children:"Plain language"})]}),r("label",{class:"ac-workspace__explain-option",children:[r("input",{type:"radio",name:"explain-mode",value:"technical",checked:e==="technical",onChange:()=>{Bi.value="technical"},"aria-label":"Technical detail"}),r("span",{children:"Technical detail"})]}),r("p",{class:"ac-workspace__explain-hint",children:e==="plain"?"Replies use everyday words. Toggle to see the technical view.":"Replies keep the technical vocabulary. Toggle for the plain view."})]})}function Ds(){const e=lo.value,n=e.length>0?e.map(l=>l.id):Object.keys(Ml),i=new Map(e.map(l=>[l.id,l.cli_present]));return r("label",{class:"ac-workspace__host-picker",children:[r("span",{class:"ac-workspace__host-label",children:"Host"}),r("select",{class:"ac-workspace__host-select","aria-label":"Host agent",value:$r.value,onChange:l=>{Ss(l.target.value)},children:n.map(l=>{const o=i.get(l)!==!1,a=Ml[l]??l;return r("option",{value:l,disabled:!o,children:[a," (",l,")",o?"":" — not installed"]},l)})})]})}function Us(){if(Te(()=>{As()},[]),En.value!==null)return r("div",{class:"ac-page ac-page--error",children:[r("h1",{children:"Workspace"}),r("p",{class:"ac-banner ac-banner--error",children:En.value})]});if(!ro.value)return r("div",{class:"ac-page",children:[r("h1",{children:"Workspace"}),r("p",{children:"Loading…"})]});const e=Wt.value!==null?yt.value.find(n=>n.slug===Wt.value)??null:null;return r("div",{class:"ac-page ac-workspace",children:[r("header",{class:"ac-page__header",children:[r("h1",{children:"Workspace"}),r("p",{class:"ac-page__subtitle",children:"Pick a role, pick a first task, run it."}),r(Ds,{})]}),oe.value!==null?r("p",{class:"ac-banner",role:"status",children:oe.value}):null,r("div",{class:"ac-workspace__grid",children:[r("section",{class:"ac-workspace__roles","aria-labelledby":"roles-heading",children:[r("h2",{id:"roles-heading",class:"ac-workspace__heading",children:"Roles"}),yt.value.length===0?r("p",{class:"ac-workspace__empty",children:"No roles installed."}):r("div",{class:"ac-workspace__role-grid",children:yt.value.map(n=>r(Os,{role:n},n.slug))})]}),r("main",{class:"ac-workspace__main","aria-label":"Tasks and sessions",children:[e!==null?r(Ls,{role:e}):r("p",{class:"ac-workspace__empty",children:"Pick a role on the left to see its first tasks."}),r(Rs,{}),r($s,{})]}),r("aside",{class:"ac-workspace__rail","aria-label":"Knowledge and documents",children:[r(Ps,{}),r(Ms,{}),r(Fs,{}),r(js,{})]})]})]})}const so="agent-config-theme";function Bs(){return(typeof document<"u"?document.documentElement.getAttribute("data-theme"):null)==="dark"?"dark":"light"}const Nn=m(Bs());function Hs(){try{const e=localStorage.getItem(so);return e==="light"||e==="dark"?e:null}catch{return null}}function qs(){if(typeof window>"u")return null;try{const e=new URLSearchParams(window.location.search).get("theme");return e==="light"||e==="dark"?e:null}catch{return null}}function Ws(){return Hs()===null&&qs()===null}function uo(e){Nn.value=e,document.documentElement.setAttribute("data-theme",e)}function Ys(){const e=Nn.value==="dark"?"light":"dark";try{localStorage.setItem(so,e)}catch{}uo(e)}function zs(){if(typeof window>"u"||typeof window.matchMedia!="function")return;const e=window.matchMedia("(prefers-color-scheme: dark)"),n=()=>{Ws()&&uo(e.matches?"dark":"light")};typeof e.addEventListener=="function"&&e.addEventListener("change",n)}function Ks(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("embed")==="1"}const Gs=Ks(),fo=[{id:"setup",label:"Setup",hashPath:"/setup",matches:["/setup","/wizard"]},{id:"settings",label:"Settings",hashPath:"/settings",matches:["/settings"]},{id:"project",label:"Project",hashPath:"/project",matches:["/project"]},{id:"workspace",label:"Workspace",hashPath:"/workspace",matches:["/workspace"]}];function ho(e){for(const n of fo)for(const i of n.matches)if(e===i||e.startsWith(`${i}/`))return n.id;return null}function Vs(e){const n=He.value,i=ho(e);return fo.filter(l=>l.id==="project"?n?.projectSurface===!0||i==="project":l.id==="workspace"?n?.devSurfaces===!0||i==="workspace":!0)}function Js(){const e=Et.value,n=ho(e);return r("header",{class:"ac-topnav",children:r("div",{class:"ac-topnav__inner",children:[r("div",{class:"ac-topnav__brand",children:[r("h1",{class:"ac-topnav__title",children:"@event4u/agent-config"}),r("p",{class:"ac-topnav__subtitle",children:"Browser Wizard"})]}),r("nav",{class:"ac-topnav__tabs","aria-label":"Surfaces",children:Vs(e).map(i=>r("button",{type:"button",class:`ac-topnav__tab${n===i.id?" ac-topnav__tab--active":""}`,"aria-current":n===i.id?"page":void 0,onClick:()=>Jt(i.hashPath),children:i.label},i.id))}),r("button",{type:"button",class:"ac-topnav__theme","aria-label":Nn.value==="dark"?"Switch to light theme":"Switch to dark theme",title:Nn.value==="dark"?"Switch to light theme":"Switch to dark theme",onClick:()=>{Ys()},children:Nn.value==="dark"?"☀":"☾"})]})})}function Qs({path:e}){return r("div",{class:"ac-page ac-page--error",children:[r("h1",{children:"Page not found"}),r("p",{children:["Nothing routed to ",r("code",{children:e}),". Try ",r("a",{href:"#/setup",children:"Setup"}),"."]})]})}function Zs(){const e=He.value;return e===null||e.dryRun!==!0?null:r("div",{class:"ac-dryrun-banner",role:"status","aria-live":"polite",children:[r("strong",{children:"DRY RUN"}),r("span",{children:" · no files will be written. Validation + rendering run normally; commits return a preview."})]})}function Xs(e){return e==="/"||e==="/setup"||e.startsWith("/setup/")?r(Rl,{path:e}):e.startsWith("/wizard")?r(Rl,{path:e}):e==="/settings/changes"?r(as,{}):e==="/settings"||e.startsWith("/settings/")?r(_s,{}):e==="/project"||e.startsWith("/project/")?r(ks,{}):e==="/workspace"?r(Us,{}):r(Qs,{path:e})}function eu(){return Te(()=>{Po(),Et.value==="/"&&Jt("/setup"),jo()},[]),r(te,{children:[r(Zs,{}),Gs?null:r(Js,{}),Xs(Et.value)]})}const nu=3e4,tu=30*6e4;let ut=null,jl=!1;function Dl(e){if(!jl&&(jl=!0,!(typeof navigator>"u"||typeof navigator.sendBeacon!="function")))try{navigator.sendBeacon(`/api/v1/shutdown?token=${encodeURIComponent(e)}`)}catch{}}function iu(e){if(typeof window>"u")return()=>{};let n=Date.now();const i=()=>{n=Date.now()},l=["pointerdown","keydown","wheel","touchstart"];for(const d of l)window.addEventListener(d,i,{passive:!0});const o=()=>{document.hidden||i()};document.addEventListener("visibilitychange",o);const a=()=>{ut!==null&&clearInterval(ut),ut=null;for(const d of l)window.removeEventListener(d,i);document.removeEventListener("visibilitychange",o),window.removeEventListener("pagehide",s)};ut=setInterval(()=>{if(!document.hidden){if(Date.now()-n>tu){Dl(e),a();return}F("/api/v1/ping").catch(()=>{})}},nu);function s(){Dl(e)}return window.addEventListener("pagehide",s),a}function ru(){if(typeof window>"u"||typeof window.history?.replaceState!="function")return;const e=new URLSearchParams(window.location.search);if(!e.has("token"))return;e.delete("token");const n=e.toString(),i=window.location.pathname+(n?`?${n}`:"")+window.location.hash;window.history.replaceState(window.history.state,"",i)}function lu(){return new URLSearchParams(window.location.search).get("token")}function au(){const e=document.getElementById("app");if(e===null)return;const n=lu();if(n===null){e.textContent="agent-config UI · missing token — re-open via `agent-config ui:serve`.";return}Mo(n),ru(),iu(n),zs(),e.textContent="",ko(r(eu,{}),e)}au();
40
- //# sourceMappingURL=index-DJY_vQVn.js.map