@event4u/agent-config 14.8.0 → 14.9.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 +165 -237
- package/README.md +1 -1
- package/agents/templates/.ai-council.yml.example +34 -4
- package/dist/agent-src/commands/pr/merge.md +9 -5
- package/dist/agent-src/commands/review/changes.md +95 -14
- package/dist/agent-src/commands/roadmap/process-full.md +2 -2
- package/dist/agent-src/contexts/execution/host-capability-manifest.md +77 -0
- package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +36 -0
- package/dist/agent-src/contexts/execution/subagent-response-contract.md +80 -0
- package/dist/agent-src/rules/untrusted-input-defense.md +9 -3
- package/dist/agent-src/skills/code-review/evals/evals.json +87 -46
- package/dist/agent-src/skills/humanizer/SKILL.md +39 -0
- package/dist/agent-src/skills/humanizer/evals/strip_fixtures.json +57 -0
- package/dist/agent-src/skills/humanizer/references/fixtures.md +54 -0
- package/dist/agent-src/skills/judge-spec-compliance/SKILL.md +154 -0
- package/dist/agent-src/skills/judge-synthesis/SKILL.md +45 -0
- package/dist/agent-src/skills/roadmap-writing/SKILL.md +18 -18
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +8 -0
- package/dist/cli/registry.js +2 -0
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/{chunk-MMSGVZKV.js → chunk-77GR3VD4.js} +65 -40
- package/dist/cli-delegate/{chunk-Q26HT4QT.js → chunk-E46KPN6K.js} +251 -150
- package/dist/cli-delegate/{chunk-EEJUMCDZ.js → chunk-PLSG6UL5.js} +1 -1
- package/dist/cli-delegate/cmd_conformance.js +89 -13
- package/dist/cli-delegate/cmd_doctor.js +3 -3
- package/dist/cli-delegate/cmd_handoff.js +2 -2
- package/dist/cli-delegate/cmd_memory_get.js +1 -1
- package/dist/cli-delegate/cmd_route_audit.js +1 -1
- package/dist/cli-delegate/cmd_settings_get.js +1 -1
- package/dist/cli-delegate/cmd_settings_set.js +1 -1
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +37 -15
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +3 -3
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +6 -5
- package/dist/discovery/trust-report.md +2 -2
- package/dist/discovery/workspaces.json +5 -4
- package/dist/hooks/dispatch.js +562 -204
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +808 -331
- package/dist/scripts/_lib/claude_plugin.js +162 -0
- package/dist/scripts/_lib/claude_plugin.js.map +1 -0
- package/dist/scripts/_lib/environment_detector.js +397 -0
- package/dist/scripts/_lib/environment_detector.js.map +1 -0
- package/dist/scripts/_lib/spawn_env.js +129 -0
- package/dist/scripts/_lib/spawn_env.js.map +1 -0
- package/dist/scripts/ai_council/modes.js +199 -0
- package/dist/scripts/ai_council/modes.js.map +1 -0
- package/dist/scripts/ai_council/transport_resolver.js +418 -0
- package/dist/scripts/ai_council/transport_resolver.js.map +1 -0
- package/dist/server/routes/wizard.js +3 -2
- package/dist/server/routes/wizard.js.map +1 -1
- package/dist/ui/assets/index-Cxgy63kz.js +26 -0
- package/dist/ui/assets/index-Cxgy63kz.js.map +1 -0
- package/dist/ui/index.html +1 -1
- package/docs/guidelines/agent-infra/traceability-field-mechanics.md +50 -0
- package/docs/guidelines/agent-infra/untrusted-input-spotlighting.md +17 -0
- package/package.json +7 -3
- package/src/config/estate-count-budget.json +13 -744
- package/src/config/evaluator-budgets.json +4 -4
- package/src/config/gate-coverage.yml +247 -9
- package/src/config/gate-violation-baselines.json +72 -72
- package/src/config/publish-surface.json +60 -0
- package/src/config/requirements-trace-budget.json +32 -0
- package/src/config/rule-stub-ceilings.json +8 -1
- package/src/scripts/_dispatch.bash +7 -0
- package/src/scripts/_lib/base_tree.ts +175 -0
- package/src/scripts/_lib/billing_grant.ts +165 -0
- package/src/scripts/_lib/billing_grant_cli.ts +123 -0
- package/src/scripts/_lib/council_fallback_posture.ts +53 -6
- package/src/scripts/_lib/council_fallback_wiring.ts +61 -1
- package/src/scripts/_lib/host_capability.ts +59 -5
- package/src/scripts/_lib/quota_parked.ts +133 -0
- package/src/scripts/_lib/retrieval_sanitize.ts +62 -0
- package/src/scripts/_lib/review_telemetry.ts +196 -0
- package/src/scripts/_lib/subagent_response.ts +92 -0
- package/src/scripts/adr/regenerate_index.ts +14 -7
- package/src/scripts/ai_council/clients.ts +12 -1
- package/src/scripts/ai_council/config.ts +72 -115
- package/src/scripts/ai_council/fallback_config.ts +19 -7
- package/src/scripts/ai_council/mid_flight_fallback.ts +88 -7
- package/src/scripts/ai_council/orchestrator.ts +2 -2
- package/src/scripts/ai_council/py_format.ts +124 -0
- package/src/scripts/ai_council/transport_resolver.ts +65 -2
- package/src/scripts/audit_adr_coverage.ts +33 -6
- package/src/scripts/check_council_pin_staleness.ts +300 -0
- package/src/scripts/check_estate_count.ts +420 -293
- package/src/scripts/check_gate_coverage.ts +91 -0
- package/src/scripts/check_no_stub_inventory_table.ts +292 -0
- package/src/scripts/check_pack_size.ts +234 -1
- package/src/scripts/check_publish_surface.ts +297 -0
- package/src/scripts/check_requirements_trace.ts +378 -0
- package/src/scripts/check_secret_leak.ts +166 -12
- package/src/scripts/code_graph/cli.ts +44 -5
- package/src/scripts/code_graph/extract.ts +87 -0
- package/src/scripts/council_cli.ts +12 -16
- package/src/scripts/detect_ai_tells.ts +87 -0
- package/src/scripts/dispatch_r2_reviewer.ts +42 -0
- package/src/scripts/generate_capabilities_index.ts +41 -0
- package/src/scripts/git_authorization_hook.ts +54 -4
- package/src/scripts/hooks/block_unauthorized_git.ts +19 -1
- package/src/scripts/hooks/run_continuation_hook.ts +3 -1
- package/src/scripts/hooks/subagent_ledger_hook.ts +76 -11
- package/src/scripts/injection_scan_hook.ts +120 -10
- package/src/scripts/lint_adr_sweep_routing.ts +365 -0
- package/src/scripts/lint_workflow_security.ts +53 -10
- package/src/scripts/lint_workflow_security_allowlist.json +2 -18
- package/src/scripts/report_envelope_rate.ts +166 -0
- package/src/scripts/review_axis_report.ts +218 -0
- package/src/scripts/run_supervise.ts +46 -1
- package/src/scripts/schemas/evals.schema.json +5 -0
- package/src/scripts/sync_pr_branch.ts +14 -7
- package/dist/cli/commands/commands.candidates.test.js +0 -257
- package/dist/cli/commands/commands.candidates.test.js.map +0 -1
- package/dist/cli/commands/profiles.test.js +0 -88
- package/dist/cli/commands/profiles.test.js.map +0 -1
- package/dist/cli/commands/recordTriggerEval.test.js +0 -113
- package/dist/cli/commands/recordTriggerEval.test.js.map +0 -1
- package/dist/cli/configRoot.test.js +0 -97
- package/dist/cli/configRoot.test.js.map +0 -1
- package/dist/cli/mcp/content.test.js +0 -54
- package/dist/cli/mcp/content.test.js.map +0 -1
- package/dist/cli/mcp/dispatch.test.js +0 -108
- package/dist/cli/mcp/dispatch.test.js.map +0 -1
- package/dist/server/writeRoot.test.js +0 -91
- package/dist/server/writeRoot.test.js.map +0 -1
- package/dist/shared/capabilities.test.js +0 -39
- package/dist/shared/capabilities.test.js.map +0 -1
- package/dist/ui/assets/index-C1pBRm1f.js +0 -26
- package/dist/ui/assets/index-C1pBRm1f.js.map +0 -1
- /package/dist/cli-delegate/{chunk-N7CDDGI3.js → chunk-CYH5SP6M.js} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
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 gt,T,Wa,za,le,Zi,Ha,Ka,Ft,$n,nn,Ya,Ti,qt,Vt,Wn={},zn=[],fl=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,_t=Array.isArray;function Q(e,n){for(var t in n)e[t]=n[t];return e}function Ai(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function hl(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?gt.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 Ln(e,o,i,r,null)}function Ln(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??++Wa,__i:-1,__u:0};return r==null&&T.vnode!=null&&T.vnode(l),l}function P(e){return e.children}function tn(e,n){this.props=e,this.context=n}function ye(e,n){if(n==null)return e.__?ye(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"?ye(e):null}function pl(e){if(e.__P&&e.__d){var n=e.__v,t=n.__e,i=[],r=[],l=Q({},n);l.__v=n.__v+1,T.vnode&&T.vnode(l),Ei(e.__P,l,n,e.__n,e.__P.namespaceURI,32&n.__u?[t]:null,i,t??ye(n),!!(32&n.__u),r),l.__v=n.__v,l.__.__k[l.__i]=l,Qa(i,l,r),n.__e=n.__=null,l.__e!=t&&qa(l)}}function qa(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}),qa(e)}function ea(e){(!e.__d&&(e.__d=!0)&&le.push(e)&&!Hn.__r++||Zi!=T.debounceRendering)&&((Zi=T.debounceRendering)||Ha)(Hn)}function Hn(){try{for(var e,n=1;le.length;)le.length>n&&le.sort(Ka),e=le.shift(),n=le.length,pl(e)}finally{le.length=Hn.__r=0}}function Va(e,n,t,i,r,l,o,s,u,c,d){var g,f,p,v,_,k,w=i&&i.__k||zn,b=n.length;for(u=vl(t,n,w,u,b),g=0;g<b;g++)(p=t.__k[g])!=null&&(f=p.__i!=-1&&w[p.__i]||Wn,p.__i=g,k=Ei(e,p,f,r,l,o,s,u,c,d),v=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&Ni(f.ref,null,p),d.push(p.ref,p.__c||v,p)),_==null&&v!=null&&(_=v),4&p.__u?(u=Ga(p,u,e),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 vl(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]=Ln(null,o,null,null,null):_t(o)?o=e.__k[l]=Ln(P,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[l]=Ln(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=gl(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=ye(s)),Za(s,s));return i}function Ga(e,n,t){var i,r;if(typeof e.type=="function"){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,n=Ga(i[r],n,t));return n}e.__e!=n&&(n&&e.type&&!n.parentNode&&(n=ye(e)),n=t.insertBefore(e.__e,n||null));do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function gl(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 na(e,n,t){n[0]=="-"?e.setProperty(n,t??""):e[n]=t==null?"":typeof t!="number"||fl.test(n)?t:t+"px"}function Nn(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||na(e.style,n,"");if(t)for(n in t)i&&t[n]==i[n]||na(e.style,n,t[n])}else if(n[0]=="o"&&n[1]=="n")l=n!=(n=n.replace(Ya,"$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[nn]=i[nn]:(t[nn]=Ti,e.addEventListener(n,l?Vt:qt,l)):e.removeEventListener(n,l?Vt:qt,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 ta(e){return function(n){if(this.l){var t=this.l[n.type+e];if(n[$n]==null)n[$n]=Ti++;else if(n[$n]<t[nn])return;return t(T.event?T.event(n):n)}}}function Ei(e,n,t,i,r,l,o,s,u,c){var d,g,f,p,v,_,k,w,b,W,Xe,ce,Ze,Xi,En,Rt,q=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 q=="function"){g=o.length;try{if(b=n.props,W=q.prototype&&q.prototype.render,Xe=(d=q.contextType)&&i[d.__c],ce=d?Xe?Xe.props.value:d.__:i,t.__c?w=(f=n.__c=t.__c).__=f.__E:(W?n.__c=f=new q(b,ce):(n.__c=f=new tn(b,ce),f.constructor=q,f.render=ml),Xe&&Xe.sub(f),f.state||(f.state={}),f.__n=i,p=f.__d=!0,f.__h=[],f._sb=[]),W&&f.__s==null&&(f.__s=f.state),W&&q.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Q({},f.__s)),Q(f.__s,q.getDerivedStateFromProps(b,f.__s))),v=f.props,_=f.state,f.__v=n,p)W&&q.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),W&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(W&&q.getDerivedStateFromProps==null&&b!==v&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(b,ce),n.__v==t.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(b,f.__s,ce)===!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(Ie){Ie&&(Ie.__=n)}),zn.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f),s=ye(t);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(b,f.__s,ce),W&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(v,_,k)})}if(f.context=ce,f.props=b,f.__P=e,f.__e=!1,Ze=T.__r,Xi=0,W)f.state=f.__s,f.__d=!1,Ze&&Ze(n),d=f.render(f.props,f.state,f.context),zn.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,Ze&&Ze(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=Q(Q({},i),f.getChildContext())),W&&!p&&f.getSnapshotBeforeUpdate!=null&&(k=f.getSnapshotBeforeUpdate(v,_)),En=d!=null&&d.type===P&&d.key==null?Xa(d.props.children):d,s=Va(e,_t(En)?En:[En],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(Ie){if(o.length=g,n.__v=null,u||l!=null){if(Ie.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(Rt=l.length;Rt--;)Ai(l[Rt])}else n.__e=t.__e;n.__k==null&&(n.__k=t.__k||[]),Ie.then||Ja(n),T.__e(Ie,n,t)}}else l==null&&n.__v==t.__v?(n.__k=t.__k,n.__e=t.__e):s=n.__e=_l(t.__e,n,t,i,r,l,o,u,c);return(d=T.diffed)&&d(n),128&n.__u?void 0:s}function Ja(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ja))}function Qa(e,n,t){for(var i=0;i<t.length;i++)Ni(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 Xa(e){return typeof e!="object"||e==null||e.__b>0?e:_t(e)?e.map(Xa):e.constructor!==void 0?null:Q({},e)}function _l(e,n,t,i,r,l,o,s,u){var c,d,g,f,p,v,_,k=t.props||Wn,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&>.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||Nn(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||Nn(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=""),Va(n.type=="template"?e.content:e,_t(f)?f:[f],n,t,i,b=="foreignObject"?"http://www.w3.org/1999/xhtml":r,l,o,l?l[0]:t.__k&&ye(t,0),s,u),l!=null)for(c=l.length;c--;)Ai(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])&&Nn(e,c,v,k[c],r),c="checked",_!=null&&_!=e[c]&&Nn(e,c,_,k[c],r))}return e}function Ni(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 Za(e,n,t){var i,r;if(T.unmount&&T.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Ni(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]&&Za(i[r],n,t||typeof e.type!="function");t||Ai(e.__e),e.__c=e.__=e.__e=void 0}function ml(e,n,t){return this.constructor(e,t)}function yl(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=[],Ei(n,e=n.__k=hl(P,null,[e]),r||Wn,Wn,n.namespaceURI,r?null:n.firstChild?gt.call(n.childNodes):null,l,r?r.__e:n.firstChild,i,o),Qa(l,e,o),e.props.children=null}gt=zn.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}},Wa=0,za=function(e){return e!=null&&e.constructor===void 0},tn.prototype.setState=function(e,n){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Q({},this.state),typeof e=="function"&&(e=e(Q({},t),this.props)),e&&Q(t,e),e!=null&&this.__v&&(n&&this._sb.push(n),ea(this))},tn.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ea(this))},tn.prototype.render=P,le=[],Ha=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ka=function(e,n){return e.__v.__b-n.__v.__b},Hn.__r=0,Ft=Math.random().toString(8),$n="__d"+Ft,nn="__a"+Ft,Ya=/(PointerCapture)$|Capture$/i,Ti=0,qt=ta(!1),Vt=ta(!0);var bl=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:--bl,__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 fn,N,Mt,ia,Gt=0,er=[],I=T,aa=I.__b,ra=I.__r,la=I.diffed,oa=I.__c,sa=I.unmount,ca=I.__;function xi(e,n){I.__h&&I.__h(N,e,Gt||n),Gt=0;var t=N.__H||(N.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({}),t.__[e]}function Ii(e){return Gt=1,kl(ir,e)}function kl(e,n,t){var i=xi(fn++,2);if(i.t=e,!i.__c&&(i.__=[ir(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 ae(e,n){var t=xi(fn++,3);!I.__s&&tr(t.__H,n)&&(t.__=e,t.u=n,N.__H.__h.push(t))}function nr(e,n){var t=xi(fn++,7);return tr(t.__H,n)&&(t.__=e(),t.__H=n,t.__h=e),t.__}function wl(){for(var e;e=er.shift();){var n=e.__H;if(e.__P&&n)try{n.__h.some(Pn),n.__h.some(Jt),n.__h=[]}catch(t){n.__h=[],I.__e(t,e.__v)}}}I.__b=function(e){N=null,aa&&aa(e)},I.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),ca&&ca(e,n)},I.__r=function(e){ra&&ra(e),fn=0;var n=(N=e.__c).__H;n&&(Mt===N?(n.__h=[],N.__h=[],n.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(n.__h.some(Pn),n.__h.some(Jt),n.__h=[],fn=0)),Mt=N},I.diffed=function(e){la&&la(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(er.push(n)!==1&&ia===I.requestAnimationFrame||((ia=I.requestAnimationFrame)||Sl)(wl)),n.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),Mt=N=null},I.__c=function(e,n){n.some(function(t){try{t.__h.some(Pn),t.__h=t.__h.filter(function(i){return!i.__||Jt(i)})}catch(i){n.some(function(r){r.__h&&(r.__h=[])}),n=[],I.__e(i,t.__v)}}),oa&&oa(e,n)},I.unmount=function(e){sa&&sa(e);var n,t=e.__c;t&&t.__H&&(t.__H.__.some(function(i){try{Pn(i)}catch(r){n=r}}),t.__H=void 0,n&&I.__e(n,t.__v))};var ua=typeof requestAnimationFrame=="function";function Sl(e){var n,t=function(){clearTimeout(i),ua&&cancelAnimationFrame(n),setTimeout(e)},i=setTimeout(t,35);ua&&(n=requestAnimationFrame(t))}function Pn(e){var n=N,t=e.__c;typeof t=="function"&&(e.__c=void 0,t()),N=n}function Jt(e){var n=N;e.__c=e.__(),N=n}function tr(e,n){return!e||e.length!==n.length||n.some(function(t,i){return t!==e[i]})}function ir(e,n){return typeof n=="function"?n(e):n}var Cl=Symbol.for("preact-signals");function mt(){if(ee>1)ee--;else{var e,n=!1;for(function(){var r=Yn;for(Yn=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}}();rn!==void 0;){var t=rn;for(rn=void 0,Kn++;t!==void 0;){var i=t.u;if(t.u=void 0,t.f&=-3,!(8&t.f)&&rr(t))try{t.c()}catch(r){n||(e=r,n=!0)}t=i}}if(Kn=0,ee--,n)throw e}}function Tl(e){if(ee>0)return e();Qt=++Al,ee++;try{return e()}finally{mt()}}var an,A=void 0;function yt(e){var n=A,t=an;A=void 0,an=void 0;try{return e()}finally{A=n,an=t}}var rn=void 0,ee=0,Kn=0,Al=0,Qt=0,Yn=void 0,qn=0;function ar(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 L(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}L.prototype.brand=Cl;L.prototype.h=function(){return!0};L.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:yt(function(){var i;(i=n.W)==null||i.call(n)}))};L.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&&yt(function(){var r;(r=n.Z)==null||r.call(n)}))}};L.prototype.subscribe=function(e){var n=this;return Sn(function(){var t=n.value;yt(function(){return e(t)})},{name:"sub"})};L.prototype.valueOf=function(){return this.value};L.prototype.toString=function(){return this.value+""};L.prototype.toJSON=function(){return this.value};L.prototype.peek=function(){var e=this;return yt(function(){return e.value})};Object.defineProperty(L.prototype,"value",{get:function(){var e=ar(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Kn>100)throw new Error("Cycle detected");(function(t){ee!==0&&Kn===0&&t.l!==Qt&&(t.l=Qt,Yn={S:t,v:t.v,i:t.i,o:Yn})})(this),this.v=e,this.i++,qn++,ee++;try{for(var n=this.t;n!==void 0;n=n.x)n.t.N()}finally{mt()}}}});function h(e,n){return new L(e,n)}function rr(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 lr(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 or(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 Ne(e,n){L.call(this,void 0,n),this.x=e,this.s=void 0,this.g=qn-1,this.f=4}Ne.prototype=new L;Ne.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===qn))return!0;if(this.g=qn,this.f|=1,this.i>0&&!rr(this))return this.f&=-2,!0;var e=A;try{lr(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,or(this),this.f&=-2,!0};Ne.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)}L.prototype.S.call(this,e)};Ne.prototype.U=function(e){if(this.t!==void 0&&(L.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)}};Ne.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(Ne.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=ar(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function da(e,n){return new Ne(e,n)}function sr(e){var n=e.m;if(e.m=void 0,typeof n=="function"){ee++;var t=A;A=void 0;try{n()}catch(i){throw e.f&=-2,e.f|=8,Oi(e),i}finally{A=t,mt()}}}function Oi(e){for(var n=e.s;n!==void 0;n=n.n)n.S.U(n);e.x=void 0,e.s=void 0,sr(e)}function El(e){if(A!==this)throw new Error("Out-of-order effect");or(this),A=e,this.f&=-2,8&this.f&&Oi(this),mt()}function Ge(e,n){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=n?.name,an&&an.push(this)}Ge.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()}};Ge.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,sr(this),lr(this),ee++;var e=A;return A=this,El.bind(this,e)};Ge.prototype.N=function(){2&this.f||(this.f|=2,this.u=rn,rn=this)};Ge.prototype.d=function(){this.f|=8,1&this.f||Oi(this)};Ge.prototype.dispose=function(){this.d()};function Sn(e,n){var t=new Ge(e,n);try{t.c()}catch(r){throw t.d(),r}var i=t.d.bind(t);return i[Symbol.dispose]=i,i}var cr,xn,Nl=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,ur=[];Sn(function(){cr=this.N})();function Je(e,n){T[e]=n.bind(null,T[e]||function(){})}function Vn(e){if(xn){var n=xn;xn=void 0,n()}xn=e&&e.S()}function dr(e){var n=this,t=e.data,i=Il(t);i.name="ReactiveDom",i.value=t;var r=nr(function(){for(var s=n,u=n.__v;u=u.__;)if(u.__c){u.__c.__$f|=4;break}var c=da(function(){var p=i.value.value;return p===0?0:p===!0?"":p||""}),d=da(function(){return!Array.isArray(c.value)&&!za(c.value)}),g=Sn(function(){if(this.N=fr,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}dr.displayName="ReactiveTextNode";Object.defineProperties(L.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:dr},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});Je("__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 L&&(t||(n.__np=t={}),t[r]=l,i[r]=l.peek())}}e(n)});Je("__r",function(e,n){if(e(n),n.type!==P){Vn();var t,i=n.__c;i&&(i.__$f&=-2,(t=i.__$u)===void 0&&(i.__$u=t=function(r,l){var o;return Sn(function(){o=this},{name:l}),o.c=r,o}(function(r){return function(){var l;Nl&&((l=this.y)==null||l.call(this)),r.__$f|=1,r.setState({})}}(i),typeof n.type=="function"?n.type.displayName||n.type.name:""))),Vn(t)}});Je("__e",function(e,n,t,i){Vn(),e(n,t,i)});Je("diffed",function(e,n){Vn();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=xl(t,u,d,r),l[u]=c):c.o(d,r)}}}e(n)});function xl(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:Sn(function(){this.N=fr;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))})}}Je("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)});Je("__h",function(e,n,t,i){i<3&&(n.__$f|=2),e(n,t,i)});tn.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 Il(e,n){return nr(function(){return h(e,n)},[])}var Ol=function(e){queueMicrotask(function(){queueMicrotask(e)})};function $l(){Tl(function(){for(var e;e=ur.shift();)cr.call(e)})}function fr(){ur.push(this)===1&&(T.requestAnimationFrame||Ol)($l)}function hr(){const e=window.location.hash;return e===""||e==="#"?"/":e.startsWith("#")?e.slice(1):e}const Gn=h(hr());function bt(e){const n=e.startsWith("/")?e:`/${e}`;`#${n}`!==window.location.hash&&(window.location.hash=n)}let fa=!1;function Ll(){fa||(fa=!0,window.addEventListener("hashchange",()=>{Gn.value=hr()}))}let hn=null;function Pl(e){hn=e}class x 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??{}};hn!==null&&(t.Authorization=`Bearer ${hn}`);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 x(o.status,u,c)}return u}async function Rl(e,n,t,i={}){const r={Accept:"text/event-stream","Content-Type":"application/json",...i.headers??{}};hn!==null&&(r.Authorization=`Bearer ${hn}`);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 x(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 be=h(null);async function Fl(){try{const e=await y("/api/v1/ping");be.value={...e,projectScopeAvailable:e.projectScopeAvailable===!0,projectSurface:e.projectSurface===!0,devSurfaces:e.devSurfaces===!0}}catch{be.value=null}}function H(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 Ml(e){return/expected (boolean|string|number)/i.test(e)?e.replace(/^expected/i,"Expected"):e}function kt(e){const n={};for(const t of e.fields??[])n[t.path]=Ml(t.message);return n}function Dl({id:e,children:n}){return a("p",{class:"ac-field__description",id:e,children:n})}function jl({id:e,children:n}){return a("p",{class:"ac-field__error",id:e,role:"alert","aria-live":"polite",children:n})}function xe({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(Dl,{id:l,children:t}):null,a("div",{class:"ac-field__control","aria-describedby":l,"aria-errormessage":o,children:r}),i!==void 0?a(jl,{id:o,children:i}):null]})}function pr(e){return a(xe,{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 Ul(e){const n=e.step??(e.integer===!0?1:"any");return a(xe,{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 Bl(e){return a(xe,{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 vr(e){const n=e.options.length>3;return a(xe,{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 Jn(e){return a(xe,{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 gr(e){return e.replace(/_/g," ").replace(/\./g," › ").replace(/\b\w/g,n=>n.toUpperCase())}function Wl(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 Dt(e,n){const t=Wl(n);return{path:e,kind:t,label:gr(e[e.length-1]??""),description:n.description,options:n.enum,min:n.minimum,max:n.maximum,defaultValue:n.default}}function _r(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(Dt([i,o,u],c));else l.push(Dt([i,o],s));n.push({path:[i],label:gr(i),description:r.description,fields:l})}else{const l=n.find(s=>s.path[0]==="__general"),o=Dt([i],r);l===void 0?n.unshift({path:["__general"],label:"General",fields:[o]}):l.fields.push(o)}return n}function Cn(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 pn(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]=pn(s,r,t),l}function Me(e){return e.join(".")}function ha(e,n,t,i){const r=Me(e.path),l=r,o=Cn(n,e.path),s=t[r],u=c=>{i(pn(n,e.path,c))};switch(e.kind){case"string":{const c=typeof o=="string"?o:"";return c.length>80?a(Jn,{id:r,name:l,label:e.label,description:e.description,error:s,value:c,onChange:u}):a(pr,{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(vr,{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(Ul,{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(Bl,{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(Jn,{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 zl({field:e,values:n,errors:t,onChange:i,decorate:r}){const l=Me(e.path),o=r?.(l,e);return o===void 0?a("div",{children:ha(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:ha(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 mr({section:e,values:n,errors:t,onChange:i,decorate:r,footer:l}){return a("section",{class:"ac-section","aria-labelledby":`section-${Me(e.path)}`,children:[a("h2",{class:"ac-section__title",id:`section-${Me(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(zl,{field:o,values:n,errors:t,onChange:i,decorate:r},Me(o.path)))}),l]})}function Hl(e){const n=_r(e.schema),t=e.errors??{};return a("form",{class:"ac-form",onSubmit:i=>i.preventDefault(),children:[n.map(i=>a(mr,{section:i,values:e.values,errors:t,onChange:e.onChange,decorate:e.decorate},Me(i.path))),e.actions!==void 0?a("div",{class:"ac-form__actions",children:e.actions}):null]})}function Kl(e){const[n]=Ii(()=>`${e.id}-list`);return a(xe,{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 Yl=["developer","reviewer","designer","product-manager","ops","qa","maintainer"],ql=["de","en","en-US","en-GB","fr","es","it","nl","pt","pt-BR"];function pa(){return new Date().toISOString().slice(0,10)}function Oe(e,n){return e?.[n]}function Vl({value:e,onChange:n,errors:t,hideRole:i,hideIdentityBasics:r}){const[l,o]=Ii(""),s="umd-role-suggestions";function u(v){n({...e,...v,last_updated:pa()})}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:pa()};v===""?delete _.notes:_.notes=v,n(_)}const p=Yl.filter(v=>!c.includes(v));return a("div",{class:"ac-user-md-form",children:[r?null:a(pr,{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:Oe(t,"identity.name"),onChange:v=>u({identity:{...e.identity,name:v}})}),r?null:a(Kl,{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:ql,error:Oe(t,"language"),onChange:v=>u({language:v})}),i?null:a(xe,{id:"umd-role-input",label:"Roles",description:"One or more roles. Seeded suggestions are non-binding — type anything and press Enter.",error:Oe(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(vr,{id:"umd-pace",name:"style.pace",label:"Pace",value:e.style.pace,error:Oe(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(Jn,{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:Oe(t,"voice_sample"),onChange:v=>u({voice_sample:v})}),a(Jn,{id:"umd-notes",name:"notes",label:"Notes",description:"Optional free-form prose the agent remembers across sessions.",rows:6,value:e.notes??"",error:Oe(t,"notes"),onChange:f})]})}function yr(){return{version:1,identity:{name:""},language:"en",role:[],style:{pace:"pragmatic"},voice_sample:"",last_updated:"1970-01-01"}}function va(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function In(e,n){return typeof e=="string"?e:n}function Gl(e){return e==="thorough"||e==="rapid"?e:"pragmatic"}function Jl(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"&&n.trim()!==""):[]}function Ql(e){if(typeof e=="string")return e===""?void 0:e}function ga(e){const n=yr(),t=va(e.identity)?e.identity:{},i=va(e.style)?e.style:{},r=Ql(e.notes),l={version:1,identity:{name:In(t.name,n.identity.name)},language:In(e.language,n.language),role:Jl(e.role),style:{pace:Gl(i.pace)},voice_sample:In(e.voice_sample,n.voice_sample),last_updated:In(e.last_updated,n.last_updated)};return r!==void 0&&(l.notes=r),l}/*! js-yaml 5.3.0 https://github.com/nodeca/js-yaml @license MIT */var S=Symbol("NOT_RESOLVED");function M(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,represent:n.represent??(t=>String(t)),representTagName:n.representTagName??(()=>e)}}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,represent:n.represent??(i=>i),representTagName:n.representTagName??(()=>e)}}function wt(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,represent:n.represent??(i=>i),representTagName:n.representTagName??(()=>e)}}var Xl=M("tag:yaml.org,2002:str",{resolve:e=>e,identify:e=>typeof e=="string"}),Zl=["","~","null","Null","NULL"],eo=M("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["","~","n","N"],resolve:e=>Zl.indexOf(e)!==-1?null:S,identify:e=>e===null,represent:()=>"null"}),no=M("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["n"],resolve:(e,n)=>e==="null"||n&&e===""?null:S,identify:e=>e===null,represent:()=>"null"}),to=["","~","null","Null","NULL"],io=M("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["","~","n","N"],resolve:e=>to.indexOf(e)!==-1?null:S,identify:e=>e===null,represent:()=>"null"}),ao=["true","True","TRUE"],ro=["false","False","FALSE"],lo=M("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["t","T","f","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"],so=["false"],co=M("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["t","f"],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=["true","True","TRUE","y","Y","yes","Yes","YES","on","On","ON"],fo=["false","False","FALSE","n","N","no","No","NO","off","Off","OFF"],ho=M("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["y","Y","n","N","t","T","f","F","o","O"],resolve:e=>uo.indexOf(e)!==-1?!0:fo.indexOf(e)!==-1?!1:S,identify:e=>Object.prototype.toString.call(e)==="[object Boolean]",represent:e=>e?"true":"false"}),po=new RegExp("^(?:0o[0-7]+|0x[0-9a-fA-F]+|[-+]?[0-9]+)$"),vo=new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");function go(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 _o(e,n){if(n){if(!vo.test(e))return S}else if(!po.test(e))return S;const t=go(e);return Number.isFinite(t)?t:S}var br=M("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-","+",..."0123456789"],resolve:_o,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf("e")<0,represent:e=>e.toString(10)}),mo=new RegExp("^-?(?:0|[1-9][0-9]*)$"),yo=new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");function bo(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 ko(e,n){if(n){if(!yo.test(e))return S}else if(!mo.test(e))return S;const t=bo(e);return Number.isFinite(t)?t:S}var wo=M("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-",..."0123456789"],resolve:ko,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf("e")<0,represent:e=>e.toString(10)}),So=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 Co(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 To(e){if(!So.test(e))return S;const n=Co(e);return Number.isFinite(n)?n:S}var Xt=M("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-","+",..."0123456789"],resolve:To,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf("e")<0,represent:e=>e.toString(10)}),Ao=new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),Eo=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function No(e){if(!Ao.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)||Eo.test(e)?i:S}function xo(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 kr=M("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-","+",".",..."0123456789"],resolve:No,identify:e=>typeof e=="number"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf("e")>=0),represent:xo}),Io=new RegExp("^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$"),Oo=new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function $o(e,n){if(n){if(!Oo.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(!Io.test(e))return S;const t=Number(e);return Number.isFinite(t)?t:S}function Lo(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 Po=M("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-",..."0123456789"],resolve:$o,identify:e=>typeof e=="number"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf("e")>=0),represent:Lo}),Ro=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))$"),Fo=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Mo(e){if(!Ro.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)||Fo.test(e)?i:S}function Do(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 Zt=M("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-","+",".",..."0123456789"],resolve:Mo,identify:e=>typeof e=="number"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf("e")>=0),represent:Do}),jo=M("tag:yaml.org,2002:merge",{implicit:!0,implicitFirstChars:["<"],resolve:(e,n)=>e==="<<"||n&&e===""?"<<":S,identify:()=>!1}),Uo=/^[A-Za-z0-9+/]*={0,2}$/;function Bo(e){const n=e.replace(/\s/g,"");if(n.length%4!==0||!Uo.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 Wo(e){let n="";for(let t=0;t<e.length;t++)n+=String.fromCharCode(e[t]);return btoa(n)}var zo=M("tag:yaml.org,2002:binary",{resolve:Bo,identify:e=>Object.prototype.toString.call(e)==="[object Uint8Array]",represent:Wo}),Ho=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Ko=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 _a(e,n,t,i=0,r=0,l=0,o=0){const s=new Date(Date.UTC(e,n,t,i,r,l,o));return s.setUTCFullYear(e,n,t),s}function Yo(e){let n=Ho.exec(e);if(n===null&&(n=Ko.exec(e)),n===null)return S;const t=+n[1],i=+n[2]-1,r=+n[3];if(!n[4]){const d=_a(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=_a(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 qo=M("tag:yaml.org,2002:timestamp",{implicit:!0,implicitFirstChars:[..."0123456789"],resolve:Yo,identify:e=>e instanceof Date,represent:e=>e.toISOString()}),Vo=$i("tag:yaml.org,2002:seq",{create:()=>[],addItem:(e,n)=>{e.push(n)},identify:Array.isArray});function St(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const n=Object.getPrototypeOf(e);return n===null||n===Object.prototype}function ma(e,n){const t={};for(const i of n)e[i]!==void 0&&(t[i]=e[i]);return t}var Go=$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(St(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,identify:()=>!1}),Jo=$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]]]),"")},identify:()=>!1}),Qo=wt("tag:yaml.org,2002:map",{create:()=>({}),identify:St,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)=>{const t=String(n);return Object.prototype.hasOwnProperty.call(e,t)?e[t]:null}}),Xo=wt("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 Zo(){return{scalar:Object.create(null),sequence:Object.create(null),mapping:Object.create(null)}}function es(){return{scalar:[],sequence:[],mapping:[]}}function ns(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 Ct=class wr{tags;implicitScalarTags;implicitScalarByFirstChar;implicitScalarAnyFirstChar;defaultScalarTag;defaultSequenceTag;defaultMappingTag;exact;prefix;constructor(n){const t=ns(n),i=[],r=Zo(),l=es();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}lookupScalarTag(n){const t=this.exact.scalar[n];if(t)return t;for(const i of this.prefix.scalar)if(n.startsWith(i.tagName))return i}lookupSequenceTag(n){const t=this.exact.sequence[n];if(t)return t;for(const i of this.prefix.sequence)if(n.startsWith(i.tagName))return i}lookupMappingTag(n){const t=this.exact.mapping[n];if(t)return t;for(const i of this.prefix.mapping)if(n.startsWith(i.tagName))return i}resolveImplicitScalarTag(n){const t=this.implicitScalarByFirstChar.get(n.charAt(0))??this.implicitScalarAnyFirstChar;for(const r of t){const l=r.resolve(n,!1,r.tagName);if(l!==S)return{value:l,tag:r}}const i=this.defaultScalarTag;return{value:i.resolve(n,!1,i.tagName),tag:i}}withTags(...n){let t=[];for(const i of n)t=t.concat(i);return new wr([...this.tags,...t])}},Li=new Ct([Xl,Vo,Qo]);new Ct([...Li.tags,no,co,wo,Po]);var ts=new Ct([...Li.tags,eo,lo,br,kr]),is=new Ct([...Li.tags,io,ho,Xt,Zt,qo,jo,zo,Go,Jo,Xo]);is.withTags({...Xt,resolve:(e,n,t)=>{const i=Xt.resolve(e,n,t);return i===S?br.resolve(e,n,t):i}},{...Zt,resolve:(e,n,t)=>{const i=Zt.resolve(e,n,t);return i===S?kr.resolve(e,n,t):i}});wt("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||St(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 ya(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)}wt("tag:yaml.org,2002:map",{create:()=>({}),identify:St,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=ya(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=ya(n);return t!==null&&Object.prototype.hasOwnProperty.call(e,t)},keys:e=>Object.keys(e),get:(e,n)=>{const t=String(n);return Object.prototype.hasOwnProperty.call(e,t)?e[t]:null}});var as={maxLength:79,indent:1,linesBefore:3,linesAfter:2};function jt(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 Ut(e,n){return" ".repeat(Math.max(n-e.length,0))+e}function rs(e,n){if(!e.buffer)return null;const t={...as,...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=jt(e.buffer,r[s-f],l[s-f],e.position-(r[s]-r[s-f]),d);u=`${" ".repeat(t.indent)}${Ut((e.line-f+1).toString(),c)} | ${p.str}
|
|
9
|
+
${u}`}const g=jt(e.buffer,r[s],l[s],e.position,d);u+=`${" ".repeat(t.indent)}${Ut((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=jt(e.buffer,r[s+f],l[s+f],e.position-(r[s]-r[s+f]),d);u+=`${" ".repeat(t.indent)}${Ut((e.line+f+1).toString(),c)} | ${p.str}
|
|
12
|
+
`}return u.replace(/\n$/,"")}function ba(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 ke=class Sr extends Error{reason;mark;constructor(n,t){super(),this.name="YAMLException",this.reason=n,this.mark=t,this.message=ba(this,!1),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toString(n){return`${this.name}: ${ba(this,n)}`}static throwAt(n,t,i,r=""){let l=0,o=0;for(let u=0;u<t;u++){const c=n.charCodeAt(u);c===10?(l++,o=u+1):c===13&&(l++,n.charCodeAt(u+1)===10&&u++,o=u+1)}const s={name:r,buffer:n,position:t,line:l,column:t-o};throw s.snippet=rs(s),new Sr(i,s)}},R={DOCUMENT:1,SEQUENCE:2,MAPPING:3,SCALAR:4,ALIAS:5,POP:6},z={PLAIN:1,SINGLE_QUOTED:2,DOUBLE_QUOTED:3,LITERAL_BLOCK:4,FOLDED_BLOCK:5},Ke={BLOCK:1,FLOW:2},V={CLIP:1,STRIP:2,KEEP:3},ls=-1;function ka(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 Cr=new Array(256),Tr=new Array(256);for(let e=0;e<256;e++)Cr[e]=ka(e)?1:0,Tr[e]=ka(e);function os(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function ss(e){return e>=48&&e<=57?e-48:(e|32)-97+10}function cs(e){return e===120?2:e===117?4:8}function Qn(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 us(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=Qn(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 ds(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=Qn(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 fs(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=Qn(e,r,t).position;else if(u<256&&Cr[u])i+=Tr[u],r++;else{let c=cs(u),d=0;for(;c>0;c--){r++;const g=ss(e.charCodeAt(r));d=(d<<4)+g}i+=os(d),r++}l=o=r}else if(s===10||s===13){i+=e.slice(l,o);const u=Qn(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 wa(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===V.KEEP?c+=`
|
|
24
|
+
`.repeat(d?1+g:g):r!==V.STRIP&&d&&(c+=`
|
|
25
|
+
`),c}function hs(e,n){if(n.valueStart===ls)return"";const{valueStart:t,valueEnd:i}=n;if(n.fast)return e.slice(t,i);switch(n.style){case z.SINGLE_QUOTED:return ds(e,t,i);case z.DOUBLE_QUOTED:return fs(e,t,i);case z.LITERAL_BLOCK:return wa(e,t,i,n.indent,n.chomping,!1);case z.FOLDED_BLOCK:return wa(e,t,i,n.indent,n.chomping,!0);default:return us(e,t,i)}}var ps=Object.assign(Object.create(null),{"!":"!","!!":"tag:yaml.org,2002:"});function Ar(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]??ps[i]??i;return decodeURIComponent(r)+decodeURIComponent(e.slice(i.length))}var De=-1,vs="tag:yaml.org,2002:merge",Ri={filename:"",schema:ts,json:!1,maxTotalMergeKeys:1e4,maxAliases:-1};function gs(e){return"tagStart"in e&&e.tagStart!==De?e.tagStart:"anchorStart"in e&&e.anchorStart!==De?e.anchorStart:"valueStart"in e&&e.valueStart!==De?e.valueStart:"start"in e?e.start:0}function F(e,n){ke.throwAt(e.source,e.position,n,e.filename)}function Er(e,n,t,i){try{return t.finalize(i)}catch(r){if(r instanceof ke)throw r;ke.throwAt(e.source,n,r instanceof Error?r.message:String(r),e.filename)}}function _s(e,n){const t=hs(e.source,n),i=n.tagStart===De?"":e.source.slice(n.tagStart,n.tagEnd),r=e.schema.defaultScalarTag;if(i!==""){if(i==="!")return{value:t,tag:r};const l=Ar(i,e.tagHandlers),o=e.schema.lookupScalarTag(l);if(o){const u=o.resolve(t,!0,l);return u===S&&F(e,`cannot resolve a node with !<${l}> explicit tag`),{value:u,tag:o}}const s=e.schema.lookupMappingTag(l)??e.schema.lookupSequenceTag(l);if(s){t!==""&&F(e,`cannot resolve a node with !<${l}> explicit tag`);const u=s.create(l);return{value:s.carrierIsResult?u:Er(e,e.position,s,u),tag:s}}F(e,`unknown scalar tag !<${l}>`)}return n.style===z.PLAIN?e.schema.resolveImplicitScalarTag(t):{value:r.resolve(t,!1,r.tagName),tag:r}}function Sa(e,n,t){const i=n.tagStart===De?"":e.source.slice(n.tagStart,n.tagEnd);return i===""||i==="!"?t:Ar(i,e.tagHandlers)}function Nr(e){return e.nodeKind==="mapping"}function Ca(e,n,t,i){for(const r of i.keys(t)){if(e.maxTotalMergeKeys!==-1&&++e.totalMergeKeys>e.maxTotalMergeKeys&&F(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&&F(e,l),(n.overridable??=new Set).add(r)}}function ms(e,n,t,i){if(e.position=n.keyPosition,Nr(i))Ca(e,n,t,i);else if(i.nodeKind==="sequence"&&Array.isArray(t))for(const r of t){const l=e.nodeTags.get(r);l||F(e,"cannot merge mappings; the provided source object is unacceptable"),Ca(e,n,r,l)}else F(e,"cannot merge mappings; the provided source object is unacceptable")}function ys(e,n,t,i,r){if(e.position=n.keyPosition,n.keyIsMerge){ms(e,n,i,r);return}!e.json&&n.tag.has(n.value,t)&&!n.overridable?.has(t)&&F(e,"duplicated mapping key");const l=n.tag.addPair(n.value,t,i);l&&F(e,l),n.overridable?.delete(t)}function Bt(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"){Nr(t)&&e.nodeTags.set(n,t);const r=i.tag.addItem(i.value,n,i.index++);r&&F(e,r)}else if(i.hasKey){const r=i.key;i.key=void 0,i.hasKey=!1,ys(e,i,r,n,t)}else i.key=n,i.keyPosition=e.position,i.hasKey=!0,i.keyIsMerge=t.tagName===vs}function Wt(e,n,t,i,r){if(n.anchorStart!==De){const l={value:t,tag:i,isValueFinal:r};return e.anchors.set(e.source.slice(n.anchorStart,n.anchorEnd),l),l}return null}function bs(e,n){const t={...Ri,...n,events:e,documents:[],eventIndex:0,position:0,frames:[],anchors:new Map,nodeTags: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=gs(i),i.type){case R.DOCUMENT:t.anchors=new Map,t.nodeTags=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 R.SCALAR:{const{value:r,tag:l}=_s(t,i);Wt(t,i,r,l,!0),Bt(t,r,l);break}case R.SEQUENCE:{const r=Sa(t,i,"tag:yaml.org,2002:seq"),l=t.schema.lookupSequenceTag(r);l||F(t,`unknown sequence tag !<${r}>`);const o=l.create(r),s=Wt(t,i,o,l,l.carrierIsResult);t.frames.push({kind:"sequence",position:t.position,value:o,tag:l,anchor:s,index:0});break}case R.MAPPING:{const r=Sa(t,i,"tag:yaml.org,2002:map"),l=t.schema.lookupMappingTag(r);l||F(t,`unknown mapping tag !<${r}>`);const o=l.create(r),s=Wt(t,i,o,l,l.carrierIsResult);t.frames.push({kind:"mapping",position:t.position,value:o,tag:l,anchor:s,key:void 0,keyPosition:t.position,hasKey:!1,keyIsMerge:!1,overridable:null});break}case R.ALIAS:{t.maxAliases!==-1&&++t.aliasCount>t.maxAliases&&F(t,`aliases exceeded maxAliases (${t.maxAliases})`);const r=t.source.slice(i.anchorStart,i.anchorEnd),l=t.anchors.get(r);l||F(t,`unidentified alias "${r}"`),l.isValueFinal||F(t,`recursive alias "${r}" is not supported for tag ${l.tag.tagName} because it uses finalize()`),Bt(t,l.value,l.tag);break}case R.POP:{const r=t.frames.pop();if(r.kind==="mapping"&&r.hasKey&&(t.position=r.keyPosition,F(t,"incomplete mapping pair in event stream")),r.kind==="document")t.documents.push(r.value);else{const l=r.tag.carrierIsResult?r.value:Er(t,r.position,r.tag,r.value);r.anchor&&(r.anchor.value=l,r.anchor.isValueFinal=!0),Bt(t,l,r.tag)}break}}}return t.documents}var C=-1,xr=Object.prototype.hasOwnProperty,Ye=1,ei=2,Ir=3,Xn=4,ks=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,ws=/[,\[\]{}]/,Or=/^(?:!|!!|![0-9A-Za-z-]+!)$/,ni=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]])`,$r=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$.~*'()_])`,Ss=new RegExp(`^(?:${ni})*$`),Cs=new RegExp(`^(?:${$r})+$`),Ts=new RegExp(`^(?:!(?:${ni})*|${$r}(?:${ni})*)$`),Fi={filename:"",maxDepth:100};function As(e,n,t){e.events.push({type:R.DOCUMENT,explicitStart:n,explicitEnd:t,directives:e.directives})}function Lr(e,n,t,i,r,l,o){e.events.push({type:R.SEQUENCE,start:n,anchorStart:t,anchorEnd:i,tagStart:r,tagEnd:l,style:o})}function ti(e,n,t,i,r,l,o){e.events.push({type:R.MAPPING,start:n,anchorStart:t,anchorEnd:i,tagStart:r,tagEnd:l,style:o})}function Ta(e,n){e.events.splice(n.eventsLength,0,{type:R.MAPPING,start:n.position,anchorStart:C,anchorEnd:C,tagStart:C,tagEnd:C,style:Ke.FLOW})}function Qe(e,n,t,i,r,l,o,s,u=V.CLIP,c=-1,d=!1){e.events.push({type:R.SCALAR,valueStart:n,valueEnd:t,anchorStart:i,anchorEnd:r,tagStart:l,tagEnd:o,style:s,chomping:u,indent:c,fast:d})}function Es(e,n,t){e.events.push({type:R.ALIAS,anchorStart:n,anchorEnd:t})}function je(e){e.events.push({type:R.POP})}function D(e){Qe(e,C,C,C,C,C,C,z.PLAIN)}function Aa(){return{anchorStart:C,anchorEnd:C,tagStart:C,tagEnd:C}}function ln(e){return{position:e.position,line:e.line,lineStart:e.lineStart,lineIndent:e.lineIndent,firstTabInLine:e.firstTabInLine,eventsLength:e.events.length}}function Ue(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){ke.throwAt(e.input.slice(0,e.length),e.position,n,e.filename)}function $(e){return e===10||e===13}function we(e){return e===9||e===32}function Y(e){return we(e)||$(e)}function X(e){return e===0||Y(e)}function Se(e){return e===44||e===91||e===93||e===123||e===125}function Ns(e){return e>=48&&e<=57?e-48:-1}function xs(e){if(e>=48&&e<=57)return e-48;const n=e|32;return n>=97&&n<=102?n-97+10:-1}function Is(e){return e===120?2:e===117?4:e===85?8:0}function Os(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 Zn(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||Y(e.input.charCodeAt(e.position-1));for(;i!==0;){for(;we(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(!$(i)&&i!==0);if(!$(i))break;for(Zn(e),t++,r=!0,i=e.input.charCodeAt(e.position);i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position)}return t}function de(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||Y(i)}return!1}function Ea(e){let n=e.input.charCodeAt(e.position);for(;n!==0&&!$(n);)n=e.input.charCodeAt(++e.position)}function Pr(e,n,t){ks.test(e.input.slice(n,t))&&m(e,"the stream contains non-printable characters")}function $s(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&&!Y(s)&&!(t&&Se(s));)s===33&&(l?m(e,"tag suffix cannot contain exclamation marks"):(o=e.input.slice(u-1,e.position+1),Or.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),ws.test(c)&&m(e,"tag suffix cannot contain flow indicator characters")}return c&&!(r?Ss.test(c):Cs.test(c))&&m(e,`tag name cannot contain such characters: ${c}`),!r&&o!=="!"&&o!=="!!"&&!xr.call(e.tagHandlers,o)&&m(e,`undeclared tag handle "${o}"`),n.tagStart=i,n.tagEnd=e.position,!0}function Ls(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&&!Y(e.input.charCodeAt(e.position))&&!Se(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 Ps(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&&!Y(e.input.charCodeAt(e.position))&&!Se(e.input.charCodeAt(e.position));)e.position++;return e.position===t&&m(e,"name of an alias node must contain at least one character"),Es(e,t,e.position),!0}function ii(e,n){j(e,!1),e.lineIndent<n&&m(e,"deficient indentation")}function Rs(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,z.SINGLE_QUOTED,V.CLIP,-1,r),!0}$(l)?(r=!1,ii(e,n)):e.position===e.lineStart&&de(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 Fs(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,z.DOUBLE_QUOTED,V.CLIP,-1,r),!0}if(l===92){r=!1;const o=e.input.charCodeAt(++e.position);if($(o))ii(e,n);else if(Os(o))e.position++;else{let s=Is(o);for(s===0&&m(e,"unknown escape sequence");s-- >0;)e.position++,xs(e.input.charCodeAt(e.position))<0&&m(e,"expected hexadecimal character");e.position++}}else $(l)?(r=!1,ii(e,n)):e.position===e.lineStart&&de(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 Ms(e,n,t){const i=e.input.charCodeAt(e.position);let r=V.CLIP,l=-1,o=!1;if(i!==124&&i!==62)return!1;const s=i===124?z.LITERAL_BLOCK:z.FOLDED_BLOCK;for(e.position++;e.input.charCodeAt(e.position)!==0;){const p=e.input.charCodeAt(e.position),v=Ns(p);if(p===43||p===45)r!==V.CLIP&&m(e,"repeat of a chomping mode identifier"),r=p===43?V.KEEP:V.STRIP,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(;we(e.input.charCodeAt(e.position));)u=!0,e.position++;u&&e.input.charCodeAt(e.position)===35&&Ea(e),$(e.input.charCodeAt(e.position))?Zn(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&&de(e,p))break;if(!o&&c===-1&&$(_)&&(d=Math.max(d,v)),!o&&c===-1&&!$(_)&&(_===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&&!$(_)&&v<n){e.lineIndent=v,e.position=p+v;break}!o&&_!==0&&!$(_)&&c===-1&&(c=v);const k=c===-1?n+1:c;if(_!==0&&!$(_)&&v<k){e.lineIndent=v,e.position=p+v;break}Ea(e),f=e.position,$(e.input.charCodeAt(e.position))&&(Zn(e),f=e.position)}return Pr(e,g,f),Qe(e,g,f,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,s,r,c),!0}function Ds(e,n){const t=e.input.charCodeAt(e.position),i=n===Ye;if(t===0||Y(t)||t===35||t===38||t===42||t===33||t===124||t===62||t===39||t===34||t===37||t===64||t===96||i&&Se(t))return!1;if(t===63||t===45){const r=e.input.charCodeAt(e.position+1);if(X(r)||i&&Se(r))return!1}return!0}function js(e,n,t,i){if(!Ds(e,t))return!1;const r=e.position;let l=e.position,o=e.input.charCodeAt(e.position);const s=t===Ye;let u=!1;for(;o!==0&&!(e.position===e.lineStart&&de(e));){if(o===58){const c=e.input.charCodeAt(e.position+1);if(X(c)||s&&Se(c))break}else if(o===35){if(Y(e.input.charCodeAt(e.position-1)))break}else{if(s&&Se(o))break;if($(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}}we(o)||(l=e.position+1),o=e.input.charCodeAt(++e.position)}return l===r?!1:(Pr(e,r,l),Qe(e,r,l,i.anchorStart,i.anchorEnd,i.tagStart,i.tagEnd,z.PLAIN,V.CLIP,-1,!u),!0)}function en(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 Us(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?ti(e,l,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,Ke.FLOW):Lr(e,l,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,Ke.FLOW),e.position++;e.input.charCodeAt(e.position)!==0;){en(e,n);let u=e.input.charCodeAt(e.position);if(u===s)return e.position++,je(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&&Y(e.input.charCodeAt(e.position+1))&&(c=d=!0,e.position+=1,en(e,n));const g=e.line,f=ln(e),p=fe(e,n,Ye,!1,!0);en(e,n),u=e.input.charCodeAt(e.position),(r||d||e.line===g)&&u===58?(c=!0,e.position++,en(e,n),r||Ta(e,f),p||D(e),fe(e,n,Ye,!1,!0)||D(e),en(e,n),r||je(e)):r&&c?(p||D(e),D(e)):r?D(e):c&&(Ta(e,f),p||D(e),D(e),je(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 Na(e,n,t){if(e.firstTabInLine!==-1||e.input.charCodeAt(e.position)!==45||!X(e.input.charCodeAt(e.position+1)))return!1;for(Lr(e,e.position,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,Ke.BLOCK);e.input.charCodeAt(e.position)===45&&X(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&&X(e.input.charCodeAt(e.position+1))&&m(e,"bad indentation of a sequence entry"),r&&e.lineIndent<=n?D(e):fe(e,n,Ir,!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&&X(e.input.charCodeAt(e.position+1))&&m(e,"bad indentation of a sequence entry")}return je(e),!0}function zt(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)&&X(c))o||(ti(e,e.position,i.anchorStart,i.anchorEnd,i.tagStart,i.tagEnd,Ke.BLOCK),o=!0),u===63?(r&&D(e),l=!0,r=!0):(r||(D(e),l=!0),r=!1),e.position+=1,s=!0;else{r&&(D(e),r=!1);const g=ln(e);if(!fe(e,t,ei,!1,!0))break;if(e.line===d){for(u=e.input.charCodeAt(e.position);we(u);)u=e.input.charCodeAt(++e.position);if(u===58){if(u=e.input.charCodeAt(++e.position),X(u)||m(e,"a whitespace character is expected after the key-value separator within a block mapping"),!o){for(Ue(e,g),ti(e,g.position,i.anchorStart,i.anchorEnd,i.tagStart,i.tagEnd,Ke.BLOCK),o=!0,fe(e,t,ei,!1,!0),u=e.input.charCodeAt(e.position);we(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?(Ue(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?(Ue(e,g),!1):!0}if(fe(e,n,Xn,!0,s)&&(s=!1),r||s&&(D(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&&D(e),o&&je(e),!0):!1}function fe(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=Aa();let g=t===Xn||t===Ir,f=g;const p=g;if(i&&j(e,!0)&&(s=!0,e.lineIndent>n?o=1:e.lineIndent===n?o=0:o=-1),o===1)for(;;){const v=e.input.charCodeAt(e.position),_=ln(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=ln(e),w=n+1;if(zt(e,e.position-e.lineStart,w,d)&&e.events[k.eventsLength]?.type===R.MAPPING)return e.depth--,!0;Ue(e,k)}if(s&&(v===33&&d.tagStart!==C||v===38&&d.anchorStart!==C)||!$s(e,d,t===Ye)&&!Ls(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===Xn){const v=t===Ye||t===ei?n:n+1,_=e.position-e.lineStart;if(o===1)if(f&&(Na(e,_,d)||zt(e,_,v,d))||Us(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=ln(e),b=c.position-c.lineStart;Ue(e,c),zt(e,b,v,Aa())&&e.events[w.eventsLength]?.type===R.MAPPING?u=!0:Ue(e,w)}!u&&(g&&Ms(e,v,d)||Rs(e,v,d)||Fs(e,v,d)||Ps(e,d)||js(e,v,t,d))&&(u=!0)}else o===0&&(u=f&&Na(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,z.PLAIN),u=!0),e.depth--,u||d.anchorStart!==C||d.tagStart!==C}function Bs(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&&!Y(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&&!$(e.input.charCodeAt(e.position));){for(;we(e.input.charCodeAt(e.position));)e.position++;if(e.input.charCodeAt(e.position)===35||$(e.input.charCodeAt(e.position))||e.input.charCodeAt(e.position)===0)break;const r=e.position;for(;e.input.charCodeAt(e.position)!==0&&!Y(e.input.charCodeAt(e.position));)e.position++;i.push(e.input.slice(r,e.position))}if($(e.input.charCodeAt(e.position))&&Zn(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;Or.test(r)||m(e,"ill-formed tag handle (first argument) of the TAG directive"),xr.call(e.tagHandlers,r)&&m(e,`there is a previously declared suffix for "${r}" tag handle`),Ts.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 Ws(e){e.directives=[],e.tagHandlers=Object.create(null);let n=!1;for(j(e,!0);Bs(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&&X(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&&de(e)){e.position+=3,j(e,!0);return}if(As(e,t,!1),fe(e,e.lineIndent-1,Xn,!1,r,r)||D(e),j(e,!0),e.position===e.lineStart&&de(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===R.DOCUMENT&&(o.explicitEnd=i),je(e),!i&&e.position<e.length&&!(e.position===e.lineStart&&de(e))&&m(e,"end of the stream or a document separator is expected")}function zs(e,n){const t=e.length,i={...Fi,...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&&ke.throwAt(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;Ws(i),i.position===l&&m(i,"can not read a document")}return i.events}var Hs={...Fi,...Ri};function Ks(e,n={}){const t={...Hs,...n},i=String(e),r=Object.keys(Fi),l=Object.keys(Ri);return bs(zs(i,ma(t,r)),{...ma(t,l),source:i})}function Ys(e,n){const t=Ks(e,n);if(t.length===0)throw new ke("expected a document, but the input is empty");if(t.length===1)return t[0];throw new ke("expected a single document in the stream, but found more")}function qs(e){if(e.trim()==="")return{};const t=Ys(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"},Ia={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"]},Vs=[{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"]}],Oa=[{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","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 Rr(e={}){return e.extended===!0?[xa,Ia,...Vs,...Oa]:[xa,Ia,...Oa]}function Tt(e,n={}){const t=Rr(n),i=Math.max(0,Math.min(t.length-1,e));return t[i]}function Gs(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 Js(e,n){const t=new Set(n);return e.filter(i=>i!=="engineering-base"&&!t.has(i)).sort()}function Qs(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(W=>W.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 Xs({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 Zs({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(Xs,{current:n,total:t})]})}function ec(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 Fr(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 nc(e,n){return e.kind==="userMd"?n==="body"||n.startsWith("body."):Fr(e,n)}function tc(e,n){for(const t of Object.keys(n.errors))if(nc(e,t))return!0;return!1}function ic(e,n){if(tc(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=>Fr(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 ac(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(P,{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=ic(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 rc(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 lc(){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 oc(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 sc=[{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 cc({text:e}){const[n,t]=Ii(!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 uc({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:sc.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(cc,{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 Mr=h(!1),on=h(null),E=h(null),et=h(!1),nt=h(!1),Ce=h(0),Mi=h(null),K=h({}),Dr=h({}),jr=h(0),Be=h({}),O=h(null),he=h(null),Di=h(!1),ai=h(!1),At=h(!1),Ur=h({}),Et=h([]);h("global");const Pe=h(!1),U=h(!1),dc=h(!1),tt=h(!1),it=h(null),ji=h([]),at=h({}),rt=h(!0),lt=h(""),ot=h("agents");h(!1);const Br=h(null),fc=[{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"}],ri=h(!1),We=h(!1),pe=h(null),Nt=h([]),xt=h([]),Te=h([]),li=h(!1),Tn=h([]),ne=h({}),Wr=h(!1),oi=h(!1),Rn=h(!1),Ui=h({}),$a=h(!1),zr=h(null),Hr=h(null),Kr=h(null),Yr=h(null),si=h(null),qr=h(null),ci=h("https://github.com/rtk-ai/rtk"),ui=h(!1),Vr=h(null),hc=h(null),di=h(null),Gr=h("event4u-app/agent-switch"),Bi=h(!1);h(!1);h(null);h([]);h({});h({});const ie=h({}),oe=h({}),fi=h(!1),La=h(!1);h({});h(null);h(null);h(!1);h(null);const st=h(null),Jr=h(!1),hi=h(null),pi=h(!1),vi=h(!1),gi=h(null),ze=h(null),Fn=h(!1),Wi=h(!1);function Qr(){return Rr({extended:U.value})}function qe(){return Qr().length}function pc(e){return e??new Date().toISOString()}function zi(e){return Math.max(0,Math.min(qe()-1,e))}function vc(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 gc(){try{return await y("/api/v1/settings")}catch(e){if(e instanceof x&&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 _c(){try{const e=await y("/api/v1/install/recovery");st.value=e.incomplete?e:null}catch{st.value=null}}async function mc(){try{const e=await y("/api/v1/install/legacy-v3");hi.value=e.present?e:null}catch{hi.value=null}}async function yc(){vi.value=!0,gi.value=null;try{await y("/api/v1/install/backup-v3",{method:"POST"}),pi.value=!0}catch(e){gi.value=e instanceof x?H(e.body.error??{code:"UNKNOWN",message:e.message}):e instanceof Error?e.message:String(e)}finally{vi.value=!1}}async function Ht(e){try{await y("/api/v1/install/recovery/dismiss",{method:"POST",body:{reason:e}})}catch(n){E.value={message:n instanceof Error?n.message:String(n),tone:"error"};return}st.value=null,Jr.value=!0}async function bc(){on.value=null;try{_c(),mc();const[e,n]=await Promise.all([y("/api/v1/wizard/state"),gc()]);Mi.value=vc(n.schema),jr.value=n.lastModified,Dr.value=n.values,Ur.value=n.legacyHints??{},U.value=e.extendedSteps===!0,ze.value=e.wizardMode??null;const t=Object.keys(e.partial??{});K.value=t.length>0?{...n.values,...e.partial}:n.values,Ce.value=zi(e.step),Pe.value=!1,Mr.value=!0;const i=Tt(Ce.value,{extended:U.value});(i.kind==="welcome"||i.kind==="userMd"||i.kind==="review")&&Hi(),(i.kind==="roles"||i.kind==="aiTools"||i.kind==="packs")&&An(),i.kind==="roles"&&Ki(),i.kind==="aiTools"&&It(),i.id==="identity"&&(Xr(),Zr()),i.kind==="review"&&el()}catch(e){e instanceof x?on.value=H(e.body.error??{code:"UNKNOWN",message:e.message}):on.value=e instanceof Error?e.message:String(e)}}function kc(e,n){return e.identity.name.trim()!==""?e:{...e,identity:{...e.identity,name:n}}}async function Hi(){if(!ai.value)try{const e=await y("/api/v1/user-md");if(Di.value=e.exists,e.exists&&e.identity!==null){const n=ga(e.identity);he.value=n,O.value=n}else{let n;try{const i=await y("/api/v1/user-md/template");n=ga(qs(i.body))}catch{n=yr()}const t=Ur.value.user_name;typeof t=="string"&&t.trim()!==""&&(n=kc(n,t)),he.value=n,O.value=n}}catch(e){E.value={message:e instanceof Error?e.message:String(e),tone:"error"}}finally{ai.value=!0}}const wc=new Set(["python"]);async function An(){if(!(ri.value||We.value)){We.value=!0,pe.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}));Nt.value=t,Tn.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=>!wc.has(l));xt.value=r,Te.value=(e.installedPacks??[]).filter(l=>i.has(l))}catch(e){e instanceof x?pe.value=H(e.body.error??{code:"UNKNOWN",message:e.message}):pe.value=e instanceof Error?e.message:String(e)}finally{We.value=!1,ri.value=!0}}}async function It(){if(!(oi.value||Rn.value)){Rn.value=!0;try{const e=await y("/api/v1/wizard/detect-tools"),n=e.tools??{},t=e.configured??[];if(Ui.value=n,Object.keys(ie.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);ie.value=i}}catch{}finally{Rn.value=!1,oi.value=!0}}}async function Xr(){if(!$a.value){$a.value=!0;try{const e=await y("/api/v1/wizard/detect-rtk"),n=e.installed===!0;zr.value=n,Hr.value=e.present===!0,Kr.value=e.identity??null,Yr.value=e.version??null,si.value=e.installCommand??null,qr.value=e.installCommands??null,typeof e.repo=="string"&&(ci.value=e.repo);const t=K.value.personal??{};K.value={...K.value,personal:{...t,rtk_installed:n}}}catch{}}}async function Zr(){if(!ui.value){ui.value=!0;try{const e=await y("/api/v1/wizard/detect-agent-switch");Vr.value=e.installed===!0,hc.value=e.version??null,di.value=e.installCommand??null,typeof e.repo=="string"&&(Gr.value=e.repo),Bi.value=e.dismissed===!0}catch{}}}async function Sc(e,n){try{await y("/api/v1/wizard/state",{method:"POST",body:{step:e,totalSteps:qe(),partial:n,startedAt:pc(null)}})}catch(t){E.value={message:t instanceof Error?t.message:String(t),tone:"error"}}}async function el(){nt.value=!0;try{const e=await y("/api/v1/settings/diff",{method:"POST",body:{values:K.value,ifUnmodifiedSince:jr.value}});Et.value=e.changes,Be.value={}}catch(e){e instanceof x?(Be.value=kt(e.body.error??{message:e.message}),E.value={message:H(e.body.error??{code:"UNKNOWN",message:e.message}),tone:"error"}):E.value={message:e instanceof Error?e.message:String(e),tone:"error"}}finally{nt.value=!1}}function ct(){return At.value?!1:O.value===null||he.value===null?O.value!==he.value:JSON.stringify(O.value)!==JSON.stringify(he.value)}async function Re(e){const n=zi(e);await Sc(n,K.value),Ce.value=n,E.value=null;const t=Tt(n,{extended:U.value});(t.kind==="welcome"||t.kind==="userMd")&&Hi(),(t.kind==="roles"||t.kind==="aiTools"||t.kind==="packs")&&An(),t.kind==="roles"&&Ki(),t.kind==="packs"&&$t(),t.kind==="aiTools"&&It(),t.id==="identity"&&(Xr(),Zr()),t.kind==="review"&&el()}function Ot(){const e=oe.value,n=new Map(Nt.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 Ki(){if(await Promise.all([An(),Hi()]),Wr.value||Object.values(ne.value).some(Boolean))return;const e=O.value?.role??[];if(e.length===0)return;const n=new Set(Tn.value.map(i=>i.id)),t={};for(const i of e)n.has(i)&&(t[i]=!0);Object.keys(t).length!==0&&(ne.value=t,$t())}function $t(){if(fi.value)return;const e=Object.entries(ne.value).filter(([,r])=>r===!0).map(([r])=>r),n=new Map(Tn.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 Nt.value)r.cluster!==void 0&&i.set(r.id,r.cluster);oe.value=Gs({installed:Te.value,roleDefaults:t,detected:xt.value,clusterOf:i})}function Cc(){const e=Object.entries(ie.value).filter(([,i])=>i===!0).map(([i])=>i);if(e.length===0)return null;const n=Ot(),t={schema_version:"wizard-v2",tools:e,packs:n,settings:K.value};return be.value?.dryRun===!0&&(t.dry_run=!0),t}async function Tc(){et.value=!0,E.value=null;try{const e={settings:K.value},n=Object.entries(ne.value).filter(([,u])=>u===!0).map(([u])=>u),t=O.value!==null&&typeof O.value.identity?.name=="string"&&O.value.identity.name.trim().length>0;O.value!==null&&t&&(ct()||n.length>0)&&(e.identity=n.length>0?{...O.value,role:n}:O.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=U.value?Cc():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 x?H(u.body.error??{code:"UNKNOWN",message:u.message}):u instanceof Error?u.message:String(u)}.`}else if(o!==null)try{let u=null;await Rl("/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 x?H(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.`}E.value={message:`${l}${s} ${r}`,tone:"success"},Ce.value=zi(qe()-1),Dr.value=K.value,he.value=ct()?O.value:he.value,Et.value=[],Pe.value=!0}catch(e){e instanceof x?(Be.value=kt(e.body.error??{message:e.message}),E.value={message:H(e.body.error??{code:"UNKNOWN",message:e.message}),tone:"error"}):E.value={message:e instanceof Error?e.message:String(e),tone:"error"}}finally{et.value=!1}}async function Ac(){Wi.value=!0,await Promise.all([An(),It()]),await Ki(),$t(),await Re(qe()-1)}function Ec(){ae(()=>{An(),It()},[]);const e=We.value||Rn.value||!ri.value||!oi.value,n=Object.values(Ui.value).filter(Boolean).length,t=Te.value.length,i=xt.value.filter(r=>!Te.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:()=>{Ac()},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:()=>{Wi.value=!0},children:"Customize step by step"})]})]})}const Nc=["de","en","en-US","en-GB","fr","es","it","nl","pt","pt-BR"];function xc(){if(La.value)return;const e=O.value;if(e===null)return;La.value=!0;let n=e;if(e.identity.name.trim()===""){const t=be.value?.systemUser;t!==void 0&&t.trim()!==""&&(n={...n,identity:{...n.identity,name:t}})}if(!Di.value&&typeof navigator<"u"){const t=(navigator.language||"").split("-")[0];t.length>=2&&(n={...n,language:t})}n!==e&&(O.value=n)}function Ic(){const e=O.value;if(ae(()=>{xc()},[e]),e===null)return a("p",{children:"Loading…"});const n=t=>{O.value={...t,last_updated:new Date().toISOString().slice(0,10)},At.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:Nc.map(t=>a("option",{value:t},t))})]})]})}function Oc(){const e=ie.value,n=Ui.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:fc.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;ie.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 $c(){if(We.value)return a("p",{children:"Loading roles…"});if(pe.value!==null)return a("div",{class:"ac-wizard-step-stub",children:a("p",{class:"ac-banner ac-banner--error",children:["Discovery failed: ",pe.value]})});const e=ne.value,n=Tn.value,t=(i,r)=>{Wr.value=!0,ne.value={...ne.value,[i]:r},$t()};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 Lc(){if(We.value)return a("p",{children:"Loading discovery manifest…"});if(pe.value!==null)return a("div",{class:"ac-wizard-step-stub",children:[a("p",{class:"ac-banner ac-banner--error",children:["Discovery failed: ",pe.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=oe.value,n=new Set(xt.value),t=new Set(Te.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(Tn.value.map(p=>[p.id,p.label])),l=ne.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=Nt.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)=>{fi.value=!0,oe.value={...oe.value,[p]:v}},f=(p,v)=>{fi.value=!0;const _={...oe.value,[p]:v};if(v)for(const k of u.get(p)??[])_[k.id]===void 0&&(_[k.id]=!0);oe.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 Pc(){const e=zr.value,n=Hr.value,t=Kr.value,i=Yr.value,r=qr.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:`${ci.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(P,{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(P,{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]}):si.value!==null?a("code",{class:"ac-rtk-row__cmd",children:si.value}):null,a("a",{class:"ac-button",href:ci.value,target:"_blank",rel:"noreferrer noopener",children:"Open rtk repo"})]}):null]})}async function Rc(){try{await y("/api/v1/wizard/dismiss-recommendation",{method:"POST",body:{id:"agent-switch"}})}catch(e){E.value={message:e instanceof Error?e.message:String(e),tone:"error"};return}Bi.value=!0}function Fc(){return!ui.value||Vr.value!==!1||Bi.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."]}),di.value!==null?a("code",{class:"ac-rtk-row__cmd",children:di.value}):null,a("a",{class:"ac-button",href:`https://github.com/${Gr.value}`,target:"_blank",rel:"noreferrer noopener",children:"Open agent-switch repo"}),a("button",{type:"button",class:"ac-button ac-button--small",onClick:()=>{Rc()},children:"Don't show again"})]})]})}function Mc(){const e=Tt(Ce.value,{extended:U.value});if(U.value&&ze.value==="install"&&e.id==="identity"&&!Fn.value)return a(lc,{});if(e.kind==="form"){const t=Qs(Mi.value,e.paths??[]);return a(P,{children:[e.id==="identity"?a(Pc,{}):null,e.id==="identity"?a(Fc,{}):null,a(Hl,{schema:t,values:K.value,errors:Be.value,onChange:i=>{K.value=i}})]})}return e.kind==="userMd"?!ai.value||O.value===null?a("p",{children:"Loading .agent-user.yml…"}):a(Vl,{value:O.value,errors:Be.value,hideRole:U.value&&ze.value==="install",hideIdentityBasics:U.value&&ze.value==="install",onChange:t=>{O.value=t,At.value=!1}}):e.kind==="welcome"?a(Ic,{}):e.kind==="aiTools"?a(Oc,{}):e.kind==="roles"?a($c,{}):e.kind==="packs"?a(Lc,{}):a(ac,{steps:Qr(),currentIndex:Ce.value,changes:Et.value,errors:Be.value,userMdChanged:ct(),userMdAction:Di.value?"replace":"create",loading:nt.value,onJump:t=>{Re(t)},selectedToolsCount:Object.values(ie.value).filter(Boolean).length,selectedPacksCount:Object.values(oe.value).filter(Boolean).length,packRemovals:_i(),removalsConfirmed:li.value,onConfirmRemovals:t=>{li.value=t},selectedToolIds:Object.entries(ie.value).filter(([,t])=>t).map(([t])=>t),packAdditions:U.value?Ot().filter(t=>t!=="engineering-base"&&!Te.value.includes(t)):[]})}function _i(){return U.value?Js(Te.value,Ot()):[]}function Pa({path:e}){if(ae(()=>{bc()},[]),!Mr.value||Mi.value===null)return a("div",{class:"ac-page",children:[a("h1",{children:"Setup wizard"}),on.value!==null?a("p",{class:"ac-banner ac-banner--error",children:on.value}):a("p",{children:"Loading…"})]});const n=Ce.value,t=qe(),i=Tt(n,{extended:U.value}),r=n===t-1,l=i.kind==="aiTools"&&Object.values(ie.value).filter(Boolean).length===0||i.kind==="roles"&&Object.values(ne.value).filter(Boolean).length===0||i.kind==="packs"&&Ot().length===0,o=U.value&&ze.value==="install"&&i.id==="identity"&&!Fn.value,s=st.value,u=s!==null&&!Jr.value,c=hi.value,d=c!==null&&c.present&&!pi.value,g=U.value&&ze.value==="install"&&n===0&&!Wi.value&&!Pe.value;return d?a("div",{class:"ac-page",children:a(oc,{sourcePath:c.path,backupTarget:c.backupTarget,version:c.version,busy:vi.value,error:gi.value,onBackupAndProceed:()=>{yc()},onAbort:()=>{E.value={tone:"info",message:"Aborted. Uninstall v3 manually, then re-run `agent-config install`."},pi.value=!0}})}):g?a("div",{class:"ac-page",children:[a("header",{class:"ac-page__header",children:a("h1",{children:"Set up agent-config"})}),E.value!==null?a("p",{class:`ac-banner${E.value.tone==="error"?" ac-banner--error":""}`,children:E.value.message}):null,a(Ec,{})]}):a("div",{class:"ac-page",children:[a(Zs,{step:i,index:n,total:t}),u?a(rc,{abortedAt:s.abortedAt,abortNote:s.abortNote,writesSinceRollback:s.writesSinceRollback,busy:et.value,onResume:()=>{Ht("resume")},onRollback:()=>{Ht("rollback")},onIgnore:()=>{Ht("ignore")}}):null,E.value!==null&&!(Pe.value&&r&&E.value.tone==="success")?a("p",{class:`ac-banner${E.value.tone==="error"?" ac-banner--error":""}`,children:E.value.message}):null,a("div",{class:"ac-wizard__step",children:Pe.value&&r?a(uc,{message:E.value?.tone==="success"?E.value.message:null}):a(Mc,{})}),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(ec,{canGoPrev:n>0,canGoNext:!r&&!l,canSkip:o||i.kind==="userMd",skipLabel:o?"Finish install here":"Skip",isLast:r,busy:et.value||nt.value,canFinish:(Et.value.length>0||ct()||_i().length>0||U.value&&Object.values(ie.value).some(Boolean))&&(_i().length===0||li.value),completed:Pe.value,onPrev:()=>{Re(n-1)},onNext:()=>{if(o){Fn.value=!0;return}Re(n+1)},onSkip:()=>{if(o){Fn.value=!0,Re(qe()-1);return}At.value=!0,Re(n+1)},onFinish:()=>{Tc()}})]})}const Dc=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","memory.review_threshold","memory.redact_patterns","memory.cadence","chat_history.enabled","update_check.enabled","legal_review_prep.acknowledged"]);function Ra(e){return Dc.has(e)}function jc(e,n){return JSON.stringify(e??null)===JSON.stringify(n??null)}function nl(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||jc(n,e.old?.default)?"adopt":"review":e.kind==="added"&&e.new?.default===void 0?"must_fix":"info"}const mi=h(!0),ut=h(null),yi=h(!1),Lt=h(null),Ve=h({}),bi=h(0),Ae=h({}),se=h(null),te=h(!1),vn=h(!1);function ve(e){return`${e.key}:${e.kind}`}async function Uc(){mi.value=!0,ut.value=null,yi.value=!1,vn.value=!1;try{const e=await y("/api/v1/settings/changes"),n=await y("/api/v1/settings");Lt.value=e.delta,Ve.value=n.values,bi.value=n.lastModified,Bc(e.delta,n.values)}catch(e){e instanceof x&&e.status===404?yi.value=!0:ut.value=e instanceof Error?e.message:String(e)}finally{mi.value=!1}}function Bc(e,n){const t={};for(const i of e.changes){const r=nl(i,Cn(n,i.key.split(".")));r==="adopt"?t[ve(i)]={mode:"adopt"}:r==="review"?t[ve(i)]={mode:"keep"}:r==="must_fix"&&(t[ve(i)]={mode:null})}Ae.value=t}function Yi(e){return nl(e,Cn(Ve.value,e.key.split(".")))}function sn(e,n){Ae.value={...Ae.value,[e]:n}}function qi(){const e=Lt.value;return e===null?[]:e.changes.filter(n=>{if(Yi(n)!=="must_fix")return!1;const t=Ae.value[ve(n)];return t===void 0||t.mode===null||t.mode==="custom"&&(t.value===void 0||t.value==="")})}function Wc(){const e=Lt.value;let n=Ve.value;if(e===null)return n;for(const t of e.changes){const i=Ae.value[ve(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=pn(n,r,t.new.default):i.mode==="custom"&&i.value!==void 0&&(n=pn(n,r,i.value))}return n}async function zc(){if(te.value)return;const e=qi();if(e.length>0){se.value=`Resolve the ${e.length} “Must fix” item${e.length===1?"":"s"} first.`;return}te.value=!0,se.value=null;try{const n=Wc();if(JSON.stringify(n)!==JSON.stringify(Ve.value)){const t=await y("/api/v1/settings",{method:"PUT",headers:{"If-Unmodified-Since":String(bi.value)},body:{values:n}});Ve.value=n,bi.value=t.lastModified}await y("/api/v1/settings/changes/ack",{method:"POST"}),vn.value=!0}catch(n){n instanceof x?se.value=H(n.body.error??{code:"UNKNOWN",message:n.message}):se.value=n instanceof Error?n.message:String(n)}finally{te.value=!1}}async function Hc(){if(te.value)return;if(qi().length>0){se.value="Cannot dismiss — “Must fix” items would leave invalid values in place.";return}te.value=!0;try{await y("/api/v1/settings/changes/ack",{method:"POST"}),vn.value=!0}catch(n){se.value=n instanceof Error?n.message:String(n)}finally{te.value=!1}}function re(e){return e===void 0?"—":typeof e=="string"?e:JSON.stringify(e)}function Kt({change:e,id:n}){const t=e.new,r=Ae.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;sn(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=>{sn(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;sn(n,{mode:"custom",value:s})}})}function Kc({change:e}){const n=Yi(e),t=ve(e),i=Ae.value[t],r=Cn(Ve.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(P,{children:[a("p",{class:"ac-change-card__detail",children:["Default changed: ",a("code",{children:re(e.old?.default)})," → ",a("code",{children:re(e.new?.default)}),n==="review"?a(P,{children:[" · your value: ",a("code",{children:re(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:()=>{sn(t,{mode:"adopt"})}}),a("span",{children:["Adopt new default (",a("code",{children:re(e.new?.default)}),")"]})]}),a("label",{class:"ac-change-card__choice",children:[a("input",{type:"radio",name:t,checked:i?.mode==="keep",onChange:()=>{sn(t,{mode:"keep"})}}),a("span",{children:["Keep current (",a("code",{children:re(r??e.old?.default)}),")"]})]})]})]}):null,e.kind==="enum_removed"?n==="must_fix"?a(P,{children:[a("p",{class:"ac-change-card__detail",children:["Your value ",a("code",{children:re(r)})," is no longer valid — removed option",(e.values?.length??0)===1?"":"s",": ",a("code",{children:(e.values??[]).join(", ")}),". Pick a replacement:"]}),a(Kt,{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:re(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(P,{children:[a("p",{class:"ac-change-card__detail",children:"New setting without a shipped default — define a value:"}),a(Kt,{change:e,id:t})]}):a("p",{class:"ac-change-card__detail",children:["New setting · default: ",a("code",{children:re(e.new?.default)}),e.new?.enum!==void 0?a(P,{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(P,{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(Kt,{change:e,id:t})]}):null]})}function Yc(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 qc(){if(ae(()=>{Uc()},[]),mi.value)return a("div",{class:"ac-page",children:[a("h1",{children:"Settings changes"}),a("p",{children:"Loading…"})]});if(ut.value!==null)return a("div",{class:"ac-page",children:[a("h1",{children:"Settings changes"}),a("p",{class:"ac-banner ac-banner--error",children:ut.value})]});if(vn.value||yi.value)return a("div",{class:"ac-page ac-settings-changes",children:[a("h1",{children:"Settings changes"}),a("p",{class:"ac-banner",children:vn.value?"Review complete — all changes resolved.":"Nothing to review — your settings are up to date."}),a("button",{type:"button",class:"ac-button",onClick:()=>bt("/settings"),children:"Back to Settings"})]});const e=Lt.value;if(e===null)return a("div",{class:"ac-page",children:a("h1",{children:"Settings changes"})});const n=Yc(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."]})]}),se.value!==null?a("p",{class:"ac-banner ac-banner--error",role:"alert",children:se.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(Kc,{change:r},ve(r)))})]},i.title)),a("div",{class:"ac-form__actions",children:[a("button",{type:"button",class:"ac-button",disabled:te.value,onClick:()=>{Hc()},children:"Dismiss (keep everything)"}),a("button",{type:"button",class:"ac-button ac-button--primary",disabled:te.value||t>0,title:t>0?`${t} “Must fix” item${t===1?"":"s"} unresolved`:void 0,onClick:()=>{zc()},children:te.value?"Saving…":"Apply & finish review"})]})]})}const $e=h(null);function Vc(){return ae(()=>{(async()=>{try{const e=await y("/api/v1/settings/changes");$e.value=e.delta.changes.length}catch{$e.value=null}})()},[]),$e.value===null||$e.value===0?null:a("div",{class:"ac-banner ac-banner--pending",role:"status",children:[a("span",{children:["An upgrade changed ",$e.value," setting",$e.value===1?"":"s"," — review recommended."]}),a("button",{type:"button",class:"ac-button ac-button--small",onClick:()=>bt("/settings/changes"),children:"Review changes"})]})}const ki=h(!1),dt=h(null),G=h({}),ft=h(null),gn=h(0),_n=h({}),Z=h(null),Ee=h(!1),ge=h(null),mn=h(null),Mn=h(""),Le=h(!1),Dn=h({}),jn=h({global:new Set,project:new Set});function Fa(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 Ma(){dt.value=null;try{const e=await y("/api/v1/settings");G.value=e.values,ft.value=Fa(e.schema),gn.value=e.lastModified,jn.value={global:new Set(e.sources?.global??[]),project:new Set(e.sources?.project??[])},ki.value=!0}catch(e){if(e instanceof x&&e.status===404&&e.body.error?.code==="NOT_FOUND"){const n=e.body;if(n.defaults!==void 0&&n.schema!==void 0){G.value=n.defaults,ft.value=Fa(n.schema),gn.value=n.lastModified??0,ki.value=!0;return}}dt.value=e instanceof Error?e.message:String(e)}}async function Gc(){if(!Ee.value){Z.value=null,_n.value={};try{const e=await y("/api/v1/settings/diff",{method:"POST",body:{values:G.value,ifUnmodifiedSince:gn.value}});if(e.changes.length===0){Z.value="No changes to save.";return}ge.value=e.changes}catch(e){e instanceof x?(_n.value=kt(e.body.error??{message:e.message}),Z.value=H(e.body.error??{code:"UNKNOWN",message:e.message})):Z.value=e instanceof Error?e.message:String(e)}}}async function tl(e=!1){Ee.value=!0;try{const n=await y("/api/v1/settings",{method:"PUT",headers:{"If-Unmodified-Since":String(gn.value)},body:e?{values:G.value,confirmSharedWrite:!0}:{values:G.value}});gn.value=n.lastModified,ge.value=null,mn.value=null,Z.value=`Saved (${n.writtenPaths.join(", ")}).`}catch(n){if(n instanceof x){const t=n.body;if(n.status===409&&t.error==="shared-write"){ge.value=null,mn.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};_n.value=kt(i),Z.value=H(i),ge.value=null;const r=Object.keys(_n.value)[0];r!==void 0&&queueMicrotask(()=>{const l=document.getElementById(r);l!==null&&l.focus()})}else Z.value=n instanceof Error?n.message:String(n)}finally{Ee.value=!1}}function Vi(e){if(e.defaultValue===void 0)return!1;const n=Cn(G.value,e.path);return n===void 0?!1:JSON.stringify(n)!==JSON.stringify(e.defaultValue)}function Jc(e,n){const t=Vi(n),i=jn.value.project.has(e)?"project":jn.value.global.has(e)&&jn.value.project.size>0?"global":void 0;return{modified:t,onReset:t&&n.defaultValue!==void 0?()=>{G.value=pn(G.value,n.path,n.defaultValue)}:void 0,sourceLabel:i}}function Qc(e,n){const t=n.toLowerCase();return e.path.join(".").toLowerCase().includes(t)||e.label.toLowerCase().includes(t)||(e.description??"").toLowerCase().includes(t)}function Xc(e){const n=Mn.value.trim(),t=Le.value,i=e.path.join("."),r=Dn.value[i]===!0;let l=e.fields.filter(c=>c.kind!=="unsupported");if(n!==""&&(l=l.filter(c=>Qc(c,n))),t&&(l=l.filter(c=>Vi(c))),n!==""||t)return l.length===0?null:{section:e,visible:l,hiddenAdvancedCount:0,expanded:r};const o=l.filter(c=>Ra(c.path.join("."))),s=l.filter(c=>!Ra(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 Zc(e){Dn.value={...Dn.value,[e]:Dn.value[e]!==!0}}function eu(){const e=be.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 nu({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:()=>{mn.value=null},children:"Cancel"}),a("button",{type:"button",class:"ac-button ac-button--primary",disabled:Ee.value,onClick:()=>{tl(!0)},children:Ee.value?"Writing…":"Write (affects all profiles)"})]})]})})}function tu({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:()=>{ge.value=null},children:"Cancel"}),a("button",{type:"button",class:"ac-button ac-button--primary",disabled:Ee.value,onClick:()=>{tl()},children:Ee.value?"Saving…":"Save"})]})]})})}function iu(){if(ae(()=>{Ma()},[]),!ki.value||ft.value===null)return a("div",{class:"ac-page",children:[a("h1",{children:"Settings"}),dt.value!==null?a("p",{class:"ac-banner ac-banner--error",children:dt.value}):a("p",{children:"Loading…"})]});const e=_r(ft.value),n=e.map(Xc).filter(r=>r!==null),t=e.flatMap(r=>r.fields).filter(r=>Vi(r)).length,i=Mn.value.trim()!==""||Le.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(Vc,{}),a(eu,{}),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:Mn.value,onInput:r=>{Mn.value=r.currentTarget.value}}),a("button",{type:"button",class:`ac-chip-toggle${Le.value?" ac-chip-toggle--active":""}`,"aria-pressed":Le.value,onClick:()=>{Le.value=!Le.value},children:["@modified",t>0?` (${t})`:""]})]}),Z.value!==null?a("p",{class:"ac-banner",children:Z.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(mr,{section:{...r.section,fields:r.visible},values:G.value,errors:_n.value,onChange:o=>{G.value=o},decorate:Jc,footer:!i&&(r.hiddenAdvancedCount>0||r.expanded)?a("button",{type:"button",class:"ac-settings-hub__disclosure","aria-expanded":r.expanded,onClick:()=>{Zc(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:()=>{Ma()},children:"Reload"}),a("button",{type:"button",class:"ac-button ac-button--primary",onClick:()=>{Gc()},children:"Preview & Save"})]})]}),ge.value!==null?a(tu,{changes:ge.value}):null,mn.value!==null?a(nu,{block:mn.value}):null]})}const ht=h(!1),He=h(null);async function au(){tt.value=!0,it.value=null;try{const e=await y("/api/v1/modules/detect");ji.value=e.candidates,Br.value=e.project_root;const n={};for(const t of e.candidates)n[t.path]=!0;at.value=n,rt.value=e.proposed_block.enabled,lt.value=e.proposed_block.namespace_template??"",ot.value=e.proposed_block.agent_folder??"agents"}catch(e){it.value=e instanceof x?H(e.body.error??{code:"UNKNOWN",message:e.message}):e instanceof Error?e.message:String(e)}finally{tt.value=!1,dc.value=!0}}function ru(){const e=new Set(ji.value.map(i=>i.path)),n=at.value,t=Object.keys(n).filter(i=>n[i]===!0&&e.has(i));return{enabled:rt.value,root_paths:t,namespace_template:lt.value,agent_folder:ot.value||"agents"}}async function lu(){ht.value=!0,He.value=null;try{const e=await y("/api/v1/modules/apply",{method:"POST",body:ru()});He.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 x?H(e.body.error??{code:"UNKNOWN",message:e.message}):e instanceof Error?e.message:String(e);He.value={message:`Could not save project settings: ${n}`,tone:"error"}}finally{ht.value=!1}}function ou(){if(tt.value)return a("p",{children:"Detecting module roots…"});if(it.value!==null)return a("p",{class:"ac-banner ac-banner--error",children:["Module detection failed: ",it.value]});const e=ji.value,n=at.value,t=Br.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:rt.value,onChange:i=>{rt.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;at.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:lt.value,placeholder:"e.g. App\\\\Modules\\\\{ModuleName}\\\\App",onInput:i=>{lt.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:ot.value,placeholder:"agents",onInput:i=>{ot.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 su(){return ae(()=>{au()},[]),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."]})]}),He.value!==null?a("p",{class:`ac-banner ac-banner--${He.value.tone==="success"?"success":"error"}`,children:He.value.message}):null,a("section",{class:"ac-section",children:[a("h2",{class:"ac-section__title",children:"Modules"}),a(ou,{})]}),a("div",{class:"ac-form__actions ac-wizard__nav",children:a("button",{type:"button",class:"ac-button ac-button--primary",disabled:ht.value||tt.value,onClick:()=>{lu()},children:ht.value?"Saving…":"Save project settings"})})]})}const Un=h([]),yn=h([]),wi=h([]),Si=h([]),pt=h(null),il=h(!1),cn=h(null),B=h(null),Yt=h("plain"),vt=h({}),al=h([]),Da={"claude-code":"Claude Code",codex:"Codex",gemini:"Gemini"};function cu(){try{return globalThis.sessionStorage?.getItem("ac-workspace-host")??"claude-code"}catch{return"claude-code"}}const Gi=h(cu());function uu(e){Gi.value=e;try{globalThis.sessionStorage?.setItem("ac-workspace-host",e)}catch{}}const bn=h([]),J=h(null),Fe=h({}),_e=h(!1),kn=h(null),ue=h(""),un=h(!1),Pt=h(!1),Ci=h(null),me=h(null),wn=h([]),Bn=h(new Set),rl="claude-code",ja=2e3;async function du(){cn.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:[]}))]);Un.value=e.roles,yn.value=n.sessions,wi.value=t.chunks,Si.value=i.documents,vt.value=r.health??{},al.value=l.hosts??[],il.value=!0}catch(e){e instanceof x?cn.value=e.body?.error?.message??e.message:cn.value=e instanceof Error?e.message:String(e)}}async function fu(e,n){try{const t=await y(`/api/v1/workspace/roles/${e}/tasks`);bn.value=t.tasks}catch{bn.value=n}}async function Ji(e){me.value=e,Bn.value=new Set;try{const n=await y(`/api/v1/workspace/sessions/${e}`);wn.value=Array.isArray(n.log)?n.log:[]}catch{wn.value=[]}}async function hu(e){B.value=null,Pt.value=!1,ue.value="",J.value=null,await Ji(e)}async function ll(e,n,t){B.value=null,_e.value=!0,ue.value="",Pt.value=!1,Ci.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:Gi.value}});kn.value=i,B.value=ol(i),J.value=null,await Ji(i.id);const r=await y("/api/v1/workspace/sessions?limit=20");yn.value=r.sessions,await Qi()}catch(i){kn.value=null,i instanceof x?B.value=i.body?.error?.message??i.message:B.value=i instanceof Error?i.message:String(i)}finally{_e.value=!1}}async function pu(e,n){if(!(n.trim()===""||un.value)){un.value=!0,B.value=null;try{const t=await y(`/api/v1/workspace/sessions/${e}/continue`,{method:"POST",body:{prompt:n}});kn.value=t,B.value=ol(t),t.driven&&(ue.value=""),await Ji(e);const i=await y("/api/v1/workspace/sessions?limit=20");yn.value=i.sessions,await Qi()}catch(t){t instanceof x&&t.status===410?(Pt.value=!0,B.value="Host session expired — start a new conversation."):t instanceof x?B.value=t.body?.error?.message??t.message:B.value=t instanceof Error?t.message:String(t)}finally{un.value=!1}}}async function Qi(){try{const e=await y("/api/v1/workspace/drive-health");vt.value=e.health??{}}catch{}}async function vu(e){try{await y(`/api/v1/workspace/drive-health/${e}/reset`,{method:"POST"}),await Qi()}catch{}}function ol(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 ${rl} 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 gu({role:e}){const n=pt.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:()=>{pt.value=e.slug,B.value=null,kn.value=null,J.value=null,Fe.value={},bn.value=e.first_tasks,fu(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 _u({role:e,task:n}){const t=n.inputs??[],i=Fe.value,r=t.some(l=>l.required&&(i[l.name]??"").trim()==="");return a("form",{class:"ac-workspace__task-form",onSubmit:l=>{l.preventDefault(),!r&&!_e.value&&ll(e,n.name,Fe.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=>{Fe.value={...Fe.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||_e.value,children:_e.value?"Running…":"Run task"}),a("button",{type:"button",class:"ac-button",onClick:()=>{J.value=null},children:"Cancel"})]})]})}function mu(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:rl} · 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 yu(){if(me.value===null)return null;const e=mu(wn.value),n=wn.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>ja,l=Bn.value.has(i),o=r&&!l?`${t.text.slice(0,ja)}…`: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(Bn.value);s.has(i)?s.delete(i):s.add(i),Bn.value=s},children:l?"Show less":"Show full"}):null,t.meta!=null?a("p",{class:"ac-workspace__turn-meta",children:t.meta}):null]},i)})}),Pt.value?a("div",{class:"ac-workspace__followup-gone",role:"status",children:[a("p",{children:"Host session expired."}),Ci.value!==null?a("button",{type:"button",class:"ac-button ac-button--primary",disabled:_e.value,onClick:()=>{const t=Ci.value;t!==null&&ll(t.role,t.task,t.inputs)},children:_e.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(),me.value!==null&&pu(me.value,ue.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:ue.value,onInput:t=>{ue.value=t.target.value}})]}),a("button",{type:"submit",class:"ac-button ac-button--primary",disabled:ue.value.trim()===""||un.value,children:un.value?"Continuing…":"Send follow-up"})]}):null]})}function bu({role:e}){const n=bn.value.length>0?bn.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":J.value===t.name,onClick:()=>{J.value=J.value===t.name?null:t.name,Fe.value={},kn.value=null,me.value=null,wn.value=[]},children:J.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,J.value===t.name?a(_u,{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 ku(){return a("section",{class:"ac-workspace__sessions","aria-labelledby":"sessions-heading",children:[a("h2",{id:"sessions-heading",class:"ac-workspace__heading",children:"Recent sessions"}),yn.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:yn.value.map(e=>a("li",{class:"ac-workspace__session",children:a("button",{type:"button",class:`ac-workspace__session-open${me.value===e.id?" ac-workspace__session-open--active":""}`,"aria-label":`Open session ${e.task}`,"aria-current":me.value===e.id?"true":void 0,onClick:()=>{hu(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 wu(){return a("section",{class:"ac-workspace__knowledge","aria-labelledby":"knowledge-heading",children:[a("h2",{id:"knowledge-heading",class:"ac-workspace__heading",children:"Knowledge sources"}),wi.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:wi.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 Su(){return a("section",{class:"ac-workspace__recent","aria-labelledby":"recent-heading",children:[a("h2",{id:"recent-heading",class:"ac-workspace__heading",children:"Recent documents"}),Si.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:Si.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 Cu(){const n=Object.values(vt.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(vt.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:()=>{vu(t)},children:"Reset"}):null]},t)})})]})}function Tu(){const e=Yt.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:()=>{Yt.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:()=>{Yt.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 Au(){const e=al.value,n=e.length>0?e.map(i=>i.id):Object.keys(Da),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:Gi.value,onChange:i=>{uu(i.target.value)},children:n.map(i=>{const r=t.get(i)!==!1,l=Da[i]??i;return a("option",{value:i,disabled:!r,children:[l," (",i,")",r?"":" — not installed"]},i)})})]})}function Eu(){if(ae(()=>{du()},[]),cn.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:cn.value})]});if(!il.value)return a("div",{class:"ac-page",children:[a("h1",{children:"Workspace"}),a("p",{children:"Loading…"})]});const e=pt.value!==null?Un.value.find(n=>n.slug===pt.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(Au,{})]}),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"}),Un.value.length===0?a("p",{class:"ac-workspace__empty",children:"No roles installed."}):a("div",{class:"ac-workspace__role-grid",children:Un.value.map(n=>a(gu,{role:n},n.slug))})]}),a("main",{class:"ac-workspace__main","aria-label":"Tasks and sessions",children:[e!==null?a(bu,{role:e}):a("p",{class:"ac-workspace__empty",children:"Pick a role on the left to see its first tasks."}),a(yu,{}),a(ku,{})]}),a("aside",{class:"ac-workspace__rail","aria-label":"Knowledge and documents",children:[a(wu,{}),a(Su,{}),a(Cu,{}),a(Tu,{})]})]})]})}const sl="agent-config-theme";function Nu(){return(typeof document<"u"?document.documentElement.getAttribute("data-theme"):null)==="dark"?"dark":"light"}const dn=h(Nu());function xu(){try{const e=localStorage.getItem(sl);return e==="light"||e==="dark"?e:null}catch{return null}}function Iu(){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 Ou(){return xu()===null&&Iu()===null}function cl(e){dn.value=e,document.documentElement.setAttribute("data-theme",e)}function $u(){const e=dn.value==="dark"?"light":"dark";try{localStorage.setItem(sl,e)}catch{}cl(e)}function Lu(){if(typeof window>"u"||typeof window.matchMedia!="function")return;const e=window.matchMedia("(prefers-color-scheme: dark)"),n=()=>{Ou()&&cl(e.matches?"dark":"light")};typeof e.addEventListener=="function"&&e.addEventListener("change",n)}function Pu(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("embed")==="1"}const Ru=Pu(),ul=[{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 dl(e){for(const n of ul)for(const t of n.matches)if(e===t||e.startsWith(`${t}/`))return n.id;return null}function Fu(e){const n=be.value,t=dl(e);return ul.filter(i=>i.id==="project"?n?.projectSurface===!0||t==="project":i.id==="workspace"?n?.devSurfaces===!0||t==="workspace":!0)}function Mu(){const e=Gn.value,n=dl(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:Fu(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:()=>bt(t.hashPath),children:t.label},t.id))}),a("button",{type:"button",class:"ac-topnav__theme","aria-label":dn.value==="dark"?"Switch to light theme":"Switch to dark theme",title:dn.value==="dark"?"Switch to light theme":"Switch to dark theme",onClick:()=>{$u()},children:dn.value==="dark"?"☀":"☾"})]})})}function Du({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 ju(){const e=be.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 Uu(e){return e==="/"||e==="/setup"||e.startsWith("/setup/")?a(Pa,{path:e}):e.startsWith("/wizard")?a(Pa,{path:e}):e==="/settings/changes"?a(qc,{}):e==="/settings"||e.startsWith("/settings/")?a(iu,{}):e==="/project"||e.startsWith("/project/")?a(su,{}):e==="/workspace"?a(Eu,{}):a(Du,{path:e})}function Bu(){return ae(()=>{Ll(),Gn.value==="/"&&bt("/setup"),Fl()},[]),a(P,{children:[a(ju,{}),Ru?null:a(Mu,{}),Uu(Gn.value)]})}const Wu=3e4,zu=30*6e4;let On=null,Ua=!1;function Ba(e){if(!Ua&&(Ua=!0,!(typeof navigator>"u"||typeof navigator.sendBeacon!="function")))try{navigator.sendBeacon(`/api/v1/shutdown?token=${encodeURIComponent(e)}`)}catch{}}function Hu(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=()=>{On!==null&&clearInterval(On),On=null;for(const s of i)window.removeEventListener(s,t);document.removeEventListener("visibilitychange",r),window.removeEventListener("pagehide",o)};On=setInterval(()=>{if(!document.hidden){if(Date.now()-n>zu){Ba(e),l();return}y("/api/v1/ping").catch(()=>{})}},Wu);function o(){Ba(e)}return window.addEventListener("pagehide",o),l}function Ku(){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 Yu(){return new URLSearchParams(window.location.search).get("token")}function qu(){const e=document.getElementById("app");if(e===null)return;const n=Yu();if(n===null){e.textContent="agent-config UI · missing token — re-open via `agent-config ui:serve`.";return}Pl(n),Ku(),Hu(n),Lu(),e.textContent="",yl(a(Bu,{}),e)}qu();
|
|
26
|
+
//# sourceMappingURL=index-Cxgy63kz.js.map
|