@event4u/agent-config 9.29.0 → 9.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +108 -7
- package/README.md +1 -0
- package/dist/agent-src/commands/analyze/inbox.md +22 -1
- package/dist/agent-src/commands/explain-run.md +31 -1
- package/dist/agent-src/commands/team/delegate.md +1 -0
- package/dist/agent-src/contexts/execution/orchestration-telemetry.md +4 -1
- package/dist/agent-src/contexts/execution/roadmap-process-loop.md +17 -0
- package/dist/agent-src/contexts/execution/subagent-response-contract.md +11 -1
- package/dist/agent-src/rules/preservation-guard.md +9 -0
- package/dist/agent-src/scripts/roadmap_gates.ts +312 -0
- package/dist/agent-src/scripts/update_roadmap_progress.ts +72 -4
- package/dist/agent-src/skills/subagent-orchestration/SKILL.md +10 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/cli/registry.js +2 -0
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/{chunk-OJM3MBJM.js → chunk-BTJNRUX3.js} +21 -34
- package/dist/cli-delegate/{chunk-MMXA5GY7.js → chunk-DDUNNFYX.js} +14 -0
- package/dist/cli-delegate/{chunk-NZ5N2XQL.js → chunk-EQY4FLJB.js} +1 -1
- package/dist/cli-delegate/{chunk-RCIA67XN.js → chunk-IYTGIG2Y.js} +44 -1
- package/dist/cli-delegate/chunk-MMJL4TIX.js +18 -0
- package/dist/cli-delegate/chunk-O3CO5BFB.js +161 -0
- package/dist/cli-delegate/{chunk-REKCMYOU.js → chunk-PFBV6XRT.js} +36 -20
- package/dist/cli-delegate/chunk-RVGBH4XK.js +142 -0
- package/dist/cli-delegate/cmd_conformance.js +2798 -95
- package/dist/cli-delegate/cmd_doctor.js +2 -1
- package/dist/cli-delegate/cmd_export.js +2 -2
- package/dist/cli-delegate/cmd_handoff.js +86 -6
- package/dist/cli-delegate/cmd_prune.js +2 -2
- package/dist/cli-delegate/cmd_route_audit.js +2 -1
- package/dist/cli-delegate/cmd_session_recycle.js +177 -0
- package/dist/cli-delegate/cmd_settings_get.js +1 -1
- package/dist/cli-delegate/cmd_settings_migrate.js +2 -2
- package/dist/cli-delegate/cmd_settings_set.js +2 -2
- package/dist/cli-delegate/cmd_sync.js +2 -2
- package/dist/cli-delegate/cmd_uninstall.js +2 -2
- package/dist/cli-delegate/cmd_validate.js +2 -2
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +7 -7
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +2 -2
- package/dist/discovery/trust-report.md +1 -1
- package/dist/discovery/workspaces.json +2 -2
- package/dist/hooks/dispatch.js +1904 -575
- package/dist/install/install.mjs +14 -0
- package/dist/mcp/registry-manifest.json +2 -2
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +3760 -726
- package/dist/server/schemas/settings.js +6 -0
- package/dist/server/schemas/settings.js.map +1 -1
- package/dist/ui/assets/index-B5qGYOJo.js +26 -0
- package/dist/ui/assets/index-B5qGYOJo.js.map +1 -0
- package/dist/ui/index.html +1 -1
- package/docs/contracts/settings-classes.md +21 -5
- package/package.json +1 -1
- package/src/agent-src/scripts/roadmap_gates.ts +312 -0
- package/src/agent-src/scripts/update_roadmap_progress.ts +72 -4
- package/src/config/agent-settings.template.yml +36 -0
- package/src/config/dispatch-economy-metrics.json +61 -0
- package/src/config/evaluator-budgets.json +4 -4
- package/src/config/hook-token-budget.json +91 -0
- package/src/config/recycle-threshold-budget.json +12 -0
- package/src/config/rule-enforcement-baseline.json +86 -0
- package/src/scripts/_cli/cmd_conformance.ts +17 -2
- package/src/scripts/_cli/cmd_session_recycle.ts +226 -0
- package/src/scripts/_dispatch.bash +23 -0
- package/src/scripts/_lib/judgment_ladder.ts +254 -2
- package/src/scripts/_lib/orchestration_record.ts +41 -10
- package/src/scripts/_lib/recycle_envelope_paths.ts +35 -0
- package/src/scripts/_lib/self_repair.ts +194 -0
- package/src/scripts/_lib/session_eol.ts +230 -0
- package/src/scripts/_lib/session_role.ts +42 -0
- package/src/scripts/_lib/subagent_capsule.ts +159 -0
- package/src/scripts/_lib/subagent_response.ts +75 -0
- package/src/scripts/ai_council/clients.ts +50 -1
- package/src/scripts/ask_transport.ts +221 -0
- package/src/scripts/bench_hook_injection.ts +234 -0
- package/src/scripts/check_adr_frontmatter.ts +84 -40
- package/src/scripts/check_branch_freshness.ts +1 -0
- package/src/scripts/check_corpus_staleness.ts +18 -4
- package/src/scripts/check_detector_corpus.ts +17 -0
- package/src/scripts/check_gitignore_freshness.ts +42 -8
- package/src/scripts/check_hook_bundle_freshness.ts +20 -0
- package/src/scripts/check_kernel_prefix_stability.ts +1 -0
- package/src/scripts/check_standing_rule_delivery.ts +73 -32
- package/src/scripts/check_static_layer_stability.ts +154 -0
- package/src/scripts/check_suppression_hygiene.ts +48 -0
- package/src/scripts/dispatch_economy_report.ts +448 -0
- package/src/scripts/dispatch_r2_reviewer.ts +15 -2
- package/src/scripts/explain_run.ts +206 -4
- package/src/scripts/generate_settings_reference.ts +1 -0
- package/src/scripts/handoff_context_hook.ts +112 -4
- package/src/scripts/hook_manifest.yaml +117 -10
- package/src/scripts/hooks/concern_registry.ts +8 -0
- package/src/scripts/hooks/delegation_nudge_hook.ts +40 -3
- package/src/scripts/hooks/dispatch_hook.ts +39 -2
- package/src/scripts/hooks/edit_shape_hook.ts +303 -0
- package/src/scripts/hooks/orchestration_record_hook.ts +19 -1
- package/src/scripts/hooks/reread_guard_hook.ts +314 -0
- package/src/scripts/hooks/rtk_wrap_hook.ts +133 -14
- package/src/scripts/hooks/session_eol_hook.ts +268 -0
- package/src/scripts/hooks/turn_end_gate_hook.ts +507 -0
- package/src/scripts/install-hooks.sh +1 -1
- package/src/scripts/language_mirror_hook.ts +89 -0
- package/src/scripts/lint_decision_impact.ts +14 -1
- package/src/scripts/lint_hook_manifest.ts +82 -0
- package/src/scripts/lint_readme_serial_comma.ts +1 -0
- package/src/scripts/lint_rule_enforcement_declaration.ts +347 -0
- package/src/scripts/measure_turn_end_gate.ts +194 -0
- package/src/scripts/orchestration_record.ts +4 -1
- package/src/scripts/rebuild_hook_bundle.ts +1 -0
- package/src/scripts/report_conformance_funnel.ts +284 -0
- package/src/scripts/report_imperative_density.ts +1 -0
- package/src/scripts/routing_doctor.ts +97 -0
- package/src/scripts/self_repair_cli.ts +51 -3
- package/src/scripts/session_eol_report.ts +261 -0
- package/src/server/schemas/settings.ts +14 -0
- package/src/templates/compact-instructions.md +40 -0
- package/dist/ui/assets/index-JDAF00bC.js +0 -26
- package/dist/ui/assets/index-JDAF00bC.js.map +0 -1
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const l of r)if(l.type==="childList")for(const o of l.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const l={};return r.integrity&&(l.integrity=r.integrity),r.referrerPolicy&&(l.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?l.credentials="include":r.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(r){if(r.ep)return;r.ep=!0;const l=t(r);fetch(r.href,l)}})();var ht,T,Ua,Ba,ie,Zi,za,Wa,Lt,xn,Je,Ha,Si,Yt,qt,jn={},Dn=[],cl=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,pt=Array.isArray;function V(e,n){for(var t in n)e[t]=n[t];return e}function Ci(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function ul(e,n,t){var i,r,l,o={};for(l in n)l=="key"?i=n[l]:l=="ref"?r=n[l]:o[l]=n[l];if(arguments.length>2&&(o.children=arguments.length>3?ht.call(arguments,2):t),typeof e=="function"&&e.defaultProps!=null)for(l in e.defaultProps)o[l]===void 0&&(o[l]=e.defaultProps[l]);return Nn(e,o,i,r,null)}function Nn(e,n,t,i,r){var l={type:e,props:n,key:t,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Ua,__i:-1,__u:0};return r==null&&T.vnode!=null&&T.vnode(l),l}function L(e){return e.children}function Xe(e,n){this.props=e,this.context=n}function Ue(e,n){if(n==null)return e.__?Ue(e.__,e.__i+1):null;for(var t;n<e.__k.length;n++)if((t=e.__k[n])!=null&&t.__e!=null)return t.__e;return typeof e.type=="function"?Ue(e):null}function dl(e){if(e.__P&&e.__d){var n=e.__v,t=n.__e,i=[],r=[],l=V({},n);l.__v=n.__v+1,T.vnode&&T.vnode(l),Ti(e.__P,l,n,e.__n,e.__P.namespaceURI,32&n.__u?[t]:null,i,t??Ue(n),!!(32&n.__u),r),l.__v=n.__v,l.__.__k[l.__i]=l,Ga(i,l,r),n.__e=n.__=null,l.__e!=t&&Ya(l)}}function Ya(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}),Ya(e)}function Qi(e){(!e.__d&&(e.__d=!0)&&ie.push(e)&&!Un.__r++||Zi!=T.debounceRendering)&&((Zi=T.debounceRendering)||za)(Un)}function Un(){try{for(var e,n=1;ie.length;)ie.length>n&&ie.sort(Wa),e=ie.shift(),n=ie.length,dl(e)}finally{ie.length=Un.__r=0}}function qa(e,n,t,i,r,l,o,s,u,c,d){var g,f,p,v,_,k,w,b=i&&i.__k||Dn,F=n.length;for(u=fl(t,n,b,u,F),g=0;g<F;g++)(p=t.__k[g])!=null&&(f=p.__i!=-1&&b[p.__i]||jn,p.__i=g,k=Ti(e,p,f,r,l,o,s,u,c,d),v=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&Ai(f.ref,null,p),d.push(p.ref,p.__c||v,p)),_==null&&v!=null&&(_=v),(w=!!(4&p.__u))||f.__k===p.__k?(u=Ka(p,u,e,w),w&&f.__e&&(f.__e=null)):typeof p.type=="function"&&k!==void 0?u=k:v&&(u=v.nextSibling),p.__u&=-7);return t.__e=_,u}function fl(e,n,t,i,r){var l,o,s,u,c,d=t.length,g=d,f=0;for(e.__k=new Array(r),l=0;l<r;l++)(o=n[l])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=e.__k[l]=Nn(null,o,null,null,null):pt(o)?o=e.__k[l]=Nn(L,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[l]=Nn(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[l]=o,u=l+f,o.__=e,o.__b=e.__b+1,s=null,(c=o.__i=hl(o,t,u,g))!=-1&&(g--,(s=t[c])&&(s.__u|=2)),s==null||s.__v==null?(c==-1&&(r>d?f--:r<d&&f++),typeof o.type!="function"&&(o.__u|=4)):c!=u&&(c==u-1?f--:c==u+1?f++:(c>u?f--:f++,o.__u|=4))):e.__k[l]=null;if(g)for(l=0;l<d;l++)(s=t[l])!=null&&!(2&s.__u)&&(s.__e==i&&(i=Ue(s)),Xa(s,s));return i}function Ka(e,n,t,i){var r,l;if(typeof e.type=="function"){for(r=e.__k,l=0;r&&l<r.length;l++)r[l]&&(r[l].__=e,n=Ka(r[l],n,t,i));return n}e.__e!=n&&(i&&(n&&e.type&&!n.parentNode&&(n=Ue(e)),t.insertBefore(e.__e,n||null)),n=e.__e);do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function hl(e,n,t,i){var r,l,o,s=e.key,u=e.type,c=n[t],d=c!=null&&(2&c.__u)==0;if(c===null&&s==null||d&&s==c.key&&u==c.type)return t;if(i>(d?1:0)){for(r=t-1,l=t+1;r>=0||l<n.length;)if((c=n[o=r>=0?r--:l++])!=null&&!(2&c.__u)&&s==c.key&&u==c.type)return o}return-1}function ea(e,n,t){n[0]=="-"?e.setProperty(n,t??""):e[n]=t==null?"":typeof t!="number"||cl.test(n)?t:t+"px"}function Sn(e,n,t,i,r){var l,o;e:if(n=="style")if(typeof t=="string")e.style.cssText=t;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(n in i)t&&n in t||ea(e.style,n,"");if(t)for(n in t)i&&t[n]==i[n]||ea(e.style,n,t[n])}else if(n[0]=="o"&&n[1]=="n")l=n!=(n=n.replace(Ha,"$1")),o=n.toLowerCase(),n=o in e||n=="onFocusOut"||n=="onFocusIn"?o.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+l]=t,t?i?t[Je]=i[Je]:(t[Je]=Si,e.addEventListener(n,l?qt:Yt,l)):e.removeEventListener(n,l?qt:Yt,l);else{if(r=="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]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&t==1?"":t))}}function na(e){return function(n){if(this.l){var t=this.l[n.type+e];if(n[xn]==null)n[xn]=Si++;else if(n[xn]<t[Je])return;return t(T.event?T.event(n):n)}}}function Ti(e,n,t,i,r,l,o,s,u,c){var d,g,f,p,v,_,k,w,b,F,Ke,oe,Ve,Xi,wn,Pt,Y=n.type;if(n.constructor!==void 0)return null;128&t.__u&&(u=!!(32&t.__u),l=[s=n.__e=t.__e]),(d=T.__b)&&d(n);e:if(typeof Y=="function"){g=o.length;try{if(b=n.props,F=Y.prototype&&Y.prototype.render,Ke=(d=Y.contextType)&&i[d.__c],oe=d?Ke?Ke.props.value:d.__:i,t.__c?w=(f=n.__c=t.__c).__=f.__E:(F?n.__c=f=new Y(b,oe):(n.__c=f=new Xe(b,oe),f.constructor=Y,f.render=vl),Ke&&Ke.sub(f),f.state||(f.state={}),f.__n=i,p=f.__d=!0,f.__h=[],f._sb=[]),F&&f.__s==null&&(f.__s=f.state),F&&Y.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=V({},f.__s)),V(f.__s,Y.getDerivedStateFromProps(b,f.__s))),v=f.props,_=f.state,f.__v=n,p)F&&Y.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),F&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(F&&Y.getDerivedStateFromProps==null&&b!==v&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(b,oe),n.__v==t.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(b,f.__s,oe)===!1){n.__v!=t.__v&&(f.props=b,f.state=f.__s,f.__d=!1),n.__e=t.__e,n.__k=t.__k,n.__k.some(function(Te){Te&&(Te.__=n)}),Dn.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(b,f.__s,oe),F&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(v,_,k)})}if(f.context=oe,f.props=b,f.__P=e,f.__e=!1,Ve=T.__r,Xi=0,F)f.state=f.__s,f.__d=!1,Ve&&Ve(n),d=f.render(f.props,f.state,f.context),Dn.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,Ve&&Ve(n),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++Xi<25);f.state=f.__s,f.getChildContext!=null&&(i=V(V({},i),f.getChildContext())),F&&!p&&f.getSnapshotBeforeUpdate!=null&&(k=f.getSnapshotBeforeUpdate(v,_)),wn=d!=null&&d.type===L&&d.key==null?Ja(d.props.children):d,s=qa(e,pt(wn)?wn:[wn],n,t,i,r,l,o,s,u,c),f.base=n.__e,n.__u&=-161,f.__h.length&&o.push(f),w&&(f.__E=f.__=null)}catch(Te){if(o.length=g,n.__v=null,u||l!=null){if(Te.then){for(n.__u|=u?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;l!=null&&(l[l.indexOf(s)]=null),n.__e=s}else if(l!=null)for(Pt=l.length;Pt--;)Ci(l[Pt])}else n.__e=t.__e;n.__k==null&&(n.__k=t.__k||[]),Te.then||Va(n),T.__e(Te,n,t)}}else l==null&&n.__v==t.__v?(n.__k=t.__k,n.__e=t.__e):s=n.__e=pl(t.__e,n,t,i,r,l,o,u,c);return(d=T.diffed)&&d(n),128&n.__u?void 0:s}function Va(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Va))}function Ga(e,n,t){for(var i=0;i<t.length;i++)Ai(t[i],t[++i],t[++i]);T.__c&&T.__c(n,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(l){l.call(r)})}catch(l){T.__e(l,r.__v)}})}function Ja(e){return typeof e!="object"||e==null||e.__b>0?e:pt(e)?e.map(Ja):e.constructor!==void 0?null:V({},e)}function pl(e,n,t,i,r,l,o,s,u){var c,d,g,f,p,v,_,k=t.props||jn,w=n.props,b=n.type;if(b=="svg"?r="http://www.w3.org/2000/svg":b=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),l!=null){for(c=0;c<l.length;c++)if((p=l[c])&&"setAttribute"in p==!!b&&(b?p.localName==b:p.nodeType==3)){e=p,l[c]=null;break}}if(e==null){if(b==null)return document.createTextNode(w);e=document.createElementNS(r,b,w.is&&w),s&&(T.__m&&T.__m(n,l),s=!1),l=null}if(b==null)k===w||s&&e.data==w||(e.data=w);else{if(l=b=="textarea"&&w.defaultValue!=null?null:l&&ht.call(e.childNodes),!s&&l!=null)for(k={},c=0;c<e.attributes.length;c++)k[(p=e.attributes[c]).name]=p.value;for(c in k)p=k[c],c=="dangerouslySetInnerHTML"?g=p:c=="children"||c in w||c=="value"&&"defaultValue"in w||c=="checked"&&"defaultChecked"in w||Sn(e,c,null,p,r);for(c in w)p=w[c],c=="children"?f=p:c=="dangerouslySetInnerHTML"?d=p:c=="value"?v=p:c=="checked"?_=p:s&&typeof p!="function"||k[c]===p||Sn(e,c,p,k[c],r);if(d)s||g&&(d.__html==g.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),n.__k=[];else if(g&&(e.innerHTML=""),qa(n.type=="template"?e.content:e,pt(f)?f:[f],n,t,i,b=="foreignObject"?"http://www.w3.org/1999/xhtml":r,l,o,l?l[0]:t.__k&&Ue(t,0),s,u),l!=null)for(c=l.length;c--;)Ci(l[c]);s&&b!="textarea"||(c="value",b=="progress"&&v==null?e.removeAttribute("value"):v!=null&&(v!==e[c]||b=="progress"&&!v||b=="option"&&v!=k[c])&&Sn(e,c,v,k[c],r),c="checked",_!=null&&_!=e[c]&&Sn(e,c,_,k[c],r))}return e}function Ai(e,n,t){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&n==null||(e.__u=e(n))}else e.current=n}catch(r){T.__e(r,t)}}function Xa(e,n,t){var i,r;if(T.unmount&&T.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Ai(i,null,n)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(l){T.__e(l,n)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Xa(i[r],n,t||typeof e.type!="function");t||Ci(e.__e),e.__c=e.__=e.__e=void 0}function vl(e,n,t){return this.constructor(e,t)}function gl(e,n,t){var i,r,l,o;n==document&&(n=document.documentElement),T.__&&T.__(e,n),r=(i=!1)?null:n.__k,l=[],o=[],Ti(n,e=n.__k=ul(L,null,[e]),r||jn,jn,n.namespaceURI,r?null:n.firstChild?ht.call(n.childNodes):null,l,r?r.__e:n.firstChild,i,o),Ga(l,e,o),e.props.children=null}ht=Dn.slice,T={__e:function(e,n,t,i){for(var r,l,o;n=n.__;)if((r=n.__c)&&!r.__)try{if((l=r.constructor)&&l.getDerivedStateFromError!=null&&(r.setState(l.getDerivedStateFromError(e)),o=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),o=r.__d),o)return r.__E=r}catch(s){e=s}throw e}},Ua=0,Ba=function(e){return e!=null&&e.constructor===void 0},Xe.prototype.setState=function(e,n){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=V({},this.state),typeof e=="function"&&(e=e(V({},t),this.props)),e&&V(t,e),e!=null&&this.__v&&(n&&this._sb.push(n),Qi(this))},Xe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Qi(this))},Xe.prototype.render=L,ie=[],za=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Wa=function(e,n){return e.__v.__b-n.__v.__b},Un.__r=0,Lt=Math.random().toString(8),xn="__d"+Lt,Je="__a"+Lt,Ha=/(PointerCapture)$|Capture$/i,Si=0,Yt=na(!1),qt=na(!0);var _l=0;function a(e,n,t,i,r,l){n||(n={});var o,s,u=n;if("ref"in u)for(s in u={},n)s=="ref"?o=n[s]:u[s]=n[s];var c={type:e,props:u,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--_l,__i:-1,__u:0,__source:r,__self:l};if(typeof e=="function"&&(o=e.defaultProps))for(s in o)u[s]===void 0&&(u[s]=o[s]);return T.vnode&&T.vnode(c),c}var on,N,Rt,ta,Kt=0,Za=[],I=T,ia=I.__b,aa=I.__r,ra=I.diffed,la=I.__c,oa=I.unmount,sa=I.__;function xi(e,n){I.__h&&I.__h(N,e,Kt||n),Kt=0;var t=N.__H||(N.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({}),t.__[e]}function Ni(e){return Kt=1,ml(nr,e)}function ml(e,n,t){var i=xi(on++,2);if(i.t=e,!i.__c&&(i.__=[nr(void 0,n),function(s){var u=i.__N?i.__N[0]:i.__[0],c=i.t(u,s);u!==c&&(i.__N=[c,i.__[1]],i.__c.setState({}))}],i.__c=N,!N.__f)){var r=function(s,u,c){if(!i.__c.__H)return!0;var d=!1,g=i.__c.props!==s;if(i.__c.__H.__.some(function(p){if(p.__N){d=!0;var v=p.__[0];p.__=p.__N,p.__N=void 0,v!==p.__[0]&&(g=!0)}}),l){var f=l.call(this,s,u,c);return d?f||g:f}return!d||g};N.__f=!0;var l=N.shouldComponentUpdate,o=N.componentWillUpdate;N.componentWillUpdate=function(s,u,c){if(this.__e){var d=l;l=void 0,r(s,u,c),l=d}o&&o.call(this,s,u,c)},N.shouldComponentUpdate=r}return i.__N||i.__}function ne(e,n){var t=xi(on++,3);!I.__s&&er(t.__H,n)&&(t.__=e,t.u=n,N.__H.__h.push(t))}function Qa(e,n){var t=xi(on++,7);return er(t.__H,n)&&(t.__=e(),t.__H=n,t.__h=e),t.__}function yl(){for(var e;e=Za.shift();){var n=e.__H;if(e.__P&&n)try{n.__h.some(En),n.__h.some(Vt),n.__h=[]}catch(t){n.__h=[],I.__e(t,e.__v)}}}I.__b=function(e){N=null,ia&&ia(e)},I.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),sa&&sa(e,n)},I.__r=function(e){aa&&aa(e),on=0;var n=(N=e.__c).__H;n&&(Rt===N?(n.__h=[],N.__h=[],n.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(n.__h.some(En),n.__h.some(Vt),n.__h=[],on=0)),Rt=N},I.diffed=function(e){ra&&ra(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(Za.push(n)!==1&&ta===I.requestAnimationFrame||((ta=I.requestAnimationFrame)||bl)(yl)),n.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),Rt=N=null},I.__c=function(e,n){n.some(function(t){try{t.__h.some(En),t.__h=t.__h.filter(function(i){return!i.__||Vt(i)})}catch(i){n.some(function(r){r.__h&&(r.__h=[])}),n=[],I.__e(i,t.__v)}}),la&&la(e,n)},I.unmount=function(e){oa&&oa(e);var n,t=e.__c;t&&t.__H&&(t.__H.__.some(function(i){try{En(i)}catch(r){n=r}}),t.__H=void 0,n&&I.__e(n,t.__v))};var ca=typeof requestAnimationFrame=="function";function bl(e){var n,t=function(){clearTimeout(i),ca&&cancelAnimationFrame(n),setTimeout(e)},i=setTimeout(t,35);ca&&(n=requestAnimationFrame(t))}function En(e){var n=N,t=e.__c;typeof t=="function"&&(e.__c=void 0,t()),N=n}function Vt(e){var n=N;e.__c=e.__(),N=n}function er(e,n){return!e||e.length!==n.length||n.some(function(t,i){return t!==e[i]})}function nr(e,n){return typeof n=="function"?n(e):n}var kl=Symbol.for("preact-signals");function vt(){if(X>1)X--;else{var e,n=!1;for(function(){var r=zn;for(zn=void 0;r!==void 0;){var l=r.S;if(l.v===r.v)for(var o=l.t;o!==void 0;o=o.x)o.i===r.i&&(o.i=l.i);r=r.o}}();Qe!==void 0;){var t=Qe;for(Qe=void 0,Bn++;t!==void 0;){var i=t.u;if(t.u=void 0,t.f&=-3,!(8&t.f)&&ir(t))try{t.c()}catch(r){n||(e=r,n=!0)}t=i}}if(Bn=0,X--,n)throw e}}function wl(e){if(X>0)return e();Gt=++Sl,X++;try{return e()}finally{vt()}}var Ze,A=void 0;function gt(e){var n=A,t=Ze;A=void 0,Ze=void 0;try{return e()}finally{A=n,Ze=t}}var Qe=void 0,X=0,Bn=0,Sl=0,Gt=0,zn=void 0,Wn=0;function tr(e){if(A!==void 0){var n=e.n;if(n===void 0||n.t!==A)return n={i:0,S:e,p:A.s,n:void 0,t:A,e:void 0,x:void 0,r:n},A.s!==void 0&&(A.s.n=n),A.s=n,e.n=n,32&A.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=A.s,n.n=void 0,A.s.n=n,A.s=n),n}}function P(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}P.prototype.brand=kl;P.prototype.h=function(){return!0};P.prototype.S=function(e){var n=this,t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t!==void 0?t.e=e:gt(function(){var i;(i=n.W)==null||i.call(n)}))};P.prototype.U=function(e){var n=this;if(this.t!==void 0){var t=e.e,i=e.x;t!==void 0&&(t.x=i,e.e=void 0),i!==void 0&&(i.e=t,e.x=void 0),e===this.t&&(this.t=i,i===void 0&>(function(){var r;(r=n.Z)==null||r.call(n)}))}};P.prototype.subscribe=function(e){var n=this;return mn(function(){var t=n.value;gt(function(){return e(t)})},{name:"sub"})};P.prototype.valueOf=function(){return this.value};P.prototype.toString=function(){return this.value+""};P.prototype.toJSON=function(){return this.value};P.prototype.peek=function(){var e=this;return gt(function(){return e.value})};Object.defineProperty(P.prototype,"value",{get:function(){var e=tr(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Bn>100)throw new Error("Cycle detected");(function(t){X!==0&&Bn===0&&t.l!==Gt&&(t.l=Gt,zn={S:t,v:t.v,i:t.i,o:zn})})(this),this.v=e,this.i++,Wn++,X++;try{for(var n=this.t;n!==void 0;n=n.x)n.t.N()}finally{vt()}}}});function h(e,n){return new P(e,n)}function ir(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 ar(e){for(var n=e.s;n!==void 0;n=n.n){var t=n.S.n;if(t!==void 0&&(n.r=t),n.S.n=n,n.i=-1,n.n===void 0){e.s=n;break}}}function rr(e){for(var n=e.s,t=void 0;n!==void 0;){var i=n.p;n.i===-1?(n.S.U(n),i!==void 0&&(i.n=n.n),n.n!==void 0&&(n.n.p=i)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=i}e.s=t}function Se(e,n){P.call(this,void 0,n),this.x=e,this.s=void 0,this.g=Wn-1,this.f=4}Se.prototype=new P;Se.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Wn))return!0;if(this.g=Wn,this.f|=1,this.i>0&&!ir(this))return this.f&=-2,!0;var e=A;try{ar(this),A=this;var n=this.x();(16&this.f||this.v!==n||this.i===0)&&(this.v=n,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return A=e,rr(this),this.f&=-2,!0};Se.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)}P.prototype.S.call(this,e)};Se.prototype.U=function(e){if(this.t!==void 0&&(P.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)}};Se.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(Se.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=tr(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function ua(e,n){return new Se(e,n)}function lr(e){var n=e.m;if(e.m=void 0,typeof n=="function"){X++;var t=A;A=void 0;try{n()}catch(i){throw e.f&=-2,e.f|=8,Ei(e),i}finally{A=t,vt()}}}function Ei(e){for(var n=e.s;n!==void 0;n=n.n)n.S.U(n);e.x=void 0,e.s=void 0,lr(e)}function Cl(e){if(A!==this)throw new Error("Out-of-order effect");rr(this),A=e,this.f&=-2,8&this.f&&Ei(this),vt()}function He(e,n){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=n?.name,Ze&&Ze.push(this)}He.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()}};He.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,lr(this),ar(this),X++;var e=A;return A=this,Cl.bind(this,e)};He.prototype.N=function(){2&this.f||(this.f|=2,this.u=Qe,Qe=this)};He.prototype.d=function(){this.f|=8,1&this.f||Ei(this)};He.prototype.dispose=function(){this.d()};function mn(e,n){var t=new He(e,n);try{t.c()}catch(r){throw t.d(),r}var i=t.d.bind(t);return i[Symbol.dispose]=i,i}var or,Cn,Tl=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,sr=[];mn(function(){or=this.N})();function Ye(e,n){T[e]=n.bind(null,T[e]||function(){})}function Hn(e){if(Cn){var n=Cn;Cn=void 0,n()}Cn=e&&e.S()}function cr(e){var n=this,t=e.data,i=xl(t);i.name="ReactiveDom",i.value=t;var r=Qa(function(){for(var s=n,u=n.__v;u=u.__;)if(u.__c){u.__c.__$f|=4;break}var c=ua(function(){var p=i.value.value;return p===0?0:p===!0?"":p||""}),d=ua(function(){return!Array.isArray(c.value)&&!Ba(c.value)}),g=mn(function(){if(this.N=ur,d.value){var p=c.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=p)}}),f=n.__$u.d;return n.__$u.d=function(){g(),f.call(this)},[d,c]},[]),l=r[0],o=r[1];return l.value?o.peek():o.value}cr.displayName="ReactiveTextNode";Object.defineProperties(P.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:cr},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});Ye("__b",function(e,n){if(typeof n.type=="string"){var t,i=n.props;for(var r in i)if(r!=="children"){var l=i[r];l instanceof P&&(t||(n.__np=t={}),t[r]=l,i[r]=l.peek())}}e(n)});Ye("__r",function(e,n){if(e(n),n.type!==L){Hn();var t,i=n.__c;i&&(i.__$f&=-2,(t=i.__$u)===void 0&&(i.__$u=t=function(r,l){var o;return mn(function(){o=this},{name:l}),o.c=r,o}(function(){var r;Tl&&((r=t.y)==null||r.call(t)),i.__$f|=1,i.setState({})},typeof n.type=="function"?n.type.displayName||n.type.name:""))),Hn(t)}});Ye("__e",function(e,n,t,i){Hn(),e(n,t,i)});Ye("diffed",function(e,n){Hn();var t;if(typeof n.type=="string"&&(t=n.__e)){var i=n.__np,r=n.props,l=t.U;if(l)for(var o in l){var s=l[o];s===void 0||i&&o in i||(s.d(),l[o]=void 0)}if(i){l||(l={},t.U=l);for(var u in i){var c=l[u],d=i[u];c===void 0?(c=Al(t,u,d,r),l[u]=c):c.o(d,r)}}}e(n)});function Al(e,n,t,i){var r=n in e&&e.ownerSVGElement===void 0,l=h(t);return{o:function(o,s){l.value=o,i=s},d:mn(function(){this.N=ur;var o=l.value.value;i[n]!==o&&(i[n]=o,r?e[n]=o:o!=null&&(o!==!1||n[4]==="-")?e.setAttribute(n,o):e.removeAttribute(n))})}}Ye("unmount",function(e,n){if(typeof n.type=="string"){var t=n.__e;if(t){var i=t.U;if(i){t.U=void 0;for(var r in i){var l=i[r];l&&l.d()}}}var o=n.__np;if(o){var s=n.props;for(var u in o)s[u]=o[u]}n.__np=void 0}else{var c=n.__c;if(c){var d=c.__$u;d&&(c.__$u=void 0,d.d())}}e(n)});Ye("__h",function(e,n,t,i){i<3&&(n.__$f|=2),e(n,t,i)});Xe.prototype.shouldComponentUpdate=function(e,n){if(this.__R)return!0;var t=this.__$u,i=t&&t.s!==void 0;for(var r in n)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var l=2&this.__$f;if(!(i||l||4&this.__$f)||1&this.__$f)return!0}else if(!(i||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!=="__source"&&e[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function xl(e,n){return Qa(function(){return h(e,n)},[])}var Nl=function(e){queueMicrotask(function(){queueMicrotask(e)})};function El(){wl(function(){for(var e;e=sr.shift();)or.call(e)})}function ur(){sr.push(this)===1&&(T.requestAnimationFrame||Nl)(El)}function dr(){const e=window.location.hash;return e===""||e==="#"?"/":e.startsWith("#")?e.slice(1):e}const Yn=h(dr());function _t(e){const n=e.startsWith("/")?e:`/${e}`;`#${n}`!==window.location.hash&&(window.location.hash=n)}let da=!1;function Il(){da||(da=!0,window.addEventListener("hashchange",()=>{Yn.value=dr()}))}let sn=null;function $l(e){sn=e}class E extends Error{status;body;constructor(n,t,i){super(i),this.status=n,this.body=t}}async function y(e,n={}){const t={Accept:"application/json",...n.headers??{}};sn!==null&&(t.Authorization=`Bearer ${sn}`);const{body:i,...r}=n,l={...r,headers:t};i!==void 0&&(l.body=JSON.stringify(i),t["Content-Type"]="application/json");const o=await fetch(e,l),s=await o.text(),u=s===""?{}:JSON.parse(s);if(!o.ok){const c=u.error?.message??`request failed (${o.status})`;throw new E(o.status,u,c)}return u}async function Ol(e,n,t,i={}){const r={Accept:"text/event-stream","Content-Type":"application/json",...i.headers??{}};sn!==null&&(r.Authorization=`Bearer ${sn}`);const l=await fetch(e,{...i,method:"POST",headers:r,body:JSON.stringify(n)});if(!l.ok||l.body===null){const d=await l.text().catch(()=>"");let g={};try{g=d===""?{}:JSON.parse(d)}catch{}throw new E(l.status,g,g.error?.message??`stream failed (${l.status})`)}const o=l.body.getReader(),s=new TextDecoder;let u="";const c=d=>{for(const g of d.split(`
|
|
2
|
-
`)){if(!g.startsWith("data:"))continue;const f=g.slice(5).trim();if(f!=="")try{t(JSON.parse(f))}catch{}}};for(;;){const{done:d,value:g}=await o.read();if(d)break;u+=s.decode(g,{stream:!0});let f=u.indexOf(`
|
|
3
|
-
|
|
4
|
-
`);for(;f!==-1;)c(u.slice(0,f)),u=u.slice(f+2),f=u.indexOf(`
|
|
5
|
-
|
|
6
|
-
`)}u.trim()!==""&&c(u)}const ge=h(null);async function Pl(){try{const e=await y("/api/v1/ping");ge.value={...e,projectScopeAvailable:e.projectScopeAvailable===!0,projectSurface:e.projectSurface===!0,devSurfaces:e.devSurfaces===!0}}catch{ge.value=null}}function z(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 Ll(e){return/expected (boolean|string|number)/i.test(e)?e.replace(/^expected/i,"Expected"):e}function mt(e){const n={};for(const t of e.fields??[])n[t.path]=Ll(t.message);return n}function Rl({id:e,children:n}){return a("p",{class:"ac-field__description",id:e,children:n})}function Fl({id:e,children:n}){return a("p",{class:"ac-field__error",id:e,role:"alert","aria-live":"polite",children:n})}function Ce({id:e,label:n,description:t,error:i,children:r}){const l=t!==void 0?`${e}-desc`:void 0,o=i!==void 0?`${e}-err`:void 0;return a("div",{class:"ac-field","data-invalid":i!==void 0?"true":void 0,children:[a("label",{class:"ac-field__label",for:e,children:n}),t!==void 0?a(Rl,{id:l,children:t}):null,a("div",{class:"ac-field__control","aria-describedby":l,"aria-errormessage":o,children:r}),i!==void 0?a(Fl,{id:o,children:i}):null]})}function fr(e){return a(Ce,{id:e.id,label:e.label,description:e.description,error:e.error,children:a("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 Ml(e){const n=e.step??(e.integer===!0?1:"any");return a(Ce,{id:e.id,label:e.label,description:e.description,error:e.error,children:a("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:t=>{const i=t.currentTarget.value,r=i===""?0:Number(i);e.onChange(Number.isFinite(r)?r:0)}})})}function jl(e){return a(Ce,{id:e.id,label:e.label,description:e.description,error:e.error,children:a("label",{class:"ac-toggle",children:[a("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)}),a("span",{class:"ac-toggle__track","aria-hidden":"true"}),a("span",{class:"ac-toggle__state",children:e.value?"On":"Off"})]})})}function hr(e){const n=e.options.length>3;return a(Ce,{id:e.id,label:e.label,description:e.description,error:e.error,children:n?a("select",{class:"ac-input",id:e.id,name:e.name,value:e.value,"aria-invalid":e.error!==void 0?"true":void 0,onChange:t=>e.onChange(t.currentTarget.value),children:e.options.map(t=>a("option",{value:t.value,children:t.label??(t.value===""?"(none)":t.value)},t.value))}):a("div",{class:"ac-radio-group",role:"radiogroup","aria-labelledby":`${e.id}-label`,children:e.options.map(t=>{const i=`${e.id}-${t.value||"none"}`;return a("label",{class:"ac-radio",for:i,children:[a("input",{type:"radio",id:i,name:e.name,value:t.value,checked:t.value===e.value,onChange:()=>e.onChange(t.value)}),a("span",{children:t.label??(t.value===""?"(none)":t.value)})]},t.value)})})})}function qn(e){return a(Ce,{id:e.id,label:e.label,description:e.description,error:e.error,children:a("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 pr(e){return e.replace(/_/g," ").replace(/\./g," › ").replace(/\b\w/g,n=>n.toUpperCase())}function Dl(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 Ft(e,n){const t=Dl(n);return{path:e,kind:t,label:pr(e[e.length-1]??""),description:n.description,options:n.enum,min:n.minimum,max:n.maximum,defaultValue:n.default}}function vr(e){const n=[],t=e.properties??{};for(const[i,r]of Object.entries(t))if(r.type==="object"&&r.properties!==void 0){const l=[];for(const[o,s]of Object.entries(r.properties))if(s.type==="object"&&s.properties!==void 0)for(const[u,c]of Object.entries(s.properties))l.push(Ft([i,o,u],c));else l.push(Ft([i,o],s));n.push({path:[i],label:pr(i),description:r.description,fields:l})}else{const l=n.find(s=>s.path[0]==="__general"),o=Ft([i],r);l===void 0?n.unshift({path:["__general"],label:"General",fields:[o]}):l.fields.push(o)}return n}function yn(e,n){let t=e;for(const i of n){if(t===null||typeof t!="object"||Array.isArray(t))return;t=t[i]}return t}function cn(e,n,t){if(n.length===0)return e;const[i,...r]=n;if(i===void 0)return e;const l={...e};if(r.length===0)return l[i]=t,l;const o=l[i],s=o!==null&&typeof o=="object"&&!Array.isArray(o)?o:{};return l[i]=cn(s,r,t),l}function Oe(e){return e.join(".")}function fa(e,n,t,i){const r=Oe(e.path),l=r,o=yn(n,e.path),s=t[r],u=c=>{i(cn(n,e.path,c))};switch(e.kind){case"string":{const c=typeof o=="string"?o:"";return c.length>80?a(qn,{id:r,name:l,label:e.label,description:e.description,error:s,value:c,onChange:u}):a(fr,{id:r,name:l,label:e.label,description:e.description,error:s,value:c,onChange:u})}case"enum":{const c=typeof o=="string"||typeof o=="number"?String(o):"",d=(e.options??[]).map(g=>({value:String(g)}));return a(hr,{id:r,name:l,label:e.label,description:e.description,error:s,value:c,options:d,onChange:u})}case"number":case"integer":{const c=typeof o=="number"?o:0;return a(Ml,{id:r,name:l,label:e.label,description:e.description,error:s,value:c,integer:e.kind==="integer",min:e.min,max:e.max,onChange:u})}case"boolean":{const c=typeof o=="boolean"?o:!1;return a(jl,{id:r,name:l,label:e.label,description:e.description,error:s,value:c,onChange:u})}case"array-of-strings":{const d=(Array.isArray(o)?o.filter(g=>typeof g=="string"):[]).join(`
|
|
7
|
-
`);return a(qn,{id:r,name:l,label:e.label,description:`${e.description??""} (one entry per line)`.trim(),error:s,value:d,onChange:g=>{const f=g.split(`
|
|
8
|
-
`).map(p=>p.trim()).filter(p=>p!=="");u(f)}})}default:return null}}function Ul({field:e,values:n,errors:t,onChange:i,decorate:r}){const l=Oe(e.path),o=r?.(l,e);return o===void 0?a("div",{children:fa(e,n,t,i)},l):a("div",{class:`ac-field-row${o.modified?" ac-field-row--modified":""}`,children:[a("div",{class:"ac-field-row__body",children:fa(e,n,t,i)}),a("div",{class:"ac-field-row__meta",children:[o.sourceLabel!==void 0?a("span",{class:"ac-badge ac-badge--source",title:`Value set in the ${o.sourceLabel} layer`,children:o.sourceLabel}):null,o.modified&&o.onReset!==void 0?a("button",{type:"button",class:"ac-field-row__reset",title:"Reset to default",onClick:o.onReset,children:"Reset"}):null]})]})}function gr({section:e,values:n,errors:t,onChange:i,decorate:r,footer:l}){return a("section",{class:"ac-section","aria-labelledby":`section-${Oe(e.path)}`,children:[a("h2",{class:"ac-section__title",id:`section-${Oe(e.path)}`,children:e.label}),e.description!==void 0?a("p",{class:"ac-section__description",children:e.description}):null,a("div",{class:"ac-section__fields",children:e.fields.map(o=>a(Ul,{field:o,values:n,errors:t,onChange:i,decorate:r},Oe(o.path)))}),l]})}function Bl(e){const n=vr(e.schema),t=e.errors??{};return a("form",{class:"ac-form",onSubmit:i=>i.preventDefault(),children:[n.map(i=>a(gr,{section:i,values:e.values,errors:t,onChange:e.onChange,decorate:e.decorate},Oe(i.path))),e.actions!==void 0?a("div",{class:"ac-form__actions",children:e.actions}):null]})}function zl(e){const[n]=Ni(()=>`${e.id}-list`);return a(Ce,{id:e.id,label:e.label,description:e.description,error:e.error,children:[a("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:t=>e.onChange(t.currentTarget.value)}),a("datalist",{id:n,children:e.suggestions.map(t=>a("option",{value:t},t))})]})}const Wl=["developer","reviewer","designer","product-manager","ops","qa","maintainer"],Hl=["de","en","en-US","en-GB","fr","es","it","nl","pt","pt-BR"];function ha(){return new Date().toISOString().slice(0,10)}function Ae(e,n){return e?.[n]}function Yl({value:e,onChange:n,errors:t,hideRole:i,hideIdentityBasics:r}){const[l,o]=Ni(""),s="umd-role-suggestions";function u(v){n({...e,...v,last_updated:ha()})}const c=e.role.filter(v=>v.trim()!=="");function d(v){const _=v.trim();if(_===""||c.includes(_)){o("");return}u({role:[...c,_]}),o("")}function g(v){c.length<=1||u({role:c.filter(_=>_!==v)})}function f(v){const _={...e,last_updated:ha()};v===""?delete _.notes:_.notes=v,n(_)}const p=Wl.filter(v=>!c.includes(v));return a("div",{class:"ac-user-md-form",children:[r?null:a(fr,{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:Ae(t,"identity.name"),onChange:v=>u({identity:{...e.identity,name:v}})}),r?null:a(zl,{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:Hl,error:Ae(t,"language"),onChange:v=>u({language:v})}),i?null:a(Ce,{id:"umd-role-input",label:"Roles",description:"One or more roles. Seeded suggestions are non-binding — type anything and press Enter.",error:Ae(t,"role"),children:[a("ul",{class:"ac-chip-list","data-testid":"umd-role-list",children:c.map(v=>a("li",{class:"ac-chip",children:[a("span",{children:v}),a("button",{type:"button",class:"ac-chip__remove","aria-label":`Remove ${v}`,disabled:c.length<=1,onClick:()=>g(v),children:"×"})]},v))}),a("div",{class:"ac-role-add",children:[a("input",{class:"ac-input",type:"text",id:"umd-role-input",name:"role-add",list:s,placeholder:"Add a role and press Enter",value:l,onInput:v=>o(v.currentTarget.value),onKeyDown:v=>{(v.key==="Enter"||v.key===",")&&(v.preventDefault(),d(l))}}),a("datalist",{id:s,children:p.map(v=>a("option",{value:v},v))}),a("button",{type:"button",class:"ac-button",onClick:()=>d(l),children:"Add role"})]})]}),a(hr,{id:"umd-pace",name:"style.pace",label:"Pace",value:e.style.pace,error:Ae(t,"style.pace"),options:[{value:"pragmatic",label:"Pragmatic"},{value:"thorough",label:"Thorough"},{value:"rapid",label:"Rapid"}],onChange:v=>u({style:{...e.style,pace:v}})}),a(qn,{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:Ae(t,"voice_sample"),onChange:v=>u({voice_sample:v})}),a(qn,{id:"umd-notes",name:"notes",label:"Notes",description:"Optional free-form prose the agent remembers across sessions.",rows:6,value:e.notes??"",error:Ae(t,"notes"),onChange:f})]})}function _r(){return{version:1,identity:{name:""},language:"en",role:[],style:{pace:"pragmatic"},voice_sample:"",last_updated:"1970-01-01"}}function pa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Tn(e,n){return typeof e=="string"?e:n}function ql(e){return e==="thorough"||e==="rapid"?e:"pragmatic"}function Kl(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"&&n.trim()!==""):[]}function Vl(e){if(typeof e=="string")return e===""?void 0:e}function va(e){const n=_r(),t=pa(e.identity)?e.identity:{},i=pa(e.style)?e.style:{},r=Vl(e.notes),l={version:1,identity:{name:Tn(t.name,n.identity.name)},language:Tn(e.language,n.language),role:Kl(e.role),style:{pace:ql(i.pace)},voice_sample:Tn(e.voice_sample,n.voice_sample),last_updated:Tn(e.last_updated,n.last_updated)};return r!==void 0&&(l.notes=r),l}/*! js-yaml 5.2.2 https://github.com/nodeca/js-yaml @license MIT */var S=Symbol("NOT_RESOLVED"),Ii=Symbol("MERGE_KEY");function R(e,n){return{tagName:e,nodeKind:"scalar",implicit:n.implicit??!1,matchByTagPrefix:n.matchByTagPrefix??!1,implicitFirstChars:n.implicitFirstChars??null,resolve:n.resolve,identify:n.identify??null,represent:n.represent??(t=>String(t)),representTagName:n.representTagName??null}}function $i(e,n){const t=n.finalize===void 0;return{tagName:e,nodeKind:"sequence",implicit:!1,matchByTagPrefix:n.matchByTagPrefix??!1,create:n.create,addItem:n.addItem,finalize:n.finalize??(i=>i),carrierIsResult:t,identify:n.identify??null,represent:n.represent??(i=>i),representTagName:n.representTagName??null}}function yt(e,n){const t=n.finalize===void 0;return{tagName:e,nodeKind:"mapping",implicit:!1,matchByTagPrefix:n.matchByTagPrefix??!1,create:n.create,addPair:n.addPair,has:n.has,keys:n.keys,get:n.get,finalize:n.finalize??(i=>i),carrierIsResult:t,identify:n.identify??null,represent:n.represent??(i=>i),representTagName:n.representTagName??null}}var Gl=R("tag:yaml.org,2002:str",{resolve:e=>e,identify:e=>typeof e=="string"}),Jl=["","~","null","Null","NULL"],Xl=R("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["","~","n","N"],resolve:e=>Jl.indexOf(e)!==-1?null:S,identify:e=>e===null,represent:()=>"null"}),Zl=R("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["n"],resolve:(e,n)=>e==="null"||n&&e===""?null:S,identify:e=>e===null,represent:()=>"null"}),Ql=["","~","null","Null","NULL"],eo=R("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["","~","n","N"],resolve:e=>Ql.indexOf(e)!==-1?null:S,identify:e=>e===null,represent:()=>"null"}),no=["true","True","TRUE"],to=["false","False","FALSE"],io=R("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["t","T","f","F"],resolve:e=>no.indexOf(e)!==-1?!0:to.indexOf(e)!==-1?!1:S,identify:e=>Object.prototype.toString.call(e)==="[object Boolean]",represent:e=>e?"true":"false"}),ao=["true"],ro=["false"],lo=R("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["t","f"],resolve:e=>ao.indexOf(e)!==-1?!0:ro.indexOf(e)!==-1?!1:S,identify:e=>Object.prototype.toString.call(e)==="[object Boolean]",represent:e=>e?"true":"false"}),oo=["true","True","TRUE","y","Y","yes","Yes","YES","on","On","ON"],so=["false","False","FALSE","n","N","no","No","NO","off","Off","OFF"],co=R("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["y","Y","n","N","t","T","f","F","o","O"],resolve:e=>oo.indexOf(e)!==-1?!0:so.indexOf(e)!==-1?!1:S,identify:e=>Object.prototype.toString.call(e)==="[object Boolean]",represent:e=>e?"true":"false"}),uo=new RegExp("^(?:0o[0-7]+|0x[0-9a-fA-F]+|[-+]?[0-9]+)$"),fo=new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");function ho(e){let n=e,t=1;return(n[0]==="-"||n[0]==="+")&&(n[0]==="-"&&(t=-1),n=n.slice(1)),n.startsWith("0b")?t*parseInt(n.slice(2),2):n.startsWith("0o")?t*parseInt(n.slice(2),8):n.startsWith("0x")?t*parseInt(n.slice(2),16):t*parseInt(n,10)}function po(e,n){if(n){if(!fo.test(e))return S}else if(!uo.test(e))return S;const t=ho(e);return Number.isFinite(t)?t:S}var mr=R("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-","+",..."0123456789"],resolve:po,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf("e")<0,represent:e=>e.toString(10)}),vo=new RegExp("^-?(?:0|[1-9][0-9]*)$"),go=new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");function _o(e){let n=e,t=1;return(n[0]==="-"||n[0]==="+")&&(n[0]==="-"&&(t=-1),n=n.slice(1)),n.startsWith("0b")?t*parseInt(n.slice(2),2):n.startsWith("0o")?t*parseInt(n.slice(2),8):n.startsWith("0x")?t*parseInt(n.slice(2),16):t*parseInt(n,10)}function mo(e,n){if(n){if(!go.test(e))return S}else if(!vo.test(e))return S;const t=_o(e);return Number.isFinite(t)?t:S}var yo=R("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-",..."0123456789"],resolve:mo,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf("e")<0,represent:e=>e.toString(10)}),bo=new RegExp("^(?:[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?0x[0-9a-fA-F_]+|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+|[-+]?(?:0|[1-9][0-9_]*))$");function ko(e){let n=e.replace(/_/g,""),t=1;if((n[0]==="-"||n[0]==="+")&&(n[0]==="-"&&(t=-1),n=n.slice(1)),n.startsWith("0b"))return t*parseInt(n.slice(2),2);if(n.startsWith("0x"))return t*parseInt(n.slice(2),16);if(n.includes(":")){let i=0;for(const r of n.split(":"))i=i*60+Number(r);return t*i}return n!=="0"&&n[0]==="0"?t*parseInt(n,8):t*parseInt(n,10)}function wo(e){if(!bo.test(e))return S;const n=ko(e);return Number.isFinite(n)?n:S}var Jt=R("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-","+",..."0123456789"],resolve:wo,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf("e")<0,represent:e=>e.toString(10)}),So=new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),Co=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function To(e){if(!So.test(e))return S;let n=e.toLowerCase();const t=n[0]==="-"?-1:1;if("+-".includes(n[0])&&(n=n.slice(1)),n===".inf")return t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(n===".nan")return NaN;const i=t*parseFloat(n);return Number.isFinite(i)||Co.test(e)?i:S}function Ao(e){if(isNaN(e))return".nan";if(e===Number.POSITIVE_INFINITY)return".inf";if(e===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(e,-0))return"-0.0";const n=e.toString(10);return/^[-+]?[0-9]+e/.test(n)?n.replace("e",".e"):n}var yr=R("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-","+",".",..."0123456789"],resolve:To,identify:e=>typeof e=="number"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf("e")>=0),represent:Ao}),xo=new RegExp("^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$"),No=new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Eo(e,n){if(n){if(!No.test(e))return S;let i=e.toLowerCase();const r=i[0]==="-"?-1:1;if("+-".includes(i[0])&&(i=i.slice(1)),i===".inf")return r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(i===".nan")return NaN;const l=r*parseFloat(i);return Number.isFinite(l)?l:S}if(!xo.test(e))return S;const t=Number(e);return Number.isFinite(t)?t:S}function Io(e){if(isNaN(e))return".nan";if(e===Number.POSITIVE_INFINITY)return".inf";if(e===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(e,-0))return"-0.0";const n=e.toString(10);return/^[-+]?[0-9]+e/.test(n)?n.replace("e",".e"):n}var $o=R("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-",..."0123456789"],resolve:Eo,identify:e=>typeof e=="number"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf("e")>=0),represent:Io}),Oo=new RegExp("^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\.[0-9_]*)(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),Po=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Lo(e){if(!Oo.test(e))return S;let n=e.toLowerCase().replace(/_/g,"");const t=n[0]==="-"?-1:1;if("+-".includes(n[0])&&(n=n.slice(1)),n===".inf")return t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(n===".nan")return NaN;let i=0;if(n.includes(":")){for(const r of n.split(":"))i=i*60+Number(r);i*=t}else i=t*parseFloat(n);return Number.isFinite(i)||Po.test(e)?i:S}function Ro(e){if(isNaN(e))return".nan";if(e===Number.POSITIVE_INFINITY)return".inf";if(e===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(e,-0))return"-0.0";const n=e.toString(10);return/^[-+]?[0-9]+e/.test(n)?n.replace("e",".e"):n}var Xt=R("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-","+",".",..."0123456789"],resolve:Lo,identify:e=>typeof e=="number"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf("e")>=0),represent:Ro}),Fo=R("tag:yaml.org,2002:merge",{implicit:!0,implicitFirstChars:["<"],resolve:(e,n)=>e==="<<"||n&&e===""?Ii:S}),Mo=/^[A-Za-z0-9+/]*={0,2}$/;function jo(e){const n=e.replace(/\s/g,"");if(n.length%4!==0||!Mo.test(n))return S;const t=atob(n),i=new Uint8Array(t.length);for(let r=0;r<t.length;r++)i[r]=t.charCodeAt(r);return i}function Do(e){let n="";for(let t=0;t<e.length;t++)n+=String.fromCharCode(e[t]);return btoa(n)}var Uo=R("tag:yaml.org,2002:binary",{resolve:jo,identify:e=>Object.prototype.toString.call(e)==="[object Uint8Array]",represent:Do}),Bo=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),zo=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 Wo(e){let n=Bo.exec(e);if(n===null&&(n=zo.exec(e)),n===null)return S;const t=+n[1],i=+n[2]-1,r=+n[3];if(!n[4]){const d=new Date(Date.UTC(t,i,r));return d.getUTCFullYear()!==t||d.getUTCMonth()!==i||d.getUTCDate()!==r?S:d}const l=+n[4],o=+n[5],s=+n[6];let u=0;if(l>23||o>59||s>59)return S;if(n[7]){let d=n[7].slice(0,3);for(;d.length<3;)d+="0";u=+d}const c=new Date(Date.UTC(t,i,r,l,o,s,u));if(c.getUTCFullYear()!==t||c.getUTCMonth()!==i||c.getUTCDate()!==r)return S;if(n[9]){const d=+n[10],g=+(n[11]||0);if(d>23||g>59)return S;const f=(d*60+g)*6e4;c.setTime(c.getTime()-(n[9]==="-"?-f:f))}return c}var Ho=R("tag:yaml.org,2002:timestamp",{implicit:!0,implicitFirstChars:[..."0123456789"],resolve:Wo,identify:e=>e instanceof Date,represent:e=>e.toISOString()}),Yo=$i("tag:yaml.org,2002:seq",{create:()=>[],addItem:(e,n)=>{e.push(n)},identify:Array.isArray});function bt(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const n=Object.getPrototypeOf(e);return n===null||n===Object.prototype}function ga(e,n){const t={};for(const i of n)e[i]!==void 0&&(t[i]=e[i]);return t}var qo=$i("tag:yaml.org,2002:omap",{create:()=>({list:[],seen:new Set}),addItem:(e,n)=>{let t;if(n instanceof Map){if(n.size!==1)return"cannot resolve an ordered map item";t=n.keys().next().value}else if(bt(n)){const i=Object.keys(n);if(i.length!==1)return"cannot resolve an ordered map item";t=i[0]}else return"cannot resolve an ordered map item";return e.seen.has(t)?"duplicate key in ordered map":(e.seen.add(t),e.list.push(n),"")},finalize:e=>e.list}),Ko=$i("tag:yaml.org,2002:pairs",{create:()=>[],addItem:(e,n)=>{if(n instanceof Map)return n.size!==1?"cannot resolve a pairs item":(e.push(n.entries().next().value),"");if(Object.prototype.toString.call(n)!=="[object Object]")return"cannot resolve a pairs item";const t=n,i=Object.keys(t);return i.length!==1?"cannot resolve a pairs item":(e.push([i[0],t[i[0]]]),"")}}),Vo=yt("tag:yaml.org,2002:map",{create:()=>({}),identify:bt,represent:e=>{const n=new Map;for(const t of Object.keys(e))n.set(t,e[t]);return n},addPair:(e,n,t)=>{if(n!==null&&typeof n=="object")return"object-based map does not support complex keys";const i=String(n);return i==="__proto__"?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,""},has:(e,n)=>n!==null&&typeof n=="object"?!1:Object.prototype.hasOwnProperty.call(e,String(n)),keys:e=>Object.keys(e),get:(e,n)=>e[String(n)]}),Go=yt("tag:yaml.org,2002:set",{create:()=>new Set,identify:e=>e instanceof Set,represent:e=>{const n=new Map;for(const t of e)n.set(t,null);return n},addPair:(e,n,t)=>t!==null?"cannot resolve a set item":(e.add(n),""),has:(e,n)=>e.has(n),keys:e=>e.keys(),get:()=>null});function Jo(){return{scalar:{},sequence:{},mapping:{}}}function Xo(){return{scalar:[],sequence:[],mapping:[]}}function Zo(e){const n=[];for(const t of e){let i=n.length;for(let r=0;r<n.length;r++){const l=n[r];if(l.nodeKind===t.nodeKind&&l.tagName===t.tagName&&l.matchByTagPrefix===t.matchByTagPrefix){i=r;break}}n[i]=t}return n}var kt=class br{tags;implicitScalarTags;implicitScalarByFirstChar;implicitScalarAnyFirstChar;defaultScalarTag;defaultSequenceTag;defaultMappingTag;exact;prefix;constructor(n){const t=Zo(n),i=[],r=Jo(),l=Xo();for(const d of t){if(d.nodeKind==="scalar"&&d.implicit){if(d.matchByTagPrefix)throw new Error("Implicit scalar tags cannot match by tag prefix");i.push(d)}switch(d.nodeKind){case"scalar":d.matchByTagPrefix?l.scalar.push(d):r.scalar[d.tagName]=d;break;case"sequence":d.matchByTagPrefix?l.sequence.push(d):r.sequence[d.tagName]=d;break;case"mapping":d.matchByTagPrefix?l.mapping.push(d):r.mapping[d.tagName]=d;break}}const o=i.filter(d=>d.implicitFirstChars===null),s=new Set;for(const d of i)if(d.implicitFirstChars!==null)for(const g of d.implicitFirstChars)s.add(g);const u=new Map;for(const d of s)u.set(d,i.filter(g=>g.implicitFirstChars===null||g.implicitFirstChars.indexOf(d)!==-1));const c=r.scalar["tag:yaml.org,2002:str"];if(!c)throw new Error("schema does not define the default scalar tag (tag:yaml.org,2002:str)");this.tags=t,this.implicitScalarTags=i,this.implicitScalarByFirstChar=u,this.implicitScalarAnyFirstChar=o,this.defaultScalarTag=c,this.defaultSequenceTag=r.sequence["tag:yaml.org,2002:seq"],this.defaultMappingTag=r.mapping["tag:yaml.org,2002:map"],this.exact=r,this.prefix=l}withTags(...n){let t=[];for(const i of n)t=t.concat(i);return new br([...this.tags,...t])}},Oi=new kt([Gl,Yo,Vo]);new kt([...Oi.tags,Zl,lo,yo,$o]);var Qo=new kt([...Oi.tags,Xl,io,mr,yr]),es=new kt([...Oi.tags,eo,co,Jt,Xt,Ho,Fo,Uo,qo,Ko,Go]);yt("tag:yaml.org,2002:map",{create:()=>new Map,addPair:(e,n,t)=>(e.set(n,t),""),has:(e,n)=>e.has(n),keys:e=>e.keys(),get:(e,n)=>e.get(n),identify:e=>e instanceof Map||bt(e),represent:e=>{if(e instanceof Map)return e;const n=new Map,t=e;for(const i of Object.keys(t))n.set(i,t[i]);return n}});function _a(e){if(Array.isArray(e)){const n=Array.prototype.slice.call(e);for(let t=0;t<n.length;t++){if(Array.isArray(n[t]))return null;typeof n[t]=="object"&&Object.prototype.toString.call(n[t])==="[object Object]"&&(n[t]="[object Object]")}return String(n)}return typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"?"[object Object]":String(e)}yt("tag:yaml.org,2002:map",{create:()=>({}),identify:bt,represent:e=>{const n=new Map;for(const t of Object.keys(e))n.set(t,e[t]);return n},addPair:(e,n,t)=>{const i=_a(n);return i===null?"nested arrays are not supported inside keys":(i==="__proto__"?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,"")},has:(e,n)=>{const t=_a(n);return t!==null&&Object.prototype.hasOwnProperty.call(e,t)},keys:e=>Object.keys(e),get:(e,n)=>e[String(n)]});var ns={maxLength:79,indent:1,linesBefore:3,linesAfter:2};function Mt(e,n,t,i,r){let l="",o="";const s=Math.floor(r/2)-1;return i-n>s&&(l=" ... ",n=i-s+l.length),t-i>s&&(o=" ...",t=i+s-o.length),{str:l+e.slice(n,t).replace(/\t/g,"→")+o,pos:i-n+l.length}}function jt(e,n){return" ".repeat(Math.max(n-e.length,0))+e}function ts(e,n){if(!e.buffer)return null;const t={...ns,...n},i=/\r?\n|\r|\0/g,r=[0],l=[];let o,s=-1;for(;o=i.exec(e.buffer);)l.push(o.index),r.push(o.index+o[0].length),e.position<=o.index&&s<0&&(s=r.length-2);s<0&&(s=r.length-1);let u="";const c=Math.min(e.line+t.linesAfter,l.length).toString().length,d=t.maxLength-(t.indent+c+3);for(let f=1;f<=t.linesBefore&&!(s-f<0);f++){const p=Mt(e.buffer,r[s-f],l[s-f],e.position-(r[s]-r[s-f]),d);u=`${" ".repeat(t.indent)}${jt((e.line-f+1).toString(),c)} | ${p.str}
|
|
9
|
-
${u}`}const g=Mt(e.buffer,r[s],l[s],e.position,d);u+=`${" ".repeat(t.indent)}${jt((e.line+1).toString(),c)} | ${g.str}
|
|
10
|
-
`,u+=`${"-".repeat(t.indent+c+3+g.pos)}^
|
|
11
|
-
`;for(let f=1;f<=t.linesAfter&&!(s+f>=l.length);f++){const p=Mt(e.buffer,r[s+f],l[s+f],e.position-(r[s]-r[s+f]),d);u+=`${" ".repeat(t.indent)}${jt((e.line+f+1).toString(),c)} | ${p.str}
|
|
12
|
-
`}return u.replace(/\n$/,"")}function ma(e,n){let t="";return e.mark?(e.mark.name&&(t+=`in "${e.mark.name}" `),t+=`(${e.mark.line+1}:${e.mark.column+1})`,!n&&e.mark.snippet&&(t+=`
|
|
13
|
-
|
|
14
|
-
${e.mark.snippet}`),`${e.reason} ${t}`):e.reason}var Kn=class extends Error{reason;mark;constructor(e,n){super(),this.name="YAMLException",this.reason=e,this.mark=n,this.message=ma(this,!1),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toString(e){return`${this.name}: ${ma(this,e)}`}};function wt(e,n,t,i=""){let r=0,l=0;for(let s=0;s<n;s++){const u=e.charCodeAt(s);u===10?(r++,l=s+1):u===13&&(r++,e.charCodeAt(s+1)===10&&s++,l=s+1)}const o={name:i,buffer:e,position:n,line:r,column:n-l};throw o.snippet=ts(o),new Kn(t,o)}var is=-1;function ya(e){switch(e){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
|
|
15
|
-
`;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""}}var kr=new Array(256),wr=new Array(256);for(let e=0;e<256;e++)kr[e]=ya(e)?1:0,wr[e]=ya(e);function as(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function rs(e){return e>=48&&e<=57?e-48:(e|32)-97+10}function ls(e){return e===120?2:e===117?4:8}function Vn(e,n,t){let i=0;for(;n<t;){const r=e.charCodeAt(n);if(r===10)i++,n++;else if(r===13)i++,n++,e.charCodeAt(n)===10&&n++;else if(r===32||r===9)n++;else break}return{position:n,breaks:i}}function Pi(e){return e===1?" ":`
|
|
16
|
-
`.repeat(e-1)}function os(e,n,t){let i="",r=n,l=n,o=n;for(;r<t;){const s=e.charCodeAt(r);if(s===10||s===13){i+=e.slice(l,o);const u=Vn(e,r,t);i+=Pi(u.breaks),r=l=o=u.position}else r++,s!==32&&s!==9&&(o=r)}return i+e.slice(l,o)}function ss(e,n,t){let i="",r=n,l=n,o=n;for(;r<t;){const s=e.charCodeAt(r);if(s===39)i+=e.slice(l,r)+"'",r+=2,l=o=r;else if(s===10||s===13){i+=e.slice(l,o);const u=Vn(e,r,t);i+=Pi(u.breaks),r=l=o=u.position}else r++,s!==32&&s!==9&&(o=r)}return i+e.slice(l,t)}function cs(e,n,t){let i="",r=n,l=n,o=n;for(;r<t;){const s=e.charCodeAt(r);if(s===92){i+=e.slice(l,r),r++;const u=e.charCodeAt(r);if(u===10||u===13)r=Vn(e,r,t).position;else if(u<256&&kr[u])i+=wr[u],r++;else{let c=ls(u),d=0;for(;c>0;c--){r++;const g=rs(e.charCodeAt(r));d=(d<<4)+g}i+=as(d),r++}l=o=r}else if(s===10||s===13){i+=e.slice(l,o);const u=Vn(e,r,t);i+=Pi(u.breaks),r=l=o=u.position}else r++,s!==32&&s!==9&&(o=r)}return i+e.slice(l,t)}function ba(e,n,t,i,r,l){const o=i<0?0:i,s=e.slice(n,t).replace(/\r\n?/g,`
|
|
17
|
-
`),u=s===""?[]:(s.endsWith(`
|
|
18
|
-
`)?s.slice(0,-1):s).split(`
|
|
19
|
-
`);let c="",d=!1,g=0,f=!1;for(const p of u){let v=0;for(;v<o&&p.charCodeAt(v)===32;)v++;if(i<0||v>=p.length){g++;continue}const _=p.slice(o),k=_.charCodeAt(0);l?k===32||k===9?(f=!0,c+=`
|
|
20
|
-
`.repeat(d?1+g:g)):f?(f=!1,c+=`
|
|
21
|
-
`.repeat(g+1)):g===0?d&&(c+=" "):c+=`
|
|
22
|
-
`.repeat(g):c+=`
|
|
23
|
-
`.repeat(d?1+g:g),c+=_,d=!0,g=0}return r===3?c+=`
|
|
24
|
-
`.repeat(d?1+g:g):r!==2&&d&&(c+=`
|
|
25
|
-
`),c}function us(e,n){if(n.valueStart===is)return"";const{valueStart:t,valueEnd:i}=n;if(n.fast)return e.slice(t,i);switch(n.style){case 2:return ss(e,t,i);case 3:return cs(e,t,i);case 4:return ba(e,t,i,n.indent,n.chomping,!1);case 5:return ba(e,t,i,n.indent,n.chomping,!0);default:return os(e,t,i)}}var ds={"!":"!","!!":"tag:yaml.org,2002:"};function Sr(e,n){if(e.startsWith("!<")&&e.endsWith(">"))return decodeURIComponent(e.slice(2,-1));const t=e.indexOf("!",1),i=t===-1?"!":e.slice(0,t+1),r=n?.[i]??ds[i]??i;return decodeURIComponent(r)+decodeURIComponent(e.slice(i.length))}var Pe=-1,Li={filename:"",schema:Qo,json:!1,maxTotalMergeKeys:1e4,maxAliases:-1};function fs(e){return"tagStart"in e&&e.tagStart!==Pe?e.tagStart:"anchorStart"in e&&e.anchorStart!==Pe?e.anchorStart:"valueStart"in e&&e.valueStart!==Pe?e.valueStart:"start"in e?e.start:0}function U(e,n){wt(e.source,e.position,n,e.filename)}function Cr(e,n,t,i){try{return t.finalize(i)}catch(r){if(r instanceof Kn)throw r;wt(e.source,n,r instanceof Error?r.message:String(r),e.filename)}}function In(e,n,t){const i=e[t];if(i)return i;for(const r of n)if(t.startsWith(r.tagName))return r}function hs(e,n,t,i,r){const l=In(n,t,i);if(l)return l;U(e,`unknown ${r} tag !<${i}>`)}function ps(e,n){const t=us(e.source,n),i=n.tagStart===Pe?"":e.source.slice(n.tagStart,n.tagEnd),r=e.schema.defaultScalarTag;if(i!==""){if(i==="!")return{value:t,tag:r};const l=Sr(i,e.tagHandlers),o=In(e.schema.exact.scalar,e.schema.prefix.scalar,l);if(o){const u=o.resolve(t,!0,l);return u===S&&U(e,`cannot resolve a node with !<${l}> explicit tag`),{value:u,tag:o}}const s=In(e.schema.exact.mapping,e.schema.prefix.mapping,l)??In(e.schema.exact.sequence,e.schema.prefix.sequence,l);if(s){t!==""&&U(e,`cannot resolve a node with !<${l}> explicit tag`);const u=s.create(l);return{value:s.carrierIsResult?u:Cr(e,e.position,s,u),tag:s}}U(e,`unknown scalar tag !<${l}>`)}if(n.style===1){const l=e.schema.implicitScalarByFirstChar.get(t.charAt(0))??e.schema.implicitScalarAnyFirstChar;for(const o of l){const s=o.resolve(t,!1,o.tagName);if(s!==S)return{value:s,tag:o}}}return{value:r.resolve(t,!1,r.tagName),tag:r}}function ka(e,n,t,i,r,l){const o=n.tagStart===Pe?"":e.source.slice(n.tagStart,n.tagEnd),s=o===""||o==="!"?r:Sr(o,e.tagHandlers);return{tagName:s,tag:hs(e,t,i,s,l)}}function Tr(e){return e.nodeKind==="mapping"}function wa(e,n,t,i){for(const r of i.keys(t)){if(e.maxTotalMergeKeys!==-1&&++e.totalMergeKeys>e.maxTotalMergeKeys&&U(e,`merge keys exceeded maxTotalMergeKeys (${e.maxTotalMergeKeys})`),n.tag.has(n.value,r))continue;const l=n.tag.addPair(n.value,r,i.get(t,r));l&&U(e,l),(n.overridable??=new Set).add(r)}}function vs(e,n,t,i){if(e.position=n.keyPosition,Tr(i))wa(e,n,t,i);else if(i.nodeKind==="sequence"&&Array.isArray(t))for(const r of t)wa(e,n,r,n.tag);else U(e,"cannot merge mappings; the provided source object is unacceptable")}function gs(e,n,t,i,r){if(e.position=n.keyPosition,t===Ii){vs(e,n,i,r);return}!e.json&&n.tag.has(n.value,t)&&!n.overridable?.has(t)&&U(e,"duplicated mapping key");const l=n.tag.addPair(n.value,t,i);l&&U(e,l),n.overridable?.delete(t)}function Dt(e,n,t){const i=e.frames[e.frames.length-1];if(i.kind==="document")i.value=n,i.hasValue=!0;else if(i.kind==="sequence"){i.merge&&(Tr(t)||U(e,"cannot merge mappings; the provided source object is unacceptable"));const r=i.tag.addItem(i.value,n,i.index++);r&&U(e,r)}else if(i.hasKey){const r=i.key;i.key=void 0,i.hasKey=!1,gs(e,i,r,n,t)}else i.key=n,i.keyPosition=e.position,i.hasKey=!0}function Ut(e,n,t,i,r){if(n.anchorStart!==Pe){const l={value:t,tag:i,isValueFinal:r};return e.anchors.set(e.source.slice(n.anchorStart,n.anchorEnd),l),l}return null}function _s(e,n){const t={...Li,...n,events:e,documents:[],eventIndex:0,position:0,frames:[],anchors:new Map,tagHandlers:Object.create(null),totalMergeKeys:0,aliasCount:0};for(;t.eventIndex<t.events.length;){const i=t.events[t.eventIndex++];switch(t.position=fs(i),i.type){case 1:t.anchors=new Map,t.aliasCount=0,t.tagHandlers=Object.create(null);for(const r of i.directives)r.kind==="tag"&&(t.tagHandlers[r.handle]=r.prefix);t.frames.push({kind:"document",position:t.position,value:void 0,hasValue:!1});break;case 4:{const{value:r,tag:l}=ps(t,i);Ut(t,i,r,l,!0),Dt(t,r,l);break}case 2:{const r=ka(t,i,t.schema.exact.sequence,t.schema.prefix.sequence,"tag:yaml.org,2002:seq","sequence"),l=r.tag.create(r.tagName),o=Ut(t,i,l,r.tag,r.tag.carrierIsResult),s=t.frames[t.frames.length-1],u=s!==void 0&&s.kind==="mapping"&&s.hasKey&&s.key===Ii;t.frames.push({kind:"sequence",position:t.position,value:l,tag:r.tag,anchor:o,index:0,merge:u});break}case 3:{const r=ka(t,i,t.schema.exact.mapping,t.schema.prefix.mapping,"tag:yaml.org,2002:map","mapping"),l=r.tag.create(r.tagName),o=Ut(t,i,l,r.tag,r.tag.carrierIsResult);t.frames.push({kind:"mapping",position:t.position,value:l,tag:r.tag,anchor:o,key:void 0,keyPosition:t.position,hasKey:!1,overridable:null});break}case 5:{t.maxAliases!==-1&&++t.aliasCount>t.maxAliases&&U(t,`aliases exceeded maxAliases (${t.maxAliases})`);const r=t.source.slice(i.anchorStart,i.anchorEnd),l=t.anchors.get(r);l||U(t,`unidentified alias "${r}"`),l.isValueFinal||U(t,`recursive alias "${r}" is not supported for tag ${l.tag.tagName} because it uses finalize()`),Dt(t,l.value,l.tag);break}case 6:{const r=t.frames.pop();if(r.kind==="document")t.documents.push(r.value);else{const l=r.tag.carrierIsResult?r.value:Cr(t,r.position,r.tag,r.value);r.anchor&&(r.anchor.value=l,r.anchor.isValueFinal=!0),Dt(t,l,r.tag)}break}}}return t.documents}var C=-1,Ar=Object.prototype.hasOwnProperty,Be=1,Zt=2,xr=3,Gn=4,ms=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,ys=/[,\[\]{}]/,Nr=/^(?:!|!!|![0-9A-Za-z-]+!)$/,Qt=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]])`,Er=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$.~*'()_])`,bs=new RegExp(`^(?:${Qt})*$`),ks=new RegExp(`^(?:${Er})+$`),ws=new RegExp(`^(?:!(?:${Qt})*|${Er}(?:${Qt})*)$`),Ri={filename:"",maxDepth:100};function Ss(e,n,t){e.events.push({type:1,explicitStart:n,explicitEnd:t,directives:e.directives})}function Ir(e,n,t,i,r,l,o){e.events.push({type:2,start:n,anchorStart:t,anchorEnd:i,tagStart:r,tagEnd:l,style:o})}function ei(e,n,t,i,r,l,o){e.events.push({type:3,start:n,anchorStart:t,anchorEnd:i,tagStart:r,tagEnd:l,style:o})}function Sa(e,n){e.events.splice(n.eventsLength,0,{type:3,start:n.position,anchorStart:C,anchorEnd:C,tagStart:C,tagEnd:C,style:2})}function qe(e,n,t,i,r,l,o,s,u=1,c=-1,d=!1){e.events.push({type:4,valueStart:n,valueEnd:t,anchorStart:i,anchorEnd:r,tagStart:l,tagEnd:o,style:s,chomping:u,indent:c,fast:d})}function Cs(e,n,t){e.events.push({type:5,anchorStart:n,anchorEnd:t})}function Le(e){e.events.push({type:6})}function M(e){qe(e,C,C,C,C,C,C,1)}function Ca(){return{anchorStart:C,anchorEnd:C,tagStart:C,tagEnd:C}}function en(e){return{position:e.position,line:e.line,lineStart:e.lineStart,lineIndent:e.lineIndent,firstTabInLine:e.firstTabInLine,eventsLength:e.events.length}}function Re(e,n){e.position=n.position,e.line=n.line,e.lineStart=n.lineStart,e.lineIndent=n.lineIndent,e.firstTabInLine=n.firstTabInLine,e.events.length=n.eventsLength}function m(e,n){wt(e.input.slice(0,e.length),e.position,n,e.filename)}function O(e){return e===10||e===13}function _e(e){return e===9||e===32}function H(e){return _e(e)||O(e)}function G(e){return e===0||H(e)}function me(e){return e===44||e===91||e===93||e===123||e===125}function Ts(e){return e>=48&&e<=57?e-48:-1}function As(e){if(e>=48&&e<=57)return e-48;const n=e|32;return n>=97&&n<=102?n-97+10:-1}function xs(e){return e===120?2:e===117?4:e===85?8:0}function Ns(e){return e===48||e===97||e===98||e===116||e===9||e===110||e===118||e===102||e===114||e===101||e===32||e===34||e===47||e===92||e===78||e===95||e===76||e===80}function Jn(e){e.input.charCodeAt(e.position)===10?e.position++:(e.position++,e.input.charCodeAt(e.position)===10&&e.position++),e.line++,e.lineStart=e.position,e.lineIndent=0,e.firstTabInLine=-1}function j(e,n){let t=0,i=e.input.charCodeAt(e.position),r=e.position===e.lineStart||H(e.input.charCodeAt(e.position-1));for(;i!==0;){for(;_e(i);)r=!0,i===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(n&&r&&i===35)do i=e.input.charCodeAt(++e.position);while(!O(i)&&i!==0);if(!O(i))break;for(Jn(e),t++,r=!0,i=e.input.charCodeAt(e.position);i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position)}return t}function le(e,n=e.position){const t=e.input.charCodeAt(n);if((t===45||t===46)&&t===e.input.charCodeAt(n+1)&&t===e.input.charCodeAt(n+2)){const i=e.input.charCodeAt(n+3);return i===0||H(i)}return!1}function Ta(e){let n=e.input.charCodeAt(e.position);for(;n!==0&&!O(n);)n=e.input.charCodeAt(++e.position)}function $r(e,n,t){ms.test(e.input.slice(n,t))&&m(e,"the stream contains non-printable characters")}function Es(e,n,t){if(e.input.charCodeAt(e.position)!==33)return!1;n.tagStart!==C&&m(e,"duplication of a tag property");const i=e.position;let r=!1,l=!1,o="!",s=e.input.charCodeAt(++e.position);s===60?(r=!0,s=e.input.charCodeAt(++e.position)):s===33&&(l=!0,o="!!",s=e.input.charCodeAt(++e.position));let u=e.position,c;if(r){for(;s!==0&&s!==62;)s=e.input.charCodeAt(++e.position);s!==62&&m(e,"unexpected end of the stream within a verbatim tag"),c=e.input.slice(u,e.position),e.position++}else{for(;s!==0&&!H(s)&&!(t&&me(s));)s===33&&(l?m(e,"tag suffix cannot contain exclamation marks"):(o=e.input.slice(u-1,e.position+1),Nr.test(o)||m(e,"named tag handle cannot contain such characters"),l=!0,u=e.position+1)),s=e.input.charCodeAt(++e.position);c=e.input.slice(u,e.position),ys.test(c)&&m(e,"tag suffix cannot contain flow indicator characters")}return c&&!(r?bs.test(c):ks.test(c))&&m(e,`tag name cannot contain such characters: ${c}`),!r&&o!=="!"&&o!=="!!"&&!Ar.call(e.tagHandlers,o)&&m(e,`undeclared tag handle "${o}"`),n.tagStart=i,n.tagEnd=e.position,!0}function Is(e,n){if(e.input.charCodeAt(e.position)!==38)return!1;n.anchorStart!==C&&m(e,"duplication of an anchor property"),e.position++;const t=e.position;for(;e.input.charCodeAt(e.position)!==0&&!H(e.input.charCodeAt(e.position))&&!me(e.input.charCodeAt(e.position));)e.position++;return e.position===t&&m(e,"name of an anchor node must contain at least one character"),n.anchorStart=t,n.anchorEnd=e.position,!0}function $s(e,n){if(e.input.charCodeAt(e.position)!==42)return!1;(n.anchorStart!==C||n.tagStart!==C)&&m(e,"alias node should not have any properties"),e.position++;const t=e.position;for(;e.input.charCodeAt(e.position)!==0&&!H(e.input.charCodeAt(e.position))&&!me(e.input.charCodeAt(e.position));)e.position++;return e.position===t&&m(e,"name of an alias node must contain at least one character"),Cs(e,t,e.position),!0}function ni(e,n){j(e,!1),e.lineIndent<n&&m(e,"deficient indentation")}function Os(e,n,t){if(e.input.charCodeAt(e.position)!==39)return!1;e.position++;const i=e.position;let r=!0;for(;e.input.charCodeAt(e.position)!==0;){const l=e.input.charCodeAt(e.position);if(l===39){if(e.input.charCodeAt(e.position+1)===39){r=!1,e.position+=2;continue}const o=e.position;return e.position++,qe(e,i,o,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,2,1,-1,r),!0}O(l)?(r=!1,ni(e,n)):e.position===e.lineStart&&le(e)?m(e,"unexpected end of the document within a single quoted scalar"):l!==9&&l<32?m(e,"expected valid JSON character"):e.position++}m(e,"unexpected end of the stream within a single quoted scalar")}function Ps(e,n,t){if(e.input.charCodeAt(e.position)!==34)return!1;e.position++;const i=e.position;let r=!0;for(;e.input.charCodeAt(e.position)!==0;){const l=e.input.charCodeAt(e.position);if(l===34){const o=e.position;return e.position++,qe(e,i,o,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,3,1,-1,r),!0}if(l===92){r=!1;const o=e.input.charCodeAt(++e.position);if(O(o))ni(e,n);else if(Ns(o))e.position++;else{let s=xs(o);for(s===0&&m(e,"unknown escape sequence");s-- >0;)e.position++,As(e.input.charCodeAt(e.position))<0&&m(e,"expected hexadecimal character");e.position++}}else O(l)?(r=!1,ni(e,n)):e.position===e.lineStart&&le(e)?m(e,"unexpected end of the document within a double quoted scalar"):l!==9&&l<32?m(e,"expected valid JSON character"):e.position++}m(e,"unexpected end of the stream within a double quoted scalar")}function Ls(e,n,t){const i=e.input.charCodeAt(e.position);let r=1,l=-1,o=!1;if(i!==124&&i!==62)return!1;const s=i===124?4:5;for(e.position++;e.input.charCodeAt(e.position)!==0;){const p=e.input.charCodeAt(e.position),v=Ts(p);if(p===43||p===45)r!==1&&m(e,"repeat of a chomping mode identifier"),r=p===43?3:2,e.position++;else if(v>=0)v===0&&m(e,"bad explicit indentation width of a block scalar; it cannot be less than one"),o&&m(e,"repeat of an indentation width identifier"),l=n+v-1,o=!0,e.position++;else break}let u=!1;for(;_e(e.input.charCodeAt(e.position));)u=!0,e.position++;u&&e.input.charCodeAt(e.position)===35&&Ta(e),O(e.input.charCodeAt(e.position))?Jn(e):e.input.charCodeAt(e.position)!==0&&m(e,"a line break is expected");let c=o?l:-1,d=0;const g=e.position;let f=e.position;for(;e.input.charCodeAt(e.position)!==0;){const p=e.position;let v=0;for(;e.input.charCodeAt(p+v)===32;)v++;const _=e.input.charCodeAt(p+v);if(_===0){c>=0?v>c&&(f=p+v):v>0&&(f=p+v);break}if(p===e.lineStart&&le(e,p))break;if(!o&&c===-1&&O(_)&&(d=Math.max(d,v)),!o&&c===-1&&!O(_)&&(_===9&&v<n&&(e.position=p+v,m(e,"tab characters must not be used in indentation")),v<d&&(e.position=p+v,m(e,"bad indentation of a mapping entry"))),c===-1&&_!==0&&!O(_)&&v<n){e.lineIndent=v,e.position=p+v;break}!o&&_!==0&&!O(_)&&c===-1&&(c=v);const k=c===-1?n+1:c;if(_!==0&&!O(_)&&v<k){e.lineIndent=v,e.position=p+v;break}Ta(e),f=e.position,O(e.input.charCodeAt(e.position))&&(Jn(e),f=e.position)}return $r(e,g,f),qe(e,g,f,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,s,r,c),!0}function Rs(e,n){const t=e.input.charCodeAt(e.position),i=n===Be;if(t===0||H(t)||t===35||t===38||t===42||t===33||t===124||t===62||t===39||t===34||t===37||t===64||t===96||i&&me(t))return!1;if(t===63||t===45){const r=e.input.charCodeAt(e.position+1);if(G(r)||i&&me(r))return!1}return!0}function Fs(e,n,t,i){if(!Rs(e,t))return!1;const r=e.position;let l=e.position,o=e.input.charCodeAt(e.position);const s=t===Be;let u=!1;for(;o!==0&&!(e.position===e.lineStart&&le(e));){if(o===58){const c=e.input.charCodeAt(e.position+1);if(G(c)||s&&me(c))break}else if(o===35){if(H(e.input.charCodeAt(e.position-1)))break}else{if(s&&me(o))break;if(O(o)){const c=e.position,d=e.line,g=e.lineStart,f=e.lineIndent;if(j(e,!1),e.lineIndent>=n){u=!0,o=e.input.charCodeAt(e.position);continue}e.position=c,e.line=d,e.lineStart=g,e.lineIndent=f;break}}_e(o)||(l=e.position+1),o=e.input.charCodeAt(++e.position)}return l===r?!1:($r(e,r,l),qe(e,r,l,i.anchorStart,i.anchorEnd,i.tagStart,i.tagEnd,1,1,-1,!u),!0)}function Ge(e,n){const t=e.line;j(e,!0),(e.line>t&&e.lineIndent<n||e.firstTabInLine!==-1&&e.lineIndent<n)&&m(e,"deficient indentation")}function Ms(e,n,t){const i=e.input.charCodeAt(e.position),r=i===123,l=e.position;let o=!0;if(i!==91&&i!==123)return!1;const s=r?125:93;for(r?ei(e,l,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,2):Ir(e,l,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,2),e.position++;e.input.charCodeAt(e.position)!==0;){Ge(e,n);let u=e.input.charCodeAt(e.position);if(u===s)return e.position++,Le(e),!0;o?u===44&&m(e,"expected the node content, but found ','"):m(e,"missed comma between flow collection entries");let c=!1,d=!1;u===63&&H(e.input.charCodeAt(e.position+1))&&(c=d=!0,e.position+=1,Ge(e,n));const g=e.line,f=en(e),p=ce(e,n,Be,!1,!0);Ge(e,n),u=e.input.charCodeAt(e.position),(r||d||e.line===g)&&u===58?(c=!0,e.position++,Ge(e,n),r||Sa(e,f),p||M(e),ce(e,n,Be,!1,!0)||M(e),Ge(e,n),r||Le(e)):r&&c?(p||M(e),M(e)):r?M(e):c&&(Sa(e,f),p||M(e),M(e),Le(e)),u=e.input.charCodeAt(e.position),u===44?(o=!0,e.position++):o=!1}m(e,"unexpected end of the stream within a flow collection")}function Aa(e,n,t){if(e.firstTabInLine!==-1||e.input.charCodeAt(e.position)!==45||!G(e.input.charCodeAt(e.position+1)))return!1;for(Ir(e,e.position,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,1);e.input.charCodeAt(e.position)===45&&G(e.input.charCodeAt(e.position+1));){e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,m(e,"tab characters must not be used in indentation"));const i=e.line;e.position++;const r=j(e,!0)>0;if(e.firstTabInLine!==-1&&e.input.charCodeAt(e.position)===45&&G(e.input.charCodeAt(e.position+1))&&m(e,"bad indentation of a sequence entry"),r&&e.lineIndent<=n?M(e):ce(e,n,xr,!1,!0),j(e,!0),e.lineIndent<n||e.position>=e.length)break;e.lineIndent>n&&m(e,"bad indentation of a sequence entry"),e.line===i&&e.input.charCodeAt(e.position)===45&&G(e.input.charCodeAt(e.position+1))&&m(e,"bad indentation of a sequence entry")}return Le(e),!0}function Bt(e,n,t,i){let r=!1,l=!1,o=!1,s=!1;if(e.firstTabInLine!==-1)return!1;let u=e.input.charCodeAt(e.position);for(;u!==0;){!r&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,m(e,"tab characters must not be used in indentation"));const c=e.input.charCodeAt(e.position+1),d=e.line;if((u===63||u===58)&&G(c))o||(ei(e,e.position,i.anchorStart,i.anchorEnd,i.tagStart,i.tagEnd,1),o=!0),u===63?(r&&M(e),l=!0,r=!0):(r||(M(e),l=!0),r=!1),e.position+=1,s=!0;else{r&&(M(e),r=!1);const g=en(e);if(!ce(e,t,Zt,!1,!0))break;if(e.line===d){for(u=e.input.charCodeAt(e.position);_e(u);)u=e.input.charCodeAt(++e.position);if(u===58){if(u=e.input.charCodeAt(++e.position),G(u)||m(e,"a whitespace character is expected after the key-value separator within a block mapping"),!o){for(Re(e,g),ei(e,g.position,i.anchorStart,i.anchorEnd,i.tagStart,i.tagEnd,1),o=!0,ce(e,t,Zt,!1,!0),u=e.input.charCodeAt(e.position);_e(u);)u=e.input.charCodeAt(++e.position);e.position++}l=!0,r=!1,s=!1}else if(l)m(e,"expected ':' after a mapping key");else return i.anchorStart!==C||i.tagStart!==C?(Re(e,g),!1):!0}else if(l)m(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return i.anchorStart!==C||i.tagStart!==C?(Re(e,g),!1):!0}if(ce(e,n,Gn,!0,s)&&(s=!1),r||s&&(M(e),s=!1),j(e,!0),u=e.input.charCodeAt(e.position),(e.line===d||e.lineIndent>n)&&u!==0)m(e,"bad indentation of a mapping entry");else if(e.lineIndent<n)break}return l?(r&&M(e),o&&Le(e),!0):!1}function ce(e,n,t,i,r,l=!0){e.depth>=e.maxDepth&&m(e,`nesting exceeded maxDepth (${e.maxDepth})`),e.depth++;let o=1,s=!1,u=!1,c=null;const d=Ca();let g=t===Gn||t===xr,f=g;const p=g;if(i&&j(e,!0)&&(s=!0,e.lineIndent>n?o=1:e.lineIndent===n?o=0:o=-1),e.position===e.lineStart&&le(e))return e.depth--,!1;if(o===1)for(;;){const v=e.input.charCodeAt(e.position),_=en(e);if(s&&o!==1&&(v===33||v===38))break;if(s&&p&&(d.tagStart!==C||d.anchorStart!==C)&&(v===33||v===38)){const k=en(e),w=n+1;if(Bt(e,e.position-e.lineStart,w,d)&&e.events[k.eventsLength]?.type===3)return e.depth--,!0;Re(e,k)}if(s&&(v===33&&d.tagStart!==C||v===38&&d.anchorStart!==C)||!Es(e,d,t===Be)&&!Is(e,d))break;c===null&&(c=_),j(e,!0)?(s=!0,f=p,e.lineIndent>n?o=1:e.lineIndent===n?o=0:o=-1):f=!1}if(f&&(f=s||r),o===1||t===Gn){const v=t===Be||t===Zt?n:n+1,_=e.position-e.lineStart;if(o===1)if(f&&(Aa(e,_,d)||Bt(e,_,v,d))||Ms(e,v,d))u=!0;else{const k=e.input.charCodeAt(e.position);if(c!==null&&l&&p&&!f&&k!==124&&k!==62){const w=en(e),b=c.position-c.lineStart;Re(e,c),Bt(e,b,v,Ca())&&e.events[w.eventsLength]?.type===3?u=!0:Re(e,w)}!u&&(g&&Ls(e,v,d)||Os(e,v,d)||Ps(e,v,d)||$s(e,d)||Fs(e,v,t,d))&&(u=!0)}else o===0&&(u=f&&Aa(e,_,d))}return g=g&&!u,!u&&(d.anchorStart!==C||d.tagStart!==C||g)&&(qe(e,C,C,d.anchorStart,d.anchorEnd,d.tagStart,d.tagEnd,1),u=!0),e.depth--,u||d.anchorStart!==C||d.tagStart!==C}function js(e){if(e.lineIndent>0||e.input.charCodeAt(e.position)!==37)return!1;e.position++;const n=e.position;for(;e.input.charCodeAt(e.position)!==0&&!H(e.input.charCodeAt(e.position));)e.position++;const t=e.input.slice(n,e.position),i=[];for(t.length===0&&m(e,"directive name must not be less than one character in length");e.input.charCodeAt(e.position)!==0&&!O(e.input.charCodeAt(e.position));){for(;_e(e.input.charCodeAt(e.position));)e.position++;if(e.input.charCodeAt(e.position)===35||O(e.input.charCodeAt(e.position))||e.input.charCodeAt(e.position)===0)break;const r=e.position;for(;e.input.charCodeAt(e.position)!==0&&!H(e.input.charCodeAt(e.position));)e.position++;i.push(e.input.slice(r,e.position))}if(O(e.input.charCodeAt(e.position))&&Jn(e),t==="YAML"){e.directives.some(l=>l.kind==="yaml")&&m(e,"duplication of %YAML directive"),i.length!==1&&m(e,"YAML directive accepts exactly one argument");const r=/^([0-9]+)\.([0-9]+)$/.exec(i[0]);r===null&&m(e,"ill-formed argument of the YAML directive"),parseInt(r[1],10)!==1&&m(e,"unacceptable YAML version of the document"),e.directives.push({kind:"yaml",version:i[0]})}else if(t==="TAG"){i.length!==2&&m(e,"TAG directive accepts exactly two arguments");const[r,l]=i;Nr.test(r)||m(e,"ill-formed tag handle (first argument) of the TAG directive"),Ar.call(e.tagHandlers,r)&&m(e,`there is a previously declared suffix for "${r}" tag handle`),ws.test(l)||m(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagHandlers[r]=l,e.directives.push({kind:"tag",handle:r,prefix:l})}return!0}function Ds(e){e.directives=[],e.tagHandlers=Object.create(null);let n=!1;for(j(e,!0);js(e);)n=!0,j(e,!0);let t=!1,i=!1,r=!0;if(e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45&&G(e.input.charCodeAt(e.position+3))){t=!0;const s=e.line;e.position+=3,j(e,!0),r=e.line>s}else n&&m(e,"directives end mark is expected");const l=e.events.length;if(!t&&e.position===e.lineStart&&e.input.charCodeAt(e.position)===46&&le(e)){e.position+=3,j(e,!0);return}if(Ss(e,t,!1),ce(e,e.lineIndent-1,Gn,!1,r,r)||M(e),j(e,!0),e.position===e.lineStart&&le(e)&&(i=e.input.charCodeAt(e.position)===46,i)){const s=e.line;e.position+=3,j(e,!0),e.line===s&&e.position<e.length&&m(e,"end of the stream or a document separator is expected")}const o=e.events[l];o?.type===1&&(o.explicitEnd=i),Le(e),!i&&e.position<e.length&&!(e.position===e.lineStart&&le(e))&&m(e,"end of the stream or a document separator is expected")}function Us(e,n){const t=e.length,i={...Ri,...n,input:`${e}\0`,length:t,position:0,line:0,lineStart:0,lineIndent:0,firstTabInLine:-1,depth:0,directives:[],tagHandlers:Object.create(null),events:[]},r=e.indexOf("\0");for(r!==-1&&wt(e,r,"null byte is not allowed in input",i.filename),i.input.charCodeAt(i.position)===65279&&i.position++;i.position<i.length&&(j(i,!0),!(i.position>=i.length));){const l=i.position;Ds(i),i.position===l&&m(i,"can not read a document")}return i.events}var Bs={...Ri,...Li};function zs(e,n={}){const t={...Bs,...n},i=String(e),r=Object.keys(Ri),l=Object.keys(Li);return _s(Us(i,ga(t,r)),{...ga(t,l),source:i})}function Ws(e,n){const t=zs(e,n);if(t.length===0)throw new Kn("expected a document, but the input is empty");if(t.length===1)return t[0];throw new Kn("expected a single document in the stream, but found more")}es.withTags({...Jt,resolve:(e,n,t)=>{const i=Jt.resolve(e,n,t);return i===S?mr.resolve(e,n,t):i}},{...Xt,resolve:(e,n,t)=>{const i=Xt.resolve(e,n,t);return i===S?yr.resolve(e,n,t):i}});function Hs(e){if(e.trim()==="")return{};const t=Ws(e);if(t==null)return{};if(typeof t!="object"||Array.isArray(t))throw new Error(".agent-user.yml must parse to an object");return t}const xa={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"},Na={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"]},Ys=[{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"]}],Ea=[{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 Or(e={}){return e.extended===!0?[xa,Na,...Ys,...Ea]:[xa,Na,...Ea]}function St(e,n={}){const t=Or(n),i=Math.max(0,Math.min(t.length-1,e));return t[i]}function qs(e){const n={},t=i=>{n[i]=!0;const r=e.clusterOf.get(i);r!==void 0&&(n[r]=!0)};for(const i of e.installed)t(i);for(const i of e.roleDefaults)t(i);for(const i of e.detected)t(i);return n}function Ks(e,n){const t=new Set(n);return e.filter(i=>i!=="engineering-base"&&!t.has(i)).sort()}function Vs(e,n){const t={type:"object",properties:{},...e.description!==void 0?{description:e.description}:{}},i=t.properties,r=e.properties??{};for(const l of n){const o=l.split(".").filter(F=>F.length>0);if(o.length===0)continue;const[s,u,c]=o;if(s===void 0)continue;const d=r[s];if(d===void 0)continue;if(u===void 0){i[s]=d;continue}const g=d.properties?.[u];if(g===void 0)continue;const p=i[s]??{type:"object",properties:{},...d.description!==void 0?{description:d.description}:{}},v=p.properties??={};if(c===void 0){v[u]=g,i[s]=p;continue}const _=g.properties?.[c];if(_===void 0)continue;const w=v[u]??{type:"object",properties:{},...g.description!==void 0?{description:g.description}:{}},b=w.properties??={};b[c]=_,v[u]=w,i[s]=p}return t}function Gs({current:e,total:n}){const t=Math.max(1,n),i=Math.max(0,Math.min(t-1,e)),r=Array.from({length:t},(o,s)=>s<=i),l=Math.round((i+1)/t*100);return a("div",{class:"ac-wizard__progress",role:"progressbar","aria-valuenow":i+1,"aria-valuemin":1,"aria-valuemax":t,"aria-valuetext":`Step ${i+1} of ${t} (${l}%)`,children:r.map((o,s)=>a("span",{class:`ac-wizard__progress-segment${o?" ac-wizard__progress-segment--filled":""}`,"aria-hidden":"true"},s))})}function Js({step:e,index:n,total:t}){return a("header",{class:"ac-page__header ac-wizard__header",children:[a("p",{class:"ac-wizard__step-count",children:["Step ",n+1," of ",t]}),a("div",{class:"ac-wizard__header-text",children:[a("h1",{children:e.title}),a("p",{class:"ac-wizard__subtitle",children:e.subtitle})]}),a(Gs,{current:n,total:t})]})}function Xs(e){const n=e.canFinish??!0,t=e.completed??!1;return a("div",{class:"ac-form__actions ac-wizard__nav",children:[a("button",{type:"button",class:"ac-button",disabled:!e.canGoPrev||e.busy,onClick:e.onPrev,children:"Back"}),e.canSkip&&e.onSkip!==void 0?a("button",{type:"button",class:"ac-button ac-wizard__skip",disabled:e.busy,onClick:e.onSkip,children:e.skipLabel??"Skip"}):null,e.isLast?t?null:a("button",{type:"button",class:"ac-button ac-button--primary",disabled:e.busy||!n,onClick:e.onFinish,children:e.busy?"Saving…":"Finish & save"}):a("button",{type:"button",class:"ac-button ac-button--primary",disabled:!e.canGoNext||e.busy,onClick:e.onNext,children:e.nextLabel??"Next"})]})}function Pr(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 Zs(e,n){return e.kind==="userMd"?n==="body"||n.startsWith("body."):Pr(e,n)}function Qs(e,n){for(const t of Object.keys(n.errors))if(Zs(e,t))return!0;return!1}function ec(e,n){if(Qs(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 t=n.changes.filter(i=>Pr(e,i.path)).length;return t===0?{label:"",tone:"idle"}:{label:`${t} change${t===1?"":"s"}`,tone:"changed"}}if(e.kind==="aiTools"){const t=n.selectedToolsCount??0;return t===0?{label:"",tone:"idle"}:{label:`${t} tool${t===1?"":"s"}`,tone:"changed"}}if(e.kind==="packs"){const t=n.selectedPacksCount??0;return t===0?{label:"",tone:"idle"}:{label:`${t} pack${t===1?"":"s"}`,tone:"changed"}}return{label:"",tone:"idle"}}function nc(e){const n=e.steps.filter((s,u)=>u!==e.currentIndex),t=e.packRemovals??[],i=e.selectedToolIds??[],r=e.packAdditions??[],l=e.changes.length,o=i.length>0||r.length>0||l>0||e.userMdChanged;return a(L,{children:[o?a("section",{class:"ac-review-summary","aria-label":"What happens on Finish",children:[a("h2",{class:"ac-review-summary__title",children:"What happens on Finish"}),a("ul",{class:"ac-review-summary__list",children:[l>0?a("li",{children:[a("strong",{children:l})," setting",l===1?"":"s"," will change"," ","in ",a("code",{children:".agent-settings.yml"}),"."]}):a("li",{children:"No settings change."}),e.userMdChanged?a("li",{children:[a("code",{children:".agent-user.yml"})," will be"," ",e.userMdAction==="create"?"created":"updated","."]}):null,i.length>0?a("li",{children:["Config is installed for ",i.length," tool",i.length===1?"":"s",":",a("span",{class:"ac-review-summary__chips",children:i.map(s=>a("code",{class:"ac-review-summary__chip",children:s},s))})]}):null,r.length>0?a("li",{children:["New pack",r.length===1?"":"s",":",a("span",{class:"ac-review-summary__chips",children:r.map(s=>a("code",{class:"ac-review-summary__chip",children:s},s))})]}):null]})]}):null,t.length>0?a("div",{class:"ac-review-removals",role:"alert",children:[a("p",{class:"ac-review-removals__title",children:["⚠️ ",t.length===1?"1 installed pack will be removed":`${t.length} installed packs will be removed`]}),a("ul",{class:"ac-review-removals__list",children:t.map(s=>a("li",{children:a("code",{children:s})},s))}),a("label",{class:"ac-review-removals__confirm",children:[a("input",{type:"checkbox",checked:e.removalsConfirmed??!1,onChange:s=>{e.onConfirmRemovals?.(s.currentTarget.checked)}}),a("span",{children:"I understand these packs will no longer be installed. Re-check them on the packs step to keep them."})]})]}):null,a("nav",{class:"ac-wizard__review-nav","aria-label":"Jump back to a step",children:[a("p",{class:"ac-wizard__review-nav-label",children:"Jump back to a step:"}),a("ul",{class:"ac-wizard__review-nav-list",children:n.map(s=>{const u=e.steps.indexOf(s),c=ec(s,e),d=c.tone==="error"?"ac-wizard__review-nav-button ac-wizard__review-nav-button--error":"ac-wizard__review-nav-button";return a("li",{children:a("button",{type:"button",class:d,onClick:()=>{e.onJump(u)},children:[a("span",{class:"ac-wizard__review-nav-index",children:u+1}),a("span",{class:"ac-wizard__review-nav-text",children:s.navLabel}),c.label!==""?a("span",{class:`ac-wizard__review-nav-status ac-wizard__review-nav-status--${c.tone}`,children:c.label}):null]})},s.id)})})]})]})}function tc(e){const n=e.abortedAt??"unknown time",t=e.abortNote??"no further detail recorded",i=e.writesSinceRollback;return a("aside",{class:"ac-banner ac-banner--recovery",role:"alert",children:[a("strong",{children:"Previous install was interrupted."}),a("p",{children:["Aborted at ",a("code",{children:n})," — ",t,". ",i," write",i===1?"":"s"," landed before the abort marker."]}),a("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."}),a("div",{class:"ac-banner__actions",children:[a("button",{type:"button",disabled:e.busy,onClick:()=>e.onResume(),children:"Resume install"}),a("button",{type:"button",disabled:e.busy,onClick:()=>e.onRollback(),children:"Rollback"}),a("button",{type:"button",disabled:e.busy,onClick:()=>e.onIgnore(),children:"Ignore"})]})]})}function ic(){return a("section",{class:"ac-continue-screen","aria-labelledby":"ac-continue-title",children:[a("h2",{id:"ac-continue-title",children:"Install complete — continue with setup?"}),a("p",{children:"Your install selections (AI tools, roles, capability packs) are captured. Use the footer to continue:"}),a("ul",{children:[a("li",{children:[a("strong",{children:"Next"})," — go through the remaining personalisation steps: editor + tooling, personality, cost profile, roadmap & quality, memory, your",a("code",{children:" .agent-user.yml"}),", and finally the project module roots."]}),a("li",{children:[a("strong",{children:"Finish install here"})," — skip the rest and write ",a("code",{children:".agent-settings.yml"})," with the install-only selections. You can re-run ",a("code",{children:"agent-config setup"}),"later to pick up the personalisation steps."]})]})]})}function ac(e){const n=e.version??"unknown";return a("section",{class:"ac-backup-screen","aria-labelledby":"ac-backup-title",children:[a("h2",{id:"ac-backup-title",children:"Existing v3 install detected"}),a("p",{children:["Found a v3.x install at ",a("code",{children:e.sourcePath})," ","(VERSION: ",a("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?a("p",{class:"ac-banner ac-banner--error",children:["Backup failed: ",e.error]}):null,a("ul",{children:[a("li",{children:[a("strong",{children:"Backup v3 and proceed"})," — copies the tree to ",a("code",{children:e.backupTarget}),", then runs the v4 install. Restore later with",a("code",{children:[" mv ",e.backupTarget," ",e.sourcePath]}),"."]}),a("li",{children:[a("strong",{children:"Abort, uninstall v3 first"})," — closes the wizard. You decide what to keep."]})]}),a("div",{class:"ac-backup-screen__actions",children:[a("button",{type:"button",class:"ac-button ac-button--primary",disabled:e.busy,onClick:()=>e.onBackupAndProceed(),children:e.busy?"Backing up…":"Backup v3 and proceed"}),a("button",{type:"button",class:"ac-button",disabled:e.busy,onClick:()=>e.onAbort(),children:"Abort, uninstall v3 first"})]})]})}const rc=[{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 lc({text:e}){const[n,t]=Ni(!1);return a("button",{type:"button",class:"ac-button ac-checklist__copy",onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{t(!0),setTimeout(()=>{t(!1)},1500)})},children:n?"Copied ✓":"Copy"})}function oc({message:e}){return a("div",{class:"ac-checklist",children:[a("div",{class:"ac-checklist__hero",children:[a("h2",{class:"ac-checklist__headline",children:"Setup complete"}),e!==null?a("p",{class:"ac-checklist__message",children:e}):null]}),a("ol",{class:"ac-checklist__items",children:rc.map(n=>a("li",{class:"ac-checklist__item",children:[a("div",{class:"ac-checklist__text",children:[a("span",{class:"ac-checklist__item-title",children:n.title}),a("span",{class:"ac-checklist__item-detail",children:n.detail})]}),n.command!==void 0?a("div",{class:"ac-checklist__cmd-row",children:[a("code",{class:"ac-checklist__cmd",children:n.command}),a(lc,{text:n.command})]}):null]},n.title))}),a("p",{class:"ac-checklist__close-hint",children:"You can close this browser window — the local server shuts down on its own."})]})}const Lr=h(!1),nn=h(null),x=h(null),Xn=h(!1),Zn=h(!1),ye=h(0),Fi=h(null),W=h({}),Rr=h({}),Fr=h(0),Fe=h({}),$=h(null),ue=h(null),Mi=h(!1),ti=h(!1),Ct=h(!1),Mr=h({}),Tt=h([]);h("global");const Ee=h(!1),D=h(!1),sc=h(!1),Qn=h(!1),et=h(null),ji=h([]),nt=h({}),tt=h(!0),it=h(""),at=h("agents");h(!1);const jr=h(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"}],ii=h(!1),Me=h(!1),de=h(null),At=h([]),xt=h([]),be=h([]),ai=h(!1),bn=h([]),Z=h({}),Dr=h(!1),ri=h(!1),$n=h(!1),Di=h({}),Ia=h(!1),Ur=h(null),Br=h(null),zr=h(null),Wr=h(null),li=h(null),Hr=h(null),oi=h("https://github.com/rtk-ai/rtk"),si=h(!1),Yr=h(null),uc=h(null),ci=h(null),qr=h("event4u-app/agent-switch"),Ui=h(!1);h(!1);h(null);h([]);h({});h({});const ee=h({}),ae=h({}),ui=h(!1),$a=h(!1);h({});h(null);h(null);h(!1);h(null);const rt=h(null),Kr=h(!1),di=h(null),fi=h(!1),hi=h(!1),pi=h(null),je=h(null),On=h(!1),Bi=h(!1);function Vr(){return Or({extended:D.value})}function ze(){return Vr().length}function dc(e){return e??new Date().toISOString()}function zi(e){return Math.max(0,Math.min(ze()-1,e))}function fc(e){if("$ref"in e&&e.$ref!==void 0&&"definitions"in e&&e.definitions!==void 0){const n=e.$ref.replace("#/definitions/",""),t=e.definitions[n];if(t!==void 0)return t}return e}async function hc(){try{return await y("/api/v1/settings")}catch(e){if(e instanceof E&&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 t=await y("/api/v1/schema");return{values:{},lastModified:0,path:".agent-settings.yml",schema:t.settings}}throw e}}async function pc(){try{const e=await y("/api/v1/install/recovery");rt.value=e.incomplete?e:null}catch{rt.value=null}}async function vc(){try{const e=await y("/api/v1/install/legacy-v3");di.value=e.present?e:null}catch{di.value=null}}async function gc(){hi.value=!0,pi.value=null;try{await y("/api/v1/install/backup-v3",{method:"POST"}),fi.value=!0}catch(e){pi.value=e instanceof E?z(e.body.error??{code:"UNKNOWN",message:e.message}):e instanceof Error?e.message:String(e)}finally{hi.value=!1}}async function zt(e){try{await y("/api/v1/install/recovery/dismiss",{method:"POST",body:{reason:e}})}catch(n){x.value={message:n instanceof Error?n.message:String(n),tone:"error"};return}rt.value=null,Kr.value=!0}async function _c(){nn.value=null;try{pc(),vc();const[e,n]=await Promise.all([y("/api/v1/wizard/state"),hc()]);Fi.value=fc(n.schema),Fr.value=n.lastModified,Rr.value=n.values,Mr.value=n.legacyHints??{},D.value=e.extendedSteps===!0,je.value=e.wizardMode??null;const t=Object.keys(e.partial??{});W.value=t.length>0?{...n.values,...e.partial}:n.values,ye.value=zi(e.step),Ee.value=!1,Lr.value=!0;const i=St(ye.value,{extended:D.value});(i.kind==="welcome"||i.kind==="userMd"||i.kind==="review")&&Wi(),(i.kind==="roles"||i.kind==="aiTools"||i.kind==="packs")&&kn(),i.kind==="roles"&&Hi(),i.kind==="aiTools"&&Nt(),i.id==="identity"&&(Gr(),Jr()),i.kind==="review"&&Xr()}catch(e){e instanceof E?nn.value=z(e.body.error??{code:"UNKNOWN",message:e.message}):nn.value=e instanceof Error?e.message:String(e)}}function mc(e,n){return e.identity.name.trim()!==""?e:{...e,identity:{...e.identity,name:n}}}async function Wi(){if(!ti.value)try{const e=await y("/api/v1/user-md");if(Mi.value=e.exists,e.exists&&e.identity!==null){const n=va(e.identity);ue.value=n,$.value=n}else{let n;try{const i=await y("/api/v1/user-md/template");n=va(Hs(i.body))}catch{n=_r()}const t=Mr.value.user_name;typeof t=="string"&&t.trim()!==""&&(n=mc(n,t)),ue.value=n,$.value=n}}catch(e){x.value={message:e instanceof Error?e.message:String(e),tone:"error"}}finally{ti.value=!0}}const yc=new Set(["python"]);async function kn(){if(!(ii.value||Me.value)){Me.value=!0,de.value=null;try{const[e,n]=await Promise.all([y("/api/v1/wizard/manifest"),y("/api/v1/wizard/auto-detect")]),t=(e.packs??[]).map(l=>({id:l.id,label:l.label??l.id,description:l.description??"",requires_hint:l.requires_hint,cluster:l.cluster??void 0,workspaces:l.workspaces}));At.value=t,bn.value=(e.workspaces??[]).filter(l=>l.id!=="agent-config-maintainer").map(l=>({id:l.id,label:l.label??l.id,description:l.description??"",default_packs:l.default_packs??[],optional_packs:l.optional_packs??[],...l.example_roles!==void 0?{example_roles:l.example_roles}:{}}));const i=new Set(t.map(l=>l.id)),r=n.signals.map(l=>l.id.startsWith("pack-")?l.id.slice(5):l.id).filter(l=>i.has(l)).filter(l=>!yc.has(l));xt.value=r,be.value=(e.installedPacks??[]).filter(l=>i.has(l))}catch(e){e instanceof E?de.value=z(e.body.error??{code:"UNKNOWN",message:e.message}):de.value=e instanceof Error?e.message:String(e)}finally{Me.value=!1,ii.value=!0}}}async function Nt(){if(!(ri.value||$n.value)){$n.value=!0;try{const e=await y("/api/v1/wizard/detect-tools"),n=e.tools??{},t=e.configured??[];if(Di.value=n,Object.keys(ee.value).length===0){const i={};if(t.length>0)for(const r of t)i[r]=!0;else for(const[r,l]of Object.entries(n))l&&(i[r]=!0);ee.value=i}}catch{}finally{$n.value=!1,ri.value=!0}}}async function Gr(){if(!Ia.value){Ia.value=!0;try{const e=await y("/api/v1/wizard/detect-rtk"),n=e.installed===!0;Ur.value=n,Br.value=e.present===!0,zr.value=e.identity??null,Wr.value=e.version??null,li.value=e.installCommand??null,Hr.value=e.installCommands??null,typeof e.repo=="string"&&(oi.value=e.repo);const t=W.value.personal??{};W.value={...W.value,personal:{...t,rtk_installed:n}}}catch{}}}async function Jr(){if(!si.value){si.value=!0;try{const e=await y("/api/v1/wizard/detect-agent-switch");Yr.value=e.installed===!0,uc.value=e.version??null,ci.value=e.installCommand??null,typeof e.repo=="string"&&(qr.value=e.repo),Ui.value=e.dismissed===!0}catch{}}}async function bc(e,n){try{await y("/api/v1/wizard/state",{method:"POST",body:{step:e,totalSteps:ze(),partial:n,startedAt:dc(null)}})}catch(t){x.value={message:t instanceof Error?t.message:String(t),tone:"error"}}}async function Xr(){Zn.value=!0;try{const e=await y("/api/v1/settings/diff",{method:"POST",body:{values:W.value,ifUnmodifiedSince:Fr.value}});Tt.value=e.changes,Fe.value={}}catch(e){e instanceof E?(Fe.value=mt(e.body.error??{message:e.message}),x.value={message:z(e.body.error??{code:"UNKNOWN",message:e.message}),tone:"error"}):x.value={message:e instanceof Error?e.message:String(e),tone:"error"}}finally{Zn.value=!1}}function lt(){return Ct.value?!1:$.value===null||ue.value===null?$.value!==ue.value:JSON.stringify($.value)!==JSON.stringify(ue.value)}async function Ie(e){const n=zi(e);await bc(n,W.value),ye.value=n,x.value=null;const t=St(n,{extended:D.value});(t.kind==="welcome"||t.kind==="userMd")&&Wi(),(t.kind==="roles"||t.kind==="aiTools"||t.kind==="packs")&&kn(),t.kind==="roles"&&Hi(),t.kind==="packs"&&It(),t.kind==="aiTools"&&Nt(),t.id==="identity"&&(Gr(),Jr()),t.kind==="review"&&Xr()}function Et(){const e=ae.value,n=new Map(At.value.map(l=>[l.id,l])),t=Object.entries(e).filter(([,l])=>l===!0).map(([l])=>l).filter(l=>{const o=n.get(l)?.cluster;return o===void 0||e[o]===!0}),i=new Set,r=l=>{if(!i.has(l)){i.add(l);for(const o of n.get(l)?.requires_hint??[])r(o)}};for(const l of t)r(l);return[...i].sort()}async function Hi(){if(await Promise.all([kn(),Wi()]),Dr.value||Object.values(Z.value).some(Boolean))return;const e=$.value?.role??[];if(e.length===0)return;const n=new Set(bn.value.map(i=>i.id)),t={};for(const i of e)n.has(i)&&(t[i]=!0);Object.keys(t).length!==0&&(Z.value=t,It())}function It(){if(ui.value)return;const e=Object.entries(Z.value).filter(([,r])=>r===!0).map(([r])=>r),n=new Map(bn.value.map(r=>[r.id,r])),t=[];for(const r of e)for(const l of n.get(r)?.default_packs??[])t.push(l);const i=new Map;for(const r of At.value)r.cluster!==void 0&&i.set(r.id,r.cluster);ae.value=qs({installed:be.value,roleDefaults:t,detected:xt.value,clusterOf:i})}function kc(){const e=Object.entries(ee.value).filter(([,i])=>i===!0).map(([i])=>i);if(e.length===0)return null;const n=Et(),t={schema_version:"wizard-v2",tools:e,packs:n,settings:W.value};return ge.value?.dryRun===!0&&(t.dry_run=!0),t}async function wc(){Xn.value=!0,x.value=null;try{const e={settings:W.value},n=Object.entries(Z.value).filter(([,u])=>u===!0).map(([u])=>u),t=$.value!==null&&typeof $.value.identity?.name=="string"&&$.value.identity.name.trim().length>0;$.value!==null&&t&&(lt()||n.length>0)&&(e.identity=n.length>0?{...$.value,role:n}:$.value);const i=await y("/api/v1/wizard/finish",{method:"POST",body:e}),r="You can close this browser window now.",l=i.dryRun===!0?"Dry-run complete — no files written. Settings would be saved.":Array.isArray(i.writtenPaths)?`Saved (${i.writtenPaths.join(", ")}). Wizard complete.`:"Wizard complete.",o=D.value?kc():null;let s="";if(o!==null&&o.dry_run===!0)try{await y("/api/v1/wizard/apply",{method:"POST",body:o}),s=" Installer preview OK (dry-run) — no files written."}catch(u){s=` Installer preview failed: ${u instanceof E?z(u.body.error??{code:"UNKNOWN",message:u.message}):u instanceof Error?u.message:String(u)}.`}else if(o!==null)try{let u=null;await Ol("/api/v1/wizard/apply",o,g=>{g.type==="error"&&(u=typeof g.message=="string"?g.message:"install failed")});const c=o.tools.length,d=o.packs.length;s=u!==null?` Installer failed: ${u}. Settings were saved; re-run the wizard to retry.`:` Installer applied ${c} tool${c===1?"":"s"}`+(d>0?` and ${d} pack${d===1?"":"s"}.`:".")}catch(u){s=` Installer bridge failed: ${u instanceof E?z(u.body.error??{code:"UNKNOWN",message:u.message}):u instanceof Error?u.message:String(u)}. Settings were saved; re-run the wizard to retry the install plan.`}x.value={message:`${l}${s} ${r}`,tone:"success"},ye.value=zi(ze()-1),Rr.value=W.value,ue.value=lt()?$.value:ue.value,Tt.value=[],Ee.value=!0}catch(e){e instanceof E?(Fe.value=mt(e.body.error??{message:e.message}),x.value={message:z(e.body.error??{code:"UNKNOWN",message:e.message}),tone:"error"}):x.value={message:e instanceof Error?e.message:String(e),tone:"error"}}finally{Xn.value=!1}}async function Sc(){Bi.value=!0,await Promise.all([kn(),Nt()]),await Hi(),It(),await Ie(ze()-1)}function Cc(){ne(()=>{kn(),Nt()},[]);const e=Me.value||$n.value||!ii.value||!ri.value,n=Object.values(Di.value).filter(Boolean).length,t=be.value.length,i=xt.value.filter(r=>!be.value.includes(r)).length;return a("div",{class:"ac-start",children:[a("section",{class:"ac-start__card ac-start__card--primary",children:[a("h2",{class:"ac-start__title",children:"Recommended setup"}),a("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."}),a("ul",{class:"ac-start__facts",children:[a("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.`}),a("li",{children:e?"Detecting capability packs…":t>0?`${t} installed pack${t===1?"":"s"} kept${i>0?`, ${i} more auto-detected`:""}.`:i>0?`${i} capability pack${i===1?"":"s"} auto-detected.`:"No packs pre-selected — add them any time later."}),a("li",{children:"Settings keep their current values (or safe defaults on a first run)."}),a("li",{children:"Nothing is written until you confirm the review screen."})]}),a("button",{type:"button",class:"ac-button ac-button--primary ac-start__cta",disabled:e,onClick:()=>{Sc()},children:e?"Detecting…":"Use recommended setup"})]}),a("section",{class:"ac-start__card",children:[a("h2",{class:"ac-start__title",children:"Customize"}),a("p",{class:"ac-start__desc",children:"Walk through every step — tools, roles, packs, behaviour, budgets — and tune each choice yourself."}),a("button",{type:"button",class:"ac-button ac-start__cta",onClick:()=>{Bi.value=!0},children:"Customize step by step"})]})]})}const Tc=["de","en","en-US","en-GB","fr","es","it","nl","pt","pt-BR"];function Ac(){if($a.value)return;const e=$.value;if(e===null)return;$a.value=!0;let n=e;if(e.identity.name.trim()===""){const t=ge.value?.systemUser;t!==void 0&&t.trim()!==""&&(n={...n,identity:{...n.identity,name:t}})}if(!Mi.value&&typeof navigator<"u"){const t=(navigator.language||"").split("-")[0];t.length>=2&&(n={...n,language:t})}n!==e&&($.value=n)}function xc(){const e=$.value;if(ne(()=>{Ac()},[e]),e===null)return a("p",{children:"Loading…"});const n=t=>{$.value={...t,last_updated:new Date().toISOString().slice(0,10)},Ct.value=!1};return a("div",{class:"ac-wizard-step-stub ac-wizard__module-fields",children:[a("p",{children:["Tell the agent who you are. We pre-filled what we could detect — adjust freely. Stored in ",a("code",{children:".agent-user.yml"}),"."]}),a("div",{class:"ac-field",children:[a("label",{class:"ac-field__label",for:"welcome-name",children:"Name"}),a("input",{class:"ac-input",id:"welcome-name",type:"text",placeholder:"How should the agent address you?",value:e.identity.name,onInput:t=>n({...e,identity:{...e.identity,name:t.currentTarget.value}})})]}),a("div",{class:"ac-field",children:[a("label",{class:"ac-field__label",for:"welcome-lang",children:"Language"}),a("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:t=>n({...e,language:t.currentTarget.value})}),a("datalist",{id:"welcome-lang-list",children:Tc.map(t=>a("option",{value:t},t))})]})]})}function Nc(){const e=ee.value,n=Di.value;return a("div",{class:"ac-wizard-step-stub",children:[a("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."}),a("ul",{class:"ac-wizard__tool-list",children:cc.map(t=>{const i=n[t.id]===!0;return a("li",{class:"ac-wizard__tool-row",children:[a("label",{class:"ac-wizard__tool-label",children:[a("input",{type:"checkbox",checked:e[t.id]??!1,onChange:r=>{const l=r.currentTarget.checked;ee.value={...e,[t.id]:l}}})," ",t.label]}),a("span",{class:`ac-badge ${i?"ac-badge--installed":"ac-badge--missing"}`,title:i?"Detected on this machine":"Not detected on this machine",children:i?"installed":"not installed"})]},t.id)})})]})}function Ec(){if(Me.value)return a("p",{children:"Loading roles…"});if(de.value!==null)return a("div",{class:"ac-wizard-step-stub",children:a("p",{class:"ac-banner ac-banner--error",children:["Discovery failed: ",de.value]})});const e=Z.value,n=bn.value,t=(i,r)=>{Dr.value=!0,Z.value={...Z.value,[i]:r},It()};return a("div",{class:"ac-wizard-step-stub",children:[a("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",a("code",{children:" .agent-user.yml"}),"."]}),n.length===0?a("p",{children:a("em",{children:"No roles available in the manifest."})}):a("div",{class:"ac-wizard__pack-grid",children:n.map(i=>a("section",{class:"ac-pack-tile",children:[a("label",{class:"ac-pack-tile__head",children:[a("input",{type:"checkbox",checked:e[i.id]??!1,onChange:r=>{t(i.id,r.currentTarget.checked)}}),a("span",{class:"ac-pack-tile__title",children:i.label})]}),(i.example_roles??[]).length>0?a("p",{class:"ac-pack-tile__role",children:["e.g. ",(i.example_roles??[]).join(", ")]}):null,i.description!==""?a("p",{class:"ac-pack-tile__desc",children:i.description}):null]},i.id))})]})}function Ic(){if(Me.value)return a("p",{children:"Loading discovery manifest…"});if(de.value!==null)return a("div",{class:"ac-wizard-step-stub",children:[a("p",{class:"ac-banner ac-banner--error",children:["Discovery failed: ",de.value]}),a("p",{children:"The manifest endpoint is gated on extended-mode. Re-run the server with extended steps enabled to populate this list."})]});const e=ae.value,n=new Set(xt.value),t=new Set(be.value),i=p=>t.has(p)?a("span",{class:"ac-badge ac-badge--installed",children:"installed"}):n.has(p)?a("span",{class:"ac-badge ac-badge--detected",children:"auto-detected"}):null,r=new Map(bn.value.map(p=>[p.id,p.label])),l=Z.value,o=p=>{const v=(p??[]).filter(_=>_!=="agent-config-maintainer");return v.length===0?null:a("span",{class:"ac-pack-tile__ws",children:v.map(_=>a("span",{class:`ac-badge ac-badge--ws${l[_]===!0?" ac-badge--ws-active":""}`,title:l[_]===!0?"Matches a role you picked":"Workspace / area",children:r.get(_)??_},_))})},s=At.value.filter(p=>p.id!=="engineering-base"),u=new Map;for(const p of s)if(p.cluster!==void 0){const v=u.get(p.cluster)??[];v.push(p),u.set(p.cluster,v)}const c=new Set(s.filter(p=>p.cluster!==void 0).map(p=>p.id)),d=s.filter(p=>!c.has(p.id)),g=(p,v)=>{ui.value=!0,ae.value={...ae.value,[p]:v}},f=(p,v)=>{ui.value=!0;const _={...ae.value,[p]:v};if(v)for(const k of u.get(p)??[])_[k.id]===void 0&&(_[k.id]=!0);ae.value=_};return a("div",{class:"ac-wizard-step-stub",children:[a("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."}),d.length===0?a("p",{children:a("em",{children:"No packs available in the manifest."})}):a("div",{class:"ac-wizard__pack-grid",children:d.map(p=>{const v=u.get(p.id)??[],_=v.length>0,k=e[p.id]??!1;return a("section",{class:"ac-pack-tile",children:[a("label",{class:"ac-pack-tile__head",children:[a("input",{type:"checkbox",checked:k,onChange:w=>{const b=w.currentTarget.checked;_?f(p.id,b):g(p.id,b)}}),a("span",{class:"ac-pack-tile__title",children:p.label}),i(p.id)]}),o(p.workspaces),p.description!==""?a("p",{class:"ac-pack-tile__desc",children:p.description}):null,_?a("fieldset",{class:"ac-pack-tile__children",disabled:!k,children:v.map(w=>a("label",{class:"ac-pack-tile__child",children:[a("input",{type:"checkbox",checked:e[w.id]??!1,disabled:!k,onChange:b=>{g(w.id,b.currentTarget.checked)}}),a("span",{children:w.label}),i(w.id)]},w.id))}):null]},p.id)})})]})}function $c(){const e=Ur.value,n=Br.value,t=zr.value,i=Wr.value,r=Hr.value,l=e===null?a("span",{class:"ac-badge ac-badge--missing",children:"detecting…"}):e?a("span",{class:"ac-badge ac-badge--installed",children:["installed",i!==null?` (v${i})`:""]}):n===!0?a("span",{class:"ac-badge ac-badge--missing",children:t==="unknown-rtk"?"different tool":"unverified"}):a("span",{class:"ac-badge ac-badge--missing",children:"not installed"});return a("div",{class:"ac-rtk-row",children:[a("div",{class:"ac-rtk-row__head",children:[a("span",{class:"ac-rtk-row__label",children:["rtk ",a("small",{children:"(Rust Token Killer — third-party, Apache-2.0)"})]}),l]}),n===!0&&t==="unknown-rtk"?a("div",{class:"ac-rtk-row__install",children:[a("p",{class:"ac-field__description",children:["A binary named ",a("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:"]}),a("a",{class:"ac-button",href:`${oi.value}/blob/master/INSTALL.md`,target:"_blank",rel:"noreferrer noopener",children:"Open rtk install guide"})]}):null,n===!0&&t==="unverified"?a("p",{class:"ac-field__description",children:["rtk found but the identity check failed — verify manually with ",a("code",{children:"rtk gain"})," (Rust Token Killer renders a token-savings dashboard; the colliding Rust Type Kit does not)."]}):null,n===!1?a("div",{class:"ac-rtk-row__install",children:[a("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:"}),r!==null?a(L,{children:[r.recommendedLabel!==void 0?a("p",{class:"ac-field__description",children:[r.recommendedLabel,":"]}):null,a("code",{class:"ac-rtk-row__cmd",children:r.recommended}),r.manual!==void 0?a(L,{children:[a("p",{class:"ac-field__description",children:[r.manualLabel??"Manual",":"]}),a("code",{class:"ac-rtk-row__cmd",children:r.manual})]}):null,r.note!==void 0?a("p",{class:"ac-field__description",children:r.note}):null]}):li.value!==null?a("code",{class:"ac-rtk-row__cmd",children:li.value}):null,a("a",{class:"ac-button",href:oi.value,target:"_blank",rel:"noreferrer noopener",children:"Open rtk repo"})]}):null]})}async function Oc(){try{await y("/api/v1/wizard/dismiss-recommendation",{method:"POST",body:{id:"agent-switch"}})}catch(e){x.value={message:e instanceof Error?e.message:String(e),tone:"error"};return}Ui.value=!0}function Pc(){return!si.value||Yr.value!==!1||Ui.value?null:a("div",{class:"ac-rtk-row",children:[a("div",{class:"ac-rtk-row__head",children:[a("span",{class:"ac-rtk-row__label",children:["agent-switch ",a("small",{children:"(third-party, MIT)"})]}),a("span",{class:"ac-badge ac-badge--missing",children:"not installed"})]}),a("div",{class:"ac-rtk-row__install",children:[a("p",{class:"ac-field__description",children:["agent-switch isolates multiple agent accounts into per-account profiles (",a("code",{children:"CLAUDE_CONFIG_DIR"}),") so switching accounts never requires a re-login. Free and MIT-licensed."]}),ci.value!==null?a("code",{class:"ac-rtk-row__cmd",children:ci.value}):null,a("a",{class:"ac-button",href:`https://github.com/${qr.value}`,target:"_blank",rel:"noreferrer noopener",children:"Open agent-switch repo"}),a("button",{type:"button",class:"ac-button ac-button--small",onClick:()=>{Oc()},children:"Don't show again"})]})]})}function Lc(){const e=St(ye.value,{extended:D.value});if(D.value&&je.value==="install"&&e.id==="identity"&&!On.value)return a(ic,{});if(e.kind==="form"){const t=Vs(Fi.value,e.paths??[]);return a(L,{children:[e.id==="identity"?a($c,{}):null,e.id==="identity"?a(Pc,{}):null,a(Bl,{schema:t,values:W.value,errors:Fe.value,onChange:i=>{W.value=i}})]})}return e.kind==="userMd"?!ti.value||$.value===null?a("p",{children:"Loading .agent-user.yml…"}):a(Yl,{value:$.value,errors:Fe.value,hideRole:D.value&&je.value==="install",hideIdentityBasics:D.value&&je.value==="install",onChange:t=>{$.value=t,Ct.value=!1}}):e.kind==="welcome"?a(xc,{}):e.kind==="aiTools"?a(Nc,{}):e.kind==="roles"?a(Ec,{}):e.kind==="packs"?a(Ic,{}):a(nc,{steps:Vr(),currentIndex:ye.value,changes:Tt.value,errors:Fe.value,userMdChanged:lt(),userMdAction:Mi.value?"replace":"create",loading:Zn.value,onJump:t=>{Ie(t)},selectedToolsCount:Object.values(ee.value).filter(Boolean).length,selectedPacksCount:Object.values(ae.value).filter(Boolean).length,packRemovals:vi(),removalsConfirmed:ai.value,onConfirmRemovals:t=>{ai.value=t},selectedToolIds:Object.entries(ee.value).filter(([,t])=>t).map(([t])=>t),packAdditions:D.value?Et().filter(t=>t!=="engineering-base"&&!be.value.includes(t)):[]})}function vi(){return D.value?Ks(be.value,Et()):[]}function Oa({path:e}){if(ne(()=>{_c()},[]),!Lr.value||Fi.value===null)return a("div",{class:"ac-page",children:[a("h1",{children:"Setup wizard"}),nn.value!==null?a("p",{class:"ac-banner ac-banner--error",children:nn.value}):a("p",{children:"Loading…"})]});const n=ye.value,t=ze(),i=St(n,{extended:D.value}),r=n===t-1,l=i.kind==="aiTools"&&Object.values(ee.value).filter(Boolean).length===0||i.kind==="roles"&&Object.values(Z.value).filter(Boolean).length===0||i.kind==="packs"&&Et().length===0,o=D.value&&je.value==="install"&&i.id==="identity"&&!On.value,s=rt.value,u=s!==null&&!Kr.value,c=di.value,d=c!==null&&c.present&&!fi.value,g=D.value&&je.value==="install"&&n===0&&!Bi.value&&!Ee.value;return d?a("div",{class:"ac-page",children:a(ac,{sourcePath:c.path,backupTarget:c.backupTarget,version:c.version,busy:hi.value,error:pi.value,onBackupAndProceed:()=>{gc()},onAbort:()=>{x.value={tone:"info",message:"Aborted. Uninstall v3 manually, then re-run `agent-config install`."},fi.value=!0}})}):g?a("div",{class:"ac-page",children:[a("header",{class:"ac-page__header",children:a("h1",{children:"Set up agent-config"})}),x.value!==null?a("p",{class:`ac-banner${x.value.tone==="error"?" ac-banner--error":""}`,children:x.value.message}):null,a(Cc,{})]}):a("div",{class:"ac-page",children:[a(Js,{step:i,index:n,total:t}),u?a(tc,{abortedAt:s.abortedAt,abortNote:s.abortNote,writesSinceRollback:s.writesSinceRollback,busy:Xn.value,onResume:()=>{zt("resume")},onRollback:()=>{zt("rollback")},onIgnore:()=>{zt("ignore")}}):null,x.value!==null&&!(Ee.value&&r&&x.value.tone==="success")?a("p",{class:`ac-banner${x.value.tone==="error"?" ac-banner--error":""}`,children:x.value.message}):null,a("div",{class:"ac-wizard__step",children:Ee.value&&r?a(oc,{message:x.value?.tone==="success"?x.value.message:null}):a(Lc,{})}),l?a("p",{class:"ac-wizard__hint",children:i.kind==="aiTools"?"Select at least one AI tool to continue.":i.kind==="roles"?"Select at least one role to continue.":"Select at least one capability pack to continue."}):null,a(Xs,{canGoPrev:n>0,canGoNext:!r&&!l,canSkip:o||i.kind==="userMd",skipLabel:o?"Finish install here":"Skip",isLast:r,busy:Xn.value||Zn.value,canFinish:(Tt.value.length>0||lt()||vi().length>0||D.value&&Object.values(ee.value).some(Boolean))&&(vi().length===0||ai.value),completed:Ee.value,onPrev:()=>{Ie(n-1)},onNext:()=>{if(o){On.value=!0;return}Ie(n+1)},onSkip:()=>{if(o){On.value=!0,Ie(ze()-1);return}Ct.value=!0,Ie(n+1)},onFinish:()=>{wc()}})]})}const Rc=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","worktrees.mode","legal_review_prep.acknowledged"]);function Pa(e){return Rc.has(e)}function Fc(e,n){return JSON.stringify(e??null)===JSON.stringify(n??null)}function Zr(e,n){if(e.kind==="enum_removed"){const t=new Set(e.values??[]);return n!==void 0&&t.has(n)?"must_fix":"info"}return e.kind==="type_changed"?"must_fix":e.kind==="default_changed"?n===void 0||Fc(n,e.old?.default)?"adopt":"review":e.kind==="added"&&e.new?.default===void 0?"must_fix":"info"}const gi=h(!0),ot=h(null),_i=h(!1),$t=h(null),We=h({}),mi=h(0),ke=h({}),re=h(null),Q=h(!1),un=h(!1);function fe(e){return`${e.key}:${e.kind}`}async function Mc(){gi.value=!0,ot.value=null,_i.value=!1,un.value=!1;try{const e=await y("/api/v1/settings/changes"),n=await y("/api/v1/settings");$t.value=e.delta,We.value=n.values,mi.value=n.lastModified,jc(e.delta,n.values)}catch(e){e instanceof E&&e.status===404?_i.value=!0:ot.value=e instanceof Error?e.message:String(e)}finally{gi.value=!1}}function jc(e,n){const t={};for(const i of e.changes){const r=Zr(i,yn(n,i.key.split(".")));r==="adopt"?t[fe(i)]={mode:"adopt"}:r==="review"?t[fe(i)]={mode:"keep"}:r==="must_fix"&&(t[fe(i)]={mode:null})}ke.value=t}function Yi(e){return Zr(e,yn(We.value,e.key.split(".")))}function tn(e,n){ke.value={...ke.value,[e]:n}}function qi(){const e=$t.value;return e===null?[]:e.changes.filter(n=>{if(Yi(n)!=="must_fix")return!1;const t=ke.value[fe(n)];return t===void 0||t.mode===null||t.mode==="custom"&&(t.value===void 0||t.value==="")})}function Dc(){const e=$t.value;let n=We.value;if(e===null)return n;for(const t of e.changes){const i=ke.value[fe(t)];if(i===void 0||i.mode===null||i.mode==="keep")continue;const r=t.key.split(".");i.mode==="adopt"&&t.new?.default!==void 0?n=cn(n,r,t.new.default):i.mode==="custom"&&i.value!==void 0&&(n=cn(n,r,i.value))}return n}async function Uc(){if(Q.value)return;const e=qi();if(e.length>0){re.value=`Resolve the ${e.length} “Must fix” item${e.length===1?"":"s"} first.`;return}Q.value=!0,re.value=null;try{const n=Dc();if(JSON.stringify(n)!==JSON.stringify(We.value)){const t=await y("/api/v1/settings",{method:"PUT",headers:{"If-Unmodified-Since":String(mi.value)},body:{values:n}});We.value=n,mi.value=t.lastModified}await y("/api/v1/settings/changes/ack",{method:"POST"}),un.value=!0}catch(n){n instanceof E?re.value=z(n.body.error??{code:"UNKNOWN",message:n.message}):re.value=n instanceof Error?n.message:String(n)}finally{Q.value=!1}}async function Bc(){if(Q.value)return;if(qi().length>0){re.value="Cannot dismiss — “Must fix” items would leave invalid values in place.";return}Q.value=!0;try{await y("/api/v1/settings/changes/ack",{method:"POST"}),un.value=!0}catch(n){re.value=n instanceof Error?n.message:String(n)}finally{Q.value=!1}}function te(e){return e===void 0?"—":typeof e=="string"?e:JSON.stringify(e)}function Wt({change:e,id:n}){const t=e.new,r=ke.value[n]?.value;return t?.enum!==void 0?a("select",{class:"ac-input","aria-label":`New value for ${e.key}`,value:r===void 0?"":String(r),onChange:l=>{const o=l.currentTarget.value;tn(n,{mode:"custom",value:o})},children:[a("option",{value:"",disabled:!0,children:"Choose a value…"}),t.enum.map(l=>a("option",{value:String(l),children:String(l)},String(l)))]}):t?.type==="boolean"?a("select",{class:"ac-input","aria-label":`New value for ${e.key}`,value:r===void 0?"":String(r),onChange:l=>{tn(n,{mode:"custom",value:l.currentTarget.value==="true"})},children:[a("option",{value:"",disabled:!0,children:"Choose…"}),a("option",{value:"true",children:"true"}),a("option",{value:"false",children:"false"})]}):a("input",{class:"ac-input",type:t?.type==="number"||t?.type==="integer"?"number":"text","aria-label":`New value for ${e.key}`,value:r===void 0?"":String(r),onInput:l=>{const o=l.currentTarget.value,s=t?.type==="number"||t?.type==="integer"?Number(o):o;tn(n,{mode:"custom",value:s})}})}function zc({change:e}){const n=Yi(e),t=fe(e),i=ke.value[t],r=yn(We.value,e.key.split("."));return a("li",{class:`ac-change-card ac-change-card--${n}`,"data-key":e.key,"data-kind":e.kind,children:[a("div",{class:"ac-change-card__head",children:[a("code",{class:"ac-change-card__key",children:e.key}),a("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?a("p",{class:"ac-change-card__desc",children:e.new.description}):null,e.kind==="default_changed"?a(L,{children:[a("p",{class:"ac-change-card__detail",children:["Default changed: ",a("code",{children:te(e.old?.default)})," → ",a("code",{children:te(e.new?.default)}),n==="review"?a(L,{children:[" · your value: ",a("code",{children:te(r)})]}):null]}),a("div",{class:"ac-change-card__choices",role:"radiogroup","aria-label":`Resolution for ${e.key}`,children:[a("label",{class:"ac-change-card__choice",children:[a("input",{type:"radio",name:t,checked:i?.mode==="adopt",onChange:()=>{tn(t,{mode:"adopt"})}}),a("span",{children:["Adopt new default (",a("code",{children:te(e.new?.default)}),")"]})]}),a("label",{class:"ac-change-card__choice",children:[a("input",{type:"radio",name:t,checked:i?.mode==="keep",onChange:()=>{tn(t,{mode:"keep"})}}),a("span",{children:["Keep current (",a("code",{children:te(r??e.old?.default)}),")"]})]})]})]}):null,e.kind==="enum_removed"?n==="must_fix"?a(L,{children:[a("p",{class:"ac-change-card__detail",children:["Your value ",a("code",{children:te(r)})," is no longer valid — removed option",(e.values?.length??0)===1?"":"s",": ",a("code",{children:(e.values??[]).join(", ")}),". Pick a replacement:"]}),a(Wt,{change:e,id:t})]}):a("p",{class:"ac-change-card__detail",children:["Removed option",(e.values?.length??0)===1?"":"s",": ",a("code",{children:(e.values??[]).join(", ")})," — your value ",a("code",{children:te(r??e.new?.default)})," is unaffected."]}):null,e.kind==="enum_added"?a("p",{class:"ac-change-card__detail",children:["New option",(e.values?.length??0)===1?"":"s"," available: ",a("code",{children:(e.values??[]).join(", ")})]}):null,e.kind==="added"?n==="must_fix"?a(L,{children:[a("p",{class:"ac-change-card__detail",children:"New setting without a shipped default — define a value:"}),a(Wt,{change:e,id:t})]}):a("p",{class:"ac-change-card__detail",children:["New setting · default: ",a("code",{children:te(e.new?.default)}),e.new?.enum!==void 0?a(L,{children:[" · options: ",a("code",{children:e.new.enum.join(", ")})]}):null]}):null,e.kind==="removed"?a("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"?a(L,{children:[a("p",{class:"ac-change-card__detail",children:["Type changed: ",a("code",{children:e.old?.type})," → ",a("code",{children:e.new?.type}),". Define a new value:"]}),a(Wt,{change:e,id:t})]}):null]})}function Wc(e){const n=new Map;for(const c of e.changes){const d=Yi(c);n.set(d,[...n.get(d)??[],c])}const t=[],i=n.get("must_fix")??[];i.length>0&&t.push({title:"Must fix",hint:"These stored values are invalid after the upgrade — saving is blocked until each has a valid value.",changes:i});const r=[...n.get("adopt")??[],...n.get("review")??[]];r.length>0&&t.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:r});const l=n.get("info")??[],o=l.filter(c=>c.kind==="added"),s=l.filter(c=>c.kind==="enum_added"),u=l.filter(c=>c.kind!=="added"&&c.kind!=="enum_added");return o.length>0&&t.push({title:"New settings",changes:o}),s.length>0&&t.push({title:"New options",changes:s}),u.length>0&&t.push({title:"Removed / other",changes:u}),t}function Hc(){if(ne(()=>{Mc()},[]),gi.value)return a("div",{class:"ac-page",children:[a("h1",{children:"Settings changes"}),a("p",{children:"Loading…"})]});if(ot.value!==null)return a("div",{class:"ac-page",children:[a("h1",{children:"Settings changes"}),a("p",{class:"ac-banner ac-banner--error",children:ot.value})]});if(un.value||_i.value)return a("div",{class:"ac-page ac-settings-changes",children:[a("h1",{children:"Settings changes"}),a("p",{class:"ac-banner",children:un.value?"Review complete — all changes resolved.":"Nothing to review — your settings are up to date."}),a("button",{type:"button",class:"ac-button",onClick:()=>_t("/settings"),children:"Back to Settings"})]});const e=$t.value;if(e===null)return a("div",{class:"ac-page",children:a("h1",{children:"Settings changes"})});const n=Wc(e),t=qi().length;return a("div",{class:"ac-page ac-settings-changes",children:[a("header",{class:"ac-page__header",children:[a("h1",{children:"Settings changes"}),a("p",{class:"ac-page__lede",children:["The upgrade ",a("code",{children:e.oldVersion})," → ",a("code",{children:e.newVersion})," changed the available settings. Review below — nothing was changed automatically."]})]}),re.value!==null?a("p",{class:"ac-banner ac-banner--error",role:"alert",children:re.value}):null,n.map(i=>a("section",{class:"ac-settings-changes__group",children:[a("h2",{children:[i.title," ",a("span",{class:"ac-settings-changes__count",children:["(",i.changes.length,")"]})]}),i.hint!==void 0?a("p",{class:"ac-settings-changes__hint",children:i.hint}):null,a("ul",{class:"ac-settings-changes__list",children:i.changes.map(r=>a(zc,{change:r},fe(r)))})]},i.title)),a("div",{class:"ac-form__actions",children:[a("button",{type:"button",class:"ac-button",disabled:Q.value,onClick:()=>{Bc()},children:"Dismiss (keep everything)"}),a("button",{type:"button",class:"ac-button ac-button--primary",disabled:Q.value||t>0,title:t>0?`${t} “Must fix” item${t===1?"":"s"} unresolved`:void 0,onClick:()=>{Uc()},children:Q.value?"Saving…":"Apply & finish review"})]})]})}const xe=h(null);function Yc(){return ne(()=>{(async()=>{try{const e=await y("/api/v1/settings/changes");xe.value=e.delta.changes.length}catch{xe.value=null}})()},[]),xe.value===null||xe.value===0?null:a("div",{class:"ac-banner ac-banner--pending",role:"status",children:[a("span",{children:["An upgrade changed ",xe.value," setting",xe.value===1?"":"s"," — review recommended."]}),a("button",{type:"button",class:"ac-button ac-button--small",onClick:()=>_t("/settings/changes"),children:"Review changes"})]})}const yi=h(!1),st=h(null),q=h({}),ct=h(null),dn=h(0),fn=h({}),J=h(null),we=h(!1),he=h(null),hn=h(null),Pn=h(""),Ne=h(!1),Ln=h({}),Rn=h({global:new Set,project:new Set});function La(e){if("$ref"in e&&e.$ref!==void 0&&"definitions"in e&&e.definitions!==void 0){const n=e.$ref.replace("#/definitions/",""),t=e.definitions[n];if(t!==void 0)return t}return e}async function Ra(){st.value=null;try{const e=await y("/api/v1/settings");q.value=e.values,ct.value=La(e.schema),dn.value=e.lastModified,Rn.value={global:new Set(e.sources?.global??[]),project:new Set(e.sources?.project??[])},yi.value=!0}catch(e){if(e instanceof E&&e.status===404&&e.body.error?.code==="NOT_FOUND"){const n=e.body;if(n.defaults!==void 0&&n.schema!==void 0){q.value=n.defaults,ct.value=La(n.schema),dn.value=n.lastModified??0,yi.value=!0;return}}st.value=e instanceof Error?e.message:String(e)}}async function qc(){if(!we.value){J.value=null,fn.value={};try{const e=await y("/api/v1/settings/diff",{method:"POST",body:{values:q.value,ifUnmodifiedSince:dn.value}});if(e.changes.length===0){J.value="No changes to save.";return}he.value=e.changes}catch(e){e instanceof E?(fn.value=mt(e.body.error??{message:e.message}),J.value=z(e.body.error??{code:"UNKNOWN",message:e.message})):J.value=e instanceof Error?e.message:String(e)}}}async function Qr(e=!1){we.value=!0;try{const n=await y("/api/v1/settings",{method:"PUT",headers:{"If-Unmodified-Since":String(dn.value)},body:e?{values:q.value,confirmSharedWrite:!0}:{values:q.value}});dn.value=n.lastModified,he.value=null,hn.value=null,J.value=`Saved (${n.writtenPaths.join(", ")}).`}catch(n){if(n instanceof E){const t=n.body;if(n.status===409&&t.error==="shared-write"){he.value=null,hn.value={sharedPath:typeof t.sharedPath=="string"?t.sharedPath:"",message:typeof t.message=="string"?t.message:"This write affects a shared agent-switch profile."};return}const i=n.body.error??{code:"UNKNOWN",message:n.message};fn.value=mt(i),J.value=z(i),he.value=null;const r=Object.keys(fn.value)[0];r!==void 0&&queueMicrotask(()=>{const l=document.getElementById(r);l!==null&&l.focus()})}else J.value=n instanceof Error?n.message:String(n)}finally{we.value=!1}}function Ki(e){if(e.defaultValue===void 0)return!1;const n=yn(q.value,e.path);return n===void 0?!1:JSON.stringify(n)!==JSON.stringify(e.defaultValue)}function Kc(e,n){const t=Ki(n),i=Rn.value.project.has(e)?"project":Rn.value.global.has(e)&&Rn.value.project.size>0?"global":void 0;return{modified:t,onReset:t&&n.defaultValue!==void 0?()=>{q.value=cn(q.value,n.path,n.defaultValue)}:void 0,sourceLabel:i}}function Vc(e,n){const t=n.toLowerCase();return e.path.join(".").toLowerCase().includes(t)||e.label.toLowerCase().includes(t)||(e.description??"").toLowerCase().includes(t)}function Gc(e){const n=Pn.value.trim(),t=Ne.value,i=e.path.join("."),r=Ln.value[i]===!0;let l=e.fields.filter(c=>c.kind!=="unsupported");if(n!==""&&(l=l.filter(c=>Vc(c,n))),t&&(l=l.filter(c=>Ki(c))),n!==""||t)return l.length===0?null:{section:e,visible:l,hiddenAdvancedCount:0,expanded:r};const o=l.filter(c=>Pa(c.path.join("."))),s=l.filter(c=>!Pa(c.path.join("."))),u=r?[...o,...s]:o;return u.length===0&&s.length===0?null:{section:e,visible:u,hiddenAdvancedCount:r?0:s.length,expanded:r}}function Jc(e){Ln.value={...Ln.value,[e]:Ln.value[e]!==!0}}function Xc(){const e=ge.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 a("div",{class:"ac-banner",role:"status",children:a("span",{children:["Running under agent-switch profile ",a("code",{children:n})," — settings shown and saved here are profile-scoped. Switching profiles shows that profile's own settings; nothing is lost."]})})}function Zc({block:e}){return a("div",{class:"ac-modal",role:"dialog","aria-modal":"true","aria-labelledby":"shared-write-title",children:a("div",{class:"ac-modal__panel",children:[a("h2",{id:"shared-write-title",children:"Shared write — affects all profiles"}),a("p",{children:e.message}),a("p",{children:a("code",{children:e.sharedPath})}),a("div",{class:"ac-modal__actions",children:[a("button",{type:"button",class:"ac-button",onClick:()=>{hn.value=null},children:"Cancel"}),a("button",{type:"button",class:"ac-button ac-button--primary",disabled:we.value,onClick:()=>{Qr(!0)},children:we.value?"Writing…":"Write (affects all profiles)"})]})]})})}function Qc({changes:e}){return a("div",{class:"ac-modal",role:"dialog","aria-modal":"true","aria-labelledby":"diff-title",children:a("div",{class:"ac-modal__panel",children:[a("h2",{id:"diff-title",children:"Confirm changes"}),a("ul",{class:"ac-diff",children:e.map(n=>a("li",{children:[a("code",{children:n.path}),a("span",{class:"ac-diff__before",children:JSON.stringify(n.from)}),a("span",{class:"ac-diff__arrow",children:"→"}),a("span",{class:"ac-diff__after",children:JSON.stringify(n.to)})]},n.path))}),a("div",{class:"ac-modal__actions",children:[a("button",{type:"button",class:"ac-button",onClick:()=>{he.value=null},children:"Cancel"}),a("button",{type:"button",class:"ac-button ac-button--primary",disabled:we.value,onClick:()=>{Qr()},children:we.value?"Saving…":"Save"})]})]})})}function eu(){if(ne(()=>{Ra()},[]),!yi.value||ct.value===null)return a("div",{class:"ac-page",children:[a("h1",{children:"Settings"}),st.value!==null?a("p",{class:"ac-banner ac-banner--error",children:st.value}):a("p",{children:"Loading…"})]});const e=vr(ct.value),n=e.map(Gc).filter(r=>r!==null),t=e.flatMap(r=>r.fields).filter(r=>Ki(r)).length,i=Pn.value.trim()!==""||Ne.value;return a("div",{class:"ac-page ac-settings-hub",children:[a("header",{class:"ac-page__header",children:[a("h1",{children:"Settings"}),a("nav",{class:"ac-page__nav",children:a("a",{href:"#/settings/user",children:"Edit .agent-user.yml →"})})]}),a(Yc,{}),a(Xc,{}),a("div",{class:"ac-settings-hub__toolbar",role:"search",children:[a("input",{class:"ac-input ac-settings-hub__search",type:"search",placeholder:"Search all settings (basic and advanced)…",value:Pn.value,onInput:r=>{Pn.value=r.currentTarget.value}}),a("button",{type:"button",class:`ac-chip-toggle${Ne.value?" ac-chip-toggle--active":""}`,"aria-pressed":Ne.value,onClick:()=>{Ne.value=!Ne.value},children:["@modified",t>0?` (${t})`:""]})]}),J.value!==null?a("p",{class:"ac-banner",children:J.value}):null,a("form",{class:"ac-form",onSubmit:r=>r.preventDefault(),children:[n.length===0?a("p",{class:"ac-settings-hub__empty",children:"No settings match."}):n.map(r=>{const l=r.section.path.join(".");return a(gr,{section:{...r.section,fields:r.visible},values:q.value,errors:fn.value,onChange:o=>{q.value=o},decorate:Kc,footer:!i&&(r.hiddenAdvancedCount>0||r.expanded)?a("button",{type:"button",class:"ac-settings-hub__disclosure","aria-expanded":r.expanded,onClick:()=>{Jc(l)},children:r.expanded?"Hide advanced settings":`Show ${r.hiddenAdvancedCount} advanced setting${r.hiddenAdvancedCount===1?"":"s"}`}):void 0},l)}),a("div",{class:"ac-form__actions",children:[a("button",{type:"button",class:"ac-button",onClick:()=>{Ra()},children:"Reload"}),a("button",{type:"button",class:"ac-button ac-button--primary",onClick:()=>{qc()},children:"Preview & Save"})]})]}),he.value!==null?a(Qc,{changes:he.value}):null,hn.value!==null?a(Zc,{block:hn.value}):null]})}const ut=h(!1),De=h(null);async function nu(){Qn.value=!0,et.value=null;try{const e=await y("/api/v1/modules/detect");ji.value=e.candidates,jr.value=e.project_root;const n={};for(const t of e.candidates)n[t.path]=!0;nt.value=n,tt.value=e.proposed_block.enabled,it.value=e.proposed_block.namespace_template??"",at.value=e.proposed_block.agent_folder??"agents"}catch(e){et.value=e instanceof E?z(e.body.error??{code:"UNKNOWN",message:e.message}):e instanceof Error?e.message:String(e)}finally{Qn.value=!1,sc.value=!0}}function tu(){const e=new Set(ji.value.map(i=>i.path)),n=nt.value,t=Object.keys(n).filter(i=>n[i]===!0&&e.has(i));return{enabled:tt.value,root_paths:t,namespace_template:it.value,agent_folder:at.value||"agents"}}async function iu(){ut.value=!0,De.value=null;try{const e=await y("/api/v1/modules/apply",{method:"POST",body:tu()});De.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 E?z(e.body.error??{code:"UNKNOWN",message:e.message}):e instanceof Error?e.message:String(e);De.value={message:`Could not save project settings: ${n}`,tone:"error"}}finally{ut.value=!1}}function au(){if(Qn.value)return a("p",{children:"Detecting module roots…"});if(et.value!==null)return a("p",{class:"ac-banner ac-banner--error",children:["Module detection failed: ",et.value]});const e=ji.value,n=nt.value,t=jr.value;return a("div",{class:"ac-section",children:[t!==null?a("p",{class:"ac-section__description",children:["Scanning ",a("code",{children:t}),". Pick which detected roots the agent should treat as modules. These write to",a("code",{children:" .agent-project-settings.yml"})," in this repo only."]}):null,a("label",{children:[a("input",{type:"checkbox",checked:tt.value,onChange:i=>{tt.value=i.currentTarget.checked}})," ","Enable module discovery (writes ",a("code",{children:"modules.enabled"}),")"]}),e.length===0?a("p",{children:[a("em",{children:"No module roots detected."})," The scan found no common module layouts (Laravel ",a("code",{children:"app/Modules/"}),", Symfony",a("code",{children:" src/Module/"}),", Node ",a("code",{children:"packages/"}),", Python",a("code",{children:" src/"}),", Go ",a("code",{children:"internal/"}),")."]}):a("ul",{style:"list-style: none; padding-left: 0;",children:e.map(i=>a("li",{children:a("label",{children:[a("input",{type:"checkbox",checked:n[i.path]??!1,onChange:r=>{const l=r.currentTarget.checked;nt.value={...n,[i.path]:l}}})," ",a("code",{children:i.path})," — ",i.stack," ",a("small",{children:["(",i.confidence," confidence)"]})]})},i.path))}),a("div",{class:"ac-wizard__module-fields",children:[a("div",{class:"ac-field",children:[a("label",{class:"ac-field__label",for:"ac-modules-namespace",children:"Namespace template"}),a("input",{id:"ac-modules-namespace",class:"ac-input",type:"text",value:it.value,placeholder:"e.g. App\\\\Modules\\\\{ModuleName}\\\\App",onInput:i=>{it.value=i.currentTarget.value}}),a("span",{class:"ac-field__description",children:"How a module path maps to its namespace. Leave blank to skip namespacing."})]}),a("div",{class:"ac-field",children:[a("label",{class:"ac-field__label",for:"ac-modules-agent-folder",children:"Agent folder"}),a("input",{id:"ac-modules-agent-folder",class:"ac-input",type:"text",value:at.value,placeholder:"agents",onInput:i=>{at.value=i.currentTarget.value}}),a("span",{class:"ac-field__description",children:["Folder name that holds per-module agent docs (default ",a("code",{children:"agents"}),")."]})]})]})]})}function ru(){return ne(()=>{nu()},[]),a("div",{class:"ac-page",children:[a("header",{class:"ac-page__header",children:[a("h1",{children:"Project settings"}),a("p",{class:"ac-section__description",children:["Configuration scoped to this repository — written to",a("code",{children:" .agent-project-settings.yml"}),", not the global tree."]})]}),De.value!==null?a("p",{class:`ac-banner ac-banner--${De.value.tone==="success"?"success":"error"}`,children:De.value.message}):null,a("section",{class:"ac-section",children:[a("h2",{class:"ac-section__title",children:"Modules"}),a(au,{})]}),a("div",{class:"ac-form__actions ac-wizard__nav",children:a("button",{type:"button",class:"ac-button ac-button--primary",disabled:ut.value||Qn.value,onClick:()=>{iu()},children:ut.value?"Saving…":"Save project settings"})})]})}const Fn=h([]),pn=h([]),bi=h([]),ki=h([]),dt=h(null),el=h(!1),an=h(null),B=h(null),Ht=h("plain"),ft=h({}),nl=h([]),Fa={"claude-code":"Claude Code",codex:"Codex",gemini:"Gemini"};function lu(){try{return globalThis.sessionStorage?.getItem("ac-workspace-host")??"claude-code"}catch{return"claude-code"}}const Vi=h(lu());function ou(e){Vi.value=e;try{globalThis.sessionStorage?.setItem("ac-workspace-host",e)}catch{}}const vn=h([]),K=h(null),$e=h({}),pe=h(!1),gn=h(null),se=h(""),rn=h(!1),Ot=h(!1),wi=h(null),ve=h(null),_n=h([]),Mn=h(new Set),tl="claude-code",Ma=2e3;async function su(){an.value=null;try{const[e,n,t,i,r,l]=await Promise.all([y("/api/v1/workspace/roles"),y("/api/v1/workspace/sessions?limit=20"),y("/api/v1/workspace/knowledge?limit=20"),y("/api/v1/workspace/documents?limit=20"),y("/api/v1/workspace/drive-health").catch(()=>({health:{}})),y("/api/v1/workspace/hosts").catch(()=>({hosts:[]}))]);Fn.value=e.roles,pn.value=n.sessions,bi.value=t.chunks,ki.value=i.documents,ft.value=r.health??{},nl.value=l.hosts??[],el.value=!0}catch(e){e instanceof E?an.value=e.body?.error?.message??e.message:an.value=e instanceof Error?e.message:String(e)}}async function cu(e,n){try{const t=await y(`/api/v1/workspace/roles/${e}/tasks`);vn.value=t.tasks}catch{vn.value=n}}async function Gi(e){ve.value=e,Mn.value=new Set;try{const n=await y(`/api/v1/workspace/sessions/${e}`);_n.value=Array.isArray(n.log)?n.log:[]}catch{_n.value=[]}}async function uu(e){B.value=null,Ot.value=!1,se.value="",K.value=null,await Gi(e)}async function il(e,n,t){B.value=null,pe.value=!0,se.value="",Ot.value=!1,wi.value={role:e,task:n,inputs:t};try{const i=await y("/api/v1/workspace/launch",{method:"POST",body:{role:e,task:n,inputs:t,host:Vi.value}});gn.value=i,B.value=al(i),K.value=null,await Gi(i.id);const r=await y("/api/v1/workspace/sessions?limit=20");pn.value=r.sessions,await Ji()}catch(i){gn.value=null,i instanceof E?B.value=i.body?.error?.message??i.message:B.value=i instanceof Error?i.message:String(i)}finally{pe.value=!1}}async function du(e,n){if(!(n.trim()===""||rn.value)){rn.value=!0,B.value=null;try{const t=await y(`/api/v1/workspace/sessions/${e}/continue`,{method:"POST",body:{prompt:n}});gn.value=t,B.value=al(t),t.driven&&(se.value=""),await Gi(e);const i=await y("/api/v1/workspace/sessions?limit=20");pn.value=i.sessions,await Ji()}catch(t){t instanceof E&&t.status===410?(Ot.value=!0,B.value="Host session expired — start a new conversation."):t instanceof E?B.value=t.body?.error?.message??t.message:B.value=t instanceof Error?t.message:String(t)}finally{rn.value=!1}}}async function Ji(){try{const e=await y("/api/v1/workspace/drive-health");ft.value=e.health??{}}catch{}}async function fu(e){try{await y(`/api/v1/workspace/drive-health/${e}/reset`,{method:"POST"}),await Ji()}catch{}}function al(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 ${tl} 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 hu({role:e}){const n=dt.value===e.slug;return a("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:()=>{dt.value=e.slug,B.value=null,gn.value=null,K.value=null,$e.value={},vn.value=e.first_tasks,cu(e.slug,e.first_tasks)},children:[a("span",{class:"ac-workspace__role-name",children:e.display_name}),a("span",{class:"ac-workspace__role-status","data-status":e.status,children:e.status}),a("span",{class:"ac-workspace__role-tagline",children:e.tagline})]})}function pu({role:e,task:n}){const t=n.inputs??[],i=$e.value,r=t.some(l=>l.required&&(i[l.name]??"").trim()==="");return a("form",{class:"ac-workspace__task-form",onSubmit:l=>{l.preventDefault(),!r&&!pe.value&&il(e,n.name,$e.value)},children:[t.length===0?a("p",{class:"ac-workspace__form-note",children:"No inputs — runs the prompt as-is."}):t.map(l=>a("label",{class:"ac-workspace__field",children:[a("span",{class:"ac-workspace__field-label",children:[l.name,l.required?a("span",{class:"ac-workspace__req","aria-hidden":"true",children:" *"}):null]}),a("textarea",{class:"ac-workspace__field-input",placeholder:l.shape,required:l.required,"aria-label":`${l.name}${l.required?" (required)":""}`,value:i[l.name]??"",onInput:o=>{$e.value={...$e.value,[l.name]:o.target.value}}})]},l.name)),a("div",{class:"ac-workspace__form-actions",children:[a("button",{type:"submit",class:"ac-button ac-button--primary",disabled:r||pe.value,children:pe.value?"Running…":"Run task"}),a("button",{type:"button",class:"ac-button",onClick:()=>{K.value=null},children:"Cancel"})]})]})}function vu(e){const n=[];for(const t of e){const i=t.data??{};if(t.kind==="launcher.input")i.followup===!0?n.push({kind:"user",text:typeof i.prompt=="string"?i.prompt:""}):n.push({kind:"task",text:typeof i.task=="string"?i.task:""});else if(t.kind==="host.turn"){const r=i.usage,l=r!=null?`${typeof i.model=="string"?i.model:tl} · in ${r.input_tokens??0} / out ${r.output_tokens??0} tokens`:void 0;n.push({kind:"assistant",text:typeof i.text=="string"?i.text:"",meta:l})}else if(t.kind==="host.error"){const r=typeof i.error_kind=="string"?i.error_kind:"error";n.push({kind:"error",text:`${r}: ${typeof i.error=="string"?i.error:""}`})}}return n}function gu(){if(ve.value===null)return null;const e=vu(_n.value),n=_n.value.some(t=>t.kind==="host.turn");return a("section",{class:"ac-workspace__thread","aria-label":"Conversation thread",children:[a("h2",{class:"ac-workspace__heading",children:"Conversation"}),e.length===0?a("p",{class:"ac-workspace__empty",children:"No turns yet."}):a("ol",{class:"ac-workspace__thread-list",children:e.map((t,i)=>{const r=t.kind==="assistant"&&t.text.length>Ma,l=Mn.value.has(i),o=r&&!l?`${t.text.slice(0,Ma)}…`:t.text;return a("li",{class:`ac-workspace__thread-block ac-workspace__thread-block--${t.kind}`,children:[a("span",{class:"ac-workspace__thread-role",children:t.kind==="task"?"Task":t.kind==="user"?"You":t.kind==="assistant"?"Host":"Error"}),a("pre",{class:"ac-workspace__thread-text",children:o}),r?a("button",{type:"button",class:"ac-button",onClick:()=>{const s=new Set(Mn.value);s.has(i)?s.delete(i):s.add(i),Mn.value=s},children:l?"Show less":"Show full"}):null,t.meta!=null?a("p",{class:"ac-workspace__turn-meta",children:t.meta}):null]},i)})}),Ot.value?a("div",{class:"ac-workspace__followup-gone",role:"status",children:[a("p",{children:"Host session expired."}),wi.value!==null?a("button",{type:"button",class:"ac-button ac-button--primary",disabled:pe.value,onClick:()=>{const t=wi.value;t!==null&&il(t.role,t.task,t.inputs)},children:pe.value?"Starting…":"Start a new conversation"}):a("p",{children:"Pick a task above to start a new conversation."})]}):n?a("form",{class:"ac-workspace__followup",onSubmit:t=>{t.preventDefault(),ve.value!==null&&du(ve.value,se.value)},children:[a("label",{class:"ac-workspace__field",children:[a("span",{class:"ac-workspace__field-label",children:"Follow up"}),a("textarea",{class:"ac-workspace__field-input",placeholder:"Continue this conversation — e.g. make it shorter","aria-label":"Follow-up prompt",value:se.value,onInput:t=>{se.value=t.target.value}})]}),a("button",{type:"submit",class:"ac-button ac-button--primary",disabled:se.value.trim()===""||rn.value,children:rn.value?"Continuing…":"Send follow-up"})]}):null]})}function _u({role:e}){const n=vn.value.length>0?vn.value:e.first_tasks;return a("section",{class:"ac-workspace__tasks","aria-labelledby":"task-heading",children:[a("h2",{id:"task-heading",class:"ac-workspace__heading",children:["First tasks · ",e.display_name]}),n.length===0?a("p",{class:"ac-workspace__empty",children:"No tasks scaffolded yet for this role."}):a("ul",{class:"ac-workspace__task-list",children:n.map(t=>a("li",{class:"ac-workspace__task",children:[a("div",{class:"ac-workspace__task-head",children:[a("span",{class:"ac-workspace__task-name",children:t.name}),a("button",{type:"button",class:"ac-button ac-button--primary","aria-expanded":K.value===t.name,onClick:()=>{K.value=K.value===t.name?null:t.name,$e.value={},gn.value=null,ve.value=null,_n.value=[]},children:K.value===t.name?"Close":"Start session"})]}),a("p",{class:"ac-workspace__task-intent",children:t.intent}),t.prompt!==""?a("code",{class:"ac-workspace__task-prompt",children:["prompts/",t.prompt]}):null,K.value===t.name?a(pu,{role:e.slug,task:t}):null]},t.name))}),e.skills.length>0?a("details",{class:"ac-workspace__skills",children:[a("summary",{children:["Skill shortlist (",e.skills.length,")"]}),a("ul",{class:"ac-workspace__skill-list",children:[e.skills.slice(0,5).map(t=>a("li",{class:"ac-workspace__skill",children:[a("code",{children:t.id})," — ",t.why]},t.id)),e.skills.length>5?a("li",{class:"ac-workspace__skill-more",children:["+ ",e.skills.length-5," more"]}):null]})]}):null]})}function mu(){return a("section",{class:"ac-workspace__sessions","aria-labelledby":"sessions-heading",children:[a("h2",{id:"sessions-heading",class:"ac-workspace__heading",children:"Recent sessions"}),pn.value.length===0?a("p",{class:"ac-workspace__empty",children:"No sessions yet — pick a role and start one."}):a("ul",{class:"ac-workspace__session-list",children:pn.value.map(e=>a("li",{class:"ac-workspace__session",children:a("button",{type:"button",class:`ac-workspace__session-open${ve.value===e.id?" ac-workspace__session-open--active":""}`,"aria-label":`Open session ${e.task}`,"aria-current":ve.value===e.id?"true":void 0,onClick:()=>{uu(e.id)},children:[a("span",{class:"ac-workspace__session-id",children:e.id.slice(0,16)}),a("span",{class:"ac-workspace__session-role",children:e.role}),a("span",{class:"ac-workspace__session-task",children:e.task})]})},e.id))})]})}function yu(){return a("section",{class:"ac-workspace__knowledge","aria-labelledby":"knowledge-heading",children:[a("h2",{id:"knowledge-heading",class:"ac-workspace__heading",children:"Knowledge sources"}),bi.value.length===0?a("p",{class:"ac-workspace__empty",children:["No sources yet. Run ",a("code",{children:"/knowledge:ingest <path>"})," to add documents."]}):a("ol",{class:"ac-workspace__citation-list",children:bi.value.map((e,n)=>a("li",{class:"ac-workspace__citation",children:[a("span",{class:"ac-workspace__citation-marker","aria-label":`Citation ${n+1}`,children:["[",n+1,"]"]}),a("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?a("span",{class:"ac-workspace__citation-pin","aria-label":"pinned",children:"★"}):null,a("p",{class:"ac-workspace__citation-excerpt",children:[e.excerpt.slice(0,200),e.excerpt.length>200?"…":""]})]},e.id))})]})}function bu(){return a("section",{class:"ac-workspace__recent","aria-labelledby":"recent-heading",children:[a("h2",{id:"recent-heading",class:"ac-workspace__heading",children:"Recent documents"}),ki.value.length===0?a("p",{class:"ac-workspace__empty",children:"No documents yet. Saved drafts land here."}):a("ul",{class:"ac-workspace__doc-list",children:ki.value.map(e=>a("li",{class:"ac-workspace__doc",children:[a("span",{class:"ac-workspace__doc-type","data-type":e.type,children:e.type}),a("span",{class:"ac-workspace__doc-title",children:e.title}),a("time",{class:"ac-workspace__doc-time",dateTime:e.updated_at,children:e.updated_at.slice(0,10)})]},`${e.type}/${e.slug}`))})]})}function ku(){const n=Object.values(ft.value).filter(t=>t.killed||t.consecutive_failures>0);return a("section",{class:"ac-workspace__drive-health","aria-labelledby":"drive-health-heading",children:[a("h2",{id:"drive-health-heading",class:"ac-workspace__heading",children:"Host health"}),n.length===0?a("p",{class:"ac-workspace__empty",children:"All hosts healthy."}):a("ul",{class:"ac-workspace__health-list",children:Object.entries(ft.value).filter(([,t])=>t.killed||t.consecutive_failures>0).map(([t,i])=>{const r=i.killed?i.kill_reason==="manual"?"paused (manual)":"paused — auto-recovering":"degraded";return a("li",{class:"ac-workspace__health","data-killed":i.killed?"true":"false",children:[a("span",{class:"ac-workspace__health-host",children:t}),a("span",{class:"ac-workspace__health-state",children:r}),a("span",{class:"ac-workspace__health-meta",children:[i.consecutive_failures," fail streak",i.last_error_kind!=null?` · ${i.last_error_kind}`:""]}),i.killed?a("button",{type:"button",class:"ac-button ac-workspace__health-reset","aria-label":`Reset ${t}`,onClick:()=>{fu(t)},children:"Reset"}):null]},t)})})]})}function wu(){const e=Ht.value;return a("fieldset",{class:"ac-workspace__explain",children:[a("legend",{class:"ac-workspace__heading",children:"Explanation style"}),a("label",{class:"ac-workspace__explain-option",children:[a("input",{type:"radio",name:"explain-mode",value:"plain",checked:e==="plain",onChange:()=>{Ht.value="plain"},"aria-label":"Plain language"}),a("span",{children:"Plain language"})]}),a("label",{class:"ac-workspace__explain-option",children:[a("input",{type:"radio",name:"explain-mode",value:"technical",checked:e==="technical",onChange:()=>{Ht.value="technical"},"aria-label":"Technical detail"}),a("span",{children:"Technical detail"})]}),a("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 Su(){const e=nl.value,n=e.length>0?e.map(i=>i.id):Object.keys(Fa),t=new Map(e.map(i=>[i.id,i.cli_present]));return a("label",{class:"ac-workspace__host-picker",children:[a("span",{class:"ac-workspace__host-label",children:"Host"}),a("select",{class:"ac-workspace__host-select","aria-label":"Host agent",value:Vi.value,onChange:i=>{ou(i.target.value)},children:n.map(i=>{const r=t.get(i)!==!1,l=Fa[i]??i;return a("option",{value:i,disabled:!r,children:[l," (",i,")",r?"":" — not installed"]},i)})})]})}function Cu(){if(ne(()=>{su()},[]),an.value!==null)return a("div",{class:"ac-page ac-page--error",children:[a("h1",{children:"Workspace"}),a("p",{class:"ac-banner ac-banner--error",children:an.value})]});if(!el.value)return a("div",{class:"ac-page",children:[a("h1",{children:"Workspace"}),a("p",{children:"Loading…"})]});const e=dt.value!==null?Fn.value.find(n=>n.slug===dt.value)??null:null;return a("div",{class:"ac-page ac-workspace",children:[a("header",{class:"ac-page__header",children:[a("h1",{children:"Workspace"}),a("p",{class:"ac-page__subtitle",children:"Pick a role, pick a first task, run it."}),a(Su,{})]}),B.value!==null?a("p",{class:"ac-banner",role:"status",children:B.value}):null,a("div",{class:"ac-workspace__grid",children:[a("section",{class:"ac-workspace__roles","aria-labelledby":"roles-heading",children:[a("h2",{id:"roles-heading",class:"ac-workspace__heading",children:"Roles"}),Fn.value.length===0?a("p",{class:"ac-workspace__empty",children:"No roles installed."}):a("div",{class:"ac-workspace__role-grid",children:Fn.value.map(n=>a(hu,{role:n},n.slug))})]}),a("main",{class:"ac-workspace__main","aria-label":"Tasks and sessions",children:[e!==null?a(_u,{role:e}):a("p",{class:"ac-workspace__empty",children:"Pick a role on the left to see its first tasks."}),a(gu,{}),a(mu,{})]}),a("aside",{class:"ac-workspace__rail","aria-label":"Knowledge and documents",children:[a(yu,{}),a(bu,{}),a(ku,{}),a(wu,{})]})]})]})}const rl="agent-config-theme";function Tu(){return(typeof document<"u"?document.documentElement.getAttribute("data-theme"):null)==="dark"?"dark":"light"}const ln=h(Tu());function Au(){try{const e=localStorage.getItem(rl);return e==="light"||e==="dark"?e:null}catch{return null}}function xu(){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 Nu(){return Au()===null&&xu()===null}function ll(e){ln.value=e,document.documentElement.setAttribute("data-theme",e)}function Eu(){const e=ln.value==="dark"?"light":"dark";try{localStorage.setItem(rl,e)}catch{}ll(e)}function Iu(){if(typeof window>"u"||typeof window.matchMedia!="function")return;const e=window.matchMedia("(prefers-color-scheme: dark)"),n=()=>{Nu()&&ll(e.matches?"dark":"light")};typeof e.addEventListener=="function"&&e.addEventListener("change",n)}function $u(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("embed")==="1"}const Ou=$u(),ol=[{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 sl(e){for(const n of ol)for(const t of n.matches)if(e===t||e.startsWith(`${t}/`))return n.id;return null}function Pu(e){const n=ge.value,t=sl(e);return ol.filter(i=>i.id==="project"?n?.projectSurface===!0||t==="project":i.id==="workspace"?n?.devSurfaces===!0||t==="workspace":!0)}function Lu(){const e=Yn.value,n=sl(e);return a("header",{class:"ac-topnav",children:a("div",{class:"ac-topnav__inner",children:[a("div",{class:"ac-topnav__brand",children:[a("h1",{class:"ac-topnav__title",children:"@event4u/agent-config"}),a("p",{class:"ac-topnav__subtitle",children:"Browser Wizard"})]}),a("nav",{class:"ac-topnav__tabs","aria-label":"Surfaces",children:Pu(e).map(t=>a("button",{type:"button",class:`ac-topnav__tab${n===t.id?" ac-topnav__tab--active":""}`,"aria-current":n===t.id?"page":void 0,onClick:()=>_t(t.hashPath),children:t.label},t.id))}),a("button",{type:"button",class:"ac-topnav__theme","aria-label":ln.value==="dark"?"Switch to light theme":"Switch to dark theme",title:ln.value==="dark"?"Switch to light theme":"Switch to dark theme",onClick:()=>{Eu()},children:ln.value==="dark"?"☀":"☾"})]})})}function Ru({path:e}){return a("div",{class:"ac-page ac-page--error",children:[a("h1",{children:"Page not found"}),a("p",{children:["Nothing routed to ",a("code",{children:e}),". Try ",a("a",{href:"#/setup",children:"Setup"}),"."]})]})}function Fu(){const e=ge.value;return e===null||e.dryRun!==!0?null:a("div",{class:"ac-dryrun-banner",role:"status","aria-live":"polite",children:[a("strong",{children:"DRY RUN"}),a("span",{children:" · no files will be written. Validation + rendering run normally; commits return a preview."})]})}function Mu(e){return e==="/"||e==="/setup"||e.startsWith("/setup/")?a(Oa,{path:e}):e.startsWith("/wizard")?a(Oa,{path:e}):e==="/settings/changes"?a(Hc,{}):e==="/settings"||e.startsWith("/settings/")?a(eu,{}):e==="/project"||e.startsWith("/project/")?a(ru,{}):e==="/workspace"?a(Cu,{}):a(Ru,{path:e})}function ju(){return ne(()=>{Il(),Yn.value==="/"&&_t("/setup"),Pl()},[]),a(L,{children:[a(Fu,{}),Ou?null:a(Lu,{}),Mu(Yn.value)]})}const Du=3e4,Uu=30*6e4;let An=null,ja=!1;function Da(e){if(!ja&&(ja=!0,!(typeof navigator>"u"||typeof navigator.sendBeacon!="function")))try{navigator.sendBeacon(`/api/v1/shutdown?token=${encodeURIComponent(e)}`)}catch{}}function Bu(e){if(typeof window>"u")return()=>{};let n=Date.now();const t=()=>{n=Date.now()},i=["pointerdown","keydown","wheel","touchstart"];for(const s of i)window.addEventListener(s,t,{passive:!0});const r=()=>{document.hidden||t()};document.addEventListener("visibilitychange",r);const l=()=>{An!==null&&clearInterval(An),An=null;for(const s of i)window.removeEventListener(s,t);document.removeEventListener("visibilitychange",r),window.removeEventListener("pagehide",o)};An=setInterval(()=>{if(!document.hidden){if(Date.now()-n>Uu){Da(e),l();return}y("/api/v1/ping").catch(()=>{})}},Du);function o(){Da(e)}return window.addEventListener("pagehide",o),l}function zu(){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(),t=window.location.pathname+(n?`?${n}`:"")+window.location.hash;window.history.replaceState(window.history.state,"",t)}function Wu(){return new URLSearchParams(window.location.search).get("token")}function Hu(){const e=document.getElementById("app");if(e===null)return;const n=Wu();if(n===null){e.textContent="agent-config UI · missing token — re-open via `agent-config ui:serve`.";return}$l(n),zu(),Bu(n),Iu(),e.textContent="",gl(a(ju,{}),e)}Hu();
|
|
26
|
-
//# sourceMappingURL=index-JDAF00bC.js.map
|