@event4u/agent-config 14.8.0 → 14.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +214 -237
  3. package/README.md +1 -1
  4. package/agents/templates/.ai-council.yml.example +34 -4
  5. package/dist/agent-src/commands/pr/merge.md +9 -5
  6. package/dist/agent-src/commands/review/changes.md +95 -14
  7. package/dist/agent-src/commands/roadmap/process-full.md +2 -2
  8. package/dist/agent-src/contexts/execution/host-capability-manifest.md +77 -0
  9. package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +36 -0
  10. package/dist/agent-src/contexts/execution/subagent-response-contract.md +80 -0
  11. package/dist/agent-src/rules/untrusted-input-defense.md +9 -3
  12. package/dist/agent-src/skills/async-python-patterns/SKILL.md +1 -1
  13. package/dist/agent-src/skills/code-refactoring/SKILL.md +1 -1
  14. package/dist/agent-src/skills/code-review/evals/evals.json +87 -46
  15. package/dist/agent-src/skills/condense-memory/SKILL.md +1 -1
  16. package/dist/agent-src/skills/conventional-commits-writing/SKILL.md +1 -1
  17. package/dist/agent-src/skills/design-review/SKILL.md +1 -1
  18. package/dist/agent-src/skills/discovery-interview/SKILL.md +1 -1
  19. package/dist/agent-src/skills/doc-coauthoring/SKILL.md +1 -1
  20. package/dist/agent-src/skills/docx-authoring/SKILL.md +1 -1
  21. package/dist/agent-src/skills/editorial-calendar/SKILL.md +1 -1
  22. package/dist/agent-src/skills/github-ci/SKILL.md +1 -1
  23. package/dist/agent-src/skills/humanizer/SKILL.md +39 -0
  24. package/dist/agent-src/skills/humanizer/evals/strip_fixtures.json +57 -0
  25. package/dist/agent-src/skills/humanizer/references/fixtures.md +54 -0
  26. package/dist/agent-src/skills/judge-artifact-completeness/SKILL.md +1 -1
  27. package/dist/agent-src/skills/judge-injection-defense/SKILL.md +1 -1
  28. package/dist/agent-src/skills/judge-spec-compliance/SKILL.md +154 -0
  29. package/dist/agent-src/skills/judge-synthesis/SKILL.md +45 -0
  30. package/dist/agent-src/skills/laravel-validation/SKILL.md +1 -1
  31. package/dist/agent-src/skills/legal-intake-triage/SKILL.md +1 -1
  32. package/dist/agent-src/skills/legal-practice-profile/SKILL.md +1 -1
  33. package/dist/agent-src/skills/messaging-architecture/SKILL.md +1 -1
  34. package/dist/agent-src/skills/migration-architect/SKILL.md +1 -1
  35. package/dist/agent-src/skills/module-detect-on-the-fly/SKILL.md +1 -1
  36. package/dist/agent-src/skills/module-management/SKILL.md +1 -1
  37. package/dist/agent-src/skills/motion-choreographer/SKILL.md +1 -1
  38. package/dist/agent-src/skills/onboarding-program/SKILL.md +1 -1
  39. package/dist/agent-src/skills/perf-feedback-craft/SKILL.md +1 -1
  40. package/dist/agent-src/skills/prompt-optimizer/SKILL.md +1 -1
  41. package/dist/agent-src/skills/receiving-code-review/SKILL.md +1 -1
  42. package/dist/agent-src/skills/roadmap-writing/SKILL.md +18 -18
  43. package/dist/agent-src/skills/scene-expander/SKILL.md +1 -1
  44. package/dist/agent-src/skills/secrets-management/SKILL.md +1 -1
  45. package/dist/agent-src/skills/using-git-worktrees/SKILL.md +1 -1
  46. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  47. package/dist/agent-src/templates/roadmaps.md +8 -0
  48. package/dist/cli/registry.js +2 -0
  49. package/dist/cli/registry.js.map +1 -1
  50. package/dist/cli-delegate/{chunk-MMSGVZKV.js → chunk-77GR3VD4.js} +65 -40
  51. package/dist/cli-delegate/{chunk-Q26HT4QT.js → chunk-E46KPN6K.js} +251 -150
  52. package/dist/cli-delegate/{chunk-EEJUMCDZ.js → chunk-PLSG6UL5.js} +1 -1
  53. package/dist/cli-delegate/cmd_conformance.js +89 -13
  54. package/dist/cli-delegate/cmd_doctor.js +3 -3
  55. package/dist/cli-delegate/cmd_handoff.js +2 -2
  56. package/dist/cli-delegate/cmd_memory_get.js +1 -1
  57. package/dist/cli-delegate/cmd_route_audit.js +1 -1
  58. package/dist/cli-delegate/cmd_settings_get.js +1 -1
  59. package/dist/cli-delegate/cmd_settings_set.js +1 -1
  60. package/dist/discovery/deprecation-report.md +1 -1
  61. package/dist/discovery/discovery-manifest.json +64 -42
  62. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  63. package/dist/discovery/discovery-manifest.summary.md +3 -3
  64. package/dist/discovery/dormancy-report.md +1 -1
  65. package/dist/discovery/orphan-report.md +1 -1
  66. package/dist/discovery/packs.json +6 -5
  67. package/dist/discovery/trust-report.md +2 -2
  68. package/dist/discovery/workspaces.json +5 -4
  69. package/dist/hooks/dispatch.js +562 -204
  70. package/dist/mcp/registry-manifest.json +3 -3
  71. package/dist/mcp/server.json +2 -2
  72. package/dist/mcp/server.mjs +808 -331
  73. package/dist/scripts/_lib/claude_plugin.js +162 -0
  74. package/dist/scripts/_lib/claude_plugin.js.map +1 -0
  75. package/dist/scripts/_lib/environment_detector.js +397 -0
  76. package/dist/scripts/_lib/environment_detector.js.map +1 -0
  77. package/dist/scripts/_lib/spawn_env.js +129 -0
  78. package/dist/scripts/_lib/spawn_env.js.map +1 -0
  79. package/dist/scripts/ai_council/modes.js +199 -0
  80. package/dist/scripts/ai_council/modes.js.map +1 -0
  81. package/dist/scripts/ai_council/transport_resolver.js +418 -0
  82. package/dist/scripts/ai_council/transport_resolver.js.map +1 -0
  83. package/dist/server/routes/wizard.js +3 -2
  84. package/dist/server/routes/wizard.js.map +1 -1
  85. package/dist/ui/assets/index-Cxgy63kz.js +26 -0
  86. package/dist/ui/assets/index-Cxgy63kz.js.map +1 -0
  87. package/dist/ui/index.html +1 -1
  88. package/docs/guidelines/agent-infra/traceability-field-mechanics.md +50 -0
  89. package/docs/guidelines/agent-infra/untrusted-input-spotlighting.md +17 -0
  90. package/package.json +7 -3
  91. package/src/config/estate-count-budget.json +13 -744
  92. package/src/config/evaluator-budgets.json +4 -4
  93. package/src/config/gate-coverage.yml +267 -9
  94. package/src/config/gate-violation-baselines.json +72 -72
  95. package/src/config/preamble-payload-budget.json +71 -67
  96. package/src/config/publish-surface.json +60 -0
  97. package/src/config/requirements-trace-budget.json +32 -0
  98. package/src/config/rule-stub-ceilings.json +8 -1
  99. package/src/scripts/_dispatch.bash +7 -0
  100. package/src/scripts/_lib/base_tree.ts +175 -0
  101. package/src/scripts/_lib/billing_grant.ts +165 -0
  102. package/src/scripts/_lib/billing_grant_cli.ts +123 -0
  103. package/src/scripts/_lib/council_fallback_posture.ts +53 -6
  104. package/src/scripts/_lib/council_fallback_wiring.ts +61 -1
  105. package/src/scripts/_lib/host_capability.ts +59 -5
  106. package/src/scripts/_lib/quota_parked.ts +133 -0
  107. package/src/scripts/_lib/retrieval_sanitize.ts +62 -0
  108. package/src/scripts/_lib/review_telemetry.ts +196 -0
  109. package/src/scripts/_lib/subagent_response.ts +92 -0
  110. package/src/scripts/adr/regenerate_index.ts +14 -7
  111. package/src/scripts/ai_council/clients.ts +12 -1
  112. package/src/scripts/ai_council/config.ts +72 -115
  113. package/src/scripts/ai_council/fallback_config.ts +19 -7
  114. package/src/scripts/ai_council/mid_flight_fallback.ts +88 -7
  115. package/src/scripts/ai_council/orchestrator.ts +2 -2
  116. package/src/scripts/ai_council/py_format.ts +124 -0
  117. package/src/scripts/ai_council/seating.ts +211 -0
  118. package/src/scripts/ai_council/transport_resolver.ts +65 -2
  119. package/src/scripts/audit_adr_coverage.ts +33 -6
  120. package/src/scripts/check_council_pin_staleness.ts +300 -0
  121. package/src/scripts/check_estate_count.ts +420 -293
  122. package/src/scripts/check_gate_coverage.ts +91 -0
  123. package/src/scripts/check_no_stub_inventory_table.ts +292 -0
  124. package/src/scripts/check_pack_passport_reconciliation.ts +274 -0
  125. package/src/scripts/check_pack_size.ts +234 -1
  126. package/src/scripts/check_publish_surface.ts +297 -0
  127. package/src/scripts/check_requirements_trace.ts +378 -0
  128. package/src/scripts/check_secret_leak.ts +166 -12
  129. package/src/scripts/code_graph/cli.ts +44 -5
  130. package/src/scripts/code_graph/extract.ts +87 -0
  131. package/src/scripts/council_cli.ts +12 -16
  132. package/src/scripts/detect_ai_tells.ts +87 -0
  133. package/src/scripts/dispatch_r2_reviewer.ts +42 -0
  134. package/src/scripts/generate_capabilities_index.ts +41 -0
  135. package/src/scripts/generate_pack_manifests.ts +78 -0
  136. package/src/scripts/git_authorization_hook.ts +54 -4
  137. package/src/scripts/hooks/block_unauthorized_git.ts +19 -1
  138. package/src/scripts/hooks/run_continuation_hook.ts +3 -1
  139. package/src/scripts/hooks/subagent_ledger_hook.ts +76 -11
  140. package/src/scripts/injection_scan_hook.ts +120 -10
  141. package/src/scripts/lint_adr_sweep_routing.ts +365 -0
  142. package/src/scripts/lint_workflow_security.ts +53 -10
  143. package/src/scripts/lint_workflow_security_allowlist.json +2 -18
  144. package/src/scripts/report_envelope_rate.ts +166 -0
  145. package/src/scripts/review_axis_report.ts +218 -0
  146. package/src/scripts/run_supervise.ts +46 -1
  147. package/src/scripts/schemas/evals.schema.json +5 -0
  148. package/src/scripts/schemas/pack.schema.json +62 -4
  149. package/src/scripts/schemas/skill.schema.json +2 -2
  150. package/src/scripts/sync_pr_branch.ts +14 -7
  151. package/src/scripts/tighten_skill_descriptions.ts +264 -0
  152. package/dist/cli/commands/commands.candidates.test.js +0 -257
  153. package/dist/cli/commands/commands.candidates.test.js.map +0 -1
  154. package/dist/cli/commands/profiles.test.js +0 -88
  155. package/dist/cli/commands/profiles.test.js.map +0 -1
  156. package/dist/cli/commands/recordTriggerEval.test.js +0 -113
  157. package/dist/cli/commands/recordTriggerEval.test.js.map +0 -1
  158. package/dist/cli/configRoot.test.js +0 -97
  159. package/dist/cli/configRoot.test.js.map +0 -1
  160. package/dist/cli/mcp/content.test.js +0 -54
  161. package/dist/cli/mcp/content.test.js.map +0 -1
  162. package/dist/cli/mcp/dispatch.test.js +0 -108
  163. package/dist/cli/mcp/dispatch.test.js.map +0 -1
  164. package/dist/server/writeRoot.test.js +0 -91
  165. package/dist/server/writeRoot.test.js.map +0 -1
  166. package/dist/shared/capabilities.test.js +0 -39
  167. package/dist/shared/capabilities.test.js.map +0 -1
  168. package/dist/ui/assets/index-C1pBRm1f.js +0 -26
  169. package/dist/ui/assets/index-C1pBRm1f.js.map +0 -1
  170. /package/dist/cli-delegate/{chunk-N7CDDGI3.js → chunk-CYH5SP6M.js} +0 -0
