geneseed 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +109 -5
- package/DESIGN.md +54 -1282
- package/README.md +8 -10
- package/SETUP.md +15 -7
- package/SHIPPED.md +3 -3
- package/adapters/opencode/opencode.json +0 -9
- package/bin/geneseed.mjs +2 -2
- package/docs/declined.md +53 -2
- package/docs/design-history.md +1290 -0
- package/docs/extending.md +563 -0
- package/docs/limits.md +141 -82
- package/docs/web/agents.md +1 -1
- package/docs/web/rules.md +1 -1
- package/geneseed +0 -0
- package/harness.config.json +1 -1
- package/js/cli-table.json +1 -1
- package/js/doctor.mjs +67 -22
- package/js/inventory.mjs +2 -1
- package/js/lib/fs.mjs +6 -2
- package/js/mcp.mjs +3 -15
- package/js/render.mjs +6 -4
- package/js/settings.mjs +79 -1
- package/js/themes.mjs +1 -1
- package/js/tui.mjs +2 -2
- package/js/uninstall.mjs +5 -5
- package/js/web/actions.mjs +20 -4
- package/js/web/server.mjs +53 -2
- package/package.json +1 -1
- package/src/laws/universal.md +35 -0
- package/themes/_TEMPLATE.json +3 -0
- package/themes/biker.json +3 -0
- package/themes/commentator.json +3 -0
- package/themes/cyberpunk.json +3 -0
- package/themes/gamer.json +3 -0
- package/themes/imperial.json +3 -0
- package/themes/joker.json +3 -0
- package/themes/marvin.json +3 -0
- package/themes/mean.json +3 -0
- package/themes/military.json +3 -0
- package/themes/neutral.json +3 -0
- package/themes/pirate.json +3 -0
- package/themes/sports.json +3 -0
- package/themes/verstappen.json +3 -0
- package/themes/wizard.json +3 -0
- package/web/dist/assets/{About-DX1-VTBP.js → About-BYXlmbyo.js} +1 -1
- package/web/dist/assets/{Activity-Dp9NaXOn.js → Activity-us5MPf4u.js} +1 -1
- package/web/dist/assets/{ActivityDetail-HpOBtrXS.js → ActivityDetail-CiaQXUk2.js} +1 -1
- package/web/dist/assets/{Diff-Ct4G3Se8.js → Diff-Bh0qbZ2s.js} +1 -1
- package/web/dist/assets/{Doctor-DGjkZFuA.js → Doctor-BIlQME45.js} +1 -1
- package/web/dist/assets/{Graph-b8o-S6kv.js → Graph-4dYD1dPG.js} +1 -1
- package/web/dist/assets/Harnesses-PzYZ3LOC.js +1 -0
- package/web/dist/assets/Laws-DtZweXal.js +1 -0
- package/web/dist/assets/{Library-BEZscyaQ.js → Library-CjMbksJW.js} +1 -1
- package/web/dist/assets/{Markdown-k_LSLBGq.js → Markdown-Bk81c3aZ.js} +1 -1
- package/web/dist/assets/{Profile-DydukTxP.js → Profile-Curui_-j.js} +1 -1
- package/web/dist/assets/{Rules-CIRG4Ldt.js → Rules-Bm283wdv.js} +1 -1
- package/web/dist/assets/{Skills-Buoi1IBr.js → Skills-gruqYuhl.js} +1 -1
- package/web/dist/assets/{StatusBadge-CE_AJttl.js → StatusBadge-EiM_FPqv.js} +1 -1
- package/web/dist/assets/{Themes-CI4o3gJC.js → Themes-DU99j4Hr.js} +1 -1
- package/web/dist/assets/{activity-BCW7e6Cy.js → activity-0rvQ6Vra.js} +1 -1
- package/web/dist/assets/{index-B1PIx7RM.js → index-0b2hobOo.js} +1 -1
- package/web/dist/assets/index-D5VY3TY_.js +12 -0
- package/web/dist/assets/{index-Ck2iCdaC.js → index-IiGFmCW_.js} +1 -1
- package/web/dist/index.html +1 -1
- package/web/src/pages/Laws.jsx +3 -0
- package/web/dist/assets/Harnesses-gr3-aHBF.js +0 -1
- package/web/dist/assets/Laws-DTwF5tTC.js +0 -1
- package/web/dist/assets/index-BnTQUSUz.js +0 -12
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Activity-Dp9NaXOn.js","assets/react-DOpiTn5v.js","assets/activity-BCW7e6Cy.js","assets/ActivityDetail-HpOBtrXS.js","assets/Library-BEZscyaQ.js","assets/Markdown-k_LSLBGq.js","assets/marked.esm-JKvyS0Pp.js","assets/StatusBadge-CE_AJttl.js","assets/Laws-DTwF5tTC.js","assets/roman-DkYN0LX9.js","assets/Rules-CIRG4Ldt.js","assets/Profile-DydukTxP.js","assets/Skills-Buoi1IBr.js","assets/Diff-Ct4G3Se8.js","assets/Doctor-DGjkZFuA.js","assets/Themes-CI4o3gJC.js","assets/Graph-b8o-S6kv.js","assets/index-B1PIx7RM.js","assets/Harnesses-gr3-aHBF.js","assets/index-Ck2iCdaC.js","assets/About-DX1-VTBP.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as p,c as $e}from"./react-DOpiTn5v.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))c(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const i of l.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&c(i)}).observe(document,{childList:!0,subtree:!0});function n(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function c(a){if(a.ep)return;a.ep=!0;const l=n(a);fetch(a.href,l)}})();var fe={exports:{}},ce={};/**
|
|
3
|
-
* @license React
|
|
4
|
-
* react-jsx-runtime.production.min.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var Fe=p,Le=Symbol.for("react.element"),Oe=Symbol.for("react.fragment"),Re=Object.prototype.hasOwnProperty,De=Fe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ie={key:!0,ref:!0,__self:!0,__source:!0};function je(s,t,n){var c,a={},l=null,i=null;n!==void 0&&(l=""+n),t.key!==void 0&&(l=""+t.key),t.ref!==void 0&&(i=t.ref);for(c in t)Re.call(t,c)&&!Ie.hasOwnProperty(c)&&(a[c]=t[c]);if(s&&s.defaultProps)for(c in t=s.defaultProps,t)a[c]===void 0&&(a[c]=t[c]);return{$$typeof:Le,type:s,key:l,ref:i,props:a,_owner:De.current}}ce.Fragment=Oe;ce.jsx=je;ce.jsxs=je;fe.exports=ce;var e=fe.exports;const Pe="modulepreload",Be=function(s){return"/"+s},ue={},F=function(t,n,c){let a=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),r=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));a=Promise.allSettled(n.map(u=>{if(u=Be(u),u in ue)return;ue[u]=!0;const f=u.endsWith(".css"),x=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${x}`))return;const o=document.createElement("link");if(o.rel=f?"stylesheet":Pe,f||(o.as="script"),o.crossOrigin="",o.href=u,r&&o.setAttribute("nonce",r),document.head.appendChild(o),f)return new Promise((d,g)=>{o.addEventListener("load",d),o.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function l(i){const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=i,window.dispatchEvent(r),!r.defaultPrevented)throw i}return a.then(i=>{for(const r of i||[])r.status==="rejected"&&l(r.reason);return t().catch(l)})},Ve=typeof window<"u"?window.__GENESEED_TOKEN__:"";async function be(s){const t=await s.json().catch(()=>({})),n=new Error(t.error||t.message||s.statusText);return n.status=s.status,n.body=t,n}async function S(s){const t=await fetch(s);if(!t.ok)throw await be(t);return t.json()}async function A(s,t={}){const n=await fetch(s,{method:"POST",headers:{"X-Geneseed-Token":Ve||"","Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw await be(n);return n.json()}const ze=()=>S("/api/overview"),He=()=>S("/api/activity"),Ue=s=>S("/api/activity/"+encodeURIComponent(s)),We=s=>A("/api/activity",{enabled:s}),Ge=()=>S("/api/setup"),Ze=()=>S("/api/doctor"),Ke=()=>S("/api/themes"),Ye=()=>S("/api/graph"),qe=Object.freeze(Object.defineProperty({__proto__:null,activity:He,activityDetail:Ue,activityToggle:We,doctor:Ze,graph:Ye,overview:ze,setup:Ge,themes:Ke},Symbol.toStringTag,{value:"Module"})),Je=s=>S(`/api/catalog/${s}`),Xe=(s,t)=>S(`/api/item/${s}/${encodeURIComponent(t)}`),Qe=s=>A("/api/memory/delete",{name:s}),es=Object.freeze(Object.defineProperty({__proto__:null,catalog:Je,item:Xe,memoryDelete:Qe},Symbol.toStringTag,{value:"Module"})),ss=()=>S("/api/diff"),ts=s=>A("/api/actions/restore",{files:s}),as=Object.freeze(Object.defineProperty({__proto__:null,diff:ss,restore:ts},Symbol.toStringTag,{value:"Module"})),ns=409,cs=s=>S(`/api/jobs/${s}`),ls=()=>S("/api/jobs"),is=s=>A(`/api/jobs/${s}/cancel`);async function rs(s,t){try{return await A(`/api/actions/${s}`,t||{})}catch(n){throw n.status===ns?new Error("An action is already running."):n}}const os=Object.freeze(Object.defineProperty({__proto__:null,action:rs,cancelJob:is,job:cs,jobs:ls},Symbol.toStringTag,{value:"Module"})),ds=()=>S("/api/mcp"),hs=(s,t,n)=>A("/api/mcp",{path:s,name:t,enabled:n}),us=Object.freeze(Object.defineProperty({__proto__:null,mcp:ds,mcpToggle:hs},Symbol.toStringTag,{value:"Module"})),ms=()=>S("/api/installs"),ps=(s,t,n)=>A("/api/install",{host:s,path:t,action:n}),xs=(s,t,n)=>A("/api/install",{host:s,path:t,action:"remove",memory:n}),gs=(s,t)=>A("/api/view",{host:s,path:t}),fs=()=>A("/api/pick-folder",{}),js=Object.freeze(Object.defineProperty({__proto__:null,installRemove:xs,installToggle:ps,installs:ms,pickFolder:fs,selectView:gs},Symbol.toStringTag,{value:"Module"})),bs=()=>S("/api/ping"),vs=()=>A("/api/shutdown"),ys=()=>A("/api/restart"),Ns=Object.freeze(Object.defineProperty({__proto__:null,ping:bs,restart:ys,shutdown:vs},Symbol.toStringTag,{value:"Module"})),ve=s=>s?`?harness=${encodeURIComponent(s)}`:"",ks=s=>S(`/api/docs${ve(s)}`),ws=(s,t)=>S(`/api/docs/page/${encodeURIComponent(s)}${ve(t)}`),Ms=Object.freeze(Object.defineProperty({__proto__:null,docs:ks,docsPage:ws},Symbol.toStringTag,{value:"Module"})),Ss=()=>S("/api/rules"),Es=s=>A("/api/rules",s),_s=s=>A("/api/rules/promote",s),Cs=Object.freeze(Object.defineProperty({__proto__:null,rules:Ss,rulesMutate:Es,rulesPromote:_s},Symbol.toStringTag,{value:"Module"})),Ts=()=>S("/api/profile"),As=s=>A("/api/profile",s),$s=Object.freeze(Object.defineProperty({__proto__:null,profile:Ts,profileSave:As},Symbol.toStringTag,{value:"Module"})),Fs=()=>S("/api/excludes"),Ls=(s,t)=>A("/api/excludes",{action:s,path:t}),Os=Object.freeze(Object.defineProperty({__proto__:null,excludeMutate:Ls,excludes:Fs},Symbol.toStringTag,{value:"Module"})),_={...qe,...es,...as,...os,...us,...js,...Ns,...Ms,...Cs,...$s,...Os},Rs=new Set(["activity","diff","settings","harnesses","doctor","themes","graph","library","laws","rules","profile","skills","agents","about"]);function Ds(){const s=()=>{const a=((typeof window<"u"?window.location.hash:"")||"#/").slice(2).split("/").filter(Boolean);return a[0]==="section"?{view:"section",section:a[1]}:a[0]==="item"?{view:"item",type:a[1],name:decodeURIComponent(a[2]||"")}:a[0]==="docs"?{view:"docs",page:decodeURIComponent(a.slice(1).join("/")||"")}:a[0]==="activity"&&a[1]?{view:"activity-detail",sid:decodeURIComponent(a[1])}:Rs.has(a[0])?{view:a[0]}:{view:"dashboard"}},[t,n]=p.useState(s);return p.useEffect(()=>{const c=()=>n(s());return window.addEventListener("hashchange",c),()=>window.removeEventListener("hashchange",c)},[]),t}const W=s=>{window.location.hash=s},me={red:"#FF5C57",green:"#4ED888",yellow:"#E8B53D",blue:"#5B8CFF",magenta:"#C77DFF",cyan:"#3AD4C4",white:"#E9EFEA"},te={red:"#C53A36",green:"#2FA864",yellow:"#B8862A",blue:"#3C66D8",magenta:"#9A52D6",cyan:"#2BA89B",white:"#AEB8B0"},Q=s=>me[s]||me.cyan,Is=s=>s==="yellow"||s==="white"||s==="cyan"||s==="green"?"#06100D":"#FFFFFF";function Ps(s,t,n){if(!s)return;const c=n==="light";let a=c?te[t]||te.cyan:Q(t),l=c?"#FFFFFF":Is(t);c&&t==="white"&&(a="#566B62",l="#FFFFFF"),s.style.setProperty("--accent",a),s.style.setProperty("--accent-2",te[t]||te.cyan),s.style.setProperty("--accent-ink",l)}const Bs={cultivar:{dark:"#3AD4C4",light:"#127E73",ink:"#06100D",inkLight:"#FFFFFF"},greenhouse:{dark:"#74CE86",light:"#1C8450",ink:"#06140C",inkLight:"#FFFFFF"},operator:{dark:"#E8A23B",light:"#8F5E10",ink:"#1A1306",inkLight:"#FFFFFF"},heirloom:{dark:"#B9A6C6",light:"#6E5A7C",ink:"#1B1622",inkLight:"#FFFFFF"},matrix:{dark:"#19E37C",light:"#0B7A47",ink:"#04140C",inkLight:"#FFFFFF"},aurora:{dark:"#2DE0B8",light:"#0B7D62",ink:"#04231A",inkLight:"#FFFFFF"},perspective:{dark:"#FF7A59",light:"#C24A2C",ink:"#2A0E04",inkLight:"#FFFFFF"},sequencer:{dark:"#5B57E8",light:"#4F46E5",ink:"#FFFFFF",inkLight:"#FFFFFF"},cobalt:{dark:"#2BA8FF",light:"#1668A8",ink:"#021018",inkLight:"#FFFFFF"},cosmic:{dark:"#C081FF",light:"#7A33CC",ink:"#1A0833",inkLight:"#FFFFFF"},neon:{dark:"#DB245C",light:"#D81E5B",ink:"#FFFFFF",inkLight:"#FFFFFF"}};function Vs(s,t,n){const c=Bs[t];if(!s||!c)return!1;const a=n==="light";return s.style.setProperty("--accent",a?c.light:c.dark),s.style.setProperty("--accent-2",c.light),s.style.setProperty("--accent-ink",a?c.inkLight:c.ink),!0}const U={agents:{label:"Agents",type:"agent",desc:"capability specialists",icon:"agent"},skills:{label:"Skills",type:"skill",desc:"repeatable workflows",icon:"skill"},laws:{label:"Laws",type:"law",desc:"governance rules",icon:"law"},memory:{label:"Memory",type:"memory",desc:"durable facts",icon:"library"},notebook:{label:"Notebook",type:"notebook",desc:"sovereign space",icon:"notebook"},wiki:{label:"Knowledge",type:"wiki",desc:"knowledge base + setup",icon:"graph"},config:{label:"Config",type:"config",desc:"install metadata",icon:"settings"}},P=["agents","memory","notebook","wiki","config"],ba=P.filter(s=>s!=="agents"&&s!=="config"),va={config:"wiki"},zs=Object.fromEntries(Object.entries(U).map(([s,t])=>[t.type,s]));function le(s,t){const[n,c]=p.useState(()=>{try{return t(localStorage.getItem(s))}catch{return t(null)}});return p.useEffect(()=>{try{localStorage.setItem(s,n)}catch{}},[s,n]),[n,c]}const Hs="geneseed-mode";function Us(){const[s,t]=le(Hs,c=>c==="light"?"light":"dark");return[s,()=>t(c=>c==="light"?"dark":"light")]}const Ws="geneseed-flavour",Gs=[{id:"cultivar",short:"Cultivar",name:"Cultivar Evolved",tagline:"The calm default — cool teal ink, geometric sans, soft flat cards lit by one quiet shadow."},{id:"greenhouse",short:"Greenhouse",name:"Greenhouse",tagline:"Warm loam dark, fresh sage green, rounded humanist type — the softest, friendliest skin."},{id:"operator",short:"Operator",name:"Operator HUD",tagline:"Amber phosphor on cool charcoal — all-mono, zero-radius instrument readout."},{id:"heirloom",short:"Heirloom",name:"Heirloom",tagline:"Aubergine plum and serif display — the one luxe, calm, editorial skin."},{id:"matrix",short:"Matrix",name:"Matrix",tagline:"Acid-green order-book terminal on pure black — all Space Mono, square 2px, a faint code-grid."},{id:"aurora",short:"Aurora",name:"Aurora Glass",tagline:"The glass skin — frosted navy panels lit by a cyan-to-violet aurora, airy and weightless."},{id:"perspective",short:"Perspective",name:"Perspective",tagline:"Coral on cool slate, condensed-architectural headings, cards that physically lift off the page."},{id:"sequencer",short:"Sequencer",name:"Sequencer",tagline:"A quant terminal in daylight — indigo on white, Inter, lining numerals on a fine ruled grid."},{id:"cobalt",short:"Cobalt",name:"Cobalt Terminal",tagline:"Electric-blue hacker terminal — all-mono, 2px corners, CRT scanlines on near-black."},{id:"cosmic",short:"Cosmic",name:"Cosmic",tagline:"Violet-magenta nebula on near-black — wide Audiowide wordmark, chamfered sci-fi instrumentation."},{id:"neon",short:"Neon",name:"Neon",tagline:"Neon-noir: hot-pink edge-glow on near-black, all-mono Geist, frosted glass."}],Zs=new Set(Gs.map(s=>s.id)),Ks={a:"cultivar",b:"greenhouse",c:"operator",d:"heirloom",e:"matrix",f:"aurora",g:"perspective",z:"sequencer",cb:"cobalt",cm:"cosmic"};function Ys(){return le(Ws,s=>Zs.has(s)?s:Ks[s]||"cultivar")}const qs="geneseed-accent",Js=[{id:"auto",short:"Auto",tagline:"Follows the deployed voice's accent."},{id:"curated",short:"Curated",tagline:"Each theme's own signature colour."}],Xs=new Set(Js.map(s=>s.id));function Qs(){return le(qs,s=>s&&Xs.has(s)?s:"auto")}const et="geneseed-layout",st=[{id:"auto",short:"Auto",tagline:"Follows the theme."},{id:"cultivar",short:"Cultivar",tagline:"Hero, KPIs & genome grid."},{id:"greenhouse",short:"Greenhouse",tagline:"Ring, tiles & mix donut."},{id:"operator",short:"Operator",tagline:"Dense terminal readout."}],ye=new Set(st.map(s=>s.id));function tt(s){return s==="greenhouse"||s==="cobalt"?"greenhouse":s==="operator"?"operator":"cultivar"}function at(s,t){return t&&t!=="auto"&&ye.has(t)?t:tt(s)}function nt(){return le(et,s=>s&&ye.has(s)?s:"auto")}function ct(s){const[t,n]=p.useState(null),[c,a]=p.useState([]),l=()=>_.overview().then(n).catch(i=>s==null?void 0:s(i));return p.useEffect(()=>{l()},[]),p.useEffect(()=>{_.themes().then(i=>a(i.themes)).catch(()=>{})},[]),{overview:t,themes:c,reload:l}}const lt=600,it=1e3,rt=30;async function pe(s){await new Promise(t=>setTimeout(t,s));for(let t=0;t<rt;t++)try{await _.ping();break}catch{await new Promise(n=>setTimeout(n,it))}window.location.reload()}function ot({onFinish:s,onError:t}={}){const[n,c]=p.useState([]),[a,l]=p.useState(null),[i,r]=p.useState(!1);return p.useEffect(()=>{_.jobs().then(({jobs:x})=>{if(!x.length)return;c(x.map(d=>({id:d.id,action:d.action,status:d.status,output:d.output||"",duration:d.duration})));const o=x.find(d=>d.status==="running");o&&(l(o.id),r(!0))}).catch(()=>{})},[]),p.useEffect(()=>{var d;if(!a)return;const x=((d=n.find(g=>g.id===a))==null?void 0:d.action)==="update",o=setInterval(async()=>{try{const g=await _.job(a);if(c(j=>j.map(h=>h.id===a?{...h,output:g.output||"",status:g.status,duration:g.duration}:h)),g.status!=="running"){if(clearInterval(o),l(null),x){pe(2e3);return}s==null||s()}}catch{clearInterval(o),x&&pe(0)}},lt);return()=>clearInterval(o)},[a]),{runs:n,activeId:a,consoleOpen:i,setConsoleOpen:r,runAction:async(x,o)=>{try{const{job_id:d}=await _.action(x,o),g=x==="build"&&(o!=null&&o.theme)?`build (${o.theme} · ${o.emit})`:x;return c(j=>[...j,{id:d,action:g,status:"running",output:""}]),l(d),r(!0),d}catch(d){t==null||t(d)}},cancelJob:x=>_.cancelJob(x).catch(o=>t==null?void 0:t(o)),clearRuns:()=>c([])}}const dt={dashboard:"M3 13h7V3H3v10Zm0 8h7v-6H3v6Zm11 0h7V11h-7v10Zm0-18v6h7V3h-7Z",library:"M4 5h10v14H4zM16 7h4v12h-4M7 9h4M7 12h4",graph:"M6 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM18 8a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM18 20a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM7.5 14.5l8-8M16.7 15.2L8.8 16.6",changes:"M4 6h10M4 12h7M4 18h12M17 4l3 3-3 3M20 7h-6",doctor:"M12 3v6m0 0a4 4 0 0 1-4 4H7a3 3 0 0 0-3 3v2m8-9a4 4 0 0 0 4 4h1a3 3 0 0 1 3 3v2M12 3a1.5 1.5 0 1 0 0-.01",themes:"M12 3a9 9 0 1 0 0 18c1.1 0 2-.9 2-2 0-.5-.2-1-.5-1.3-.3-.4-.5-.8-.5-1.2 0-1 .8-1.5 1.7-1.5H17a4 4 0 0 0 4-4c0-4.4-4-8-9-8Z",settings:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm8-3a8 8 0 0 0-.1-1.3l2-1.6-2-3.4-2.4 1a8 8 0 0 0-2.2-1.3L15 2H9l-.3 2.6a8 8 0 0 0-2.2 1.3l-2.4-1-2 3.4 2 1.6A8 8 0 0 0 4 12c0 .4 0 .9.1 1.3l-2 1.6 2 3.4 2.4-1a8 8 0 0 0 2.2 1.3L9 22h6l.3-2.6a8 8 0 0 0 2.2-1.3l2.4 1 2-3.4-2-1.6c.1-.4.1-.9.1-1.3Z",search:"M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM21 21l-4.3-4.3",chevron:"M9 6l6 6-6 6",x:"M6 6l12 12M18 6L6 18",menu:"M4 7h16M4 12h16M4 17h16",play:"M7 5v14l11-7L7 5Z",clear:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14",download:"M12 3v12m0 0l-4-4m4 4l4-4M4 19h16",refresh:"M21 12a9 9 0 1 1-3-6.7M21 4v5h-5",folder:"M3 7a2 2 0 0 1 2-2h3.5l2 2H19a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z",build:"M14 3l-1 4 4-1 3 3-4 1 1 4-3 3-1-4-4 1-3-3 4-1-1-4 3-3 5 0Z",arrow:"M5 12h14M13 6l6 6-6 6",external:"M14 5h5v5M19 5l-8 8M12 5H6a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-6",copy:"M9 9h11v11H9zM5 15H4V4h11v1",spark:"M12 3v3m0 12v3m9-9h-3M6 12H3m13.5-6.5-2 2m-7 7-2 2m11 0-2-2m-7-7-2-2",activity:"M3 12h4l2.5-7 5 14 2.5-7H21",agent:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8ZM22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8",layers:"M12 3l9 5-9 5-9-5 9-5ZM3 13l9 5 9-5M3 17l9 5 9-5",sun:"M12 4V2M12 22v-2M4 12H2M22 12h-2M5.6 5.6 4.2 4.2M19.8 19.8l-1.4-1.4M18.4 5.6l1.4-1.4M4.2 19.8l1.4-1.4M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z",moon:"M21 12.8A8.5 8.5 0 1 1 11.2 3a6.5 6.5 0 0 0 9.8 9.8Z",power:"M12 3v9M7.5 6.5a7 7 0 1 0 9 0",docs:"M5 4h9l5 5v11a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1ZM14 4v5h5M8 12h7M8 16h7",skill:"M21.7 6.6a5 5 0 0 1-6.6 6.6l-7.4 7.4a2 2 0 1 1-2.8-2.8l7.4-7.4a5 5 0 0 1 6.6-6.6l-2.6 2.6a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0Z",law:"M12 3v18M5 6h14M8 21h8M6 6l-3 6h6zM3 12a3 3 0 0 1 6 0M18 6l-3 6h6zM15 12a3 3 0 0 1 6 0",rule:"M7 3h10a1 1 0 0 1 1 1v17l-6-3.5L6 21V4a1 1 0 0 1 1-1ZM9.5 9.5l1.8 1.8 3.4-3.6",profile:"M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8ZM5 20a7 7 0 0 1 14 0",notebook:"M7 4h11v16H7zM4 8h3M4 12h3M4 16h3M11 9h5M11 13h5M11 17h3",about:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18ZM12 11v6M12 7.6h.01",github:"M12 2a10 10 0 0 0-3.2 19.5c.5.1.7-.2.7-.5v-1.8c-2.8.6-3.4-1.2-3.4-1.2-.5-1.2-1.1-1.5-1.1-1.5-.9-.6.1-.6.1-.6 1 .1 1.5 1 1.5 1 .9 1.5 2.3 1.1 2.9.8.1-.6.3-1.1.6-1.3-2.2-.3-4.6-1.1-4.6-5 0-1.1.4-2 1-2.7-.1-.3-.4-1.3.1-2.7 0 0 .8-.3 2.7 1a9.4 9.4 0 0 1 5 0c1.9-1.3 2.7-1 2.7-1 .5 1.4.2 2.4.1 2.7.6.7 1 1.6 1 2.7 0 3.9-2.4 4.7-4.6 5 .4.3.7.9.7 1.8v2.6c0 .3.2.6.7.5A10 10 0 0 0 12 2Z"};function E({name:s,className:t="glyph",style:n}){return e.jsx("svg",{className:t,style:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:dt[s]||""})})}function ht({className:s="sprout"}){return e.jsxs("svg",{className:s,viewBox:"0 0 24 24","aria-hidden":"true",children:[e.jsx("path",{d:"M12 21.5v-9",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),e.jsx("path",{d:"M12 13c0-4.5 3.2-7.5 7.5-7.5 0 4.5-3.2 7.5-7.5 7.5z",fill:"var(--accent)"}),e.jsx("path",{d:"M12 14.5c0-3.6-2.6-6-6-6 0 3.6 2.6 6 6 6z",fill:"var(--accent)",opacity:".42"}),e.jsx("circle",{cx:"12",cy:"12.4",r:"1.1",fill:"var(--bg)"})]})}const ut=[{group:"Harness"},{hash:"#/",id:"dashboard",label:"Dashboard",icon:"dashboard",match:s=>s.view==="dashboard"},{hash:"#/activity",id:"activity",label:"Activity",icon:"activity",match:s=>s.view==="activity"},{hash:"#/laws",id:"laws",label:"Laws",icon:"law",match:s=>s.view==="laws"||s.view==="section"&&s.section==="laws"||s.view==="item"&&s.type==="law",tag:s=>{var t;return((t=s==null?void 0:s.counts)==null?void 0:t.laws)??null}},{hash:"#/rules",id:"rules",label:"Rules",icon:"rule",match:s=>s.view==="rules"},{hash:"#/profile",id:"profile",label:"Profile",icon:"profile",match:s=>s.view==="profile"},{hash:"#/skills",id:"skills",label:"Skills",icon:"skill",match:s=>s.view==="skills"||s.view==="section"&&s.section==="skills"||s.view==="item"&&s.type==="skill",tag:s=>{var t;return((t=s==null?void 0:s.counts)==null?void 0:t.skills)??null}},{hash:"#/agents",id:"agents",label:"Agents",icon:"agent",match:s=>s.view==="agents"||s.view==="section"&&s.section==="agents"||s.view==="item"&&s.type==="agent",tag:s=>{var t;return((t=s==null?void 0:s.counts)==null?void 0:t.agents)??null}},{hash:"#/library",id:"library",label:"Library",icon:"library",match:s=>s.view==="library"||s.view==="section"&&!["laws","skills","agents"].includes(s.section)||s.view==="item"&&!["law","skill","agent"].includes(s.type)},{hash:"#/docs",id:"docs",label:"Docs",icon:"docs",match:s=>s.view==="docs"},{hash:"#/graph",id:"graph",label:"Graph",icon:"graph",match:s=>s.view==="graph"},{group:"Maintain"},{hash:"#/diff",id:"changes",label:"Changes",icon:"changes",match:s=>s.view==="diff",tag:s=>(s!=null&&s.diff?s.diff.edited+s.diff.added:null)||null},{hash:"#/doctor",id:"doctor",label:"Doctor",icon:"doctor",match:s=>s.view==="doctor",tag:s=>s!=null&&s.doctor&&!s.doctor.ok?s.doctor.problems.length:null,warn:!0},{group:"Configure"},{hash:"#/harnesses",id:"harnesses",label:"Harnesses",icon:"layers",match:s=>s.view==="harnesses"},{hash:"#/themes",id:"themes",label:"Themes",icon:"themes",match:s=>s.view==="themes"},{hash:"#/settings",id:"settings",label:"Settings",icon:"settings",match:s=>s.view==="settings"},{group:"About"},{hash:"#/about",id:"about",label:"About",icon:"about",match:s=>s.view==="about"}];function mt({route:s,overview:t,onOpenVoice:n,onNavigate:c}){return e.jsxs("aside",{className:"rail",id:"rail-nav","aria-label":"Harness navigation",children:[e.jsxs("button",{className:"rail-brand",onClick:()=>{W("#/"),c==null||c()},title:"Dashboard",children:[e.jsx(ht,{}),e.jsxs("div",{className:"brand-text",children:[e.jsxs("span",{className:"brand-name",children:["Gene",e.jsx("b",{children:"seed"})]}),e.jsx("span",{className:"brand-sub",children:"harness console"})]})]}),ut.map((a,l)=>{if(a.group)return e.jsx("div",{className:"rail-group",children:a.group},"g"+l);const i=a.tag?a.tag(t):null,r=a.match(s);return e.jsx("div",{className:"rail-nav",children:e.jsxs("a",{className:`rail-item ${r?"active":""}`,href:a.hash,"aria-current":r?"page":void 0,title:a.label,onClick:()=>c==null?void 0:c(),children:[e.jsx(E,{name:a.icon}),e.jsx("span",{children:a.label}),i?e.jsx("span",{className:"tag",style:a.warn?{color:"var(--warn)"}:null,children:i}):null]})},a.id)}),e.jsx("div",{className:"rail-spacer"}),e.jsx("div",{className:"rail-foot",children:e.jsxs("button",{className:"voice",onClick:n,title:"Switch deployed voice",children:[e.jsx("span",{className:"voice-orb"}),e.jsxs("div",{className:"voice-meta",children:[e.jsx("div",{className:"vk",children:"deployed voice"}),e.jsx("div",{className:"vv",children:(t==null?void 0:t.theme)||"—"})]}),e.jsx(E,{name:"chevron",className:"chev glyph"})]})})]})}const Ne=60,ke=3600,pt=86400,ie={seconds:90,minutes:90*Ne,hours:36*ke};function xt(s){const t=Math.max(0,Date.now()/1e3-s);return t<ie.seconds?`${Math.round(t)}s`:t<ie.minutes?`${Math.round(t/Ne)}m`:t<ie.hours?`${Math.round(t/ke)}h`:`${Math.round(t/pt)}d`}function gt(s){return s?s.replace(/\\/g,"/").replace(/^\/?(home|Users)\/[^/]+/i,"~").replace(/^[A-Z]:\/Users\/[^/]+/i,"~"):"~"}const Z={deployed:.4,doctorClean:.25,doctorMinor:.15,doctorMinorMax:2,doctorFail:.05,versionSynced:.2,diskClean:.15};function ft(s,t){var l,i,r;if(!s)return 0;const n=((i=(l=s.doctor)==null?void 0:l.problems)==null?void 0:i.length)??99,c=(r=s.doctor)!=null&&r.ok?Z.doctorClean:n<=Z.doctorMinorMax?Z.doctorMinor:Z.doctorFail,a=t&&t.installed_fp&&t.installed_fp===t.source_fp;return(s.deployed?Z.deployed:0)+c+(a?Z.versionSynced:0)+(s.diff&&s.diff.missing===0?Z.diskClean:0)}const we=s=>Math.max(...P.map(t=>(s==null?void 0:s[t])??0),1),ee=s=>((s==null?void 0:s.edited)??0)+((s==null?void 0:s.added)??0);function jt(){const[s,t]=p.useState(null),[n,c]=p.useState(""),a=p.useRef(null),l=p.useCallback(()=>{if(s||a.current)return a.current;const i=(async()=>{const r=[],u=["laws","skills",...P],f=await Promise.all(u.map(async x=>{try{const o=await _.catalog(x);return{sec:x,items:(o==null?void 0:o.items)||[]}}catch{return{sec:x,items:[]}}}));for(const{sec:x,items:o}of f){const d=U[x];for(const g of o){const j=g.title||g.name;r.push({kind:d.label,sortKey:u.indexOf(x),title:j,desc:g.desc||"",hay:`${j} ${g.desc||""} ${g.name||""}`.toLowerCase(),route:`#/item/${d.type}/${encodeURIComponent(g.name)}`})}}try{const x=await _.mcp(),o=new Set;for(const d of(x==null?void 0:x.targets)||[])for(const g of d.servers||[]){if(o.has(g.name))continue;o.add(g.name);const j=g.label||g.name;r.push({kind:"MCP servers",sortKey:100,title:j,desc:g.desc||"",hay:`${j} ${g.desc||""} ${g.name||""} mcp`.toLowerCase(),route:"#/settings"})}}catch{}try{const x=await _.docs();for(const o of(x==null?void 0:x.groups)||[])for(const d of o.pages||[])r.push({kind:"Docs",sortKey:110,title:d.title,desc:o.label,hay:`${d.title||""} ${d.id||""} ${o.label||""}`.toLowerCase(),route:`#/docs/${encodeURIComponent(d.id)}`})}catch{}return t(r),a.current=null,r})().catch(r=>(a.current=null,c(r.message||String(r)),[]));return a.current=i,i},[s]);return{index:s,error:n,prime:l}}const bt=24;function vt(s,t){const n=s.title.toLowerCase();return n.startsWith(t)?0:n.includes(t)?1:s.hay.includes(t)?2:-1}function Me(s,t){const n=t.toLowerCase().trim();if(!n||!s)return[];const c=[];for(const a of s){const l=vt(a,n);l>=0&&c.push({e:a,s:l})}return c.sort((a,l)=>a.s-l.s||a.e.sortKey-l.e.sortKey||a.e.title.localeCompare(l.e.title)),c.slice(0,bt).map(a=>a.e)}function yt({query:s,index:t,loading:n,active:c,onActive:a,onClose:l}){const i=p.useMemo(()=>Me(t,s),[t,s]),r=p.useRef(null);p.useEffect(()=>{c>=i.length&&a(0)},[i,c,a]),p.useEffect(()=>{var d;const o=(d=r.current)==null?void 0:d.querySelector(`[data-spot-row="${c}"]`);o==null||o.scrollIntoView({block:"nearest"})},[c]);const u=o=>{o&&(W(o.route),l())},f=[];let x=null;return i.forEach((o,d)=>{(!x||x.kind!==o.kind)&&(x={kind:o.kind,rows:[]},f.push(x)),x.rows.push({entry:o,index:d})}),s.trim()?e.jsxs("div",{className:"spotlight",ref:r,role:"listbox",children:[n&&!t&&e.jsx("div",{className:"spot-empty",children:"Loading…"}),!n&&i.length===0&&t&&e.jsxs("div",{className:"spot-empty",children:["No matches for “",s,"”."]}),f.map(o=>e.jsxs("div",{className:"spot-group",children:[e.jsx("div",{className:"spot-group-head",children:o.kind}),o.rows.map(({entry:d,index:g})=>e.jsxs("div",{"data-spot-row":g,role:"option","aria-selected":g===c,className:`spot-row ${g===c?"on":""}`,onMouseDown:j=>{j.preventDefault(),u(d)},onMouseEnter:()=>a(g),children:[e.jsx("div",{className:"spot-title",children:d.title}),d.desc?e.jsx("div",{className:"spot-desc",children:d.desc}):null]},`${d.route}-${g}`))]},o.kind))]}):null}function Nt({value:s,onChange:t}){const n=p.useRef(null),c=p.useRef(null),[a,l]=p.useState(!1),[i,r]=p.useState(0),{index:u,prime:f}=jt();p.useEffect(()=>{const d=g=>{var j;g.key!=="/"||g.target.closest("input, textarea, select")||(g.preventDefault(),(j=n.current)==null||j.focus())};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[]),p.useEffect(()=>{if(!a)return;const d=g=>{var j;(j=c.current)!=null&&j.contains(g.target)||l(!1)};return window.addEventListener("mousedown",d),()=>window.removeEventListener("mousedown",d)},[a]);const x=a&&!!s.trim(),o=d=>{var j,h;if(!x)return;const g=Me(u,s);if(d.key==="ArrowDown")d.preventDefault(),r(m=>Math.min(m+1,Math.max(g.length-1,0)));else if(d.key==="ArrowUp")d.preventDefault(),r(m=>Math.max(m-1,0));else if(d.key==="Enter"){const m=g[i];m&&(d.preventDefault(),W(m.route),l(!1),(j=n.current)==null||j.blur())}else d.key==="Escape"&&(d.preventDefault(),s?t(""):(l(!1),(h=n.current)==null||h.blur()))};return e.jsxs("div",{className:"tb-search",ref:c,children:[e.jsx(E,{name:"search",className:"mag glyph"}),e.jsx("input",{ref:n,value:s,onChange:d=>{t(d.target.value),r(0)},onFocus:()=>{l(!0),f()},onKeyDown:o,placeholder:"Search the harness…"}),e.jsx("span",{className:"kbd",children:"/"}),x&&e.jsx(yt,{query:s,index:u,loading:!u,active:i,onActive:r,onClose:()=>{var d;l(!1),(d=n.current)==null||d.blur()}})]})}function Se(s,t=[]){const[n,c]=p.useState(null),[a,l]=p.useState(""),[i,r]=p.useState(!0),u=p.useRef(s);u.current=s;const f=p.useCallback(()=>(r(!0),l(""),Promise.resolve(u.current()).then(x=>c(x)).catch(x=>l(x.message)).finally(()=>r(!1))),t);return p.useEffect(()=>{f()},[f]),{data:n,error:a,loading:i,reload:f,setData:c}}function kt({dataRev:s,onSwitch:t}){const{data:n}=Se(()=>_.installs(),[s]),c=((n==null?void 0:n.installs)||[]).filter(i=>i.state==="active");if(c.length<2)return null;const a=c.find(i=>i.selected)||c[0],l=async i=>{const r=c.find(u=>u.id===i.target.value);if(r)try{await _.selectView(r.host,r.path),t==null||t()}catch{}};return e.jsxs("div",{className:"row gap-8",style:{alignItems:"center"},title:"Harness the console is viewing",children:[e.jsx("span",{style:{fontSize:12,color:"var(--text-3)"},children:"harness"}),e.jsx("select",{className:"sel","aria-label":"harness to view",value:a.id,onChange:l,children:c.map(i=>e.jsxs("option",{value:i.id,children:[i.host," · ",i.scope]},i.id))})]})}const wt={dashboard:"overview",diff:"diff",doctor:"doctor",themes:"themes",graph:"graph",settings:"settings"};function Mt(s){return s.view==="section"?["laws","skills"].includes(s.section)?s.section:"library":s.view==="item"?s.type==="law"?"laws":s.type==="skill"?"skills":"library":wt[s.view]||s.view}function St({route:s,navOpen:t,onToggleNav:n,target:c,query:a,onQuery:l,mode:i,onToggleMode:r,onShutdown:u,dataRev:f,onSwitch:x}){return e.jsxs("header",{className:"topbar",children:[e.jsx("button",{className:"tb-menu",onClick:n,"aria-label":t?"Close navigation":"Open navigation","aria-expanded":!!t,"aria-controls":"rail-nav",children:e.jsx(E,{name:t?"x":"menu"})}),e.jsxs("div",{className:"prompt",children:[e.jsx("span",{className:"path",children:gt(c)}),e.jsx("span",{className:"sep",children:"$"}),e.jsx("span",{className:"cmd",children:"geneseed"})," ",e.jsxs("span",{className:"flag",children:["--tab=",Mt(s)]}),e.jsx("span",{className:"cur"})]}),e.jsx("div",{className:"topbar-spacer"}),e.jsx(kt,{dataRev:f,onSwitch:x}),e.jsx(Nt,{value:a,onChange:l}),e.jsx("button",{className:"iconbtn",title:i==="light"?"Switch to dark":"Switch to light",onClick:r,children:e.jsx(E,{name:i==="light"?"moon":"sun"})}),e.jsx("button",{className:"iconbtn",title:"Stop server",onClick:u,children:e.jsx(E,{name:"power"})})]})}function Et({themes:s,current:t,onPick:n,onClose:c}){const a=p.useRef(null);return p.useEffect(()=>{const l=i=>{a.current&&!a.current.contains(i.target)&&c()};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[c]),e.jsxs("div",{className:"pop",ref:a,children:[e.jsx("div",{className:"tick",style:{padding:"4px 10px 8px"},children:"Switch voice"}),s.map(l=>e.jsxs("div",{className:`pop-item ${l.name===t?"on":""}`,onClick:()=>n(l.name),children:[e.jsx("span",{className:"po",style:{background:Q(l.accent),boxShadow:`0 0 8px ${Q(l.accent)}`}}),e.jsx("span",{className:"pn",children:l.name})]},l.name))]})}const _t=3500;function Ct({toast:s,onClose:t}){return p.useEffect(()=>{const n=setTimeout(t,_t);return()=>clearTimeout(n)},[s]),e.jsxs("div",{className:`toast ${s.kind}`,children:[e.jsx("div",{children:s.msg}),e.jsx("div",{style:{marginTop:8},children:e.jsx("button",{className:"btn ghost",onClick:t,children:"Dismiss"})})]})}function Tt({runs:s,open:t,onToggle:n,onClear:c,onCancel:a,busy:l}){const i=p.useRef(null),r=s.length?s[s.length-1].output.length:0;return p.useEffect(()=>{const u=i.current;u&&t&&(u.scrollTop=u.scrollHeight)},[s.length,r,t]),e.jsxs("div",{className:"console",style:{height:"42vh",transform:t?"none":"translateY(calc(42vh - 42px))"},children:[e.jsxs("div",{className:"console-head",onClick:n,children:[e.jsxs("span",{className:"ttl",children:[e.jsx("span",{className:`live ${l?"on":""}`}),"terminal"]}),e.jsx("span",{className:"count",children:s.length}),e.jsxs("div",{className:"right",onClick:u=>u.stopPropagation(),children:[e.jsx("button",{className:"iconbtn",title:"Clear",onClick:c,disabled:!s.length,children:e.jsx(E,{name:"clear"})}),e.jsx("button",{className:"iconbtn",title:t?"Collapse":"Expand","aria-expanded":t,onClick:n,children:e.jsx(E,{name:"chevron",className:"glyph",style:{transform:t?"rotate(90deg)":"rotate(-90deg)"}})})]})]}),t&&e.jsxs("div",{className:"console-body",ref:i,children:[s.length===0&&e.jsx("div",{className:"console-empty",children:"No commands run yet. Actions you trigger stream here."}),s.map(u=>e.jsxs("div",{className:"run",children:[e.jsxs("div",{className:"run-head",children:[e.jsx("span",{className:"pr",children:"$"}),e.jsx("span",{className:"act",children:u.action}),e.jsx("span",{className:`st ${u.status}`,children:u.status==="running"?"…running":`${u.status==="done"?"✓ done":"✗ failed"}${u.duration?` · ${u.duration}s`:""}`}),u.status==="running"&&a&&e.jsx("button",{className:"iconbtn run-cancel",title:"Cancel this run",onClick:()=>a(u.id),children:e.jsx(E,{name:"x"})})]}),u.output&&e.jsx("pre",{className:"run-out",children:u.output})]},u.id))]})]})}const At=550,xe="gs-splash-seen";function $t(){try{if(window.localStorage.getItem(xe))return 0;window.localStorage.setItem(xe,"1")}catch{}return At}function Ft({ready:s,onDone:t}){const[n,c]=p.useState(!1),[a,l]=p.useState(!1);p.useEffect(()=>{const r=$t();if(!r){c(!0);return}const u=setTimeout(()=>c(!0),r);return()=>clearTimeout(u)},[]),p.useEffect(()=>{s&&n&&l(!0)},[s,n]),p.useEffect(()=>{if(!a)return;const r=setTimeout(()=>t==null?void 0:t(),700);return()=>clearTimeout(r)},[a]);const i=r=>{r.animationName==="splashOut"&&(t==null||t())};return e.jsxs("div",{className:`boot-splash${a?" fading":""}`,"aria-hidden":"true",onAnimationEnd:i,children:[e.jsxs("div",{className:"boot-dial",children:[e.jsxs("svg",{className:"boot-ring",viewBox:"0 0 172 172",children:[e.jsx("circle",{cx:"86",cy:"86",r:"72",fill:"none",stroke:"var(--surface-3)",strokeWidth:"9"}),e.jsx("circle",{cx:"86",cy:"86",r:"50",fill:"none",stroke:"var(--line-2)",strokeWidth:"8",strokeDasharray:"1.2 5.3",opacity:".7"}),e.jsx("circle",{className:"boot-progress",cx:"86",cy:"86",r:"72",fill:"none",stroke:"var(--accent)",strokeWidth:"9",strokeLinecap:"round"})]}),e.jsxs("svg",{className:"boot-sprout",viewBox:"0 0 24 24",children:[e.jsx("path",{className:"bs-stem",d:"M12 21.5v-9",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),e.jsx("path",{className:"bs-leaf bs-leaf-main",d:"M12 13c0-4.5 3.2-7.5 7.5-7.5 0 4.5-3.2 7.5-7.5 7.5z",fill:"var(--accent)"}),e.jsx("path",{className:"bs-leaf bs-leaf-back",d:"M12 14.5c0-3.6-2.6-6-6-6 0 3.6 2.6 6 6 6z",fill:"var(--accent)",opacity:".42"}),e.jsx("circle",{cx:"12",cy:"12.4",r:"1.1",fill:"var(--bg)"})]})]}),e.jsxs("div",{className:"boot-status",children:[e.jsx("span",{children:"germinating harness"}),e.jsx("span",{className:"boot-caret"})]})]})}function Ee({label:s="Loading…"}){return e.jsx("div",{className:"loading",children:s})}function Lt({value:s,size:t=232}){const n=t/2-14,c=2*Math.PI*n,a=c*(1-s);return e.jsxs("div",{className:"ring-wrap",style:{width:t,height:t},children:[e.jsxs("svg",{viewBox:`0 0 ${t} ${t}`,children:[e.jsx("circle",{cx:t/2,cy:t/2,r:n,fill:"none",stroke:"var(--surface-3)",strokeWidth:"10"}),e.jsx("circle",{cx:t/2,cy:t/2,r:n,fill:"none",stroke:"var(--accent)",strokeWidth:"10",strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:a,style:{transition:"stroke-dashoffset 1.1s cubic-bezier(.2,.7,.2,1)"}}),Array.from({length:48}).map((l,i)=>{const r=i/48*2*Math.PI,u=n-18,f=n-24,x=t/2+Math.cos(r)*u,o=t/2+Math.sin(r)*u,d=t/2+Math.cos(r)*f,g=t/2+Math.sin(r)*f;return e.jsx("line",{x1:x,y1:o,x2:d,y2:g,stroke:"var(--line-2)",strokeWidth:"1",opacity:i/48<s?.9:.25},i)})]}),e.jsxs("div",{className:"ring-center",children:[e.jsxs("div",{className:"pct",children:[Math.round(s*100),e.jsx("span",{style:{fontSize:20,color:"var(--text-3)"},children:"%"})]}),e.jsx("div",{className:"lbl",children:"germination"})]})]})}function Ot({overview:s}){const t=ee(s.diff),n=s.counts||{},c=[{key:"agents",label:"Agents",hash:"#/agents"},{key:"skills",label:"Skills",hash:"#/skills"},{key:"laws",label:"Laws",hash:"#/laws"}];return e.jsxs("div",{className:"card kpiband rise mb-16",children:[c.map(a=>{const l=n[a.key];return e.jsxs("a",{className:"kseg",href:a.hash,title:`Open ${a.label}`,children:[e.jsx("span",{className:"kseg-n"+(l===0?" zero":""),children:l??"—"}),e.jsx("span",{className:"kseg-l",children:a.label})]},a.key)}),e.jsx("div",{className:"kseg-spacer"}),e.jsxs("button",{className:"kseg"+(t>0?" hot":""),onClick:()=>W("#/diff"),title:"Open changes",children:[e.jsx("span",{className:"kseg-n"+(t===0?" zero":""),children:t}),e.jsx("span",{className:"kseg-l",children:"Local edits"}),t>0&&e.jsx("span",{className:"delta up",children:"▲"})]})]})}function Rt({overview:s}){return e.jsx("div",{className:"genome",children:P.map((t,n)=>{var l;const c=U[t],a=(l=s.counts)==null?void 0:l[t];return e.jsxs("div",{className:"card gcell rise",style:{animationDelay:`${n*50}ms`},onClick:()=>W("#/section/"+t),children:[e.jsxs("div",{className:"gtop",children:[e.jsx("span",{className:"gname",children:c.label}),e.jsx(E,{name:c.icon,className:"gicon"})]}),e.jsx("div",{className:"gcount"+(a===0?" zero":""),children:a??"—"}),e.jsx("div",{className:"gdesc",children:c.desc})]},t)})})}function de({jobs:s}){if(!s||s.length===0)return e.jsx("div",{className:"feed",children:e.jsxs("div",{className:"empty",children:[e.jsx("div",{className:"big",children:"No activity yet"}),"Actions you run appear here."]})});const t={done:"ok",running:"acc",failed:"bad"},n=[...s].sort((c,a)=>a.started-c.started).slice(0,8);return e.jsx("div",{className:"feed",children:n.map(c=>e.jsxs("div",{className:"feed-row",children:[e.jsx("span",{className:`feed-dot ${t[c.status]||"ok"}`}),e.jsx("span",{className:"feed-txt",children:e.jsx("b",{children:c.action})}),e.jsxs("span",{className:"feed-when",children:[xt(c.started)," ago"]})]},c.id))})}const Dt={neutral:"Loaded & ready",imperial:"The Codex in force",military:"The unit stands ready",cyberpunk:"Jacked in",wizard:"Wards in place",pirate:"The crew stands ready",gamer:"Game loaded",sports:"The squad takes the field",biker:"The crew rolls out",commentator:"Lights out, away we go",verstappen:"Setup's in",joker:"Mic check",mean:"Rules are up",marvin:"Online. Reluctantly."};function It({overview:s,sigil:t,setup:n,jobs:c,onAction:a}){const l=s.deployed?Dt[s.theme]||"Loaded & ready":"Not deployed",i=ft(s,n);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"card pad-lg rise mb-16",children:e.jsxs("div",{className:"hero",children:[e.jsx(Lt,{value:i}),e.jsxs("div",{className:"hero-facts",children:[e.jsx("div",{className:"ttl",children:l}),t&&e.jsxs("div",{className:"voice-readout",children:[e.jsx("span",{className:"vr-cur",children:"▕"}),e.jsx("span",{className:"vr-txt",children:t})]},s.theme),e.jsxs("p",{className:"sub",children:["One source rendered into ",e.jsx("code",{children:s.target}),". Every repo on this machine inherits it."]}),e.jsxs("div",{className:"hero-chips",children:[e.jsxs("span",{className:"chip",children:[e.jsx("span",{className:"ck",children:"voice"}),e.jsx("span",{className:"cv",style:{textTransform:"capitalize"},children:s.theme})]}),e.jsxs("span",{className:"chip",children:[e.jsx("span",{className:"ck",children:"mode"}),e.jsx("span",{className:"cv",children:s.emit})]}),e.jsxs("span",{className:"chip",children:[e.jsx("span",{className:"ck",children:"footprint"}),e.jsx("span",{className:"cv",children:s.footprint})]}),e.jsxs("span",{className:"chip",children:[e.jsx("span",{className:"ck",children:"built"}),e.jsx("span",{className:"cv",children:s.build_time||"unknown"})]}),e.jsxs("span",{className:"chip",children:[e.jsx("span",{className:"ck",children:"fp"}),e.jsx("span",{className:"cv",children:(n==null?void 0:n.installed_fp)||"—"})]})]}),e.jsxs("div",{className:"row wrap gap-10",children:[e.jsxs("button",{className:"btn",onClick:()=>a("update"),children:[e.jsx(E,{name:"refresh"}),"Update"]}),e.jsxs("button",{className:"btn ghost",onClick:()=>a("build-all"),children:[e.jsx(E,{name:"build"}),"Rebuild"]}),e.jsxs("button",{className:"btn ghost",onClick:()=>a("doctor"),children:[e.jsx(E,{name:"doctor"}),"Run doctor"]})]})]})]})}),e.jsx(Ot,{overview:s}),e.jsxs("div",{className:"grid split-status",children:[e.jsxs("div",{className:"card pad-lg",children:[e.jsxs("div",{className:"card-head",children:[e.jsx("h3",{children:"Capability genome"}),e.jsx("div",{className:"right",children:e.jsxs("span",{className:"tick",children:[P.length," sections"]})})]}),e.jsx(Rt,{overview:s})]}),e.jsxs("div",{className:"card pad-lg",children:[e.jsxs("div",{className:"card-head",children:[e.jsx("h3",{children:"Recent activity"}),e.jsx("div",{className:"right",children:e.jsxs("span",{className:"badge acc",children:[e.jsx("span",{className:"dot"}),"live"]})})]}),e.jsx(de,{jobs:c})]})]})]})}function Pt({k:s,overview:t,max:n}){var l;const c=U[s],a=((l=t.counts)==null?void 0:l[s])??0;return e.jsxs("div",{className:"strand",onClick:()=>W("#/section/"+s),children:[e.jsxs("span",{className:"strand-name",children:[e.jsx("span",{className:"strand-dot"}),e.jsx("span",{children:c.label})]}),e.jsx("div",{className:"hbar",children:e.jsx("i",{style:{width:`${a/n*100}%`}})}),e.jsx("span",{className:"strand-val",children:a})]})}const T={maxNodes:28,goldenAngle:2.39996,seedRadiusScale:.42,iterations:90,repulsion:480,springLength:46,springStiffness:.05,centrePull:.005,boundsMargin:{x:16,y:14},edgeCurve:{max:20,scale:.14}},K={baseRadius:{agent:4,law:3,skill:3.2},degreeScale:.45,degreeMax:3.6,hubGlowScale:3.2,hub:{minDegree:3,maxFraction:.55}};function Bt({graph:s}){const[c,a]=p.useState(null),{nodes:l,edges:i,pos:r,degrees:u,maxDeg:f}=p.useMemo(()=>{const j={nodes:[],edges:[],pos:new Map,degrees:new Map,maxDeg:0};if(!s||!s.nodes.length)return j;const h=new Map;s.edges.forEach(w=>{h.set(w.source,(h.get(w.source)||0)+1),h.set(w.target,(h.get(w.target)||0)+1)});const b=[...s.nodes].sort((w,N)=>(h.get(N.id)||0)-(h.get(w.id)||0)).slice(0,T.maxNodes),y=new Set(b.map(w=>w.id)),k=s.edges.filter(w=>y.has(w.source)&&y.has(w.target)),L=440/2,O=230/2,$=new Map;b.forEach((w,N)=>{if(N===0)$.set(w.id,{x:L,y:O});else{const R=N*T.goldenAngle,C=Math.sqrt(N/b.length);$.set(w.id,{x:L+Math.cos(R)*C*(440*T.seedRadiusScale),y:O+Math.sin(R)*C*(230*T.seedRadiusScale)})}});const v=b.map(w=>$.get(w.id));for(let w=0;w<T.iterations;w++){for(let N=0;N<v.length;N++)for(let R=N+1;R<v.length;R++){const C=v[N],D=v[R],B=C.x-D.x,I=C.y-D.y,z=B*B+I*I||1,V=Math.sqrt(z),Y=T.repulsion/z;C.x+=B/V*Y,C.y+=I/V*Y,D.x-=B/V*Y,D.y-=I/V*Y}for(const N of k){const R=$.get(N.source),C=$.get(N.target),D=C.x-R.x,B=C.y-R.y,I=Math.sqrt(D*D+B*B)||1,z=(I-T.springLength)*T.springStiffness;R.x+=D/I*z,R.y+=B/I*z,C.x-=D/I*z,C.y-=B/I*z}for(const N of v)N.x+=(L-N.x)*T.centrePull,N.y+=(O-N.y)*T.centrePull,N.x=Math.max(T.boundsMargin.x,Math.min(440-T.boundsMargin.x,N.x)),N.y=Math.max(T.boundsMargin.y,Math.min(230-T.boundsMargin.y,N.y))}const G=Math.max(1,...h.values());return{nodes:b,edges:k,pos:$,degrees:h,maxDeg:G}},[s]),x=p.useMemo(()=>{if(!c)return null;const j=new Set([c]);return i.forEach(h=>{h.source===c&&j.add(h.target),h.target===c&&j.add(h.source)}),j},[c,i]);if(!l.length)return e.jsx("div",{style:{height:200,display:"grid",placeItems:"center",color:"var(--text-3)",fontSize:13},children:"no cross-links yet"});const o=c?r.get(c):null,d=c?l.find(j=>j.id===c):null,g=(d==null?void 0:d.type)==="law"?`Rule ${c}`:c;return e.jsxs("svg",{viewBox:"0 0 440 230",style:{width:"100%",height:"auto",display:"block"},role:"img","aria-label":"Cross-link constellation",onMouseLeave:()=>a(null),children:[e.jsx("defs",{children:e.jsxs("radialGradient",{id:"mg-hub-glow",cx:"50%",cy:"50%",r:"50%",children:[e.jsx("stop",{offset:"0%",stopColor:"var(--accent)",stopOpacity:"0.42"}),e.jsx("stop",{offset:"60%",stopColor:"var(--accent)",stopOpacity:"0.08"}),e.jsx("stop",{offset:"100%",stopColor:"var(--accent)",stopOpacity:"0"})]})}),i.map((j,h)=>{const m=r.get(j.source),b=r.get(j.target);if(!m||!b)return null;const y=c&&(j.source===c||j.target===c),k=c&&!y,L=b.x-m.x,O=b.y-m.y,$=Math.sqrt(L*L+O*O)||1,v=Math.min(T.edgeCurve.max,$*T.edgeCurve.scale),G=(m.x+b.x)/2+-O/$*v,w=(m.y+b.y)/2+L/$*v;return e.jsx("path",{d:`M${m.x},${m.y} Q${G},${w} ${b.x},${b.y}`,fill:"none",stroke:y?"var(--accent)":"var(--line-2)",strokeWidth:y?1.3:.9,opacity:k?.14:y?.95:.55},h)}),l.map(j=>{const h=r.get(j.id);if(!h)return null;const m=u.get(j.id)||0,y=(K.baseRadius[j.type]??K.baseRadius.skill)+Math.min(K.degreeMax,m*K.degreeScale),k=m>=Math.max(K.hub.minDegree,f*K.hub.maxFraction),L=m===0,O=x&&!x.has(j.id),$=j.type==="agent"?"var(--accent)":j.type==="law"?"var(--warn)":"var(--good)";return e.jsxs("g",{opacity:O?.22:1,onMouseEnter:()=>a(j.id),style:{cursor:"pointer"},children:[k&&e.jsx("circle",{cx:h.x,cy:h.y,r:y*K.hubGlowScale,fill:"url(#mg-hub-glow)"}),e.jsx("circle",{cx:h.x,cy:h.y,r:y,fill:$,fillOpacity:L?.55:1,stroke:"var(--bg)",strokeWidth:"1.4"})]},j.id)}),o&&e.jsx("text",{x:o.x+(o.x>350?-10:10),y:o.y-9,textAnchor:o.x>350?"end":"start",fontSize:"11",fill:"var(--text)",style:{paintOrder:"stroke",stroke:"var(--bg)",strokeWidth:3},children:g})]})}function Vt({overview:s,sigil:t,setup:n,jobs:c,graph:a}){const l=we(s.counts),i=(n==null?void 0:n.version_verdict)||"",r=i.includes("up to date"),u=ee(s.diff),f=[["Source","src/, the canonical genetic material",(n==null?void 0:n.source_fp)||"—",!0],["Render",`geneseed build → ${s.emit}`,s.theme+" voice",!0],["Deployed",s.target,"inherited by every repo",!1]];return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid split-lineage mb-16",children:[e.jsxs("div",{className:"card pad-lg rise",style:{position:"relative",overflow:"hidden"},children:[e.jsx("h2",{className:"h",style:{fontSize:22,margin:"0 0 18px"},children:"Gene-seed lineage"}),e.jsxs("div",{className:"lineage-track",children:[e.jsx("div",{className:"spine"}),f.map(([x,o,d,g],j)=>e.jsxs("div",{className:"lineage-step",children:[e.jsx("span",{className:`node ${g?"on":""}`}),e.jsx("div",{className:"lt",children:x}),e.jsx("div",{className:"ld",children:o}),e.jsx("div",{className:"ltag",children:d})]},j))]}),e.jsx("hr",{className:"hr"}),t&&e.jsxs("div",{className:"voice-readout",style:{marginBottom:14},children:[e.jsx("span",{className:"vr-cur",children:"▕"}),e.jsx("span",{className:"vr-txt",children:t})]},s.theme),e.jsxs("div",{className:"row wrap gap-10",children:[e.jsxs("span",{className:`badge ${r?"ok":"warn"}`,children:[e.jsx("span",{className:"dot"}),"in sync · ",i]}),e.jsxs("span",{className:"badge",children:[e.jsx("span",{className:"dot"}),u," local edits"]})]})]}),e.jsxs("div",{className:"card pad-lg rise",style:{animationDelay:"80ms"},children:[e.jsxs("div",{className:"card-head",children:[e.jsx("h3",{children:"Cross-link constellation"}),e.jsx("div",{className:"right",children:e.jsxs("button",{className:"btn soft sm",onClick:()=>W("#/graph"),children:["Open graph",e.jsx(E,{name:"arrow"})]})})]}),e.jsx(Bt,{graph:a})]})]}),e.jsxs("div",{className:"grid split-even",children:[e.jsxs("div",{className:"card pad-lg",children:[e.jsxs("div",{className:"card-head",children:[e.jsx("h3",{children:"Genome strand"}),e.jsx("div",{className:"right",children:e.jsx("span",{className:"tick",children:"by volume"})})]}),P.map(x=>e.jsx(Pt,{k:x,overview:s,max:l},x))]}),e.jsxs("div",{className:"card pad-lg",children:[e.jsx("div",{className:"card-head",children:e.jsx("h3",{children:"Recent activity"})}),e.jsx(de,{jobs:c})]})]})]})}function zt({overview:s,setup:t,jobs:n}){var u,f,x;const c=P.reduce((o,d)=>{var g;return o+(((g=s.counts)==null?void 0:g[d])??0)},0),a=we(s.counts),l=(u=s.doctor)==null?void 0:u.ok,i=((x=(f=s.doctor)==null?void 0:f.problems)==null?void 0:x.length)??0,r=ee(s.diff);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"card pad-md rise mb-16",children:e.jsx("div",{className:"row wrap between gap-16",children:e.jsxs("div",{className:"row",style:{gap:20,flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsx("div",{className:"tick",children:"status"}),e.jsx("div",{className:"row",style:{gap:8,marginTop:4},children:e.jsxs("span",{className:`badge ${s.deployed?"ok":"warn"}`,children:[e.jsx("span",{className:"dot"}),s.deployed?"deployed":"not deployed"]})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"tick",children:"voice"}),e.jsx("div",{className:"metric",style:{fontSize:18,marginTop:6,textTransform:"capitalize"},children:s.theme})]}),e.jsxs("div",{children:[e.jsx("div",{className:"tick",children:"mode"}),e.jsx("div",{className:"mono",style:{fontSize:14,marginTop:6},children:s.emit})]}),e.jsxs("div",{children:[e.jsx("div",{className:"tick",children:"fingerprint"}),e.jsx("div",{className:"mono",style:{fontSize:14,marginTop:6,color:"var(--accent)"},children:(t==null?void 0:t.installed_fp)||"—"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"tick",children:"doctor"}),e.jsx("div",{className:"row",style:{gap:8,marginTop:4},children:l?e.jsxs("span",{className:"badge ok",children:[e.jsx("span",{className:"dot"}),"clean"]}):e.jsxs("span",{className:"badge warn",children:[e.jsx("span",{className:"dot"}),i," issue",i!==1?"s":""]})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"tick",children:"edits"}),e.jsx("div",{className:"metric",style:{fontSize:18,marginTop:6},children:r})]})]})})}),e.jsxs("div",{className:"grid split-operator",children:[e.jsxs("div",{className:"card rise",style:{animationDelay:"60ms"},children:[e.jsxs("div",{className:"card-head pad-lg",style:{padding:"18px 20px 0",marginBottom:14},children:[e.jsx("h3",{children:"Sections"}),e.jsx("div",{className:"right",children:e.jsxs("span",{className:"tick",children:[c," entries total"]})})]}),e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Section"}),e.jsx("th",{children:"Detail"}),e.jsx("th",{style:{width:130},children:"Share"}),e.jsx("th",{className:"num",children:"Count"})]})}),e.jsx("tbody",{children:P.map(o=>{var j;const d=U[o],g=((j=s.counts)==null?void 0:j[o])??0;return e.jsxs("tr",{className:"clickable",onClick:()=>W("#/section/"+o),children:[e.jsx("td",{className:"name",children:d.label}),e.jsx("td",{className:"muted",children:d.desc}),e.jsx("td",{children:e.jsx("div",{className:"hbar",children:e.jsx("i",{style:{width:`${g/a*100}%`}})})}),e.jsx("td",{className:"num",children:g})]},o)})})]})]}),e.jsxs("div",{className:"card pad-lg rise",style:{animationDelay:"120ms"},children:[e.jsx("div",{className:"card-head",children:e.jsx("h3",{children:"Run log"})}),e.jsx(de,{jobs:n})]})]})]})}const Ht=864e5;function _e(s,t=10,n="today"){const c=new Array(t).fill(0).map((l,i)=>({t:i===t-1?n:`${t-1-i}d`,v:0})),a=Date.now();for(const l of s){const i=l.started||l.finished||l.created||l.ts;if(!i)continue;const r=typeof i=="string"?Date.parse(i):i*1e3;if(!Number.isFinite(r))continue;const u=Math.floor((a-r)/Ht);u<0||u>=t||(c[t-1-u].v+=1)}return c}const Ut=12,Wt=120,H=["#2BB673","#16A6A6","#E8A23B","#E07A5F","#8E7DBE","#5BD08A","#79856E"];function ge({segments:s,size:t=186,stroke:n=26,caption:c="capabilities"}){const a=s.reduce((f,x)=>f+x.value,0)||1,l=t/2-n/2,i=t/2,r=t/2;let u=0;return e.jsxs("svg",{width:t,height:t,viewBox:`0 0 ${t} ${t}`,children:[e.jsx("circle",{cx:i,cy:r,r:l,fill:"none",stroke:"var(--surface-3)",strokeWidth:n}),s.map((f,x)=>{if(f.value/a<=0)return null;const d=u/a*2*Math.PI-Math.PI/2,g=(u+f.value)/a*2*Math.PI-Math.PI/2;u+=f.value;const j=i+l*Math.cos(d),h=r+l*Math.sin(d),m=i+l*Math.cos(g),b=r+l*Math.sin(g),y=g-d>Math.PI?1:0;return e.jsx("path",{d:`M ${j} ${h} A ${l} ${l} 0 ${y} 1 ${m} ${b}`,fill:"none",stroke:f.color,strokeWidth:n,strokeLinecap:"butt",children:e.jsxs("title",{children:[f.label,": ",f.value]})},x)}),e.jsx("text",{x:i,y:r-4,textAnchor:"middle",className:"donut-c-num",children:a}),e.jsx("text",{x:i,y:r+16,textAnchor:"middle",className:"donut-c-cap",children:c})]})}function Gt(s){if(s.length<2)return s.length?`M${s[0][0]},${s[0][1]}`:"";let t=`M${s[0][0]},${s[0][1]}`;for(let n=0;n<s.length-1;n++){const c=s[n-1]||s[n],a=s[n],l=s[n+1],i=s[n+2]||l,r=a[0]+(l[0]-c[0])/6,u=a[1]+(l[1]-c[1])/6,f=l[0]-(i[0]-a[0])/6,x=l[1]-(i[1]-a[1])/6;t+=` C${r},${u} ${f},${x} ${l[0]},${l[1]}`}return t}function Zt({data:s,height:t=156,accent:n}){if(!s.length)return null;const c=600,a=t,l=6,i=14,r=6,u=Math.max(...s.map(m=>m.v),1)+1,f=c-l*2,x=s.length>1?f/(s.length-1):f,o=s.map((m,b)=>{const y=l+b*x,k=a-r-m.v/u*(a-i-r);return[y,k]}),d=Gt(o),g=o[o.length-1],j=o[0],h=`${d} L${g[0]},${a} L${j[0]},${a} Z`;return e.jsxs("svg",{viewBox:`0 0 ${c} ${a}`,preserveAspectRatio:"none",style:{width:"100%",height:t,display:"block",overflow:"visible"},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"b-grad",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0",stopColor:n,stopOpacity:".28"}),e.jsx("stop",{offset:"1",stopColor:n,stopOpacity:"0"})]})}),e.jsx("path",{d:h,fill:"url(#b-grad)"}),e.jsx("path",{d,fill:"none",stroke:n,strokeWidth:"2",strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"}),e.jsx("circle",{cx:g[0],cy:g[1],r:"3.5",fill:n,vectorEffect:"non-scaling-stroke"})]})}function ae({label:s,value:t,sub:n,color:c,icon:a}){return e.jsxs("div",{className:"b-tile",children:[e.jsx("span",{className:"b-tile-ic",style:{background:`color-mix(in srgb, ${c} 18%, transparent)`,color:c},children:e.jsx(E,{name:a})}),e.jsxs("div",{className:"b-tile-body",children:[e.jsx("div",{className:"b-tile-val"+(t===0?" zero":""),children:t}),e.jsx("div",{className:"b-tile-label",children:s})]}),e.jsx("div",{className:"b-tile-sub",children:n})]})}const Kt={neutral:"Loaded & ready",imperial:"The Codex in force",military:"The unit stands ready",cyberpunk:"Jacked in",wizard:"Wards in place",pirate:"The crew stands ready",gamer:"Game loaded",sports:"The squad takes the field",biker:"The crew rolls out",commentator:"Lights out, away we go",verstappen:"Setup's in",joker:"Mic check",mean:"Rules are up",marvin:"Online. Reluctantly."};function Yt({overview:s,sigil:t,jobs:n,doctor:c,onAction:a}){const l=s.counts||{},i=(c==null?void 0:c.groups)||[],r=i.length>0,u=i.filter(m=>m.problems.length===0).length,f=i.length||1,x=s.deployed?Kt[s.theme]||"Loaded & ready":"Not deployed",o=ee(s.diff),d=P.filter(m=>(l[m]||0)>0).map((m,b)=>({label:U[m].label,value:l[m]||0,color:H[b%H.length]})),g=d.reduce((m,b)=>m+b.value,0),j=_e(n||[],10),h=j.reduce((m,b)=>m+b.v,0);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"b-greet",children:[e.jsxs("div",{children:[e.jsx("div",{className:"eyebrow",children:"your harness"}),e.jsx("h1",{className:"h b-h",children:x}),e.jsx("p",{className:"sub",children:t||"A friendly read of every layer growing in your harness."})]}),e.jsxs("div",{className:"row gap-8",children:[e.jsxs("button",{className:"btn",onClick:()=>a("update"),children:[e.jsx(E,{name:"refresh"}),"Update"]}),e.jsxs("button",{className:"btn ghost",onClick:()=>a("build-all"),children:[e.jsx(E,{name:"build"}),"Rebuild"]})]})]}),e.jsxs("div",{className:"grid b-hero-grid mb-16",children:[e.jsxs("div",{className:"card b-hero",children:[e.jsx("div",{className:"b-hero-ring",children:e.jsx(ge,{segments:[{label:"pass",value:u,color:H[0]},{label:"attention",value:Math.max(f-u,0),color:H[2]}],size:168,stroke:20,caption:"checks"})}),e.jsxs("div",{className:"b-hero-side",children:[e.jsx("h3",{className:"b-hero-title",children:r?`${u} of ${f} checks pass`:"Running checks…"}),e.jsxs("p",{className:"sub",children:["One source, rendered into ",e.jsx("code",{children:s.target})," and inherited by every repo on this machine."]}),r&&e.jsx("ul",{className:"b-hero-checks",children:i.map(m=>{const b=m.problems.length===0;return e.jsxs("li",{className:`b-hcheck ${b?"ok":"bad"}`,title:b?"clean":m.problems.join("; "),children:[e.jsx("span",{className:"b-hcheck-mark",children:b?"✓":"!"}),e.jsx("span",{className:"b-hcheck-label",children:m.label})]},m.label)})}),e.jsxs("div",{className:"b-chips",children:[e.jsxs("span",{className:"b-chip",children:[e.jsx("b",{style:{textTransform:"capitalize"},children:s.theme})," voice"]}),e.jsx("span",{className:"b-chip",children:e.jsx("b",{children:s.emit})}),e.jsxs("span",{className:"b-chip",children:["built ",e.jsx("b",{children:s.build_time||"unknown"})]})]})]})]}),e.jsxs("div",{className:"b-tiles",children:[e.jsx(ae,{label:"Agents",value:l.agents??"—",sub:"specialists",color:H[0],icon:"layers"}),e.jsx(ae,{label:"Skills",value:l.skills??"—",sub:"workflows",color:H[1],icon:"skill"}),e.jsx(ae,{label:"Laws",value:l.laws??"—",sub:"all upheld",color:H[2],icon:"law"}),e.jsx(ae,{label:"Edits",value:o,sub:"to graft",color:H[3],icon:"changes"})]})]}),e.jsxs("div",{className:"grid split-even mb-16",children:[e.jsxs("div",{className:"card pad-lg b-mix-card",children:[e.jsxs("div",{className:"card-head",children:[e.jsx("h3",{children:"Capability mix"}),e.jsx("div",{className:"right",children:e.jsxs("span",{className:"tick",children:[g," total"]})})]}),e.jsxs("div",{className:"b-mix",children:[e.jsx(ge,{segments:d,size:186,stroke:26}),e.jsx("div",{className:"b-legend",children:d.map(m=>e.jsxs("div",{className:"b-leg-row",children:[e.jsx("span",{className:"b-leg-dot",style:{background:m.color}}),e.jsx("span",{className:"b-leg-name",children:m.label}),e.jsx("span",{className:"b-leg-bar",children:e.jsx("i",{style:{width:`${m.value/g*100}%`,background:m.color}})}),e.jsx("span",{className:"b-leg-val",children:m.value})]},m.label))})]})]}),e.jsxs("div",{className:"card pad-lg",children:[e.jsxs("div",{className:"card-head",children:[e.jsx("h3",{children:"Recent runs"}),e.jsx("div",{className:"right",children:e.jsxs("span",{className:"badge ok",children:[e.jsx("span",{className:"dot"}),"job log"]})})]}),e.jsxs("div",{className:"b-stat-lead",children:[e.jsx("span",{className:"b-stat-big",children:h}),e.jsxs("span",{className:"b-stat-cap",children:["runs in the last 10 days · ",u,"/",f," checks pass now"]})]}),e.jsx(Zt,{data:j,accent:H[0],height:156})]})]}),e.jsxs("div",{className:"card pad-lg",children:[e.jsxs("div",{className:"card-head",children:[e.jsx("h3",{children:"Recent activity"}),e.jsx("div",{className:"right",children:e.jsxs("span",{className:"tick",children:["last ",Math.min((n==null?void 0:n.length)||0,12)," runs"]})})]}),e.jsxs("div",{className:"b-timeline",children:[(n||[]).slice(0,Ut).map(m=>{const b=m.status==="done",k=m.status==="failed"?"warn":b?"ok":"acc";return e.jsxs("div",{className:"b-tl-row",children:[e.jsx("span",{className:`b-tl-node ${k}`}),e.jsxs("div",{className:"b-tl-body",children:[e.jsx("b",{children:m.action}),m.output?`: ${m.output.split(`
|
|
11
|
-
`)[0].slice(0,Wt)}`:""]}),e.jsx("span",{className:"b-tl-when",children:m.duration?`${m.duration}s`:m.status})]},m.id)}),(!n||n.length===0)&&e.jsxs("div",{className:"b-tl-row",children:[e.jsx("span",{className:"b-tl-node"}),e.jsx("div",{className:"b-tl-body sub",children:"No runs yet. Trigger an action to populate this."}),e.jsx("span",{className:"b-tl-when",children:"—"})]})]})]})]})}const qt=14,Jt=120;function X({title:s,right:t,children:n,span:c}){return e.jsxs("div",{className:"c-mod",style:c?{gridColumn:`span ${c}`}:null,children:[e.jsxs("div",{className:"c-mod-head",children:[e.jsx("span",{className:"c-tab"}),e.jsx("h3",{children:s}),t&&e.jsx("span",{className:"c-mod-right",children:t})]}),e.jsx("div",{className:"c-mod-body",children:n})]})}function q({label:s,value:t}){return e.jsxs("div",{className:"c-kpi",children:[e.jsx("div",{className:"c-kpi-label",children:s}),e.jsx("div",{className:"c-kpi-val"+(t===0?" zero":""),children:t})]})}function Xt({data:s,height:t=120,hi:n}){if(!s.length)return null;const c=Math.max(...s.map(a=>a.v),1);return e.jsx("div",{className:"c-cols",style:{height:t},children:s.map((a,l)=>{const i=Math.max(a.v/c*(t-6),2);return e.jsx("div",{className:`c-col ${l===n?"hi":""}`,style:{height:i},title:`${a.t}: ${a.v}`},l)})})}function Qt({checks:s}){return e.jsx("div",{className:"c-band",children:s.map((t,n)=>e.jsx("span",{className:`c-band-cell ${t.problems.length===0?"ok":"bad"}`,title:`${t.label}: ${t.problems.length===0?"pass":`${t.problems.length} problem(s)`}`},n))})}function ea(s){const t={};for(const n of s||[]){const c=n.action||"unknown";t[c]=(t[c]||0)+1}return Object.entries(t).map(([n,c])=>({label:n,value:c})).sort((n,c)=>c.value-n.value)}function sa({overview:s,jobs:t,doctor:n,onAction:c}){const a=s.counts||{},l=P.reduce((h,m)=>h+(a[m]||0),0),i=Math.max(...P.map(h=>a[h]||0),1),r=(n==null?void 0:n.groups)||[],u=r.filter(h=>h.problems.length===0).length,f=_e(t||[],10,"0d"),x=f.reduce((h,m)=>h+m.v,0),o=ea(t),d=Math.max(...o.map(h=>h.value),1),g=ee(s.diff),j=[["status",s.deployed?e.jsx("span",{className:"c-pill ok",children:"DEPLOYED"}):e.jsx("span",{className:"c-pill warn",children:"NOT DEPLOYED"})],["voice",e.jsx("span",{style:{textTransform:"capitalize"},children:s.theme})],["mode",s.emit],["doctor",r.length===0?e.jsx("span",{className:"c-pill",children:"—"}):u===r.length?e.jsx("span",{className:"c-pill ok",children:"CLEAN"}):e.jsxs("span",{className:"c-pill warn",children:[r.length-u," ISSUES"]})],["edits",String(g)],["built",s.build_time||"—"],["target",e.jsx("span",{className:"c-dim mono",children:s.target})]];return e.jsxs("div",{className:"c-root",children:[e.jsxs("div",{className:"c-titlebar",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"c-h1",children:"HARNESS // STATUS READOUT"}),e.jsxs("div",{className:"c-sub",children:[s.target," · rendered from src/ · inherited everywhere"]})]}),e.jsxs("div",{className:"row gap-8",children:[e.jsxs("button",{className:"btn",onClick:()=>c("update"),children:[e.jsx(E,{name:"refresh"}),"UPDATE"]}),e.jsx("button",{className:"btn ghost",onClick:()=>c("build-all"),children:"REBUILD"}),e.jsx("button",{className:"btn ghost",onClick:()=>c("doctor"),children:"DOCTOR"})]})]}),e.jsx("div",{className:"c-strip",children:j.map(([h,m],b)=>e.jsxs("div",{className:"c-strip-cell",children:[e.jsx("div",{className:"c-strip-k",children:h}),e.jsx("div",{className:"c-strip-v",children:m})]},b))}),e.jsxs("div",{className:"c-kpi-row",children:[e.jsx(q,{label:"AGENTS",value:a.agents??"—"}),e.jsx(q,{label:"SKILLS",value:a.skills??"—"}),e.jsx(q,{label:"LAWS",value:a.laws??"—"}),e.jsx(q,{label:"MEMORY",value:a.memory??"—"}),e.jsx(q,{label:"NOTEBOOK",value:a.notebook??"—"}),e.jsx(q,{label:"EDITS",value:g})]}),e.jsxs("div",{className:"c-grid",children:[e.jsx(X,{title:"CAPABILITY DISTRIBUTION",right:`${l} ENTRIES`,span:2,children:e.jsxs("table",{className:"c-tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"SECTION"}),e.jsx("th",{children:"DETAIL"}),e.jsx("th",{style:{width:150},children:"SHARE"}),e.jsx("th",{className:"num",children:"N"})]})}),e.jsx("tbody",{children:P.map(h=>e.jsxs("tr",{children:[e.jsx("td",{className:"c-name",children:U[h].label}),e.jsx("td",{className:"c-dim",children:U[h].desc}),e.jsx("td",{children:e.jsx("div",{className:"c-bar",children:e.jsx("i",{style:{width:`${(a[h]||0)/i*100}%`,background:h==="agents"||h==="skills"?"var(--accent)":"var(--line-3)"}})})}),e.jsx("td",{className:(a[h]||0)>0?"num":"num c-dim",children:a[h]??0})]},h))})]})}),e.jsx(X,{title:"DOCTOR // CHECKS",right:r.length?`${u}/${r.length}`:"—",children:r.length>0?e.jsxs(e.Fragment,{children:[e.jsx(Qt,{checks:r}),e.jsx("div",{className:"c-check-list",children:r.map(h=>{const m=h.problems.length===0;return e.jsxs("div",{className:"c-check-row",children:[e.jsx("span",{className:`c-dotmark ${m?"ok":"bad"}`}),e.jsx("span",{className:"c-check-name",children:h.label}),e.jsx("span",{className:"c-check-detail",children:m?"clean":`${h.problems.length} problem${h.problems.length===1?"":"s"}`})]},h.label)})})]}):e.jsx("p",{className:"c-dim mono",style:{fontSize:11},children:"No doctor run loaded yet."})}),e.jsxs(X,{title:"RUN RATE // 10D",right:`${x} RUNS`,span:2,children:[e.jsx(Xt,{data:f,height:120,hi:f.length-1}),e.jsx("div",{className:"c-axis",children:f.map((h,m)=>e.jsx("span",{children:m%2===0?h.t:""},m))})]}),e.jsx(X,{title:"RUN LOG // BY TYPE",right:`${(t||[]).length} LOGGED`,children:o.length>0?e.jsx("table",{className:"c-tbl",children:e.jsx("tbody",{children:o.map(h=>e.jsxs("tr",{children:[e.jsx("td",{className:"c-name",style:{textTransform:"uppercase",fontWeight:400},children:h.label}),e.jsx("td",{children:e.jsx("div",{className:"c-bar",children:e.jsx("i",{style:{width:`${h.value/d*100}%`,background:"var(--accent)"}})})}),e.jsx("td",{className:"num",children:h.value})]},h.label))})}):e.jsx("p",{className:"c-dim mono",style:{fontSize:11},children:"No runs logged."})}),e.jsx(X,{title:"RECENT // RUN LOG",span:3,children:e.jsx("table",{className:"c-tbl",children:e.jsxs("tbody",{children:[(t||[]).slice(0,qt).map(h=>{const m=h.status==="done",y=h.status==="failed"?"bad":m?"ok":"acc",k=h.output?h.output.split(`
|
|
12
|
-
`)[0].slice(0,Jt):"—";return e.jsxs("tr",{children:[e.jsxs("td",{style:{width:96},children:[e.jsx("span",{className:`c-dotmark ${y}`})," ",e.jsx("span",{className:"c-dim",children:h.action})]}),e.jsx("td",{className:"c-name",style:{fontWeight:400},children:k}),e.jsx("td",{className:"num c-dim",children:h.duration?`${h.duration}s`:h.status})]},h.id)}),(!t||t.length===0)&&e.jsx("tr",{children:e.jsx("td",{colSpan:"3",className:"c-dim",style:{fontSize:11},children:"No runs logged."})})]})})})]})]})}function ta({error:s,style:t}){return s?e.jsx("p",{className:"badge bad",style:t,children:s}):null}function aa({onAction:s}){var d,g,j,h,m;const{data:t,error:n}=Se(()=>_.themes(),[]),[c,a]=p.useState(""),[l,i]=p.useState("");if(n)return e.jsx(ta,{error:n});if(!t)return e.jsx(Ee,{});const r=c||((d=t.current)==null?void 0:d.theme)||"neutral",u=(g=t.emits)==null?void 0:g.some(b=>b.name==="opencode-global"),f=l||(u?"opencode-global":((j=t.current)==null?void 0:j.emit)||((m=(h=t.emits)==null?void 0:h[0])==null?void 0:m.name)||""),x=a,o=i;return e.jsxs("div",{className:"narrow-lg",children:[e.jsx("div",{className:"head-row mb-18",children:e.jsxs("div",{children:[e.jsx("h1",{className:"h",children:"Deploy your harness"}),e.jsx("p",{className:"sub",children:"Geneseed isn't implanted on this machine yet. Pick a voice and an install mode, then deploy. The graft runs in the console below, and this dashboard lights up when it lands."})]})}),e.jsxs("div",{className:"card pad-lg mb-16",children:[e.jsx("div",{className:"card-head",children:e.jsx("h3",{children:"1 · Choose a voice"})}),e.jsx("div",{className:"row wrap gap-10",children:t.themes.map(b=>e.jsxs("button",{className:`btn ${b.name===r?"soft":"ghost"}`,onClick:()=>x(b.name),title:b.blurb||b.tagline||b.name,children:[e.jsx("span",{className:"po",style:{width:10,height:10,borderRadius:"50%",background:Q(b.accent),boxShadow:`0 0 8px ${Q(b.accent)}`}}),e.jsx("span",{style:{textTransform:"capitalize"},children:b.name})]},b.name))})]}),e.jsxs("div",{className:"card pad-lg mb-16",children:[e.jsx("div",{className:"card-head",children:e.jsx("h3",{children:"2 · Install mode"})}),e.jsxs("p",{className:"sub mb-16",children:[e.jsx("code",{children:"opencode-global"})," deploys once to your global config so every repo on this machine inherits the harness (recommended). Other modes render into a chosen directory."]}),e.jsxs("label",{className:"stack",style:{gap:6,maxWidth:360},children:[e.jsx("span",{className:"tick",children:"Mode"}),e.jsx("select",{className:"sel",value:f,onChange:b=>o(b.target.value),children:t.emits.map(b=>e.jsxs("option",{value:b.name,children:[b.name,b.desc?` · ${b.desc}`:""]},b.name))})]})]}),e.jsxs("button",{className:"btn btn-grid",disabled:!f,onClick:()=>s("build",{theme:r,emit:f}),children:[e.jsx(E,{name:"build"}),"Deploy harness"]})]})}function na({overview:s,themes:t,onAction:n,flavour:c="a",layout:a="auto"}){var b;const l=at(c,a),[i,r]=p.useState("status"),[u,f]=p.useState(null),[x,o]=p.useState([]),[d,g]=p.useState(null),[j,h]=p.useState(null),m=s&&((b=t.find(y=>y.name===s.theme))==null?void 0:b.sigil)||"";return p.useEffect(()=>{let y=!0;return _.setup().then(k=>y&&f(k)).catch(()=>{}),_.jobs().then(k=>y&&o(k.jobs||[])).catch(()=>{}),_.graph().then(k=>y&&g(k)).catch(()=>{}),(l==="greenhouse"||l==="operator")&&_.doctor().then(k=>y&&h(k)).catch(()=>{}),()=>{y=!1}},[l]),s?s.deployed?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"head-row",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"h",children:"Harness console"}),e.jsx("p",{className:"sub",children:"A live readout of the harness this machine carries. Its voice, its capabilities, its drift from source."})]}),e.jsx("div",{className:"seg",children:[["status","Status"],["lineage","Lineage"],["operator","Operator"]].map(([y,k])=>e.jsx("button",{className:i===y?"on":"",onClick:()=>r(y),children:k},y))})]}),i==="status"&&l==="cultivar"&&e.jsx(It,{overview:s,sigil:m,setup:u,jobs:x,onAction:n}),i==="status"&&l==="greenhouse"&&e.jsx(Yt,{overview:s,sigil:m,jobs:x,doctor:j,onAction:n}),i==="status"&&l==="operator"&&e.jsx(sa,{overview:s,jobs:x,doctor:j,onAction:n}),i==="lineage"&&e.jsx(Vt,{overview:s,sigil:m,setup:u,jobs:x,graph:d}),i==="operator"&&e.jsx(zt,{overview:s,setup:u,jobs:x})]}):e.jsx(aa,{onAction:n}):e.jsx("div",{className:"loading",children:"Loading…"})}const ca=p.lazy(()=>F(()=>import("./Activity-Dp9NaXOn.js"),__vite__mapDeps([0,1,2]))),la=p.lazy(()=>F(()=>import("./ActivityDetail-HpOBtrXS.js"),__vite__mapDeps([3,1,2]))),ne=p.lazy(()=>F(()=>import("./Library-BEZscyaQ.js"),__vite__mapDeps([4,1,5,6,7]))),re=p.lazy(()=>F(()=>import("./Laws-DTwF5tTC.js"),__vite__mapDeps([8,1,9]))),ia=p.lazy(()=>F(()=>import("./Rules-CIRG4Ldt.js"),__vite__mapDeps([10,1]))),ra=p.lazy(()=>F(()=>import("./Profile-DydukTxP.js"),__vite__mapDeps([11,1,5,6]))),oe=p.lazy(()=>F(()=>import("./Skills-Buoi1IBr.js"),__vite__mapDeps([12,1,5,6,7]))),oa=p.lazy(()=>F(()=>import("./Diff-Ct4G3Se8.js"),__vite__mapDeps([13,1]))),da=p.lazy(()=>F(()=>import("./Doctor-DGjkZFuA.js"),__vite__mapDeps([14,1]))),ha=p.lazy(()=>F(()=>import("./Themes-CI4o3gJC.js"),__vite__mapDeps([15,1]))),ua=p.lazy(()=>F(()=>import("./Graph-b8o-S6kv.js"),__vite__mapDeps([16,1,9]))),ma=p.lazy(()=>F(()=>import("./index-B1PIx7RM.js"),__vite__mapDeps([17,1]))),pa=p.lazy(()=>F(()=>import("./Harnesses-gr3-aHBF.js"),__vite__mapDeps([18,1]))),xa=p.lazy(()=>F(()=>import("./index-Ck2iCdaC.js"),__vite__mapDeps([19,1,6]))),ga=p.lazy(()=>F(()=>import("./About-DX1-VTBP.js"),__vite__mapDeps([20,1])));function fa(){const s=Ds(),[t,n]=p.useState(""),[c,a]=p.useState(null),[l,i]=p.useState(!1),[r,u]=p.useState(!1),[f,x]=Us(),[o,d]=Ys(),[g,j]=Qs(),[h,m]=nt(),[b,y]=p.useState(()=>!window.sessionStorage.getItem("gs-booted")),[k,L]=p.useState(!1),O=p.useRef(null);p.useEffect(()=>{if(!k)return;const M=se=>{se.key==="Escape"&&L(!1)};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[k]);const $=M=>{var se,he;return a({kind:((se=M==null?void 0:M.body)==null?void 0:se.kind)||"err",msg:((he=M==null?void 0:M.body)==null?void 0:he.message)||M.message})},{overview:v,themes:G,reload:w}=ct($),[N,R]=p.useState(0),C=()=>{w(),R(M=>M+1)},{runs:D,activeId:B,consoleOpen:I,setConsoleOpen:z,runAction:V,cancelJob:Y,clearRuns:Ce}=ot({onFinish:C,onError:$}),J=D[D.length-1],Te=J?J.status==="running"?`${J.action} running`:`${J.action} ${J.status}`:"";p.useEffect(()=>{const M=O.current;M&&(g==="curated"&&Vs(M,o,f)||v!=null&&v.accent&&Ps(M,v.accent,f))},[v,f,g,o]);const Ae=async()=>{if(window.confirm("Stop the local Geneseed server? The console goes offline until you start it again.")){try{await _.shutdown()}catch{}u(!0)}};return r?e.jsxs("div",{className:`app fl-${o} ${f==="light"?"light":""}`,ref:O,children:[e.jsx("div",{className:"atmos","aria-hidden":"true"}),e.jsx("div",{className:"page",style:{display:"grid",placeItems:"center"},children:e.jsxs("p",{className:"sub",style:{textAlign:"center",maxWidth:480},children:["Server stopped. You can close this tab and reopen any time with"," ",e.jsx("code",{children:"geneseed web"}),"."]})})]}):e.jsxs("div",{className:`app fl-${o} ${f==="light"?"light":""}${k?" nav-open":""}`,ref:O,children:[e.jsx("div",{className:"atmos","aria-hidden":"true"}),e.jsx("a",{className:"skip-link",href:"#main",children:"Skip to content"}),e.jsx("p",{className:"sr-only",role:"status","aria-live":"polite",children:Te}),k&&e.jsx("button",{type:"button",className:"nav-scrim","aria-label":"Close navigation",onClick:()=>L(!1)}),e.jsx(mt,{route:s,overview:v,onOpenVoice:()=>i(M=>!M),onNavigate:()=>L(!1)}),l&&e.jsx(Et,{themes:G,current:v==null?void 0:v.theme,onPick:M=>{i(!1),V("build",{theme:M,emit:v==null?void 0:v.emit})},onClose:()=>i(!1)}),e.jsxs("div",{className:"col",children:[e.jsx(St,{route:s,navOpen:k,onToggleNav:()=>L(M=>!M),target:v==null?void 0:v.target,query:t,onQuery:n,mode:f,onToggleMode:x,onShutdown:Ae,dataRev:N,onSwitch:C}),e.jsx("main",{className:"page",id:"main",tabIndex:-1,children:e.jsx("div",{className:s.view==="harnesses"?"pad pad-wide":"pad",children:e.jsxs(p.Suspense,{fallback:e.jsx(Ee,{}),children:[s.view==="dashboard"&&e.jsx(na,{overview:v,themes:G,onAction:V,flavour:o,layout:h}),s.view==="activity"&&e.jsx(ca,{}),s.view==="activity-detail"&&e.jsx(la,{sid:s.sid},s.sid),s.view==="library"&&e.jsx(ne,{overview:v,dataRev:N}),s.view==="agents"&&e.jsx(ne,{overview:v,section:"agents",dataRev:N}),s.view==="laws"&&e.jsx(re,{}),s.view==="rules"&&e.jsx(ia,{}),s.view==="profile"&&e.jsx(ra,{}),s.view==="skills"&&e.jsx(oe,{}),s.view==="section"&&(s.section==="laws"?e.jsx(re,{}):s.section==="skills"?e.jsx(oe,{}):e.jsx(ne,{overview:v,section:s.section,dataRev:N})),s.view==="item"&&(s.type==="law"?e.jsx(re,{selected:s.name}):s.type==="skill"?e.jsx(oe,{selected:s.name}):e.jsx(ne,{overview:v,section:zs[s.type]||s.type,selected:s.name,dataRev:N})),s.view==="diff"&&e.jsx(oa,{onMutated:w,dataRev:N}),s.view==="doctor"&&e.jsx(da,{}),s.view==="themes"&&e.jsx(ha,{onAction:V}),s.view==="graph"&&e.jsx(ua,{}),s.view==="settings"&&e.jsx(ma,{overview:v,onAction:V,flavour:o,onFlavour:d,accentMode:g,onAccentMode:j,layout:h,onLayout:m}),s.view==="harnesses"&&e.jsx(pa,{onAction:V,themes:G,currentTheme:v==null?void 0:v.theme,dataRev:N,onMutated:C}),s.view==="docs"&&e.jsx(xa,{page:s.page,query:t,onAction:V,overview:v}),s.view==="about"&&e.jsx(ga,{})]})})}),e.jsx(Tt,{runs:D,open:I,busy:!!B,onToggle:()=>z(M=>!M),onClear:Ce,onCancel:Y})]}),c&&e.jsx(Ct,{toast:c,onClose:()=>a(null)}),b&&e.jsx(Ft,{ready:!!v,onDone:()=>{window.sessionStorage.setItem("gs-booted","1"),y(!1)}})]})}$e(document.getElementById("root")).render(e.jsx(fa,{}));"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(()=>{})});export{Js as A,ta as E,Gs as F,E as I,Ee as L,U as S,_ as a,ba as b,va as c,Q as d,st as e,tt as f,W as g,le as h,e as j,xt as r,Se as u};
|