@@ -1,26 +0,0 @@
1
- (function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const l of r)if(l.type==="childList")for(const o of l.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const l={};return r.integrity&&(l.integrity=r.integrity),r.referrerPolicy&&(l.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?l.credentials="include":r.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(r){if(r.ep)return;r.ep=!0;const l=t(r);fetch(r.href,l)}})();var ht,T,Ba,za,ie,Zi,Wa,Ha,Lt,xn,Je,Ya,Si,Yt,Kt,jn={},Dn=[],ul=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,pt=Array.isArray;function V(e,n){for(var t in n)e[t]=n[t];return e}function Ci(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function dl(e,n,t){var i,r,l,o={};for(l in n)l=="key"?i=n[l]:l=="ref"?r=n[l]:o[l]=n[l];if(arguments.length>2&&(o.children=arguments.length>3?ht.call(arguments,2):t),typeof e=="function"&&e.defaultProps!=null)for(l in e.defaultProps)o[l]===void 0&&(o[l]=e.defaultProps[l]);return Nn(e,o,i,r,null)}function Nn(e,n,t,i,r){var l={type:e,props:n,key:t,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Ba,__i:-1,__u:0};return r==null&&T.vnode!=null&&T.vnode(l),l}function L(e){return e.children}function Xe(e,n){this.props=e,this.context=n}function ge(e,n){if(n==null)return e.__?ge(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"?ge(e):null}function fl(e){if(e.__P&&e.__d){var n=e.__v,t=n.__e,i=[],r=[],l=V({},n);l.__v=n.__v+1,T.vnode&&T.vnode(l),Ti(e.__P,l,n,e.__n,e.__P.namespaceURI,32&n.__u?[t]:null,i,t??ge(n),!!(32&n.__u),r),l.__v=n.__v,l.__.__k[l.__i]=l,Ja(i,l,r),n.__e=n.__=null,l.__e!=t&&Ka(l)}}function Ka(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}),Ka(e)}function Qi(e){(!e.__d&&(e.__d=!0)&&ie.push(e)&&!Un.__r++||Zi!=T.debounceRendering)&&((Zi=T.debounceRendering)||Wa)(Un)}function Un(){try{for(var e,n=1;ie.length;)ie.length>n&&ie.sort(Ha),e=ie.shift(),n=ie.length,fl(e)}finally{ie.length=Un.__r=0}}function qa(e,n,t,i,r,l,o,s,u,c,d){var g,f,p,v,_,k,w=i&&i.__k||Dn,b=n.length;for(u=hl(t,n,w,u,b),g=0;g<b;g++)(p=t.__k[g])!=null&&(f=p.__i!=-1&&w[p.__i]||jn,p.__i=g,k=Ti(e,p,f,r,l,o,s,u,c,d),v=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&Ai(f.ref,null,p),d.push(p.ref,p.__c||v,p)),_==null&&v!=null&&(_=v),4&p.__u?(u=Va(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 hl(e,n,t,i,r){var l,o,s,u,c,d=t.length,g=d,f=0;for(e.__k=new Array(r),l=0;l<r;l++)(o=n[l])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=e.__k[l]=Nn(null,o,null,null,null):pt(o)?o=e.__k[l]=Nn(L,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[l]=Nn(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[l]=o,u=l+f,o.__=e,o.__b=e.__b+1,s=null,(c=o.__i=pl(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=ge(s)),Za(s,s));return i}function Va(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=Va(i[r],n,t));return n}e.__e!=n&&(n&&e.type&&!n.parentNode&&(n=ge(e)),n=t.insertBefore(e.__e,n||null));do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function pl(e,n,t,i){var r,l,o,s=e.key,u=e.type,c=n[t],d=c!=null&&(2&c.__u)==0;if(c===null&&s==null||d&&s==c.key&&u==c.type)return t;if(i>(d?1:0)){for(r=t-1,l=t+1;r>=0||l<n.length;)if((c=n[o=r>=0?r--:l++])!=null&&!(2&c.__u)&&s==c.key&&u==c.type)return o}return-1}function ea(e,n,t){n[0]=="-"?e.setProperty(n,t??""):e[n]=t==null?"":typeof t!="number"||ul.test(n)?t:t+"px"}function Sn(e,n,t,i,r){var l,o;e:if(n=="style")if(typeof t=="string")e.style.cssText=t;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(n in i)t&&n in t||ea(e.style,n,"");if(t)for(n in t)i&&t[n]==i[n]||ea(e.style,n,t[n])}else if(n[0]=="o"&&n[1]=="n")l=n!=(n=n.replace(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[Je]=i[Je]:(t[Je]=Si,e.addEventListener(n,l?Kt:Yt,l)):e.removeEventListener(n,l?Kt:Yt,l);else{if(r=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&t==1?"":t))}}function na(e){return function(n){if(this.l){var t=this.l[n.type+e];if(n[xn]==null)n[xn]=Si++;else if(n[xn]<t[Je])return;return t(T.event?T.event(n):n)}}}function Ti(e,n,t,i,r,l,o,s,u,c){var d,g,f,p,v,_,k,w,b,B,qe,le,Ve,Xi,wn,Pt,Y=n.type;if(n.constructor!==void 0)return null;128&t.__u&&(u=!!(32&t.__u),l=[s=n.__e=t.__e]),(d=T.__b)&&d(n);e:if(typeof Y=="function"){g=o.length;try{if(b=n.props,B=Y.prototype&&Y.prototype.render,qe=(d=Y.contextType)&&i[d.__c],le=d?qe?qe.props.value:d.__:i,t.__c?w=(f=n.__c=t.__c).__=f.__E:(B?n.__c=f=new Y(b,le):(n.__c=f=new Xe(b,le),f.constructor=Y,f.render=gl),qe&&qe.sub(f),f.state||(f.state={}),f.__n=i,p=f.__d=!0,f.__h=[],f._sb=[]),B&&f.__s==null&&(f.__s=f.state),B&&Y.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=V({},f.__s)),V(f.__s,Y.getDerivedStateFromProps(b,f.__s))),v=f.props,_=f.state,f.__v=n,p)B&&Y.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),B&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(B&&Y.getDerivedStateFromProps==null&&b!==v&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(b,le),n.__v==t.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(b,f.__s,le)===!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(Ae){Ae&&(Ae.__=n)}),Dn.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f),s=ge(t);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(b,f.__s,le),B&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(v,_,k)})}if(f.context=le,f.props=b,f.__P=e,f.__e=!1,Ve=T.__r,Xi=0,B)f.state=f.__s,f.__d=!1,Ve&&Ve(n),d=f.render(f.props,f.state,f.context),Dn.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,Ve&&Ve(n),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++Xi<25);f.state=f.__s,f.getChildContext!=null&&(i=V(V({},i),f.getChildContext())),B&&!p&&f.getSnapshotBeforeUpdate!=null&&(k=f.getSnapshotBeforeUpdate(v,_)),wn=d!=null&&d.type===L&&d.key==null?Xa(d.props.children):d,s=qa(e,pt(wn)?wn:[wn],n,t,i,r,l,o,s,u,c),f.base=n.__e,n.__u&=-161,f.__h.length&&o.push(f),w&&(f.__E=f.__=null)}catch(Ae){if(o.length=g,n.__v=null,u||l!=null){if(Ae.then){for(n.__u|=u?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;l!=null&&(l[l.indexOf(s)]=null),n.__e=s}else if(l!=null)for(Pt=l.length;Pt--;)Ci(l[Pt])}else n.__e=t.__e;n.__k==null&&(n.__k=t.__k||[]),Ae.then||Ga(n),T.__e(Ae,n,t)}}else l==null&&n.__v==t.__v?(n.__k=t.__k,n.__e=t.__e):s=n.__e=vl(t.__e,n,t,i,r,l,o,u,c);return(d=T.diffed)&&d(n),128&n.__u?void 0:s}function Ga(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ga))}function Ja(e,n,t){for(var i=0;i<t.length;i++)Ai(t[i],t[++i],t[++i]);T.__c&&T.__c(n,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(l){l.call(r)})}catch(l){T.__e(l,r.__v)}})}function Xa(e){return typeof e!="object"||e==null||e.__b>0?e:pt(e)?e.map(Xa):e.constructor!==void 0?null:V({},e)}function vl(e,n,t,i,r,l,o,s,u){var c,d,g,f,p,v,_,k=t.props||jn,w=n.props,b=n.type;if(b=="svg"?r="http://www.w3.org/2000/svg":b=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),l!=null){for(c=0;c<l.length;c++)if((p=l[c])&&"setAttribute"in p==!!b&&(b?p.localName==b:p.nodeType==3)){e=p,l[c]=null;break}}if(e==null){if(b==null)return document.createTextNode(w);e=document.createElementNS(r,b,w.is&&w),s&&(T.__m&&T.__m(n,l),s=!1),l=null}if(b==null)k===w||s&&e.data==w||(e.data=w);else{if(l=b=="textarea"&&w.defaultValue!=null?null:l&&ht.call(e.childNodes),!s&&l!=null)for(k={},c=0;c<e.attributes.length;c++)k[(p=e.attributes[c]).name]=p.value;for(c in k)p=k[c],c=="dangerouslySetInnerHTML"?g=p:c=="children"||c in w||c=="value"&&"defaultValue"in w||c=="checked"&&"defaultChecked"in w||Sn(e,c,null,p,r);for(c in w)p=w[c],c=="children"?f=p:c=="dangerouslySetInnerHTML"?d=p:c=="value"?v=p:c=="checked"?_=p:s&&typeof p!="function"||k[c]===p||Sn(e,c,p,k[c],r);if(d)s||g&&(d.__html==g.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),n.__k=[];else if(g&&(e.innerHTML=""),qa(n.type=="template"?e.content:e,pt(f)?f:[f],n,t,i,b=="foreignObject"?"http://www.w3.org/1999/xhtml":r,l,o,l?l[0]:t.__k&&ge(t,0),s,u),l!=null)for(c=l.length;c--;)Ci(l[c]);s&&b!="textarea"||(c="value",b=="progress"&&v==null?e.removeAttribute("value"):v!=null&&(v!==e[c]||b=="progress"&&!v||b=="option"&&v!=k[c])&&Sn(e,c,v,k[c],r),c="checked",_!=null&&_!=e[c]&&Sn(e,c,_,k[c],r))}return e}function Ai(e,n,t){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&n==null||(e.__u=e(n))}else e.current=n}catch(r){T.__e(r,t)}}function Za(e,n,t){var i,r;if(T.unmount&&T.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Ai(i,null,n)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(l){T.__e(l,n)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Za(i[r],n,t||typeof e.type!="function");t||Ci(e.__e),e.__c=e.__=e.__e=void 0}function gl(e,n,t){return this.constructor(e,t)}function _l(e,n,t){var i,r,l,o;n==document&&(n=document.documentElement),T.__&&T.__(e,n),r=(i=!1)?null:n.__k,l=[],o=[],Ti(n,e=n.__k=dl(L,null,[e]),r||jn,jn,n.namespaceURI,r?null:n.firstChild?ht.call(n.childNodes):null,l,r?r.__e:n.firstChild,i,o),Ja(l,e,o),e.props.children=null}ht=Dn.slice,T={__e:function(e,n,t,i){for(var r,l,o;n=n.__;)if((r=n.__c)&&!r.__)try{if((l=r.constructor)&&l.getDerivedStateFromError!=null&&(r.setState(l.getDerivedStateFromError(e)),o=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),o=r.__d),o)return r.__E=r}catch(s){e=s}throw e}},Ba=0,za=function(e){return e!=null&&e.constructor===void 0},Xe.prototype.setState=function(e,n){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=V({},this.state),typeof e=="function"&&(e=e(V({},t),this.props)),e&&V(t,e),e!=null&&this.__v&&(n&&this._sb.push(n),Qi(this))},Xe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Qi(this))},Xe.prototype.render=L,ie=[],Wa=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ha=function(e,n){return e.__v.__b-n.__v.__b},Un.__r=0,Lt=Math.random().toString(8),xn="__d"+Lt,Je="__a"+Lt,Ya=/(PointerCapture)$|Capture$/i,Si=0,Yt=na(!1),Kt=na(!0);var ml=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:--ml,__i:-1,__u:0,__source:r,__self:l};if(typeof e=="function"&&(o=e.defaultProps))for(s in o)u[s]===void 0&&(u[s]=o[s]);return T.vnode&&T.vnode(c),c}var on,N,Rt,ta,qt=0,Qa=[],I=T,ia=I.__b,aa=I.__r,ra=I.diffed,la=I.__c,oa=I.unmount,sa=I.__;function xi(e,n){I.__h&&I.__h(N,e,qt||n),qt=0;var t=N.__H||(N.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({}),t.__[e]}function Ni(e){return qt=1,yl(tr,e)}function yl(e,n,t){var i=xi(on++,2);if(i.t=e,!i.__c&&(i.__=[tr(void 0,n),function(s){var u=i.__N?i.__N[0]:i.__[0],c=i.t(u,s);u!==c&&(i.__N=[c,i.__[1]],i.__c.setState({}))}],i.__c=N,!N.__f)){var r=function(s,u,c){if(!i.__c.__H)return!0;var d=!1,g=i.__c.props!==s;if(i.__c.__H.__.some(function(p){if(p.__N){d=!0;var v=p.__[0];p.__=p.__N,p.__N=void 0,v!==p.__[0]&&(g=!0)}}),l){var f=l.call(this,s,u,c);return d?f||g:f}return!d||g};N.__f=!0;var l=N.shouldComponentUpdate,o=N.componentWillUpdate;N.componentWillUpdate=function(s,u,c){if(this.__e){var d=l;l=void 0,r(s,u,c),l=d}o&&o.call(this,s,u,c)},N.shouldComponentUpdate=r}return i.__N||i.__}function ne(e,n){var t=xi(on++,3);!I.__s&&nr(t.__H,n)&&(t.__=e,t.u=n,N.__H.__h.push(t))}function er(e,n){var t=xi(on++,7);return nr(t.__H,n)&&(t.__=e(),t.__H=n,t.__h=e),t.__}function bl(){for(var e;e=Qa.shift();){var n=e.__H;if(e.__P&&n)try{n.__h.some(En),n.__h.some(Vt),n.__h=[]}catch(t){n.__h=[],I.__e(t,e.__v)}}}I.__b=function(e){N=null,ia&&ia(e)},I.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),sa&&sa(e,n)},I.__r=function(e){aa&&aa(e),on=0;var n=(N=e.__c).__H;n&&(Rt===N?(n.__h=[],N.__h=[],n.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(n.__h.some(En),n.__h.some(Vt),n.__h=[],on=0)),Rt=N},I.diffed=function(e){ra&&ra(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(Qa.push(n)!==1&&ta===I.requestAnimationFrame||((ta=I.requestAnimationFrame)||kl)(bl)),n.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),Rt=N=null},I.__c=function(e,n){n.some(function(t){try{t.__h.some(En),t.__h=t.__h.filter(function(i){return!i.__||Vt(i)})}catch(i){n.some(function(r){r.__h&&(r.__h=[])}),n=[],I.__e(i,t.__v)}}),la&&la(e,n)},I.unmount=function(e){oa&&oa(e);var n,t=e.__c;t&&t.__H&&(t.__H.__.some(function(i){try{En(i)}catch(r){n=r}}),t.__H=void 0,n&&I.__e(n,t.__v))};var ca=typeof requestAnimationFrame=="function";function kl(e){var n,t=function(){clearTimeout(i),ca&&cancelAnimationFrame(n),setTimeout(e)},i=setTimeout(t,35);ca&&(n=requestAnimationFrame(t))}function En(e){var n=N,t=e.__c;typeof t=="function"&&(e.__c=void 0,t()),N=n}function Vt(e){var n=N;e.__c=e.__(),N=n}function nr(e,n){return!e||e.length!==n.length||n.some(function(t,i){return t!==e[i]})}function tr(e,n){return typeof n=="function"?n(e):n}var wl=Symbol.for("preact-signals");function vt(){if(X>1)X--;else{var e,n=!1;for(function(){var r=zn;for(zn=void 0;r!==void 0;){var l=r.S;if(l.v===r.v)for(var o=l.t;o!==void 0;o=o.x)o.i===r.i&&(o.i=l.i);r=r.o}}();Qe!==void 0;){var t=Qe;for(Qe=void 0,Bn++;t!==void 0;){var i=t.u;if(t.u=void 0,t.f&=-3,!(8&t.f)&&ar(t))try{t.c()}catch(r){n||(e=r,n=!0)}t=i}}if(Bn=0,X--,n)throw e}}function Sl(e){if(X>0)return e();Gt=++Cl,X++;try{return e()}finally{vt()}}var Ze,A=void 0;function gt(e){var n=A,t=Ze;A=void 0,Ze=void 0;try{return e()}finally{A=n,Ze=t}}var Qe=void 0,X=0,Bn=0,Cl=0,Gt=0,zn=void 0,Wn=0;function ir(e){if(A!==void 0){var n=e.n;if(n===void 0||n.t!==A)return n={i:0,S:e,p:A.s,n:void 0,t:A,e:void 0,x:void 0,r:n},A.s!==void 0&&(A.s.n=n),A.s=n,e.n=n,32&A.f&&e.S(n),n;if(n.i===-1)return n.i=0,n.n!==void 0&&(n.n.p=n.p,n.p!==void 0&&(n.p.n=n.n),n.p=A.s,n.n=void 0,A.s.n=n,A.s=n),n}}function P(e,n){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=n?.watched,this.Z=n?.unwatched,this.name=n?.name}P.prototype.brand=wl;P.prototype.h=function(){return!0};P.prototype.S=function(e){var n=this,t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t!==void 0?t.e=e:gt(function(){var i;(i=n.W)==null||i.call(n)}))};P.prototype.U=function(e){var n=this;if(this.t!==void 0){var t=e.e,i=e.x;t!==void 0&&(t.x=i,e.e=void 0),i!==void 0&&(i.e=t,e.x=void 0),e===this.t&&(this.t=i,i===void 0&&gt(function(){var r;(r=n.Z)==null||r.call(n)}))}};P.prototype.subscribe=function(e){var n=this;return mn(function(){var t=n.value;gt(function(){return e(t)})},{name:"sub"})};P.prototype.valueOf=function(){return this.value};P.prototype.toString=function(){return this.value+""};P.prototype.toJSON=function(){return this.value};P.prototype.peek=function(){var e=this;return gt(function(){return e.value})};Object.defineProperty(P.prototype,"value",{get:function(){var e=ir(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Bn>100)throw new Error("Cycle detected");(function(t){X!==0&&Bn===0&&t.l!==Gt&&(t.l=Gt,zn={S:t,v:t.v,i:t.i,o:zn})})(this),this.v=e,this.i++,Wn++,X++;try{for(var n=this.t;n!==void 0;n=n.x)n.t.N()}finally{vt()}}}});function h(e,n){return new P(e,n)}function ar(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 rr(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 lr(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 Ce(e,n){P.call(this,void 0,n),this.x=e,this.s=void 0,this.g=Wn-1,this.f=4}Ce.prototype=new P;Ce.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Wn))return!0;if(this.g=Wn,this.f|=1,this.i>0&&!ar(this))return this.f&=-2,!0;var e=A;try{rr(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,lr(this),this.f&=-2,!0};Ce.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var n=this.s;n!==void 0;n=n.n)n.S.S(n)}P.prototype.S.call(this,e)};Ce.prototype.U=function(e){if(this.t!==void 0&&(P.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var n=this.s;n!==void 0;n=n.n)n.S.U(n)}};Ce.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(Ce.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=ir(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function ua(e,n){return new Ce(e,n)}function or(e){var n=e.m;if(e.m=void 0,typeof n=="function"){X++;var t=A;A=void 0;try{n()}catch(i){throw e.f&=-2,e.f|=8,Ei(e),i}finally{A=t,vt()}}}function Ei(e){for(var n=e.s;n!==void 0;n=n.n)n.S.U(n);e.x=void 0,e.s=void 0,or(e)}function Tl(e){if(A!==this)throw new Error("Out-of-order effect");lr(this),A=e,this.f&=-2,8&this.f&&Ei(this),vt()}function He(e,n){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=n?.name,Ze&&Ze.push(this)}He.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var n=this.x();typeof n=="function"&&(this.m=n)}finally{e()}};He.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,or(this),rr(this),X++;var e=A;return A=this,Tl.bind(this,e)};He.prototype.N=function(){2&this.f||(this.f|=2,this.u=Qe,Qe=this)};He.prototype.d=function(){this.f|=8,1&this.f||Ei(this)};He.prototype.dispose=function(){this.d()};function mn(e,n){var t=new He(e,n);try{t.c()}catch(r){throw t.d(),r}var i=t.d.bind(t);return i[Symbol.dispose]=i,i}var sr,Cn,Al=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,cr=[];mn(function(){sr=this.N})();function Ye(e,n){T[e]=n.bind(null,T[e]||function(){})}function Hn(e){if(Cn){var n=Cn;Cn=void 0,n()}Cn=e&&e.S()}function ur(e){var n=this,t=e.data,i=Nl(t);i.name="ReactiveDom",i.value=t;var r=er(function(){for(var s=n,u=n.__v;u=u.__;)if(u.__c){u.__c.__$f|=4;break}var c=ua(function(){var p=i.value.value;return p===0?0:p===!0?"":p||""}),d=ua(function(){return!Array.isArray(c.value)&&!za(c.value)}),g=mn(function(){if(this.N=dr,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}ur.displayName="ReactiveTextNode";Object.defineProperties(P.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:ur},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});Ye("__b",function(e,n){if(typeof n.type=="string"){var t,i=n.props;for(var r in i)if(r!=="children"){var l=i[r];l instanceof P&&(t||(n.__np=t={}),t[r]=l,i[r]=l.peek())}}e(n)});Ye("__r",function(e,n){if(e(n),n.type!==L){Hn();var t,i=n.__c;i&&(i.__$f&=-2,(t=i.__$u)===void 0&&(i.__$u=t=function(r,l){var o;return mn(function(){o=this},{name:l}),o.c=r,o}(function(r){return function(){var l;Al&&((l=this.y)==null||l.call(this)),r.__$f|=1,r.setState({})}}(i),typeof n.type=="function"?n.type.displayName||n.type.name:""))),Hn(t)}});Ye("__e",function(e,n,t,i){Hn(),e(n,t,i)});Ye("diffed",function(e,n){Hn();var t;if(typeof n.type=="string"&&(t=n.__e)){var i=n.__np,r=n.props,l=t.U;if(l)for(var o in l){var s=l[o];s===void 0||i&&o in i||(s.d(),l[o]=void 0)}if(i){l||(l={},t.U=l);for(var u in i){var c=l[u],d=i[u];c===void 0?(c=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:mn(function(){this.N=dr;var o=l.value.value;i[n]!==o&&(i[n]=o,r?e[n]=o:o!=null&&(o!==!1||n[4]==="-")?e.setAttribute(n,o):e.removeAttribute(n))})}}Ye("unmount",function(e,n){if(typeof n.type=="string"){var t=n.__e;if(t){var i=t.U;if(i){t.U=void 0;for(var r in i){var l=i[r];l&&l.d()}}}var o=n.__np;if(o){var s=n.props;for(var u in o)s[u]=o[u]}n.__np=void 0}else{var c=n.__c;if(c){var d=c.__$u;d&&(c.__$u=void 0,d.d())}}e(n)});Ye("__h",function(e,n,t,i){i<3&&(n.__$f|=2),e(n,t,i)});Xe.prototype.shouldComponentUpdate=function(e,n){if(this.__R)return!0;var t=this.__$u,i=t&&t.s!==void 0;for(var r in n)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var l=2&this.__$f;if(!(i||l||4&this.__$f)||1&this.__$f)return!0}else if(!(i||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!=="__source"&&e[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function Nl(e,n){return er(function(){return h(e,n)},[])}var El=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Il(){Sl(function(){for(var e;e=cr.shift();)sr.call(e)})}function dr(){cr.push(this)===1&&(T.requestAnimationFrame||El)(Il)}function fr(){const e=window.location.hash;return e===""||e==="#"?"/":e.startsWith("#")?e.slice(1):e}const Yn=h(fr());function _t(e){const n=e.startsWith("/")?e:`/${e}`;`#${n}`!==window.location.hash&&(window.location.hash=n)}let da=!1;function $l(){da||(da=!0,window.addEventListener("hashchange",()=>{Yn.value=fr()}))}let sn=null;function Ol(e){sn=e}class E extends Error{status;body;constructor(n,t,i){super(i),this.status=n,this.body=t}}async function y(e,n={}){const t={Accept:"application/json",...n.headers??{}};sn!==null&&(t.Authorization=`Bearer ${sn}`);const{body:i,...r}=n,l={...r,headers:t};i!==void 0&&(l.body=JSON.stringify(i),t["Content-Type"]="application/json");const o=await fetch(e,l),s=await o.text(),u=s===""?{}:JSON.parse(s);if(!o.ok){const c=u.error?.message??`request failed (${o.status})`;throw new E(o.status,u,c)}return u}async function Pl(e,n,t,i={}){const r={Accept:"text/event-stream","Content-Type":"application/json",...i.headers??{}};sn!==null&&(r.Authorization=`Bearer ${sn}`);const l=await fetch(e,{...i,method:"POST",headers:r,body:JSON.stringify(n)});if(!l.ok||l.body===null){const d=await l.text().catch(()=>"");let g={};try{g=d===""?{}:JSON.parse(d)}catch{}throw new E(l.status,g,g.error?.message??`stream failed (${l.status})`)}const o=l.body.getReader(),s=new TextDecoder;let u="";const c=d=>{for(const g of d.split(`
2
- `)){if(!g.startsWith("data:"))continue;const f=g.slice(5).trim();if(f!=="")try{t(JSON.parse(f))}catch{}}};for(;;){const{done:d,value:g}=await o.read();if(d)break;u+=s.decode(g,{stream:!0});let f=u.indexOf(`
3
-
4
- `);for(;f!==-1;)c(u.slice(0,f)),u=u.slice(f+2),f=u.indexOf(`
5
-
6
- `)}u.trim()!==""&&c(u)}const _e=h(null);async function Ll(){try{const e=await y("/api/v1/ping");_e.value={...e,projectScopeAvailable:e.projectScopeAvailable===!0,projectSurface:e.projectSurface===!0,devSurfaces:e.devSurfaces===!0}}catch{_e.value=null}}function z(e){switch(e.code){case"VALIDATION":return"Some fields need attention before saving.";case"CONFLICT":return"This file changed on disk while you were editing. Review the latest version and re-save.";case"PRECONDITION_REQUIRED":return"Reload the page once — the optimistic-lock token is missing.";case"NOT_FOUND":return"The file does not exist yet. Use the wizard to create it.";case"ATOMIC_WRITE":return"Write failed mid-flight. The file was not partially modified.";case"YAML_PARSE":return"YAML parse error — fix the file by hand, then reload.";default:return e.message}}function Rl(e){return/expected (boolean|string|number)/i.test(e)?e.replace(/^expected/i,"Expected"):e}function mt(e){const n={};for(const t of e.fields??[])n[t.path]=Rl(t.message);return n}function Fl({id:e,children:n}){return a("p",{class:"ac-field__description",id:e,children:n})}function Ml({id:e,children:n}){return a("p",{class:"ac-field__error",id:e,role:"alert","aria-live":"polite",children:n})}function Te({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(Fl,{id:l,children:t}):null,a("div",{class:"ac-field__control","aria-describedby":l,"aria-errormessage":o,children:r}),i!==void 0?a(Ml,{id:o,children:i}):null]})}function hr(e){return a(Te,{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 jl(e){const n=e.step??(e.integer===!0?1:"any");return a(Te,{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 Dl(e){return a(Te,{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 pr(e){const n=e.options.length>3;return a(Te,{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 Kn(e){return a(Te,{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 vr(e){return e.replace(/_/g," ").replace(/\./g," › ").replace(/\b\w/g,n=>n.toUpperCase())}function Ul(e){return e.enum!==void 0&&e.enum.length>0?"enum":e.type==="integer"?"integer":e.type==="number"?"number":e.type==="boolean"?"boolean":e.type==="string"?"string":e.type==="array"&&e.items?.type==="string"?"array-of-strings":"unsupported"}function Ft(e,n){const t=Ul(n);return{path:e,kind:t,label:vr(e[e.length-1]??""),description:n.description,options:n.enum,min:n.minimum,max:n.maximum,defaultValue:n.default}}function gr(e){const n=[],t=e.properties??{};for(const[i,r]of Object.entries(t))if(r.type==="object"&&r.properties!==void 0){const l=[];for(const[o,s]of Object.entries(r.properties))if(s.type==="object"&&s.properties!==void 0)for(const[u,c]of Object.entries(s.properties))l.push(Ft([i,o,u],c));else l.push(Ft([i,o],s));n.push({path:[i],label:vr(i),description:r.description,fields:l})}else{const l=n.find(s=>s.path[0]==="__general"),o=Ft([i],r);l===void 0?n.unshift({path:["__general"],label:"General",fields:[o]}):l.fields.push(o)}return n}function yn(e,n){let t=e;for(const i of n){if(t===null||typeof t!="object"||Array.isArray(t))return;t=t[i]}return t}function cn(e,n,t){if(n.length===0)return e;const[i,...r]=n;if(i===void 0)return e;const l={...e};if(r.length===0)return l[i]=t,l;const o=l[i],s=o!==null&&typeof o=="object"&&!Array.isArray(o)?o:{};return l[i]=cn(s,r,t),l}function Pe(e){return e.join(".")}function fa(e,n,t,i){const r=Pe(e.path),l=r,o=yn(n,e.path),s=t[r],u=c=>{i(cn(n,e.path,c))};switch(e.kind){case"string":{const c=typeof o=="string"?o:"";return c.length>80?a(Kn,{id:r,name:l,label:e.label,description:e.description,error:s,value:c,onChange:u}):a(hr,{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(pr,{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(jl,{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(Dl,{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(Kn,{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 Bl({field:e,values:n,errors:t,onChange:i,decorate:r}){const l=Pe(e.path),o=r?.(l,e);return o===void 0?a("div",{children:fa(e,n,t,i)},l):a("div",{class:`ac-field-row${o.modified?" ac-field-row--modified":""}`,children:[a("div",{class:"ac-field-row__body",children:fa(e,n,t,i)}),a("div",{class:"ac-field-row__meta",children:[o.sourceLabel!==void 0?a("span",{class:"ac-badge ac-badge--source",title:`Value set in the ${o.sourceLabel} layer`,children:o.sourceLabel}):null,o.modified&&o.onReset!==void 0?a("button",{type:"button",class:"ac-field-row__reset",title:"Reset to default",onClick:o.onReset,children:"Reset"}):null]})]})}function _r({section:e,values:n,errors:t,onChange:i,decorate:r,footer:l}){return a("section",{class:"ac-section","aria-labelledby":`section-${Pe(e.path)}`,children:[a("h2",{class:"ac-section__title",id:`section-${Pe(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(Bl,{field:o,values:n,errors:t,onChange:i,decorate:r},Pe(o.path)))}),l]})}function zl(e){const n=gr(e.schema),t=e.errors??{};return a("form",{class:"ac-form",onSubmit:i=>i.preventDefault(),children:[n.map(i=>a(_r,{section:i,values:e.values,errors:t,onChange:e.onChange,decorate:e.decorate},Pe(i.path))),e.actions!==void 0?a("div",{class:"ac-form__actions",children:e.actions}):null]})}function Wl(e){const[n]=Ni(()=>`${e.id}-list`);return a(Te,{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 Hl=["developer","reviewer","designer","product-manager","ops","qa","maintainer"],Yl=["de","en","en-US","en-GB","fr","es","it","nl","pt","pt-BR"];function ha(){return new Date().toISOString().slice(0,10)}function xe(e,n){return e?.[n]}function Kl({value:e,onChange:n,errors:t,hideRole:i,hideIdentityBasics:r}){const[l,o]=Ni(""),s="umd-role-suggestions";function u(v){n({...e,...v,last_updated:ha()})}const c=e.role.filter(v=>v.trim()!=="");function d(v){const _=v.trim();if(_===""||c.includes(_)){o("");return}u({role:[...c,_]}),o("")}function g(v){c.length<=1||u({role:c.filter(_=>_!==v)})}function f(v){const _={...e,last_updated:ha()};v===""?delete _.notes:_.notes=v,n(_)}const p=Hl.filter(v=>!c.includes(v));return a("div",{class:"ac-user-md-form",children:[r?null:a(hr,{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:xe(t,"identity.name"),onChange:v=>u({identity:{...e.identity,name:v}})}),r?null:a(Wl,{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:Yl,error:xe(t,"language"),onChange:v=>u({language:v})}),i?null:a(Te,{id:"umd-role-input",label:"Roles",description:"One or more roles. Seeded suggestions are non-binding — type anything and press Enter.",error:xe(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(pr,{id:"umd-pace",name:"style.pace",label:"Pace",value:e.style.pace,error:xe(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(Kn,{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:xe(t,"voice_sample"),onChange:v=>u({voice_sample:v})}),a(Kn,{id:"umd-notes",name:"notes",label:"Notes",description:"Optional free-form prose the agent remembers across sessions.",rows:6,value:e.notes??"",error:xe(t,"notes"),onChange:f})]})}function mr(){return{version:1,identity:{name:""},language:"en",role:[],style:{pace:"pragmatic"},voice_sample:"",last_updated:"1970-01-01"}}function pa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Tn(e,n){return typeof e=="string"?e:n}function ql(e){return e==="thorough"||e==="rapid"?e:"pragmatic"}function Vl(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"&&n.trim()!==""):[]}function Gl(e){if(typeof e=="string")return e===""?void 0:e}function va(e){const n=mr(),t=pa(e.identity)?e.identity:{},i=pa(e.style)?e.style:{},r=Gl(e.notes),l={version:1,identity:{name:Tn(t.name,n.identity.name)},language:Tn(e.language,n.language),role:Vl(e.role),style:{pace:ql(i.pace)},voice_sample:Tn(e.voice_sample,n.voice_sample),last_updated:Tn(e.last_updated,n.last_updated)};return r!==void 0&&(l.notes=r),l}/*! js-yaml 5.2.3 https://github.com/nodeca/js-yaml @license MIT */var S=Symbol("NOT_RESOLVED"),Ii=Symbol("MERGE_KEY");function R(e,n){return{tagName:e,nodeKind:"scalar",implicit:n.implicit??!1,matchByTagPrefix:n.matchByTagPrefix??!1,implicitFirstChars:n.implicitFirstChars??null,resolve:n.resolve,identify:n.identify??null,represent:n.represent??(t=>String(t)),representTagName:n.representTagName??null}}function $i(e,n){const t=n.finalize===void 0;return{tagName:e,nodeKind:"sequence",implicit:!1,matchByTagPrefix:n.matchByTagPrefix??!1,create:n.create,addItem:n.addItem,finalize:n.finalize??(i=>i),carrierIsResult:t,identify:n.identify??null,represent:n.represent??(i=>i),representTagName:n.representTagName??null}}function yt(e,n){const t=n.finalize===void 0;return{tagName:e,nodeKind:"mapping",implicit:!1,matchByTagPrefix:n.matchByTagPrefix??!1,create:n.create,addPair:n.addPair,has:n.has,keys:n.keys,get:n.get,finalize:n.finalize??(i=>i),carrierIsResult:t,identify:n.identify??null,represent:n.represent??(i=>i),representTagName:n.representTagName??null}}var Jl=R("tag:yaml.org,2002:str",{resolve:e=>e,identify:e=>typeof e=="string"}),Xl=["","~","null","Null","NULL"],Zl=R("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["","~","n","N"],resolve:e=>Xl.indexOf(e)!==-1?null:S,identify:e=>e===null,represent:()=>"null"}),Ql=R("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["n"],resolve:(e,n)=>e==="null"||n&&e===""?null:S,identify:e=>e===null,represent:()=>"null"}),eo=["","~","null","Null","NULL"],no=R("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["","~","n","N"],resolve:e=>eo.indexOf(e)!==-1?null:S,identify:e=>e===null,represent:()=>"null"}),to=["true","True","TRUE"],io=["false","False","FALSE"],ao=R("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["t","T","f","F"],resolve:e=>to.indexOf(e)!==-1?!0:io.indexOf(e)!==-1?!1:S,identify:e=>Object.prototype.toString.call(e)==="[object Boolean]",represent:e=>e?"true":"false"}),ro=["true"],lo=["false"],oo=R("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["t","f"],resolve:e=>ro.indexOf(e)!==-1?!0:lo.indexOf(e)!==-1?!1:S,identify:e=>Object.prototype.toString.call(e)==="[object Boolean]",represent:e=>e?"true":"false"}),so=["true","True","TRUE","y","Y","yes","Yes","YES","on","On","ON"],co=["false","False","FALSE","n","N","no","No","NO","off","Off","OFF"],uo=R("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["y","Y","n","N","t","T","f","F","o","O"],resolve:e=>so.indexOf(e)!==-1?!0:co.indexOf(e)!==-1?!1:S,identify:e=>Object.prototype.toString.call(e)==="[object Boolean]",represent:e=>e?"true":"false"}),fo=new RegExp("^(?:0o[0-7]+|0x[0-9a-fA-F]+|[-+]?[0-9]+)$"),ho=new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");function po(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 vo(e,n){if(n){if(!ho.test(e))return S}else if(!fo.test(e))return S;const t=po(e);return Number.isFinite(t)?t:S}var yr=R("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-","+",..."0123456789"],resolve:vo,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf("e")<0,represent:e=>e.toString(10)}),go=new RegExp("^-?(?:0|[1-9][0-9]*)$"),_o=new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");function mo(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 yo(e,n){if(n){if(!_o.test(e))return S}else if(!go.test(e))return S;const t=mo(e);return Number.isFinite(t)?t:S}var bo=R("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-",..."0123456789"],resolve:yo,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf("e")<0,represent:e=>e.toString(10)}),ko=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 wo(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 So(e){if(!ko.test(e))return S;const n=wo(e);return Number.isFinite(n)?n:S}var Jt=R("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-","+",..."0123456789"],resolve:So,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf("e")<0,represent:e=>e.toString(10)}),Co=new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),To=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Ao(e){if(!Co.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)||To.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 br=R("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-","+",".",..."0123456789"],resolve:Ao,identify:e=>typeof e=="number"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf("e")>=0),represent:xo}),No=new RegExp("^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$"),Eo=new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Io(e,n){if(n){if(!Eo.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(!No.test(e))return S;const t=Number(e);return Number.isFinite(t)?t:S}function $o(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 Oo=R("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-",..."0123456789"],resolve:Io,identify:e=>typeof e=="number"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf("e")>=0),represent:$o}),Po=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))$"),Lo=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Ro(e){if(!Po.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)||Lo.test(e)?i:S}function Fo(e){if(isNaN(e))return".nan";if(e===Number.POSITIVE_INFINITY)return".inf";if(e===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(e,-0))return"-0.0";const n=e.toString(10);return/^[-+]?[0-9]+e/.test(n)?n.replace("e",".e"):n}var Xt=R("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-","+",".",..."0123456789"],resolve:Ro,identify:e=>typeof e=="number"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf("e")>=0),represent:Fo}),Mo=R("tag:yaml.org,2002:merge",{implicit:!0,implicitFirstChars:["<"],resolve:(e,n)=>e==="<<"||n&&e===""?Ii:S}),jo=/^[A-Za-z0-9+/]*={0,2}$/;function Do(e){const n=e.replace(/\s/g,"");if(n.length%4!==0||!jo.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 Uo(e){let n="";for(let t=0;t<e.length;t++)n+=String.fromCharCode(e[t]);return btoa(n)}var Bo=R("tag:yaml.org,2002:binary",{resolve:Do,identify:e=>Object.prototype.toString.call(e)==="[object Uint8Array]",represent:Uo}),zo=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Wo=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 ga(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 Ho(e){let n=zo.exec(e);if(n===null&&(n=Wo.exec(e)),n===null)return S;const t=+n[1],i=+n[2]-1,r=+n[3];if(!n[4]){const d=ga(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=ga(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 Yo=R("tag:yaml.org,2002:timestamp",{implicit:!0,implicitFirstChars:[..."0123456789"],resolve:Ho,identify:e=>e instanceof Date,represent:e=>e.toISOString()}),Ko=$i("tag:yaml.org,2002:seq",{create:()=>[],addItem:(e,n)=>{e.push(n)},identify:Array.isArray});function bt(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const n=Object.getPrototypeOf(e);return n===null||n===Object.prototype}function _a(e,n){const t={};for(const i of n)e[i]!==void 0&&(t[i]=e[i]);return t}var qo=$i("tag:yaml.org,2002:omap",{create:()=>({list:[],seen:new Set}),addItem:(e,n)=>{let t;if(n instanceof Map){if(n.size!==1)return"cannot resolve an ordered map item";t=n.keys().next().value}else if(bt(n)){const i=Object.keys(n);if(i.length!==1)return"cannot resolve an ordered map item";t=i[0]}else return"cannot resolve an ordered map item";return e.seen.has(t)?"duplicate key in ordered map":(e.seen.add(t),e.list.push(n),"")},finalize:e=>e.list}),Vo=$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]]]),"")}}),Go=yt("tag:yaml.org,2002:map",{create:()=>({}),identify:bt,represent:e=>{const n=new Map;for(const t of Object.keys(e))n.set(t,e[t]);return n},addPair:(e,n,t)=>{if(n!==null&&typeof n=="object")return"object-based map does not support complex keys";const i=String(n);return i==="__proto__"?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,""},has:(e,n)=>n!==null&&typeof n=="object"?!1:Object.prototype.hasOwnProperty.call(e,String(n)),keys:e=>Object.keys(e),get:(e,n)=>{const t=String(n);return Object.prototype.hasOwnProperty.call(e,t)?e[t]:null}}),Jo=yt("tag:yaml.org,2002:set",{create:()=>new Set,identify:e=>e instanceof Set,represent:e=>{const n=new Map;for(const t of e)n.set(t,null);return n},addPair:(e,n,t)=>t!==null?"cannot resolve a set item":(e.add(n),""),has:(e,n)=>e.has(n),keys:e=>e.keys(),get:()=>null});function Xo(){return{scalar:Object.create(null),sequence:Object.create(null),mapping:Object.create(null)}}function Zo(){return{scalar:[],sequence:[],mapping:[]}}function Qo(e){const n=[];for(const t of e){let i=n.length;for(let r=0;r<n.length;r++){const l=n[r];if(l.nodeKind===t.nodeKind&&l.tagName===t.tagName&&l.matchByTagPrefix===t.matchByTagPrefix){i=r;break}}n[i]=t}return n}var kt=class kr{tags;implicitScalarTags;implicitScalarByFirstChar;implicitScalarAnyFirstChar;defaultScalarTag;defaultSequenceTag;defaultMappingTag;exact;prefix;constructor(n){const t=Qo(n),i=[],r=Xo(),l=Zo();for(const d of t){if(d.nodeKind==="scalar"&&d.implicit){if(d.matchByTagPrefix)throw new Error("Implicit scalar tags cannot match by tag prefix");i.push(d)}switch(d.nodeKind){case"scalar":d.matchByTagPrefix?l.scalar.push(d):r.scalar[d.tagName]=d;break;case"sequence":d.matchByTagPrefix?l.sequence.push(d):r.sequence[d.tagName]=d;break;case"mapping":d.matchByTagPrefix?l.mapping.push(d):r.mapping[d.tagName]=d;break}}const o=i.filter(d=>d.implicitFirstChars===null),s=new Set;for(const d of i)if(d.implicitFirstChars!==null)for(const g of d.implicitFirstChars)s.add(g);const u=new Map;for(const d of s)u.set(d,i.filter(g=>g.implicitFirstChars===null||g.implicitFirstChars.indexOf(d)!==-1));const c=r.scalar["tag:yaml.org,2002:str"];if(!c)throw new Error("schema does not define the default scalar tag (tag:yaml.org,2002:str)");this.tags=t,this.implicitScalarTags=i,this.implicitScalarByFirstChar=u,this.implicitScalarAnyFirstChar=o,this.defaultScalarTag=c,this.defaultSequenceTag=r.sequence["tag:yaml.org,2002:seq"],this.defaultMappingTag=r.mapping["tag:yaml.org,2002:map"],this.exact=r,this.prefix=l}withTags(...n){let t=[];for(const i of n)t=t.concat(i);return new kr([...this.tags,...t])}},Oi=new kt([Jl,Ko,Go]);new kt([...Oi.tags,Ql,oo,bo,Oo]);var es=new kt([...Oi.tags,Zl,ao,yr,br]),ns=new kt([...Oi.tags,no,uo,Jt,Xt,Yo,Mo,Bo,qo,Vo,Jo]);yt("tag:yaml.org,2002:map",{create:()=>new Map,addPair:(e,n,t)=>(e.set(n,t),""),has:(e,n)=>e.has(n),keys:e=>e.keys(),get:(e,n)=>e.get(n),identify:e=>e instanceof Map||bt(e),represent:e=>{if(e instanceof Map)return e;const n=new Map,t=e;for(const i of Object.keys(t))n.set(i,t[i]);return n}});function ma(e){if(Array.isArray(e)){const n=Array.prototype.slice.call(e);for(let t=0;t<n.length;t++){if(Array.isArray(n[t]))return null;typeof n[t]=="object"&&Object.prototype.toString.call(n[t])==="[object Object]"&&(n[t]="[object Object]")}return String(n)}return typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"?"[object Object]":String(e)}yt("tag:yaml.org,2002:map",{create:()=>({}),identify:bt,represent:e=>{const n=new Map;for(const t of Object.keys(e))n.set(t,e[t]);return n},addPair:(e,n,t)=>{const i=ma(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=ma(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 ts={maxLength:79,indent:1,linesBefore:3,linesAfter:2};function Mt(e,n,t,i,r){let l="",o="";const s=Math.floor(r/2)-1;return i-n>s&&(l=" ... ",n=i-s+l.length),t-i>s&&(o=" ...",t=i+s-o.length),{str:l+e.slice(n,t).replace(/\t/g,"→")+o,pos:i-n+l.length}}function jt(e,n){return" ".repeat(Math.max(n-e.length,0))+e}function is(e,n){if(!e.buffer)return null;const t={...ts,...n},i=/\r?\n|\r|\0/g,r=[0],l=[];let o,s=-1;for(;o=i.exec(e.buffer);)l.push(o.index),r.push(o.index+o[0].length),e.position<=o.index&&s<0&&(s=r.length-2);s<0&&(s=r.length-1);let u="";const c=Math.min(e.line+t.linesAfter,l.length).toString().length,d=t.maxLength-(t.indent+c+3);for(let f=1;f<=t.linesBefore&&!(s-f<0);f++){const p=Mt(e.buffer,r[s-f],l[s-f],e.position-(r[s]-r[s-f]),d);u=`${" ".repeat(t.indent)}${jt((e.line-f+1).toString(),c)} | ${p.str}
9
- ${u}`}const g=Mt(e.buffer,r[s],l[s],e.position,d);u+=`${" ".repeat(t.indent)}${jt((e.line+1).toString(),c)} | ${g.str}
10
- `,u+=`${"-".repeat(t.indent+c+3+g.pos)}^
11
- `;for(let f=1;f<=t.linesAfter&&!(s+f>=l.length);f++){const p=Mt(e.buffer,r[s+f],l[s+f],e.position-(r[s]-r[s+f]),d);u+=`${" ".repeat(t.indent)}${jt((e.line+f+1).toString(),c)} | ${p.str}
12
- `}return u.replace(/\n$/,"")}function ya(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 qn=class extends Error{reason;mark;constructor(e,n){super(),this.name="YAMLException",this.reason=e,this.mark=n,this.message=ya(this,!1),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toString(e){return`${this.name}: ${ya(this,e)}`}};function wt(e,n,t,i=""){let r=0,l=0;for(let s=0;s<n;s++){const u=e.charCodeAt(s);u===10?(r++,l=s+1):u===13&&(r++,e.charCodeAt(s+1)===10&&s++,l=s+1)}const o={name:i,buffer:e,position:n,line:r,column:n-l};throw o.snippet=is(o),new qn(t,o)}var as=-1;function ba(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 wr=new Array(256),Sr=new Array(256);for(let e=0;e<256;e++)wr[e]=ba(e)?1:0,Sr[e]=ba(e);function rs(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function ls(e){return e>=48&&e<=57?e-48:(e|32)-97+10}function os(e){return e===120?2:e===117?4:8}function Vn(e,n,t){let i=0;for(;n<t;){const r=e.charCodeAt(n);if(r===10)i++,n++;else if(r===13)i++,n++,e.charCodeAt(n)===10&&n++;else if(r===32||r===9)n++;else break}return{position:n,breaks:i}}function Pi(e){return e===1?" ":`
16
- `.repeat(e-1)}function ss(e,n,t){let i="",r=n,l=n,o=n;for(;r<t;){const s=e.charCodeAt(r);if(s===10||s===13){i+=e.slice(l,o);const u=Vn(e,r,t);i+=Pi(u.breaks),r=l=o=u.position}else r++,s!==32&&s!==9&&(o=r)}return i+e.slice(l,o)}function cs(e,n,t){let i="",r=n,l=n,o=n;for(;r<t;){const s=e.charCodeAt(r);if(s===39)i+=e.slice(l,r)+"'",r+=2,l=o=r;else if(s===10||s===13){i+=e.slice(l,o);const u=Vn(e,r,t);i+=Pi(u.breaks),r=l=o=u.position}else r++,s!==32&&s!==9&&(o=r)}return i+e.slice(l,t)}function us(e,n,t){let i="",r=n,l=n,o=n;for(;r<t;){const s=e.charCodeAt(r);if(s===92){i+=e.slice(l,r),r++;const u=e.charCodeAt(r);if(u===10||u===13)r=Vn(e,r,t).position;else if(u<256&&wr[u])i+=Sr[u],r++;else{let c=os(u),d=0;for(;c>0;c--){r++;const g=ls(e.charCodeAt(r));d=(d<<4)+g}i+=rs(d),r++}l=o=r}else if(s===10||s===13){i+=e.slice(l,o);const u=Vn(e,r,t);i+=Pi(u.breaks),r=l=o=u.position}else r++,s!==32&&s!==9&&(o=r)}return i+e.slice(l,t)}function ka(e,n,t,i,r,l){const o=i<0?0:i,s=e.slice(n,t).replace(/\r\n?/g,`
17
- `),u=s===""?[]:(s.endsWith(`
18
- `)?s.slice(0,-1):s).split(`
19
- `);let c="",d=!1,g=0,f=!1;for(const p of u){let v=0;for(;v<o&&p.charCodeAt(v)===32;)v++;if(i<0||v>=p.length){g++;continue}const _=p.slice(o),k=_.charCodeAt(0);l?k===32||k===9?(f=!0,c+=`
20
- `.repeat(d?1+g:g)):f?(f=!1,c+=`
21
- `.repeat(g+1)):g===0?d&&(c+=" "):c+=`
22
- `.repeat(g):c+=`
23
- `.repeat(d?1+g:g),c+=_,d=!0,g=0}return r===3?c+=`
24
- `.repeat(d?1+g:g):r!==2&&d&&(c+=`
25
- `),c}function ds(e,n){if(n.valueStart===as)return"";const{valueStart:t,valueEnd:i}=n;if(n.fast)return e.slice(t,i);switch(n.style){case 2:return cs(e,t,i);case 3:return us(e,t,i);case 4:return ka(e,t,i,n.indent,n.chomping,!1);case 5:return ka(e,t,i,n.indent,n.chomping,!0);default:return ss(e,t,i)}}var fs=Object.assign(Object.create(null),{"!":"!","!!":"tag:yaml.org,2002:"});function Cr(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]??fs[i]??i;return decodeURIComponent(r)+decodeURIComponent(e.slice(i.length))}var Le=-1,Li={filename:"",schema:es,json:!1,maxTotalMergeKeys:1e4,maxAliases:-1};function hs(e){return"tagStart"in e&&e.tagStart!==Le?e.tagStart:"anchorStart"in e&&e.anchorStart!==Le?e.anchorStart:"valueStart"in e&&e.valueStart!==Le?e.valueStart:"start"in e?e.start:0}function D(e,n){wt(e.source,e.position,n,e.filename)}function Tr(e,n,t,i){try{return t.finalize(i)}catch(r){if(r instanceof qn)throw r;wt(e.source,n,r instanceof Error?r.message:String(r),e.filename)}}function In(e,n,t){const i=e[t];if(i)return i;for(const r of n)if(t.startsWith(r.tagName))return r}function ps(e,n,t,i,r){const l=In(n,t,i);if(l)return l;D(e,`unknown ${r} tag !<${i}>`)}function vs(e,n){const t=ds(e.source,n),i=n.tagStart===Le?"":e.source.slice(n.tagStart,n.tagEnd),r=e.schema.defaultScalarTag;if(i!==""){if(i==="!")return{value:t,tag:r};const l=Cr(i,e.tagHandlers),o=In(e.schema.exact.scalar,e.schema.prefix.scalar,l);if(o){const u=o.resolve(t,!0,l);return u===S&&D(e,`cannot resolve a node with !<${l}> explicit tag`),{value:u,tag:o}}const s=In(e.schema.exact.mapping,e.schema.prefix.mapping,l)??In(e.schema.exact.sequence,e.schema.prefix.sequence,l);if(s){t!==""&&D(e,`cannot resolve a node with !<${l}> explicit tag`);const u=s.create(l);return{value:s.carrierIsResult?u:Tr(e,e.position,s,u),tag:s}}D(e,`unknown scalar tag !<${l}>`)}if(n.style===1){const l=e.schema.implicitScalarByFirstChar.get(t.charAt(0))??e.schema.implicitScalarAnyFirstChar;for(const o of l){const s=o.resolve(t,!1,o.tagName);if(s!==S)return{value:s,tag:o}}}return{value:r.resolve(t,!1,r.tagName),tag:r}}function wa(e,n,t,i,r,l){const o=n.tagStart===Le?"":e.source.slice(n.tagStart,n.tagEnd),s=o===""||o==="!"?r:Cr(o,e.tagHandlers);return{tagName:s,tag:ps(e,t,i,s,l)}}function Ar(e){return e.nodeKind==="mapping"}function Sa(e,n,t,i){for(const r of i.keys(t)){if(e.maxTotalMergeKeys!==-1&&++e.totalMergeKeys>e.maxTotalMergeKeys&&D(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&&D(e,l),(n.overridable??=new Set).add(r)}}function gs(e,n,t,i){if(e.position=n.keyPosition,Ar(i))Sa(e,n,t,i);else if(i.nodeKind==="sequence"&&Array.isArray(t))for(const r of t)Sa(e,n,r,n.tag);else D(e,"cannot merge mappings; the provided source object is unacceptable")}function _s(e,n,t,i,r){if(e.position=n.keyPosition,t===Ii){gs(e,n,i,r);return}!e.json&&n.tag.has(n.value,t)&&!n.overridable?.has(t)&&D(e,"duplicated mapping key");const l=n.tag.addPair(n.value,t,i);l&&D(e,l),n.overridable?.delete(t)}function Dt(e,n,t){const i=e.frames[e.frames.length-1];if(i.kind==="document")i.value=n,i.hasValue=!0;else if(i.kind==="sequence"){i.merge&&(Ar(t)||D(e,"cannot merge mappings; the provided source object is unacceptable"));const r=i.tag.addItem(i.value,n,i.index++);r&&D(e,r)}else if(i.hasKey){const r=i.key;i.key=void 0,i.hasKey=!1,_s(e,i,r,n,t)}else i.key=n,i.keyPosition=e.position,i.hasKey=!0}function Ut(e,n,t,i,r){if(n.anchorStart!==Le){const l={value:t,tag:i,isValueFinal:r};return e.anchors.set(e.source.slice(n.anchorStart,n.anchorEnd),l),l}return null}function ms(e,n){const t={...Li,...n,events:e,documents:[],eventIndex:0,position:0,frames:[],anchors:new Map,tagHandlers:Object.create(null),totalMergeKeys:0,aliasCount:0};for(;t.eventIndex<t.events.length;){const i=t.events[t.eventIndex++];switch(t.position=hs(i),i.type){case 1:t.anchors=new Map,t.aliasCount=0,t.tagHandlers=Object.create(null);for(const r of i.directives)r.kind==="tag"&&(t.tagHandlers[r.handle]=r.prefix);t.frames.push({kind:"document",position:t.position,value:void 0,hasValue:!1});break;case 4:{const{value:r,tag:l}=vs(t,i);Ut(t,i,r,l,!0),Dt(t,r,l);break}case 2:{const r=wa(t,i,t.schema.exact.sequence,t.schema.prefix.sequence,"tag:yaml.org,2002:seq","sequence"),l=r.tag.create(r.tagName),o=Ut(t,i,l,r.tag,r.tag.carrierIsResult),s=t.frames[t.frames.length-1],u=s!==void 0&&s.kind==="mapping"&&s.hasKey&&s.key===Ii;t.frames.push({kind:"sequence",position:t.position,value:l,tag:r.tag,anchor:o,index:0,merge:u});break}case 3:{const r=wa(t,i,t.schema.exact.mapping,t.schema.prefix.mapping,"tag:yaml.org,2002:map","mapping"),l=r.tag.create(r.tagName),o=Ut(t,i,l,r.tag,r.tag.carrierIsResult);t.frames.push({kind:"mapping",position:t.position,value:l,tag:r.tag,anchor:o,key:void 0,keyPosition:t.position,hasKey:!1,overridable:null});break}case 5:{t.maxAliases!==-1&&++t.aliasCount>t.maxAliases&&D(t,`aliases exceeded maxAliases (${t.maxAliases})`);const r=t.source.slice(i.anchorStart,i.anchorEnd),l=t.anchors.get(r);l||D(t,`unidentified alias "${r}"`),l.isValueFinal||D(t,`recursive alias "${r}" is not supported for tag ${l.tag.tagName} because it uses finalize()`),Dt(t,l.value,l.tag);break}case 6:{const r=t.frames.pop();if(r.kind==="mapping"&&r.hasKey&&(t.position=r.keyPosition,D(t,"incomplete mapping pair in event stream")),r.kind==="document")t.documents.push(r.value);else{const l=r.tag.carrierIsResult?r.value:Tr(t,r.position,r.tag,r.value);r.anchor&&(r.anchor.value=l,r.anchor.isValueFinal=!0),Dt(t,l,r.tag)}break}}}return t.documents}var C=-1,xr=Object.prototype.hasOwnProperty,Be=1,Zt=2,Nr=3,Gn=4,ys=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,bs=/[,\[\]{}]/,Er=/^(?:!|!!|![0-9A-Za-z-]+!)$/,Qt=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]])`,Ir=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$.~*'()_])`,ks=new RegExp(`^(?:${Qt})*$`),ws=new RegExp(`^(?:${Ir})+$`),Ss=new RegExp(`^(?:!(?:${Qt})*|${Ir}(?:${Qt})*)$`),Ri={filename:"",maxDepth:100};function Cs(e,n,t){e.events.push({type:1,explicitStart:n,explicitEnd:t,directives:e.directives})}function $r(e,n,t,i,r,l,o){e.events.push({type:2,start:n,anchorStart:t,anchorEnd:i,tagStart:r,tagEnd:l,style:o})}function ei(e,n,t,i,r,l,o){e.events.push({type:3,start:n,anchorStart:t,anchorEnd:i,tagStart:r,tagEnd:l,style:o})}function Ca(e,n){e.events.splice(n.eventsLength,0,{type:3,start:n.position,anchorStart:C,anchorEnd:C,tagStart:C,tagEnd:C,style:2})}function Ke(e,n,t,i,r,l,o,s,u=1,c=-1,d=!1){e.events.push({type:4,valueStart:n,valueEnd:t,anchorStart:i,anchorEnd:r,tagStart:l,tagEnd:o,style:s,chomping:u,indent:c,fast:d})}function Ts(e,n,t){e.events.push({type:5,anchorStart:n,anchorEnd:t})}function Re(e){e.events.push({type:6})}function F(e){Ke(e,C,C,C,C,C,C,1)}function Ta(){return{anchorStart:C,anchorEnd:C,tagStart:C,tagEnd:C}}function en(e){return{position:e.position,line:e.line,lineStart:e.lineStart,lineIndent:e.lineIndent,firstTabInLine:e.firstTabInLine,eventsLength:e.events.length}}function Fe(e,n){e.position=n.position,e.line=n.line,e.lineStart=n.lineStart,e.lineIndent=n.lineIndent,e.firstTabInLine=n.firstTabInLine,e.events.length=n.eventsLength}function m(e,n){wt(e.input.slice(0,e.length),e.position,n,e.filename)}function O(e){return e===10||e===13}function me(e){return e===9||e===32}function H(e){return me(e)||O(e)}function G(e){return e===0||H(e)}function ye(e){return e===44||e===91||e===93||e===123||e===125}function As(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 Ns(e){return e===120?2:e===117?4:e===85?8:0}function Es(e){return e===48||e===97||e===98||e===116||e===9||e===110||e===118||e===102||e===114||e===101||e===32||e===34||e===47||e===92||e===78||e===95||e===76||e===80}function Jn(e){e.input.charCodeAt(e.position)===10?e.position++:(e.position++,e.input.charCodeAt(e.position)===10&&e.position++),e.line++,e.lineStart=e.position,e.lineIndent=0,e.firstTabInLine=-1}function M(e,n){let t=0,i=e.input.charCodeAt(e.position),r=e.position===e.lineStart||H(e.input.charCodeAt(e.position-1));for(;i!==0;){for(;me(i);)r=!0,i===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(n&&r&&i===35)do i=e.input.charCodeAt(++e.position);while(!O(i)&&i!==0);if(!O(i))break;for(Jn(e),t++,r=!0,i=e.input.charCodeAt(e.position);i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position)}return t}function se(e,n=e.position){const t=e.input.charCodeAt(n);if((t===45||t===46)&&t===e.input.charCodeAt(n+1)&&t===e.input.charCodeAt(n+2)){const i=e.input.charCodeAt(n+3);return i===0||H(i)}return!1}function Aa(e){let n=e.input.charCodeAt(e.position);for(;n!==0&&!O(n);)n=e.input.charCodeAt(++e.position)}function Or(e,n,t){ys.test(e.input.slice(n,t))&&m(e,"the stream contains non-printable characters")}function Is(e,n,t){if(e.input.charCodeAt(e.position)!==33)return!1;n.tagStart!==C&&m(e,"duplication of a tag property");const i=e.position;let r=!1,l=!1,o="!",s=e.input.charCodeAt(++e.position);s===60?(r=!0,s=e.input.charCodeAt(++e.position)):s===33&&(l=!0,o="!!",s=e.input.charCodeAt(++e.position));let u=e.position,c;if(r){for(;s!==0&&s!==62;)s=e.input.charCodeAt(++e.position);s!==62&&m(e,"unexpected end of the stream within a verbatim tag"),c=e.input.slice(u,e.position),e.position++}else{for(;s!==0&&!H(s)&&!(t&&ye(s));)s===33&&(l?m(e,"tag suffix cannot contain exclamation marks"):(o=e.input.slice(u-1,e.position+1),Er.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),bs.test(c)&&m(e,"tag suffix cannot contain flow indicator characters")}return c&&!(r?ks.test(c):ws.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 $s(e,n){if(e.input.charCodeAt(e.position)!==38)return!1;n.anchorStart!==C&&m(e,"duplication of an anchor property"),e.position++;const t=e.position;for(;e.input.charCodeAt(e.position)!==0&&!H(e.input.charCodeAt(e.position))&&!ye(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 Os(e,n){if(e.input.charCodeAt(e.position)!==42)return!1;(n.anchorStart!==C||n.tagStart!==C)&&m(e,"alias node should not have any properties"),e.position++;const t=e.position;for(;e.input.charCodeAt(e.position)!==0&&!H(e.input.charCodeAt(e.position))&&!ye(e.input.charCodeAt(e.position));)e.position++;return e.position===t&&m(e,"name of an alias node must contain at least one character"),Ts(e,t,e.position),!0}function ni(e,n){M(e,!1),e.lineIndent<n&&m(e,"deficient indentation")}function Ps(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++,Ke(e,i,o,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,2,1,-1,r),!0}O(l)?(r=!1,ni(e,n)):e.position===e.lineStart&&se(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 Ls(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++,Ke(e,i,o,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,3,1,-1,r),!0}if(l===92){r=!1;const o=e.input.charCodeAt(++e.position);if(O(o))ni(e,n);else if(Es(o))e.position++;else{let s=Ns(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 O(l)?(r=!1,ni(e,n)):e.position===e.lineStart&&se(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 Rs(e,n,t){const i=e.input.charCodeAt(e.position);let r=1,l=-1,o=!1;if(i!==124&&i!==62)return!1;const s=i===124?4:5;for(e.position++;e.input.charCodeAt(e.position)!==0;){const p=e.input.charCodeAt(e.position),v=As(p);if(p===43||p===45)r!==1&&m(e,"repeat of a chomping mode identifier"),r=p===43?3:2,e.position++;else if(v>=0)v===0&&m(e,"bad explicit indentation width of a block scalar; it cannot be less than one"),o&&m(e,"repeat of an indentation width identifier"),l=n+v-1,o=!0,e.position++;else break}let u=!1;for(;me(e.input.charCodeAt(e.position));)u=!0,e.position++;u&&e.input.charCodeAt(e.position)===35&&Aa(e),O(e.input.charCodeAt(e.position))?Jn(e):e.input.charCodeAt(e.position)!==0&&m(e,"a line break is expected");let c=o?l:-1,d=0;const g=e.position;let f=e.position;for(;e.input.charCodeAt(e.position)!==0;){const p=e.position;let v=0;for(;e.input.charCodeAt(p+v)===32;)v++;const _=e.input.charCodeAt(p+v);if(_===0){c>=0?v>c&&(f=p+v):v>0&&(f=p+v);break}if(p===e.lineStart&&se(e,p))break;if(!o&&c===-1&&O(_)&&(d=Math.max(d,v)),!o&&c===-1&&!O(_)&&(_===9&&v<n&&(e.position=p+v,m(e,"tab characters must not be used in indentation")),v<d&&(e.position=p+v,m(e,"bad indentation of a mapping entry"))),c===-1&&_!==0&&!O(_)&&v<n){e.lineIndent=v,e.position=p+v;break}!o&&_!==0&&!O(_)&&c===-1&&(c=v);const k=c===-1?n+1:c;if(_!==0&&!O(_)&&v<k){e.lineIndent=v,e.position=p+v;break}Aa(e),f=e.position,O(e.input.charCodeAt(e.position))&&(Jn(e),f=e.position)}return Or(e,g,f),Ke(e,g,f,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,s,r,c),!0}function Fs(e,n){const t=e.input.charCodeAt(e.position),i=n===Be;if(t===0||H(t)||t===35||t===38||t===42||t===33||t===124||t===62||t===39||t===34||t===37||t===64||t===96||i&&ye(t))return!1;if(t===63||t===45){const r=e.input.charCodeAt(e.position+1);if(G(r)||i&&ye(r))return!1}return!0}function Ms(e,n,t,i){if(!Fs(e,t))return!1;const r=e.position;let l=e.position,o=e.input.charCodeAt(e.position);const s=t===Be;let u=!1;for(;o!==0&&!(e.position===e.lineStart&&se(e));){if(o===58){const c=e.input.charCodeAt(e.position+1);if(G(c)||s&&ye(c))break}else if(o===35){if(H(e.input.charCodeAt(e.position-1)))break}else{if(s&&ye(o))break;if(O(o)){const c=e.position,d=e.line,g=e.lineStart,f=e.lineIndent;if(M(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}}me(o)||(l=e.position+1),o=e.input.charCodeAt(++e.position)}return l===r?!1:(Or(e,r,l),Ke(e,r,l,i.anchorStart,i.anchorEnd,i.tagStart,i.tagEnd,1,1,-1,!u),!0)}function Ge(e,n){const t=e.line;M(e,!0),(e.line>t&&e.lineIndent<n||e.firstTabInLine!==-1&&e.lineIndent<n)&&m(e,"deficient indentation")}function js(e,n,t){const i=e.input.charCodeAt(e.position),r=i===123,l=e.position;let o=!0;if(i!==91&&i!==123)return!1;const s=r?125:93;for(r?ei(e,l,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,2):$r(e,l,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,2),e.position++;e.input.charCodeAt(e.position)!==0;){Ge(e,n);let u=e.input.charCodeAt(e.position);if(u===s)return e.position++,Re(e),!0;o?u===44&&m(e,"expected the node content, but found ','"):m(e,"missed comma between flow collection entries");let c=!1,d=!1;u===63&&H(e.input.charCodeAt(e.position+1))&&(c=d=!0,e.position+=1,Ge(e,n));const g=e.line,f=en(e),p=ce(e,n,Be,!1,!0);Ge(e,n),u=e.input.charCodeAt(e.position),(r||d||e.line===g)&&u===58?(c=!0,e.position++,Ge(e,n),r||Ca(e,f),p||F(e),ce(e,n,Be,!1,!0)||F(e),Ge(e,n),r||Re(e)):r&&c?(p||F(e),F(e)):r?F(e):c&&(Ca(e,f),p||F(e),F(e),Re(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 xa(e,n,t){if(e.firstTabInLine!==-1||e.input.charCodeAt(e.position)!==45||!G(e.input.charCodeAt(e.position+1)))return!1;for($r(e,e.position,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,1);e.input.charCodeAt(e.position)===45&&G(e.input.charCodeAt(e.position+1));){e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,m(e,"tab characters must not be used in indentation"));const i=e.line;e.position++;const r=M(e,!0)>0;if(e.firstTabInLine!==-1&&e.input.charCodeAt(e.position)===45&&G(e.input.charCodeAt(e.position+1))&&m(e,"bad indentation of a sequence entry"),r&&e.lineIndent<=n?F(e):ce(e,n,Nr,!1,!0),M(e,!0),e.lineIndent<n||e.position>=e.length)break;e.lineIndent>n&&m(e,"bad indentation of a sequence entry"),e.line===i&&e.input.charCodeAt(e.position)===45&&G(e.input.charCodeAt(e.position+1))&&m(e,"bad indentation of a sequence entry")}return Re(e),!0}function Bt(e,n,t,i){let r=!1,l=!1,o=!1,s=!1;if(e.firstTabInLine!==-1)return!1;let u=e.input.charCodeAt(e.position);for(;u!==0;){!r&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,m(e,"tab characters must not be used in indentation"));const c=e.input.charCodeAt(e.position+1),d=e.line;if((u===63||u===58)&&G(c))o||(ei(e,e.position,i.anchorStart,i.anchorEnd,i.tagStart,i.tagEnd,1),o=!0),u===63?(r&&F(e),l=!0,r=!0):(r||(F(e),l=!0),r=!1),e.position+=1,s=!0;else{r&&(F(e),r=!1);const g=en(e);if(!ce(e,t,Zt,!1,!0))break;if(e.line===d){for(u=e.input.charCodeAt(e.position);me(u);)u=e.input.charCodeAt(++e.position);if(u===58){if(u=e.input.charCodeAt(++e.position),G(u)||m(e,"a whitespace character is expected after the key-value separator within a block mapping"),!o){for(Fe(e,g),ei(e,g.position,i.anchorStart,i.anchorEnd,i.tagStart,i.tagEnd,1),o=!0,ce(e,t,Zt,!1,!0),u=e.input.charCodeAt(e.position);me(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?(Fe(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?(Fe(e,g),!1):!0}if(ce(e,n,Gn,!0,s)&&(s=!1),r||s&&(F(e),s=!1),M(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&&F(e),o&&Re(e),!0):!1}function ce(e,n,t,i,r,l=!0){e.depth>=e.maxDepth&&m(e,`nesting exceeded maxDepth (${e.maxDepth})`),e.depth++;let o=1,s=!1,u=!1,c=null;const d=Ta();let g=t===Gn||t===Nr,f=g;const p=g;if(i&&M(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),_=en(e);if(s&&o!==1&&(v===33||v===38))break;if(s&&p&&(d.tagStart!==C||d.anchorStart!==C)&&(v===33||v===38)){const k=en(e),w=n+1;if(Bt(e,e.position-e.lineStart,w,d)&&e.events[k.eventsLength]?.type===3)return e.depth--,!0;Fe(e,k)}if(s&&(v===33&&d.tagStart!==C||v===38&&d.anchorStart!==C)||!Is(e,d,t===Be)&&!$s(e,d))break;c===null&&(c=_),M(e,!0)?(s=!0,f=p,e.lineIndent>n?o=1:e.lineIndent===n?o=0:o=-1):f=!1}if(f&&(f=s||r),o===1||t===Gn){const v=t===Be||t===Zt?n:n+1,_=e.position-e.lineStart;if(o===1)if(f&&(xa(e,_,d)||Bt(e,_,v,d))||js(e,v,d))u=!0;else{const k=e.input.charCodeAt(e.position);if(c!==null&&l&&p&&!f&&k!==124&&k!==62){const w=en(e),b=c.position-c.lineStart;Fe(e,c),Bt(e,b,v,Ta())&&e.events[w.eventsLength]?.type===3?u=!0:Fe(e,w)}!u&&(g&&Rs(e,v,d)||Ps(e,v,d)||Ls(e,v,d)||Os(e,d)||Ms(e,v,t,d))&&(u=!0)}else o===0&&(u=f&&xa(e,_,d))}return g=g&&!u,!u&&(d.anchorStart!==C||d.tagStart!==C||g)&&(Ke(e,C,C,d.anchorStart,d.anchorEnd,d.tagStart,d.tagEnd,1),u=!0),e.depth--,u||d.anchorStart!==C||d.tagStart!==C}function Ds(e){if(e.lineIndent>0||e.input.charCodeAt(e.position)!==37)return!1;e.position++;const n=e.position;for(;e.input.charCodeAt(e.position)!==0&&!H(e.input.charCodeAt(e.position));)e.position++;const t=e.input.slice(n,e.position),i=[];for(t.length===0&&m(e,"directive name must not be less than one character in length");e.input.charCodeAt(e.position)!==0&&!O(e.input.charCodeAt(e.position));){for(;me(e.input.charCodeAt(e.position));)e.position++;if(e.input.charCodeAt(e.position)===35||O(e.input.charCodeAt(e.position))||e.input.charCodeAt(e.position)===0)break;const r=e.position;for(;e.input.charCodeAt(e.position)!==0&&!H(e.input.charCodeAt(e.position));)e.position++;i.push(e.input.slice(r,e.position))}if(O(e.input.charCodeAt(e.position))&&Jn(e),t==="YAML"){e.directives.some(l=>l.kind==="yaml")&&m(e,"duplication of %YAML directive"),i.length!==1&&m(e,"YAML directive accepts exactly one argument");const r=/^([0-9]+)\.([0-9]+)$/.exec(i[0]);r===null&&m(e,"ill-formed argument of the YAML directive"),parseInt(r[1],10)!==1&&m(e,"unacceptable YAML version of the document"),e.directives.push({kind:"yaml",version:i[0]})}else if(t==="TAG"){i.length!==2&&m(e,"TAG directive accepts exactly two arguments");const[r,l]=i;Er.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`),Ss.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 Us(e){e.directives=[],e.tagHandlers=Object.create(null);let n=!1;for(M(e,!0);Ds(e);)n=!0,M(e,!0);let t=!1,i=!1,r=!0;if(e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45&&G(e.input.charCodeAt(e.position+3))){t=!0;const s=e.line;e.position+=3,M(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&&se(e)){e.position+=3,M(e,!0);return}if(Cs(e,t,!1),ce(e,e.lineIndent-1,Gn,!1,r,r)||F(e),M(e,!0),e.position===e.lineStart&&se(e)&&(i=e.input.charCodeAt(e.position)===46,i)){const s=e.line;e.position+=3,M(e,!0),e.line===s&&e.position<e.length&&m(e,"end of the stream or a document separator is expected")}const o=e.events[l];o?.type===1&&(o.explicitEnd=i),Re(e),!i&&e.position<e.length&&!(e.position===e.lineStart&&se(e))&&m(e,"end of the stream or a document separator is expected")}function Bs(e,n){const t=e.length,i={...Ri,...n,input:`${e}\0`,length:t,position:0,line:0,lineStart:0,lineIndent:0,firstTabInLine:-1,depth:0,directives:[],tagHandlers:Object.create(null),events:[]},r=e.indexOf("\0");for(r!==-1&&wt(e,r,"null byte is not allowed in input",i.filename),i.input.charCodeAt(i.position)===65279&&i.position++;i.position<i.length&&(M(i,!0),!(i.position>=i.length));){const l=i.position;Us(i),i.position===l&&m(i,"can not read a document")}return i.events}var zs={...Ri,...Li};function Ws(e,n={}){const t={...zs,...n},i=String(e),r=Object.keys(Ri),l=Object.keys(Li);return ms(Bs(i,_a(t,r)),{..._a(t,l),source:i})}function Hs(e,n){const t=Ws(e,n);if(t.length===0)throw new qn("expected a document, but the input is empty");if(t.length===1)return t[0];throw new qn("expected a single document in the stream, but found more")}ns.withTags({...Jt,resolve:(e,n,t)=>{const i=Jt.resolve(e,n,t);return i===S?yr.resolve(e,n,t):i}},{...Xt,resolve:(e,n,t)=>{const i=Xt.resolve(e,n,t);return i===S?br.resolve(e,n,t):i}});function Ys(e){if(e.trim()==="")return{};const t=Hs(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 Na={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"},Ea={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"]},Ks=[{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"]}],Ia=[{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 Pr(e={}){return e.extended===!0?[Na,Ea,...Ks,...Ia]:[Na,Ea,...Ia]}function St(e,n={}){const t=Pr(n),i=Math.max(0,Math.min(t.length-1,e));return t[i]}function qs(e){const n={},t=i=>{n[i]=!0;const r=e.clusterOf.get(i);r!==void 0&&(n[r]=!0)};for(const i of e.installed)t(i);for(const i of e.roleDefaults)t(i);for(const i of e.detected)t(i);return n}function Vs(e,n){const t=new Set(n);return e.filter(i=>i!=="engineering-base"&&!t.has(i)).sort()}function Gs(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(B=>B.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 Js({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 Xs({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(Js,{current:n,total:t})]})}function Zs(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 Lr(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 Qs(e,n){return e.kind==="userMd"?n==="body"||n.startsWith("body."):Lr(e,n)}function ec(e,n){for(const t of Object.keys(n.errors))if(Qs(e,t))return!0;return!1}function nc(e,n){if(ec(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=>Lr(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 tc(e){const n=e.steps.filter((s,u)=>u!==e.currentIndex),t=e.packRemovals??[],i=e.selectedToolIds??[],r=e.packAdditions??[],l=e.changes.length,o=i.length>0||r.length>0||l>0||e.userMdChanged;return a(L,{children:[o?a("section",{class:"ac-review-summary","aria-label":"What happens on Finish",children:[a("h2",{class:"ac-review-summary__title",children:"What happens on Finish"}),a("ul",{class:"ac-review-summary__list",children:[l>0?a("li",{children:[a("strong",{children:l})," setting",l===1?"":"s"," will change"," ","in ",a("code",{children:".agent-settings.yml"}),"."]}):a("li",{children:"No settings change."}),e.userMdChanged?a("li",{children:[a("code",{children:".agent-user.yml"})," will be"," ",e.userMdAction==="create"?"created":"updated","."]}):null,i.length>0?a("li",{children:["Config is installed for ",i.length," tool",i.length===1?"":"s",":",a("span",{class:"ac-review-summary__chips",children:i.map(s=>a("code",{class:"ac-review-summary__chip",children:s},s))})]}):null,r.length>0?a("li",{children:["New pack",r.length===1?"":"s",":",a("span",{class:"ac-review-summary__chips",children:r.map(s=>a("code",{class:"ac-review-summary__chip",children:s},s))})]}):null]})]}):null,t.length>0?a("div",{class:"ac-review-removals",role:"alert",children:[a("p",{class:"ac-review-removals__title",children:["⚠️ ",t.length===1?"1 installed pack will be removed":`${t.length} installed packs will be removed`]}),a("ul",{class:"ac-review-removals__list",children:t.map(s=>a("li",{children:a("code",{children:s})},s))}),a("label",{class:"ac-review-removals__confirm",children:[a("input",{type:"checkbox",checked:e.removalsConfirmed??!1,onChange:s=>{e.onConfirmRemovals?.(s.currentTarget.checked)}}),a("span",{children:"I understand these packs will no longer be installed. Re-check them on the packs step to keep them."})]})]}):null,a("nav",{class:"ac-wizard__review-nav","aria-label":"Jump back to a step",children:[a("p",{class:"ac-wizard__review-nav-label",children:"Jump back to a step:"}),a("ul",{class:"ac-wizard__review-nav-list",children:n.map(s=>{const u=e.steps.indexOf(s),c=nc(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 ic(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 ac(){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 rc(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 lc=[{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 oc({text:e}){const[n,t]=Ni(!1);return a("button",{type:"button",class:"ac-button ac-checklist__copy",onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{t(!0),setTimeout(()=>{t(!1)},1500)})},children:n?"Copied ✓":"Copy"})}function sc({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:lc.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(oc,{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 Rr=h(!1),nn=h(null),x=h(null),Xn=h(!1),Zn=h(!1),be=h(0),Fi=h(null),W=h({}),Fr=h({}),Mr=h(0),Me=h({}),$=h(null),ue=h(null),Mi=h(!1),ti=h(!1),Ct=h(!1),jr=h({}),Tt=h([]);h("global");const Ie=h(!1),j=h(!1),cc=h(!1),Qn=h(!1),et=h(null),ji=h([]),nt=h({}),tt=h(!0),it=h(""),at=h("agents");h(!1);const Dr=h(null),uc=[{id:"claude-code",label:"Claude Code"},{id:"claude-desktop",label:"Claude Desktop"},{id:"cursor",label:"Cursor"},{id:"windsurf",label:"Windsurf"},{id:"cline",label:"Cline"},{id:"gemini-cli",label:"Gemini CLI"},{id:"copilot",label:"GitHub Copilot"},{id:"augment",label:"Augment"},{id:"aider",label:"Aider"},{id:"codex",label:"Codex"},{id:"roocode",label:"Roo Code"},{id:"continue",label:"Continue"},{id:"kilocode",label:"Kilo Code"},{id:"zed",label:"Zed"},{id:"jetbrains",label:"JetBrains"},{id:"kiro",label:"Kiro"},{id:"qoder",label:"Qoder"},{id:"opencode",label:"OpenCode"},{id:"trae",label:"Trae"},{id:"antigravity",label:"Antigravity"},{id:"codebuddy",label:"CodeBuddy"},{id:"droid",label:"Droid"},{id:"warp",label:"Warp"}],ii=h(!1),je=h(!1),de=h(null),At=h([]),xt=h([]),ke=h([]),ai=h(!1),bn=h([]),Z=h({}),Ur=h(!1),ri=h(!1),$n=h(!1),Di=h({}),$a=h(!1),Br=h(null),zr=h(null),Wr=h(null),Hr=h(null),li=h(null),Yr=h(null),oi=h("https://github.com/rtk-ai/rtk"),si=h(!1),Kr=h(null),dc=h(null),ci=h(null),qr=h("event4u-app/agent-switch"),Ui=h(!1);h(!1);h(null);h([]);h({});h({});const ee=h({}),ae=h({}),ui=h(!1),Oa=h(!1);h({});h(null);h(null);h(!1);h(null);const rt=h(null),Vr=h(!1),di=h(null),fi=h(!1),hi=h(!1),pi=h(null),De=h(null),On=h(!1),Bi=h(!1);function Gr(){return Pr({extended:j.value})}function ze(){return Gr().length}function fc(e){return e??new Date().toISOString()}function zi(e){return Math.max(0,Math.min(ze()-1,e))}function hc(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 pc(){try{return await y("/api/v1/settings")}catch(e){if(e instanceof E&&e.status===404&&e.body.error?.code==="NOT_FOUND"){const n=e.body;if(n.defaults!==void 0&&n.schema!==void 0)return{values:n.defaults,lastModified:n.lastModified??0,path:n.path??".agent-settings.yml",schema:n.schema};const t=await y("/api/v1/schema");return{values:{},lastModified:0,path:".agent-settings.yml",schema:t.settings}}throw e}}async function vc(){try{const e=await y("/api/v1/install/recovery");rt.value=e.incomplete?e:null}catch{rt.value=null}}async function gc(){try{const e=await y("/api/v1/install/legacy-v3");di.value=e.present?e:null}catch{di.value=null}}async function _c(){hi.value=!0,pi.value=null;try{await y("/api/v1/install/backup-v3",{method:"POST"}),fi.value=!0}catch(e){pi.value=e instanceof E?z(e.body.error??{code:"UNKNOWN",message:e.message}):e instanceof Error?e.message:String(e)}finally{hi.value=!1}}async function zt(e){try{await y("/api/v1/install/recovery/dismiss",{method:"POST",body:{reason:e}})}catch(n){x.value={message:n instanceof Error?n.message:String(n),tone:"error"};return}rt.value=null,Vr.value=!0}async function mc(){nn.value=null;try{vc(),gc();const[e,n]=await Promise.all([y("/api/v1/wizard/state"),pc()]);Fi.value=hc(n.schema),Mr.value=n.lastModified,Fr.value=n.values,jr.value=n.legacyHints??{},j.value=e.extendedSteps===!0,De.value=e.wizardMode??null;const t=Object.keys(e.partial??{});W.value=t.length>0?{...n.values,...e.partial}:n.values,be.value=zi(e.step),Ie.value=!1,Rr.value=!0;const i=St(be.value,{extended:j.value});(i.kind==="welcome"||i.kind==="userMd"||i.kind==="review")&&Wi(),(i.kind==="roles"||i.kind==="aiTools"||i.kind==="packs")&&kn(),i.kind==="roles"&&Hi(),i.kind==="aiTools"&&Nt(),i.id==="identity"&&(Jr(),Xr()),i.kind==="review"&&Zr()}catch(e){e instanceof E?nn.value=z(e.body.error??{code:"UNKNOWN",message:e.message}):nn.value=e instanceof Error?e.message:String(e)}}function yc(e,n){return e.identity.name.trim()!==""?e:{...e,identity:{...e.identity,name:n}}}async function Wi(){if(!ti.value)try{const e=await y("/api/v1/user-md");if(Mi.value=e.exists,e.exists&&e.identity!==null){const n=va(e.identity);ue.value=n,$.value=n}else{let n;try{const i=await y("/api/v1/user-md/template");n=va(Ys(i.body))}catch{n=mr()}const t=jr.value.user_name;typeof t=="string"&&t.trim()!==""&&(n=yc(n,t)),ue.value=n,$.value=n}}catch(e){x.value={message:e instanceof Error?e.message:String(e),tone:"error"}}finally{ti.value=!0}}const bc=new Set(["python"]);async function kn(){if(!(ii.value||je.value)){je.value=!0,de.value=null;try{const[e,n]=await Promise.all([y("/api/v1/wizard/manifest"),y("/api/v1/wizard/auto-detect")]),t=(e.packs??[]).map(l=>({id:l.id,label:l.label??l.id,description:l.description??"",requires_hint:l.requires_hint,cluster:l.cluster??void 0,workspaces:l.workspaces}));At.value=t,bn.value=(e.workspaces??[]).filter(l=>l.id!=="agent-config-maintainer").map(l=>({id:l.id,label:l.label??l.id,description:l.description??"",default_packs:l.default_packs??[],optional_packs:l.optional_packs??[],...l.example_roles!==void 0?{example_roles:l.example_roles}:{}}));const i=new Set(t.map(l=>l.id)),r=n.signals.map(l=>l.id.startsWith("pack-")?l.id.slice(5):l.id).filter(l=>i.has(l)).filter(l=>!bc.has(l));xt.value=r,ke.value=(e.installedPacks??[]).filter(l=>i.has(l))}catch(e){e instanceof E?de.value=z(e.body.error??{code:"UNKNOWN",message:e.message}):de.value=e instanceof Error?e.message:String(e)}finally{je.value=!1,ii.value=!0}}}async function Nt(){if(!(ri.value||$n.value)){$n.value=!0;try{const e=await y("/api/v1/wizard/detect-tools"),n=e.tools??{},t=e.configured??[];if(Di.value=n,Object.keys(ee.value).length===0){const i={};if(t.length>0)for(const r of t)i[r]=!0;else for(const[r,l]of Object.entries(n))l&&(i[r]=!0);ee.value=i}}catch{}finally{$n.value=!1,ri.value=!0}}}async function Jr(){if(!$a.value){$a.value=!0;try{const e=await y("/api/v1/wizard/detect-rtk"),n=e.installed===!0;Br.value=n,zr.value=e.present===!0,Wr.value=e.identity??null,Hr.value=e.version??null,li.value=e.installCommand??null,Yr.value=e.installCommands??null,typeof e.repo=="string"&&(oi.value=e.repo);const t=W.value.personal??{};W.value={...W.value,personal:{...t,rtk_installed:n}}}catch{}}}async function Xr(){if(!si.value){si.value=!0;try{const e=await y("/api/v1/wizard/detect-agent-switch");Kr.value=e.installed===!0,dc.value=e.version??null,ci.value=e.installCommand??null,typeof e.repo=="string"&&(qr.value=e.repo),Ui.value=e.dismissed===!0}catch{}}}async function kc(e,n){try{await y("/api/v1/wizard/state",{method:"POST",body:{step:e,totalSteps:ze(),partial:n,startedAt:fc(null)}})}catch(t){x.value={message:t instanceof Error?t.message:String(t),tone:"error"}}}async function Zr(){Zn.value=!0;try{const e=await y("/api/v1/settings/diff",{method:"POST",body:{values:W.value,ifUnmodifiedSince:Mr.value}});Tt.value=e.changes,Me.value={}}catch(e){e instanceof E?(Me.value=mt(e.body.error??{message:e.message}),x.value={message:z(e.body.error??{code:"UNKNOWN",message:e.message}),tone:"error"}):x.value={message:e instanceof Error?e.message:String(e),tone:"error"}}finally{Zn.value=!1}}function lt(){return Ct.value?!1:$.value===null||ue.value===null?$.value!==ue.value:JSON.stringify($.value)!==JSON.stringify(ue.value)}async function $e(e){const n=zi(e);await kc(n,W.value),be.value=n,x.value=null;const t=St(n,{extended:j.value});(t.kind==="welcome"||t.kind==="userMd")&&Wi(),(t.kind==="roles"||t.kind==="aiTools"||t.kind==="packs")&&kn(),t.kind==="roles"&&Hi(),t.kind==="packs"&&It(),t.kind==="aiTools"&&Nt(),t.id==="identity"&&(Jr(),Xr()),t.kind==="review"&&Zr()}function Et(){const e=ae.value,n=new Map(At.value.map(l=>[l.id,l])),t=Object.entries(e).filter(([,l])=>l===!0).map(([l])=>l).filter(l=>{const o=n.get(l)?.cluster;return o===void 0||e[o]===!0}),i=new Set,r=l=>{if(!i.has(l)){i.add(l);for(const o of n.get(l)?.requires_hint??[])r(o)}};for(const l of t)r(l);return[...i].sort()}async function Hi(){if(await Promise.all([kn(),Wi()]),Ur.value||Object.values(Z.value).some(Boolean))return;const e=$.value?.role??[];if(e.length===0)return;const n=new Set(bn.value.map(i=>i.id)),t={};for(const i of e)n.has(i)&&(t[i]=!0);Object.keys(t).length!==0&&(Z.value=t,It())}function It(){if(ui.value)return;const e=Object.entries(Z.value).filter(([,r])=>r===!0).map(([r])=>r),n=new Map(bn.value.map(r=>[r.id,r])),t=[];for(const r of e)for(const l of n.get(r)?.default_packs??[])t.push(l);const i=new Map;for(const r of At.value)r.cluster!==void 0&&i.set(r.id,r.cluster);ae.value=qs({installed:ke.value,roleDefaults:t,detected:xt.value,clusterOf:i})}function wc(){const e=Object.entries(ee.value).filter(([,i])=>i===!0).map(([i])=>i);if(e.length===0)return null;const n=Et(),t={schema_version:"wizard-v2",tools:e,packs:n,settings:W.value};return _e.value?.dryRun===!0&&(t.dry_run=!0),t}async function Sc(){Xn.value=!0,x.value=null;try{const e={settings:W.value},n=Object.entries(Z.value).filter(([,u])=>u===!0).map(([u])=>u),t=$.value!==null&&typeof $.value.identity?.name=="string"&&$.value.identity.name.trim().length>0;$.value!==null&&t&&(lt()||n.length>0)&&(e.identity=n.length>0?{...$.value,role:n}:$.value);const i=await y("/api/v1/wizard/finish",{method:"POST",body:e}),r="You can close this browser window now.",l=i.dryRun===!0?"Dry-run complete — no files written. Settings would be saved.":Array.isArray(i.writtenPaths)?`Saved (${i.writtenPaths.join(", ")}). Wizard complete.`:"Wizard complete.",o=j.value?wc():null;let s="";if(o!==null&&o.dry_run===!0)try{await y("/api/v1/wizard/apply",{method:"POST",body:o}),s=" Installer preview OK (dry-run) — no files written."}catch(u){s=` Installer preview failed: ${u instanceof E?z(u.body.error??{code:"UNKNOWN",message:u.message}):u instanceof Error?u.message:String(u)}.`}else if(o!==null)try{let u=null;await Pl("/api/v1/wizard/apply",o,g=>{g.type==="error"&&(u=typeof g.message=="string"?g.message:"install failed")});const c=o.tools.length,d=o.packs.length;s=u!==null?` Installer failed: ${u}. Settings were saved; re-run the wizard to retry.`:` Installer applied ${c} tool${c===1?"":"s"}`+(d>0?` and ${d} pack${d===1?"":"s"}.`:".")}catch(u){s=` Installer bridge failed: ${u instanceof E?z(u.body.error??{code:"UNKNOWN",message:u.message}):u instanceof Error?u.message:String(u)}. Settings were saved; re-run the wizard to retry the install plan.`}x.value={message:`${l}${s} ${r}`,tone:"success"},be.value=zi(ze()-1),Fr.value=W.value,ue.value=lt()?$.value:ue.value,Tt.value=[],Ie.value=!0}catch(e){e instanceof E?(Me.value=mt(e.body.error??{message:e.message}),x.value={message:z(e.body.error??{code:"UNKNOWN",message:e.message}),tone:"error"}):x.value={message:e instanceof Error?e.message:String(e),tone:"error"}}finally{Xn.value=!1}}async function Cc(){Bi.value=!0,await Promise.all([kn(),Nt()]),await Hi(),It(),await $e(ze()-1)}function Tc(){ne(()=>{kn(),Nt()},[]);const e=je.value||$n.value||!ii.value||!ri.value,n=Object.values(Di.value).filter(Boolean).length,t=ke.value.length,i=xt.value.filter(r=>!ke.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:()=>{Cc()},children:e?"Detecting…":"Use recommended setup"})]}),a("section",{class:"ac-start__card",children:[a("h2",{class:"ac-start__title",children:"Customize"}),a("p",{class:"ac-start__desc",children:"Walk through every step — tools, roles, packs, behaviour, budgets — and tune each choice yourself."}),a("button",{type:"button",class:"ac-button ac-start__cta",onClick:()=>{Bi.value=!0},children:"Customize step by step"})]})]})}const Ac=["de","en","en-US","en-GB","fr","es","it","nl","pt","pt-BR"];function xc(){if(Oa.value)return;const e=$.value;if(e===null)return;Oa.value=!0;let n=e;if(e.identity.name.trim()===""){const t=_e.value?.systemUser;t!==void 0&&t.trim()!==""&&(n={...n,identity:{...n.identity,name:t}})}if(!Mi.value&&typeof navigator<"u"){const t=(navigator.language||"").split("-")[0];t.length>=2&&(n={...n,language:t})}n!==e&&($.value=n)}function Nc(){const e=$.value;if(ne(()=>{xc()},[e]),e===null)return a("p",{children:"Loading…"});const n=t=>{$.value={...t,last_updated:new Date().toISOString().slice(0,10)},Ct.value=!1};return a("div",{class:"ac-wizard-step-stub ac-wizard__module-fields",children:[a("p",{children:["Tell the agent who you are. We pre-filled what we could detect — adjust freely. Stored in ",a("code",{children:".agent-user.yml"}),"."]}),a("div",{class:"ac-field",children:[a("label",{class:"ac-field__label",for:"welcome-name",children:"Name"}),a("input",{class:"ac-input",id:"welcome-name",type:"text",placeholder:"How should the agent address you?",value:e.identity.name,onInput:t=>n({...e,identity:{...e.identity,name:t.currentTarget.value}})})]}),a("div",{class:"ac-field",children:[a("label",{class:"ac-field__label",for:"welcome-lang",children:"Language"}),a("input",{class:"ac-input",id:"welcome-lang",type:"text",list:"welcome-lang-list",placeholder:"BCP-47 code, e.g. de, en, en-US",value:e.language,onInput:t=>n({...e,language:t.currentTarget.value})}),a("datalist",{id:"welcome-lang-list",children:Ac.map(t=>a("option",{value:t},t))})]})]})}function Ec(){const e=ee.value,n=Di.value;return a("div",{class:"ac-wizard-step-stub",children:[a("p",{children:"Pick the AI tools you use. Tools detected on this machine are pre-selected on first run. The installer wires each selected tool's surface (skills, rules, commands) on apply; you can change this list later by re-running the wizard."}),a("ul",{class:"ac-wizard__tool-list",children:uc.map(t=>{const i=n[t.id]===!0;return a("li",{class:"ac-wizard__tool-row",children:[a("label",{class:"ac-wizard__tool-label",children:[a("input",{type:"checkbox",checked:e[t.id]??!1,onChange:r=>{const l=r.currentTarget.checked;ee.value={...e,[t.id]:l}}})," ",t.label]}),a("span",{class:`ac-badge ${i?"ac-badge--installed":"ac-badge--missing"}`,title:i?"Detected on this machine":"Not detected on this machine",children:i?"installed":"not installed"})]},t.id)})})]})}function Ic(){if(je.value)return a("p",{children:"Loading roles…"});if(de.value!==null)return a("div",{class:"ac-wizard-step-stub",children:a("p",{class:"ac-banner ac-banner--error",children:["Discovery failed: ",de.value]})});const e=Z.value,n=bn.value,t=(i,r)=>{Ur.value=!0,Z.value={...Z.value,[i]:r},It()};return a("div",{class:"ac-wizard-step-stub",children:[a("p",{children:["Pick the areas you work in. We use them to recommend capability packs on the next step, and they become your roles in",a("code",{children:" .agent-user.yml"}),"."]}),n.length===0?a("p",{children:a("em",{children:"No roles available in the manifest."})}):a("div",{class:"ac-wizard__pack-grid",children:n.map(i=>a("section",{class:"ac-pack-tile",children:[a("label",{class:"ac-pack-tile__head",children:[a("input",{type:"checkbox",checked:e[i.id]??!1,onChange:r=>{t(i.id,r.currentTarget.checked)}}),a("span",{class:"ac-pack-tile__title",children:i.label})]}),(i.example_roles??[]).length>0?a("p",{class:"ac-pack-tile__role",children:["e.g. ",(i.example_roles??[]).join(", ")]}):null,i.description!==""?a("p",{class:"ac-pack-tile__desc",children:i.description}):null]},i.id))})]})}function $c(){if(je.value)return a("p",{children:"Loading discovery manifest…"});if(de.value!==null)return a("div",{class:"ac-wizard-step-stub",children:[a("p",{class:"ac-banner ac-banner--error",children:["Discovery failed: ",de.value]}),a("p",{children:"The manifest endpoint is gated on extended-mode. Re-run the server with extended steps enabled to populate this list."})]});const e=ae.value,n=new Set(xt.value),t=new Set(ke.value),i=p=>t.has(p)?a("span",{class:"ac-badge ac-badge--installed",children:"installed"}):n.has(p)?a("span",{class:"ac-badge ac-badge--detected",children:"auto-detected"}):null,r=new Map(bn.value.map(p=>[p.id,p.label])),l=Z.value,o=p=>{const v=(p??[]).filter(_=>_!=="agent-config-maintainer");return v.length===0?null:a("span",{class:"ac-pack-tile__ws",children:v.map(_=>a("span",{class:`ac-badge ac-badge--ws${l[_]===!0?" ac-badge--ws-active":""}`,title:l[_]===!0?"Matches a role you picked":"Workspace / area",children:r.get(_)??_},_))})},s=At.value.filter(p=>p.id!=="engineering-base"),u=new Map;for(const p of s)if(p.cluster!==void 0){const v=u.get(p.cluster)??[];v.push(p),u.set(p.cluster,v)}const c=new Set(s.filter(p=>p.cluster!==void 0).map(p=>p.id)),d=s.filter(p=>!c.has(p.id)),g=(p,v)=>{ui.value=!0,ae.value={...ae.value,[p]:v}},f=(p,v)=>{ui.value=!0;const _={...ae.value,[p]:v};if(v)for(const k of u.get(p)??[])_[k.id]===void 0&&(_[k.id]=!0);ae.value=_};return a("div",{class:"ac-wizard-step-stub",children:[a("p",{children:"Pick the capability packs to install. Auto-detected packs are pre-selected; engineering hygiene is included automatically when a pack needs it. A language tile expands to its frameworks — turn the language off to skip them all."}),d.length===0?a("p",{children:a("em",{children:"No packs available in the manifest."})}):a("div",{class:"ac-wizard__pack-grid",children:d.map(p=>{const v=u.get(p.id)??[],_=v.length>0,k=e[p.id]??!1;return a("section",{class:"ac-pack-tile",children:[a("label",{class:"ac-pack-tile__head",children:[a("input",{type:"checkbox",checked:k,onChange:w=>{const b=w.currentTarget.checked;_?f(p.id,b):g(p.id,b)}}),a("span",{class:"ac-pack-tile__title",children:p.label}),i(p.id)]}),o(p.workspaces),p.description!==""?a("p",{class:"ac-pack-tile__desc",children:p.description}):null,_?a("fieldset",{class:"ac-pack-tile__children",disabled:!k,children:v.map(w=>a("label",{class:"ac-pack-tile__child",children:[a("input",{type:"checkbox",checked:e[w.id]??!1,disabled:!k,onChange:b=>{g(w.id,b.currentTarget.checked)}}),a("span",{children:w.label}),i(w.id)]},w.id))}):null]},p.id)})})]})}function Oc(){const e=Br.value,n=zr.value,t=Wr.value,i=Hr.value,r=Yr.value,l=e===null?a("span",{class:"ac-badge ac-badge--missing",children:"detecting…"}):e?a("span",{class:"ac-badge ac-badge--installed",children:["installed",i!==null?` (v${i})`:""]}):n===!0?a("span",{class:"ac-badge ac-badge--missing",children:t==="unknown-rtk"?"different tool":"unverified"}):a("span",{class:"ac-badge ac-badge--missing",children:"not installed"});return a("div",{class:"ac-rtk-row",children:[a("div",{class:"ac-rtk-row__head",children:[a("span",{class:"ac-rtk-row__label",children:["rtk ",a("small",{children:"(Rust Token Killer — third-party, Apache-2.0)"})]}),l]}),n===!0&&t==="unknown-rtk"?a("div",{class:"ac-rtk-row__install",children:[a("p",{class:"ac-field__description",children:["A binary named ",a("code",{children:"rtk"})," is on PATH, but it is not Rust Token Killer — two unrelated projects share the name (the other is Rust Type Kit). The token-saving integration stays off. See the upstream name-collision guidance:"]}),a("a",{class:"ac-button",href:`${oi.value}/blob/master/INSTALL.md`,target:"_blank",rel:"noreferrer noopener",children:"Open rtk install guide"})]}):null,n===!0&&t==="unverified"?a("p",{class:"ac-field__description",children:["rtk found but the identity check failed — verify manually with ",a("code",{children:"rtk gain"})," (Rust Token Killer renders a token-savings dashboard; the colliding Rust Type Kit does not)."]}):null,n===!1?a("div",{class:"ac-rtk-row__install",children:[a("p",{class:"ac-field__description",children:"rtk wraps verbose CLI output — upstream reports 60–90% token savings (their estimate). Install it, then re-open the wizard to pick up detection:"}),r!==null?a(L,{children:[r.recommendedLabel!==void 0?a("p",{class:"ac-field__description",children:[r.recommendedLabel,":"]}):null,a("code",{class:"ac-rtk-row__cmd",children:r.recommended}),r.manual!==void 0?a(L,{children:[a("p",{class:"ac-field__description",children:[r.manualLabel??"Manual",":"]}),a("code",{class:"ac-rtk-row__cmd",children:r.manual})]}):null,r.note!==void 0?a("p",{class:"ac-field__description",children:r.note}):null]}):li.value!==null?a("code",{class:"ac-rtk-row__cmd",children:li.value}):null,a("a",{class:"ac-button",href:oi.value,target:"_blank",rel:"noreferrer noopener",children:"Open rtk repo"})]}):null]})}async function Pc(){try{await y("/api/v1/wizard/dismiss-recommendation",{method:"POST",body:{id:"agent-switch"}})}catch(e){x.value={message:e instanceof Error?e.message:String(e),tone:"error"};return}Ui.value=!0}function Lc(){return!si.value||Kr.value!==!1||Ui.value?null:a("div",{class:"ac-rtk-row",children:[a("div",{class:"ac-rtk-row__head",children:[a("span",{class:"ac-rtk-row__label",children:["agent-switch ",a("small",{children:"(third-party, MIT)"})]}),a("span",{class:"ac-badge ac-badge--missing",children:"not installed"})]}),a("div",{class:"ac-rtk-row__install",children:[a("p",{class:"ac-field__description",children:["agent-switch isolates multiple agent accounts into per-account profiles (",a("code",{children:"CLAUDE_CONFIG_DIR"}),") so switching accounts never requires a re-login. Free and MIT-licensed."]}),ci.value!==null?a("code",{class:"ac-rtk-row__cmd",children:ci.value}):null,a("a",{class:"ac-button",href:`https://github.com/${qr.value}`,target:"_blank",rel:"noreferrer noopener",children:"Open agent-switch repo"}),a("button",{type:"button",class:"ac-button ac-button--small",onClick:()=>{Pc()},children:"Don't show again"})]})]})}function Rc(){const e=St(be.value,{extended:j.value});if(j.value&&De.value==="install"&&e.id==="identity"&&!On.value)return a(ac,{});if(e.kind==="form"){const t=Gs(Fi.value,e.paths??[]);return a(L,{children:[e.id==="identity"?a(Oc,{}):null,e.id==="identity"?a(Lc,{}):null,a(zl,{schema:t,values:W.value,errors:Me.value,onChange:i=>{W.value=i}})]})}return e.kind==="userMd"?!ti.value||$.value===null?a("p",{children:"Loading .agent-user.yml…"}):a(Kl,{value:$.value,errors:Me.value,hideRole:j.value&&De.value==="install",hideIdentityBasics:j.value&&De.value==="install",onChange:t=>{$.value=t,Ct.value=!1}}):e.kind==="welcome"?a(Nc,{}):e.kind==="aiTools"?a(Ec,{}):e.kind==="roles"?a(Ic,{}):e.kind==="packs"?a($c,{}):a(tc,{steps:Gr(),currentIndex:be.value,changes:Tt.value,errors:Me.value,userMdChanged:lt(),userMdAction:Mi.value?"replace":"create",loading:Zn.value,onJump:t=>{$e(t)},selectedToolsCount:Object.values(ee.value).filter(Boolean).length,selectedPacksCount:Object.values(ae.value).filter(Boolean).length,packRemovals:vi(),removalsConfirmed:ai.value,onConfirmRemovals:t=>{ai.value=t},selectedToolIds:Object.entries(ee.value).filter(([,t])=>t).map(([t])=>t),packAdditions:j.value?Et().filter(t=>t!=="engineering-base"&&!ke.value.includes(t)):[]})}function vi(){return j.value?Vs(ke.value,Et()):[]}function Pa({path:e}){if(ne(()=>{mc()},[]),!Rr.value||Fi.value===null)return a("div",{class:"ac-page",children:[a("h1",{children:"Setup wizard"}),nn.value!==null?a("p",{class:"ac-banner ac-banner--error",children:nn.value}):a("p",{children:"Loading…"})]});const n=be.value,t=ze(),i=St(n,{extended:j.value}),r=n===t-1,l=i.kind==="aiTools"&&Object.values(ee.value).filter(Boolean).length===0||i.kind==="roles"&&Object.values(Z.value).filter(Boolean).length===0||i.kind==="packs"&&Et().length===0,o=j.value&&De.value==="install"&&i.id==="identity"&&!On.value,s=rt.value,u=s!==null&&!Vr.value,c=di.value,d=c!==null&&c.present&&!fi.value,g=j.value&&De.value==="install"&&n===0&&!Bi.value&&!Ie.value;return d?a("div",{class:"ac-page",children:a(rc,{sourcePath:c.path,backupTarget:c.backupTarget,version:c.version,busy:hi.value,error:pi.value,onBackupAndProceed:()=>{_c()},onAbort:()=>{x.value={tone:"info",message:"Aborted. Uninstall v3 manually, then re-run `agent-config install`."},fi.value=!0}})}):g?a("div",{class:"ac-page",children:[a("header",{class:"ac-page__header",children:a("h1",{children:"Set up agent-config"})}),x.value!==null?a("p",{class:`ac-banner${x.value.tone==="error"?" ac-banner--error":""}`,children:x.value.message}):null,a(Tc,{})]}):a("div",{class:"ac-page",children:[a(Xs,{step:i,index:n,total:t}),u?a(ic,{abortedAt:s.abortedAt,abortNote:s.abortNote,writesSinceRollback:s.writesSinceRollback,busy:Xn.value,onResume:()=>{zt("resume")},onRollback:()=>{zt("rollback")},onIgnore:()=>{zt("ignore")}}):null,x.value!==null&&!(Ie.value&&r&&x.value.tone==="success")?a("p",{class:`ac-banner${x.value.tone==="error"?" ac-banner--error":""}`,children:x.value.message}):null,a("div",{class:"ac-wizard__step",children:Ie.value&&r?a(sc,{message:x.value?.tone==="success"?x.value.message:null}):a(Rc,{})}),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(Zs,{canGoPrev:n>0,canGoNext:!r&&!l,canSkip:o||i.kind==="userMd",skipLabel:o?"Finish install here":"Skip",isLast:r,busy:Xn.value||Zn.value,canFinish:(Tt.value.length>0||lt()||vi().length>0||j.value&&Object.values(ee.value).some(Boolean))&&(vi().length===0||ai.value),completed:Ie.value,onPrev:()=>{$e(n-1)},onNext:()=>{if(o){On.value=!0;return}$e(n+1)},onSkip:()=>{if(o){On.value=!0,$e(ze()-1);return}Ct.value=!0,$e(n+1)},onFinish:()=>{Sc()}})]})}const Fc=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 La(e){return Fc.has(e)}function Mc(e,n){return JSON.stringify(e??null)===JSON.stringify(n??null)}function Qr(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||Mc(n,e.old?.default)?"adopt":"review":e.kind==="added"&&e.new?.default===void 0?"must_fix":"info"}const gi=h(!0),ot=h(null),_i=h(!1),$t=h(null),We=h({}),mi=h(0),we=h({}),re=h(null),Q=h(!1),un=h(!1);function fe(e){return`${e.key}:${e.kind}`}async function jc(){gi.value=!0,ot.value=null,_i.value=!1,un.value=!1;try{const e=await y("/api/v1/settings/changes"),n=await y("/api/v1/settings");$t.value=e.delta,We.value=n.values,mi.value=n.lastModified,Dc(e.delta,n.values)}catch(e){e instanceof E&&e.status===404?_i.value=!0:ot.value=e instanceof Error?e.message:String(e)}finally{gi.value=!1}}function Dc(e,n){const t={};for(const i of e.changes){const r=Qr(i,yn(n,i.key.split(".")));r==="adopt"?t[fe(i)]={mode:"adopt"}:r==="review"?t[fe(i)]={mode:"keep"}:r==="must_fix"&&(t[fe(i)]={mode:null})}we.value=t}function Yi(e){return Qr(e,yn(We.value,e.key.split(".")))}function tn(e,n){we.value={...we.value,[e]:n}}function Ki(){const e=$t.value;return e===null?[]:e.changes.filter(n=>{if(Yi(n)!=="must_fix")return!1;const t=we.value[fe(n)];return t===void 0||t.mode===null||t.mode==="custom"&&(t.value===void 0||t.value==="")})}function Uc(){const e=$t.value;let n=We.value;if(e===null)return n;for(const t of e.changes){const i=we.value[fe(t)];if(i===void 0||i.mode===null||i.mode==="keep")continue;const r=t.key.split(".");i.mode==="adopt"&&t.new?.default!==void 0?n=cn(n,r,t.new.default):i.mode==="custom"&&i.value!==void 0&&(n=cn(n,r,i.value))}return n}async function Bc(){if(Q.value)return;const e=Ki();if(e.length>0){re.value=`Resolve the ${e.length} “Must fix” item${e.length===1?"":"s"} first.`;return}Q.value=!0,re.value=null;try{const n=Uc();if(JSON.stringify(n)!==JSON.stringify(We.value)){const t=await y("/api/v1/settings",{method:"PUT",headers:{"If-Unmodified-Since":String(mi.value)},body:{values:n}});We.value=n,mi.value=t.lastModified}await y("/api/v1/settings/changes/ack",{method:"POST"}),un.value=!0}catch(n){n instanceof E?re.value=z(n.body.error??{code:"UNKNOWN",message:n.message}):re.value=n instanceof Error?n.message:String(n)}finally{Q.value=!1}}async function zc(){if(Q.value)return;if(Ki().length>0){re.value="Cannot dismiss — “Must fix” items would leave invalid values in place.";return}Q.value=!0;try{await y("/api/v1/settings/changes/ack",{method:"POST"}),un.value=!0}catch(n){re.value=n instanceof Error?n.message:String(n)}finally{Q.value=!1}}function te(e){return e===void 0?"—":typeof e=="string"?e:JSON.stringify(e)}function Wt({change:e,id:n}){const t=e.new,r=we.value[n]?.value;return t?.enum!==void 0?a("select",{class:"ac-input","aria-label":`New value for ${e.key}`,value:r===void 0?"":String(r),onChange:l=>{const o=l.currentTarget.value;tn(n,{mode:"custom",value:o})},children:[a("option",{value:"",disabled:!0,children:"Choose a value…"}),t.enum.map(l=>a("option",{value:String(l),children:String(l)},String(l)))]}):t?.type==="boolean"?a("select",{class:"ac-input","aria-label":`New value for ${e.key}`,value:r===void 0?"":String(r),onChange:l=>{tn(n,{mode:"custom",value:l.currentTarget.value==="true"})},children:[a("option",{value:"",disabled:!0,children:"Choose…"}),a("option",{value:"true",children:"true"}),a("option",{value:"false",children:"false"})]}):a("input",{class:"ac-input",type:t?.type==="number"||t?.type==="integer"?"number":"text","aria-label":`New value for ${e.key}`,value:r===void 0?"":String(r),onInput:l=>{const o=l.currentTarget.value,s=t?.type==="number"||t?.type==="integer"?Number(o):o;tn(n,{mode:"custom",value:s})}})}function Wc({change:e}){const n=Yi(e),t=fe(e),i=we.value[t],r=yn(We.value,e.key.split("."));return a("li",{class:`ac-change-card ac-change-card--${n}`,"data-key":e.key,"data-kind":e.kind,children:[a("div",{class:"ac-change-card__head",children:[a("code",{class:"ac-change-card__key",children:e.key}),a("span",{class:`ac-change-card__badge ac-change-card__badge--${n}`,children:n==="must_fix"?"Must fix":n==="adopt"?"New default":n==="review"?"Review":"Info"})]}),e.new?.description!==void 0?a("p",{class:"ac-change-card__desc",children:e.new.description}):null,e.kind==="default_changed"?a(L,{children:[a("p",{class:"ac-change-card__detail",children:["Default changed: ",a("code",{children:te(e.old?.default)})," → ",a("code",{children:te(e.new?.default)}),n==="review"?a(L,{children:[" · your value: ",a("code",{children:te(r)})]}):null]}),a("div",{class:"ac-change-card__choices",role:"radiogroup","aria-label":`Resolution for ${e.key}`,children:[a("label",{class:"ac-change-card__choice",children:[a("input",{type:"radio",name:t,checked:i?.mode==="adopt",onChange:()=>{tn(t,{mode:"adopt"})}}),a("span",{children:["Adopt new default (",a("code",{children:te(e.new?.default)}),")"]})]}),a("label",{class:"ac-change-card__choice",children:[a("input",{type:"radio",name:t,checked:i?.mode==="keep",onChange:()=>{tn(t,{mode:"keep"})}}),a("span",{children:["Keep current (",a("code",{children:te(r??e.old?.default)}),")"]})]})]})]}):null,e.kind==="enum_removed"?n==="must_fix"?a(L,{children:[a("p",{class:"ac-change-card__detail",children:["Your value ",a("code",{children:te(r)})," is no longer valid — removed option",(e.values?.length??0)===1?"":"s",": ",a("code",{children:(e.values??[]).join(", ")}),". Pick a replacement:"]}),a(Wt,{change:e,id:t})]}):a("p",{class:"ac-change-card__detail",children:["Removed option",(e.values?.length??0)===1?"":"s",": ",a("code",{children:(e.values??[]).join(", ")})," — your value ",a("code",{children:te(r??e.new?.default)})," is unaffected."]}):null,e.kind==="enum_added"?a("p",{class:"ac-change-card__detail",children:["New option",(e.values?.length??0)===1?"":"s"," available: ",a("code",{children:(e.values??[]).join(", ")})]}):null,e.kind==="added"?n==="must_fix"?a(L,{children:[a("p",{class:"ac-change-card__detail",children:"New setting without a shipped default — define a value:"}),a(Wt,{change:e,id:t})]}):a("p",{class:"ac-change-card__detail",children:["New setting · default: ",a("code",{children:te(e.new?.default)}),e.new?.enum!==void 0?a(L,{children:[" · options: ",a("code",{children:e.new.enum.join(", ")})]}):null]}):null,e.kind==="removed"?a("p",{class:"ac-change-card__detail",children:"This setting no longer exists. Your stored value is kept in place and ignored (nothing is deleted)."}):null,e.kind==="type_changed"?a(L,{children:[a("p",{class:"ac-change-card__detail",children:["Type changed: ",a("code",{children:e.old?.type})," → ",a("code",{children:e.new?.type}),". Define a new value:"]}),a(Wt,{change:e,id:t})]}):null]})}function Hc(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 Yc(){if(ne(()=>{jc()},[]),gi.value)return a("div",{class:"ac-page",children:[a("h1",{children:"Settings changes"}),a("p",{children:"Loading…"})]});if(ot.value!==null)return a("div",{class:"ac-page",children:[a("h1",{children:"Settings changes"}),a("p",{class:"ac-banner ac-banner--error",children:ot.value})]});if(un.value||_i.value)return a("div",{class:"ac-page ac-settings-changes",children:[a("h1",{children:"Settings changes"}),a("p",{class:"ac-banner",children:un.value?"Review complete — all changes resolved.":"Nothing to review — your settings are up to date."}),a("button",{type:"button",class:"ac-button",onClick:()=>_t("/settings"),children:"Back to Settings"})]});const e=$t.value;if(e===null)return a("div",{class:"ac-page",children:a("h1",{children:"Settings changes"})});const n=Hc(e),t=Ki().length;return a("div",{class:"ac-page ac-settings-changes",children:[a("header",{class:"ac-page__header",children:[a("h1",{children:"Settings changes"}),a("p",{class:"ac-page__lede",children:["The upgrade ",a("code",{children:e.oldVersion})," → ",a("code",{children:e.newVersion})," changed the available settings. Review below — nothing was changed automatically."]})]}),re.value!==null?a("p",{class:"ac-banner ac-banner--error",role:"alert",children:re.value}):null,n.map(i=>a("section",{class:"ac-settings-changes__group",children:[a("h2",{children:[i.title," ",a("span",{class:"ac-settings-changes__count",children:["(",i.changes.length,")"]})]}),i.hint!==void 0?a("p",{class:"ac-settings-changes__hint",children:i.hint}):null,a("ul",{class:"ac-settings-changes__list",children:i.changes.map(r=>a(Wc,{change:r},fe(r)))})]},i.title)),a("div",{class:"ac-form__actions",children:[a("button",{type:"button",class:"ac-button",disabled:Q.value,onClick:()=>{zc()},children:"Dismiss (keep everything)"}),a("button",{type:"button",class:"ac-button ac-button--primary",disabled:Q.value||t>0,title:t>0?`${t} “Must fix” item${t===1?"":"s"} unresolved`:void 0,onClick:()=>{Bc()},children:Q.value?"Saving…":"Apply & finish review"})]})]})}const Ne=h(null);function Kc(){return ne(()=>{(async()=>{try{const e=await y("/api/v1/settings/changes");Ne.value=e.delta.changes.length}catch{Ne.value=null}})()},[]),Ne.value===null||Ne.value===0?null:a("div",{class:"ac-banner ac-banner--pending",role:"status",children:[a("span",{children:["An upgrade changed ",Ne.value," setting",Ne.value===1?"":"s"," — review recommended."]}),a("button",{type:"button",class:"ac-button ac-button--small",onClick:()=>_t("/settings/changes"),children:"Review changes"})]})}const yi=h(!1),st=h(null),K=h({}),ct=h(null),dn=h(0),fn=h({}),J=h(null),Se=h(!1),he=h(null),hn=h(null),Pn=h(""),Ee=h(!1),Ln=h({}),Rn=h({global:new Set,project:new Set});function Ra(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 Fa(){st.value=null;try{const e=await y("/api/v1/settings");K.value=e.values,ct.value=Ra(e.schema),dn.value=e.lastModified,Rn.value={global:new Set(e.sources?.global??[]),project:new Set(e.sources?.project??[])},yi.value=!0}catch(e){if(e instanceof E&&e.status===404&&e.body.error?.code==="NOT_FOUND"){const n=e.body;if(n.defaults!==void 0&&n.schema!==void 0){K.value=n.defaults,ct.value=Ra(n.schema),dn.value=n.lastModified??0,yi.value=!0;return}}st.value=e instanceof Error?e.message:String(e)}}async function qc(){if(!Se.value){J.value=null,fn.value={};try{const e=await y("/api/v1/settings/diff",{method:"POST",body:{values:K.value,ifUnmodifiedSince:dn.value}});if(e.changes.length===0){J.value="No changes to save.";return}he.value=e.changes}catch(e){e instanceof E?(fn.value=mt(e.body.error??{message:e.message}),J.value=z(e.body.error??{code:"UNKNOWN",message:e.message})):J.value=e instanceof Error?e.message:String(e)}}}async function el(e=!1){Se.value=!0;try{const n=await y("/api/v1/settings",{method:"PUT",headers:{"If-Unmodified-Since":String(dn.value)},body:e?{values:K.value,confirmSharedWrite:!0}:{values:K.value}});dn.value=n.lastModified,he.value=null,hn.value=null,J.value=`Saved (${n.writtenPaths.join(", ")}).`}catch(n){if(n instanceof E){const t=n.body;if(n.status===409&&t.error==="shared-write"){he.value=null,hn.value={sharedPath:typeof t.sharedPath=="string"?t.sharedPath:"",message:typeof t.message=="string"?t.message:"This write affects a shared agent-switch profile."};return}const i=n.body.error??{code:"UNKNOWN",message:n.message};fn.value=mt(i),J.value=z(i),he.value=null;const r=Object.keys(fn.value)[0];r!==void 0&&queueMicrotask(()=>{const l=document.getElementById(r);l!==null&&l.focus()})}else J.value=n instanceof Error?n.message:String(n)}finally{Se.value=!1}}function qi(e){if(e.defaultValue===void 0)return!1;const n=yn(K.value,e.path);return n===void 0?!1:JSON.stringify(n)!==JSON.stringify(e.defaultValue)}function Vc(e,n){const t=qi(n),i=Rn.value.project.has(e)?"project":Rn.value.global.has(e)&&Rn.value.project.size>0?"global":void 0;return{modified:t,onReset:t&&n.defaultValue!==void 0?()=>{K.value=cn(K.value,n.path,n.defaultValue)}:void 0,sourceLabel:i}}function Gc(e,n){const t=n.toLowerCase();return e.path.join(".").toLowerCase().includes(t)||e.label.toLowerCase().includes(t)||(e.description??"").toLowerCase().includes(t)}function Jc(e){const n=Pn.value.trim(),t=Ee.value,i=e.path.join("."),r=Ln.value[i]===!0;let l=e.fields.filter(c=>c.kind!=="unsupported");if(n!==""&&(l=l.filter(c=>Gc(c,n))),t&&(l=l.filter(c=>qi(c))),n!==""||t)return l.length===0?null:{section:e,visible:l,hiddenAdvancedCount:0,expanded:r};const o=l.filter(c=>La(c.path.join("."))),s=l.filter(c=>!La(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 Xc(e){Ln.value={...Ln.value,[e]:Ln.value[e]!==!0}}function Zc(){const e=_e.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 Qc({block:e}){return a("div",{class:"ac-modal",role:"dialog","aria-modal":"true","aria-labelledby":"shared-write-title",children:a("div",{class:"ac-modal__panel",children:[a("h2",{id:"shared-write-title",children:"Shared write — affects all profiles"}),a("p",{children:e.message}),a("p",{children:a("code",{children:e.sharedPath})}),a("div",{class:"ac-modal__actions",children:[a("button",{type:"button",class:"ac-button",onClick:()=>{hn.value=null},children:"Cancel"}),a("button",{type:"button",class:"ac-button ac-button--primary",disabled:Se.value,onClick:()=>{el(!0)},children:Se.value?"Writing…":"Write (affects all profiles)"})]})]})})}function eu({changes:e}){return a("div",{class:"ac-modal",role:"dialog","aria-modal":"true","aria-labelledby":"diff-title",children:a("div",{class:"ac-modal__panel",children:[a("h2",{id:"diff-title",children:"Confirm changes"}),a("ul",{class:"ac-diff",children:e.map(n=>a("li",{children:[a("code",{children:n.path}),a("span",{class:"ac-diff__before",children:JSON.stringify(n.from)}),a("span",{class:"ac-diff__arrow",children:"→"}),a("span",{class:"ac-diff__after",children:JSON.stringify(n.to)})]},n.path))}),a("div",{class:"ac-modal__actions",children:[a("button",{type:"button",class:"ac-button",onClick:()=>{he.value=null},children:"Cancel"}),a("button",{type:"button",class:"ac-button ac-button--primary",disabled:Se.value,onClick:()=>{el()},children:Se.value?"Saving…":"Save"})]})]})})}function nu(){if(ne(()=>{Fa()},[]),!yi.value||ct.value===null)return a("div",{class:"ac-page",children:[a("h1",{children:"Settings"}),st.value!==null?a("p",{class:"ac-banner ac-banner--error",children:st.value}):a("p",{children:"Loading…"})]});const e=gr(ct.value),n=e.map(Jc).filter(r=>r!==null),t=e.flatMap(r=>r.fields).filter(r=>qi(r)).length,i=Pn.value.trim()!==""||Ee.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(Kc,{}),a(Zc,{}),a("div",{class:"ac-settings-hub__toolbar",role:"search",children:[a("input",{class:"ac-input ac-settings-hub__search",type:"search",placeholder:"Search all settings (basic and advanced)…",value:Pn.value,onInput:r=>{Pn.value=r.currentTarget.value}}),a("button",{type:"button",class:`ac-chip-toggle${Ee.value?" ac-chip-toggle--active":""}`,"aria-pressed":Ee.value,onClick:()=>{Ee.value=!Ee.value},children:["@modified",t>0?` (${t})`:""]})]}),J.value!==null?a("p",{class:"ac-banner",children:J.value}):null,a("form",{class:"ac-form",onSubmit:r=>r.preventDefault(),children:[n.length===0?a("p",{class:"ac-settings-hub__empty",children:"No settings match."}):n.map(r=>{const l=r.section.path.join(".");return a(_r,{section:{...r.section,fields:r.visible},values:K.value,errors:fn.value,onChange:o=>{K.value=o},decorate:Vc,footer:!i&&(r.hiddenAdvancedCount>0||r.expanded)?a("button",{type:"button",class:"ac-settings-hub__disclosure","aria-expanded":r.expanded,onClick:()=>{Xc(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:()=>{Fa()},children:"Reload"}),a("button",{type:"button",class:"ac-button ac-button--primary",onClick:()=>{qc()},children:"Preview & Save"})]})]}),he.value!==null?a(eu,{changes:he.value}):null,hn.value!==null?a(Qc,{block:hn.value}):null]})}const ut=h(!1),Ue=h(null);async function tu(){Qn.value=!0,et.value=null;try{const e=await y("/api/v1/modules/detect");ji.value=e.candidates,Dr.value=e.project_root;const n={};for(const t of e.candidates)n[t.path]=!0;nt.value=n,tt.value=e.proposed_block.enabled,it.value=e.proposed_block.namespace_template??"",at.value=e.proposed_block.agent_folder??"agents"}catch(e){et.value=e instanceof E?z(e.body.error??{code:"UNKNOWN",message:e.message}):e instanceof Error?e.message:String(e)}finally{Qn.value=!1,cc.value=!0}}function iu(){const e=new Set(ji.value.map(i=>i.path)),n=nt.value,t=Object.keys(n).filter(i=>n[i]===!0&&e.has(i));return{enabled:tt.value,root_paths:t,namespace_template:it.value,agent_folder:at.value||"agents"}}async function au(){ut.value=!0,Ue.value=null;try{const e=await y("/api/v1/modules/apply",{method:"POST",body:iu()});Ue.value={message:e.appliedTo!==null?`Saved project settings to ${e.appliedTo}.`:`Saved project settings to ${e.projectRoot}.`,tone:"success"}}catch(e){const n=e instanceof E?z(e.body.error??{code:"UNKNOWN",message:e.message}):e instanceof Error?e.message:String(e);Ue.value={message:`Could not save project settings: ${n}`,tone:"error"}}finally{ut.value=!1}}function ru(){if(Qn.value)return a("p",{children:"Detecting module roots…"});if(et.value!==null)return a("p",{class:"ac-banner ac-banner--error",children:["Module detection failed: ",et.value]});const e=ji.value,n=nt.value,t=Dr.value;return a("div",{class:"ac-section",children:[t!==null?a("p",{class:"ac-section__description",children:["Scanning ",a("code",{children:t}),". Pick which detected roots the agent should treat as modules. These write to",a("code",{children:" .agent-project-settings.yml"})," in this repo only."]}):null,a("label",{children:[a("input",{type:"checkbox",checked:tt.value,onChange:i=>{tt.value=i.currentTarget.checked}})," ","Enable module discovery (writes ",a("code",{children:"modules.enabled"}),")"]}),e.length===0?a("p",{children:[a("em",{children:"No module roots detected."})," The scan found no common module layouts (Laravel ",a("code",{children:"app/Modules/"}),", Symfony",a("code",{children:" src/Module/"}),", Node ",a("code",{children:"packages/"}),", Python",a("code",{children:" src/"}),", Go ",a("code",{children:"internal/"}),")."]}):a("ul",{style:"list-style: none; padding-left: 0;",children:e.map(i=>a("li",{children:a("label",{children:[a("input",{type:"checkbox",checked:n[i.path]??!1,onChange:r=>{const l=r.currentTarget.checked;nt.value={...n,[i.path]:l}}})," ",a("code",{children:i.path})," — ",i.stack," ",a("small",{children:["(",i.confidence," confidence)"]})]})},i.path))}),a("div",{class:"ac-wizard__module-fields",children:[a("div",{class:"ac-field",children:[a("label",{class:"ac-field__label",for:"ac-modules-namespace",children:"Namespace template"}),a("input",{id:"ac-modules-namespace",class:"ac-input",type:"text",value:it.value,placeholder:"e.g. App\\\\Modules\\\\{ModuleName}\\\\App",onInput:i=>{it.value=i.currentTarget.value}}),a("span",{class:"ac-field__description",children:"How a module path maps to its namespace. Leave blank to skip namespacing."})]}),a("div",{class:"ac-field",children:[a("label",{class:"ac-field__label",for:"ac-modules-agent-folder",children:"Agent folder"}),a("input",{id:"ac-modules-agent-folder",class:"ac-input",type:"text",value:at.value,placeholder:"agents",onInput:i=>{at.value=i.currentTarget.value}}),a("span",{class:"ac-field__description",children:["Folder name that holds per-module agent docs (default ",a("code",{children:"agents"}),")."]})]})]})]})}function lu(){return ne(()=>{tu()},[]),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."]})]}),Ue.value!==null?a("p",{class:`ac-banner ac-banner--${Ue.value.tone==="success"?"success":"error"}`,children:Ue.value.message}):null,a("section",{class:"ac-section",children:[a("h2",{class:"ac-section__title",children:"Modules"}),a(ru,{})]}),a("div",{class:"ac-form__actions ac-wizard__nav",children:a("button",{type:"button",class:"ac-button ac-button--primary",disabled:ut.value||Qn.value,onClick:()=>{au()},children:ut.value?"Saving…":"Save project settings"})})]})}const Fn=h([]),pn=h([]),bi=h([]),ki=h([]),dt=h(null),nl=h(!1),an=h(null),U=h(null),Ht=h("plain"),ft=h({}),tl=h([]),Ma={"claude-code":"Claude Code",codex:"Codex",gemini:"Gemini"};function ou(){try{return globalThis.sessionStorage?.getItem("ac-workspace-host")??"claude-code"}catch{return"claude-code"}}const Vi=h(ou());function su(e){Vi.value=e;try{globalThis.sessionStorage?.setItem("ac-workspace-host",e)}catch{}}const vn=h([]),q=h(null),Oe=h({}),pe=h(!1),gn=h(null),oe=h(""),rn=h(!1),Ot=h(!1),wi=h(null),ve=h(null),_n=h([]),Mn=h(new Set),il="claude-code",ja=2e3;async function cu(){an.value=null;try{const[e,n,t,i,r,l]=await Promise.all([y("/api/v1/workspace/roles"),y("/api/v1/workspace/sessions?limit=20"),y("/api/v1/workspace/knowledge?limit=20"),y("/api/v1/workspace/documents?limit=20"),y("/api/v1/workspace/drive-health").catch(()=>({health:{}})),y("/api/v1/workspace/hosts").catch(()=>({hosts:[]}))]);Fn.value=e.roles,pn.value=n.sessions,bi.value=t.chunks,ki.value=i.documents,ft.value=r.health??{},tl.value=l.hosts??[],nl.value=!0}catch(e){e instanceof E?an.value=e.body?.error?.message??e.message:an.value=e instanceof Error?e.message:String(e)}}async function uu(e,n){try{const t=await y(`/api/v1/workspace/roles/${e}/tasks`);vn.value=t.tasks}catch{vn.value=n}}async function Gi(e){ve.value=e,Mn.value=new Set;try{const n=await y(`/api/v1/workspace/sessions/${e}`);_n.value=Array.isArray(n.log)?n.log:[]}catch{_n.value=[]}}async function du(e){U.value=null,Ot.value=!1,oe.value="",q.value=null,await Gi(e)}async function al(e,n,t){U.value=null,pe.value=!0,oe.value="",Ot.value=!1,wi.value={role:e,task:n,inputs:t};try{const i=await y("/api/v1/workspace/launch",{method:"POST",body:{role:e,task:n,inputs:t,host:Vi.value}});gn.value=i,U.value=rl(i),q.value=null,await Gi(i.id);const r=await y("/api/v1/workspace/sessions?limit=20");pn.value=r.sessions,await Ji()}catch(i){gn.value=null,i instanceof E?U.value=i.body?.error?.message??i.message:U.value=i instanceof Error?i.message:String(i)}finally{pe.value=!1}}async function fu(e,n){if(!(n.trim()===""||rn.value)){rn.value=!0,U.value=null;try{const t=await y(`/api/v1/workspace/sessions/${e}/continue`,{method:"POST",body:{prompt:n}});gn.value=t,U.value=rl(t),t.driven&&(oe.value=""),await Gi(e);const i=await y("/api/v1/workspace/sessions?limit=20");pn.value=i.sessions,await Ji()}catch(t){t instanceof E&&t.status===410?(Ot.value=!0,U.value="Host session expired — start a new conversation."):t instanceof E?U.value=t.body?.error?.message??t.message:U.value=t instanceof Error?t.message:String(t)}finally{rn.value=!1}}}async function Ji(){try{const e=await y("/api/v1/workspace/drive-health");ft.value=e.health??{}}catch{}}async function hu(e){try{await y(`/api/v1/workspace/drive-health/${e}/reset`,{method:"POST"}),await Ji()}catch{}}function rl(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 ${il} 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 pu({role:e}){const n=dt.value===e.slug;return a("button",{type:"button",class:`ac-workspace__role${n?" ac-workspace__role--active":""}`,"aria-current":n?"true":void 0,"aria-label":`Pick role ${e.display_name}`,onClick:()=>{dt.value=e.slug,U.value=null,gn.value=null,q.value=null,Oe.value={},vn.value=e.first_tasks,uu(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 vu({role:e,task:n}){const t=n.inputs??[],i=Oe.value,r=t.some(l=>l.required&&(i[l.name]??"").trim()==="");return a("form",{class:"ac-workspace__task-form",onSubmit:l=>{l.preventDefault(),!r&&!pe.value&&al(e,n.name,Oe.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=>{Oe.value={...Oe.value,[l.name]:o.target.value}}})]},l.name)),a("div",{class:"ac-workspace__form-actions",children:[a("button",{type:"submit",class:"ac-button ac-button--primary",disabled:r||pe.value,children:pe.value?"Running…":"Run task"}),a("button",{type:"button",class:"ac-button",onClick:()=>{q.value=null},children:"Cancel"})]})]})}function gu(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:il} · 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 _u(){if(ve.value===null)return null;const e=gu(_n.value),n=_n.value.some(t=>t.kind==="host.turn");return a("section",{class:"ac-workspace__thread","aria-label":"Conversation thread",children:[a("h2",{class:"ac-workspace__heading",children:"Conversation"}),e.length===0?a("p",{class:"ac-workspace__empty",children:"No turns yet."}):a("ol",{class:"ac-workspace__thread-list",children:e.map((t,i)=>{const r=t.kind==="assistant"&&t.text.length>ja,l=Mn.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(Mn.value);s.has(i)?s.delete(i):s.add(i),Mn.value=s},children:l?"Show less":"Show full"}):null,t.meta!=null?a("p",{class:"ac-workspace__turn-meta",children:t.meta}):null]},i)})}),Ot.value?a("div",{class:"ac-workspace__followup-gone",role:"status",children:[a("p",{children:"Host session expired."}),wi.value!==null?a("button",{type:"button",class:"ac-button ac-button--primary",disabled:pe.value,onClick:()=>{const t=wi.value;t!==null&&al(t.role,t.task,t.inputs)},children:pe.value?"Starting…":"Start a new conversation"}):a("p",{children:"Pick a task above to start a new conversation."})]}):n?a("form",{class:"ac-workspace__followup",onSubmit:t=>{t.preventDefault(),ve.value!==null&&fu(ve.value,oe.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:oe.value,onInput:t=>{oe.value=t.target.value}})]}),a("button",{type:"submit",class:"ac-button ac-button--primary",disabled:oe.value.trim()===""||rn.value,children:rn.value?"Continuing…":"Send follow-up"})]}):null]})}function mu({role:e}){const n=vn.value.length>0?vn.value:e.first_tasks;return a("section",{class:"ac-workspace__tasks","aria-labelledby":"task-heading",children:[a("h2",{id:"task-heading",class:"ac-workspace__heading",children:["First tasks · ",e.display_name]}),n.length===0?a("p",{class:"ac-workspace__empty",children:"No tasks scaffolded yet for this role."}):a("ul",{class:"ac-workspace__task-list",children:n.map(t=>a("li",{class:"ac-workspace__task",children:[a("div",{class:"ac-workspace__task-head",children:[a("span",{class:"ac-workspace__task-name",children:t.name}),a("button",{type:"button",class:"ac-button ac-button--primary","aria-expanded":q.value===t.name,onClick:()=>{q.value=q.value===t.name?null:t.name,Oe.value={},gn.value=null,ve.value=null,_n.value=[]},children:q.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,q.value===t.name?a(vu,{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 yu(){return a("section",{class:"ac-workspace__sessions","aria-labelledby":"sessions-heading",children:[a("h2",{id:"sessions-heading",class:"ac-workspace__heading",children:"Recent sessions"}),pn.value.length===0?a("p",{class:"ac-workspace__empty",children:"No sessions yet — pick a role and start one."}):a("ul",{class:"ac-workspace__session-list",children:pn.value.map(e=>a("li",{class:"ac-workspace__session",children:a("button",{type:"button",class:`ac-workspace__session-open${ve.value===e.id?" ac-workspace__session-open--active":""}`,"aria-label":`Open session ${e.task}`,"aria-current":ve.value===e.id?"true":void 0,onClick:()=>{du(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 bu(){return a("section",{class:"ac-workspace__knowledge","aria-labelledby":"knowledge-heading",children:[a("h2",{id:"knowledge-heading",class:"ac-workspace__heading",children:"Knowledge sources"}),bi.value.length===0?a("p",{class:"ac-workspace__empty",children:["No sources yet. Run ",a("code",{children:"/knowledge:ingest <path>"})," to add documents."]}):a("ol",{class:"ac-workspace__citation-list",children:bi.value.map((e,n)=>a("li",{class:"ac-workspace__citation",children:[a("span",{class:"ac-workspace__citation-marker","aria-label":`Citation ${n+1}`,children:["[",n+1,"]"]}),a("a",{href:`file://${e.source}`,class:"ac-workspace__citation-source",title:"Open source in OS default app",children:e.source.split("/").pop()??e.source}),e.pinned?a("span",{class:"ac-workspace__citation-pin","aria-label":"pinned",children:"★"}):null,a("p",{class:"ac-workspace__citation-excerpt",children:[e.excerpt.slice(0,200),e.excerpt.length>200?"…":""]})]},e.id))})]})}function ku(){return a("section",{class:"ac-workspace__recent","aria-labelledby":"recent-heading",children:[a("h2",{id:"recent-heading",class:"ac-workspace__heading",children:"Recent documents"}),ki.value.length===0?a("p",{class:"ac-workspace__empty",children:"No documents yet. Saved drafts land here."}):a("ul",{class:"ac-workspace__doc-list",children:ki.value.map(e=>a("li",{class:"ac-workspace__doc",children:[a("span",{class:"ac-workspace__doc-type","data-type":e.type,children:e.type}),a("span",{class:"ac-workspace__doc-title",children:e.title}),a("time",{class:"ac-workspace__doc-time",dateTime:e.updated_at,children:e.updated_at.slice(0,10)})]},`${e.type}/${e.slug}`))})]})}function wu(){const n=Object.values(ft.value).filter(t=>t.killed||t.consecutive_failures>0);return a("section",{class:"ac-workspace__drive-health","aria-labelledby":"drive-health-heading",children:[a("h2",{id:"drive-health-heading",class:"ac-workspace__heading",children:"Host health"}),n.length===0?a("p",{class:"ac-workspace__empty",children:"All hosts healthy."}):a("ul",{class:"ac-workspace__health-list",children:Object.entries(ft.value).filter(([,t])=>t.killed||t.consecutive_failures>0).map(([t,i])=>{const r=i.killed?i.kill_reason==="manual"?"paused (manual)":"paused — auto-recovering":"degraded";return a("li",{class:"ac-workspace__health","data-killed":i.killed?"true":"false",children:[a("span",{class:"ac-workspace__health-host",children:t}),a("span",{class:"ac-workspace__health-state",children:r}),a("span",{class:"ac-workspace__health-meta",children:[i.consecutive_failures," fail streak",i.last_error_kind!=null?` · ${i.last_error_kind}`:""]}),i.killed?a("button",{type:"button",class:"ac-button ac-workspace__health-reset","aria-label":`Reset ${t}`,onClick:()=>{hu(t)},children:"Reset"}):null]},t)})})]})}function Su(){const e=Ht.value;return a("fieldset",{class:"ac-workspace__explain",children:[a("legend",{class:"ac-workspace__heading",children:"Explanation style"}),a("label",{class:"ac-workspace__explain-option",children:[a("input",{type:"radio",name:"explain-mode",value:"plain",checked:e==="plain",onChange:()=>{Ht.value="plain"},"aria-label":"Plain language"}),a("span",{children:"Plain language"})]}),a("label",{class:"ac-workspace__explain-option",children:[a("input",{type:"radio",name:"explain-mode",value:"technical",checked:e==="technical",onChange:()=>{Ht.value="technical"},"aria-label":"Technical detail"}),a("span",{children:"Technical detail"})]}),a("p",{class:"ac-workspace__explain-hint",children:e==="plain"?"Replies use everyday words. Toggle to see the technical view.":"Replies keep the technical vocabulary. Toggle for the plain view."})]})}function Cu(){const e=tl.value,n=e.length>0?e.map(i=>i.id):Object.keys(Ma),t=new Map(e.map(i=>[i.id,i.cli_present]));return a("label",{class:"ac-workspace__host-picker",children:[a("span",{class:"ac-workspace__host-label",children:"Host"}),a("select",{class:"ac-workspace__host-select","aria-label":"Host agent",value:Vi.value,onChange:i=>{su(i.target.value)},children:n.map(i=>{const r=t.get(i)!==!1,l=Ma[i]??i;return a("option",{value:i,disabled:!r,children:[l," (",i,")",r?"":" — not installed"]},i)})})]})}function Tu(){if(ne(()=>{cu()},[]),an.value!==null)return a("div",{class:"ac-page ac-page--error",children:[a("h1",{children:"Workspace"}),a("p",{class:"ac-banner ac-banner--error",children:an.value})]});if(!nl.value)return a("div",{class:"ac-page",children:[a("h1",{children:"Workspace"}),a("p",{children:"Loading…"})]});const e=dt.value!==null?Fn.value.find(n=>n.slug===dt.value)??null:null;return a("div",{class:"ac-page ac-workspace",children:[a("header",{class:"ac-page__header",children:[a("h1",{children:"Workspace"}),a("p",{class:"ac-page__subtitle",children:"Pick a role, pick a first task, run it."}),a(Cu,{})]}),U.value!==null?a("p",{class:"ac-banner",role:"status",children:U.value}):null,a("div",{class:"ac-workspace__grid",children:[a("section",{class:"ac-workspace__roles","aria-labelledby":"roles-heading",children:[a("h2",{id:"roles-heading",class:"ac-workspace__heading",children:"Roles"}),Fn.value.length===0?a("p",{class:"ac-workspace__empty",children:"No roles installed."}):a("div",{class:"ac-workspace__role-grid",children:Fn.value.map(n=>a(pu,{role:n},n.slug))})]}),a("main",{class:"ac-workspace__main","aria-label":"Tasks and sessions",children:[e!==null?a(mu,{role:e}):a("p",{class:"ac-workspace__empty",children:"Pick a role on the left to see its first tasks."}),a(_u,{}),a(yu,{})]}),a("aside",{class:"ac-workspace__rail","aria-label":"Knowledge and documents",children:[a(bu,{}),a(ku,{}),a(wu,{}),a(Su,{})]})]})]})}const ll="agent-config-theme";function Au(){return(typeof document<"u"?document.documentElement.getAttribute("data-theme"):null)==="dark"?"dark":"light"}const ln=h(Au());function xu(){try{const e=localStorage.getItem(ll);return e==="light"||e==="dark"?e:null}catch{return null}}function Nu(){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 Eu(){return xu()===null&&Nu()===null}function ol(e){ln.value=e,document.documentElement.setAttribute("data-theme",e)}function Iu(){const e=ln.value==="dark"?"light":"dark";try{localStorage.setItem(ll,e)}catch{}ol(e)}function $u(){if(typeof window>"u"||typeof window.matchMedia!="function")return;const e=window.matchMedia("(prefers-color-scheme: dark)"),n=()=>{Eu()&&ol(e.matches?"dark":"light")};typeof e.addEventListener=="function"&&e.addEventListener("change",n)}function Ou(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("embed")==="1"}const Pu=Ou(),sl=[{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 cl(e){for(const n of sl)for(const t of n.matches)if(e===t||e.startsWith(`${t}/`))return n.id;return null}function Lu(e){const n=_e.value,t=cl(e);return sl.filter(i=>i.id==="project"?n?.projectSurface===!0||t==="project":i.id==="workspace"?n?.devSurfaces===!0||t==="workspace":!0)}function Ru(){const e=Yn.value,n=cl(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:Lu(e).map(t=>a("button",{type:"button",class:`ac-topnav__tab${n===t.id?" ac-topnav__tab--active":""}`,"aria-current":n===t.id?"page":void 0,onClick:()=>_t(t.hashPath),children:t.label},t.id))}),a("button",{type:"button",class:"ac-topnav__theme","aria-label":ln.value==="dark"?"Switch to light theme":"Switch to dark theme",title:ln.value==="dark"?"Switch to light theme":"Switch to dark theme",onClick:()=>{Iu()},children:ln.value==="dark"?"☀":"☾"})]})})}function Fu({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 Mu(){const e=_e.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 ju(e){return e==="/"||e==="/setup"||e.startsWith("/setup/")?a(Pa,{path:e}):e.startsWith("/wizard")?a(Pa,{path:e}):e==="/settings/changes"?a(Yc,{}):e==="/settings"||e.startsWith("/settings/")?a(nu,{}):e==="/project"||e.startsWith("/project/")?a(lu,{}):e==="/workspace"?a(Tu,{}):a(Fu,{path:e})}function Du(){return ne(()=>{$l(),Yn.value==="/"&&_t("/setup"),Ll()},[]),a(L,{children:[a(Mu,{}),Pu?null:a(Ru,{}),ju(Yn.value)]})}const Uu=3e4,Bu=30*6e4;let An=null,Da=!1;function Ua(e){if(!Da&&(Da=!0,!(typeof navigator>"u"||typeof navigator.sendBeacon!="function")))try{navigator.sendBeacon(`/api/v1/shutdown?token=${encodeURIComponent(e)}`)}catch{}}function zu(e){if(typeof window>"u")return()=>{};let n=Date.now();const t=()=>{n=Date.now()},i=["pointerdown","keydown","wheel","touchstart"];for(const s of i)window.addEventListener(s,t,{passive:!0});const r=()=>{document.hidden||t()};document.addEventListener("visibilitychange",r);const l=()=>{An!==null&&clearInterval(An),An=null;for(const s of i)window.removeEventListener(s,t);document.removeEventListener("visibilitychange",r),window.removeEventListener("pagehide",o)};An=setInterval(()=>{if(!document.hidden){if(Date.now()-n>Bu){Ua(e),l();return}y("/api/v1/ping").catch(()=>{})}},Uu);function o(){Ua(e)}return window.addEventListener("pagehide",o),l}function Wu(){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 Hu(){return new URLSearchParams(window.location.search).get("token")}function Yu(){const e=document.getElementById("app");if(e===null)return;const n=Hu();if(n===null){e.textContent="agent-config UI · missing token — re-open via `agent-config ui:serve`.";return}Ol(n),Wu(),zu(n),$u(),e.textContent="",_l(a(Du,{}),e)}Yu();
26
- //# sourceMappingURL=index-C1pBRm1f.js.map