@davidbalzan/groundwork-console 0.1.13 → 0.1.14
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/dist/bus.js +4 -4
- package/dist/gitinfo.js +31 -17
- package/package.json +5 -4
- package/public/assets/{abnfDiagram-N423BO3Z-2g9UHdfw.js → abnfDiagram-N423BO3Z-BSvB33qO.js} +1 -1
- package/public/assets/{arc-EEINoaIY.js → arc-zFmco7vQ.js} +1 -1
- package/public/assets/architecture-TIHT7OUA-BQFAhsKM.js +1 -0
- package/public/assets/{architectureDiagram-T3A2C74G-D4F9rIiu.js → architectureDiagram-T3A2C74G-Dq8B7QSd.js} +1 -1
- package/public/assets/{blockDiagram-VBNYF7ZC-CQZAhVXz.js → blockDiagram-VBNYF7ZC-Dyx-2MxL.js} +1 -1
- package/public/assets/{c4Diagram-5PPSVZJV-BlBzSIXs.js → c4Diagram-5PPSVZJV-BcQgTpcV.js} +1 -1
- package/public/assets/channel-BBOBumsc.js +1 -0
- package/public/assets/{chunk-2GRJ4B5K-ZVZxINuZ.js → chunk-2GRJ4B5K-0LJiHhVt.js} +1 -1
- package/public/assets/{chunk-4I5QYGJK-8hqVPXHL.js → chunk-4I5QYGJK-DU9jcgy8.js} +1 -1
- package/public/assets/{chunk-5RXB4S5H-D1s6L_89.js → chunk-5RXB4S5H-Dbb9fQEh.js} +1 -1
- package/public/assets/{chunk-6Q2QTUOP-BWLeyKxS.js → chunk-6Q2QTUOP-BEP7PF5q.js} +1 -1
- package/public/assets/{chunk-7Z6QIM7H-DjvOr6wh.js → chunk-7Z6QIM7H-BDULl8ao.js} +1 -1
- package/public/assets/{chunk-GF5L2VYU-BCFrJAqb.js → chunk-GF5L2VYU-CKmEMSg9.js} +1 -1
- package/public/assets/{chunk-I66GZJ75-XdTCBJhL.js → chunk-I66GZJ75-C8VZHfLH.js} +1 -1
- package/public/assets/{chunk-JQJVKLGR-BwEUHZBv.js → chunk-JQJVKLGR-DM2yoV15.js} +1 -1
- package/public/assets/{chunk-KBJHAD2P-HjBUqR8F.js → chunk-KBJHAD2P-BRAKI2QY.js} +1 -1
- package/public/assets/{chunk-NSK5VX7P-DkHwHrKE.js → chunk-NSK5VX7P-DV7uo6bZ.js} +1 -1
- package/public/assets/{chunk-QR6OTTB3-DF1_EWFH.js → chunk-QR6OTTB3-CIKpM1Nr.js} +1 -1
- package/public/assets/{chunk-RYQCIY6F-BaBhRLGF.js → chunk-RYQCIY6F-DrSpjyPL.js} +1 -1
- package/public/assets/{chunk-UBXNYLIW-BNV3VrZA.js → chunk-UBXNYLIW-CKJQ1y-l.js} +1 -1
- package/public/assets/{chunk-W5SLKNZC-5ymyg6B_.js → chunk-W5SLKNZC-BrvtgZ7x.js} +1 -1
- package/public/assets/{chunk-WRU74C26-oznLCI2s.js → chunk-WRU74C26-D5OxzQZ_.js} +1 -1
- package/public/assets/{chunk-XXDRQBXY-sauNIYLc.js → chunk-XXDRQBXY-B7N0mEcW.js} +1 -1
- package/public/assets/classDiagram-JCYQIIEL-g9vVH4Bz.js +1 -0
- package/public/assets/classDiagram-v2-OCEON4UE-g9vVH4Bz.js +1 -0
- package/public/assets/{cose-bilkent-JH36ORCC-B0A4Je-o.js → cose-bilkent-JH36ORCC-B4AeOPAc.js} +1 -1
- package/public/assets/{cynefin-VYW2F7L2-BtmksekA.js → cynefin-VYW2F7L2-DzOwlGVY.js} +1 -1
- package/public/assets/{cynefinDiagram-MW4NZA55-DxlB0XWy.js → cynefinDiagram-MW4NZA55-SA4aXkpc.js} +1 -1
- package/public/assets/{dagre-VZM6K2ZE-BwX2jQEP.js → dagre-VZM6K2ZE-C5ltS5m2.js} +1 -1
- package/public/assets/{diagram-7IWD3JNH-CRw4eKmV.js → diagram-7IWD3JNH-TU7uqjDX.js} +1 -1
- package/public/assets/{diagram-B4RE2ZJO-BhSHl_HC.js → diagram-B4RE2ZJO-HCe8Z_RD.js} +1 -1
- package/public/assets/{diagram-LBJQPF4R-BLNDbOa-.js → diagram-LBJQPF4R-9kRxXqkG.js} +1 -1
- package/public/assets/{diagram-Q27KOJAE-OI-WVr2z.js → diagram-Q27KOJAE-DfLFPFvB.js} +1 -1
- package/public/assets/{diagram-UB23O5K3-Dw4v-DRV.js → diagram-UB23O5K3-BUpWSI8L.js} +1 -1
- package/public/assets/{dist-CkCHUIyI.js → dist-By9Jxne0.js} +1 -1
- package/public/assets/{ebnfDiagram-BXEA7PRR-_CCtytYQ.js → ebnfDiagram-BXEA7PRR-Dz83w-0Y.js} +1 -1
- package/public/assets/{erDiagram-JOGREHBK-DPwktZ67.js → erDiagram-JOGREHBK-DHZjXCza.js} +1 -1
- package/public/assets/eventmodeling-45OFAUF4-UQEvaa-G.js +1 -0
- package/public/assets/flowDiagram-UKHOOZJN-D3oCUrRO.js +1 -0
- package/public/assets/{ganttDiagram-PKOTCBZU-ChHOAX0R.js → ganttDiagram-PKOTCBZU-B3tcBB-9.js} +1 -1
- package/public/assets/{gitGraph-TEB2WS4Q-DTKjAplS.js → gitGraph-TEB2WS4Q-BQKfiZNh.js} +1 -1
- package/public/assets/{gitGraphDiagram-DS77QQ5N-CetQtIP1.js → gitGraphDiagram-DS77QQ5N-BM480xTb.js} +1 -1
- package/public/assets/{index-CMeHHiB8.js → index-Crr1PM3T.js} +4 -4
- package/public/assets/{info-DKCQHKI2-CEZZoshL.js → info-DKCQHKI2-DW33_uuk.js} +1 -1
- package/public/assets/{infoDiagram-6WML65LV-Dn0Ci1fh.js → infoDiagram-6WML65LV-BeewbX8V.js} +1 -1
- package/public/assets/{ishikawaDiagram-WSZJBQD7-C0yvCWyv.js → ishikawaDiagram-WSZJBQD7-DcWSwP2B.js} +1 -1
- package/public/assets/{journeyDiagram-NVQOT4AX-CpTSt3oh.js → journeyDiagram-NVQOT4AX-BxT4Ea_S.js} +1 -1
- package/public/assets/{kanban-definition-27J2QSJJ-Co4MhtWb.js → kanban-definition-27J2QSJJ-CEvqnKgz.js} +1 -1
- package/public/assets/{line-CKdpDvRy.js → line-DrJMZj-O.js} +1 -1
- package/public/assets/{linear-BAY9SBNB.js → linear-cUeO7N7d.js} +1 -1
- package/public/assets/{mermaid-parser.core-B-yKcreq.js → mermaid-parser.core-CIHTTkEa.js} +3 -3
- package/public/assets/{mermaid.core-CW_jKbCL.js → mermaid.core-Cc5OhPpa.js} +4 -4
- package/public/assets/{mindmap-definition-FAOFIHXS-CejNgzQn.js → mindmap-definition-FAOFIHXS-DsHkrrK_.js} +1 -1
- package/public/assets/{packet-7NZHBO7P-B53cyWv4.js → packet-7NZHBO7P-C_T3uLvX.js} +1 -1
- package/public/assets/{pegDiagram-VL7TDLO6-DAh-rohm.js → pegDiagram-VL7TDLO6-CBdlvXSc.js} +1 -1
- package/public/assets/{pie-RZYD4A2V-Bbl6CzP-.js → pie-RZYD4A2V-CpetmYJU.js} +1 -1
- package/public/assets/{pieDiagram-7S7Q4E2Y-BoiaUX85.js → pieDiagram-7S7Q4E2Y-CT3wi9zO.js} +1 -1
- package/public/assets/{quadrantDiagram-CIZ2JOQS-2EgkGrDN.js → quadrantDiagram-CIZ2JOQS-Vuywai3l.js} +1 -1
- package/public/assets/{radar-I7S5WNFK-1Piyk_Oc.js → radar-I7S5WNFK-rNDTWylh.js} +1 -1
- package/public/assets/{railroad-3IZDKUUU-DcQG7hTA.js → railroad-3IZDKUUU-B09wa8N5.js} +1 -1
- package/public/assets/railroad-abnf-AHOZXSZD-DPdRoDGL.js +1 -0
- package/public/assets/railroad-ebnf-EBAXGLYW-BWVVmeh0.js +1 -0
- package/public/assets/railroad-peg-LSFZ7HO6-CFlw0fDo.js +1 -0
- package/public/assets/{railroadDiagram-AXF67PYL-kPPDLWet.js → railroadDiagram-AXF67PYL-DxwqeTls.js} +1 -1
- package/public/assets/{requirementDiagram-LRYGKXZP-B0wNE6wF.js → requirementDiagram-LRYGKXZP-UGxNbVIj.js} +1 -1
- package/public/assets/{sankeyDiagram-W5VNT64P-CyKEUx9w.js → sankeyDiagram-W5VNT64P-DpR73q2C.js} +1 -1
- package/public/assets/{sequenceDiagram-SI44F4Z6-DT7UmiRF.js → sequenceDiagram-SI44F4Z6-xvxxzFmu.js} +1 -1
- package/public/assets/{src-EbLSa_z9.js → src-eh414mKr.js} +1 -1
- package/public/assets/{stateDiagram-OKZ733FA-BNk8YOH4.js → stateDiagram-OKZ733FA-Cqt3c052.js} +1 -1
- package/public/assets/stateDiagram-v2-UEYNNEHI-toMIf4-z.js +1 -0
- package/public/assets/{swimlanes-SLNWSIFB-B7eUL04h.js → swimlanes-SLNWSIFB-BJknsAAA.js} +1 -1
- package/public/assets/swimlanesDiagram-ULZ7WXOC-BF4o5mrv.js +8 -0
- package/public/assets/{timeline-definition-Z64GVDOM-CDLh-h94.js → timeline-definition-Z64GVDOM-Dkcqv4tL.js} +1 -1
- package/public/assets/{treeView-QDETBFTQ-BAscBSG9.js → treeView-QDETBFTQ-C1uzwCFh.js} +1 -1
- package/public/assets/{treemap-6X3UGDF4-B2ahLgfF.js → treemap-6X3UGDF4-C59GIx2E.js} +1 -1
- package/public/assets/{vennDiagram-T6HMQDX7-62WQ_264.js → vennDiagram-T6HMQDX7-Cd3Zvctp.js} +1 -1
- package/public/assets/{wardley-OPB4EBWU-DUrXideD.js → wardley-OPB4EBWU-D3P85e8V.js} +1 -1
- package/public/assets/{wardleyDiagram-T6FBY63Y-Ci4DF612.js → wardleyDiagram-T6FBY63Y-BLX8xtsj.js} +1 -1
- package/public/assets/{xychartDiagram-ELKLHX3M-D--O5thj.js → xychartDiagram-ELKLHX3M-CUfF0x4C.js} +1 -1
- package/public/index.html +1 -1
- package/public/assets/architecture-TIHT7OUA-CFm6TN4T.js +0 -1
- package/public/assets/channel-CHLtdsMA.js +0 -1
- package/public/assets/classDiagram-JCYQIIEL-Wf8lPn9O.js +0 -1
- package/public/assets/classDiagram-v2-OCEON4UE-Wf8lPn9O.js +0 -1
- package/public/assets/eventmodeling-45OFAUF4-COOjM2XZ.js +0 -1
- package/public/assets/flowDiagram-UKHOOZJN-ipIqOWay.js +0 -1
- package/public/assets/railroad-abnf-AHOZXSZD-CaviTNom.js +0 -1
- package/public/assets/railroad-ebnf-EBAXGLYW-K7l-WN0j.js +0 -1
- package/public/assets/railroad-peg-LSFZ7HO6-Bu22X3mO.js +0 -1
- package/public/assets/stateDiagram-v2-UEYNNEHI-8Oafa2Rm.js +0 -1
- package/public/assets/swimlanesDiagram-ULZ7WXOC-BT5Ebr7W.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-Cc5OhPpa.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-eh414mKr.js","assets/chunk-I66GZJ75-C8VZHfLH.js","assets/chunk-NSK5VX7P-DV7uo6bZ.js","assets/dist-By9Jxne0.js","assets/chunk-4I5QYGJK-DU9jcgy8.js","assets/chunk-WRU74C26-D5OxzQZ_.js","assets/chunk-7BUUIJ7U-Bb538aSH.js","assets/chunk-UBXNYLIW-CKJQ1y-l.js","assets/chunk-W5SLKNZC-BrvtgZ7x.js","assets/chunk-QR6OTTB3-CIKpM1Nr.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-7Z6QIM7H-BDULl8ao.js","assets/line-DrJMZj-O.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function ee(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function P(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var F=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},I={map:ee,forEach:function(e,t,n){ee(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ee(e,function(){t++}),t},toArray:function(e){return ee(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=I,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:P}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,F)}catch(e){F(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),h=o(((e,t)=>{t.exports=m()})),g=o((e=>{var t=p();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.8`})),_=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=o((e=>{var t=h(),n=p(),r=_();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,m=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function ee(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?ee(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return ee(e(t))}catch{}}return null}var P=Array.isArray,F=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te={pending:!1,data:null,method:null,action:null},ne=[],re=-1;function L(e){return{current:e}}function ie(e){0>re||(e.current=ne[re],ne[re]=null,re--)}function R(e,t){re++,ne[re]=e.current,e.current=t}var z=L(null),ae=L(null),oe=L(null),se=L(null);function ce(e,t){switch(R(oe,t),R(ae,e),R(z,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ie(z),R(z,e)}function le(){ie(z),ie(ae),ie(oe)}function ue(e){e.memoizedState!==null&&R(se,e);var t=z.current,n=Hd(t,e.type);t!==n&&(R(ae,e),R(z,n))}function de(e){ae.current===e&&(ie(z),ie(ae)),se.current===e&&(ie(se),Qf._currentValue=te)}var fe,pe;function me(e){if(fe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);fe=t&&t[1]||``,pe=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+fe+e+pe}var he=!1;function ge(e,t){if(!e||he)return``;he=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -21,11 +21,11 @@ Error generating stack: `+e.message+`
|
|
|
21
21
|
`),t=t.replace(Ac,`�`),e.src=t}function Mc(e){let t;e.inlineMode?(t=new e.Token(`inline`,``,0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function Nc(e){let t=e.tokens,n=0;for(let e=0;e<t.length;e++)t[e].type!==`reference_definition`&&(e!==n&&(t[n]=t[e]),n++);t.length!==n&&(t.length=n)}function Pc(e){let t=e.tokens;for(let n=0,r=t.length;n<r;n++){let r=t[n];r.type===`inline`&&e.md.inline.parse(r.content,e.md,e.env,r.children)}}function Fc(e){return/^<a[>\s]/i.test(e)}function Ic(e){return/^<\/a\s*>/i.test(e)}function Lc(e){let t=e.tokens;if(e.md.options.linkify)for(let n=0,r=t.length;n<r;n++){if(t[n].type!==`inline`||!e.md.linkify.test(t[n].content))continue;let r=t[n].children,i=0;for(let a=r.length-1;a>=0;a--){let o=r[a];if(o.type===`link_close`){for(a--;r[a].level!==o.level&&r[a].type!==`link_open`;)a--;continue}if(o.type===`html_inline`&&(Fc(o.content)&&i>0&&i--,Ic(o.content)&&i++),!(i>0)&&o.type===`text`&&e.md.linkify.test(o.content)){let i=o.content,s=e.md.linkify.match(i),c=[],l=o.level,u=0;s.length>0&&s[0].index===0&&a>0&&r[a-1].type===`text_special`&&(s=s.slice(1));for(let t=0;t<s.length;t++){let n=s[t].url,r=e.md.normalizeLink(n);if(!e.md.validateLink(r))continue;let a=s[t].text;a=s[t].schema?s[t].schema===`mailto:`&&!/^mailto:/i.test(a)?e.md.normalizeLinkText(`mailto:${a}`).replace(/^mailto:/,``):e.md.normalizeLinkText(a):e.md.normalizeLinkText(`http://${a}`).replace(/^http:\/\//,``);let o=s[t].index;if(o>u){let t=new e.Token(`text`,``,0);t.content=i.slice(u,o),t.level=l,c.push(t)}let d=new e.Token(`link_open`,`a`,1);d.attrs=[[`href`,r]],d.level=l++,d.markup=`linkify`,d.info=`auto`,c.push(d);let f=new e.Token(`text`,``,0);f.content=a,f.level=l,c.push(f);let p=new e.Token(`link_close`,`a`,-1);p.level=--l,p.markup=`linkify`,p.info=`auto`,c.push(p),u=s[t].lastIndex}if(u<i.length){let t=new e.Token(`text`,``,0);t.content=i.slice(u),t.level=l,c.push(t)}t[n].children=r=Ks(r,a,c)}}}}var Rc=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,zc=/\((c|tm|r)\)/i,Bc=/\((c|tm|r)\)/gi,Vc={c:`©`,r:`®`,tm:`™`};function Hc(e,t){return Vc[t.toLowerCase()]}function Uc(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&(r.content=r.content.replace(Bc,Hc)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function Wc(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&Rc.test(r.content)&&(r.content=r.content.replace(/\+-/g,`±`).replace(/\.{2,}/g,`…`).replace(/([?!])…/g,`$1..`).replace(/([?!]){4,}/g,`$1$1$1`).replace(/,{2,}/g,`,`).replace(/(^|[^-])---(?=[^-]|$)/gm,`$1—`).replace(/(^|\s)--(?=\s|$)/gm,`$1–`).replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,`$1–`)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function Gc(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type===`inline`&&(zc.test(e.tokens[t].content)&&Uc(e.tokens[t].children),Rc.test(e.tokens[t].content)&&Wc(e.tokens[t].children))}var Kc=/['"]/,qc=/['"]/g,Jc=`’`;function Yc(e,t,n,r){e[t]||(e[t]=[]),e[t].push({pos:n,ch:r})}function Xc(e,t){let n=``,r=0;t.sort((e,t)=>e.pos-t.pos);for(let i=0;i<t.length;i++){let a=t[i];n+=e.slice(r,a.pos)+a.ch,r=a.pos+1}return n+e.slice(r)}function Zc(e,t){let n,r=[],i={};for(let a=0;a<e.length;a++){let o=e[a],s=e[a].level;for(n=r.length-1;n>=0&&!(r[n].level<=s);n--);if(r.length=n+1,o.type!==`text`)continue;let c=o.content,l=0,u=c.length;OUTER:for(;l<u;){qc.lastIndex=l;let o=qc.exec(c);if(!o)break;let d=!0,f=!0;l=o.index+1;let p=o[0]===`'`,m=32;if(o.index-1>=0)m=c.charCodeAt(o.index-1);else for(n=a-1;n>=0&&e[n].type!==`softbreak`&&e[n].type!==`hardbreak`;n--)if(e[n].content){m=e[n].content.charCodeAt(e[n].content.length-1);break}let h=32;if(l<u)h=c.charCodeAt(l);else for(n=a+1;n<e.length&&e[n].type!==`softbreak`&&e[n].type!==`hardbreak`;n++)if(e[n].content){h=e[n].content.charCodeAt(0);break}let g=fc(m)||dc(m),_=fc(h)||dc(h),v=lc(m),y=lc(h);if(y?d=!1:_&&(v||g||(d=!1)),v?f=!1:g&&(y||_||(f=!1)),h===34&&o[0]===`"`&&m>=48&&m<=57&&(f=d=!1),d&&f&&(d=g,f=_),!d&&!f){p&&Yc(i,a,o.index,Jc);continue}if(f)for(n=r.length-1;n>=0;n--){let e=r[n];if(r[n].level<s)break;if(e.single===p&&r[n].level===s){e=r[n];let s,c;p?(s=t.md.options.quotes[2],c=t.md.options.quotes[3]):(s=t.md.options.quotes[0],c=t.md.options.quotes[1]),Yc(i,a,o.index,c),Yc(i,e.token,e.pos,s),r.length=n;continue OUTER}}d?r.push({token:a,pos:o.index,single:p,level:s}):f&&p&&Yc(i,a,o.index,Jc)}}Object.keys(i).forEach(function(t){let n=Number(t);e[n].content=Xc(e[n].content,i[t])})}function Qc(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!==`inline`||!Kc.test(e.tokens[t].content)||Zc(e.tokens[t].children,e)}function $c(e){let t,n,r=e.length;for(t=0;t<r;t++)e[t].type===`text_special`&&(e[t].type=`text`);for(t=n=0;t<r;t++)e[t].type===`text`&&t+1<r&&e[t+1].type===`text`?e[t+1].content=e[t].content+e[t+1].content:(t!==n&&(e[n]=e[t]),n++);t!==n&&(e.length=n)}function el(e){let t,n,r=e.tokens,i=r.length;for(let e=0;e<i;e++){if(r[e].type!==`inline`)continue;let i=r[e].children,a=i.length;for(t=0;t<a;t++)i[t].type===`text_special`&&(i[t].type=`text`),i[t].children&&$c(i[t].children);for(t=n=0;t<a;t++)i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}}var tl=[[`normalize`,jc],[`block`,Mc],[`strip_references`,Nc],[`inline`,Pc],[`linkify`,Lc],[`replacements`,Gc],[`smartquotes`,Qc],[`text_join`,el]],nl=class{constructor(){Y(this,`ruler`,new Tc),Y(this,`State`,Oc);for(let e=0;e<tl.length;e++)this.ruler.push(tl[e][0],tl[e][1])}process(e){let t=this.ruler.getRules(``);for(let n=0,r=t.length;n<r;n++)t[n](e)}},rl=class{constructor(e,t,n,r){Y(this,`bMarks`,[]),Y(this,`eMarks`,[]),Y(this,`tShift`,[]),Y(this,`sCount`,[]),Y(this,`bsCount`,[]),Y(this,`blkIndent`,0),Y(this,`line`,0),Y(this,`lineMax`,0),Y(this,`tight`,!1),Y(this,`listIndent`,-1),Y(this,`parentType`,`root`),Y(this,`level`,0),Y(this,`Token`,wc),this.src=e,this.md=t,this.env=n,this.tokens=r;let i=this.src;for(let e=0,t=0,n=0,r=0,a=i.length,o=!1;t<a;t++){let s=i.charCodeAt(t);if(!o){if(cc(s)){n++,s===9?r+=4-r%4:r++;continue}o=!0}(s===10||t===a-1)&&(s!==10&&t++,this.bMarks.push(e),this.eMarks.push(t),this.tShift.push(n),this.sCount.push(r),this.bsCount.push(0),o=!1,n=0,r=0,e=t+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}push(e,t,n){let r=new wc(e,t,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r}isEmpty(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]}skipEmptyLines(e){for(let t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e}skipSpaces(e){for(let t=this.src.length;e<t&&cc(this.src.charCodeAt(e));e++);return e}skipSpacesBack(e,t){if(e<=t)return e;for(;e>t;)if(!cc(this.src.charCodeAt(--e)))return e+1;return e}skipChars(e,t){for(let n=this.src.length;e<n&&this.src.charCodeAt(e)===t;e++);return e}skipCharsBack(e,t,n){if(e<=n)return e;for(;e>n;)if(t!==this.src.charCodeAt(--e))return e+1;return e}getLines(e,t,n,r){if(e>=t)return``;let i=Array(t-e);for(let a=0,o=e;o<t;o++,a++){let e=0,s=this.bMarks[o],c=s,l;for(l=o+1<t||r?this.eMarks[o]+1:this.eMarks[o];c<l&&e<n;){let t=this.src.charCodeAt(c);if(cc(t))t===9?e+=4-(e+this.bsCount[o])%4:e++;else if(c-s<this.tShift[o])e++;else break;c++}e>n?i[a]=Array(e-n+1).join(` `)+this.src.slice(c,l):i[a]=this.src.slice(c,l)}return i.join(``)}},il=65536;function al(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function ol(e){let t=[],n=e.length,r=0,i=e.charCodeAt(r),a=!1,o=0,s=``;for(;r<n;)i===124&&(a?(s+=e.substring(o,r-1),o=r):(t.push(s+e.substring(o,r)),s=``,o=r+1)),a=i===92,r++,i=e.charCodeAt(r);return t.push(s+e.substring(o)),t}function sl(e,t,n,r){if(t+2>n)return!1;let i=t+1;if(e.sCount[i]<e.blkIndent||e.sCount[i]-e.blkIndent>=4)return!1;let a=e.bMarks[i]+e.tShift[i];if(a>=e.eMarks[i])return!1;let o=e.src.charCodeAt(a++);if(o!==124&&o!==45&&o!==58||a>=e.eMarks[i])return!1;let s=e.src.charCodeAt(a++);if(s!==124&&s!==45&&s!==58&&!cc(s)||o===45&&cc(s))return!1;for(;a<e.eMarks[i];){let t=e.src.charCodeAt(a);if(t!==124&&t!==45&&t!==58&&!cc(t))return!1;a++}let c=al(e,t+1),l=c.split(`|`),u=[];for(let e=0;e<l.length;e++){let t=l[e].trim();if(!t){if(e===0||e===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(t))return!1;t.charCodeAt(t.length-1)===58?u.push(t.charCodeAt(0)===58?`center`:`right`):t.charCodeAt(0)===58?u.push(`left`):u.push(``)}if(c=al(e,t).trim(),c.indexOf(`|`)===-1||e.sCount[t]-e.blkIndent>=4)return!1;l=ol(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop();let d=l.length;if(d===0||d!==u.length)return!1;if(r)return!0;let f=e.parentType;e.parentType=`table`;let p=e.md.block.ruler.getRules(`blockquote`),m=e.push(`table_open`,`table`,1),h=[t,0];m.map=h;let g=e.push(`thead_open`,`thead`,1);g.map=[t,t+1];let _=e.push(`tr_open`,`tr`,1);_.map=[t,t+1];for(let t=0;t<l.length;t++){let n=e.push(`th_open`,`th`,1);u[t]&&(n.attrs=[[`style`,`text-align:${u[t]}`]]);let r=e.push(`inline`,``,0);r.content=l[t].trim(),r.children=[],e.push(`th_close`,`th`,-1)}e.push(`tr_close`,`tr`,-1),e.push(`thead_close`,`thead`,-1);let v,y=0;for(i=t+2;i<n&&!(e.sCount[i]<e.blkIndent);i++){let r=!1;for(let t=0,a=p.length;t<a;t++)if(p[t](e,i,n,!0)){r=!0;break}if(r||(c=al(e,i).trim(),!c)||e.sCount[i]-e.blkIndent>=4||(l=ol(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop(),y+=d-l.length,y>il))break;if(i===t+2){let n=e.push(`tbody_open`,`tbody`,1);n.map=v=[t+2,0]}let a=e.push(`tr_open`,`tr`,1);a.map=[i,i+1];for(let t=0;t<d;t++){let n=e.push(`td_open`,`td`,1);u[t]&&(n.attrs=[[`style`,`text-align:${u[t]}`]]);let r=e.push(`inline`,``,0);r.content=l[t]?l[t].trim():``,r.children=[],e.push(`td_close`,`td`,-1)}e.push(`tr_close`,`tr`,-1)}return v&&(e.push(`tbody_close`,`tbody`,-1),v[1]=i),e.push(`table_close`,`table`,-1),h[1]=i,e.parentType=f,e.line=i,!0}function cl(e,t,n){if(e.sCount[t]-e.blkIndent<4)return!1;let r=t+1,i=r;for(;r<n;){if(e.isEmpty(r)){r++;continue}if(e.sCount[r]-e.blkIndent>=4){r++,i=r;continue}break}e.line=i;let a=e.push(`code_block`,`code`,0);return a.content=e.getLines(t,i,4+e.blkIndent,!1)+`
|
|
22
22
|
`,a.map=[t,e.line],!0}function ll(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>a)return!1;let o=e.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let s=i;i=e.skipChars(i,o);let c=i-s;if(c<3)return!1;let l=e.src.slice(s,i),u=e.src.slice(i,a);if(o===96&&u.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;let d=t,f=!1;for(;d++,!(d>=n||(i=s=e.bMarks[d]+e.tShift[d],a=e.eMarks[d],i<a&&e.sCount[d]<e.blkIndent));)if(e.src.charCodeAt(i)===o&&!(e.sCount[d]-e.blkIndent>=4)&&(i=e.skipChars(i,o),!(i-s<c)&&(i=e.skipSpaces(i),!(i<a)))){f=!0;break}c=e.sCount[t],e.line=d+ +!!f;let p=e.push(`fence`,`code`,0);return p.info=u,p.content=e.getLines(t+1,d,c,!0),p.markup=l,p.map=[t,e.line],!0}function ul(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;let s=[],c=[],l=[],u=[],d=e.md.block.ruler.getRules(`blockquote`),f=e.parentType;e.parentType=`blockquote`;let p=!1,m;for(m=t;m<n;m++){let t=e.sCount[m]<e.blkIndent;if(i=e.bMarks[m]+e.tShift[m],a=e.eMarks[m],i>=a)break;if(e.src.charCodeAt(i++)===62&&!t){let t=e.sCount[m]+1,n,r;e.src.charCodeAt(i)===32?(i++,t++,r=!1,n=!0):e.src.charCodeAt(i)===9?(n=!0,(e.bsCount[m]+t)%4==3?(i++,t++,r=!1):r=!0):n=!1;let o=t;for(s.push(e.bMarks[m]),e.bMarks[m]=i;i<a;){let t=e.src.charCodeAt(i);if(cc(t))t===9?o+=4-(o+e.bsCount[m]+ +!!r)%4:o++;else break;i++}p=i>=a,c.push(e.bsCount[m]),e.bsCount[m]=e.sCount[m]+1+ +!!n,l.push(e.sCount[m]),e.sCount[m]=o-t,u.push(e.tShift[m]),e.tShift[m]=i-e.bMarks[m];continue}if(p)break;let r=!1;for(let t=0,i=d.length;t<i;t++)if(d[t](e,m,n,!0)){r=!0;break}if(r){e.lineMax=m,e.blkIndent!==0&&(s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]-=e.blkIndent);break}s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]=-1}let h=e.blkIndent;e.blkIndent=0;let g=e.push(`blockquote_open`,`blockquote`,1);g.markup=`>`;let _=[t,0];g.map=_,e.md.block.tokenize(e,t,m);let v=e.push(`blockquote_close`,`blockquote`,-1);v.markup=`>`,e.lineMax=o,e.parentType=f,_[1]=e.line;for(let n=0;n<u.length;n++)e.bMarks[n+t]=s[n],e.tShift[n+t]=u[n],e.sCount[n+t]=l[n],e.bsCount[n+t]=c[n];return e.blkIndent=h,!0}function dl(e,t,n,r){let i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let a=e.bMarks[t]+e.tShift[t],o=e.src.charCodeAt(a++);if(o!==42&&o!==45&&o!==95)return!1;let s=1;for(;a<i;){let t=e.src.charCodeAt(a++);if(t!==o&&!cc(t))return!1;t===o&&s++}if(s<3)return!1;if(r)return!0;e.line=t+1;let c=e.push(`hr`,`hr`,0);return c.map=[t,e.line],c.markup=Array(s+1).join(String.fromCharCode(o)),!0}function fl(e,t){let n=e.eMarks[t],r=e.bMarks[t]+e.tShift[t],i=e.src.charCodeAt(r++);return i!==42&&i!==45&&i!==43||r<n&&!cc(e.src.charCodeAt(r))?-1:r}function pl(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t],i=n;if(i+1>=r)return-1;let a=e.src.charCodeAt(i++);if(a<48||a>57)return-1;for(;;){if(i>=r)return-1;if(a=e.src.charCodeAt(i++),a>=48&&a<=57){if(i-n>=10)return-1;continue}if(a===41||a===46)break;return-1}return i<r&&(a=e.src.charCodeAt(i),!cc(a))?-1:i}function ml(e,t){let n=e.level+2;for(let r=t+2,i=e.tokens.length-2;r<i;r++)e.tokens[r].level===n&&e.tokens[r].type===`paragraph_open`&&(e.tokens[r+2].hidden=!0,e.tokens[r].hidden=!0,r+=2)}function hl(e,t,n,r){let i,a,o,s,c=t,l=!0;if(e.sCount[c]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[c]-e.listIndent>=4&&e.sCount[c]<e.blkIndent)return!1;let u=!1;r&&e.parentType===`paragraph`&&e.sCount[c]>=e.blkIndent&&(u=!0);let d,f,p;if((p=pl(e,c))>=0){if(d=!0,o=e.bMarks[c]+e.tShift[c],f=Number(e.src.slice(o,p-1)),u&&f!==1)return!1}else if((p=fl(e,c))>=0)d=!1;else return!1;if(u&&e.skipSpaces(p)>=e.eMarks[c])return!1;if(r)return!0;let m=e.src.charCodeAt(p-1),h=e.tokens.length;d?(s=e.push(`ordered_list_open`,`ol`,1),f!==1&&(s.attrs=[[`start`,f]])):s=e.push(`bullet_list_open`,`ul`,1);let g=[c,0];s.map=g,s.markup=String.fromCharCode(m);let _=!1,v=e.md.block.ruler.getRules(`list`),y=e.parentType;for(e.parentType=`list`;c<n;){a=p,i=e.eMarks[c];let t=e.sCount[c]+p-(e.bMarks[c]+e.tShift[c]),r=t;for(;a<i;){let t=e.src.charCodeAt(a);if(t===9)r+=4-(r+e.bsCount[c])%4;else if(t===32)r++;else break;a++}let u=a,f;f=u>=i?1:r-t,f>4&&(f=1);let h=t+f;s=e.push(`list_item_open`,`li`,1),s.markup=String.fromCharCode(m);let g=[c,0];s.map=g,d&&(s.info=e.src.slice(o,p-1));let y=e.tight,b=e.tShift[c],x=e.sCount[c],S=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=h,e.tight=!0,e.tShift[c]=u-e.bMarks[c],e.sCount[c]=r,u>=i&&e.isEmpty(c+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,c,n),(!e.tight||_)&&(l=!1),_=e.line-c>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=S,e.tShift[c]=b,e.sCount[c]=x,e.tight=y,s=e.push(`list_item_close`,`li`,-1),s.markup=String.fromCharCode(m),c=e.line,g[1]=c,c>=n||e.sCount[c]<e.blkIndent||e.sCount[c]-e.blkIndent>=4)break;let C=!1;for(let t=0,r=v.length;t<r;t++)if(v[t](e,c,n,!0)){C=!0;break}if(C)break;if(d){if(p=pl(e,c),p<0)break;o=e.bMarks[c]+e.tShift[c]}else if(p=fl(e,c),p<0)break;if(m!==e.src.charCodeAt(p-1))break}return s=d?e.push(`ordered_list_close`,`ol`,-1):e.push(`bullet_list_close`,`ul`,-1),s.markup=String.fromCharCode(m),g[1]=c,e.line=c,e.parentType=y,l&&ml(e,h),!0}function gl(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=t+1;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==91)return!1;function s(t){let n=e.lineMax;if(t>=n||e.isEmpty(t))return null;let r=!1;if(e.sCount[t]-e.blkIndent>3&&(r=!0),e.sCount[t]<0&&(r=!0),!r){let r=e.md.block.ruler.getRules(`reference`),i=e.parentType;e.parentType=`reference`;let a=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,t,n,!0)){a=!0;break}if(e.parentType=i,a)return null}let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];return e.src.slice(i,a+1)}let c=e.src.slice(i,a+1);a=c.length;let l=-1;for(i=1;i<a;i++){let e=c.charCodeAt(i);if(e===91)return!1;if(e===93){l=i;break}if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(e===92&&(i++,i<a&&c.charCodeAt(i)===10)){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}}if(l<0||c.charCodeAt(l+1)!==58)return!1;for(i=l+2;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!cc(e))break}let u=e.md.helpers.parseLinkDestination(c,i,a);if(!u.ok)return!1;let d=e.md.normalizeLink(u.str);if(!e.md.validateLink(d))return!1;i=u.pos;let f=i,p=o,m=i;for(;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!cc(e))break}let h=e.md.helpers.parseLinkTitle(c,i,a);for(;h.can_continue;){let t=s(o);if(t===null)break;c+=t,i=a,a=c.length,o++,h=e.md.helpers.parseLinkTitle(c,i,a,h)}let g;for(i<a&&m!==i&&h.ok?(g=h.str,i=h.pos):(g=``,i=f,o=p);i<a&&cc(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10&&g)for(g=``,i=f,o=p;i<a&&cc(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10)return!1;let _=pc(c.slice(1,l));if(!_)return!1;if(r)return!0;e.env.references===void 0&&(e.env.references={}),e.env.references[_]===void 0&&(e.env.references[_]={title:g,href:d});let v=e.push(`reference_definition`,``,0);v.map=[t,o],v.hidden=!0;let y=Object.create(null);return y.label=_,v.meta=y,e.line=o,!0}var _l=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),vl=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,yl=`<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>`,bl=RegExp(`^(?:${vl}|${yl}|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),xl=RegExp(`^(?:${vl}|${yl})`),Sl=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Za-z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[RegExp(`^</?(${_l.join(`|`)})(?=(\\s|/?>|$))`,`i`),/^$/,!0],[RegExp(`${xl.source}\\s*$`),/^$/,!1]];function Cl(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let o=e.src.slice(i,a),s=0;for(;s<Sl.length&&!Sl[s][0].test(o);s++);if(s===Sl.length)return!1;if(r)return Sl[s][2];let c=t+1,l=Sl[s][1].test(``);if(!Sl[s][1].test(o)){for(;c<n&&!(e.sCount[c]<e.blkIndent&&(l||!e.isEmpty(c)));c++)if(i=e.bMarks[c]+e.tShift[c],a=e.eMarks[c],o=e.src.slice(i,a),Sl[s][1].test(o)){o.length!==0&&c++;break}}e.line=c;let u=e.push(`html_block`,``,0);return u.map=[t,c],u.content=e.getLines(t,c,e.blkIndent,!0),!0}function wl(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let o=e.src.charCodeAt(i);if(o!==35||i>=a)return!1;let s=1;for(o=e.src.charCodeAt(++i);o===35&&i<a&&s<=6;)s++,o=e.src.charCodeAt(++i);if(s>6||i<a&&!cc(o))return!1;if(r)return!0;a=e.skipSpacesBack(a,i);let c=e.skipCharsBack(a,35,i);c>i&&cc(e.src.charCodeAt(c-1))&&(a=c),e.line=t+1;let l=e.push(`heading_open`,`h${s}`,1);l.markup=`########`.slice(0,s),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=hc(e.src.slice(i,a)),u.map=[t,e.line],u.children=[];let d=e.push(`heading_close`,`h${s}`,-1);return d.markup=`########`.slice(0,s),!0}function Tl(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`);if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.parentType;e.parentType=`paragraph`;let a=0,o,s=t+1;for(;s<n&&!e.isEmpty(s);s++){if(e.sCount[s]-e.blkIndent>3)continue;if(e.sCount[s]>=e.blkIndent){let t=e.bMarks[s]+e.tShift[s],n=e.eMarks[s];if(t<n&&(o=e.src.charCodeAt(t),(o===45||o===61)&&(t=e.skipChars(t,o),t=e.skipSpaces(t),t>=n))){a=o===61?1:2;break}}if(e.sCount[s]<0)continue;let t=!1;for(let i=0,a=r.length;i<a;i++)if(r[i](e,s,n,!0)){t=!0;break}if(t)break}if(!a)return e.parentType=i,!1;let c=hc(e.getLines(t,s,e.blkIndent,!1));e.line=s+1;let l=e.push(`heading_open`,`h${a}`,1);l.markup=String.fromCharCode(o),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=c,u.map=[t,e.line-1],u.children=[];let d=e.push(`heading_close`,`h${a}`,-1);return d.markup=String.fromCharCode(o),e.parentType=i,!0}function El(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`),i=e.parentType,a=t+1;for(e.parentType=`paragraph`;a<n&&!e.isEmpty(a);a++){if(e.sCount[a]-e.blkIndent>3||e.sCount[a]<0)continue;let t=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,a,n,!0)){t=!0;break}if(t)break}let o=hc(e.getLines(t,a,e.blkIndent,!1));e.line=a;let s=e.push(`paragraph_open`,`p`,1);s.map=[t,e.line];let c=e.push(`inline`,``,0);return c.content=o,c.map=[t,e.line],c.children=[],e.push(`paragraph_close`,`p`,-1),e.parentType=i,!0}var Dl=[[`table`,sl,[`paragraph`,`reference`]],[`code`,cl],[`fence`,ll,[`paragraph`,`reference`,`blockquote`,`list`]],[`blockquote`,ul,[`paragraph`,`reference`,`blockquote`,`list`]],[`hr`,dl,[`paragraph`,`reference`,`blockquote`,`list`]],[`list`,hl,[`paragraph`,`reference`,`blockquote`]],[`reference`,gl],[`html_block`,Cl,[`paragraph`,`reference`,`blockquote`]],[`heading`,wl,[`paragraph`,`reference`,`blockquote`]],[`lheading`,Tl],[`paragraph`,El]],Ol=class{constructor(){Y(this,`ruler`,new Tc),Y(this,`State`,rl);for(let e=0;e<Dl.length;e++)this.ruler.push(Dl[e][0],Dl[e][1],{alt:(Dl[e][2]||[]).slice()})}tokenize(e,t,n){let r=this.ruler.getRules(``),i=r.length,a=e.md.options.maxNesting,o=t,s=!1;for(;o<n&&(e.line=o=e.skipEmptyLines(o),!(o>=n||e.sCount[o]<e.blkIndent));){if(e.level>=a){e.line=n;break}let t=e.line,c=!1;for(let a=0;a<i;a++)if(c=r[a](e,o,n,!1),c){if(t>=e.line)throw Error(`block rule didn't increment state.line`);break}if(!c)throw Error(`none of the block rules matched`);e.tight=!s,e.isEmpty(e.line-1)&&(s=!0),o=e.line,o<n&&e.isEmpty(o)&&(s=!0,o++,e.line=o)}}parse(e,t,n,r){if(!e)return;let i=new this.State(e,t,n,r);this.tokenize(i,i.line,i.lineMax)}},kl=class{constructor(e,t,n,r){Y(this,`pos`,0),Y(this,`level`,0),Y(this,`pending`,``),Y(this,`pendingLevel`,0),Y(this,`cache`,{}),Y(this,`backticks`,{}),Y(this,`backticksScanned`,!1),Y(this,`linkLevel`,0),Y(this,`delimiters`,[]),Y(this,`_prev_delimiters`,[]),Y(this,`Token`,wc),this.src=e,this.env=n,this.md=t,this.tokens=r,this.tokens_meta=Array(r.length),this.posMax=this.src.length}pushPending(){let e=new wc(`text`,``,0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending=``,e}push(e,t,n){this.pending&&this.pushPending();let r=new wc(e,t,n),i;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r}scanDelims(e,t){let n=this.posMax,r=this.src.charCodeAt(e),i;if(e===0)i=32;else if(e===1)i=this.src.charCodeAt(0),(i&63488)==55296&&(i=65533);else if(i=this.src.charCodeAt(e-1),(i&64512)==56320){let t=this.src.charCodeAt(e-2);i=(t&64512)==55296?65536+(t-55296<<10)+(i-56320):65533}else(i&64512)==55296&&(i=65533);let a=e;for(;a<n&&this.src.charCodeAt(a)===r;)a++;let o=a-e,s=a<n?this.src.charCodeAt(a):32;if((s&64512)==55296){let e=this.src.charCodeAt(a+1);s=(e&64512)==56320?65536+(s-55296<<10)+(e-56320):65533}else(s&64512)==56320&&(s=65533);let c=fc(i)||dc(i),l=fc(s)||dc(s),u=lc(i),d=lc(s),f=!d&&(!l||u||c),p=!u&&(!c||d||l);return{can_open:f&&(t||!p||c),can_close:p&&(t||!f||l),length:o}}};function Al(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function jl(e,t){let n=e.pos;for(;n<e.posMax&&!Al(e.src.charCodeAt(n));)n++;return n!==e.pos&&(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}var Ml=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function Nl(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;let n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;let i=e.pending.match(Ml);if(!i)return!1;let a=i[1],o=e.md.linkify.matchAtStart(e.src.slice(n-a.length));if(!o)return!1;let s=o.url;if(s.length<=a.length)return!1;let c=s.length;for(;c>0&&s.charCodeAt(c-1)===42;)c--;c!==s.length&&(s=s.slice(0,c));let l=e.md.normalizeLink(s);if(!e.md.validateLink(l))return!1;if(!t){e.pending=e.pending.slice(0,-a.length);let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,l]],t.markup=`linkify`,t.info=`auto`;let n=e.push(`text`,``,0);n.content=e.md.normalizeLinkText(s);let r=e.push(`link_close`,`a`,-1);r.markup=`linkify`,r.info=`auto`}return e.pos+=s.length-a.length,!0}function Pl(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;let r=e.pending.length-1,i=e.posMax;if(!t){if(r>=0&&e.pending.charCodeAt(r)===32){if(r>=1&&e.pending.charCodeAt(r-1)===32){let t=r-1;for(;t>=1&&e.pending.charCodeAt(t-1)===32;)t--;e.pending=e.pending.slice(0,t),e.push(`hardbreak`,`br`,0)}else e.pending=e.pending.slice(0,-1),e.push(`softbreak`,`br`,0)}else e.push(`softbreak`,`br`,0)}for(n++;n<i&&cc(e.src.charCodeAt(n));)n++;return e.pos=n,!0}var X=[];for(let e=0;e<256;e++)X.push(0);`\\!"#$%&'()*+,./:;<=>?@[]^_\`{|}~-`.split(``).forEach(function(e){X[e.charCodeAt(0)]=1});function Fl(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=e.src.charCodeAt(n);if(i===10){for(t||e.push(`hardbreak`,`br`,0),n++;n<r&&(i=e.src.charCodeAt(n),cc(i));)n++;return e.pos=n,!0}if(i===32){if(!t){let t=e.push(`text_special`,``,0);t.content=`\\`,t.markup=`\\`,t.info=`escape`}return e.pos=n,!0}let a=e.src[n];if(i>=55296&&i<=56319&&n+1<r){let t=e.src.charCodeAt(n+1);t>=56320&&t<=57343&&(a+=e.src[n+1],n++)}let o=`\\`+a;if(!t){let t=e.push(`text_special`,``,0);t.content=i<256&&X[i]!==0?a:o,t.markup=o,t.info=`escape`}return e.pos=n+1,!0}function Z(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==96)return!1;let r=n;n++;let i=e.posMax;for(;n<i&&e.src.charCodeAt(n)===96;)n++;let a=e.src.slice(r,n),o=a.length;if(e.backticksScanned&&(e.backticks[o]||0)<=r)return t||(e.pending+=a),e.pos+=o,!0;let s=n,c;for(;(c=e.src.indexOf("`",s))!==-1;){for(s=c+1;s<i&&e.src.charCodeAt(s)===96;)s++;let r=s-c;if(r===o){if(!t){let t=e.push(`code_inline`,`code`,0);t.markup=a,t.content=e.src.slice(n,c).replace(/\n/g,` `).replace(/^ (.+) $/,`$1`)}return e.pos=s,!0}e.backticks[r]=c}return e.backticksScanned=!0,t||(e.pending+=a),e.pos+=o,!0}function Q(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==126)return!1;let i=e.scanDelims(e.pos,!0),a=i.length,o=String.fromCharCode(r);if(a<2)return!1;let s;a%2&&(s=e.push(`text`,``,0),s.content=o,a--);for(let t=0;t<a;t+=2)s=e.push(`text`,``,0),s.content=o+o,e.delimiters.push({marker:r,length:0,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return e.pos+=i.length,!0}function Il(e,t){let n,r=[],i=t.length;for(let a=0;a<i;a++){let i=t[a];if(i.marker!==126||i.end===-1)continue;let o=t[i.end];n=e.tokens[i.token],n.type=`s_open`,n.tag=`s`,n.nesting=1,n.markup=`~~`,n.content=``,n=e.tokens[o.token],n.type=`s_close`,n.tag=`s`,n.nesting=-1,n.markup=`~~`,n.content=``,e.tokens[o.token-1].type===`text`&&e.tokens[o.token-1].content===`~`&&r.push(o.token-1)}for(;r.length;){let t=r.pop(),i=t+1;for(;i<e.tokens.length&&e.tokens[i].type===`s_close`;)i++;i--,t!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[t],e.tokens[t]=n)}}function Ll(e){let t=e.tokens_meta,n=e.tokens_meta.length;Il(e,e.delimiters);for(let r=0;r<n;r++){let n=t[r]?.delimiters;n&&Il(e,n)}}var Rl={tokenize:Q,postProcess:Ll};function zl(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==95&&r!==42)return!1;let i=e.scanDelims(e.pos,r===42);for(let t=0;t<i.length;t++){let t=e.push(`text`,``,0);t.content=String.fromCharCode(r),e.delimiters.push({marker:r,length:i.length,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return e.pos+=i.length,!0}function Bl(e,t){let n=t.length;for(let r=n-1;r>=0;r--){let n=t[r];if(n.marker!==95&&n.marker!==42||n.end===-1)continue;let i=t[n.end],a=r>0&&t[r-1].end===n.end+1&&t[r-1].marker===n.marker&&t[r-1].token===n.token-1&&t[n.end+1].token===i.token+1,o=String.fromCharCode(n.marker),s=e.tokens[n.token];s.type=a?`strong_open`:`em_open`,s.tag=a?`strong`:`em`,s.nesting=1,s.markup=a?o+o:o,s.content=``;let c=e.tokens[i.token];c.type=a?`strong_close`:`em_close`,c.tag=a?`strong`:`em`,c.nesting=-1,c.markup=a?o+o:o,c.content=``,a&&(e.tokens[t[r-1].token].content=``,e.tokens[t[n.end+1].token].content=``,r--)}}function Vl(e){let t=e.tokens_meta,n=e.tokens_meta.length;Bl(e,e.delimiters);for(let r=0;r<n;r++){let n=t[r]?.delimiters;n&&Bl(e,n)}}var Hl={tokenize:zl,postProcess:Vl};function Ul(e,t){let n,r,i,a,o=``,s=``,c=e.pos,l=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;let u=e.pos,d=e.posMax,f=e.pos+1,p=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(p<0)return!1;let m=p+1;if(m<d&&e.src.charCodeAt(m)===40){for(l=!1,m++;m<d&&(n=e.src.charCodeAt(m),!(!cc(n)&&n!==10));m++);if(m>=d)return!1;if(c=m,i=e.md.helpers.parseLinkDestination(e.src,m,e.posMax),i.ok){for(o=e.md.normalizeLink(i.str),e.md.validateLink(o)?m=i.pos:o=``,c=m;m<d&&(n=e.src.charCodeAt(m),!(!cc(n)&&n!==10));m++);if(i=e.md.helpers.parseLinkTitle(e.src,m,e.posMax),m<d&&c!==m&&i.ok)for(s=i.str,m=i.pos;m<d&&(n=e.src.charCodeAt(m),!(!cc(n)&&n!==10));m++);}(m>=d||e.src.charCodeAt(m)!==41)&&(l=!0),m++}if(l){if(e.env.references===void 0)return!1;if(m<d&&e.src.charCodeAt(m)===91?(c=m+1,m=e.md.helpers.parseLinkLabel(e,m),m>=0?r=e.src.slice(c,m++):m=p+1):m=p+1,r||=e.src.slice(f,p),r=pc(r),a=e.env.references[r],!a)return e.pos=u,!1;o=a.href,s=a.title}if(!t){e.pos=f,e.posMax=p;let t=e.push(`link_open`,`a`,1),n=[[`href`,o]];if(t.attrs=n,s&&n.push([`title`,s]),r){let e=Object.create(null);e.label=r,t.meta=e}e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push(`link_close`,`a`,-1)}return e.pos=m,e.posMax=d,!0}function Wl(e,t){let n,r,i,a,o,s,c,l,u=``,d=e.pos,f=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let p=e.pos+2,m=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(m<0)return!1;if(a=m+1,a<f&&e.src.charCodeAt(a)===40){for(a++;a<f&&(n=e.src.charCodeAt(a),!(!cc(n)&&n!==10));a++);if(a>=f)return!1;for(l=a,s=e.md.helpers.parseLinkDestination(e.src,a,e.posMax),s.ok&&(u=e.md.normalizeLink(s.str),e.md.validateLink(u)?a=s.pos:u=``),l=a;a<f&&(n=e.src.charCodeAt(a),!(!cc(n)&&n!==10));a++);if(s=e.md.helpers.parseLinkTitle(e.src,a,e.posMax),a<f&&l!==a&&s.ok)for(c=s.str,a=s.pos;a<f&&(n=e.src.charCodeAt(a),!(!cc(n)&&n!==10));a++);else c=``;if(a>=f||e.src.charCodeAt(a)!==41)return e.pos=d,!1;a++}else{if(e.env.references===void 0)return!1;if(a<f&&e.src.charCodeAt(a)===91?(l=a+1,a=e.md.helpers.parseLinkLabel(e,a),a>=0?i=e.src.slice(l,a++):a=m+1):a=m+1,i||=e.src.slice(p,m),i=pc(i),o=e.env.references[i],!o)return e.pos=d,!1;u=o.href,c=o.title}if(!t){r=e.src.slice(p,m);let t=[];e.md.inline.parse(r,e.md,e.env,t);let n=e.push(`image`,`img`,0),a=[[`src`,u],[`alt`,``]];if(n.attrs=a,n.children=t,n.content=r,c&&a.push([`title`,c]),i){let e=Object.create(null);e.label=i,n.meta=e}}return e.pos=a,e.posMax=f,!0}var Gl=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,Kl=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function ql(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;let r=e.pos,i=e.posMax;for(;;){if(++n>=i)return!1;let t=e.src.charCodeAt(n);if(t===60)return!1;if(t===62)break}let a=e.src.slice(r+1,n);if(Kl.test(a)){let n=e.md.normalizeLink(a);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}if(Gl.test(a)){let n=e.md.normalizeLink(`mailto:${a}`);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}return!1}function Jl(e){return/^<a[>\s]/i.test(e)}function Yl(e){return/^<\/a\s*>/i.test(e)}function Xl(e){let t=e|32;return t>=97&&t<=122}function Zl(e,t){if(!e.md.options.html)return!1;let n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=n)return!1;let i=e.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!Xl(i))return!1;let a=e.src.slice(r).match(bl);if(!a)return!1;if(!t){let t=e.push(`html_inline`,``,0);t.content=a[0],Jl(t.content)&&e.linkLevel++,Yl(t.content)&&e.linkLevel--}return e.pos+=a[0].length,!0}var Ql=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,$l=/^&([a-z][a-z0-9]{1,31});/i;function eu(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){let r=e.src.slice(n).match(Ql);if(r){if(!t){let t=r[1][0].toLowerCase()===`x`?parseInt(r[1].slice(1),16):parseInt(r[1],10),n=e.push(`text_special`,``,0);n.content=qs(t)?Js(t):Js(65533),n.markup=r[0],n.info=`entity`}return e.pos+=r[0].length,!0}}else{let r=e.src.slice(n).match($l);if(r){let n=as(r[0]);if(n!==r[0]){if(!t){let t=e.push(`text_special`,``,0);t.content=n,t.markup=r[0],t.info=`entity`}return e.pos+=r[0].length,!0}}}return!1}function tu(e){let t={},n=e.length;if(!n)return;let r=0,i=-2,a=[];for(let o=0;o<n;o++){let n=e[o];if(a.push(0),(e[r].marker!==n.marker||i!==n.token-1)&&(r=o),i=n.token,n.length=n.length||0,!n.close)continue;t.hasOwnProperty(n.marker)||(t[n.marker]=[-1,-1,-1,-1,-1,-1]);let s=t[n.marker][(n.open?3:0)+n.length%3],c=r-a[r]-1,l=c;for(;c>s;c-=a[c]+1){let t=e[c];if(t.marker===n.marker&&t.open&&t.end<0){let r=!1;if((t.close||n.open)&&(t.length+n.length)%3==0&&(t.length%3!=0||n.length%3!=0)&&(r=!0),!r){let r=c>0&&!e[c-1].open?a[c-1]+1:0;a[o]=o-c+r,a[c]=r,n.open=!1,t.end=o,t.close=!1,l=-1,i=-2;break}}}l!==-1&&(t[n.marker][(n.open?3:0)+(n.length||0)%3]=l)}}function nu(e){let t=e.tokens_meta,n=e.tokens_meta.length;tu(e.delimiters);for(let e=0;e<n;e++){let n=t[e]?.delimiters;n&&tu(n)}}function ru(e){let t,n,r=0,i=e.tokens,a=e.tokens.length;for(t=n=0;t<a;t++)i[t].nesting<0&&r--,i[t].level=r,i[t].nesting>0&&r++,i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}var iu=[[`text`,jl],[`linkify`,Nl],[`newline`,Pl],[`escape`,Fl],[`backticks`,Z],[`strikethrough`,Rl.tokenize],[`emphasis`,Hl.tokenize],[`link`,Ul],[`image`,Wl],[`autolink`,ql],[`html_inline`,Zl],[`entity`,eu]],au=[[`balance_pairs`,nu],[`strikethrough`,Rl.postProcess],[`emphasis`,Hl.postProcess],[`fragments_join`,ru]],ou=class{constructor(){Y(this,`ruler`,new Tc),Y(this,`ruler2`,new Tc),Y(this,`State`,kl);for(let e=0;e<iu.length;e++)this.ruler.push(iu[e][0],iu[e][1]);for(let e=0;e<au.length;e++)this.ruler2.push(au[e][0],au[e][1])}skipToken(e){let t=e.pos,n=this.ruler.getRules(``),r=n.length,i=e.md.options.maxNesting,a=e.cache;if(a[t]!==void 0){e.pos=a[t];return}let o=!1;if(e.level<i){for(let i=0;i<r;i++)if(e.level++,o=n[i](e,!0),e.level--,o){if(t>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}else e.pos=e.posMax;o||e.pos++,a[t]=e.pos}tokenize(e){let t=this.ruler.getRules(``),n=t.length,r=e.posMax,i=e.md.options.maxNesting;for(;e.pos<r;){let a=e.pos,o=!1;if(e.level<i){for(let r=0;r<n;r++)if(o=t[r](e,!1),o){if(a>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}if(o){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()}parse(e,t,n,r){let i=new this.State(e,t,n,r);this.tokenize(i);let a=this.ruler2.getRules(``),o=a.length;for(let e=0;e<o;e++)a[e](i)}},su={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`strip_references`,`inline`,`text_join`]},block:{rules:[`paragraph`]},inline:{rules:[`text`],rules2:[`balance_pairs`,`fragments_join`]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`strip_references`,`inline`,`text_join`]},block:{rules:[`blockquote`,`code`,`fence`,`heading`,`hr`,`html_block`,`lheading`,`list`,`reference`,`paragraph`]},inline:{rules:[`autolink`,`backticks`,`emphasis`,`entity`,`escape`,`html_inline`,`image`,`link`,`newline`,`text`],rules2:[`balance_pairs`,`emphasis`,`fragments_join`]}}}},cu=/^(vbscript|javascript|file|data):/,lu=/^data:image\/(gif|png|jpeg|webp);/,uu=[`http:`,`https:`,`mailto:`],du=class{validateLink(e){let t=e.trim().toLowerCase();return!cu.test(t)||lu.test(t)}normalizeLink(e){let t=No(e,!0);if(t.hostname&&(!t.protocol||uu.indexOf(t.protocol)>=0))try{t.hostname=Vs.toASCII(t.hostname)}catch{}return bo(xo(t))}normalizeLinkText(e){let t=No(e,!0);if(t.hostname&&(!t.protocol||uu.indexOf(t.protocol)>=0))try{t.hostname=Vs.toUnicode(t.hostname)}catch{}return _o(xo(t),_o.defaultChars+`%`)}constructor(...e){Y(this,`inline`,new ou),Y(this,`block`,new Ol),Y(this,`core`,new nl),Y(this,`renderer`,new Dc),Y(this,`linkify`,new ms),Y(this,`utils`,Ws),Y(this,`helpers`,Object.assign({},bc));let[t,n]=e;typeof t==`string`?(this.configure(t),n&&this.set(n)):(this.configure(`default`),this.set(t||{}))}set(e){return Object.assign(this.options,e),this}configure(e){let t;if(typeof e==`string`){let n=e;if(t=su[n],!t)throw Error(`Wrong 'markdown-it' preset "${n}", check name`)}else t=e;if(!t)throw Error("Wrong `markdown-it` preset, can't be empty");t.options&&(this.options={...t.options});let n=t.components;if(n){[`core`,`block`,`inline`].forEach(e=>{let t=n[e]?.rules;t&&this[e].ruler.enableOnly(t)});let e=n.inline?.rules2;e&&this.inline.ruler2.enableOnly(e)}return this}enable(e,t=!1){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(t=>{n=n.concat(this[t].ruler.enable(e,!0))}),n=n.concat(this.inline.ruler2.enable(e,!0));let r=e.filter(e=>n.indexOf(e)<0);if(r.length&&!t)throw Error(`MarkdownIt. Failed to enable unknown rule(s): ${r}`);return this}disable(e,t=!1){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(t=>{n=n.concat(this[t].ruler.disable(e,!0))}),n=n.concat(this.inline.ruler2.disable(e,!0));let r=e.filter(e=>n.indexOf(e)<0);if(r.length&&!t)throw Error(`MarkdownIt. Failed to disable unknown rule(s): ${r}`);return this}use(e,...t){return e.apply(e,[this,...t]),this}parse(e,t){if(typeof e!=`string`)throw Error(`Input data should be a String`);let n=new this.core.State(e,this,t);return this.core.process(n),n.tokens}render(e,t={}){return this.renderer.render(this.parse(e,t),this.options,t)}parseInline(e,t){let n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens}renderInline(e,t={}){return this.renderer.render(this.parseInline(e,t),this.options,t)}};Y(du,`Token`,wc),Y(du,`Ruler`,Tc),Y(du,`Renderer`,Dc),Y(du,`ParserCore`,nl),Y(du,`StateCore`,Oc),Y(du,`ParserBlock`,Ol),Y(du,`StateBlock`,rl),Y(du,`ParserInline`,ou),Y(du,`StateInline`,kl);var fu=new(Gs(du))({html:!1,linkify:!0,typographer:!1}),pu=0;fu.core.ruler.push(`source_map`,e=>{for(let t of e.tokens)t.map&&t.block&&t.nesting>=0&&t.type!==`inline`&&(t.attrSet(`data-line`,String(t.map[0]+1+pu)),t.attrSet(`data-line-end`,String(t.map[1]+1+pu)))});var mu=e=>e.toLowerCase().replace(/<[^>]+>/g,``).replace(/[`*_~]/g,``).replace(/[^\p{L}\p{N}\s-]/gu,``).trim().replace(/\s+/g,`-`).slice(0,80)||`section`,hu=new Map;fu.renderer.rules.heading_open=(e,t,n,r,i)=>{let a=e[t+1],o=mu(a?.type===`inline`?a.content:``),s=hu.get(o)??0;return hu.set(o,s+1),s&&(o=`${o}-${s+1}`),e[t].attrSet(`id`,o),i.renderToken(e,t,n)};var gu=fu.renderer.rules.fence;fu.renderer.rules.fence=(e,t,n,r,i)=>{let a=e[t],o=a.map?` data-line="${a.map[0]+1+pu}" data-line-end="${a.map[1]+1+pu}"`:``;return a.info.trim()===`mermaid`?`<div class="mermaid"${o}>${fu.utils.escapeHtml(a.content)}</div>`:gu(e,t,n,r,i).replace(/^<pre/,`<pre${o}`)};var _u=new Map;function vu(e){let t=e.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);return t?{meta:t[1].split(`
|
|
23
23
|
`).map(e=>{let t=e.indexOf(`:`);return t>0?[e.slice(0,t).trim(),e.slice(t+1).trim()]:null}).filter(e=>!!e&&!!e[0]),body:e.slice(t[0].length)}:{meta:null,body:e}}function yu(e){let t=_u.get(e);if(t)return t;let{meta:n,body:r}=vu(e),i=e.length-r.length?e.slice(0,e.length-r.length).split(`
|
|
24
|
-
`).length-1:0,a=n?`<div class="frontmatter" data-line="1" data-line-end="${i+1}"><table>${n.map(([e,t])=>`<tr><th>${fu.utils.escapeHtml(e)}</th><td>${fu.utils.escapeHtml(t)}</td></tr>`).join(``)}</table></div>`:``;pu=i,hu=new Map;let o=a+fu.render(r).replace(/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,(e,t,n)=>`<a class="wikilink" href="#/docs/${encodeURIComponent(t)}">${n??t}</a>`).replace(/<li([^>]*)>\[( |x|X)\] /g,(e,t,n)=>`<li${t} class="task"><input type="checkbox" disabled${n.trim()?` checked`:``}> `);return _u.size>200&&_u.clear(),_u.set(e,o),o}var bu={theme:`base`,themeVariables:{primaryColor:`#FFFFFF`,primaryBorderColor:`#2B1D14`,primaryTextColor:`#2B1D14`,lineColor:`#9A7A60`,secondaryColor:`#FBE3D0`,tertiaryColor:`#EFE5D8`,fontFamily:`"Source Sans 3", system-ui, sans-serif`,fontSize:`13px`}};function xu(e){let t=[],n=e.newStart,r=!1;for(let i of e.lines)if(i.startsWith(`+`)){let e=t[t.length-1];e&&e[1]===n?e[1]=n+1:t.push([n,n+1]),n++,r=!1}else i.startsWith(`-`)?r||=(t.push([n,n+1]),!0):(n++,r=!1);return t}function Su(e,t){e.querySelectorAll(`[data-chg]`).forEach(e=>{e.removeAttribute(`data-chg`),e.removeAttribute(`data-hunk`),e.classList.remove(`chg-uncommitted`,`chg-commit`)});let n=[...e.querySelectorAll(`[data-line]`)];t.forEach((e,t)=>e.hunks.forEach((r,i)=>{let a=xu(r),o=n.filter(e=>{let t=+e.dataset.line,n=+e.dataset.lineEnd;return a.some(([e,r])=>t<r&&n>e)});for(let n of o)o.some(e=>e!==n&&n.contains(e))||n.dataset.chg!==`uncommitted`&&(n.dataset.chg=e.kind,n.dataset.hunk=`${t}:${i}`,n.classList.add(e.kind===`uncommitted`?`chg-uncommitted`:`chg-commit`))}))}function Cu(e,t){if(t.length===0)return e;let n=document.createElement(`div`);return n.innerHTML=e,Su(n,t),n.innerHTML}var wu=(0,P.memo)(function({html:e,className:t,onOver:n,onLeave:r}){let i=(0,P.useRef)(null);return(0,P.useEffect)(()=>{let e=i.current;if(!e)return;let t=e.querySelectorAll(`.mermaid:not([data-processed])`);if(t.length===0)return;let n=!1;return oi(async()=>{let{default:e}=await import(`./mermaid.core-CW_jKbCL.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])).then(async({default:e})=>{n||(e.initialize({startOnLoad:!1,...bu}),await e.run({nodes:t}))}),()=>{n=!0}},[e]),(0,B.jsx)(`div`,{ref:i,className:`md ${t}`,dangerouslySetInnerHTML:{__html:e},onMouseOver:n,onMouseLeave:r})});function Tu({source:e,changes:t=[],className:n=``}){let r=yu(e),[i,a]=(0,P.useState)(null),o=(0,P.useMemo)(()=>Cu(r,t),[r,t]),s=(0,P.useRef)(t);s.current=t;let c=(0,P.useCallback)(e=>{let t=e.target.closest(`[data-hunk]`);if(!t){a(e=>e&&null);return}let[n,r]=t.dataset.hunk.split(`:`).map(Number),i=s.current[n],o=i?.hunks[r];if(!i||!o){a(null);return}let c=t.getBoundingClientRect();a({x:Math.min(c.left,window.innerWidth-560),y:c.bottom+6,change:i,hunk:o})},[]),l=(0,P.useCallback)(()=>a(null),[]);return(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(wu,{html:o,className:n,onOver:c,onLeave:l}),i&&(0,B.jsxs)(`div`,{className:`fixed z-50 max-w-[540px] max-h-[50vh] overflow-auto bg-paper border border-sand rounded-kit shadow-panel text-[12px]`,style:{left:i.x,top:i.y},children:[(0,B.jsxs)(`div`,{className:`px-3 py-1.5 border-b border-sand font-mono flex gap-2 items-baseline ${i.change.kind===`uncommitted`?`text-amber`:`text-leaf`}`,children:[(0,B.jsx)(`b`,{children:i.change.kind===`uncommitted`?`uncommitted`:`last commit`}),(0,B.jsx)(`span`,{className:`text-ink3 truncate`,children:i.change.label}),(0,B.jsxs)(`span`,{className:`ml-auto text-tan`,children:[`@@ +`,i.hunk.newStart,`,`,i.hunk.newLines]})]}),(0,B.jsx)(`pre`,{className:`m-0 px-3 py-2 font-mono leading-[1.5] whitespace-pre-wrap`,children:i.hunk.lines.map((e,t)=>(0,B.jsx)(`div`,{className:e.startsWith(`+`)?`bg-moss-wash text-moss`:e.startsWith(`-`)?`bg-brick-wash text-brick line-through decoration-brick/40`:`text-umber`,children:e},t))})]})]})}function Eu(e,t){let n=e.trim().replace(/^['"`<(]+|[>'"`)]+$/g,``),r,i=n.match(/:(\d+)$/);i&&(r=Number(i[1]),n=n.slice(0,-i[0].length)),n.startsWith(`[[`)&&n.endsWith(`]]`)&&(n=n.slice(2,-2).split(`|`)[0].trim()),n=n.replace(/\\/g,`/`);let a=n.toLowerCase().lastIndexOf(`/docs/`);a>=0&&(n=n.slice(a+1)),n.startsWith(`./`)&&(n=n.slice(2));let o=n.toLowerCase().startsWith(`docs/`)?n.slice(5):n,s=o.replace(/\.md$/i,``);if(!t.length)return/^[\w./-]+\.md$/i.test(o)?{file:o,line:r}:s&&!s.includes(` `)?{file:`${s}.md`,line:r}:null;let c=t.filter(e=>{let t=e.replace(/\.md$/i,``),n=e.split(`/`).pop()?.replace(/\.md$/i,``);return e===o||e===`${o}.md`||t===s||t.endsWith(`/${s}`)||e.endsWith(`/${o}`)||n===s});return c.length===1?{file:c[0],line:r}:c.includes(o)?{file:o,line:r}:c.includes(`${o}.md`)?{file:`${o}.md`,line:r}:null}var Du=/\[\[([^\]|]+)(?:\|[^\]]+)?\]\](?::\d+)?|(?:(?:~\/|\.{1,2}\/)?(?:[\w.-]+\/)+)?[\w.-]+\.md(?::\d+)?/g;function Ou(e,t,n){return e==null||typeof e==`boolean`||typeof e==`number`?e:typeof e==`string`?ku(e,t,n):Array.isArray(e)?e.map((e,r)=>{let i=Ou(e,t,n);return(0,P.isValidElement)(i)&&i.key==null?(0,P.cloneElement)(i,{key:r}):i}):(0,P.isValidElement)(e)&&e.props.children!=null?(0,P.cloneElement)(e,void 0,Ou(e.props.children,t,n)):e}function ku(e,t,n){if(Du.lastIndex=0,!Du.test(e))return e;Du.lastIndex=0;let r=[],i=0,a,o=0;for(;a=Du.exec(e);){a.index>i&&r.push(e.slice(i,a.index));let s=a[0],c=Eu(s,t);c?r.push((0,B.jsx)(`button`,{type:`button`,className:`md-ref`,title:`Open ${c.file}${c.line?`:${c.line}`:``}`,onClick:e=>{e.preventDefault(),e.stopPropagation(),n(c)},children:s},`md-${o++}`)):r.push(s),i=a.index+s.length}return i<e.length&&r.push(e.slice(i)),r.length===1?r[0]:r}var Au=(0,P.createContext)({files:[],open:()=>{},linkify:e=>e}),ju=()=>(0,P.useContext)(Au);function Mu({children:e}){let{current:t}=Ha(),n=ar(),[r,i]=(0,P.useState)(null),a=q(t?`/projects/${t}/docs`:null,3e4).data?.files??[],o=q(r?`/projects/${r.project}/docs/${encodeURIComponent(r.ref.file)}`:null),s=(e,n)=>{let r=n||t;r&&i({ref:e,project:r})};return(0,P.useEffect)(()=>{if(!r)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),e.preventDefault(),i(null))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r]),(0,P.useEffect)(()=>{if(!r||!o.data||!r.ref.line)return;let e=setTimeout(()=>document.getElementById(`L${r.ref.line}`)?.scrollIntoView({block:`center`}),80);return()=>clearTimeout(e)},[r,o.data]),(0,B.jsxs)(Au.Provider,{value:{files:a,open:s,linkify:(e,n)=>Ou(e,a,e=>s(e,n||t))},children:[e,r&&(0,B.jsx)(`div`,{className:`fixed inset-0 z-[70] bg-walnut/40 flex items-start justify-center pt-[8vh] px-4`,onMouseDown:e=>{e.target===e.currentTarget&&i(null)},children:(0,B.jsxs)(`div`,{className:`w-[min(820px,94vw)] max-h-[84vh] bg-paper border border-sand rounded-kit shadow-panel grid grid-rows-[auto_1fr] overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`px-4 py-2.5 border-b border-sand flex items-center gap-2 min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-mono text-[12px] text-ink3 truncate`,title:o.data?.path??r.ref.file,children:[o.data?.path??`docs/${r.ref.file}`,r.ref.line?`:${r.ref.line}`:``]}),(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 shrink-0`,children:[(0,B.jsx)(K,{size:`sm`,onClick:()=>{n(`/docs/${encodeURIComponent(r.ref.file)}${r.ref.line?`?view=source&line=${r.ref.line}`:``}`),i(null)},children:`Open in Docs`}),(0,B.jsx)(K,{size:`sm`,onClick:()=>i(null),children:`Close (Esc)`})]})]}),(0,B.jsxs)(`div`,{className:`overflow-auto px-6 py-4`,children:[o.loading&&(0,B.jsx)(`div`,{className:`text-[13px] text-umber`,children:`loading…`}),o.error&&(0,B.jsxs)(`div`,{className:`text-[13px] text-brick`,children:[`Could not load — not in `,r.project,`’s docs/? `,o.error]}),o.data&&(0,B.jsx)(Tu,{source:o.data.source})]})]})})]})}var Nu=[`circle`,`square`,`diamond`,`hexagon`,`triangle`,`shield`,`leaf`,`pentagon`];function Pu(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}var Fu=e=>Nu[Pu(e)%Nu.length];function Iu(e,t){let n=t/2,r=t/2-1,i=(e,t=-Math.PI/2)=>Array.from({length:e},(i,a)=>{let o=t+a*2*Math.PI/e;return`${(n+r*Math.cos(o)).toFixed(2)},${(n+r*Math.sin(o)).toFixed(2)}`}).join(` `);switch(e){case`circle`:return(0,B.jsx)(`circle`,{cx:n,cy:n,r});case`square`:return(0,B.jsx)(`rect`,{x:1.5,y:1.5,width:t-3,height:t-3,rx:2});case`diamond`:return(0,B.jsx)(`polygon`,{points:i(4)});case`hexagon`:return(0,B.jsx)(`polygon`,{points:i(6,0)});case`triangle`:return(0,B.jsx)(`polygon`,{points:i(3)});case`pentagon`:return(0,B.jsx)(`polygon`,{points:i(5)});case`shield`:return(0,B.jsx)(`path`,{d:`M${n} 1.5 L${t-1.5} ${t*.3} V${t*.55} Q${t-1.5} ${t-2} ${n} ${t-1.5} Q1.5 ${t-2} 1.5 ${t*.55} V${t*.3} Z`});case`leaf`:return(0,B.jsx)(`path`,{d:`M${n} 1.5 Q${t-1.5} ${t*.35} ${t-2.5} ${t-2} Q${t*.35} ${t-1.5} 1.5 ${n} Q${t*.35} 1.5 ${n} 1.5 Z`})}}function Lu({id:e,role:t,size:n=18,state:r,active:i,className:a=``}){let o=dd(t),s=Fu(e),c=r===`dead`?.35:r===`dormant`?.5:r===`idle`?.7:1,l=e.replace(/[^a-z0-9]/gi,``).slice(0,1).toUpperCase();return(0,B.jsxs)(`span`,{className:`relative inline-flex shrink-0 ${a}`,style:{width:n,height:n},title:`${e}${t?` · ${t}`:``}`,children:[(0,B.jsxs)(`svg`,{width:n,height:n,viewBox:`0 0 ${n} ${n}`,style:{opacity:c},"aria-hidden":!0,children:[(0,B.jsx)(`g`,{fill:o,stroke:o,strokeWidth:`1`,children:Iu(s,n)}),(0,B.jsx)(`text`,{x:n/2,y:n/2+n*.22,textAnchor:`middle`,fontSize:n*.55,fontFamily:`JetBrains Mono, monospace`,fontWeight:`700`,fill:`#FCFAF6`,children:l})]}),i&&(0,B.jsx)(`span`,{className:`absolute -right-0.5 -bottom-0.5 w-2 h-2 rounded-full bg-moss ring-2 ring-paper`,children:(0,B.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-moss animate-ping opacity-60`})})]})}var Ru=e=>/done|merged|deployed|complete|closed|✅/i.test(e);function zu(e){return e?e.workstreams.rows.filter(e=>!(`malformed`in e)).map(e=>e.schema===`workstreams.v1`?{name:e.stream,owner:e.owner,status:e.status,note:e.lastNote??``}:{name:e.lane,owner:e.owner,status:e.state,note:e.currentSlice??``}).map(e=>({...e,done:Ru(e.status)})):[]}var Bu=e=>e.match(/^Task\s+(\d+)\b/i)?.[1]??null;function Vu(e,t,n){if(!n)return null;let r=t.replace(/\./g,`\\.`),i=RegExp(`(^|\\b)(P${r}[-.\\s]?T${n}\\b|Phase\\s*${r}\\b.*\\bT(?:ask)?\\s*${n}\\b)`,`i`);return e.find(e=>i.test(e.name))??null}function Hu(e,t){let n=e.trim().toLowerCase();return t.find(e=>e.toLowerCase()===n)??t.find(e=>n.includes(e.toLowerCase()))??null}var Uu=/(`[^`\n]+`)|(\*\*[^*\n]+\*\*)|(~~[^~\n]+~~)|(\[\[([^\]|\n]+)(?:\|([^\]\n]+))?\]\])|(\[([^\]\n]+)\]\((https?:\/\/[^)\s]+)\))|(\bhttps?:\/\/[^\s<>()"']+[^\s<>()"'.,;:!?])|((?<![\w*])\*(?!\s)([^*\n]+?)(?<!\s)\*(?![\w*]))|((?<![\w_])_(?!\s)([^_\n]+?)(?<!\s)_(?![\w_]))/g;function Wu({text:e,className:t}){let n=[],r=0,i,a=0;for(Uu.lastIndex=0;i=Uu.exec(e);)i.index>r&&n.push(e.slice(r,i.index)),i[1]?n.push((0,B.jsx)(`code`,{className:`font-mono text-[.92em] px-1 rounded bg-linen text-walnut`,children:i[1].slice(1,-1)},a++)):i[2]?n.push((0,B.jsx)(`b`,{children:i[2].slice(2,-2)},a++)):i[3]?n.push((0,B.jsx)(`s`,{className:`text-tan`,children:i[3].slice(2,-2)},a++)):i[4]?n.push((0,B.jsx)(V,{to:`/docs/${encodeURIComponent(i[5])}`,onClick:e=>e.stopPropagation(),className:`text-ember-deep`,children:i[6]??i[5]},a++)):i[7]?n.push((0,B.jsx)(`a`,{href:i[9],target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),className:`text-ember-deep`,children:i[8]},a++)):i[10]?n.push((0,B.jsxs)(`a`,{href:i[10],target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),className:`text-ember-deep break-all`,children:[i[10].replace(/^https?:\/\//,``).slice(0,60),i[10].replace(/^https?:\/\//,``).length>60?`…`:``]},a++)):i[11]?n.push((0,B.jsx)(`i`,{children:i[12]},a++)):i[13]&&n.push((0,B.jsx)(`i`,{children:i[14]},a++)),r=i.index+i[0].length;return r<e.length&&n.push(e.slice(r)),t?(0,B.jsx)(`span`,{className:t,children:n}):(0,B.jsx)(B.Fragment,{children:n})}var Gu=({text:e})=>(0,B.jsx)(Wu,{text:e});function Ku({stream:e,agents:t,size:n=`sm`}){if(!e)return null;let r=Hu(e.owner,t.map(e=>e.agentId));return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 shrink-0`,title:`${e.name} · ${e.owner} · ${e.status}${e.note?` · ${e.note}`:``}`,children:[r?(0,B.jsx)(ld,{id:r,bare:!0,size:n}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[11px] text-umber`,children:[(0,B.jsx)(Lu,{id:e.owner,size:14,state:`dead`}),e.owner]}),(0,B.jsx)(G,{tone:e.done?`ok`:/block/i.test(e.status)?`bad`:/queued|hold|wait/i.test(e.status)?`warn`:`neutral`,children:e.status.replace(/^[^\w]+/,``).slice(0,16)})]})}function qu({project:e,phase:t,highlight:n,maxH:r=`46vh`,compact:i=!1}){let{data:a,error:o}=q(`/projects/${e}/phases/${t.id}/tasks`,15e3),s=q(`/projects/${e}/board`,15e3).data,c=q(`/bus/agents`,2e4).data??[],l=zu(s),[u,d]=(0,P.useState)({}),f=q(`/admin/bus-writes`,1e4).data?.enabled??!1,[p,m]=(0,P.useState)({}),h=async(n,r)=>{m(e=>({...e,[n]:{to:r??`aide`,ts:Date.now()}}));try{let i=await Ia(`/actions/task/${e}/${t.id}/${n}`,{owner:r??void 0});if(i.status!==`ok`)throw Error(i.error??i.log?.slice(-1)[0]??`failed`);m(e=>({...e,[n]:{to:i.owner??r??`aide`,ts:Date.now()}}))}catch(e){m(t=>({...t,[n]:{err:e.message}}))}};return o?(0,B.jsx)(`div`,{className:`px-3 py-2 text-[13px] text-brick`,children:o}):a?a.sections.length===0?(0,B.jsxs)(`div`,{className:`px-3 py-3 text-[13px] text-umber`,children:[`No tasks yet — run `,(0,B.jsx)(`code`,{children:`/plan-phase`}),` (roadmap → Plan).`]}):(0,B.jsx)(`div`,{className:`grid gap-0 overflow-auto overscroll-contain min-w-0`,style:{maxHeight:r},children:a.sections.map(e=>{let r=e.tasks.filter(e=>e.done).length,o=r===e.tasks.length,s=Vu(l,t.n,Bu(e.title)),m=!!n&&!!s&&Hu(s.owner,c.map(e=>e.agentId))===n,g=u[e.line]===void 0?o:!u[e.line];return(0,B.jsxs)(`div`,{className:`border-b border-sand last:border-b-0 min-w-0 ${m?`bg-ember/[.04]`:``}`,children:[(0,B.jsxs)(`div`,{className:`sticky top-0 z-[1] px-3 py-1.5 min-w-0 ${m?`bg-ember-wash`:`bg-cream`} ${i?`grid gap-0.5`:`flex items-center gap-2`}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>d(t=>({...t,[e.line]:g})),className:`border-0 bg-transparent p-0 cursor-pointer font-mono text-[11px] text-tan w-3 shrink-0 hover:text-umber`,title:g?`expand`:`collapse`,"aria-expanded":!g,children:g?`▸`:`▾`}),m&&(0,B.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-ember shrink-0`,title:`this agent's task`}),(0,B.jsx)(V,{to:`/docs/${encodeURIComponent(a.file)}?view=source&line=${e.line}`,className:`font-semibold text-[12px] hover:no-underline hover:text-ember-deep truncate ${o?`text-tan`:`text-umber`}`,children:e.title}),(0,B.jsxs)(`span`,{className:`font-mono text-[11px] shrink-0 ${o?`text-leaf`:`text-tan`}`,children:[r,`/`,e.tasks.length,o?` ✓`:``]}),!i&&(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[(0,B.jsx)(Ku,{stream:s,agents:c}),(0,B.jsx)(`span`,{className:`h-1 w-24 rounded-full bg-linen overflow-hidden`,children:(0,B.jsx)(`span`,{className:`block h-full ${o?`bg-leaf`:`bg-ember`}`,style:{width:`${e.tasks.length?r/e.tasks.length*100:0}%`}})})]})]}),i&&s&&(0,B.jsx)(`div`,{className:`flex items-center gap-2 min-w-0 pl-5`,children:(0,B.jsx)(Ku,{stream:s,agents:c})})]}),!g&&e.tasks.map(e=>(0,B.jsxs)(`div`,{className:`group grid grid-cols-[var(--spacing-gutter)_minmax(0,1fr)_auto] items-start hover:bg-linen/60 border-t border-sand/60 min-w-0`,style:{paddingLeft:e.depth*12},children:[(0,B.jsx)(`span`,{className:`self-stretch flex items-start justify-center pt-1.5 font-mono text-[11px] border-r border-sand ${e.done?`text-leaf`:p[e.line]&&!(`err`in p[e.line])?`text-amber`:`text-tan`}`,title:p[e.line]&&!(`err`in p[e.line])?`asked ${p[e.line].to} to tick it`:void 0,children:e.done?`- [x]`:p[e.line]&&!(`err`in p[e.line])?`- [~]`:`- [ ]`}),(0,B.jsxs)(V,{to:`/docs/${encodeURIComponent(a.file)}?view=source&line=${e.line}`,className:`px-3 py-1.5 min-w-0 break-words hover:no-underline text-inherit ${i?`text-[12px] leading-snug`:`text-[13px]`} ${e.done?`text-tan line-through decoration-dust`:``}`,children:[(0,B.jsx)(Gu,{text:e.text}),p[e.line]&&`err`in p[e.line]&&(0,B.jsx)(`span`,{className:`ml-2 font-mono text-[10px] text-brick`,children:p[e.line].err})]}),(0,B.jsx)(`span`,{className:`pr-2 pt-1 shrink-0`,children:!e.done&&(p[e.line]&&!(`err`in p[e.line])?(0,B.jsxs)(`span`,{className:`font-mono text-[10px] text-amber whitespace-nowrap`,title:`the owner was asked to run /check-task; the tick appears when it does`,children:[`asked · `,p[e.line].to.split(`-`).slice(-1)[0]]}):(0,B.jsx)(`button`,{type:`button`,disabled:!f,onClick:()=>h(e.line,s?Hu(s.owner,c.map(e=>e.agentId)):null),className:`opacity-0 group-hover:opacity-100 focus:opacity-100 font-mono text-[10px] px-1.5 py-0.5 rounded border ${f?`border-dust text-umber bg-paper hover:text-leaf hover:border-leaf cursor-pointer`:`border-dashed border-dust text-tan cursor-not-allowed`}`,title:f?`ask ${s?s.owner:`the aide`} to run /check-task for this line`:`bus writes are off (header) — mark done DMs the owner`,children:`✓ done`}))})]},e.line))]},e.line)})}):(0,B.jsx)(`div`,{className:`px-3 py-2 font-mono text-[12px] text-tan`,children:`…`})}function Ju({project:e,phase:t,onClose:n}){let{data:r}=q(`/projects/${e}/phases/${t.id}/tasks`,15e3),i=r?.total?Math.round(r.done/r.total*100):0;return(0,B.jsxs)(`div`,{className:`mt-3 border border-sand rounded-kit bg-paper`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-sand`,children:[(0,B.jsx)(`b`,{className:`text-[13px]`,children:t.title}),(0,B.jsx)(G,{tone:r?.total&&r.done===r.total?`ok`:`neutral`,children:r?`${r.done}/${r.total} · ${i}%`:`…`}),(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-ink3`,children:r?.file??`no tasks file`}),(0,B.jsxs)(`span`,{className:`ml-auto flex gap-1.5`,children:[r?.file&&(0,B.jsx)(V,{to:`/docs/${encodeURIComponent(r.file)}`,className:`hover:no-underline`,children:(0,B.jsx)(K,{size:`sm`,tone:`ghost`,children:`Open doc`})}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:n,children:`✕`})]})]}),(0,B.jsx)(qu,{project:e,phase:t})]})}var Yu=`/api`,Xu=/\[image: (\S+) · (\S+)\]/g,Zu=e=>`${Yu}/uploads/${encodeURIComponent(e.split(`/`).pop()??``)}`;function Qu(e){let t=e?.persistKey,[n,r]=(0,P.useState)(()=>{if(!t)return[];try{return JSON.parse(localStorage.getItem(t)??`[]`)}catch{return[]}}),i=(0,P.useCallback)(e=>r(n=>{let r=e(n);if(t)try{r.length?localStorage.setItem(t,JSON.stringify(r)):localStorage.removeItem(t)}catch{}return r}),[t]);(0,P.useEffect)(()=>{if(t)try{r(JSON.parse(localStorage.getItem(t)??`[]`))}catch{r([])}},[t]);let[a,o]=(0,P.useState)(0),[s,c]=(0,P.useState)(null),l=(0,P.useCallback)(async e=>{let t=e.filter(e=>e.type.startsWith(`image/`));if(t.length){o(e=>e+t.length),c(null);for(let e of t)try{let t=new FormData;t.append(`file`,e,e.name||`paste.png`);let n=await fetch(`${Yu}/uploads`,{method:`POST`,body:t}),r=await n.json();if(!n.ok)throw Error(r.error??`${n.status}`);i(e=>e.some(e=>e.name===r.name)?e:[...e,r])}catch(e){c(e.message)}finally{o(e=>e-1)}}},[]),u=(0,P.useCallback)(e=>{let t=Array.from(e.clipboardData?.files??[]);t.length&&(e.preventDefault(),l(t))},[l]),d=(0,P.useCallback)(e=>{let t=Array.from(e.dataTransfer?.files??[]);t.length&&(e.preventDefault(),l(t))},[l]),f=(0,P.useCallback)(e=>{e.dataTransfer?.types.includes(`Files`)&&e.preventDefault()},[]);return{items:n,busy:a>0,err:s,onPaste:u,onDrop:d,onDragOver:f,remove:e=>i(t=>t.filter(t=>t.name!==e)),clear:()=>i(()=>[]),withRefs:e=>n.length?`${e.trim()}${e.trim()?`
|
|
24
|
+
`).length-1:0,a=n?`<div class="frontmatter" data-line="1" data-line-end="${i+1}"><table>${n.map(([e,t])=>`<tr><th>${fu.utils.escapeHtml(e)}</th><td>${fu.utils.escapeHtml(t)}</td></tr>`).join(``)}</table></div>`:``;pu=i,hu=new Map;let o=a+fu.render(r).replace(/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,(e,t,n)=>`<a class="wikilink" href="#/docs/${encodeURIComponent(t)}">${n??t}</a>`).replace(/<li([^>]*)>\[( |x|X)\] /g,(e,t,n)=>`<li${t} class="task"><input type="checkbox" disabled${n.trim()?` checked`:``}> `);return _u.size>200&&_u.clear(),_u.set(e,o),o}var bu={theme:`base`,themeVariables:{primaryColor:`#FFFFFF`,primaryBorderColor:`#2B1D14`,primaryTextColor:`#2B1D14`,lineColor:`#9A7A60`,secondaryColor:`#FBE3D0`,tertiaryColor:`#EFE5D8`,fontFamily:`"Source Sans 3", system-ui, sans-serif`,fontSize:`13px`}};function xu(e){let t=[],n=e.newStart,r=!1;for(let i of e.lines)if(i.startsWith(`+`)){let e=t[t.length-1];e&&e[1]===n?e[1]=n+1:t.push([n,n+1]),n++,r=!1}else i.startsWith(`-`)?r||=(t.push([n,n+1]),!0):(n++,r=!1);return t}function Su(e,t){e.querySelectorAll(`[data-chg]`).forEach(e=>{e.removeAttribute(`data-chg`),e.removeAttribute(`data-hunk`),e.classList.remove(`chg-uncommitted`,`chg-commit`)});let n=[...e.querySelectorAll(`[data-line]`)];t.forEach((e,t)=>e.hunks.forEach((r,i)=>{let a=xu(r),o=n.filter(e=>{let t=+e.dataset.line,n=+e.dataset.lineEnd;return a.some(([e,r])=>t<r&&n>e)});for(let n of o)o.some(e=>e!==n&&n.contains(e))||n.dataset.chg!==`uncommitted`&&(n.dataset.chg=e.kind,n.dataset.hunk=`${t}:${i}`,n.classList.add(e.kind===`uncommitted`?`chg-uncommitted`:`chg-commit`))}))}function Cu(e,t){if(t.length===0)return e;let n=document.createElement(`div`);return n.innerHTML=e,Su(n,t),n.innerHTML}var wu=(0,P.memo)(function({html:e,className:t,onOver:n,onLeave:r}){let i=(0,P.useRef)(null);return(0,P.useEffect)(()=>{let e=i.current;if(!e)return;let t=e.querySelectorAll(`.mermaid:not([data-processed])`);if(t.length===0)return;let n=!1;return oi(async()=>{let{default:e}=await import(`./mermaid.core-Cc5OhPpa.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])).then(async({default:e})=>{n||(e.initialize({startOnLoad:!1,...bu}),await e.run({nodes:t}))}),()=>{n=!0}},[e]),(0,B.jsx)(`div`,{ref:i,className:`md ${t}`,dangerouslySetInnerHTML:{__html:e},onMouseOver:n,onMouseLeave:r})});function Tu({source:e,changes:t=[],className:n=``}){let r=yu(e),[i,a]=(0,P.useState)(null),o=(0,P.useMemo)(()=>Cu(r,t),[r,t]),s=(0,P.useRef)(t);s.current=t;let c=(0,P.useCallback)(e=>{let t=e.target.closest(`[data-hunk]`);if(!t){a(e=>e&&null);return}let[n,r]=t.dataset.hunk.split(`:`).map(Number),i=s.current[n],o=i?.hunks[r];if(!i||!o){a(null);return}let c=t.getBoundingClientRect();a({x:Math.min(c.left,window.innerWidth-560),y:c.bottom+6,change:i,hunk:o})},[]),l=(0,P.useCallback)(()=>a(null),[]);return(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(wu,{html:o,className:n,onOver:c,onLeave:l}),i&&(0,B.jsxs)(`div`,{className:`fixed z-50 max-w-[540px] max-h-[50vh] overflow-auto bg-paper border border-sand rounded-kit shadow-panel text-[12px]`,style:{left:i.x,top:i.y},children:[(0,B.jsxs)(`div`,{className:`px-3 py-1.5 border-b border-sand font-mono flex gap-2 items-baseline ${i.change.kind===`uncommitted`?`text-amber`:`text-leaf`}`,children:[(0,B.jsx)(`b`,{children:i.change.kind===`uncommitted`?`uncommitted`:`last commit`}),(0,B.jsx)(`span`,{className:`text-ink3 truncate`,children:i.change.label}),(0,B.jsxs)(`span`,{className:`ml-auto text-tan`,children:[`@@ +`,i.hunk.newStart,`,`,i.hunk.newLines]})]}),(0,B.jsx)(`pre`,{className:`m-0 px-3 py-2 font-mono leading-[1.5] whitespace-pre-wrap`,children:i.hunk.lines.map((e,t)=>(0,B.jsx)(`div`,{className:e.startsWith(`+`)?`bg-moss-wash text-moss`:e.startsWith(`-`)?`bg-brick-wash text-brick line-through decoration-brick/40`:`text-umber`,children:e},t))})]})]})}function Eu(e,t){let n=e.trim().replace(/^['"`<(]+|[>'"`)]+$/g,``),r,i=n.match(/:(\d+)$/);i&&(r=Number(i[1]),n=n.slice(0,-i[0].length)),n.startsWith(`[[`)&&n.endsWith(`]]`)&&(n=n.slice(2,-2).split(`|`)[0].trim()),n=n.replace(/\\/g,`/`);let a=n.toLowerCase().lastIndexOf(`/docs/`);a>=0&&(n=n.slice(a+1)),n.startsWith(`./`)&&(n=n.slice(2));let o=n.toLowerCase().startsWith(`docs/`)?n.slice(5):n,s=o.replace(/\.md$/i,``);if(!t.length)return/^[\w./-]+\.md$/i.test(o)?{file:o,line:r}:s&&!s.includes(` `)?{file:`${s}.md`,line:r}:null;let c=t.filter(e=>{let t=e.replace(/\.md$/i,``),n=e.split(`/`).pop()?.replace(/\.md$/i,``);return e===o||e===`${o}.md`||t===s||t.endsWith(`/${s}`)||e.endsWith(`/${o}`)||n===s});return c.length===1?{file:c[0],line:r}:c.includes(o)?{file:o,line:r}:c.includes(`${o}.md`)?{file:`${o}.md`,line:r}:null}var Du=/\[\[([^\]|]+)(?:\|[^\]]+)?\]\](?::\d+)?|(?:(?:~\/|\.{1,2}\/)?(?:[\w.-]+\/)+)?[\w.-]+\.md(?::\d+)?/g;function Ou(e,t,n){return e==null||typeof e==`boolean`||typeof e==`number`?e:typeof e==`string`?ku(e,t,n):Array.isArray(e)?e.map((e,r)=>{let i=Ou(e,t,n);return(0,P.isValidElement)(i)&&i.key==null?(0,P.cloneElement)(i,{key:r}):i}):(0,P.isValidElement)(e)&&e.props.children!=null?(0,P.cloneElement)(e,void 0,Ou(e.props.children,t,n)):e}function ku(e,t,n){if(Du.lastIndex=0,!Du.test(e))return e;Du.lastIndex=0;let r=[],i=0,a,o=0;for(;a=Du.exec(e);){a.index>i&&r.push(e.slice(i,a.index));let s=a[0],c=Eu(s,t);c?r.push((0,B.jsx)(`button`,{type:`button`,className:`md-ref`,title:`Open ${c.file}${c.line?`:${c.line}`:``}`,onClick:e=>{e.preventDefault(),e.stopPropagation(),n(c)},children:s},`md-${o++}`)):r.push(s),i=a.index+s.length}return i<e.length&&r.push(e.slice(i)),r.length===1?r[0]:r}var Au=(0,P.createContext)({files:[],open:()=>{},linkify:e=>e}),ju=()=>(0,P.useContext)(Au);function Mu({children:e}){let{current:t}=Ha(),n=ar(),[r,i]=(0,P.useState)(null),a=q(t?`/projects/${t}/docs`:null,3e4).data?.files??[],o=q(r?`/projects/${r.project}/docs/${encodeURIComponent(r.ref.file)}`:null),s=(e,n)=>{let r=n||t;r&&i({ref:e,project:r})};return(0,P.useEffect)(()=>{if(!r)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),e.preventDefault(),i(null))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r]),(0,P.useEffect)(()=>{if(!r||!o.data||!r.ref.line)return;let e=setTimeout(()=>document.getElementById(`L${r.ref.line}`)?.scrollIntoView({block:`center`}),80);return()=>clearTimeout(e)},[r,o.data]),(0,B.jsxs)(Au.Provider,{value:{files:a,open:s,linkify:(e,n)=>Ou(e,a,e=>s(e,n||t))},children:[e,r&&(0,B.jsx)(`div`,{className:`fixed inset-0 z-[70] bg-walnut/40 flex items-start justify-center pt-[8vh] px-4`,onMouseDown:e=>{e.target===e.currentTarget&&i(null)},children:(0,B.jsxs)(`div`,{className:`w-[min(820px,94vw)] max-h-[84vh] bg-paper border border-sand rounded-kit shadow-panel grid grid-rows-[auto_1fr] overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`px-4 py-2.5 border-b border-sand flex items-center gap-2 min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-mono text-[12px] text-ink3 truncate`,title:o.data?.path??r.ref.file,children:[o.data?.path??`docs/${r.ref.file}`,r.ref.line?`:${r.ref.line}`:``]}),(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 shrink-0`,children:[(0,B.jsx)(K,{size:`sm`,onClick:()=>{n(`/docs/${encodeURIComponent(r.ref.file)}${r.ref.line?`?view=source&line=${r.ref.line}`:``}`),i(null)},children:`Open in Docs`}),(0,B.jsx)(K,{size:`sm`,onClick:()=>i(null),children:`Close (Esc)`})]})]}),(0,B.jsxs)(`div`,{className:`overflow-auto px-6 py-4`,children:[o.loading&&(0,B.jsx)(`div`,{className:`text-[13px] text-umber`,children:`loading…`}),o.error&&(0,B.jsxs)(`div`,{className:`text-[13px] text-brick`,children:[`Could not load — not in `,r.project,`’s docs/? `,o.error]}),o.data&&(0,B.jsx)(Tu,{source:o.data.source})]})]})})]})}var Nu=[`circle`,`square`,`diamond`,`hexagon`,`triangle`,`shield`,`leaf`,`pentagon`];function Pu(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}var Fu=e=>Nu[Pu(e)%Nu.length];function Iu(e,t){let n=t/2,r=t/2-1,i=(e,t=-Math.PI/2)=>Array.from({length:e},(i,a)=>{let o=t+a*2*Math.PI/e;return`${(n+r*Math.cos(o)).toFixed(2)},${(n+r*Math.sin(o)).toFixed(2)}`}).join(` `);switch(e){case`circle`:return(0,B.jsx)(`circle`,{cx:n,cy:n,r});case`square`:return(0,B.jsx)(`rect`,{x:1.5,y:1.5,width:t-3,height:t-3,rx:2});case`diamond`:return(0,B.jsx)(`polygon`,{points:i(4)});case`hexagon`:return(0,B.jsx)(`polygon`,{points:i(6,0)});case`triangle`:return(0,B.jsx)(`polygon`,{points:i(3)});case`pentagon`:return(0,B.jsx)(`polygon`,{points:i(5)});case`shield`:return(0,B.jsx)(`path`,{d:`M${n} 1.5 L${t-1.5} ${t*.3} V${t*.55} Q${t-1.5} ${t-2} ${n} ${t-1.5} Q1.5 ${t-2} 1.5 ${t*.55} V${t*.3} Z`});case`leaf`:return(0,B.jsx)(`path`,{d:`M${n} 1.5 Q${t-1.5} ${t*.35} ${t-2.5} ${t-2} Q${t*.35} ${t-1.5} 1.5 ${n} Q${t*.35} 1.5 ${n} 1.5 Z`})}}function Lu({id:e,role:t,size:n=18,state:r,active:i,className:a=``}){let o=dd(t),s=Fu(e),c=r===`dead`?.35:r===`dormant`?.5:r===`idle`?.7:1,l=e.replace(/[^a-z0-9]/gi,``).slice(0,1).toUpperCase();return(0,B.jsxs)(`span`,{className:`relative inline-flex shrink-0 ${a}`,style:{width:n,height:n},title:`${e}${t?` · ${t}`:``}`,children:[(0,B.jsxs)(`svg`,{width:n,height:n,viewBox:`0 0 ${n} ${n}`,style:{opacity:c},"aria-hidden":!0,children:[(0,B.jsx)(`g`,{fill:o,stroke:o,strokeWidth:`1`,children:Iu(s,n)}),(0,B.jsx)(`text`,{x:n/2,y:n/2+n*.22,textAnchor:`middle`,fontSize:n*.55,fontFamily:`JetBrains Mono, monospace`,fontWeight:`700`,fill:`#FCFAF6`,children:l})]}),i&&(0,B.jsx)(`span`,{className:`absolute -right-0.5 -bottom-0.5 w-2 h-2 rounded-full bg-moss ring-2 ring-paper`,children:(0,B.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-moss animate-ping opacity-60`})})]})}var Ru=e=>/done|merged|deployed|complete|closed|✅/i.test(e);function zu(e){return e?e.workstreams.rows.filter(e=>!(`malformed`in e)).map(e=>e.schema===`workstreams.v1`?{name:e.stream,owner:e.owner,status:e.status,note:e.lastNote??``}:{name:e.lane,owner:e.owner,status:e.state,note:e.currentSlice??``}).map(e=>({...e,done:Ru(e.status)})):[]}var Bu=e=>e.match(/^Task\s+(\d+)\b/i)?.[1]??null;function Vu(e,t,n){if(!n)return null;let r=t.replace(/\./g,`\\.`),i=RegExp(`(^|\\b)(P${r}[-.\\s]?T${n}\\b|Phase\\s*${r}\\b.*\\bT(?:ask)?\\s*${n}\\b)`,`i`);return e.find(e=>i.test(e.name))??null}function Hu(e,t){let n=e.trim().toLowerCase();return t.find(e=>e.toLowerCase()===n)??t.find(e=>n.includes(e.toLowerCase()))??null}var Uu=/(`[^`\n]+`)|(\*\*[^*\n]+\*\*)|(~~[^~\n]+~~)|(\[\[([^\]|\n]+)(?:\|([^\]\n]+))?\]\])|(\[([^\]\n]+)\]\((https?:\/\/[^)\s]+)\))|(\bhttps?:\/\/[^\s<>()"']+[^\s<>()"'.,;:!?])|((?<![\w*])\*(?!\s)([^*\n]+?)(?<!\s)\*(?![\w*]))|((?<![\w_])_(?!\s)([^_\n]+?)(?<!\s)_(?![\w_]))/g;function Wu({text:e,className:t}){let n=[],r=0,i,a=0;for(Uu.lastIndex=0;i=Uu.exec(e);)i.index>r&&n.push(e.slice(r,i.index)),i[1]?n.push((0,B.jsx)(`code`,{className:`font-mono text-[.92em] px-1 rounded bg-linen text-walnut`,children:i[1].slice(1,-1)},a++)):i[2]?n.push((0,B.jsx)(`b`,{children:i[2].slice(2,-2)},a++)):i[3]?n.push((0,B.jsx)(`s`,{className:`text-tan`,children:i[3].slice(2,-2)},a++)):i[4]?n.push((0,B.jsx)(V,{to:`/docs/${encodeURIComponent(i[5])}`,onClick:e=>e.stopPropagation(),className:`text-ember-deep`,children:i[6]??i[5]},a++)):i[7]?n.push((0,B.jsx)(`a`,{href:i[9],target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),className:`text-ember-deep`,children:i[8]},a++)):i[10]?n.push((0,B.jsxs)(`a`,{href:i[10],target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),className:`text-ember-deep break-all`,children:[i[10].replace(/^https?:\/\//,``).slice(0,60),i[10].replace(/^https?:\/\//,``).length>60?`…`:``]},a++)):i[11]?n.push((0,B.jsx)(`i`,{children:i[12]},a++)):i[13]&&n.push((0,B.jsx)(`i`,{children:i[14]},a++)),r=i.index+i[0].length;return r<e.length&&n.push(e.slice(r)),t?(0,B.jsx)(`span`,{className:t,children:n}):(0,B.jsx)(B.Fragment,{children:n})}var Gu=({text:e})=>(0,B.jsx)(Wu,{text:e});function Ku({stream:e,agents:t,size:n=`sm`}){if(!e)return null;let r=Hu(e.owner,t.map(e=>e.agentId));return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 shrink-0`,title:`${e.name} · ${e.owner} · ${e.status}${e.note?` · ${e.note}`:``}`,children:[r?(0,B.jsx)(ld,{id:r,bare:!0,size:n}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[11px] text-umber`,children:[(0,B.jsx)(Lu,{id:e.owner,size:14,state:`dead`}),e.owner]}),(0,B.jsx)(G,{tone:e.done?`ok`:/block/i.test(e.status)?`bad`:/queued|hold|wait/i.test(e.status)?`warn`:`neutral`,children:e.status.replace(/^[^\w]+/,``).slice(0,16)})]})}function qu({project:e,phase:t,highlight:n,maxH:r=`46vh`,compact:i=!1}){let{data:a,error:o}=q(`/projects/${e}/phases/${t.id}/tasks`,15e3),s=q(`/projects/${e}/board`,15e3).data,c=q(`/bus/agents`,2e4).data??[],l=zu(s),[u,d]=(0,P.useState)({}),f=q(`/admin/bus-writes`,1e4).data?.enabled??!1,[p,m]=(0,P.useState)({}),h=async(n,r)=>{m(e=>({...e,[n]:{to:r??`aide`,ts:Date.now()}}));try{let i=await Ia(`/actions/task/${e}/${t.id}/${n}`,{owner:r??void 0});if(i.status!==`ok`)throw Error(i.error??i.log?.slice(-1)[0]??`failed`);m(e=>({...e,[n]:{to:i.owner??r??`aide`,ts:Date.now()}}))}catch(e){m(t=>({...t,[n]:{err:e.message}}))}};return o?(0,B.jsx)(`div`,{className:`px-3 py-2 text-[13px] text-brick`,children:o}):a?a.sections.length===0?(0,B.jsxs)(`div`,{className:`px-3 py-3 text-[13px] text-umber`,children:[`No tasks yet — run `,(0,B.jsx)(`code`,{children:`/plan-phase`}),` (roadmap → Plan).`]}):(0,B.jsx)(`div`,{className:`grid gap-0 overflow-auto overscroll-contain min-w-0`,style:{maxHeight:r},children:a.sections.map(e=>{let r=e.tasks.filter(e=>e.done).length,o=r===e.tasks.length,s=Vu(l,t.n,Bu(e.title)),m=!!n&&!!s&&Hu(s.owner,c.map(e=>e.agentId))===n,g=u[e.line]===void 0?o:!u[e.line];return(0,B.jsxs)(`div`,{className:`border-b border-sand last:border-b-0 min-w-0 ${m?`bg-ember/[.04]`:``}`,children:[(0,B.jsxs)(`div`,{className:`sticky top-0 z-[1] px-3 py-1.5 min-w-0 ${m?`bg-ember-wash`:`bg-cream`} ${i?`grid gap-0.5`:`flex items-center gap-2`}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>d(t=>({...t,[e.line]:g})),className:`border-0 bg-transparent p-0 cursor-pointer font-mono text-[11px] text-tan w-3 shrink-0 hover:text-umber`,title:g?`expand`:`collapse`,"aria-expanded":!g,children:g?`▸`:`▾`}),m&&(0,B.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-ember shrink-0`,title:`this agent's task`}),(0,B.jsx)(V,{to:`/docs/${encodeURIComponent(a.file)}?view=source&line=${e.line}`,className:`font-semibold text-[12px] hover:no-underline hover:text-ember-deep truncate ${o?`text-tan`:`text-umber`}`,children:e.title}),(0,B.jsxs)(`span`,{className:`font-mono text-[11px] shrink-0 ${o?`text-leaf`:`text-tan`}`,children:[r,`/`,e.tasks.length,o?` ✓`:``]}),!i&&(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[(0,B.jsx)(Ku,{stream:s,agents:c}),(0,B.jsx)(`span`,{className:`h-1 w-24 rounded-full bg-linen overflow-hidden`,children:(0,B.jsx)(`span`,{className:`block h-full ${o?`bg-leaf`:`bg-ember`}`,style:{width:`${e.tasks.length?r/e.tasks.length*100:0}%`}})})]})]}),i&&s&&(0,B.jsx)(`div`,{className:`flex items-center gap-2 min-w-0 pl-5`,children:(0,B.jsx)(Ku,{stream:s,agents:c})})]}),!g&&e.tasks.map(e=>(0,B.jsxs)(`div`,{className:`group grid grid-cols-[var(--spacing-gutter)_minmax(0,1fr)_auto] items-start hover:bg-linen/60 border-t border-sand/60 min-w-0`,style:{paddingLeft:e.depth*12},children:[(0,B.jsx)(`span`,{className:`self-stretch flex items-start justify-center pt-1.5 font-mono text-[11px] border-r border-sand ${e.done?`text-leaf`:p[e.line]&&!(`err`in p[e.line])?`text-amber`:`text-tan`}`,title:p[e.line]&&!(`err`in p[e.line])?`asked ${p[e.line].to} to tick it`:void 0,children:e.done?`- [x]`:p[e.line]&&!(`err`in p[e.line])?`- [~]`:`- [ ]`}),(0,B.jsxs)(V,{to:`/docs/${encodeURIComponent(a.file)}?view=source&line=${e.line}`,className:`px-3 py-1.5 min-w-0 break-words hover:no-underline text-inherit ${i?`text-[12px] leading-snug`:`text-[13px]`} ${e.done?`text-tan line-through decoration-dust`:``}`,children:[(0,B.jsx)(Gu,{text:e.text}),p[e.line]&&`err`in p[e.line]&&(0,B.jsx)(`span`,{className:`ml-2 font-mono text-[10px] text-brick`,children:p[e.line].err})]}),(0,B.jsx)(`span`,{className:`pr-2 pt-1 shrink-0`,children:!e.done&&(p[e.line]&&!(`err`in p[e.line])?(0,B.jsxs)(`span`,{className:`font-mono text-[10px] text-amber whitespace-nowrap`,title:`the owner was asked to run /check-task; the tick appears when it does`,children:[`asked · `,p[e.line].to.split(`-`).slice(-1)[0]]}):(0,B.jsx)(`button`,{type:`button`,disabled:!f,onClick:()=>h(e.line,s?Hu(s.owner,c.map(e=>e.agentId)):null),className:`opacity-0 group-hover:opacity-100 focus:opacity-100 font-mono text-[10px] px-1.5 py-0.5 rounded border ${f?`border-dust text-umber bg-paper hover:text-leaf hover:border-leaf cursor-pointer`:`border-dashed border-dust text-tan cursor-not-allowed`}`,title:f?`ask ${s?s.owner:`the aide`} to run /check-task for this line`:`bus writes are off (header) — mark done DMs the owner`,children:`✓ done`}))})]},e.line))]},e.line)})}):(0,B.jsx)(`div`,{className:`px-3 py-2 font-mono text-[12px] text-tan`,children:`…`})}function Ju({project:e,phase:t,onClose:n}){let{data:r}=q(`/projects/${e}/phases/${t.id}/tasks`,15e3),i=r?.total?Math.round(r.done/r.total*100):0;return(0,B.jsxs)(`div`,{className:`mt-3 border border-sand rounded-kit bg-paper`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-sand`,children:[(0,B.jsx)(`b`,{className:`text-[13px]`,children:t.title}),(0,B.jsx)(G,{tone:r?.total&&r.done===r.total?`ok`:`neutral`,children:r?`${r.done}/${r.total} · ${i}%`:`…`}),(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-ink3`,children:r?.file??`no tasks file`}),(0,B.jsxs)(`span`,{className:`ml-auto flex gap-1.5`,children:[r?.file&&(0,B.jsx)(V,{to:`/docs/${encodeURIComponent(r.file)}`,className:`hover:no-underline`,children:(0,B.jsx)(K,{size:`sm`,tone:`ghost`,children:`Open doc`})}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:n,children:`✕`})]})]}),(0,B.jsx)(qu,{project:e,phase:t})]})}var Yu=`/api`,Xu=/\[image: (\S+) · (\S+)\]/g,Zu=e=>`${Yu}/uploads/${encodeURIComponent(e.split(`/`).pop()??``)}`;function Qu(e){let t=e?.persistKey,[n,r]=(0,P.useState)(()=>{if(!t)return[];try{return JSON.parse(localStorage.getItem(t)??`[]`)}catch{return[]}}),i=(0,P.useCallback)(e=>r(n=>{let r=e(n);if(t)try{r.length?localStorage.setItem(t,JSON.stringify(r)):localStorage.removeItem(t)}catch{}return r}),[t]);(0,P.useEffect)(()=>{if(t)try{r(JSON.parse(localStorage.getItem(t)??`[]`))}catch{r([])}},[t]);let[a,o]=(0,P.useState)(0),[s,c]=(0,P.useState)(null),l=(0,P.useCallback)(async e=>{let t=e.filter(e=>e.type.startsWith(`image/`));if(t.length){o(e=>e+t.length),c(null);for(let e of t)try{let t=new FormData;t.append(`file`,e,e.name||`paste.png`);let n=await fetch(`${Yu}/uploads`,{method:`POST`,body:t}),r=await n.json();if(!n.ok)throw Error(r.error??`${n.status}`);i(e=>e.some(e=>e.name===r.name)?e:[...e,r])}catch(e){c(e.message)}finally{o(e=>e-1)}}},[]),u=(0,P.useCallback)(e=>{let t=Array.from(e.clipboardData?.files??[]);t.length&&(e.preventDefault(),l(t))},[l]),d=(0,P.useCallback)(e=>{let t=Array.from(e.dataTransfer?.files??[]);t.length&&(e.preventDefault(),l(t))},[l]),f=(0,P.useCallback)(e=>{e.dataTransfer?.types.includes(`Files`)&&e.preventDefault()},[]);return{items:n,busy:a>0,err:s,onPaste:u,onDrop:d,onDragOver:f,remove:e=>i(t=>t.filter(t=>t.name!==e)),clear:()=>i(()=>[]),withRefs:e=>n.length?`${e.trim()}${e.trim()?`
|
|
25
25
|
`:``}${n.map(e=>e.ref).join(`
|
|
26
26
|
`)}`:e,hasContent:e=>!!e.trim()||n.length>0}}function $u({a:e}){return!e.items.length&&!e.busy&&!e.err?null:(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[e.items.map(t=>(0,B.jsxs)(`span`,{className:`relative inline-flex items-center gap-1 border border-sand rounded-kit bg-cream/60 p-0.5`,title:`${t.path}\n${t.url}`,children:[(0,B.jsx)(`img`,{src:Zu(t.name),alt:t.name,className:`h-10 w-auto max-w-[120px] rounded object-cover`}),(0,B.jsxs)(`span`,{className:`font-mono text-[10px] text-ink3 pr-1`,children:[Math.round(t.bytes/1024),` KB`]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>e.remove(t.name),className:`absolute -top-1.5 -right-1.5 w-4 h-4 rounded-full bg-walnut text-paper text-[10px] leading-none border-0 cursor-pointer`,title:`remove`,children:`×`})]},t.name)),e.busy&&(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-ink3`,children:`uploading…`}),e.err&&(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-brick`,children:e.err})]})}var ed=/(^|\n)\s*(#{1,6}\s|[-*+]\s|\d+[.)]\s|\|.*\||```|~~~|>\s|(-{3,}|\*{3,})\s*$)/;function td({text:e}){return ed.test(e)?(0,B.jsx)(`div`,{className:`md md-bubble whitespace-normal min-w-0`,dangerouslySetInnerHTML:{__html:yu(e)}}):(0,B.jsx)(Wu,{text:e})}function nd({text:e}){let t=[],n=0,r,i=0;for(Xu.lastIndex=0;r=Xu.exec(e);){r.index>n&&t.push((0,B.jsx)(td,{text:e.slice(n,r.index)},`t${i++}`));let[,a,o]=r;t.push((0,B.jsx)(`a`,{href:Zu(o),target:`_blank`,rel:`noreferrer`,className:`inline-block align-top my-1 mr-1 border border-sand rounded-kit p-0.5 bg-cream/60 hover:no-underline`,title:a,children:(0,B.jsx)(`img`,{src:Zu(o),alt:a.split(`/`).pop(),className:`max-h-40 max-w-[280px] rounded object-contain`,loading:`lazy`})},i++)),n=r.index+r[0].length}return n<e.length&&t.push((0,B.jsx)(td,{text:e.slice(n)},`t${i++}`)),(0,B.jsx)(B.Fragment,{children:t})}var rd=`/api`;function id({agentId:e,onClose:t}){let{linkify:n}=ju(),[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(null),[s,c]=(0,P.useState)(200),[l,u]=(0,P.useState)(!0),[d,f]=(0,P.useState)(!0),[p,m]=(0,P.useState)(()=>localStorage.getItem(`groundwork-console.pane.tasks`)!==`0`),h=e=>{m(e),localStorage.setItem(`groundwork-console.pane.tasks`,e?`1`:`0`)},{current:g,projects:_}=Ha(),v=q(`/admin/bus-writes`,1e4).data?.enabled??!1,y=(q(`/bus/agents`,3e4).data??[]).find(t=>t.agentId===e),b=y?.project&&_.some(e=>e.name===y.project||e.room===y.project)?_.find(e=>e.name===y.project||e.room===y.project).name:g,[x,S]=(0,P.useState)(``),[C,w]=(0,P.useState)(null),T=Qu(),E=async()=>{if(T.hasContent(x)){w(`sending`);try{let t=await Ia(`/actions/send`,{as:`david`,to:e,text:T.withRefs(x)});w(t.status===`ok`?`sent — lands in the pane via tmux-push`:t.error??t.log?.slice(-1)[0]??`failed`),t.status===`ok`&&(S(``),T.clear())}catch(e){w(e.message)}}},D=(0,P.useRef)(null);return(0,P.useEffect)(()=>{let t=!0,n=async()=>{try{let n=await fetch(`${rd}/bus/agents/${encodeURIComponent(e)}/pane?lines=${s}${d?`&colors=1`:``}`),r=await n.json();if(!t)return;if(!n.ok){o(r.error??`${n.status}`);return}o(null),i(r)}catch(e){t&&o(e.message)}};n();let r=setInterval(n,3e3);return()=>{t=!1,clearInterval(r)}},[e,s,d]),(0,P.useEffect)(()=>{l&&D.current&&(D.current.scrollTop=D.current.scrollHeight)},[r,l]),(0,P.useEffect)(()=>{let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[]),(0,P.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,B.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-walnut/30 flex justify-end`,onMouseDown:e=>{e.target===e.currentTarget&&t()},children:(0,B.jsxs)(`div`,{className:`${p?`w-[min(1340px,calc(100vw-16px))]`:`w-[min(920px,92vw)]`} h-full max-h-screen bg-paper border-l border-sand shadow-panel grid grid-rows-[auto_minmax(0,1fr)] whitespace-normal text-left transition-[width] duration-200`,style:{borderTop:`4px solid ${dd(y?.role)}`},children:[(0,B.jsxs)(`div`,{className:`px-4 py-2.5 border-b border-sand flex items-center gap-2`,children:[(0,B.jsx)(Lu,{id:e,role:y?.role,size:22,state:y?.reachability,active:y?.active}),(0,B.jsx)(`span`,{className:`font-display font-bold text-[16px] text-umber`,children:e}),y?.role&&(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.06em]`,style:{color:dd(y.role)},children:y.role}),r&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`font-mono text-[12px] text-ink3`,children:[r.pane,` · `,r.command]}),r.active?(0,B.jsx)(G,{tone:`ok`,children:`active`}):(0,B.jsx)(G,{tone:`outline`,children:`quiet`}),(0,B.jsxs)(`span`,{className:`font-mono text-[11px] text-tan`,children:[r.lines,` lines · `,new Date(r.capturedAt).toLocaleTimeString()]})]}),(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,B.jsx)(`span`,{className:`inline-flex border border-dust rounded-kit overflow-hidden`,children:[[`colors`,d,()=>f(e=>!e)],[`tasks`,p,()=>h(!p)],[`follow`,l,()=>u(e=>!e)]].map(([e,t,n])=>(0,B.jsx)(`button`,{type:`button`,onClick:n,"aria-pressed":t,className:`px-2 py-[3px] text-[11px] font-mono border-0 cursor-pointer ${t?`bg-walnut text-paper`:`bg-paper text-umber`}`,children:e},e))}),(0,B.jsx)(`select`,{value:s,onChange:e=>c(Number(e.target.value)),className:`font-mono text-[11px] px-1.5 py-1 border border-dust rounded bg-paper text-umber`,children:[100,200,500,1e3,2e3].map(e=>(0,B.jsxs)(`option`,{value:e,children:[e,` lines`]},e))}),(0,B.jsx)(K,{size:`sm`,onClick:t,children:`Close (Esc)`})]})]}),(0,B.jsxs)(`div`,{className:`min-h-0 grid ${p?`grid-cols-[minmax(0,1fr)_minmax(300px,380px)]`:`grid-cols-1`}`,children:[(0,B.jsxs)(`div`,{className:`min-h-0 grid grid-rows-[minmax(0,1fr)_auto]`,children:[(0,B.jsx)(`pre`,{ref:D,onScroll:()=>{let e=D.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<24;t!==l&&u(t)},className:`m-0 px-4 py-3 min-h-0 overflow-auto overscroll-contain font-mono text-[12px] leading-[1.45] whitespace-pre-wrap break-words pane-dark`,children:a?(0,B.jsx)(`span`,{className:`text-brick`,children:a}):r?n(d&&r.ansi?mo(r.ansi):r.text):`capturing…`}),(0,B.jsxs)(`div`,{className:`px-4 py-2 border-t border-sand grid gap-1.5`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] gap-2 items-center`,children:[(0,B.jsx)(`input`,{value:x,onChange:e=>S(e.target.value),onKeyDown:e=>{e.key===`Enter`&&v&&E()},onPaste:T.onPaste,onDrop:T.onDrop,onDragOver:T.onDragOver,disabled:!v,placeholder:v?`DM ${e} as david — paste or drop an image, delivered by its tmux-push into this pane`:`DM needs bus writes on (header badge)`,className:`text-[13px] px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut`}),(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:E,disabled:!v||!T.hasContent(x)||T.busy||C===`sending`,children:`Send DM`})]}),(0,B.jsx)($u,{a:T}),(0,B.jsxs)(`div`,{className:`font-mono text-[11px] text-tan`,children:[`read-only `,(0,B.jsx)(`code`,{children:`tmux capture-pane`}),` · 3 s refresh · the console never types into panes — the DM goes through the bus (a Run) and the agent's own pusher types it`,C&&C!==`sending`?(0,B.jsxs)(`span`,{className:/^sent/.test(C)?` text-leaf`:` text-brick`,children:[` · `,C]}):null]})]})]}),p&&(0,B.jsx)(ad,{project:b,agentId:e})]})]})})}function ad({project:e,agentId:t}){let n=q(e?`/projects/${e}/board`:null,15e3).data,r=q(`/bus/agents`,2e4).data??[],i=n?.phases.find(e=>e.state===`ongoing`)??n?.phases.find(e=>e.state===`planned`),a=zu(n).filter(e=>!e.done&&Hu(e.owner,r.map(e=>e.agentId))===t);return(0,B.jsxs)(`aside`,{className:`min-h-0 min-w-0 overflow-hidden overscroll-contain border-l border-sand bg-cream/40 grid grid-rows-[auto_auto_minmax(0,1fr)]`,children:[(0,B.jsxs)(`div`,{className:`px-3 py-2 border-b border-sand flex items-center gap-2 flex-wrap`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.1em] text-tan`,children:`now`}),i?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{to:`/board`,className:`font-semibold text-[13px] text-walnut hover:text-ember-deep hover:no-underline`,children:i.title}),(0,B.jsx)(G,{tone:i.state===`ongoing`?`david`:`neutral`,children:i.state}),(0,B.jsxs)(`span`,{className:`font-mono text-[11px] text-ink3`,children:[i.done,`/`,i.total]})]}):(0,B.jsx)(`span`,{className:`text-[13px] text-umber`,children:e?`no phase in flight`:`no project selected`})]}),(0,B.jsxs)(`div`,{className:`px-3 py-2 border-b border-sand grid gap-1`,children:[(0,B.jsxs)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.1em] text-tan`,children:[t,` is on`]}),a.length===0&&(0,B.jsx)(`span`,{className:`text-[12px] text-umber`,children:`no active stream owned by this agent`}),a.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px]`,children:[(0,B.jsx)(`span`,{className:`font-mono text-umber truncate`,title:e.note,children:e.name}),(0,B.jsx)(`span`,{className:`ml-auto`,children:(0,B.jsx)(Ku,{stream:e,agents:r})})]},e.name))]}),i&&e?(0,B.jsx)(qu,{project:e,phase:i,highlight:t,maxH:`100%`,compact:!0}):(0,B.jsx)(`div`,{className:`px-3 py-3 text-[12px] text-umber`,children:`Pick a project (header) to see its phase tasks.`})]})}var od=`/api`,sd=e=>{if(!e)return`—`;let t=Math.floor((Date.now()-e)/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:`${Math.floor(t/3600)}h`};function cd({agentId:e,lines:t=4,className:n=``,label:r}){let[i,a]=(0,P.useState)(null),[o,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(!1);(0,P.useEffect)(()=>{let n=!0,r=async()=>{try{let r=await fetch(`${od}/bus/agents/${encodeURIComponent(e)}/pane?lines=${t+6}&colors=1`),i=await r.json();if(!n)return;if(!r.ok){s(i.error??String(r.status));return}s(null),a(i)}catch(e){n&&s(e.message)}};r();let i=setInterval(r,3e3);return()=>{n=!1,clearInterval(i)}},[e,t]);let u=e=>e.split(`
|
|
27
27
|
`).filter(e=>e.trim().length>0).slice(-t).join(`
|
|
28
|
-
`);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{onClick:()=>l(!0),className:`w-full text-left rounded-[4px] overflow-hidden border border-sand bg-transparent p-0 cursor-pointer group ${n}`,title:`${e} · pane ${i?.pane??``} · click for the full view`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-[3px] bg-linen border-b border-sand`,children:[(0,B.jsx)(`span`,{className:`relative inline-block w-1.5 h-1.5 rounded-full ${i?.active?`bg-moss`:`bg-dust`}`,children:i?.active&&(0,B.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-moss animate-ping opacity-60`})}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] text-ink3 truncate`,children:r??e}),(0,B.jsx)(`span`,{className:`ml-auto font-mono text-[10px] text-tan`,children:i?i.active?`active`:`quiet ${sd(i.paneActivity)}`:`…`})]}),(0,B.jsx)(`pre`,{className:`m-0 px-2 py-1 pane-dark font-mono text-[10.5px] leading-[1.35] whitespace-pre-wrap break-words max-h-[calc(1.35em*4+8px)] overflow-hidden group-hover:opacity-90`,style:{maxHeight:`calc(1.35em * ${t} + 8px)`},children:o?(0,B.jsx)(`span`,{className:`text-brick`,children:o}):i?i.ansi?mo(u(i.ansi)):u(i.text):`capturing…`})]}),c&&(0,B.jsx)(id,{agentId:e,onClose:()=>l(!1)})]})}function ld({id:e,prefix:t,size:n=`sm`,className:r=``,bare:i=!1,noDot:a=!1}){let o=(q(`/bus/agents`,2e4).data??[]).find(t=>t.agentId===e),[s,c]=(0,P.useState)(!1),[l,u]=(0,P.useState)(!1),d=(0,P.useRef)(null),f=()=>{d.current&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>c(!0),250)},p=()=>{d.current&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>c(!1),200)};(0,P.useEffect)(()=>()=>{d.current&&window.clearTimeout(d.current)},[]);let m=!!o?.pane;return(0,B.jsxs)(`span`,{className:`relative inline-flex ${r}`,onMouseEnter:f,onMouseLeave:p,children:[(0,B.jsxs)(`button`,{onClick:()=>m&&u(!0),className:i?`inline-flex items-center gap-1.5 font-mono font-semibold ${n===`sm`?`text-[12px]`:`text-[13px]`} border-0 bg-transparent p-0 text-walnut ${m?`cursor-pointer hover:text-ember-deep`:`cursor-default`}`:`inline-flex items-center gap-1.5 rounded-full border font-mono ${n===`sm`?`text-[11px] px-2 py-0.5`:`text-[12px] px-2.5 py-1`} ${m?`cursor-pointer border-dust bg-paper hover:border-ember`:`cursor-default border-sand bg-linen/60`} text-walnut`,title:m?`${e} · pane ${o.pane} · click to pop out`:`${e}${o?` · ${o.reachability}`:` · not on the bus`}`,children:[t&&(0,B.jsx)(`span`,{className:`text-tan`,children:t}),!a&&(0,B.jsx)(Lu,{id:e,role:o?.role,size:n===`sm`?14:18,state:o?.reachability??`dead`,active:o?.active}),(0,B.jsx)(`span`,{className:`truncate max-w-[220px]`,children:e}),o&&!o.transport&&o.reachability!==`dead`&&(0,B.jsx)(`span`,{className:`text-amber`,title:`not attached — DMs won't reach its pane`,children:`⚠`})]}),s&&m&&(0,B.jsx)(`span`,{className:`absolute left-0 top-[calc(100%+6px)] z-50 w-[420px] whitespace-normal text-left`,onMouseEnter:f,onMouseLeave:p,children:(0,B.jsx)(cd,{agentId:e,lines:6,label:`${e} · ${o.role??``}`,className:`shadow-panel bg-paper`})}),l&&(0,B.jsx)(id,{agentId:e,onClose:()=>u(!1)})]})}var ud=[{re:/coordinator/i,label:`coordinator`,dot:`#4A6A2C`,ring:`#B9CFA0`},{re:/aide|liaison|curator/i,label:`aide`,dot:`#C4587A`,ring:`#F0C2D2`},{re:/\bqa\b|quality/i,label:`qa`,dot:`#C88A1E`,ring:`#F0DFA6`},{re:/\bci\b/i,label:`ci`,dot:`#E8702A`,ring:`#F6C9A6`},{re:/audit/i,label:`audit`,dot:`#7A4A6A`,ring:`#DDBFD3`},{re:/automation/i,label:`automation`,dot:`#8A7660`,ring:`#D9CDBB`},{re:/human|david/i,label:`human`,dot:`#B7521A`,ring:`#F6C9A6`}],dd=e=>ud.find(t=>t.re.test(e??``))?.dot??`#5C7A96`,fd=e=>ud.find(t=>t.re.test(e??``))?.label??`worker`;function pd(e,t,n){return e.project===t||!!n&&e.project===n}function md(e){return e.agentId===`groundwork-console`||e.agentId===`david`}function hd(){let{projects:e,current:t}=Ha(),n=q(`/bus/agents`,15e3).data??[],r=e.find(e=>e.name===t)?.room,i=n.filter(e=>!md(e)&&e.reachability!==`dead`&&pd(e,t,r)),a=n.filter(e=>!md(e)&&e.reachability!==`dead`&&!i.includes(e)),o=e=>[`aide`,`coordinator`,`qa`,`ci`,`worker`,`audit`].indexOf(fd(e.role))+1||9,s=[...i].sort((e,t)=>o(e)-o(t)||e.agentId.localeCompare(t.agentId)),[c,l]=(0,P.useState)(!1);return(0,B.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-1.5 border-b border-sand bg-paper/70 min-h-[34px] whitespace-nowrap overflow-x-auto [scrollbar-width:none]`,children:[(0,B.jsxs)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.1em] text-tan shrink-0`,children:[`online · `,t||`—`]}),s.length===0&&(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-tan`,children:`no agents for this project`}),s.map(e=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-sand bg-paper`,style:{borderColor:dd(e.role)+`66`},title:`${e.agentId} · ${fd(e.role)}${e.pane?` · ${e.pane}`:``}`,children:[(0,B.jsx)(Lu,{id:e.agentId,role:e.role,size:16,state:e.reachability,active:e.active}),(0,B.jsx)(ld,{id:e.agentId,bare:!0,noDot:!0,size:`sm`}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.06em]`,style:{color:dd(e.role)},children:fd(e.role)})]},e.agentId)),c&&a.map(e=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-dashed border-sand bg-cream/60`,title:`${e.agentId} · ${fd(e.role)} · ${e.project??`?`}`,children:[(0,B.jsx)(Lu,{id:e.agentId,role:e.role,size:16,state:e.reachability,active:e.active}),(0,B.jsx)(ld,{id:e.agentId,bare:!0,noDot:!0,size:`sm`}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] text-tan`,children:e.project})]},e.agentId)),a.length>0&&(0,B.jsx)(`button`,{onClick:()=>l(e=>!e),"aria-pressed":c,className:`ml-auto font-mono text-[11px] text-ink3 shrink-0 border-0 bg-transparent cursor-pointer hover:text-umber`,title:c?`show only this project`:a.map(e=>e.agentId).join(`, `),children:c?`only this project`:`+${a.length} elsewhere`}),(0,B.jsx)(`span`,{className:`ml-3 font-mono text-[10px] text-tan shrink-0 hidden xl:inline-flex items-center gap-2`,children:[[`coordinator`,`#4A6A2C`],[`aide`,`#C4587A`],[`qa`,`#C88A1E`],[`ci`,`#E8702A`],[`worker`,`#5C7A96`]].map(([e,t])=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full`,style:{background:t}}),e]},e))})]})}function gd(e){let[t,n]=(0,P.useState)(!1),r=(0,P.useRef)(e);return(0,P.useEffect)(()=>{let e=()=>{let e=document.getSelection();n(!!e&&!e.isCollapsed)};return document.addEventListener(`selectionchange`,e),()=>document.removeEventListener(`selectionchange`,e)},[]),t||(r.current=e),r.current}var _d={clear:`reset the agent's context — typed raw into its CLI via send_command`,compact:`compact the agent's context — typed raw into its CLI via send_command`,"reload-skills":`reload the agent's skills after a playbook update — typed raw into its CLI via send_command`},vd=e=>e.map(e=>e.replace(/^\//,``)).map(e=>({name:e,description:_d[e]??`typed raw into the agent's CLI via send_command`,source:`built-in`}));function $(e,t){let n=e.slice(0,t),r=n.match(/(^|\s)\/([\w-]*)$/);return r?{start:n.length-r[2].length-1,query:r[2]}:null}function yd(e){let t=q(e?`/projects/${e}/skills`:null,6e4).data,n=za();return(0,P.useMemo)(()=>[...vd(n),...(t?.groundwork.skills??[]).map(e=>({name:e.name,description:e.description,source:`groundwork`})),...(t?.playbook.cards??[]).map(e=>({name:e.name,description:e.description,source:`playbook`}))],[t,n])}function bd({skills:e,query:t,onPick:n,onClose:r,bind:i}){let a=(0,P.useMemo)(()=>{let n=t.toLowerCase(),r=e.filter(e=>e.name.toLowerCase().includes(n));return(r.length?r:e.filter(e=>e.description.toLowerCase().includes(n))).sort((e,t)=>Number(t.name.toLowerCase().startsWith(n))-Number(e.name.toLowerCase().startsWith(n))||e.name.localeCompare(t.name)).slice(0,12)},[e,t]),[o,s]=(0,P.useState)(0),c=(0,P.useRef)(null);return(0,P.useEffect)(()=>{s(0)},[t]),(0,P.useEffect)(()=>(i(e=>e.key===`ArrowDown`?(s(e=>Math.min(e+1,a.length-1)),!0):e.key===`ArrowUp`?(s(e=>Math.max(e-1,0)),!0):(e.key===`Enter`||e.key===`Tab`)&&a[o]?(n(a[o].name),!0):e.key===`Escape`&&(r(),!0)),()=>i(null)),[i,a,o,n,r]),(0,P.useEffect)(()=>{c.current?.querySelector(`[data-i="${o}"]`)?.scrollIntoView({block:`nearest`})},[o]),a.length===0?(0,B.jsxs)(`div`,{className:`absolute left-0 right-0 bottom-full mb-1 bg-paper border border-sand rounded-kit shadow-panel px-2 py-1.5 font-mono text-[11px] text-tan`,children:[`no skill matches “/`,t,`” — Enter sends the text as typed`]}):(0,B.jsxs)(`div`,{ref:c,role:`listbox`,"aria-label":`slash commands`,className:`absolute left-0 right-0 bottom-full mb-1 max-h-[240px] overflow-auto overscroll-contain bg-paper border border-sand rounded-kit shadow-panel grid`,children:[a.map((e,t)=>(0,B.jsxs)(`button`,{"data-i":t,type:`button`,role:`option`,"aria-selected":t===o,onMouseDown:t=>{t.preventDefault(),n(e.name)},onMouseEnter:()=>s(t),className:`grid grid-cols-[auto_1fr_auto] gap-2 items-baseline px-2 py-1 text-left border-0 cursor-pointer ${t===o?`bg-linen`:`bg-transparent`}`,children:[(0,B.jsxs)(`span`,{className:`font-mono text-[12px] font-semibold text-walnut`,children:[`/`,e.name]}),(0,B.jsx)(`span`,{className:`text-[12px] text-umber truncate`,title:e.description,children:e.description}),(0,B.jsx)(G,{tone:e.source===`built-in`?`warn`:e.source===`playbook`?`neutral`:`outline`,children:e.source===`built-in`?`built-in · raw`:e.source})]},`${e.source}:${e.name}`)),(0,B.jsx)(`div`,{className:`px-2 py-1 font-mono text-[10px] text-tan border-t border-sand`,children:`↑↓ move · Enter/Tab insert · Esc close · sent as a text DM; the agent runs the skill`})]})}var xd=(e,t)=>window.dispatchEvent(new CustomEvent(`groundwork-console:summon`,{detail:{agentId:e,answers:t?.answers}})),Sd=e=>`groundwork-console.summon.${e}`,Cd=e=>`groundwork-console.summon.seen.${e}`;function wd(e){let t=rr(),n=t.pathname.match(/^\/docs\/(.+)$/),r=new URLSearchParams(t.search);if(n){let t=decodeURIComponent(n[1]),i=r.get(`line`);return t.startsWith(`kb:`)?{label:`knowledge/${t.slice(3)}${i?`:${i}`:``}`,cite:`groundwork-knowledge/${t.slice(3)}${i?`:${i}`:``}`}:{label:`${t}${i?`:${i}`:``}`,cite:`${e}/docs/${t}${i?`:${i}`:``}`}}let i=t.pathname===`/`?`home`:t.pathname.slice(1).split(`/`)[0];return{label:i,cite:`groundwork-console /${i}${e?` · ${e}`:``}`}}function Td(){let{current:e,projects:t}=Ha(),n=q(`/bus/agents`,2e4).data??[],r=q(e?`/projects/${e}/agents`:null,3e4).data,i=n.filter(e=>e.reachability!==`dead`&&!md(e)),a=t.find(t=>t.name===e)?.room,o=e?i.filter(t=>pd(t,e,a)):i,[s,c]=(0,P.useState)(()=>e?localStorage.getItem(Sd(e)):null);(0,P.useEffect)(()=>{c(e?localStorage.getItem(Sd(e)):null)},[e]);let l=(s&&i.some(e=>e.agentId===s)?s:null)??r?.aide??r?.coordinator??o[0]?.agentId??null,u=n.find(e=>e.agentId===l),[d,f]=(0,P.useState)(!1),[p,m]=(0,P.useState)(!1),h=t=>{c(t),e&&localStorage.setItem(Sd(e),t),m(!1),f(!0)},g=gd(q(l?`/bus/dm/${encodeURIComponent(l)}?limit=80`:null,d?4e3:2e4).data),_=q(`/bus/inbox?limit=100`,2e4).data?.decisions??{},[v,y]=(0,P.useState)(0);(0,P.useEffect)(()=>{l&&y(Number(localStorage.getItem(Cd(l))??0))},[l]),(0,P.useEffect)(()=>{d&&l&&g&&(localStorage.setItem(Cd(l),String(g.lastFromAgent)),y(g.lastFromAgent))},[d,l,g]);let b=!!g&&g.lastFromAgent>v;(0,P.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(m(!1),f(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let[x,S]=(0,P.useState)([]);(0,P.useEffect)(()=>{let e=e=>{let t=e.detail;S(t?.answers??[]),t?.agentId?h(t.agentId):(f(!1),m(!0))};return window.addEventListener(`groundwork-console:summon`,e),()=>window.removeEventListener(`groundwork-console:summon`,e)});let[C,w]=(0,P.useState)(``);if((0,P.useEffect)(()=>{p||w(``)},[p]),!l)return null;let T=e=>Math.max(e.paneActivity??0,e.lastSeen??0,e.lastHeartbeat??0),E=[...o].sort((e,t)=>Number(/aide/i.test(t.role??``))-Number(/aide/i.test(e.role??``))||T(t)-T(e)),D=o.length>6||i.length>o.length,O=D?E.slice(0,6):E,k=C.trim()?i.filter(e=>`${e.agentId} ${e.role??``} ${e.project??``}`.toLowerCase().includes(C.trim().toLowerCase())):E.slice(6),A=O.length,j=e=>{let t=(A===1?.5:e/(A-1))*(Math.PI/2);return{x:-Math.sin(t)*96,y:-Math.cos(t)*96}};return(0,B.jsxs)(B.Fragment,{children:[d&&(0,B.jsx)(kd,{agentId:l,me:u,project:e,thread:g??void 0,answers:x,onAnswered:()=>S([]),onClose:()=>f(!1),onSwitch:()=>{m(!0)}}),(0,B.jsxs)(`div`,{className:`fixed right-5 bottom-5 z-[55]`,style:{width:52,height:52},children:[p&&(0,B.jsxs)(`div`,{className:`absolute inset-0`,"aria-label":`pick an agent`,children:[O.map((e,t)=>{let n=j(t);return(0,B.jsxs)(`button`,{onClick:()=>h(e.agentId),title:`${e.agentId} · ${fd(e.role)}`,className:`absolute rounded-full border-2 bg-paper shadow-panel cursor-pointer p-[3px] transition-transform hover:scale-110`,style:{left:26+n.x-17,top:26+n.y-17,borderColor:dd(e.role),width:34,height:34,animation:`summon-pop .18s ease-out ${t*30}ms both`},children:[(0,B.jsx)(Lu,{id:e.agentId,role:e.role,size:26,state:e.reachability,active:e.active}),_[e.agentId]?(0,B.jsx)(Ed,{n:_[e.agentId],small:!0}):null]},e.agentId)}),O.length===0&&(0,B.jsx)(`span`,{className:`absolute right-0 bottom-14 whitespace-nowrap font-mono text-[11px] text-tan bg-paper border border-sand rounded-kit px-2 py-1`,children:`no live agents`}),D&&(0,B.jsxs)(`div`,{className:`absolute right-0 bottom-[130px] w-[300px] bg-paper border border-sand rounded-kit shadow-panel p-2 grid gap-1`,onMouseDown:e=>e.stopPropagation(),children:[(0,B.jsx)(`input`,{autoFocus:!0,value:C,onChange:e=>w(e.target.value),onKeyDown:e=>{e.key===`Enter`&&k[0]&&h(k[0].agentId),e.key===`Escape`&&m(!1)},placeholder:e?`${o.length} live in ${e} — type to search all projects`:`${o.length} live — type to filter (id · role · project)`,className:`text-[12px] px-2 py-1.5 border border-dust rounded-kit bg-paper text-walnut font-mono`}),(0,B.jsxs)(`div`,{className:`max-h-[220px] overflow-auto overscroll-contain grid`,children:[k.slice(0,40).map((e,t)=>(0,B.jsxs)(`button`,{onClick:()=>h(e.agentId),className:`grid grid-cols-[auto_1fr_auto] items-center gap-2 px-1.5 py-1 rounded border-0 cursor-pointer text-left ${t===0&&C.trim()?`bg-linen`:`bg-transparent hover:bg-linen/60`}`,title:`${e.agentId} · ${fd(e.role)} · ${e.project??``}`,children:[(0,B.jsx)(Lu,{id:e.agentId,role:e.role,size:16,state:e.reachability,active:e.active}),(0,B.jsxs)(`span`,{className:`min-w-0 truncate font-mono text-[12px] text-walnut`,children:[e.agentId,(0,B.jsxs)(`span`,{className:`text-tan`,children:[` · `,fd(e.role),e.project?` · ${e.project}`:``]})]}),_[e.agentId]?(0,B.jsxs)(`span`,{className:`font-mono text-[10px] text-ember`,children:[`★`,_[e.agentId]]}):null]},e.agentId)),k.length===0&&(0,B.jsx)(`span`,{className:`px-1.5 py-1 font-mono text-[11px] text-tan`,children:C.trim()?`no match`:`${o.length===1?`the only ${e||`bus`} agent is`:`all ${o.length} ${e||`bus`} agents are`} on the ring — type to search other projects`})]}),(0,B.jsxs)(`span`,{className:`font-mono text-[10px] text-tan px-1`,children:[`ring = aide + `,5,` most recent · Enter picks the first match`]})]})]}),(0,B.jsxs)(`button`,{onClick:()=>p?m(!1):f(e=>!e),title:`${l} · ${fd(u?.role)} — click to chat`,className:`absolute inset-0 rounded-full border-2 bg-paper shadow-panel cursor-pointer p-1 hover:scale-105 transition-transform`,style:{borderColor:dd(u?.role)},children:[(0,B.jsx)(Lu,{id:l,role:u?.role,size:40,state:u?.reachability??`dead`,active:u?.active}),_[l]?(0,B.jsx)(Ed,{n:_[l]}):b&&(0,B.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 w-3 h-3 rounded-full bg-ember border-2 border-paper`,title:`new message`})]}),(0,B.jsx)(`button`,{onClick:()=>m(e=>!e),"aria-pressed":p,title:`pick another agent`,className:`absolute -left-2 -top-2 w-6 h-6 rounded-full border border-dust shadow-panel cursor-pointer text-[13px] leading-none flex items-center justify-center ${p?`bg-walnut text-paper`:`bg-paper text-umber`}`,children:p?`×`:`+`})]}),(0,B.jsx)(`style`,{children:`.summon-dots{display:inline-flex;gap:3px}.summon-dots i{width:5px;height:5px;border-radius:50%;background:currentColor;opacity:.25;animation:summon-dot 1.2s infinite}.summon-dots i:nth-child(2){animation-delay:.2s}.summon-dots i:nth-child(3){animation-delay:.4s}@keyframes summon-dot{0%,80%,100%{opacity:.25}40%{opacity:1}}@keyframes summon-pop{from{transform:scale(.4);opacity:0}to{transform:scale(1);opacity:1}}@keyframes summon-pulse{0%,100%{box-shadow:0 0 0 0 rgba(200,120,42,.55)}50%{box-shadow:0 0 0 6px rgba(200,120,42,0)}}`})]})}function Ed({n:e,small:t=!1}){return(0,B.jsx)(`span`,{className:`absolute -top-1 -right-1 rounded-full bg-ember text-paper border-2 border-paper font-mono font-bold flex items-center justify-center leading-none ${t?`w-4 h-4 text-[9px]`:`w-5 h-5 text-[10px]`}`,title:`${e} decision${e===1?``:`s`} waiting on you`,style:{animation:`summon-pulse 1.6s ease-in-out infinite`},children:`★`})}var Dd=e=>{let t=Math.round(e/1e3);return t<60?`${t} s`:t<3600?`${Math.floor(t/60)} min`:`${Math.floor(t/3600)} h`},Od=(0,P.memo)(function({m:e,mine:t,maxed:n}){let r=String(e.text??``),i=e.prefix?r.replace(RegExp(`^${e.prefix}:?\\s*`),``):r;return(0,B.jsxs)(`div`,{className:`${e.pending?`opacity-70`:``} ${n?`max-w-[70%]`:`max-w-[88%]`} rounded-kit px-2.5 py-1.5 text-[12.5px] leading-snug whitespace-pre-wrap break-words border ${t?`justify-self-end bg-paper border-sand`:`justify-self-start bg-linen/70 border-sand/70`}`,children:[e.prefix&&(0,B.jsx)(Oa,{prefix:e.prefix}),(0,B.jsx)(nd,{text:i}),(0,B.jsx)(`div`,{className:`font-mono text-[10px] mt-0.5 ${t?`text-right`:``} ${e.failed?`text-brick`:`text-tan`}`,children:e.failed?`not sent · ${e.failed}`:e.pending?`sending…`:e.ts?new Date(e.ts).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):``})]})},(e,t)=>e.m===t.m&&e.mine===t.mine&&e.maxed===t.maxed);function kd({agentId:e,me:t,project:n,thread:r,answers:i=[],onAnswered:a,onClose:o,onSwitch:s}){let c=q(`/admin/bus-writes`,1e4).data?.enabled??!1,l=wd(n),[u,d]=(0,P.useState)(!0),f=`groundwork-console.summon.draft.${e}`,[p,m]=(0,P.useState)(()=>localStorage.getItem(f)??``),[h,g]=(0,P.useState)(null),_=e=>{m(e);try{e?localStorage.setItem(f,e):localStorage.removeItem(f)}catch{}};(0,P.useEffect)(()=>{m(localStorage.getItem(`groundwork-console.summon.draft.${e}`)??``)},[e]);let[v,y]=(0,P.useState)(!1),[b,x]=(0,P.useState)(()=>localStorage.getItem(`groundwork-console.summon.max`)===`1`),S=()=>x(e=>(localStorage.setItem(`groundwork-console.summon.max`,e?`0`:`1`),!e)),C=Qu({persistKey:`groundwork-console.summon.att.${e}`}),w=yd(n),T=new Set(za()),E=(0,P.useRef)(null),[D,O]=(0,P.useState)(0),[k,A]=(0,P.useState)(!0),j=k?$(p,D):null,M=(0,P.useRef)(null),N=(0,P.useCallback)(e=>{M.current=e},[]),ee=(0,P.useRef)(null),F=(0,P.useCallback)(e=>{let t=$(p,D);if(!t)return;let n=`${p.slice(0,t.start)}/${e} ${p.slice(D)}`,r=t.start+e.length+2;_(n),O(r),ee.current=r},[p,D]);(0,P.useEffect)(()=>{if(ee.current!==null&&E.current){let e=ee.current;ee.current=null,E.current.focus(),E.current.setSelectionRange(e,e)}},[p]);let I=(0,P.useRef)(null),[te,ne]=(0,P.useState)([]),re=r?.messages??[],L=e=>ie.current.get(`${e.text??``}`)??null,ie=(0,P.useRef)(new Map),R=te.filter(e=>!re.some(t=>t.from===`david`&&Number(t.ts??0)>=Number(e.ts??0)-2e3&&(t.text??``)===(e.text??``))),z=[...re,...R],ae=new Set,oe=(e,t)=>{let n=e.pending?String(e.id):(e.from===`david`?L(e):null)??e.id??`${e.ts??`t`}-${t}`;return ae.has(n)&&(n=e.id??`${n}-${t}`),ae.add(n),n},[se,ce]=(0,P.useState)(0);(0,P.useEffect)(()=>{let e=setInterval(()=>ce(e=>e+1),1e3);return()=>clearInterval(e)},[]);let le=(q(`/bus/agents`,4e3).data??[]).find(t=>t.agentId===e)??t,ue=le?.paneActivity?Date.now()-le.paneActivity:1/0,de=ue<2e4,fe=([...z].reverse().find(e=>e.from===`david`)?.ts??0)>([...z].reverse().find(e=>e.from!==`david`)?.ts??0),[pe,me]=(0,P.useState)(!0),he=()=>{let e=I.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<32;t!==pe&&me(t)};(0,P.useEffect)(()=>{pe&&I.current&&(I.current.scrollTop=I.current.scrollHeight)},[z.length,pe]);let ge=async()=>{if(!C.hasContent(p))return;g(`sending`);let t=p.trim(),n=T.has(t),r=n?t:t.startsWith(`/`)?`AGENT_ACTION: run ${t}`:t,o=n?t:C.withRefs(r),s=n?t:u?`${o}\n(context: ${l.cite})`:o,c={id:`local-${Date.now()}`,ts:Date.now(),from:`david`,to:e,text:s,prefix:null,pending:!0};ie.current.set(String(c.text??``),String(c.id)),ie.current.size>50&&ie.current.delete(ie.current.keys().next().value),ne(e=>[...e,c]),_(``),C.clear();try{let n=await Ia(`/actions/send`,{as:`david`,to:e,text:s,answers:i.length?i:void 0});if(n.status===`ok`)g(n.raw?n.delivery===`confirmed`?`${t} typed into the pane (delivery confirmed)`:n.warning??`${t}: delivery ${n.delivery??`unknown`}`:n.warning??null),a?.();else{let e=n.error??n.log?.slice(-1)[0]??`failed`;g(e),ne(t=>t.map(t=>t.id===c.id?{...t,failed:e}:t))}}catch(e){let t=e.message;g(t),ne(e=>e.map(e=>e.id===c.id?{...e,failed:t}:e))}},_e=(0,P.useMemo)(()=>z,[z]);return(0,B.jsxs)(B.Fragment,{children:[v&&(0,B.jsx)(id,{agentId:e,onClose:()=>y(!1)}),(0,B.jsxs)(`div`,{className:`fixed z-[54] bg-paper border border-sand rounded-kit shadow-panel grid grid-rows-[auto_minmax(0,1fr)_auto] whitespace-normal text-left transition-[width,height] duration-150 ${b?`right-5 bottom-[84px] w-[min(1100px,calc(100vw-40px))] h-[calc(100vh-110px)]`:`right-5 bottom-[84px] w-[min(400px,calc(100vw-40px))] h-[min(560px,calc(100vh-140px))]`}`,style:{borderTop:`3px solid ${dd(t?.role)}`},children:[(0,B.jsxs)(`div`,{className:`px-3 py-2 border-b border-sand flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(Lu,{id:e,role:t?.role,size:22,state:t?.reachability??`dead`,active:t?.active}),(0,B.jsx)(`span`,{className:`font-display font-bold text-[14px] text-umber truncate`,children:e}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.06em]`,style:{color:dd(t?.role)},children:fd(t?.role)}),t?(0,B.jsx)(G,{tone:t.reachability===`live`?`ok`:t.reachability===`idle`||t.reachability===`dormant`?`warn`:`bad`,children:t.active?`active`:t.reachability}):(0,B.jsx)(G,{tone:`bad`,children:`offline`}),(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[t?.pane&&(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:()=>y(!0),title:`open its pane`,children:`pane`}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:s,title:`summon another agent`,children:`switch`}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:S,title:b?`restore`:`maximize`,children:b?`⇲`:`⇱`}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:o,children:`✕`})]})]}),(0,B.jsxs)(`div`,{ref:I,onScroll:he,className:`min-h-0 overflow-auto overscroll-contain px-3 py-2 grid gap-1.5 content-start bg-cream/40`,children:[!r&&(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`loading thread…`}),r&&_e.length===0&&(0,B.jsxs)(`span`,{className:`text-[12px] text-umber`,children:[`No DMs with `,e,` yet. Say what you need — it lands in its pane via tmux-push.`]}),_e.map((e,t)=>(0,B.jsx)(Od,{m:e,mine:e.from===`david`,maxed:b},oe(e,t))),(de||fe)&&(0,B.jsx)(`div`,{className:`justify-self-start inline-flex items-center gap-2 px-2.5 py-1.5 rounded-kit border border-sand/70 bg-linen/50 font-mono text-[11px] text-ink3`,title:le?.paneActivity?`last pane output ${Math.round(ue/1e3)} s ago`:`no pane activity`,children:de?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`summon-dots`,"aria-hidden":!0,children:[(0,B.jsx)(`i`,{}),(0,B.jsx)(`i`,{}),(0,B.jsx)(`i`,{})]}),(0,B.jsxs)(`span`,{children:[e.split(`-`)[0],` is working`]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-tan`}),(0,B.jsxs)(`span`,{children:[`delivered · quiet for `,ue===1/0?`a while`:Dd(ue)]})]})})]}),(0,B.jsxs)(`div`,{className:`px-3 py-2 border-t border-sand grid gap-1.5`,children:[(0,B.jsxs)(`label`,{className:`flex items-center gap-1.5 font-mono text-[11px] text-ink3 min-w-0`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked)}),(0,B.jsx)(`span`,{className:`shrink-0`,children:`context:`}),(0,B.jsx)(`span`,{className:`truncate text-umber`,title:l.cite,children:l.label})]}),(0,B.jsxs)(`div`,{className:`relative grid grid-cols-[1fr_auto] gap-1.5 items-center`,children:[(0,B.jsx)(`textarea`,{ref:E,value:p,onChange:e=>{_(e.target.value),O(e.target.selectionStart??e.target.value.length),A(!0)},onClick:e=>O(e.target.selectionStart??0),onKeyUp:e=>O(e.target.selectionStart??0),onKeyDown:e=>{if(j&&M.current&&M.current(e)){e.preventDefault();return}e.key===`Enter`&&!e.shiftKey&&c&&(e.preventDefault(),ge())},onPaste:C.onPaste,onDrop:C.onDrop,onDragOver:C.onDragOver,disabled:!c,rows:b?4:2,placeholder:c?`DM ${e} as david — Enter to send, ⇧Enter newline, paste images`:`bus writes are off (header badge)`,className:`text-[13px] px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut resize-none min-w-0`}),(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:ge,disabled:!c||!C.hasContent(p)||C.busy||h===`sending`,children:h===`sending`?`…`:`Send`}),j&&c&&(0,B.jsx)(bd,{skills:w,query:j.query,onPick:F,onClose:()=>A(!1),bind:N})]}),(0,B.jsx)($u,{a:C}),T.has(p.trim())?(0,B.jsxs)(`div`,{className:`font-mono text-[11px] text-ink3`,children:[(0,B.jsx)(`span`,{className:`text-umber`,children:p.trim()}),` is sent `,(0,B.jsx)(`b`,{children:`raw`}),` (no banner, no context) via the bus send_command — the agent's CLI runs it; delivery is confirmed by its pusher`]}):p.trim().startsWith(`/`)&&(0,B.jsxs)(`div`,{className:`font-mono text-[11px] text-ink3`,children:[`sends as `,(0,B.jsxs)(`span`,{className:`text-umber`,children:[`AGENT_ACTION: run `,p.trim().split(/\s/)[0],` …`]}),` — the bus pusher drops raw leading-slash DMs (only the MCP's allowlist — `,[...T].join(` `),` — goes raw); the agent runs the skill from the request`]}),h&&h!==`sending`&&(0,B.jsx)(`div`,{className:`font-mono text-[11px] ${/delivery confirmed/.test(h)?`text-leaf`:`text-brick`}`,children:h})]})]})]})}var Ad={h:`/`,b:`/board`,m:`/monitor`,u:`/bus`,d:`/docs`,g:`/git`,o:`/ops`},jd=e=>{let t=e;return!!t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable)};function Md(){let e=ar(),[t,n]=(0,P.useState)(!1);return(0,P.useEffect)(()=>{let t=0,r=r=>{if(!(r.metaKey||r.ctrlKey||r.altKey||jd(r.target))){if(r.key===`Escape`){n(!1);return}if(r.key===`?`){n(e=>!e);return}if(r.key===`/`){r.preventDefault(),xd(``);return}if(r.key===`g`&&!(Date.now()-t<900)){t=Date.now();return}Date.now()-t<900&&Ad[r.key]&&(r.preventDefault(),e(Ad[r.key]),t=0)}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e]),t?(0,B.jsx)(`div`,{className:`fixed inset-0 z-[70] bg-walnut/30 flex items-center justify-center`,onMouseDown:()=>n(!1),children:(0,B.jsxs)(`div`,{className:`bg-paper border border-sand rounded-kit shadow-panel p-4 grid gap-2 min-w-[320px]`,onMouseDown:e=>e.stopPropagation(),children:[(0,B.jsx)(`div`,{className:`font-display font-bold text-[15px] text-umber`,children:`Keyboard`}),[[`/`,`summon an agent (picker)`],[`g h`,`Home`],[`g b`,`Board`],[`g m`,`Monitor`],[`g u`,`Bus`],[`g d`,`Docs`],[`g g`,`Git`],[`g o`,`Ops`],[`Esc`,`close drawer / picker / this`],[`?`,`toggle this list`]].map(([e,t])=>(0,B.jsxs)(`div`,{className:`grid grid-cols-[64px_1fr] gap-3 items-baseline text-[13px]`,children:[(0,B.jsx)(`kbd`,{className:`font-mono text-[12px] px-1.5 py-0.5 border border-dust rounded bg-cream text-walnut justify-self-start`,children:e}),(0,B.jsx)(`span`,{className:`text-umber`,children:t})]},e)),(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-tan mt-1`,children:`In the Summon drawer: Enter sends · ⇧Enter newline · paste images.`})]})}):null}var Nd=`/api`;function Pd({children:e}){let[t,n]=(0,P.useState)(`checking`),[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(null),[s,c]=(0,P.useState)(!1),l=async()=>{try{let e=await(await fetch(`${Nd}/auth/status`)).json();n(e.authed?`in`:`out`)}catch{n(`offline`)}};(0,P.useEffect)(()=>{l()},[]),(0,P.useEffect)(()=>{t!==`in`&&fetch(`${Nd}/health`).then(e=>e.json()).then(e=>{document.title=e.hostname?`Sign in · ${e.hostname}`:`Sign in · Groundwork Console`}).catch(()=>{document.title=`Sign in · Groundwork Console`})},[t]),(0,P.useEffect)(()=>{let e=()=>n(`out`);return window.addEventListener(`groundwork-console:unauthorized`,e),()=>window.removeEventListener(`groundwork-console:unauthorized`,e)},[]);let u=async()=>{c(!0),o(null);try{let e=await fetch(`${Nd}/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:r})}),t=await e.json();if(!e.ok)throw Error(t.error??`${e.status}`);i(``),n(`in`)}catch(e){o(e.message)}finally{c(!1)}};return t===`in`?(0,B.jsx)(B.Fragment,{children:e}):t===`checking`?(0,B.jsx)(`div`,{className:`min-h-screen grid place-items-center font-mono text-[12px] text-tan`,children:`checking session…`}):(0,B.jsx)(`div`,{className:`min-h-screen grid place-items-center bg-cream p-6`,children:(0,B.jsxs)(`div`,{className:`w-[380px] bg-paper border border-sand rounded-kit shadow-panel`,children:[(0,B.jsxs)(`div`,{className:`px-5 py-4 border-b border-sand flex items-center gap-2 font-display font-bold text-[18px] text-ember`,children:[(0,B.jsx)(Pa,{}),` Groundwork Console`]}),(0,B.jsx)(`div`,{className:`p-5 grid gap-3 text-[13px]`,children:t===`offline`?(0,B.jsxs)(`div`,{className:`text-brick`,children:[`API unreachable — start it with `,(0,B.jsx)(`code`,{children:`pnpm dev:api`}),`, then `,(0,B.jsx)(`button`,{className:`underline border-0 bg-transparent p-0 cursor-pointer text-ember-deep`,onClick:l,children:`retry`}),`.`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`text-umber`,children:[`This console can write to your bus and docs. Enter the console token — it's in `,(0,B.jsx)(`code`,{className:`font-mono text-[12px]`,children:`~/.groundwork-console/token`}),` on the machine running the API (or `,(0,B.jsx)(`code`,{className:`font-mono text-[12px]`,children:`GROUNDWORK_CONSOLE_TOKEN`}),`).`]}),(0,B.jsx)(`input`,{type:`password`,autoFocus:!0,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&r&&u()},placeholder:`token`,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`}),a&&(0,B.jsx)(`div`,{className:`text-brick`,children:a}),(0,B.jsx)(K,{tone:`primary`,onClick:u,disabled:!r||s,children:s?`Signing in…`:`Sign in`}),(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-tan`,children:`Cookie lasts 30 days on this browser. Single shared token — no accounts.`})]})})]})})}var Fd=[{to:`/`,label:`Home`,icon:`home`},{to:`/board`,label:`Board`,icon:`board`},{to:`/bus`,label:`Bus`,icon:`bus`},{to:`/monitor`,label:`Monitor`,icon:`monitor`},{to:`/docs`,label:`Docs`,icon:`docs`},{to:`/git`,label:`Git`,icon:`git`},{to:`/ops`,label:`Ops`,icon:`fleet`}];function Id(){let{error:e}=Ha(),{running:t}=Ga(),n=q(`/bus/unread`,3e4).data?.inbox??0,r=q(`/kit`).data,i=q(`/health`,6e4).data,a=i?.hostname,o=!!i?.version&&i.version!==`0.1.13`,s=rr();(0,P.useEffect)(()=>{let e=s.pathname===`/`?``:s.pathname.split(`/`)[1],t=Fd.find(t=>t.to===`/`?e===``:t.to===`/${e}`)?.label??(e?e[0].toUpperCase()+e.slice(1):`Home`);document.title=a?`${t} · ${a}`:t},[s.pathname,a]);let c=r?.packages?`${r.name} ${r.kitVersion} · seam ${r.packages.seam?.version} · mcp ${r.packages.mcp?.version}`:`kit · offline`;return(0,B.jsx)(Pd,{children:(0,B.jsx)(Mu,{children:(0,B.jsxs)(`div`,{className:`grid grid-rows-[48px_auto_1fr] min-h-screen`,children:[(0,B.jsxs)(`header`,{className:`grid grid-cols-[auto_auto_1fr] items-center gap-4 px-4 border-b border-sand bg-cream min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 font-display font-bold text-[16px] text-ember whitespace-nowrap`,title:c,children:[(0,B.jsx)(Pa,{}),` Groundwork Console`]}),(0,B.jsx)(`nav`,{className:`flex gap-0.5 whitespace-nowrap`,children:Fd.map(e=>(0,B.jsxs)(ji,{to:e.to===`/bus`&&n>0?`/bus?view=inbox`:e.to,end:e.to===`/`,className:({isActive:e})=>`inline-flex items-center gap-1.5 px-3 py-2 rounded-kit font-medium ${e?`bg-paper text-walnut shadow-[inset_0_0_0_1px_var(--color-sand)]`:`text-umber hover:no-underline hover:bg-linen`}`,children:[(0,B.jsx)(`span`,{className:`text-tan`,children:wa[e.icon]({size:16})}),(0,B.jsx)(`span`,{className:`hidden xl:inline`,children:e.label}),e.to===`/ops`&&t>0?(0,B.jsxs)(`span`,{className:`ml-1.5 inline-flex items-center gap-1 text-amber`,children:[(0,B.jsx)(Na,{size:12}),(0,B.jsx)(G,{tone:`warn`,children:t})]}):null,e.to===`/bus`&&n>0?(0,B.jsx)(`span`,{className:`ml-1.5 inline-flex`,title:`${n} unread DM(s) to david`,children:(0,B.jsx)(G,{tone:`david`,children:n})}):null,e.badge?(0,B.jsx)(`span`,{className:`ml-1.5 inline-flex`,children:(0,B.jsx)(G,{tone:`david`,children:e.badge})}):null]},e.to))}),(0,B.jsxs)(`div`,{className:`flex gap-0.5 items-center justify-end min-w-0 whitespace-nowrap`,children:[e&&(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-brick mr-2`,title:e,children:`api offline`}),(0,B.jsx)(Ja,{}),(0,B.jsx)(Qa,{}),(0,B.jsx)(Za,{}),o&&(0,B.jsxs)(`button`,{onClick:()=>location.reload(),className:`mr-1 font-mono text-[11px] px-2 py-1 rounded-full bg-amber-wash text-amber border border-amber-line cursor-pointer`,title:`this tab runs 0.1.13, the API is ${i?.version} — reload to get the new UI`,children:[`new version `,i?.version,` — reload`]}),(0,B.jsx)(so,{}),(0,B.jsx)(`button`,{onClick:async()=>{await fetch(`/api/auth/logout`,{method:`POST`}),window.dispatchEvent(new Event(`groundwork-console:unauthorized`))},className:`ml-1 font-mono text-[11px] text-tan border-0 bg-transparent cursor-pointer hover:text-umber`,title:`sign out (clears the session cookie)`,children:`⎋`})]})]}),(0,B.jsx)(hd,{}),(0,B.jsx)(Rr,{}),(0,B.jsx)(co,{}),(0,B.jsx)(Td,{}),(0,B.jsx)(Md,{})]})})})}function Ld(e,t=Date.now()){let n=Math.max(0,(t-e)/1e3)/60,r=n/60,i=r/24;if(n<1)return`just now`;if(r<1)return`${Math.floor(n)} min ago`;if(i<1)return`${Math.floor(r)} h ago`;if(i<2)return`yesterday`;if(i<7)return`${Math.floor(i)} days ago`;let a=i/7;if(a<2)return`last week`;if(i<30)return`${Math.floor(a)} weeks ago`;let o=i/30;return o<2?`last month`:i<365?`${Math.floor(o)} months ago`:i<730?`last year`:`${Math.floor(i/365)} years ago`}function Rd(e,t=Date.now()){let n=(t-e)/864e5;return n<1?`text-tan`:n<7?`text-amber`:`text-brick font-semibold`}var zd=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),Bd=e=>!!e&&Ea.includes(e),Vd={"state.fact.stale":`warn`,"state.board.malformed":`bad`,"state.decision.open":`david`,"state.phase.active":`neutral`,"phase.completed":`ok`,"phase.started":`ok`,"phase.progress":`neutral`,"done.appended":`ok`,"queue.item.added":`neutral`,"queue.item.closed":`ok`,"fact.stale":`warn`,"board.malformed":`bad`,"decision.posted":`david`};function Hd(){let{data:e,refresh:t}=q(`/events?limit=40`,15e3),[n,r]=(0,P.useState)(!1),[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(!1),c=async(e,n)=>{s(!0);try{await Ia(`/events/config`,{rule:e,enabled:n}),t()}finally{s(!1)}},l=async e=>{s(!0);try{await Ia(`/events/config`,{dryRun:e,confirm:e?void 0:i}),t(),r(!1),a(``)}finally{s(!1)}},[u,d]=(0,P.useState)([]);(0,P.useEffect)(()=>{let e=new EventSource(`/api/events/stream`);return e.onmessage=e=>{let t=JSON.parse(e.data);t.type!==`hello`&&d(e=>{let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=e.slice();return r[n]=t,r}return[t,...e].slice(0,40)})},()=>e.close()},[]);let f=[...u,...(e?.recent??[]).filter(e=>!u.some(t=>t.id===e.id)).slice().reverse()].slice(0,40),p=e?.config;return(0,B.jsxs)(U,{children:[(0,B.jsxs)(W,{title:`Events`,icon:`health`,path:p?`${p.identity.displayName??p.identity.agentId} · ${p.rules.filter(e=>e.enabled).length}/${p.rules.length} rules enabled · dedupe ${p.limits?.dedupeTtlHours??72} h · max ${p.limits?.maxPerRulePerProjectPerHour??3}/h`:`detector`,children:[p&&(p.live?(0,B.jsx)(G,{tone:`bad`,children:`LIVE — sending`}):p.dryRun?(0,B.jsx)(G,{tone:`outline`,children:`dry-run`}):(0,B.jsx)(G,{tone:`warn`,children:`armed · bus writes off`})),p&&(p.dryRun?(0,B.jsx)(K,{size:`sm`,onClick:()=>r(!0),disabled:o,children:`Go live…`}):(0,B.jsx)(K,{size:`sm`,onClick:()=>l(!0),disabled:o,children:`Back to dry-run`}))]}),p&&(0,B.jsxs)(`div`,{className:`px-3 py-2 border-b border-sand grid gap-1`,children:[p.rules.map(e=>(0,B.jsxs)(`label`,{className:`grid grid-cols-[auto_1fr] gap-2 items-baseline font-mono text-[12px] text-ink3 cursor-pointer`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:!!e.enabled,disabled:o||e.action.type===`none`,onChange:t=>c(e.id,t.target.checked),title:e.action.type===`none`?`informational rule — nothing to send`:`enable this rule`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`text-walnut`,children:e.on}),` → `,e.action.type===`none`?(0,B.jsx)(`span`,{className:`text-tan`,children:e.action.note}):(0,B.jsxs)(B.Fragment,{children:[e.action.to?e.action.to:`#${e.action.room}`,` · `,Bd(e.action.prefix)&&(0,B.jsx)(Oa,{prefix:e.action.prefix}),(0,B.jsx)(`span`,{className:`text-umber`,children:e.action.text})]})]})]},e.id)),(0,B.jsxs)(`div`,{className:`text-[11px] font-mono text-tan`,children:[`a rule sends only when: bus writes ON (header) · dry-run OFF · rule enabled · not a duplicate (key, `,p.limits?.dedupeTtlHours??72,` h) · under the rate limit · a live coordinator exists for the project. Baseline state.* events never trigger rules.`]})]}),n&&(0,B.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-walnut/30 flex items-start justify-center pt-[12vh]`,onMouseDown:e=>{e.target===e.currentTarget&&r(!1)},children:(0,B.jsxs)(`div`,{className:`w-[520px] bg-paper border border-brick rounded-kit shadow-panel`,children:[(0,B.jsx)(`div`,{className:`px-4 py-3 border-b border-sand font-display font-bold text-[18px] text-brick`,children:`Turn dry-run off`}),(0,B.jsxs)(`div`,{className:`p-4 grid gap-3 text-[13px] text-umber`,children:[(0,B.jsxs)(`div`,{children:[`Enabled rules will really `,(0,B.jsx)(`code`,{children:`send_message`}),` as `,(0,B.jsx)(`b`,{className:`text-walnut`,children:`groundwork-console`}),` (automation) whenever bus writes are on. Dedupe + rate limit apply; every send is a Run. Persisted in `,(0,B.jsx)(`code`,{children:`groundwork-console.rules.json`}),`.`]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Type LIVE to confirm`}),(0,B.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]})]}),(0,B.jsxs)(`div`,{className:`px-4 py-3 border-t border-sand flex justify-end gap-2`,children:[(0,B.jsx)(K,{size:`sm`,onClick:()=>r(!1),children:`Cancel`}),(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:()=>l(!1),disabled:i!==`LIVE`||o,children:`Go live`})]})]})}),f.length===0&&(0,B.jsx)(`div`,{className:`px-3 py-3 text-[13px] text-umber`,children:`Watching seam files + rooms every 15 s. Nothing dirty at baseline and nothing changed since.`}),f.map(e=>(0,B.jsxs)(`div`,{className:`grid grid-cols-[var(--spacing-gutter)_1fr] border-b border-sand last:border-b-0`,children:[(0,B.jsx)(`div`,{className:`py-2.5 flex justify-center font-mono text-[12px] text-tan border-r border-sand`,children:`⚡`}),(0,B.jsxs)(`div`,{className:`px-3 pt-2 pb-2.5 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex gap-2 items-baseline mb-0.5 flex-wrap`,children:[(0,B.jsx)(G,{tone:Vd[e.type]??`neutral`,children:e.type}),e.data.baseline?(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`baseline · no action`}):null,(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-umber`,children:e.project}),(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-ink3`,children:zd(e.ts)})]}),(0,B.jsx)(`div`,{className:`font-mono text-[12px] text-umber break-all`,children:Object.entries(e.data).filter(([e])=>![`project`,`room`].includes(e)).map(([e,t])=>`${e}=${String(t)}`).join(` · `)}),e.actions.filter(e=>e.type!==`none`).map(e=>(0,B.jsxs)(`div`,{className:`mt-1 text-[13px] pl-2 border-l-2 ${e.sent?`border-leaf`:e.skipped?`border-amber`:`border-dust`}`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.06em] mr-1.5 ${e.sent?`text-leaf`:e.skipped?`text-amber`:`text-tan`}`,children:e.sent?`sent`:e.skipped?`skipped · ${e.skipped}`:e.dryRun?`would send`:`sending`}),Bd(e.prefix)&&(0,B.jsx)(Oa,{prefix:e.prefix}),(0,B.jsx)(`span`,{className:`text-walnut`,children:e.text}),` `,(0,B.jsxs)(`span`,{className:`font-mono text-[12px] text-ink3`,children:[`→ `,e.to??`#${e.room}`]}),e.runId&&(0,B.jsx)(`span`,{className:`ml-2 font-mono text-[11px] text-tan`,children:e.runId})]},e.ruleId))]})]},e.id))]})}function Ud(){let{data:e}=q(`/events?limit=40`,3e4),t=e?.config;if(!t)return null;let n=t.rules.filter(e=>e.enabled).length,r=Date.now()-864e5,i=(e?.recent??[]).filter(e=>e.ts>r).flatMap(e=>e.actions).filter(e=>e.sent).length;return(0,B.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-[11px] text-ink3 px-1`,children:[(0,B.jsx)(`span`,{className:`uppercase tracking-[.1em] text-tan`,children:`events`}),t.live?(0,B.jsx)(G,{tone:`bad`,children:`live`}):t.dryRun?(0,B.jsx)(G,{tone:`outline`,children:`dry-run`}):(0,B.jsx)(G,{tone:`warn`,children:`armed · bus writes off`}),(0,B.jsxs)(`span`,{children:[n,`/`,t.rules.length,` rules on · `,i,` sent in 24 h`]}),(0,B.jsx)(V,{to:`/ops/events`,className:`ml-auto text-ember-deep`,children:`Ops → Events`})]})}var Wd={complete:{label:`complete`,tone:`ok`,dot:`bg-leaf border-leaf`,ring:`text-leaf`,hint:`all tasks ticked`},ongoing:{label:`ongoing`,tone:`david`,dot:`bg-ember border-ember`,ring:`text-ember`,hint:`streams in flight or tasks ticked`},planned:{label:`planned`,tone:`neutral`,dot:`bg-paper border-umber`,ring:`text-umber`,hint:`tasks written, none started`},pending:{label:`pending`,tone:`outline`,dot:`bg-paper border-dust border-dashed`,ring:`text-tan`,hint:`no PHASE*_TASKS.md yet — run /plan-phase`}};function Gd({pct:e,cls:t,size:n=44}){let r=(n-6)/2,i=2*Math.PI*r;return(0,B.jsxs)(`svg`,{width:n,height:n,viewBox:`0 0 ${n} ${n}`,className:t,"aria-hidden":!0,children:[(0,B.jsx)(`circle`,{cx:n/2,cy:n/2,r,fill:`none`,stroke:`currentColor`,strokeOpacity:`.18`,strokeWidth:`4`}),(0,B.jsx)(`circle`,{cx:n/2,cy:n/2,r,fill:`none`,stroke:`currentColor`,strokeWidth:`4`,strokeLinecap:`round`,strokeDasharray:`${e/100*i} ${i}`,transform:`rotate(-90 ${n/2} ${n/2})`})]})}function Kd({project:e,phases:t,canWrite:n,prd:r}){let i=q(`/projects/${e}/agents`,3e4).data,[a,o]=(0,P.useState)(null),[s,c]=(0,P.useState)(null),[l,u]=(0,P.useState)(null),d=`groundwork-console.roadmap.last.${e}`,[f,p]=(0,P.useState)(()=>{try{return JSON.parse(localStorage.getItem(d)??`{}`)}catch{return{}}}),m=(e,t,n)=>p(r=>{let i={...r,[e]:{verb:t,to:n,ts:Date.now()}};return localStorage.setItem(d,JSON.stringify(i)),i}),h=e=>{let t=Math.floor((Date.now()-e)/6e4);return t<1?`just now`:t<60?`${t} min ago`:`${Math.floor(t/60)} h ago`},g=async(t,r)=>{if(!n){c(`bus writes are off — click the header badge (read-only · v0.1) and type ENABLE, then retry`);return}if(r===`plan`&&!i?.aide){c(`no live aide for ${e} — start one (coord-aide) in #room, or DM the coordinator from Bus`);return}if(r!==`plan`&&!i?.coordinator){c(`no live coordinator for ${e}`);return}o(`${t.id}:${r}`),c(null);try{let n=await Ia(`/actions/phase/${e}/${t.id}/${r}`),i=n.args?.to??``;n.status===`ok`&&m(t.id,r,i),c(n.status===`ok`?`sent → ${i}`:n.error??n.log?.slice(-1)[0]??`failed`)}catch(e){c(e.message)}finally{o(null)}},_=async t=>{if(!n){c(`bus writes are off — switch them on in the header, then retry`);return}o(t),c(null);try{let n=await Ia(`/actions/project/${e}/${t}`),r=n.args?.to??``;c(n.status===`ok`?`sent → ${r} — continue in its thread`:n.error??n.log?.slice(-1)[0]??`failed`),n.status===`ok`&&r&&xd(r)}catch(e){c(e.message)}finally{o(null)}},v=t.filter(e=>e.state===`complete`).length,y=t.find(e=>e.state===`ongoing`)??t.find(e=>e.state===`planned`)??t.find(e=>e.state===`pending`);return(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`Roadmap`,icon:`phases`,eyebrow:`PRODUCTION_ROADMAP · phases/`,path:`${v}/${t.length} complete${y?` · next: ${y.title}`:``}`,children:(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 flex-wrap`,children:[i?.aide?(0,B.jsx)(ld,{id:i.aide,prefix:`aide`}):(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`no live aide`}),i?.coordinator?(0,B.jsx)(ld,{id:i.coordinator,prefix:`coord`}):(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`no live coordinator`})]})}),t.length===0&&(0,B.jsxs)(`div`,{className:`px-3 py-3 grid gap-2 text-[13px]`,children:[r==null?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`text-walnut`,children:[`No PRD yet. The roadmap starts from `,(0,B.jsx)(`code`,{children:`docs/PRD.md`}),` — write it with your aide (it runs `,(0,B.jsx)(`code`,{children:`/create-prd`}),` and asks you what it needs).`]}),(0,B.jsxs)(`div`,{className:`flex gap-2 items-center flex-wrap`,children:[(0,B.jsx)(K,{size:`sm`,tone:`primary`,disabled:!!a||!i?.aide,title:i?.aide?`DM ${i.aide}: run /create-prd with me`:`no live aide — spawn one under Ops → Fleets`,onClick:()=>_(`create-prd`),children:a===`create-prd`?(0,B.jsx)(Na,{size:12}):`Write the PRD with the aide`}),i?.aide&&(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:()=>xd(i.aide),children:`Open the aide's thread`}),!i?.aide&&(0,B.jsx)(V,{to:`/ops/fleets`,className:`hover:no-underline`,children:(0,B.jsx)(K,{size:`sm`,children:`Spawn aide`})})]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`text-walnut`,children:[`PRD is `,(0,B.jsx)(`b`,{children:r.status??`present`}),r.roadmap?` and a roadmap exists`:``,` — no `,(0,B.jsx)(`code`,{children:`docs/phases/`}),` yet. Kickstart builds the roadmap + doc scaffold (roadmap, tech stack, architecture, decisions, workstreams, queue, done, facts); phases follow with `,(0,B.jsx)(`code`,{children:`/plan-phase 1`}),`.`]}),(0,B.jsxs)(`div`,{className:`flex gap-2 items-center flex-wrap`,children:[(0,B.jsx)(K,{size:`sm`,tone:`primary`,disabled:!!a||!i?.aide,title:i?.aide?`DM ${i.aide}: run /kickstart in ${e}`:`no live aide — spawn one under Ops → Fleets`,onClick:()=>_(`kickstart`),children:a===`kickstart`?(0,B.jsx)(Na,{size:12}):`Kickstart with the aide`}),i?.aide&&(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:()=>xd(i.aide),children:`Open the aide's thread`}),!i?.aide&&(0,B.jsx)(V,{to:`/ops/fleets`,className:`hover:no-underline`,children:(0,B.jsx)(K,{size:`sm`,children:`Spawn aide`})})]})]}),s&&(0,B.jsx)(`div`,{className:`font-mono text-[12px] ${/^sent/.test(s)?`text-leaf`:`text-brick`}`,children:s})]}),t.length>0&&(0,B.jsxs)(`div`,{className:`px-3 pt-3 pb-2 min-w-0`,children:[(0,B.jsx)(`div`,{className:`overflow-x-auto overscroll-x-contain [scrollbar-width:thin]`,children:(0,B.jsx)(`ol`,{className:`flex items-start gap-0 min-w-max`,children:t.map((e,n)=>{let r=Wd[e.state],i=e.total?Math.round(e.done/e.total*100):0,o=n===t.length-1;return(0,B.jsxs)(`li`,{className:`flex items-start`,children:[(0,B.jsxs)(`div`,{className:`w-[190px] grid gap-1.5 justify-items-center text-center`,children:[(0,B.jsxs)(`button`,{onClick:()=>u(t=>t===e.id?null:e.id),className:`relative border-0 bg-transparent p-0 cursor-pointer rounded-full ${l===e.id?`ring-2 ring-ember ring-offset-2 ring-offset-paper`:``}`,title:`show tasks`,children:[(0,B.jsx)(Gd,{pct:e.state===`complete`?100:i,cls:r.ring}),(0,B.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center font-mono font-bold text-[12px] ${r.ring}`,children:e.state===`complete`?`✓`:e.n})]}),(0,B.jsx)(`button`,{onClick:()=>u(t=>t===e.id?null:e.id),className:`font-semibold text-[13px] leading-tight line-clamp-2 px-1 border-0 bg-transparent cursor-pointer text-walnut hover:text-ember-deep`,title:e.title,children:e.title}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(G,{tone:r.tone,children:r.label}),(0,B.jsxs)(`span`,{className:`font-mono text-[11px] text-ink3`,children:[e.total?`${e.done}/${e.total}`:`—`,e.streams?` · ${e.streams} stream${e.streams===1?``:`s`}`:``]})]}),f[e.id]&&(0,B.jsxs)(`div`,{className:`font-mono text-[10px] text-ink3 flex items-center gap-1 justify-center flex-wrap`,title:new Date(f[e.id].ts).toLocaleString(),children:[(0,B.jsx)(`span`,{className:`uppercase tracking-[.06em]`,children:f[e.id].verb===`kickoff`?`kicked off`:f[e.id].verb===`plan`?`plan requested`:`audit requested`}),(0,B.jsx)(`span`,{children:`→`}),(0,B.jsx)(ld,{id:f[e.id].to,bare:!0}),(0,B.jsx)(`span`,{className:`text-tan`,children:h(f[e.id].ts)})]}),(0,B.jsxs)(`div`,{className:`flex gap-1 flex-wrap justify-center`,children:[(e.tasks||e.readme)&&(0,B.jsx)(V,{to:`/docs/${encodeURIComponent(e.tasks??e.readme)}`,className:`hover:no-underline`,children:(0,B.jsx)(K,{size:`sm`,tone:`ghost`,children:`Open`})}),e.state===`pending`&&(0,B.jsx)(K,{size:`sm`,tone:`primary`,disabled:!!a,title:`DM the aide: run /plan-phase`,onClick:()=>g(e,`plan`),children:a===`${e.id}:plan`?(0,B.jsx)(Na,{size:12}):`Plan`}),e.state===`planned`&&(0,B.jsx)(K,{size:`sm`,tone:`primary`,disabled:!!a,title:`GO to the coordinator`,onClick:()=>g(e,`kickoff`),children:a===`${e.id}:kickoff`?(0,B.jsx)(Na,{size:12}):`Kick off`}),e.state===`ongoing`&&(0,B.jsx)(K,{size:`sm`,disabled:!!a,title:`ask the coordinator to run /coord-audit`,onClick:()=>g(e,`audit`),children:a===`${e.id}:audit`?(0,B.jsx)(Na,{size:12}):`Audit`})]})]}),!o&&(0,B.jsx)(`div`,{className:`mt-[21px] h-[3px] w-6 rounded ${e.state===`complete`?`bg-leaf`:`bg-sand`}`})]},e.id)})})}),l&&(0,B.jsx)(Ju,{project:e,phase:t.find(e=>e.id===l),onClose:()=>u(null)}),s&&(0,B.jsx)(`div`,{className:`mt-2 font-mono text-[12px] flex items-center gap-2 ${/^sent/.test(s)?`text-leaf`:`text-brick`}`,children:/^sent → /.test(s)?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:`sent →`}),(0,B.jsx)(ld,{id:s.replace(/^sent → /,``),bare:!0})]}):s}),(0,B.jsx)(`div`,{className:`mt-2 font-mono text-[11px] text-tan flex gap-3 flex-wrap`,children:Object.keys(Wd).map(e=>(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full border mr-1 align-middle ${Wd[e].dot}`}),Wd[e].label,` — `,Wd[e].hint]},e))})]})]})}function qd({phases:e}){return e?.length?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:e.map(e=>`${e.n}: ${e.state}${e.total?` ${e.done}/${e.total}`:``}`).join(` · `),children:[e.map((e,t)=>(0,B.jsx)(`span`,{className:`inline-block w-2.5 h-2.5 rounded-full border ${Wd[e.state].dot}`},t)),(0,B.jsxs)(`span`,{className:`ml-1 font-mono text-[11px] text-ink3`,children:[e.filter(e=>e.state===`complete`).length,`/`,e.length]})]}):(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`no phases`})}function Jd({project:e,canWrite:t,onClose:n,initialRole:r}){let{data:i}=q(`/actions/spawn/options?project=${encodeURIComponent(e)}`),[a,o]=(0,P.useState)(r??`worker`),[s,c]=(0,P.useState)(`claude`),[l,u]=(0,P.useState)(``),[d,f]=(0,P.useState)(``),[p,m]=(0,P.useState)(``),[h,g]=(0,P.useState)(``),[_,v]=(0,P.useState)(8),[y,b]=(0,P.useState)(!1),[x,S]=(0,P.useState)(null),[C,w]=(0,P.useState)(null),T=ar(),{runs:E}=Ga(),D=x?E.find(e=>e.id===x.id)??x:null;(0,P.useEffect)(()=>{i&&!l&&u(i.suggest[a]??``)},[i,a,l]),(0,P.useEffect)(()=>{i&&u(i.suggest[a]??``)},[a]);let O=async()=>{b(!0),w(null);try{let t=await Ia(`/actions/spawn`,{project:e,role:a,harness:s,agentId:l,lane:d||void 0,model:p||void 0,note:h||void 0,waitSeconds:_});if(!t.status)throw Error(t.error??`failed`);S(t)}catch(e){w(e.message)}finally{b(!1)}},k=i?.roles.find(e=>e.id===a)?.skill??``;return(0,B.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-walnut/30 flex items-start justify-center pt-[8vh] whitespace-normal text-left`,onMouseDown:e=>{e.target===e.currentTarget&&!y&&n()},children:(0,B.jsxs)(`div`,{className:`w-[640px] bg-paper border border-sand rounded-kit shadow-panel`,children:[(0,B.jsxs)(`div`,{className:`px-4 py-3 border-b border-sand font-display font-bold text-[18px] text-umber`,children:[`Spawn agent · `,e]}),(0,B.jsxs)(`div`,{className:`p-4 grid gap-3 text-[13px]`,children:[(0,B.jsxs)(`div`,{className:`flex gap-1.5 flex-wrap items-center text-umber`,children:[(0,B.jsx)(G,{tone:t?`warn`:`outline`,children:t?`bus writes on`:`bus writes OFF`}),(0,B.jsxs)(`span`,{children:[`tmux window `,(0,B.jsxs)(`code`,{children:[`fleet-`,e]}),` · cwd `,(0,B.jsx)(`code`,{children:i?.repoPath?.replace(/^\/Users\/[^/]+/,`~`)}),i?.room?(0,B.jsxs)(B.Fragment,{children:[` · room `,(0,B.jsxs)(`code`,{children:[`#`,i.room]})]}):` · no room linked`]})]}),!t&&(0,B.jsx)(`div`,{className:`text-brick`,children:`Turn on bus writes (header toggle) first — spawning launches a process and types the role invocation into the new pane.`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Role · playbook card`}),(0,B.jsx)(`select`,{value:a,onChange:e=>o(e.target.value),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`,children:(i?.roles??[]).map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.id,` · `,e.skill]},e.id))})]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Harness`}),(0,B.jsx)(`select`,{value:s,onChange:e=>c(e.target.value),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`,children:(i?.harnesses??[]).map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.id,` · `,e.cmd]},e.id))})]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Agent id`}),(0,B.jsx)(`input`,{value:l,onChange:e=>u(e.target.value.trim()),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]}),a===`worker`?(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Lane`}),(0,B.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:`repo-owner · rendering · api`,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]}):(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Model (Claude only, optional)`}),(0,B.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),placeholder:`claude-sonnet-4-6`,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]})]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Extra instruction (optional, injected after the skill)`}),(0,B.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`e.g. mission: re-verify the design doc after PR4`,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3 text-umber`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Start wait`}),(0,B.jsx)(`input`,{type:`range`,min:3,max:30,value:_,onChange:e=>v(Number(e.target.value))}),(0,B.jsxs)(`span`,{className:`font-mono text-[12px]`,children:[_,` s`]}),(0,B.jsx)(`span`,{className:`text-[12px]`,children:`before injecting the skill`})]}),(0,B.jsxs)(`div`,{className:`font-mono text-[12px] text-ink3 bg-linen rounded px-2 py-1.5`,children:[`will type: `,(0,B.jsx)(`b`,{className:`text-walnut`,children:i?.harnesses.find(e=>e.id===s)?.cmd}),` → wait `,_,` s → `,s===`claude`?`/color · `:``,(0,B.jsxs)(`b`,{className:`text-walnut`,children:[k,` --id=`,l||`…`,d?` --lane=${d}`:``,i?.room?` --room=${i.room}`:``]}),` → wait for register (≤ 90 s)`]}),C&&(0,B.jsx)(`div`,{className:`text-brick`,children:C}),D&&(0,B.jsxs)(`div`,{className:`p-2 rounded-kit border min-w-0 max-w-full ${D.status===`ok`?`border-moss-line bg-moss-wash/50`:D.status===`failed`?`border-brick-line bg-brick-wash/50`:`border-amber-line bg-amber-wash/40`}`,children:[(0,B.jsxs)(`div`,{className:`font-mono text-[12px]`,children:[D.status===`running`?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-amber`,children:[(0,B.jsx)(Na,{}),` `,(0,B.jsx)(G,{tone:`warn`,children:`running`})]}):(0,B.jsx)(G,{tone:D.status===`ok`?`ok`:`bad`,children:D.status}),` `,(0,B.jsx)(`b`,{children:D.label}),D.status===`running`&&(0,B.jsx)(`span`,{className:`ml-2 text-tan`,children:`live — you can close this; it keeps running (see Runs)`})]}),(0,B.jsxs)(`pre`,{className:`m-0 mt-1 font-mono text-[12px] whitespace-pre-wrap max-h-[30vh] overflow-auto min-w-0 max-w-full break-words overscroll-contain`,children:[D.log.join(`
|
|
28
|
+
`);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{onClick:()=>l(!0),className:`w-full text-left rounded-[4px] overflow-hidden border border-sand bg-transparent p-0 cursor-pointer group ${n}`,title:`${e} · pane ${i?.pane??``} · click for the full view`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-[3px] bg-linen border-b border-sand`,children:[(0,B.jsx)(`span`,{className:`relative inline-block w-1.5 h-1.5 rounded-full ${i?.active?`bg-moss`:`bg-dust`}`,children:i?.active&&(0,B.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-moss animate-ping opacity-60`})}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] text-ink3 truncate`,children:r??e}),(0,B.jsx)(`span`,{className:`ml-auto font-mono text-[10px] text-tan`,children:i?i.active?`active`:`quiet ${sd(i.paneActivity)}`:`…`})]}),(0,B.jsx)(`pre`,{className:`m-0 px-2 py-1 pane-dark font-mono text-[10.5px] leading-[1.35] whitespace-pre-wrap break-words max-h-[calc(1.35em*4+8px)] overflow-hidden group-hover:opacity-90`,style:{maxHeight:`calc(1.35em * ${t} + 8px)`},children:o?(0,B.jsx)(`span`,{className:`text-brick`,children:o}):i?i.ansi?mo(u(i.ansi)):u(i.text):`capturing…`})]}),c&&(0,B.jsx)(id,{agentId:e,onClose:()=>l(!1)})]})}function ld({id:e,prefix:t,size:n=`sm`,className:r=``,bare:i=!1,noDot:a=!1}){let o=(q(`/bus/agents`,2e4).data??[]).find(t=>t.agentId===e),[s,c]=(0,P.useState)(!1),[l,u]=(0,P.useState)(!1),d=(0,P.useRef)(null),f=()=>{d.current&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>c(!0),250)},p=()=>{d.current&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>c(!1),200)};(0,P.useEffect)(()=>()=>{d.current&&window.clearTimeout(d.current)},[]);let m=!!o?.pane;return(0,B.jsxs)(`span`,{className:`relative inline-flex ${r}`,onMouseEnter:f,onMouseLeave:p,children:[(0,B.jsxs)(`button`,{onClick:()=>m&&u(!0),className:i?`inline-flex items-center gap-1.5 font-mono font-semibold ${n===`sm`?`text-[12px]`:`text-[13px]`} border-0 bg-transparent p-0 text-walnut ${m?`cursor-pointer hover:text-ember-deep`:`cursor-default`}`:`inline-flex items-center gap-1.5 rounded-full border font-mono ${n===`sm`?`text-[11px] px-2 py-0.5`:`text-[12px] px-2.5 py-1`} ${m?`cursor-pointer border-dust bg-paper hover:border-ember`:`cursor-default border-sand bg-linen/60`} text-walnut`,title:m?`${e} · pane ${o.pane} · click to pop out`:`${e}${o?` · ${o.reachability}`:` · not on the bus`}`,children:[t&&(0,B.jsx)(`span`,{className:`text-tan`,children:t}),!a&&(0,B.jsx)(Lu,{id:e,role:o?.role,size:n===`sm`?14:18,state:o?.reachability??`dead`,active:o?.active}),(0,B.jsx)(`span`,{className:`truncate max-w-[220px]`,children:e}),o&&!o.transport&&o.reachability!==`dead`&&(0,B.jsx)(`span`,{className:`text-amber`,title:`not attached — DMs won't reach its pane`,children:`⚠`})]}),s&&m&&(0,B.jsx)(`span`,{className:`absolute left-0 top-[calc(100%+6px)] z-50 w-[420px] whitespace-normal text-left`,onMouseEnter:f,onMouseLeave:p,children:(0,B.jsx)(cd,{agentId:e,lines:6,label:`${e} · ${o.role??``}`,className:`shadow-panel bg-paper`})}),l&&(0,B.jsx)(id,{agentId:e,onClose:()=>u(!1)})]})}var ud=[{re:/coordinator/i,label:`coordinator`,dot:`#4A6A2C`,ring:`#B9CFA0`},{re:/aide|liaison|curator/i,label:`aide`,dot:`#C4587A`,ring:`#F0C2D2`},{re:/\bqa\b|quality/i,label:`qa`,dot:`#C88A1E`,ring:`#F0DFA6`},{re:/\bci\b/i,label:`ci`,dot:`#E8702A`,ring:`#F6C9A6`},{re:/audit/i,label:`audit`,dot:`#7A4A6A`,ring:`#DDBFD3`},{re:/automation/i,label:`automation`,dot:`#8A7660`,ring:`#D9CDBB`},{re:/human|david/i,label:`human`,dot:`#B7521A`,ring:`#F6C9A6`}],dd=e=>ud.find(t=>t.re.test(e??``))?.dot??`#5C7A96`,fd=e=>ud.find(t=>t.re.test(e??``))?.label??`worker`;function pd(e,t,n){return e.project===t||!!n&&e.project===n}function md(e){return e.agentId===`groundwork-console`||e.agentId===`david`}function hd(){let{projects:e,current:t}=Ha(),n=q(`/bus/agents`,15e3).data??[],r=e.find(e=>e.name===t)?.room,i=n.filter(e=>!md(e)&&e.reachability!==`dead`&&pd(e,t,r)),a=n.filter(e=>!md(e)&&e.reachability!==`dead`&&!i.includes(e)),o=e=>[`aide`,`coordinator`,`qa`,`ci`,`worker`,`audit`].indexOf(fd(e.role))+1||9,s=[...i].sort((e,t)=>o(e)-o(t)||e.agentId.localeCompare(t.agentId)),[c,l]=(0,P.useState)(!1);return(0,B.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-1.5 border-b border-sand bg-paper/70 min-h-[34px] whitespace-nowrap overflow-x-auto [scrollbar-width:none]`,children:[(0,B.jsxs)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.1em] text-tan shrink-0`,children:[`online · `,t||`—`]}),s.length===0&&(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-tan`,children:`no agents for this project`}),s.map(e=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-sand bg-paper`,style:{borderColor:dd(e.role)+`66`},title:`${e.agentId} · ${fd(e.role)}${e.pane?` · ${e.pane}`:``}`,children:[(0,B.jsx)(Lu,{id:e.agentId,role:e.role,size:16,state:e.reachability,active:e.active}),(0,B.jsx)(ld,{id:e.agentId,bare:!0,noDot:!0,size:`sm`}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.06em]`,style:{color:dd(e.role)},children:fd(e.role)})]},e.agentId)),c&&a.map(e=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-dashed border-sand bg-cream/60`,title:`${e.agentId} · ${fd(e.role)} · ${e.project??`?`}`,children:[(0,B.jsx)(Lu,{id:e.agentId,role:e.role,size:16,state:e.reachability,active:e.active}),(0,B.jsx)(ld,{id:e.agentId,bare:!0,noDot:!0,size:`sm`}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] text-tan`,children:e.project})]},e.agentId)),a.length>0&&(0,B.jsx)(`button`,{onClick:()=>l(e=>!e),"aria-pressed":c,className:`ml-auto font-mono text-[11px] text-ink3 shrink-0 border-0 bg-transparent cursor-pointer hover:text-umber`,title:c?`show only this project`:a.map(e=>e.agentId).join(`, `),children:c?`only this project`:`+${a.length} elsewhere`}),(0,B.jsx)(`span`,{className:`ml-3 font-mono text-[10px] text-tan shrink-0 hidden xl:inline-flex items-center gap-2`,children:[[`coordinator`,`#4A6A2C`],[`aide`,`#C4587A`],[`qa`,`#C88A1E`],[`ci`,`#E8702A`],[`worker`,`#5C7A96`]].map(([e,t])=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full`,style:{background:t}}),e]},e))})]})}function gd(e){let[t,n]=(0,P.useState)(!1),r=(0,P.useRef)(e);return(0,P.useEffect)(()=>{let e=()=>{let e=document.getSelection();n(!!e&&!e.isCollapsed)};return document.addEventListener(`selectionchange`,e),()=>document.removeEventListener(`selectionchange`,e)},[]),t||(r.current=e),r.current}var _d={clear:`reset the agent's context — typed raw into its CLI via send_command`,compact:`compact the agent's context — typed raw into its CLI via send_command`,"reload-skills":`reload the agent's skills after a playbook update — typed raw into its CLI via send_command`},vd=e=>e.map(e=>e.replace(/^\//,``)).map(e=>({name:e,description:_d[e]??`typed raw into the agent's CLI via send_command`,source:`built-in`}));function $(e,t){let n=e.slice(0,t),r=n.match(/(^|\s)\/([\w-]*)$/);return r?{start:n.length-r[2].length-1,query:r[2]}:null}function yd(e){let t=q(e?`/projects/${e}/skills`:null,6e4).data,n=za();return(0,P.useMemo)(()=>[...vd(n),...(t?.groundwork.skills??[]).map(e=>({name:e.name,description:e.description,source:`groundwork`})),...(t?.playbook.cards??[]).map(e=>({name:e.name,description:e.description,source:`playbook`}))],[t,n])}function bd({skills:e,query:t,onPick:n,onClose:r,bind:i}){let a=(0,P.useMemo)(()=>{let n=t.toLowerCase(),r=e.filter(e=>e.name.toLowerCase().includes(n));return(r.length?r:e.filter(e=>e.description.toLowerCase().includes(n))).sort((e,t)=>Number(t.name.toLowerCase().startsWith(n))-Number(e.name.toLowerCase().startsWith(n))||e.name.localeCompare(t.name)).slice(0,12)},[e,t]),[o,s]=(0,P.useState)(0),c=(0,P.useRef)(null);return(0,P.useEffect)(()=>{s(0)},[t]),(0,P.useEffect)(()=>(i(e=>e.key===`ArrowDown`?(s(e=>Math.min(e+1,a.length-1)),!0):e.key===`ArrowUp`?(s(e=>Math.max(e-1,0)),!0):(e.key===`Enter`||e.key===`Tab`)&&a[o]?(n(a[o].name),!0):e.key===`Escape`&&(r(),!0)),()=>i(null)),[i,a,o,n,r]),(0,P.useEffect)(()=>{c.current?.querySelector(`[data-i="${o}"]`)?.scrollIntoView({block:`nearest`})},[o]),a.length===0?(0,B.jsxs)(`div`,{className:`absolute left-0 right-0 bottom-full mb-1 bg-paper border border-sand rounded-kit shadow-panel px-2 py-1.5 font-mono text-[11px] text-tan`,children:[`no skill matches “/`,t,`” — Enter sends the text as typed`]}):(0,B.jsxs)(`div`,{ref:c,role:`listbox`,"aria-label":`slash commands`,className:`absolute left-0 right-0 bottom-full mb-1 max-h-[240px] overflow-auto overscroll-contain bg-paper border border-sand rounded-kit shadow-panel grid`,children:[a.map((e,t)=>(0,B.jsxs)(`button`,{"data-i":t,type:`button`,role:`option`,"aria-selected":t===o,onMouseDown:t=>{t.preventDefault(),n(e.name)},onMouseEnter:()=>s(t),className:`grid grid-cols-[auto_1fr_auto] gap-2 items-baseline px-2 py-1 text-left border-0 cursor-pointer ${t===o?`bg-linen`:`bg-transparent`}`,children:[(0,B.jsxs)(`span`,{className:`font-mono text-[12px] font-semibold text-walnut`,children:[`/`,e.name]}),(0,B.jsx)(`span`,{className:`text-[12px] text-umber truncate`,title:e.description,children:e.description}),(0,B.jsx)(G,{tone:e.source===`built-in`?`warn`:e.source===`playbook`?`neutral`:`outline`,children:e.source===`built-in`?`built-in · raw`:e.source})]},`${e.source}:${e.name}`)),(0,B.jsx)(`div`,{className:`px-2 py-1 font-mono text-[10px] text-tan border-t border-sand`,children:`↑↓ move · Enter/Tab insert · Esc close · sent as a text DM; the agent runs the skill`})]})}var xd=(e,t)=>window.dispatchEvent(new CustomEvent(`groundwork-console:summon`,{detail:{agentId:e,answers:t?.answers}})),Sd=e=>`groundwork-console.summon.${e}`,Cd=e=>`groundwork-console.summon.seen.${e}`;function wd(e){let t=rr(),n=t.pathname.match(/^\/docs\/(.+)$/),r=new URLSearchParams(t.search);if(n){let t=decodeURIComponent(n[1]),i=r.get(`line`);return t.startsWith(`kb:`)?{label:`knowledge/${t.slice(3)}${i?`:${i}`:``}`,cite:`groundwork-knowledge/${t.slice(3)}${i?`:${i}`:``}`}:{label:`${t}${i?`:${i}`:``}`,cite:`${e}/docs/${t}${i?`:${i}`:``}`}}let i=t.pathname===`/`?`home`:t.pathname.slice(1).split(`/`)[0];return{label:i,cite:`groundwork-console /${i}${e?` · ${e}`:``}`}}function Td(){let{current:e,projects:t}=Ha(),n=q(`/bus/agents`,2e4).data??[],r=q(e?`/projects/${e}/agents`:null,3e4).data,i=n.filter(e=>e.reachability!==`dead`&&!md(e)),a=t.find(t=>t.name===e)?.room,o=e?i.filter(t=>pd(t,e,a)):i,[s,c]=(0,P.useState)(()=>e?localStorage.getItem(Sd(e)):null);(0,P.useEffect)(()=>{c(e?localStorage.getItem(Sd(e)):null)},[e]);let l=(s&&i.some(e=>e.agentId===s)?s:null)??r?.aide??r?.coordinator??o[0]?.agentId??null,u=n.find(e=>e.agentId===l),[d,f]=(0,P.useState)(!1),[p,m]=(0,P.useState)(!1),h=t=>{c(t),e&&localStorage.setItem(Sd(e),t),m(!1),f(!0)},g=gd(q(l?`/bus/dm/${encodeURIComponent(l)}?limit=80`:null,d?4e3:2e4).data),_=q(`/bus/inbox?limit=100`,2e4).data?.decisions??{},[v,y]=(0,P.useState)(0);(0,P.useEffect)(()=>{l&&y(Number(localStorage.getItem(Cd(l))??0))},[l]),(0,P.useEffect)(()=>{d&&l&&g&&(localStorage.setItem(Cd(l),String(g.lastFromAgent)),y(g.lastFromAgent))},[d,l,g]);let b=!!g&&g.lastFromAgent>v;(0,P.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(m(!1),f(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let[x,S]=(0,P.useState)([]);(0,P.useEffect)(()=>{let e=e=>{let t=e.detail;S(t?.answers??[]),t?.agentId?h(t.agentId):(f(!1),m(!0))};return window.addEventListener(`groundwork-console:summon`,e),()=>window.removeEventListener(`groundwork-console:summon`,e)});let[C,w]=(0,P.useState)(``);if((0,P.useEffect)(()=>{p||w(``)},[p]),!l)return null;let T=e=>Math.max(e.paneActivity??0,e.lastSeen??0,e.lastHeartbeat??0),E=[...o].sort((e,t)=>Number(/aide/i.test(t.role??``))-Number(/aide/i.test(e.role??``))||T(t)-T(e)),D=o.length>6||i.length>o.length,O=D?E.slice(0,6):E,k=C.trim()?i.filter(e=>`${e.agentId} ${e.role??``} ${e.project??``}`.toLowerCase().includes(C.trim().toLowerCase())):E.slice(6),A=O.length,j=e=>{let t=(A===1?.5:e/(A-1))*(Math.PI/2);return{x:-Math.sin(t)*96,y:-Math.cos(t)*96}};return(0,B.jsxs)(B.Fragment,{children:[d&&(0,B.jsx)(kd,{agentId:l,me:u,project:e,thread:g??void 0,answers:x,onAnswered:()=>S([]),onClose:()=>f(!1),onSwitch:()=>{m(!0)}}),(0,B.jsxs)(`div`,{className:`fixed right-5 bottom-5 z-[55]`,style:{width:52,height:52},children:[p&&(0,B.jsxs)(`div`,{className:`absolute inset-0`,"aria-label":`pick an agent`,children:[O.map((e,t)=>{let n=j(t);return(0,B.jsxs)(`button`,{onClick:()=>h(e.agentId),title:`${e.agentId} · ${fd(e.role)}`,className:`absolute rounded-full border-2 bg-paper shadow-panel cursor-pointer p-[3px] transition-transform hover:scale-110`,style:{left:26+n.x-17,top:26+n.y-17,borderColor:dd(e.role),width:34,height:34,animation:`summon-pop .18s ease-out ${t*30}ms both`},children:[(0,B.jsx)(Lu,{id:e.agentId,role:e.role,size:26,state:e.reachability,active:e.active}),_[e.agentId]?(0,B.jsx)(Ed,{n:_[e.agentId],small:!0}):null]},e.agentId)}),O.length===0&&(0,B.jsx)(`span`,{className:`absolute right-0 bottom-14 whitespace-nowrap font-mono text-[11px] text-tan bg-paper border border-sand rounded-kit px-2 py-1`,children:`no live agents`}),D&&(0,B.jsxs)(`div`,{className:`absolute right-0 bottom-[130px] w-[300px] bg-paper border border-sand rounded-kit shadow-panel p-2 grid gap-1`,onMouseDown:e=>e.stopPropagation(),children:[(0,B.jsx)(`input`,{autoFocus:!0,value:C,onChange:e=>w(e.target.value),onKeyDown:e=>{e.key===`Enter`&&k[0]&&h(k[0].agentId),e.key===`Escape`&&m(!1)},placeholder:e?`${o.length} live in ${e} — type to search all projects`:`${o.length} live — type to filter (id · role · project)`,className:`text-[12px] px-2 py-1.5 border border-dust rounded-kit bg-paper text-walnut font-mono`}),(0,B.jsxs)(`div`,{className:`max-h-[220px] overflow-auto overscroll-contain grid`,children:[k.slice(0,40).map((e,t)=>(0,B.jsxs)(`button`,{onClick:()=>h(e.agentId),className:`grid grid-cols-[auto_1fr_auto] items-center gap-2 px-1.5 py-1 rounded border-0 cursor-pointer text-left ${t===0&&C.trim()?`bg-linen`:`bg-transparent hover:bg-linen/60`}`,title:`${e.agentId} · ${fd(e.role)} · ${e.project??``}`,children:[(0,B.jsx)(Lu,{id:e.agentId,role:e.role,size:16,state:e.reachability,active:e.active}),(0,B.jsxs)(`span`,{className:`min-w-0 truncate font-mono text-[12px] text-walnut`,children:[e.agentId,(0,B.jsxs)(`span`,{className:`text-tan`,children:[` · `,fd(e.role),e.project?` · ${e.project}`:``]})]}),_[e.agentId]?(0,B.jsxs)(`span`,{className:`font-mono text-[10px] text-ember`,children:[`★`,_[e.agentId]]}):null]},e.agentId)),k.length===0&&(0,B.jsx)(`span`,{className:`px-1.5 py-1 font-mono text-[11px] text-tan`,children:C.trim()?`no match`:`${o.length===1?`the only ${e||`bus`} agent is`:`all ${o.length} ${e||`bus`} agents are`} on the ring — type to search other projects`})]}),(0,B.jsxs)(`span`,{className:`font-mono text-[10px] text-tan px-1`,children:[`ring = aide + `,5,` most recent · Enter picks the first match`]})]})]}),(0,B.jsxs)(`button`,{onClick:()=>p?m(!1):f(e=>!e),title:`${l} · ${fd(u?.role)} — click to chat`,className:`absolute inset-0 rounded-full border-2 bg-paper shadow-panel cursor-pointer p-1 hover:scale-105 transition-transform`,style:{borderColor:dd(u?.role)},children:[(0,B.jsx)(Lu,{id:l,role:u?.role,size:40,state:u?.reachability??`dead`,active:u?.active}),_[l]?(0,B.jsx)(Ed,{n:_[l]}):b&&(0,B.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 w-3 h-3 rounded-full bg-ember border-2 border-paper`,title:`new message`})]}),(0,B.jsx)(`button`,{onClick:()=>m(e=>!e),"aria-pressed":p,title:`pick another agent`,className:`absolute -left-2 -top-2 w-6 h-6 rounded-full border border-dust shadow-panel cursor-pointer text-[13px] leading-none flex items-center justify-center ${p?`bg-walnut text-paper`:`bg-paper text-umber`}`,children:p?`×`:`+`})]}),(0,B.jsx)(`style`,{children:`.summon-dots{display:inline-flex;gap:3px}.summon-dots i{width:5px;height:5px;border-radius:50%;background:currentColor;opacity:.25;animation:summon-dot 1.2s infinite}.summon-dots i:nth-child(2){animation-delay:.2s}.summon-dots i:nth-child(3){animation-delay:.4s}@keyframes summon-dot{0%,80%,100%{opacity:.25}40%{opacity:1}}@keyframes summon-pop{from{transform:scale(.4);opacity:0}to{transform:scale(1);opacity:1}}@keyframes summon-pulse{0%,100%{box-shadow:0 0 0 0 rgba(200,120,42,.55)}50%{box-shadow:0 0 0 6px rgba(200,120,42,0)}}`})]})}function Ed({n:e,small:t=!1}){return(0,B.jsx)(`span`,{className:`absolute -top-1 -right-1 rounded-full bg-ember text-paper border-2 border-paper font-mono font-bold flex items-center justify-center leading-none ${t?`w-4 h-4 text-[9px]`:`w-5 h-5 text-[10px]`}`,title:`${e} decision${e===1?``:`s`} waiting on you`,style:{animation:`summon-pulse 1.6s ease-in-out infinite`},children:`★`})}var Dd=e=>{let t=Math.round(e/1e3);return t<60?`${t} s`:t<3600?`${Math.floor(t/60)} min`:`${Math.floor(t/3600)} h`},Od=(0,P.memo)(function({m:e,mine:t,maxed:n}){let r=String(e.text??``),i=e.prefix?r.replace(RegExp(`^${e.prefix}:?\\s*`),``):r;return(0,B.jsxs)(`div`,{className:`${e.pending?`opacity-70`:``} ${n?`max-w-[70%]`:`max-w-[88%]`} rounded-kit px-2.5 py-1.5 text-[12.5px] leading-snug whitespace-pre-wrap break-words border ${t?`justify-self-end bg-paper border-sand`:`justify-self-start bg-linen/70 border-sand/70`}`,children:[e.prefix&&(0,B.jsx)(Oa,{prefix:e.prefix}),(0,B.jsx)(nd,{text:i}),(0,B.jsx)(`div`,{className:`font-mono text-[10px] mt-0.5 ${t?`text-right`:``} ${e.failed?`text-brick`:`text-tan`}`,children:e.failed?`not sent · ${e.failed}`:e.pending?`sending…`:e.ts?new Date(e.ts).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):``})]})},(e,t)=>e.m===t.m&&e.mine===t.mine&&e.maxed===t.maxed);function kd({agentId:e,me:t,project:n,thread:r,answers:i=[],onAnswered:a,onClose:o,onSwitch:s}){let c=q(`/admin/bus-writes`,1e4).data?.enabled??!1,l=wd(n),[u,d]=(0,P.useState)(!0),f=`groundwork-console.summon.draft.${e}`,[p,m]=(0,P.useState)(()=>localStorage.getItem(f)??``),[h,g]=(0,P.useState)(null),_=e=>{m(e);try{e?localStorage.setItem(f,e):localStorage.removeItem(f)}catch{}};(0,P.useEffect)(()=>{m(localStorage.getItem(`groundwork-console.summon.draft.${e}`)??``)},[e]);let[v,y]=(0,P.useState)(!1),[b,x]=(0,P.useState)(()=>localStorage.getItem(`groundwork-console.summon.max`)===`1`),S=()=>x(e=>(localStorage.setItem(`groundwork-console.summon.max`,e?`0`:`1`),!e)),C=Qu({persistKey:`groundwork-console.summon.att.${e}`}),w=yd(n),T=new Set(za()),E=(0,P.useRef)(null),[D,O]=(0,P.useState)(0),[k,A]=(0,P.useState)(!0),j=k?$(p,D):null,M=(0,P.useRef)(null),N=(0,P.useCallback)(e=>{M.current=e},[]),ee=(0,P.useRef)(null),F=(0,P.useCallback)(e=>{let t=$(p,D);if(!t)return;let n=`${p.slice(0,t.start)}/${e} ${p.slice(D)}`,r=t.start+e.length+2;_(n),O(r),ee.current=r},[p,D]);(0,P.useEffect)(()=>{if(ee.current!==null&&E.current){let e=ee.current;ee.current=null,E.current.focus(),E.current.setSelectionRange(e,e)}},[p]);let I=(0,P.useRef)(null),[te,ne]=(0,P.useState)([]),re=r?.messages??[],L=e=>ie.current.get(`${e.text??``}`)??null,ie=(0,P.useRef)(new Map),R=te.filter(e=>!re.some(t=>t.from===`david`&&Number(t.ts??0)>=Number(e.ts??0)-2e3&&(t.text??``)===(e.text??``))),z=[...re,...R],ae=new Set,oe=(e,t)=>{let n=e.pending?String(e.id):(e.from===`david`?L(e):null)??e.id??`${e.ts??`t`}-${t}`;return ae.has(n)&&(n=e.id??`${n}-${t}`),ae.add(n),n},[se,ce]=(0,P.useState)(0);(0,P.useEffect)(()=>{let e=setInterval(()=>ce(e=>e+1),1e3);return()=>clearInterval(e)},[]);let le=(q(`/bus/agents`,4e3).data??[]).find(t=>t.agentId===e)??t,ue=le?.paneActivity?Date.now()-le.paneActivity:1/0,de=ue<2e4,fe=([...z].reverse().find(e=>e.from===`david`)?.ts??0)>([...z].reverse().find(e=>e.from!==`david`)?.ts??0),[pe,me]=(0,P.useState)(!0),he=()=>{let e=I.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<32;t!==pe&&me(t)};(0,P.useEffect)(()=>{pe&&I.current&&(I.current.scrollTop=I.current.scrollHeight)},[z.length,pe]);let ge=async()=>{if(!C.hasContent(p))return;g(`sending`);let t=p.trim(),n=T.has(t),r=n?t:t.startsWith(`/`)?`AGENT_ACTION: run ${t}`:t,o=n?t:C.withRefs(r),s=n?t:u?`${o}\n(context: ${l.cite})`:o,c={id:`local-${Date.now()}`,ts:Date.now(),from:`david`,to:e,text:s,prefix:null,pending:!0};ie.current.set(String(c.text??``),String(c.id)),ie.current.size>50&&ie.current.delete(ie.current.keys().next().value),ne(e=>[...e,c]),_(``),C.clear();try{let n=await Ia(`/actions/send`,{as:`david`,to:e,text:s,answers:i.length?i:void 0});if(n.status===`ok`)g(n.raw?n.delivery===`confirmed`?`${t} typed into the pane (delivery confirmed)`:n.warning??`${t}: delivery ${n.delivery??`unknown`}`:n.warning??null),a?.();else{let e=n.error??n.log?.slice(-1)[0]??`failed`;g(e),ne(t=>t.map(t=>t.id===c.id?{...t,failed:e}:t))}}catch(e){let t=e.message;g(t),ne(e=>e.map(e=>e.id===c.id?{...e,failed:t}:e))}},_e=(0,P.useMemo)(()=>z,[z]);return(0,B.jsxs)(B.Fragment,{children:[v&&(0,B.jsx)(id,{agentId:e,onClose:()=>y(!1)}),(0,B.jsxs)(`div`,{className:`fixed z-[54] bg-paper border border-sand rounded-kit shadow-panel grid grid-rows-[auto_minmax(0,1fr)_auto] whitespace-normal text-left transition-[width,height] duration-150 ${b?`right-5 bottom-[84px] w-[min(1100px,calc(100vw-40px))] h-[calc(100vh-110px)]`:`right-5 bottom-[84px] w-[min(400px,calc(100vw-40px))] h-[min(560px,calc(100vh-140px))]`}`,style:{borderTop:`3px solid ${dd(t?.role)}`},children:[(0,B.jsxs)(`div`,{className:`px-3 py-2 border-b border-sand flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(Lu,{id:e,role:t?.role,size:22,state:t?.reachability??`dead`,active:t?.active}),(0,B.jsx)(`span`,{className:`font-display font-bold text-[14px] text-umber truncate`,children:e}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.06em]`,style:{color:dd(t?.role)},children:fd(t?.role)}),t?(0,B.jsx)(G,{tone:t.reachability===`live`?`ok`:t.reachability===`idle`||t.reachability===`dormant`?`warn`:`bad`,children:t.active?`active`:t.reachability}):(0,B.jsx)(G,{tone:`bad`,children:`offline`}),(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[t?.pane&&(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:()=>y(!0),title:`open its pane`,children:`pane`}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:s,title:`summon another agent`,children:`switch`}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:S,title:b?`restore`:`maximize`,children:b?`⇲`:`⇱`}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:o,children:`✕`})]})]}),(0,B.jsxs)(`div`,{ref:I,onScroll:he,className:`min-h-0 overflow-auto overscroll-contain px-3 py-2 grid gap-1.5 content-start bg-cream/40`,children:[!r&&(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`loading thread…`}),r&&_e.length===0&&(0,B.jsxs)(`span`,{className:`text-[12px] text-umber`,children:[`No DMs with `,e,` yet. Say what you need — it lands in its pane via tmux-push.`]}),_e.map((e,t)=>(0,B.jsx)(Od,{m:e,mine:e.from===`david`,maxed:b},oe(e,t))),(de||fe)&&(0,B.jsx)(`div`,{className:`justify-self-start inline-flex items-center gap-2 px-2.5 py-1.5 rounded-kit border border-sand/70 bg-linen/50 font-mono text-[11px] text-ink3`,title:le?.paneActivity?`last pane output ${Math.round(ue/1e3)} s ago`:`no pane activity`,children:de?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`summon-dots`,"aria-hidden":!0,children:[(0,B.jsx)(`i`,{}),(0,B.jsx)(`i`,{}),(0,B.jsx)(`i`,{})]}),(0,B.jsxs)(`span`,{children:[e.split(`-`)[0],` is working`]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-tan`}),(0,B.jsxs)(`span`,{children:[`delivered · quiet for `,ue===1/0?`a while`:Dd(ue)]})]})})]}),(0,B.jsxs)(`div`,{className:`px-3 py-2 border-t border-sand grid gap-1.5`,children:[(0,B.jsxs)(`label`,{className:`flex items-center gap-1.5 font-mono text-[11px] text-ink3 min-w-0`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked)}),(0,B.jsx)(`span`,{className:`shrink-0`,children:`context:`}),(0,B.jsx)(`span`,{className:`truncate text-umber`,title:l.cite,children:l.label})]}),(0,B.jsxs)(`div`,{className:`relative grid grid-cols-[1fr_auto] gap-1.5 items-center`,children:[(0,B.jsx)(`textarea`,{ref:E,value:p,onChange:e=>{_(e.target.value),O(e.target.selectionStart??e.target.value.length),A(!0)},onClick:e=>O(e.target.selectionStart??0),onKeyUp:e=>O(e.target.selectionStart??0),onKeyDown:e=>{if(j&&M.current&&M.current(e)){e.preventDefault();return}e.key===`Enter`&&!e.shiftKey&&c&&(e.preventDefault(),ge())},onPaste:C.onPaste,onDrop:C.onDrop,onDragOver:C.onDragOver,disabled:!c,rows:b?4:2,placeholder:c?`DM ${e} as david — Enter to send, ⇧Enter newline, paste images`:`bus writes are off (header badge)`,className:`text-[13px] px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut resize-none min-w-0`}),(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:ge,disabled:!c||!C.hasContent(p)||C.busy||h===`sending`,children:h===`sending`?`…`:`Send`}),j&&c&&(0,B.jsx)(bd,{skills:w,query:j.query,onPick:F,onClose:()=>A(!1),bind:N})]}),(0,B.jsx)($u,{a:C}),T.has(p.trim())?(0,B.jsxs)(`div`,{className:`font-mono text-[11px] text-ink3`,children:[(0,B.jsx)(`span`,{className:`text-umber`,children:p.trim()}),` is sent `,(0,B.jsx)(`b`,{children:`raw`}),` (no banner, no context) via the bus send_command — the agent's CLI runs it; delivery is confirmed by its pusher`]}):p.trim().startsWith(`/`)&&(0,B.jsxs)(`div`,{className:`font-mono text-[11px] text-ink3`,children:[`sends as `,(0,B.jsxs)(`span`,{className:`text-umber`,children:[`AGENT_ACTION: run `,p.trim().split(/\s/)[0],` …`]}),` — the bus pusher drops raw leading-slash DMs (only the MCP's allowlist — `,[...T].join(` `),` — goes raw); the agent runs the skill from the request`]}),h&&h!==`sending`&&(0,B.jsx)(`div`,{className:`font-mono text-[11px] ${/delivery confirmed/.test(h)?`text-leaf`:`text-brick`}`,children:h})]})]})]})}var Ad={h:`/`,b:`/board`,m:`/monitor`,u:`/bus`,d:`/docs`,g:`/git`,o:`/ops`},jd=e=>{let t=e;return!!t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable)};function Md(){let e=ar(),[t,n]=(0,P.useState)(!1);return(0,P.useEffect)(()=>{let t=0,r=r=>{if(!(r.metaKey||r.ctrlKey||r.altKey||jd(r.target))){if(r.key===`Escape`){n(!1);return}if(r.key===`?`){n(e=>!e);return}if(r.key===`/`){r.preventDefault(),xd(``);return}if(r.key===`g`&&!(Date.now()-t<900)){t=Date.now();return}Date.now()-t<900&&Ad[r.key]&&(r.preventDefault(),e(Ad[r.key]),t=0)}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e]),t?(0,B.jsx)(`div`,{className:`fixed inset-0 z-[70] bg-walnut/30 flex items-center justify-center`,onMouseDown:()=>n(!1),children:(0,B.jsxs)(`div`,{className:`bg-paper border border-sand rounded-kit shadow-panel p-4 grid gap-2 min-w-[320px]`,onMouseDown:e=>e.stopPropagation(),children:[(0,B.jsx)(`div`,{className:`font-display font-bold text-[15px] text-umber`,children:`Keyboard`}),[[`/`,`summon an agent (picker)`],[`g h`,`Home`],[`g b`,`Board`],[`g m`,`Monitor`],[`g u`,`Bus`],[`g d`,`Docs`],[`g g`,`Git`],[`g o`,`Ops`],[`Esc`,`close drawer / picker / this`],[`?`,`toggle this list`]].map(([e,t])=>(0,B.jsxs)(`div`,{className:`grid grid-cols-[64px_1fr] gap-3 items-baseline text-[13px]`,children:[(0,B.jsx)(`kbd`,{className:`font-mono text-[12px] px-1.5 py-0.5 border border-dust rounded bg-cream text-walnut justify-self-start`,children:e}),(0,B.jsx)(`span`,{className:`text-umber`,children:t})]},e)),(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-tan mt-1`,children:`In the Summon drawer: Enter sends · ⇧Enter newline · paste images.`})]})}):null}var Nd=`/api`;function Pd({children:e}){let[t,n]=(0,P.useState)(`checking`),[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(null),[s,c]=(0,P.useState)(!1),l=async()=>{try{let e=await(await fetch(`${Nd}/auth/status`)).json();n(e.authed?`in`:`out`)}catch{n(`offline`)}};(0,P.useEffect)(()=>{l()},[]),(0,P.useEffect)(()=>{t!==`in`&&fetch(`${Nd}/health`).then(e=>e.json()).then(e=>{document.title=e.hostname?`Sign in · ${e.hostname}`:`Sign in · Groundwork Console`}).catch(()=>{document.title=`Sign in · Groundwork Console`})},[t]),(0,P.useEffect)(()=>{let e=()=>n(`out`);return window.addEventListener(`groundwork-console:unauthorized`,e),()=>window.removeEventListener(`groundwork-console:unauthorized`,e)},[]);let u=async()=>{c(!0),o(null);try{let e=await fetch(`${Nd}/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:r})}),t=await e.json();if(!e.ok)throw Error(t.error??`${e.status}`);i(``),n(`in`)}catch(e){o(e.message)}finally{c(!1)}};return t===`in`?(0,B.jsx)(B.Fragment,{children:e}):t===`checking`?(0,B.jsx)(`div`,{className:`min-h-screen grid place-items-center font-mono text-[12px] text-tan`,children:`checking session…`}):(0,B.jsx)(`div`,{className:`min-h-screen grid place-items-center bg-cream p-6`,children:(0,B.jsxs)(`div`,{className:`w-[380px] bg-paper border border-sand rounded-kit shadow-panel`,children:[(0,B.jsxs)(`div`,{className:`px-5 py-4 border-b border-sand flex items-center gap-2 font-display font-bold text-[18px] text-ember`,children:[(0,B.jsx)(Pa,{}),` Groundwork Console`]}),(0,B.jsx)(`div`,{className:`p-5 grid gap-3 text-[13px]`,children:t===`offline`?(0,B.jsxs)(`div`,{className:`text-brick`,children:[`API unreachable — start it with `,(0,B.jsx)(`code`,{children:`pnpm dev:api`}),`, then `,(0,B.jsx)(`button`,{className:`underline border-0 bg-transparent p-0 cursor-pointer text-ember-deep`,onClick:l,children:`retry`}),`.`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`text-umber`,children:[`This console can write to your bus and docs. Enter the console token — it's in `,(0,B.jsx)(`code`,{className:`font-mono text-[12px]`,children:`~/.groundwork-console/token`}),` on the machine running the API (or `,(0,B.jsx)(`code`,{className:`font-mono text-[12px]`,children:`GROUNDWORK_CONSOLE_TOKEN`}),`).`]}),(0,B.jsx)(`input`,{type:`password`,autoFocus:!0,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&r&&u()},placeholder:`token`,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`}),a&&(0,B.jsx)(`div`,{className:`text-brick`,children:a}),(0,B.jsx)(K,{tone:`primary`,onClick:u,disabled:!r||s,children:s?`Signing in…`:`Sign in`}),(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-tan`,children:`Cookie lasts 30 days on this browser. Single shared token — no accounts.`})]})})]})})}var Fd=[{to:`/`,label:`Home`,icon:`home`},{to:`/board`,label:`Board`,icon:`board`},{to:`/bus`,label:`Bus`,icon:`bus`},{to:`/monitor`,label:`Monitor`,icon:`monitor`},{to:`/docs`,label:`Docs`,icon:`docs`},{to:`/git`,label:`Git`,icon:`git`},{to:`/ops`,label:`Ops`,icon:`fleet`}];function Id(){let{error:e}=Ha(),{running:t}=Ga(),n=q(`/bus/unread`,3e4).data?.inbox??0,r=q(`/kit`).data,i=q(`/health`,6e4).data,a=i?.hostname,o=!!i?.version&&i.version!==`0.1.14`,s=rr();(0,P.useEffect)(()=>{let e=s.pathname===`/`?``:s.pathname.split(`/`)[1],t=Fd.find(t=>t.to===`/`?e===``:t.to===`/${e}`)?.label??(e?e[0].toUpperCase()+e.slice(1):`Home`);document.title=a?`${t} · ${a}`:t},[s.pathname,a]);let c=r?.packages?`${r.name} ${r.kitVersion} · seam ${r.packages.seam?.version} · mcp ${r.packages.mcp?.version}`:`kit · offline`;return(0,B.jsx)(Pd,{children:(0,B.jsx)(Mu,{children:(0,B.jsxs)(`div`,{className:`grid grid-rows-[48px_auto_1fr] min-h-screen`,children:[(0,B.jsxs)(`header`,{className:`grid grid-cols-[auto_auto_1fr] items-center gap-4 px-4 border-b border-sand bg-cream min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 font-display font-bold text-[16px] text-ember whitespace-nowrap`,title:c,children:[(0,B.jsx)(Pa,{}),` Groundwork Console`]}),(0,B.jsx)(`nav`,{className:`flex gap-0.5 whitespace-nowrap`,children:Fd.map(e=>(0,B.jsxs)(ji,{to:e.to===`/bus`&&n>0?`/bus?view=inbox`:e.to,end:e.to===`/`,className:({isActive:e})=>`inline-flex items-center gap-1.5 px-3 py-2 rounded-kit font-medium ${e?`bg-paper text-walnut shadow-[inset_0_0_0_1px_var(--color-sand)]`:`text-umber hover:no-underline hover:bg-linen`}`,children:[(0,B.jsx)(`span`,{className:`text-tan`,children:wa[e.icon]({size:16})}),(0,B.jsx)(`span`,{className:`hidden xl:inline`,children:e.label}),e.to===`/ops`&&t>0?(0,B.jsxs)(`span`,{className:`ml-1.5 inline-flex items-center gap-1 text-amber`,children:[(0,B.jsx)(Na,{size:12}),(0,B.jsx)(G,{tone:`warn`,children:t})]}):null,e.to===`/bus`&&n>0?(0,B.jsx)(`span`,{className:`ml-1.5 inline-flex`,title:`${n} unread DM(s) to david`,children:(0,B.jsx)(G,{tone:`david`,children:n})}):null,e.badge?(0,B.jsx)(`span`,{className:`ml-1.5 inline-flex`,children:(0,B.jsx)(G,{tone:`david`,children:e.badge})}):null]},e.to))}),(0,B.jsxs)(`div`,{className:`flex gap-0.5 items-center justify-end min-w-0 whitespace-nowrap`,children:[e&&(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-brick mr-2`,title:e,children:`api offline`}),(0,B.jsx)(Ja,{}),(0,B.jsx)(Qa,{}),(0,B.jsx)(Za,{}),o&&(0,B.jsxs)(`button`,{onClick:()=>location.reload(),className:`mr-1 font-mono text-[11px] px-2 py-1 rounded-full bg-amber-wash text-amber border border-amber-line cursor-pointer`,title:`this tab runs 0.1.14, the API is ${i?.version} — reload to get the new UI`,children:[`new version `,i?.version,` — reload`]}),(0,B.jsx)(so,{}),(0,B.jsx)(`button`,{onClick:async()=>{await fetch(`/api/auth/logout`,{method:`POST`}),window.dispatchEvent(new Event(`groundwork-console:unauthorized`))},className:`ml-1 font-mono text-[11px] text-tan border-0 bg-transparent cursor-pointer hover:text-umber`,title:`sign out (clears the session cookie)`,children:`⎋`})]})]}),(0,B.jsx)(hd,{}),(0,B.jsx)(Rr,{}),(0,B.jsx)(co,{}),(0,B.jsx)(Td,{}),(0,B.jsx)(Md,{})]})})})}function Ld(e,t=Date.now()){let n=Math.max(0,(t-e)/1e3)/60,r=n/60,i=r/24;if(n<1)return`just now`;if(r<1)return`${Math.floor(n)} min ago`;if(i<1)return`${Math.floor(r)} h ago`;if(i<2)return`yesterday`;if(i<7)return`${Math.floor(i)} days ago`;let a=i/7;if(a<2)return`last week`;if(i<30)return`${Math.floor(a)} weeks ago`;let o=i/30;return o<2?`last month`:i<365?`${Math.floor(o)} months ago`:i<730?`last year`:`${Math.floor(i/365)} years ago`}function Rd(e,t=Date.now()){let n=(t-e)/864e5;return n<1?`text-tan`:n<7?`text-amber`:`text-brick font-semibold`}var zd=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),Bd=e=>!!e&&Ea.includes(e),Vd={"state.fact.stale":`warn`,"state.board.malformed":`bad`,"state.decision.open":`david`,"state.phase.active":`neutral`,"phase.completed":`ok`,"phase.started":`ok`,"phase.progress":`neutral`,"done.appended":`ok`,"queue.item.added":`neutral`,"queue.item.closed":`ok`,"fact.stale":`warn`,"board.malformed":`bad`,"decision.posted":`david`};function Hd(){let{data:e,refresh:t}=q(`/events?limit=40`,15e3),[n,r]=(0,P.useState)(!1),[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(!1),c=async(e,n)=>{s(!0);try{await Ia(`/events/config`,{rule:e,enabled:n}),t()}finally{s(!1)}},l=async e=>{s(!0);try{await Ia(`/events/config`,{dryRun:e,confirm:e?void 0:i}),t(),r(!1),a(``)}finally{s(!1)}},[u,d]=(0,P.useState)([]);(0,P.useEffect)(()=>{let e=new EventSource(`/api/events/stream`);return e.onmessage=e=>{let t=JSON.parse(e.data);t.type!==`hello`&&d(e=>{let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=e.slice();return r[n]=t,r}return[t,...e].slice(0,40)})},()=>e.close()},[]);let f=[...u,...(e?.recent??[]).filter(e=>!u.some(t=>t.id===e.id)).slice().reverse()].slice(0,40),p=e?.config;return(0,B.jsxs)(U,{children:[(0,B.jsxs)(W,{title:`Events`,icon:`health`,path:p?`${p.identity.displayName??p.identity.agentId} · ${p.rules.filter(e=>e.enabled).length}/${p.rules.length} rules enabled · dedupe ${p.limits?.dedupeTtlHours??72} h · max ${p.limits?.maxPerRulePerProjectPerHour??3}/h`:`detector`,children:[p&&(p.live?(0,B.jsx)(G,{tone:`bad`,children:`LIVE — sending`}):p.dryRun?(0,B.jsx)(G,{tone:`outline`,children:`dry-run`}):(0,B.jsx)(G,{tone:`warn`,children:`armed · bus writes off`})),p&&(p.dryRun?(0,B.jsx)(K,{size:`sm`,onClick:()=>r(!0),disabled:o,children:`Go live…`}):(0,B.jsx)(K,{size:`sm`,onClick:()=>l(!0),disabled:o,children:`Back to dry-run`}))]}),p&&(0,B.jsxs)(`div`,{className:`px-3 py-2 border-b border-sand grid gap-1`,children:[p.rules.map(e=>(0,B.jsxs)(`label`,{className:`grid grid-cols-[auto_1fr] gap-2 items-baseline font-mono text-[12px] text-ink3 cursor-pointer`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:!!e.enabled,disabled:o||e.action.type===`none`,onChange:t=>c(e.id,t.target.checked),title:e.action.type===`none`?`informational rule — nothing to send`:`enable this rule`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`text-walnut`,children:e.on}),` → `,e.action.type===`none`?(0,B.jsx)(`span`,{className:`text-tan`,children:e.action.note}):(0,B.jsxs)(B.Fragment,{children:[e.action.to?e.action.to:`#${e.action.room}`,` · `,Bd(e.action.prefix)&&(0,B.jsx)(Oa,{prefix:e.action.prefix}),(0,B.jsx)(`span`,{className:`text-umber`,children:e.action.text})]})]})]},e.id)),(0,B.jsxs)(`div`,{className:`text-[11px] font-mono text-tan`,children:[`a rule sends only when: bus writes ON (header) · dry-run OFF · rule enabled · not a duplicate (key, `,p.limits?.dedupeTtlHours??72,` h) · under the rate limit · a live coordinator exists for the project. Baseline state.* events never trigger rules.`]})]}),n&&(0,B.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-walnut/30 flex items-start justify-center pt-[12vh]`,onMouseDown:e=>{e.target===e.currentTarget&&r(!1)},children:(0,B.jsxs)(`div`,{className:`w-[520px] bg-paper border border-brick rounded-kit shadow-panel`,children:[(0,B.jsx)(`div`,{className:`px-4 py-3 border-b border-sand font-display font-bold text-[18px] text-brick`,children:`Turn dry-run off`}),(0,B.jsxs)(`div`,{className:`p-4 grid gap-3 text-[13px] text-umber`,children:[(0,B.jsxs)(`div`,{children:[`Enabled rules will really `,(0,B.jsx)(`code`,{children:`send_message`}),` as `,(0,B.jsx)(`b`,{className:`text-walnut`,children:`groundwork-console`}),` (automation) whenever bus writes are on. Dedupe + rate limit apply; every send is a Run. Persisted in `,(0,B.jsx)(`code`,{children:`groundwork-console.rules.json`}),`.`]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Type LIVE to confirm`}),(0,B.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]})]}),(0,B.jsxs)(`div`,{className:`px-4 py-3 border-t border-sand flex justify-end gap-2`,children:[(0,B.jsx)(K,{size:`sm`,onClick:()=>r(!1),children:`Cancel`}),(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:()=>l(!1),disabled:i!==`LIVE`||o,children:`Go live`})]})]})}),f.length===0&&(0,B.jsx)(`div`,{className:`px-3 py-3 text-[13px] text-umber`,children:`Watching seam files + rooms every 15 s. Nothing dirty at baseline and nothing changed since.`}),f.map(e=>(0,B.jsxs)(`div`,{className:`grid grid-cols-[var(--spacing-gutter)_1fr] border-b border-sand last:border-b-0`,children:[(0,B.jsx)(`div`,{className:`py-2.5 flex justify-center font-mono text-[12px] text-tan border-r border-sand`,children:`⚡`}),(0,B.jsxs)(`div`,{className:`px-3 pt-2 pb-2.5 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex gap-2 items-baseline mb-0.5 flex-wrap`,children:[(0,B.jsx)(G,{tone:Vd[e.type]??`neutral`,children:e.type}),e.data.baseline?(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`baseline · no action`}):null,(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-umber`,children:e.project}),(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-ink3`,children:zd(e.ts)})]}),(0,B.jsx)(`div`,{className:`font-mono text-[12px] text-umber break-all`,children:Object.entries(e.data).filter(([e])=>![`project`,`room`].includes(e)).map(([e,t])=>`${e}=${String(t)}`).join(` · `)}),e.actions.filter(e=>e.type!==`none`).map(e=>(0,B.jsxs)(`div`,{className:`mt-1 text-[13px] pl-2 border-l-2 ${e.sent?`border-leaf`:e.skipped?`border-amber`:`border-dust`}`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.06em] mr-1.5 ${e.sent?`text-leaf`:e.skipped?`text-amber`:`text-tan`}`,children:e.sent?`sent`:e.skipped?`skipped · ${e.skipped}`:e.dryRun?`would send`:`sending`}),Bd(e.prefix)&&(0,B.jsx)(Oa,{prefix:e.prefix}),(0,B.jsx)(`span`,{className:`text-walnut`,children:e.text}),` `,(0,B.jsxs)(`span`,{className:`font-mono text-[12px] text-ink3`,children:[`→ `,e.to??`#${e.room}`]}),e.runId&&(0,B.jsx)(`span`,{className:`ml-2 font-mono text-[11px] text-tan`,children:e.runId})]},e.ruleId))]})]},e.id))]})}function Ud(){let{data:e}=q(`/events?limit=40`,3e4),t=e?.config;if(!t)return null;let n=t.rules.filter(e=>e.enabled).length,r=Date.now()-864e5,i=(e?.recent??[]).filter(e=>e.ts>r).flatMap(e=>e.actions).filter(e=>e.sent).length;return(0,B.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-[11px] text-ink3 px-1`,children:[(0,B.jsx)(`span`,{className:`uppercase tracking-[.1em] text-tan`,children:`events`}),t.live?(0,B.jsx)(G,{tone:`bad`,children:`live`}):t.dryRun?(0,B.jsx)(G,{tone:`outline`,children:`dry-run`}):(0,B.jsx)(G,{tone:`warn`,children:`armed · bus writes off`}),(0,B.jsxs)(`span`,{children:[n,`/`,t.rules.length,` rules on · `,i,` sent in 24 h`]}),(0,B.jsx)(V,{to:`/ops/events`,className:`ml-auto text-ember-deep`,children:`Ops → Events`})]})}var Wd={complete:{label:`complete`,tone:`ok`,dot:`bg-leaf border-leaf`,ring:`text-leaf`,hint:`all tasks ticked`},ongoing:{label:`ongoing`,tone:`david`,dot:`bg-ember border-ember`,ring:`text-ember`,hint:`streams in flight or tasks ticked`},planned:{label:`planned`,tone:`neutral`,dot:`bg-paper border-umber`,ring:`text-umber`,hint:`tasks written, none started`},pending:{label:`pending`,tone:`outline`,dot:`bg-paper border-dust border-dashed`,ring:`text-tan`,hint:`no PHASE*_TASKS.md yet — run /plan-phase`}};function Gd({pct:e,cls:t,size:n=44}){let r=(n-6)/2,i=2*Math.PI*r;return(0,B.jsxs)(`svg`,{width:n,height:n,viewBox:`0 0 ${n} ${n}`,className:t,"aria-hidden":!0,children:[(0,B.jsx)(`circle`,{cx:n/2,cy:n/2,r,fill:`none`,stroke:`currentColor`,strokeOpacity:`.18`,strokeWidth:`4`}),(0,B.jsx)(`circle`,{cx:n/2,cy:n/2,r,fill:`none`,stroke:`currentColor`,strokeWidth:`4`,strokeLinecap:`round`,strokeDasharray:`${e/100*i} ${i}`,transform:`rotate(-90 ${n/2} ${n/2})`})]})}function Kd({project:e,phases:t,canWrite:n,prd:r}){let i=q(`/projects/${e}/agents`,3e4).data,[a,o]=(0,P.useState)(null),[s,c]=(0,P.useState)(null),[l,u]=(0,P.useState)(null),d=`groundwork-console.roadmap.last.${e}`,[f,p]=(0,P.useState)(()=>{try{return JSON.parse(localStorage.getItem(d)??`{}`)}catch{return{}}}),m=(e,t,n)=>p(r=>{let i={...r,[e]:{verb:t,to:n,ts:Date.now()}};return localStorage.setItem(d,JSON.stringify(i)),i}),h=e=>{let t=Math.floor((Date.now()-e)/6e4);return t<1?`just now`:t<60?`${t} min ago`:`${Math.floor(t/60)} h ago`},g=async(t,r)=>{if(!n){c(`bus writes are off — click the header badge (read-only · v0.1) and type ENABLE, then retry`);return}if(r===`plan`&&!i?.aide){c(`no live aide for ${e} — start one (coord-aide) in #room, or DM the coordinator from Bus`);return}if(r!==`plan`&&!i?.coordinator){c(`no live coordinator for ${e}`);return}o(`${t.id}:${r}`),c(null);try{let n=await Ia(`/actions/phase/${e}/${t.id}/${r}`),i=n.args?.to??``;n.status===`ok`&&m(t.id,r,i),c(n.status===`ok`?`sent → ${i}`:n.error??n.log?.slice(-1)[0]??`failed`)}catch(e){c(e.message)}finally{o(null)}},_=async t=>{if(!n){c(`bus writes are off — switch them on in the header, then retry`);return}o(t),c(null);try{let n=await Ia(`/actions/project/${e}/${t}`),r=n.args?.to??``;c(n.status===`ok`?`sent → ${r} — continue in its thread`:n.error??n.log?.slice(-1)[0]??`failed`),n.status===`ok`&&r&&xd(r)}catch(e){c(e.message)}finally{o(null)}},v=t.filter(e=>e.state===`complete`).length,y=t.find(e=>e.state===`ongoing`)??t.find(e=>e.state===`planned`)??t.find(e=>e.state===`pending`);return(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`Roadmap`,icon:`phases`,eyebrow:`PRODUCTION_ROADMAP · phases/`,path:`${v}/${t.length} complete${y?` · next: ${y.title}`:``}`,children:(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 flex-wrap`,children:[i?.aide?(0,B.jsx)(ld,{id:i.aide,prefix:`aide`}):(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`no live aide`}),i?.coordinator?(0,B.jsx)(ld,{id:i.coordinator,prefix:`coord`}):(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`no live coordinator`})]})}),t.length===0&&(0,B.jsxs)(`div`,{className:`px-3 py-3 grid gap-2 text-[13px]`,children:[r==null?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`text-walnut`,children:[`No PRD yet. The roadmap starts from `,(0,B.jsx)(`code`,{children:`docs/PRD.md`}),` — write it with your aide (it runs `,(0,B.jsx)(`code`,{children:`/create-prd`}),` and asks you what it needs).`]}),(0,B.jsxs)(`div`,{className:`flex gap-2 items-center flex-wrap`,children:[(0,B.jsx)(K,{size:`sm`,tone:`primary`,disabled:!!a||!i?.aide,title:i?.aide?`DM ${i.aide}: run /create-prd with me`:`no live aide — spawn one under Ops → Fleets`,onClick:()=>_(`create-prd`),children:a===`create-prd`?(0,B.jsx)(Na,{size:12}):`Write the PRD with the aide`}),i?.aide&&(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:()=>xd(i.aide),children:`Open the aide's thread`}),!i?.aide&&(0,B.jsx)(V,{to:`/ops/fleets`,className:`hover:no-underline`,children:(0,B.jsx)(K,{size:`sm`,children:`Spawn aide`})})]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`text-walnut`,children:[`PRD is `,(0,B.jsx)(`b`,{children:r.status??`present`}),r.roadmap?` and a roadmap exists`:``,` — no `,(0,B.jsx)(`code`,{children:`docs/phases/`}),` yet. Kickstart builds the roadmap + doc scaffold (roadmap, tech stack, architecture, decisions, workstreams, queue, done, facts); phases follow with `,(0,B.jsx)(`code`,{children:`/plan-phase 1`}),`.`]}),(0,B.jsxs)(`div`,{className:`flex gap-2 items-center flex-wrap`,children:[(0,B.jsx)(K,{size:`sm`,tone:`primary`,disabled:!!a||!i?.aide,title:i?.aide?`DM ${i.aide}: run /kickstart in ${e}`:`no live aide — spawn one under Ops → Fleets`,onClick:()=>_(`kickstart`),children:a===`kickstart`?(0,B.jsx)(Na,{size:12}):`Kickstart with the aide`}),i?.aide&&(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:()=>xd(i.aide),children:`Open the aide's thread`}),!i?.aide&&(0,B.jsx)(V,{to:`/ops/fleets`,className:`hover:no-underline`,children:(0,B.jsx)(K,{size:`sm`,children:`Spawn aide`})})]})]}),s&&(0,B.jsx)(`div`,{className:`font-mono text-[12px] ${/^sent/.test(s)?`text-leaf`:`text-brick`}`,children:s})]}),t.length>0&&(0,B.jsxs)(`div`,{className:`px-3 pt-3 pb-2 min-w-0`,children:[(0,B.jsx)(`div`,{className:`overflow-x-auto overscroll-x-contain [scrollbar-width:thin]`,children:(0,B.jsx)(`ol`,{className:`flex items-start gap-0 min-w-max`,children:t.map((e,n)=>{let r=Wd[e.state],i=e.total?Math.round(e.done/e.total*100):0,o=n===t.length-1;return(0,B.jsxs)(`li`,{className:`flex items-start`,children:[(0,B.jsxs)(`div`,{className:`w-[190px] grid gap-1.5 justify-items-center text-center`,children:[(0,B.jsxs)(`button`,{onClick:()=>u(t=>t===e.id?null:e.id),className:`relative border-0 bg-transparent p-0 cursor-pointer rounded-full ${l===e.id?`ring-2 ring-ember ring-offset-2 ring-offset-paper`:``}`,title:`show tasks`,children:[(0,B.jsx)(Gd,{pct:e.state===`complete`?100:i,cls:r.ring}),(0,B.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center font-mono font-bold text-[12px] ${r.ring}`,children:e.state===`complete`?`✓`:e.n})]}),(0,B.jsx)(`button`,{onClick:()=>u(t=>t===e.id?null:e.id),className:`font-semibold text-[13px] leading-tight line-clamp-2 px-1 border-0 bg-transparent cursor-pointer text-walnut hover:text-ember-deep`,title:e.title,children:e.title}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(G,{tone:r.tone,children:r.label}),(0,B.jsxs)(`span`,{className:`font-mono text-[11px] text-ink3`,children:[e.total?`${e.done}/${e.total}`:`—`,e.streams?` · ${e.streams} stream${e.streams===1?``:`s`}`:``]})]}),f[e.id]&&(0,B.jsxs)(`div`,{className:`font-mono text-[10px] text-ink3 flex items-center gap-1 justify-center flex-wrap`,title:new Date(f[e.id].ts).toLocaleString(),children:[(0,B.jsx)(`span`,{className:`uppercase tracking-[.06em]`,children:f[e.id].verb===`kickoff`?`kicked off`:f[e.id].verb===`plan`?`plan requested`:`audit requested`}),(0,B.jsx)(`span`,{children:`→`}),(0,B.jsx)(ld,{id:f[e.id].to,bare:!0}),(0,B.jsx)(`span`,{className:`text-tan`,children:h(f[e.id].ts)})]}),(0,B.jsxs)(`div`,{className:`flex gap-1 flex-wrap justify-center`,children:[(e.tasks||e.readme)&&(0,B.jsx)(V,{to:`/docs/${encodeURIComponent(e.tasks??e.readme)}`,className:`hover:no-underline`,children:(0,B.jsx)(K,{size:`sm`,tone:`ghost`,children:`Open`})}),e.state===`pending`&&(0,B.jsx)(K,{size:`sm`,tone:`primary`,disabled:!!a,title:`DM the aide: run /plan-phase`,onClick:()=>g(e,`plan`),children:a===`${e.id}:plan`?(0,B.jsx)(Na,{size:12}):`Plan`}),e.state===`planned`&&(0,B.jsx)(K,{size:`sm`,tone:`primary`,disabled:!!a,title:`GO to the coordinator`,onClick:()=>g(e,`kickoff`),children:a===`${e.id}:kickoff`?(0,B.jsx)(Na,{size:12}):`Kick off`}),e.state===`ongoing`&&(0,B.jsx)(K,{size:`sm`,disabled:!!a,title:`ask the coordinator to run /coord-audit`,onClick:()=>g(e,`audit`),children:a===`${e.id}:audit`?(0,B.jsx)(Na,{size:12}):`Audit`})]})]}),!o&&(0,B.jsx)(`div`,{className:`mt-[21px] h-[3px] w-6 rounded ${e.state===`complete`?`bg-leaf`:`bg-sand`}`})]},e.id)})})}),l&&(0,B.jsx)(Ju,{project:e,phase:t.find(e=>e.id===l),onClose:()=>u(null)}),s&&(0,B.jsx)(`div`,{className:`mt-2 font-mono text-[12px] flex items-center gap-2 ${/^sent/.test(s)?`text-leaf`:`text-brick`}`,children:/^sent → /.test(s)?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:`sent →`}),(0,B.jsx)(ld,{id:s.replace(/^sent → /,``),bare:!0})]}):s}),(0,B.jsx)(`div`,{className:`mt-2 font-mono text-[11px] text-tan flex gap-3 flex-wrap`,children:Object.keys(Wd).map(e=>(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full border mr-1 align-middle ${Wd[e].dot}`}),Wd[e].label,` — `,Wd[e].hint]},e))})]})]})}function qd({phases:e}){return e?.length?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:e.map(e=>`${e.n}: ${e.state}${e.total?` ${e.done}/${e.total}`:``}`).join(` · `),children:[e.map((e,t)=>(0,B.jsx)(`span`,{className:`inline-block w-2.5 h-2.5 rounded-full border ${Wd[e.state].dot}`},t)),(0,B.jsxs)(`span`,{className:`ml-1 font-mono text-[11px] text-ink3`,children:[e.filter(e=>e.state===`complete`).length,`/`,e.length]})]}):(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`no phases`})}function Jd({project:e,canWrite:t,onClose:n,initialRole:r}){let{data:i}=q(`/actions/spawn/options?project=${encodeURIComponent(e)}`),[a,o]=(0,P.useState)(r??`worker`),[s,c]=(0,P.useState)(`claude`),[l,u]=(0,P.useState)(``),[d,f]=(0,P.useState)(``),[p,m]=(0,P.useState)(``),[h,g]=(0,P.useState)(``),[_,v]=(0,P.useState)(8),[y,b]=(0,P.useState)(!1),[x,S]=(0,P.useState)(null),[C,w]=(0,P.useState)(null),T=ar(),{runs:E}=Ga(),D=x?E.find(e=>e.id===x.id)??x:null;(0,P.useEffect)(()=>{i&&!l&&u(i.suggest[a]??``)},[i,a,l]),(0,P.useEffect)(()=>{i&&u(i.suggest[a]??``)},[a]);let O=async()=>{b(!0),w(null);try{let t=await Ia(`/actions/spawn`,{project:e,role:a,harness:s,agentId:l,lane:d||void 0,model:p||void 0,note:h||void 0,waitSeconds:_});if(!t.status)throw Error(t.error??`failed`);S(t)}catch(e){w(e.message)}finally{b(!1)}},k=i?.roles.find(e=>e.id===a)?.skill??``;return(0,B.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-walnut/30 flex items-start justify-center pt-[8vh] whitespace-normal text-left`,onMouseDown:e=>{e.target===e.currentTarget&&!y&&n()},children:(0,B.jsxs)(`div`,{className:`w-[640px] bg-paper border border-sand rounded-kit shadow-panel`,children:[(0,B.jsxs)(`div`,{className:`px-4 py-3 border-b border-sand font-display font-bold text-[18px] text-umber`,children:[`Spawn agent · `,e]}),(0,B.jsxs)(`div`,{className:`p-4 grid gap-3 text-[13px]`,children:[(0,B.jsxs)(`div`,{className:`flex gap-1.5 flex-wrap items-center text-umber`,children:[(0,B.jsx)(G,{tone:t?`warn`:`outline`,children:t?`bus writes on`:`bus writes OFF`}),(0,B.jsxs)(`span`,{children:[`tmux window `,(0,B.jsxs)(`code`,{children:[`fleet-`,e]}),` · cwd `,(0,B.jsx)(`code`,{children:i?.repoPath?.replace(/^\/Users\/[^/]+/,`~`)}),i?.room?(0,B.jsxs)(B.Fragment,{children:[` · room `,(0,B.jsxs)(`code`,{children:[`#`,i.room]})]}):` · no room linked`]})]}),!t&&(0,B.jsx)(`div`,{className:`text-brick`,children:`Turn on bus writes (header toggle) first — spawning launches a process and types the role invocation into the new pane.`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Role · playbook card`}),(0,B.jsx)(`select`,{value:a,onChange:e=>o(e.target.value),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`,children:(i?.roles??[]).map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.id,` · `,e.skill]},e.id))})]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Harness`}),(0,B.jsx)(`select`,{value:s,onChange:e=>c(e.target.value),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`,children:(i?.harnesses??[]).map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.id,` · `,e.cmd]},e.id))})]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Agent id`}),(0,B.jsx)(`input`,{value:l,onChange:e=>u(e.target.value.trim()),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]}),a===`worker`?(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Lane`}),(0,B.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:`repo-owner · rendering · api`,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]}):(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Model (Claude only, optional)`}),(0,B.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),placeholder:`claude-sonnet-4-6`,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]})]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Extra instruction (optional, injected after the skill)`}),(0,B.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`e.g. mission: re-verify the design doc after PR4`,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3 text-umber`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Start wait`}),(0,B.jsx)(`input`,{type:`range`,min:3,max:30,value:_,onChange:e=>v(Number(e.target.value))}),(0,B.jsxs)(`span`,{className:`font-mono text-[12px]`,children:[_,` s`]}),(0,B.jsx)(`span`,{className:`text-[12px]`,children:`before injecting the skill`})]}),(0,B.jsxs)(`div`,{className:`font-mono text-[12px] text-ink3 bg-linen rounded px-2 py-1.5`,children:[`will type: `,(0,B.jsx)(`b`,{className:`text-walnut`,children:i?.harnesses.find(e=>e.id===s)?.cmd}),` → wait `,_,` s → `,s===`claude`?`/color · `:``,(0,B.jsxs)(`b`,{className:`text-walnut`,children:[k,` --id=`,l||`…`,d?` --lane=${d}`:``,i?.room?` --room=${i.room}`:``]}),` → wait for register (≤ 90 s)`]}),C&&(0,B.jsx)(`div`,{className:`text-brick`,children:C}),D&&(0,B.jsxs)(`div`,{className:`p-2 rounded-kit border min-w-0 max-w-full ${D.status===`ok`?`border-moss-line bg-moss-wash/50`:D.status===`failed`?`border-brick-line bg-brick-wash/50`:`border-amber-line bg-amber-wash/40`}`,children:[(0,B.jsxs)(`div`,{className:`font-mono text-[12px]`,children:[D.status===`running`?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-amber`,children:[(0,B.jsx)(Na,{}),` `,(0,B.jsx)(G,{tone:`warn`,children:`running`})]}):(0,B.jsx)(G,{tone:D.status===`ok`?`ok`:`bad`,children:D.status}),` `,(0,B.jsx)(`b`,{children:D.label}),D.status===`running`&&(0,B.jsx)(`span`,{className:`ml-2 text-tan`,children:`live — you can close this; it keeps running (see Runs)`})]}),(0,B.jsxs)(`pre`,{className:`m-0 mt-1 font-mono text-[12px] whitespace-pre-wrap max-h-[30vh] overflow-auto min-w-0 max-w-full break-words overscroll-contain`,children:[D.log.join(`
|
|
29
29
|
`),D.error?`
|
|
30
30
|
`+D.error:``]})]})]}),(0,B.jsxs)(`div`,{className:`px-4 py-3 border-t border-sand flex justify-end gap-2`,children:[(0,B.jsx)(K,{size:`sm`,onClick:n,disabled:y,children:D?D.status===`running`?`Close (keeps running)`:`Close`:`Cancel`}),D&&(0,B.jsx)(K,{size:`sm`,onClick:()=>{n(),T(`/monitor`)},children:`Open Monitor`}),!D&&(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:O,disabled:!t||y||!l,children:y?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(Na,{}),` Starting…`]}):`Spawn`})]})]})})}function Yd({project:e,fleet:t,canWrite:n,compact:r=!1}){let i=q(`/bus/agents`,2e4).data??[],[a,o]=(0,P.useState)(null),s=e=>e?i.find(t=>t.agentId===e):void 0,c=({role:e,id:t,wide:n})=>{let r=s(t);return t?(0,B.jsxs)(`div`,{className:`px-2.5 py-1.5 rounded-kit border border-sand bg-paper ${n?``:`min-w-[170px]`}`,children:[(0,B.jsx)(ld,{id:t,size:`md`,bare:!0}),(0,B.jsxs)(`span`,{className:`block font-mono text-[10px] uppercase tracking-[.08em] text-tan mt-0.5`,children:[e,r?.pane?` · ${r.pane}`:``]})]}):(0,B.jsxs)(`button`,{onClick:()=>o(e),className:`grid grid-cols-[auto_1fr] gap-2 items-center px-2.5 py-1.5 rounded-kit border border-dashed border-dust bg-transparent text-left cursor-pointer hover:border-ember ${n?``:`min-w-[150px]`}`,title:`spawn a ${e}`,children:[(0,B.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full border border-dashed border-dust`}),(0,B.jsxs)(`span`,{className:`min-w-0`,children:[(0,B.jsx)(`span`,{className:`block font-mono text-[12px] text-tan`,children:`missing`}),(0,B.jsxs)(`span`,{className:`block font-mono text-[10px] uppercase tracking-[.08em] text-tan`,children:[e,` · spawn`]})]})]})},l=({v:e=!1})=>(0,B.jsx)(`span`,{className:e?`w-px h-4 bg-dust mx-auto`:`h-px w-5 bg-dust self-center`}),u=t.roles.workers;return(0,B.jsxs)(`div`,{className:`grid gap-1 ${r?`text-[12px]`:``}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,B.jsx)(`div`,{className:`px-2.5 py-1.5 rounded-kit border border-ember bg-ember-wash/40 font-mono font-semibold text-[12px] text-ember-deep`,children:`David`}),(0,B.jsx)(l,{}),(0,B.jsx)(c,{role:`aide`,id:t.roles.aide}),(0,B.jsx)(l,{}),(0,B.jsx)(c,{role:`coordinator`,id:t.roles.coordinator}),(0,B.jsx)(l,{}),(0,B.jsxs)(`div`,{className:`grid gap-1`,children:[(0,B.jsxs)(`div`,{className:`flex gap-1 flex-wrap`,children:[(0,B.jsx)(c,{role:`qa`,id:t.roles.qa}),(0,B.jsx)(c,{role:`ci`,id:t.roles.ci})]}),(0,B.jsxs)(`div`,{className:`flex gap-1 flex-wrap`,children:[u.map(e=>(0,B.jsx)(c,{role:`worker`,id:e},e)),(0,B.jsx)(c,{role:`worker`,id:null})]})]})]}),!r&&(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-tan`,children:`you talk to the aide · the coordinator faces the fleet · qa gates · ci ships · workers own lanes. Click a filled slot to watch its pane, a dashed one to spawn that role.`}),a&&(0,B.jsx)(Jd,{project:e,canWrite:n,initialRole:a,onClose:()=>o(null)})]})}var Xd={absent:`bad`,partial:`warn`,present:`ok`};function Zd({fleet:e}){if(!e)return null;let t=e.state===`absent`?`no fleet`:e.state===`partial`?`fleet partial · missing ${e.missing.join(`, `)}`:`fleet · ${e.live.length} live`;return(0,B.jsx)(G,{tone:Xd[e.state],children:t})}function Qd({project:e,canWrite:t}){let{data:n,refresh:r}=q(`/projects/${e}/fleet`,2e4),[i,a]=(0,P.useState)(!1);return!n||n.state===`present`?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`rounded-kit border px-4 py-3 grid gap-2 ${n.state===`absent`?`border-brick-line bg-brick-wash/40`:`border-amber-line bg-amber-wash/50`}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,B.jsx)(Zd,{fleet:n}),(0,B.jsx)(`span`,{className:`text-[13px] text-umber`,children:n.state===`absent`?(0,B.jsxs)(B.Fragment,{children:[`No agents are live for `,(0,B.jsx)(`b`,{className:`text-walnut`,children:e}),`. Boards and docs still read fine; Plan / Fix / Kick off need someone to talk to.`]}):(0,B.jsxs)(B.Fragment,{children:[`Missing `,(0,B.jsx)(`b`,{className:`text-walnut`,children:n.missing.join(`, `)}),`.`]})}),(0,B.jsxs)(`span`,{className:`ml-auto flex gap-1.5`,children:[(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:()=>a(!0),children:`Spawn fleet…`}),(0,B.jsx)(V,{to:`/ops/fleets`,className:`hover:no-underline`,children:(0,B.jsx)(K,{size:`sm`,children:`Fleets`})})]})]}),(0,B.jsx)(Yd,{project:e,fleet:n,canWrite:t,compact:!0})]}),i&&(0,B.jsx)($d,{project:e,templates:n.templates,missing:n.missing,canWrite:t,onClose:()=>{a(!1),r()}})]})}function $d({project:e,templates:t,missing:n,canWrite:r,onClose:i}){let[a,o]=(0,P.useState)(t.find(e=>e.id===`standard`)?.id??t[0]?.id??`standard`),[s,c]=(0,P.useState)(`claude`),[l,u]=(0,P.useState)(`claude`),[d,f]=(0,P.useState)(null),[p,m]=(0,P.useState)(``),[h,g]=(0,P.useState)(8),[_,v]=(0,P.useState)(!1),[y,b]=(0,P.useState)(null),[x,S]=(0,P.useState)(null),{runs:C}=Ga(),w=y?C.find(e=>e.id===y.id)??y:null,T=t.find(e=>e.id===a),E=d??T?.workers??0;return(0,B.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-walnut/30 flex items-start justify-center pt-[8vh] whitespace-normal text-left`,onMouseDown:e=>{e.target===e.currentTarget&&!_&&i()},children:(0,B.jsxs)(`div`,{className:`w-[680px] bg-paper border border-sand rounded-kit shadow-panel`,children:[(0,B.jsxs)(`div`,{className:`px-4 py-3 border-b border-sand font-display font-bold text-[18px] text-umber`,children:[`Spawn a fleet · `,e]}),(0,B.jsxs)(`div`,{className:`p-4 grid gap-3 text-[13px]`,children:[(0,B.jsxs)(`div`,{className:`text-umber`,children:[`Shapes from the playbook layout. Agents are launched one after another in tmux window `,(0,B.jsxs)(`code`,{children:[`fleet-`,e]}),`, each injected with its role card and `,(0,B.jsx)(`code`,{children:`--id`}),`, and the console waits for each to register.`,n.length>0&&(0,B.jsxs)(B.Fragment,{children:[` Currently missing: `,(0,B.jsx)(`b`,{className:`text-walnut`,children:n.join(`, `)}),`.`]})]}),!r&&(0,B.jsx)(`div`,{className:`text-brick`,children:`Turn on bus writes (header toggle) first.`}),(0,B.jsx)(`div`,{className:`grid gap-1.5`,children:t.map(e=>(0,B.jsxs)(`label`,{className:`grid grid-cols-[auto_1fr] gap-2 items-start px-3 py-2 rounded-kit border cursor-pointer ${a===e.id?`border-ember bg-ember-wash/40`:`border-sand`}`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`tpl`,checked:a===e.id,onChange:()=>{o(e.id),f(null)}}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{children:e.label}),(0,B.jsx)(`span`,{className:`block text-[12px] text-umber`,children:e.hint}),(0,B.jsx)(`span`,{className:`block font-mono text-[11px] text-tan`,children:[...e.roles,...Array.from({length:e.workers},(e,t)=>`worker-${t+1}`)].join(` · `)})]})]},e.id))}),(0,B.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Harness`}),(0,B.jsx)(`select`,{value:s,onChange:e=>c(e.target.value),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`,children:[`claude`,`grok`,`codex`,`opencode`].map(e=>(0,B.jsx)(`option`,{children:e},e))})]}),T?.roles.includes(`ci`)&&(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`CI harness (cheap)`}),(0,B.jsx)(`select`,{value:l,onChange:e=>u(e.target.value),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`,children:[`claude`,`grok`,`codex`,`opencode`].map(e=>(0,B.jsx)(`option`,{children:e},e))})]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Workers`}),(0,B.jsx)(`input`,{type:`number`,min:0,max:8,value:E,onChange:e=>f(Number(e.target.value)),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]})]}),E>0&&(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Lanes (comma-separated, optional)`}),(0,B.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),placeholder:`rendering, gameplay, infra`,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3 text-umber`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Start wait`}),(0,B.jsx)(`input`,{type:`range`,min:3,max:30,value:h,onChange:e=>g(Number(e.target.value))}),(0,B.jsxs)(`span`,{className:`font-mono text-[12px]`,children:[h,` s per agent`]}),(0,B.jsxs)(`span`,{className:`text-[12px]`,children:[`· total ≈ `,(T?.roles.length??0)+E,` × (`,h,` s + register)`]})]}),x&&(0,B.jsx)(`div`,{className:`text-brick`,children:x}),w&&(0,B.jsxs)(`div`,{className:`p-2 rounded-kit border min-w-0 max-w-full ${w.status===`ok`?`border-moss-line bg-moss-wash/50`:w.status===`failed`?`border-brick-line bg-brick-wash/50`:`border-amber-line bg-amber-wash/40`}`,children:[(0,B.jsxs)(`div`,{className:`font-mono text-[12px]`,children:[w.status===`running`?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-amber`,children:[(0,B.jsx)(Na,{}),` `,(0,B.jsx)(G,{tone:`warn`,children:`running`})]}):(0,B.jsx)(G,{tone:w.status===`ok`?`ok`:`bad`,children:w.status}),` `,(0,B.jsx)(`b`,{children:w.label})]}),(0,B.jsx)(`pre`,{className:`m-0 mt-1 font-mono text-[12px] whitespace-pre-wrap max-h-[30vh] overflow-auto min-w-0 max-w-full break-words overscroll-contain`,children:w.log.join(`
|
|
31
31
|
`)})]})]}),(0,B.jsxs)(`div`,{className:`px-4 py-3 border-t border-sand flex justify-end gap-2`,children:[(0,B.jsx)(K,{size:`sm`,onClick:i,disabled:_,children:w?`Close (keeps running)`:`Cancel`}),!w&&(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:async()=>{v(!0),S(null);try{let t=await Ia(`/actions/spawn-fleet`,{project:e,template:a,harness:s,ciHarness:l,workers:E,lanes:p.split(`,`).map(e=>e.trim()).filter(Boolean),waitSeconds:h});if(!t.status)throw Error(t.error??`failed`);b(t)}catch(e){S(e.message)}finally{v(!1)}},disabled:!r||_||!T,children:_?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(Na,{}),` Starting…`]}):`Spawn ${(T?.roles.length??0)+E} agents`})]})]})})}var ef=e=>{let t=Date.now()-e,n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n} min ago`;let r=Math.floor(n/60);return r<24?`${r} h ago`:`${Math.floor(r/24)} d ago`},tf=e=>e===`workstreams.v1`?[e,`ok`]:e===`workstreams.lanes-v0`?[`lanes-v0 · legacy`,`warn`]:e===`unknown`?[`unknown workstreams grammar`,`bad`]:[`no WORKSTREAMS.md`,`outline`];function nf(){let{projects:e,setCurrent:t,error:n,refresh:r}=Ha(),i=q(`/kit`).data,a=q(`/bus/agents`,3e4).data??[],o=a.filter(e=>e.reachability===`live`).length,s=a.filter(e=>e.reachability===`dead`),c=q(`/needs-david`,3e4).data??[],[l,u]=(0,P.useState)(!1);return(0,B.jsxs)(`div`,{className:`p-4 pb-10 grid gap-[18px] content-start`,children:[l&&(0,B.jsx)(Xa,{onClose:()=>{u(!1),r()}}),(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline gap-3 flex-wrap`,children:[(0,B.jsx)(`span`,{className:`font-display font-bold text-[34px] leading-[1.1] tracking-[-.015em] text-ember`,children:`Projects`}),(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:()=>u(!0),title:`register a repo path with the console`,children:`Add project`}),(0,B.jsxs)(`span`,{className:`ml-3 text-[13px] text-umber`,children:[`Groundwork-managed repos with a seam in `,(0,B.jsx)(`code`,{children:`docs/`}),` · from `,(0,B.jsx)(`code`,{children:`groundwork-console.config.json`})]})]}),(0,B.jsxs)(`div`,{className:`flex gap-2.5 items-center flex-wrap`,children:[i?.requires&&!i.requires.ok&&(0,B.jsx)(`span`,{className:`font-mono text-[11px] px-2 py-1 rounded-full bg-ember-wash text-ember-deep border border-ember/40`,title:Object.entries(i.requires).filter(([e])=>[`seam`,`mcp`,`groundwork`,`playbook`].includes(e)).map(([e,t])=>`${e}: has ${t.installed??`none`}, needs ${t.required}`).join(`
|
|
@@ -36,6 +36,6 @@ Error generating stack: `+e.message+`
|
|
|
36
36
|
`).map((e,o)=>{let s=o+1,c=n&&a(t?.uncommitted,s),l=r&&a(t?.lastCommit?.hunks,s),u=i===s;return(0,B.jsxs)(`div`,{id:`L${s}`,className:`grid grid-cols-[3.5ch_1fr] gap-3 rounded-[2px] ${u?`bg-ember-wash ring-1 ring-ember`:c?`bg-amber-wash/60`:l?`bg-moss-wash/50`:``}`,children:[(0,B.jsx)(`span`,{className:`text-right select-none ${u?`text-ember font-semibold`:`text-tan`}`,children:s}),(0,B.jsx)(`span`,{children:e||` `})]},o)})})}var If=e=>/done|merged|deployed|complete|closed|✅/i.test(e),Lf=e=>If(e)?`ok`:/block/i.test(e)?`bad`:/queued|hold|wait/i.test(e)?`warn`:`neutral`;function Rf({project:e}){let t=q(e?`/projects/${e}/board`:null,15e3).data,n=q(`/bus/agents`,2e4).data??[];if(!t)return null;let r=t.phases.find(e=>e.state===`ongoing`)??t.phases.find(e=>e.state===`planned`),i=t.workstreams.rows.filter(e=>!(`malformed`in e)).map(e=>e.schema===`workstreams.v1`?{name:e.stream,owner:e.owner,status:e.status,note:e.lastNote}:{name:e.lane,owner:e.owner,status:e.state,note:e.currentSlice}).filter(e=>!If(e.status)),a=e=>n.find(t=>t.agentId===e||e.includes(t.agentId))?.agentId??null;return(0,B.jsxs)(`div`,{className:`border border-sand rounded-kit bg-paper px-3 py-2 grid gap-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.1em] text-tan`,children:`now`}),r?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{to:`/board`,className:`font-semibold text-[13px] hover:no-underline text-walnut hover:text-ember-deep`,children:r.title}),(0,B.jsx)(G,{tone:r.state===`ongoing`?`david`:`neutral`,children:r.state}),(0,B.jsxs)(`span`,{className:`font-mono text-[11px] text-ink3`,children:[r.done,`/`,r.total,` tasks`,r.streams?` · ${r.streams} streams`:``]})]}):(0,B.jsx)(`span`,{className:`text-[13px] text-umber`,children:`no phase in flight`}),(0,B.jsxs)(`span`,{className:`ml-auto font-mono text-[11px] text-ink3`,children:[i.length,` active stream`,i.length===1?``:`s`]})]}),i.length>0&&(0,B.jsx)(`div`,{className:`flex gap-1.5 flex-wrap`,children:i.slice(0,8).map(e=>{let t=a(e.owner);return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded-kit border border-sand bg-cream/60 max-w-[360px]`,title:`${e.name} · ${e.owner} · ${e.status}${e.note?` · ${e.note}`:``}`,children:[t?(0,B.jsx)(ld,{id:t,bare:!0,size:`sm`}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[12px] text-umber`,children:[(0,B.jsx)(Lu,{id:e.owner,size:14,state:`dead`}),e.owner]}),(0,B.jsx)(`span`,{className:`text-[12px] truncate`,children:e.name}),(0,B.jsx)(G,{tone:Lf(e.status),children:e.status.replace(/^[^\w]+/,``).slice(0,18)})]},e.name)})})]})}var zf=`/api`,Bf=e=>{if(!e)return`—`;let t=Math.floor((Date.now()-e)/1e3);return t<60?`${t} s`:t<3600?`${Math.floor(t/60)} min`:`${Math.floor(t/3600)} h`};function Vf(){let{current:e}=Ha(),{linkify:t}=ju(),[n,r]=(0,P.useState)(`project`),[i,a]=(0,P.useState)(40),[o,s]=(0,P.useState)(2),[c,l]=(0,P.useState)(()=>localStorage.getItem(`groundwork-console.monitor.layout`)??`grid`),[u,d]=(0,P.useState)(()=>Number(localStorage.getItem(`groundwork-console.monitor.tileW`)??520));(0,P.useEffect)(()=>{localStorage.setItem(`groundwork-console.monitor.layout`,c),localStorage.setItem(`groundwork-console.monitor.tileW`,String(u))},[c,u]);let[f,p]=(0,P.useState)([]),[m,h]=(0,P.useState)(null),[g,_]=(0,P.useState)(null),[v,y]=(0,P.useState)(!1),[b,x]=(0,P.useState)(!0),[S,C]=(0,P.useState)(0),w=q(n===`project`&&e?`/projects/${e}/board`:null,2e4).data,T=e=>(w?.workstreams.rows.filter(e=>!(`malformed`in e))??[]).map(e=>e.schema===`workstreams.v1`?{name:e.stream,owner:e.owner,status:e.status}:{name:e.lane,owner:e.owner,status:e.state}).filter(t=>(t.owner===e||t.owner.includes(e))&&!/done|merged|deployed|complete|closed|✅/i.test(t.status)),E=(0,P.useRef)({}),D=(0,P.useRef)([]),O=(()=>{let e=f.map(e=>e.agentId),t=D.current.filter(t=>e.includes(t)),n=f.filter(e=>!t.includes(e.agentId)).sort((e,t)=>!!/coordinator/i.test(t.role??``)-+!!/coordinator/i.test(e.role??``)||e.agentId.localeCompare(t.agentId)).map(e=>e.agentId);return D.current=[...t,...n],D.current.map(e=>f.find(t=>t.agentId===e)).filter(Boolean)})(),k=(0,P.useRef)({}),A=(0,P.useRef)({});(0,P.useLayoutEffect)(()=>{let e={};for(let[t,n]of Object.entries(k.current)){if(!n)continue;let r=n.getBoundingClientRect();e[t]=r;let i=A.current[t];if(i&&(i.left!==r.left||i.top!==r.top)){let e=i.left-r.left,t=i.top-r.top;n.style.transition=`none`,n.style.transform=`translate(${e}px,${t}px)`,requestAnimationFrame(()=>{n.style.transition=`transform 320ms cubic-bezier(.2,.7,.2,1)`,n.style.transform=``})}}A.current=e}),(0,P.useEffect)(()=>{let t=!0,r=async()=>{if(!v)try{let r=await fetch(`${zf}/bus/panes?lines=${i}${b?`&colors=1`:``}${n===`project`&&e?`&project=${encodeURIComponent(e)}`:``}`),a=await r.json();if(!t)return;if(!r.ok)throw Error(String(a.error??r.status));p(a),h(null),C(e=>e+1)}catch(e){t&&h(e.message)}};r();let a=setInterval(r,3e3);return()=>{t=!1,clearInterval(a)}},[n,e,i,v,b]);let[j,M]=(0,P.useState)({}),N=e=>j[e]!==!1;(0,P.useEffect)(()=>{for(let[e,t]of Object.entries(E.current))if(t&&N(e)){let e=t.scrollHeight-t.clientHeight;Math.abs(t.scrollTop-e)>1&&(t.scrollTop=e)}},[S]);let ee=e=>t=>{let n=t.currentTarget,r=n.scrollHeight-n.scrollTop-n.clientHeight<24;r!==N(e)&&M(t=>({...t,[e]:r}))},F=e=>{M(t=>({...t,[e]:!0}));let t=E.current[e];if(t){let e=t.scrollHeight-t.clientHeight;Math.abs(t.scrollTop-e)>1&&(t.scrollTop=e)}},I=f.filter(e=>e.active).length;return(0,B.jsxs)(`div`,{className:`p-4 grid gap-3.5 content-start [overflow-anchor:none]`,children:[g&&(0,B.jsx)(id,{agentId:g,onClose:()=>_(null)}),(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between flex-wrap gap-2`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`font-display font-bold text-[34px] leading-[1.1] tracking-[-.015em] text-ember`,children:`Monitor`}),(0,B.jsxs)(`span`,{className:`ml-3 text-[13px] text-umber`,children:[n===`project`?e:`all projects`,` · `,f.length,` pane`,f.length===1?``:`s`,` · `,I,` active · read-only capture every 3 s`]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsxs)(`span`,{className:`inline-flex border border-dust rounded-kit overflow-hidden`,children:[(0,B.jsx)(`button`,{onClick:()=>r(`project`),"aria-pressed":n===`project`,className:`px-2.5 py-[5px] text-[12px] font-medium border-0 cursor-pointer ${n===`project`?`bg-walnut text-paper`:`bg-paper text-umber`}`,children:e||`project`}),(0,B.jsx)(`button`,{onClick:()=>r(`all`),"aria-pressed":n===`all`,className:`px-2.5 py-[5px] text-[12px] font-medium border-0 cursor-pointer ${n===`all`?`bg-walnut text-paper`:`bg-paper text-umber`}`,children:`all`})]}),(0,B.jsxs)(`span`,{className:`inline-flex border border-dust rounded-kit overflow-hidden`,children:[(0,B.jsx)(`button`,{onClick:()=>l(`grid`),"aria-pressed":c===`grid`,className:`px-2.5 py-[5px] text-[12px] font-mono border-0 cursor-pointer ${c===`grid`?`bg-walnut text-paper`:`bg-paper text-umber`}`,title:`wrapping grid`,children:`grid`}),(0,B.jsx)(`button`,{onClick:()=>l(`row`),"aria-pressed":c===`row`,className:`px-2.5 py-[5px] text-[12px] font-mono border-0 cursor-pointer ${c===`row`?`bg-walnut text-paper`:`bg-paper text-umber`}`,title:`one row, scroll sideways`,children:`row`})]}),c===`grid`&&(0,B.jsx)(`span`,{className:`inline-flex border border-dust rounded-kit overflow-hidden`,children:[1,2,3].map(e=>(0,B.jsxs)(`button`,{onClick:()=>s(e),"aria-pressed":o===e,className:`px-2.5 py-[5px] text-[12px] font-mono border-0 cursor-pointer ${o===e?`bg-walnut text-paper`:`bg-paper text-umber`}`,children:[e,`×`]},e))}),c===`row`&&(0,B.jsx)(`select`,{value:u,onChange:e=>d(Number(e.target.value)),className:`font-mono text-[12px] px-2 py-[5px] border border-dust rounded-kit bg-paper text-umber`,title:`tile width`,children:[420,520,640,800].map(e=>(0,B.jsxs)(`option`,{value:e,children:[e,`px`]},e))}),(0,B.jsx)(`select`,{value:i,onChange:e=>a(Number(e.target.value)),className:`font-mono text-[12px] px-2 py-[5px] border border-dust rounded-kit bg-paper text-umber`,children:[20,40,80,150].map(e=>(0,B.jsxs)(`option`,{value:e,children:[e,` lines`]},e))}),(0,B.jsxs)(`label`,{className:`font-mono text-[11px] text-ink3 flex items-center gap-1`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:b,onChange:e=>x(e.target.checked)}),`colors`]}),(0,B.jsx)(K,{size:`sm`,onClick:()=>y(e=>!e),"aria-pressed":v,children:v?`Resume`:`Pause`})]})]}),n===`project`&&e&&(0,B.jsx)(Rf,{project:e}),m&&(0,B.jsx)(U,{className:`px-4 py-3 text-[13px] text-brick`,children:m}),f.length===0&&!m&&(0,B.jsxs)(U,{className:`px-4 py-4 text-[13px] text-umber`,children:[`No pane-attached agents`,n===`project`?` for ${e}`:``,`. Agents appear here when their transport is tmux-push (attach_agent) and the pane is alive.`,n===`project`&&(0,B.jsxs)(B.Fragment,{children:[` Try `,(0,B.jsx)(`button`,{className:`underline text-ember-deep bg-transparent border-0 p-0 cursor-pointer`,onClick:()=>r(`all`),children:`all projects`}),`.`]})]}),(0,B.jsx)(`div`,{className:c===`grid`?`grid gap-3.5`:`flex gap-3.5 overflow-x-auto pb-2 snap-x snap-mandatory [scrollbar-width:thin]`,style:c===`grid`?{gridTemplateColumns:`repeat(${o}, minmax(0, 1fr))`}:void 0,children:O.map(e=>(0,B.jsx)(`div`,{ref:t=>{k.current[e.agentId]=t},className:c===`row`?`shrink-0 snap-start`:`min-w-0`,style:c===`row`?{width:u}:void 0,children:(0,B.jsxs)(U,{className:`grid grid-rows-[auto_1fr_auto]`,children:[(0,B.jsx)(`div`,{style:{height:4,background:dd(e.role)}}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 px-3 border-b border-sand min-w-0 h-[46px]`,children:[(0,B.jsx)(Lu,{id:e.agentId,role:e.role,size:20,state:e.reachability,active:e.active}),(0,B.jsxs)(`span`,{className:`min-w-0`,children:[(0,B.jsx)(`span`,{className:`block font-mono font-semibold text-[13px] truncate leading-tight`,children:e.agentId}),(0,B.jsxs)(`span`,{className:`block font-mono text-[10px] uppercase tracking-[.06em] leading-tight`,style:{color:dd(e.role)},children:[fd(e.role),n===`project`&&T(e.agentId).length>0?(0,B.jsxs)(`span`,{className:`text-ink3 normal-case tracking-normal`,children:[` · `,T(e.agentId).map(e=>e.name).join(` · `)]}):``]})]}),n===`all`&&e.project&&(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan truncate`,children:e.project}),e.windowName&&(0,B.jsxs)(`span`,{className:`font-mono text-[10px] text-tan truncate shrink-0`,title:`tmux window ${e.windowName}`,children:[`⧉ `,e.windowName]}),(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 shrink-0`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-ink3`,title:`last pane output`,children:e.active?(0,B.jsx)(G,{tone:`ok`,children:`active`}):(0,B.jsxs)(`span`,{className:`text-tan`,children:[`quiet `,Bf(e.paneActivity)]})}),!N(e.agentId)&&(0,B.jsx)(`button`,{className:`font-mono text-[11px] px-1.5 py-0.5 rounded-full bg-amber-wash text-amber border border-amber-line cursor-pointer`,onClick:()=>F(e.agentId),title:`follow paused while you read — click to jump to the bottom and follow again`,children:`↓ follow`}),(0,B.jsx)(`button`,{className:`font-mono text-[11px] text-ember-deep bg-transparent border-0 cursor-pointer`,onClick:()=>xd(e.agentId),title:`DM this agent (Summon)`,children:`DM`}),(0,B.jsx)(`button`,{className:`font-mono text-[11px] text-ember-deep bg-transparent border-0 cursor-pointer underline decoration-dotted`,onClick:()=>_(e.agentId),title:`open full pane`,children:e.pane})]})]}),(0,B.jsx)(`pre`,{ref:t=>{E.current[e.agentId]=t},onScroll:ee(e.agentId),className:`m-0 px-3 py-2 overflow-auto overscroll-contain font-mono text-[11.5px] leading-[1.4] whitespace-pre-wrap break-words pane-dark`,style:{height:`${Math.min(i,80)*16+16}px`},children:e.capture?t(b&&e.capture.ansi?mo(e.capture.ansi):e.capture.text,e.project??void 0):`—`})]})},e.agentId))}),(0,B.jsxs)(`div`,{className:`font-mono text-[11px] text-tan`,children:[`pulsing dot = pane content changed in the last 60 s (status-bar/timer redraws don't count) · `,c===`row`?`row: scroll sideways (shift+wheel / trackpad), tiles snap`:`grid wraps; switch to row for 8+ agents`,` · tiles auto-scroll to the bottom · click a pane id for the full, follow-able view · the console never types into panes — DM opens the agent's thread (Summon)`]})]})}var Hf=[{to:`fleets`,label:`Fleets`,icon:`fleet`,hint:`presence · spawn · unregister · prune · decommission`},{to:`skills`,label:`Skills`,icon:`skills`,hint:`groundwork / playbook skills · updates`},{to:`release`,label:`Release`,icon:`release`,hint:`kit versions · PRs · gates`},{to:`runs`,label:`Runs`,icon:`health`,hint:`every action the console performed`},{to:`events`,label:`Events`,icon:`bus`,hint:`mechanical rules → coordinator (dry-run by default)`}];function Uf(){let{running:e}=Ga(),t=rr(),n=Hf.find(e=>t.pathname.startsWith(`/ops/${e.to}`));return(0,B.jsxs)(`div`,{className:`grid grid-rows-[auto_1fr] min-h-0`,children:[(0,B.jsxs)(`div`,{className:`px-4 pt-3 flex items-end gap-1 border-b border-sand bg-cream/60`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.1em] text-tan mr-2 pb-2.5`,children:`ops`}),Hf.map(t=>(0,B.jsxs)(ji,{to:t.to,className:({isActive:e})=>`inline-flex items-center gap-1.5 px-3 py-2 -mb-px border-b-2 text-[13px] font-medium hover:no-underline ${e?`border-ember text-walnut`:`border-transparent text-ink3 hover:text-umber`}`,title:t.hint,children:[(0,B.jsx)(`span`,{className:`text-tan`,children:wa[t.icon]({size:14})}),t.label,t.to===`runs`&&e>0?(0,B.jsx)(`span`,{className:`ml-1 inline-flex items-center justify-center min-w-4 h-4 px-1 rounded-full bg-ember text-paper font-mono text-[10px]`,children:e}):null]},t.to)),n&&(0,B.jsx)(`span`,{className:`ml-auto pb-2.5 font-mono text-[11px] text-tan hidden lg:inline`,children:n.hint})]}),(0,B.jsx)(Rr,{})]})}function Wf(){return(0,B.jsx)(`div`,{className:`p-4`,children:(0,B.jsx)(Hd,{})})}function Gf({title:e,danger:t,body:n,confirmWord:r,action:i,payload:a,preview:o,onClose:s,onDone:c}){let[l,u]=(0,P.useState)(``),[d,f]=(0,P.useState)(!1),[p,m]=(0,P.useState)(null),[h,g]=(0,P.useState)(null),_=async()=>{f(!0);try{let e=await Ia(i,{...a,confirm:l});m(e),e.status===`ok`&&c?.(e)}finally{f(!1)}},v=async()=>{if(o){f(!0);try{g(await o())}finally{f(!1)}}},y=(e,t)=>(0,B.jsxs)(`div`,{className:`p-2 rounded-kit border min-w-0 max-w-full ${t===`preview`?`border-dust bg-sand/40`:e.status===`ok`?`border-moss-line bg-moss-wash/50`:`border-brick-line bg-brick-wash/50`}`,children:[(0,B.jsxs)(`div`,{className:`font-mono text-[12px]`,children:[t===`preview`?(0,B.jsx)(G,{tone:`warn`,children:`preview · nothing written`}):(0,B.jsx)(G,{tone:e.status===`ok`?`ok`:`bad`,children:e.status}),` `,(0,B.jsx)(`b`,{children:e.label})]}),(0,B.jsxs)(`pre`,{className:`m-0 mt-1 font-mono text-[12px] whitespace-pre-wrap max-h-[30vh] overflow-auto min-w-0 max-w-full break-words overscroll-contain`,children:[e.log.join(`
|
|
37
37
|
`),e.result===void 0?``:`
|
|
38
38
|
`+JSON.stringify(e.result,null,1).slice(0,2e3),e.error?`
|
|
39
|
-
`+e.error:``]})]});return(0,B.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-walnut/30 flex items-start justify-center pt-[10vh]`,onMouseDown:e=>{e.target===e.currentTarget&&s()},children:(0,B.jsxs)(`div`,{className:`w-[600px] bg-paper border rounded-kit shadow-panel ${t?`border-brick`:`border-sand`}`,children:[(0,B.jsx)(`div`,{className:`px-4 py-3 border-b border-sand font-display font-bold text-[18px] ${t?`text-brick`:`text-umber`}`,children:e}),(0,B.jsxs)(`div`,{className:`p-4 grid gap-3 text-[13px] text-umber`,children:[n,o&&!h&&(0,B.jsx)(`div`,{children:(0,B.jsx)(K,{size:`sm`,onClick:v,disabled:d,children:d?`…`:`Preview (dry-run · writes nothing)`})}),h&&y(h,`preview`),!p&&(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsxs)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:[`Type `,r,` to `,o?`apply — the preview above changed nothing`:`confirm`]}),(0,B.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]}),p&&y(p,`result`)]}),(0,B.jsxs)(`div`,{className:`px-4 py-3 border-t border-sand flex justify-end gap-2`,children:[(0,B.jsx)(K,{size:`sm`,onClick:s,children:p?`Close`:`Cancel`}),!p&&(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:_,disabled:l!==r||d,children:d?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(Na,{}),` Running…`]}):o?`Apply`:`Run`})]})]})})}var Kf=`18px 1.6fr 1fr 1fr 1fr 1.2fr auto`,qf=[[`automation`,`groundwork-console: reads + prefixed sends only; no record authority`],[`coordinator`,`routes work, noise sink, faces the fleet`],[`coord-worker`,`lane owner, own worktree, cites every DONE`],[`coord-qa`,`quality gate; PASS/FAIL @ head`],[`coord-ci`,`release operator; merges on cited PASS`],[`coord-aide`,`David’s comms point; owns QUEUE`],[`coord-audit`,`read-only architecture drift`],[`coord-fleet`,`stands up a fleet in tmux`],[`coord-handover`,`context-clear snapshot`]],Jf=e=>e===null?`—`:e<6e4?`just now`:e<36e5?`${Math.round(e/6e4)} min`:e<864e5?`${Math.round(e/36e5)} h`:`${Math.round(e/864e5)} d`;function Yf(){let{current:e,projects:t}=Ha(),{data:n,error:r,loading:i}=q(`/bus/agents`,2e4),[a,o]=(0,P.useState)(`project`),{runs:s}=Ga(),c=q(`/kit`).data,[l,u]=(0,P.useState)(!1),d=s.find(e=>(e.label===`bus doctor`||e.label===`bus doctor · fix`)&&e.status===`ok`),f=(d?.result?.findings??[]).filter(e=>e.fixable&&e.level!==`ok`),p=(d?.result?.findings??[]).find(e=>e.check===`dist-behind-source`&&e.level!==`ok`),m=q(`/health`,6e4).data?.requires?.paths?.kitCheckout??null,h=d?.result,g=async()=>{u(!0);try{await Ia(`/actions/bus-doctor`)}finally{u(!1)}},[_,v]=(0,P.useState)(!1),[y,b]=(0,P.useState)(null),[x,S]=(0,P.useState)(null),[C,w]=(0,P.useState)(!1),[T,E]=(0,P.useState)(!1),D=q(a===`project`&&e?`/projects/${e}/fleet`:null,2e4).data,O=q(`/admin/bus-writes`,1e4).data?.enabled??!1,k=ar(),A=n??[],j=t.find(t=>t.name===e)?.room,M=A.filter(t=>t.project===e||j&&t.project===j),N=a===`project`?M:A,ee=A.find(e=>/coordinator/i.test(e.role??``)&&/kit|agent-workflow/i.test(e.project??``)&&e.reachability!==`dead`)?.agentId??null,F=N.filter(e=>e.reachability===`dead`&&![`groundwork-console`,`david`].includes(e.agentId)).map(e=>e.agentId),I=N.filter(e=>e.reachability===`live`).length,te=e=>t.find(t=>t.name===e.project||t.room&&t.room===e.project)?.name,ne=e=>te(e)??`~${e.project??`—`}`,re=a===`all`?[...new Set(A.map(ne))].sort((e,t)=>!!e.startsWith(`~`)-+!!t.startsWith(`~`)||e.localeCompare(t)):[e],L=e=>{if(e.startsWith(`~`))return{title:`#${e.slice(1)}`,path:`not registered as a project`,registered:!1};let n=t.find(t=>t.name===e);return{title:e,path:n?.room?`#${n.room}`:`no room linked`,registered:!0}};return(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_340px] gap-4 p-4 max-[980px]:grid-cols-1`,children:[(0,B.jsxs)(`div`,{className:`grid gap-3.5 content-start min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3 flex-wrap`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`span`,{className:`font-display font-bold text-[34px] leading-[1.1] tracking-[-.015em] text-ember`,children:`Fleets`}),(0,B.jsxs)(`span`,{className:`ml-3 text-[13px] text-umber whitespace-nowrap`,children:[a===`project`?`${e} · `:`all projects · `,N.length,` registered · `,I,` live`]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap justify-end`,children:[(0,B.jsxs)(`span`,{className:`inline-flex border border-dust rounded-kit overflow-hidden whitespace-nowrap`,children:[(0,B.jsxs)(`button`,{onClick:()=>o(`project`),"aria-pressed":a===`project`,className:`px-2.5 py-[5px] text-[12px] font-medium border-0 cursor-pointer ${a===`project`?`bg-walnut text-paper`:`bg-paper text-umber`}`,children:[e||`project`,` · `,M.length]}),(0,B.jsxs)(`button`,{onClick:()=>o(`all`),"aria-pressed":a===`all`,className:`px-2.5 py-[5px] text-[12px] font-medium border-0 cursor-pointer ${a===`all`?`bg-walnut text-paper`:`bg-paper text-umber`}`,children:[`all · `,A.length]})]}),(0,B.jsx)(K,{size:`sm`,onClick:()=>k(`/monitor`),children:`Monitor`}),(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:()=>w(!0),title:`spawn an agent into tmux for this project`,children:`Spawn agent…`}),(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(K,{size:`sm`,onClick:()=>E(e=>!e),"aria-expanded":T,children:`Admin ▾`}),T&&(0,B.jsxs)(`div`,{className:`absolute right-0 top-[calc(100%+6px)] z-40 w-[260px] bg-paper border border-sand rounded-kit shadow-panel whitespace-normal text-left`,onMouseLeave:()=>E(!1),children:[(0,B.jsxs)(`button`,{className:`w-full text-left px-3 py-2 text-[13px] border-0 bg-transparent cursor-pointer hover:bg-linen border-b border-sand`,onClick:()=>{E(!1),g()},disabled:l,children:[l?`Running doctor…`:`Run bus doctor`,(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-tan`,children:`MCP doctor as groundwork-console · read-only`})]}),(0,B.jsxs)(`button`,{className:`w-full text-left px-3 py-2 text-[13px] border-0 bg-transparent cursor-pointer hover:bg-linen border-b border-sand`,onClick:()=>{E(!1),b({kind:`prune`})},children:[`Prune bus data…`,(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-tan`,children:`old messages/status/inbox · dry-run first`})]}),(0,B.jsxs)(`button`,{className:`w-full text-left px-3 py-2 text-[13px] border-0 bg-transparent cursor-pointer hover:bg-linen border-b border-sand disabled:opacity-50`,onClick:()=>{E(!1),b({kind:`dead`})},disabled:F.length===0,children:[`Unregister dead (`,F.length,a===`project`?` in ${e}`:``,`)…`,(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-tan`,children:`force_unregister agents inactive > 24 h`})]}),j&&(0,B.jsxs)(`button`,{className:`w-full text-left px-3 py-2 text-[13px] border-0 bg-transparent cursor-pointer hover:bg-linen text-brick`,onClick:()=>{E(!1),v(!0)},children:[`Decommission fleet + #`,j,`…`,(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-tan`,children:`unregister members + delete room`})]}),!O&&(0,B.jsx)(`div`,{className:`px-3 py-2 font-mono text-[11px] text-tan border-t border-sand`,children:`bus writes are off — admin actions dry-run / refuse`})]})]})]})]}),C&&(0,B.jsx)(Jd,{project:e,canWrite:O,onClose:()=>{w(!1)}}),x&&(0,B.jsx)(id,{agentId:x,onClose:()=>S(null)}),y?.kind===`fix`&&(0,B.jsx)(Gf,{title:`Bus doctor · fix fixable (${f.length})`,confirmWord:`FIX`,action:`/actions/bus-doctor`,payload:{fix:!0},onClose:()=>{b(null),g()},body:(0,B.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,B.jsxs)(`div`,{children:[`Runs the MCP `,(0,B.jsx)(`code`,{children:`doctor`}),` with `,(0,B.jsx)(`code`,{children:`fix: true`}),` as `,(0,B.jsx)(`code`,{children:`groundwork-console`}),` — only its own fix path, only the findings it tags `,(0,B.jsx)(`b`,{children:`fixable`}),`. Before/after counts and the delta are shown in the result; nothing in `,(0,B.jsx)(`code`,{children:`~/agent-coord`}),` is edited by hand. Gated by bus writes.`]}),(0,B.jsx)(`ul`,{className:`m-0 pl-4 grid gap-0.5`,children:f.map(e=>(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`code`,{children:e.check}),e.detail?(0,B.jsxs)(`span`,{className:`text-umber`,children:[` — `,e.detail.slice(0,120)]}):null]},e.check))}),!O&&(0,B.jsx)(`div`,{className:`text-brick`,children:`bus writes are off — the API will answer 403 until you switch them on in the header.`})]})}),y?.kind===`rebuild`&&(0,B.jsx)(Gf,{title:`Rebuild kit MCP`,confirmWord:`BUILD`,action:`/actions/rebuild-kit-mcp`,payload:{},onClose:()=>{b(null),g()},body:(0,B.jsxs)(`div`,{children:[`dist-behind-source is not doctor-fixable: the kit checkout's `,(0,B.jsx)(`code`,{children:`src/`}),` is newer than `,(0,B.jsx)(`code`,{children:`dist/`}),`. Runs `,(0,B.jsx)(`code`,{children:`pnpm --filter agent-coord-mcp build`}),` in `,(0,B.jsx)(`code`,{children:m}),` (the doctor's own advice: `,(0,B.jsx)(`code`,{children:`npm run build`}),`, then restart sessions). Live MCP sessions keep the old inode until agents restart / re-attach. Shell Run, bus-writes gated.`]})}),y?.kind===`prune`&&(0,B.jsx)(Gf,{title:`Prune bus data`,confirmWord:`PRUNE`,action:`/actions/prune`,payload:{dryRun:!1,olderThanDays:30,targets:[`rooms`,`status`,`inbox`,`receipts`,`members`],removeOrphanInboxes:!0},preview:()=>Ia(`/actions/prune`,{dryRun:!0,olderThanDays:30,targets:[`rooms`,`status`,`inbox`,`receipts`,`members`],removeOrphanInboxes:!0}),onClose:()=>b(null),body:(0,B.jsxs)(`div`,{children:[`MCP `,(0,B.jsx)(`code`,{children:`prune`}),`: removes room messages / status entries / inbox items / receipts older than `,(0,B.jsx)(`b`,{children:`30 days`}),` (decisions kept longer), orphan inboxes and stale memberships. Preview first — the tool has a native dry-run. Requires bus writes on.`]})}),y?.kind===`dead`&&(0,B.jsx)(Gf,{danger:!0,title:`Unregister ${F.length} dead agent${F.length===1?``:`s`}`,confirmWord:`UNREGISTER`,action:`/actions/unregister-dead`,payload:{agentIds:F},onClose:()=>b(null),body:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`code`,{children:`force_unregister`}),` for every agent in `,(0,B.jsx)(`b`,{children:a===`project`?e:`all projects`}),` whose last activity is over 24 h old: `,(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-walnut break-words`,children:F.join(`, `)}),`. Registry entries, transports and inbox markers go; room history stays. Requires bus writes on.`]})}),y?.kind===`one`&&(0,B.jsx)(Gf,{danger:!0,title:`Unregister ${y.id}`,confirmWord:y.id,action:`/actions/unregister`,payload:{agentId:y.id},onClose:()=>b(null),body:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`code`,{children:`force_unregister`}),` `,(0,B.jsx)(`b`,{children:y.id}),`. Requires bus writes on.`]})}),_&&j&&(0,B.jsx)(Xf,{room:j,project:e,agents:M.map(e=>e.agentId),onClose:()=>v(!1)}),r&&(0,B.jsxs)(U,{className:`px-4 py-3 text-[13px] text-brick`,children:[`API error: `,r]}),a===`project`&&D?.state===`present`&&(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`Fleet`,icon:`fleet`,path:`${D.live.length} live · topology`}),(0,B.jsx)(`div`,{className:`px-3 py-3`,children:(0,B.jsx)(Yd,{project:e,fleet:D,canWrite:O,onOpenPane:e=>S(e)})})]}),a===`project`&&(0,B.jsx)(Qd,{project:e,canWrite:O}),N.length===0&&!i&&a===`all`&&(0,B.jsx)(U,{className:`px-4 py-3 text-[13px] text-umber`,children:`No agents registered on the bus.`}),re.filter(e=>a!==`all`||N.some(t=>ne(t)===e)).map(e=>{let t=L(e),n=a===`all`?N.filter(t=>ne(t)===e):N;return(0,B.jsxs)(U,{children:[a===`all`&&(0,B.jsx)(W,{title:t.title,icon:`fleet`,path:`${t.path} · ${n.length} agent${n.length===1?``:`s`}`,children:!t.registered&&(0,B.jsx)(G,{tone:`outline`,children:`not registered`})}),(0,B.jsxs)(Aa,{cols:Kf,children:[(0,B.jsx)(`span`,{}),(0,B.jsx)(`span`,{children:`Agent`}),(0,B.jsx)(`span`,{children:`Role`}),(0,B.jsx)(`span`,{children:`Project`}),(0,B.jsx)(`span`,{children:`Transport`}),(0,B.jsx)(`span`,{children:`Pane · last seen`}),(0,B.jsx)(`span`,{})]}),n.map(e=>(0,B.jsxs)(`div`,{className:`grid gap-3 items-center px-3 min-h-10 border-b border-sand last:border-b-0 hover:bg-linen/60`,style:{gridTemplateColumns:Kf},children:[(0,B.jsx)(Ma,{state:e.reachability,active:e.active}),(0,B.jsx)(`span`,{className:`font-mono font-medium text-[13px] truncate`,children:e.agentId}),(0,B.jsx)(`span`,{className:`text-umber text-[13px] truncate`,children:e.role??`—`}),(0,B.jsx)(`span`,{className:`font-mono text-[13px] truncate`,children:e.project??`—`}),(0,B.jsx)(`span`,{className:`justify-self-start`,children:e.transport?(0,B.jsx)(G,{tone:`outline`,children:e.transport}):e.reachability===`dead`?(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-tan`,children:`—`}):(0,B.jsx)(G,{tone:`warn`,children:`not attached`})}),(0,B.jsxs)(`span`,{className:`font-mono text-[12px] text-ink3`,children:[e.progress&&e.progress.state!==`producing`&&(0,B.jsx)(G,{tone:e.progress.state===`stalled`?`bad`:`outline`,children:e.progress.state===`unknown`?`no output seen`:e.progress.state}),e.progress&&e.progress.state!==`producing`?` `:``,e.pane?(0,B.jsx)(`button`,{className:`border-0 bg-transparent p-0 font-mono text-[12px] text-ember-deep cursor-pointer underline decoration-dotted`,onClick:()=>S(e.agentId),title:`view pane`,children:e.pane}):`—`,` · `,Jf(e.heartbeatAgeMs),e.paneCommand?(0,B.jsxs)(`span`,{className:`text-tan`,children:[` · `,e.paneCommand]}):``]}),e.reachability===`dead`?(0,B.jsx)(K,{tone:`ghost`,size:`sm`,onClick:()=>b({kind:`one`,id:e.agentId}),children:`Unregister`}):(0,B.jsx)(K,{tone:`ghost`,size:`sm`,onClick:()=>xd(e.agentId),children:`DM`})]},e.agentId))]},e)})]}),(0,B.jsxs)(`aside`,{className:`grid gap-3.5 content-start min-w-0`,children:[(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`Liveness rule`,icon:`health`,path:`pane activity ∨ heartbeat`}),(0,B.jsxs)(`div`,{className:`px-3 py-2 text-[13px] text-umber`,children:[`last seen = freshest of tmux `,(0,B.jsx)(`code`,{children:`window_activity`}),`, heartbeat, transport/inbox mtimes · `,(0,B.jsx)(`b`,{className:`text-walnut`,children:`live`}),` < 15 min · idle < 24 h · dead beyond. Pulsing dot = pane content changed in the last 60 s (the bottom 3 lines — status/timer strip — are ignored, so an idle harness redrawing its clock does not pulse). Click a pane id to watch it (read-only).`]})]}),(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`Roles`,icon:`fleet`,path:`playbook ${c?.packages?.playbook?.version??`…`}`}),(0,B.jsx)(`div`,{className:`px-3 pt-1.5 pb-2.5 grid gap-1 text-[13px] text-umber`,children:qf.map(([e,t])=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`b`,{className:`text-walnut`,children:e}),` — `,t]},e))})]}),(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`Bus doctor`,icon:`doctor`,path:h?`mcp doctor · ${new Date(d.endedAt??d.startedAt).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`:`mcp doctor as groundwork-console`,children:h&&(0,B.jsx)(G,{tone:h.healthy?`ok`:`warn`,children:h.healthy?`healthy`:`${h.summary.warn} warn · ${h.summary.error} error`})}),!h&&(0,B.jsxs)(`div`,{className:`px-3 py-2 text-[13px] text-umber`,children:[`Press `,(0,B.jsx)(`b`,{children:`Run doctor`}),` — calls the MCP `,(0,B.jsx)(`code`,{children:`doctor`}),` tool as `,(0,B.jsx)(`code`,{children:`groundwork-console`}),` (automation). Read-only; `,(0,B.jsx)(`code`,{children:`fix`}),` stays gated.`]}),h?.findings.filter(e=>e.level!==`ok`).map(e=>(0,B.jsxs)(`div`,{className:`grid grid-cols-[var(--spacing-gutter)_1fr] min-h-10 items-center border-b border-sand last:border-b-0`,children:[(0,B.jsx)(`div`,{className:`self-stretch flex items-center justify-center font-mono text-[12px] text-tan border-r border-sand`,children:`!`}),(0,B.jsxs)(`div`,{className:`px-3 py-2 min-w-0`,children:[(0,B.jsx)(G,{tone:e.level===`error`?`bad`:`warn`,children:e.check}),e.fixable&&(0,B.jsx)(`span`,{className:`ml-1.5 inline-flex`,children:(0,B.jsx)(G,{tone:`outline`,children:`fixable`})}),e.detail&&(0,B.jsx)(`div`,{className:`text-[13px] text-umber mt-1 break-words`,children:e.detail})]})]},e.check)),h&&(0,B.jsxs)(`div`,{className:`px-3 py-2 text-[12px] font-mono text-ink3 flex items-center gap-2 flex-wrap`,children:[h.summary.ok,` ok · `,h.summary.warn,` warn · `,h.summary.error,` error`,d?.result?.delta&&(0,B.jsxs)(`span`,{className:d.result.delta.warn+d.result.delta.error<0?`text-leaf`:`text-tan`,children:[`· after fix: Δ warn `,d.result.delta.warn,` · error `,d.result.delta.error,d.result.fixed?.fixedFindings.length?` · fixed: ${d.result.fixed.fixedFindings.join(`, `)}`:` · nothing changed`]}),(0,B.jsxs)(`span`,{className:`ml-auto flex gap-1.5`,children:[f.length>0&&(0,B.jsxs)(K,{size:`sm`,tone:O?`primary`:`default`,onClick:()=>b({kind:`fix`}),title:O?`run the MCP doctor's own fix for the findings it tags fixable`:`bus writes are off — the fix is a bus write`,children:[`Fix fixable (`,f.length,`)`]}),p&&(m?(0,B.jsx)(K,{size:`sm`,onClick:()=>b({kind:`rebuild`}),title:`src/ newer than dist/ in the kit checkout — rebuild the MCP (pnpm --filter agent-coord-mcp build)`,children:`Rebuild kit MCP…`}):(0,B.jsx)(K,{size:`sm`,onClick:()=>xd(ee??``,{answers:void 0}),disabled:!ee,title:ee?`ask ${ee} to publish/rebuild the MCP`:`no live kit coordinator`,children:`Ask kit coordinator`}))]})]})]})]})]})}function Xf({room:e,project:t,agents:n,onClose:r}){let[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(!1),[c,l]=(0,P.useState)(!1),[u,d]=(0,P.useState)(null);return(0,B.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-walnut/30 flex items-start justify-center pt-[12vh]`,onMouseDown:e=>{e.target===e.currentTarget&&r()},children:(0,B.jsxs)(`div`,{className:`w-[560px] bg-paper border border-brick rounded-kit shadow-panel`,children:[(0,B.jsxs)(`div`,{className:`px-4 py-3 border-b border-sand font-display font-bold text-[18px] text-brick`,children:[`Decommission fleet + channel #`,e]}),(0,B.jsxs)(`div`,{className:`p-4 grid gap-3 text-[13px]`,children:[(0,B.jsxs)(`div`,{className:`text-umber`,children:[`This will `,(0,B.jsxs)(`b`,{className:`text-walnut`,children:[`force_unregister `,n.length,` agent`,n.length===1?``:`s`]}),` (`,n.slice(0,6).join(`, `),n.length>6?`…`:``,`), then `,(0,B.jsxs)(`b`,{className:`text-walnut`,children:[`delete_room #`,e]}),` (message history is kept in `,(0,B.jsx)(`code`,{children:`~/agent-coord/history`}),`). Repo and seam files are never touched.`]}),(0,B.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),` also remove `,(0,B.jsx)(`b`,{children:t}),` from groundwork-console.config.json`]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Type the room name to confirm`}),(0,B.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),placeholder:e,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]}),(0,B.jsxs)(`div`,{className:`text-[12px] text-umber`,children:[`Bus writes are gated: without `,(0,B.jsx)(`code`,{children:`GROUNDWORK_CONSOLE_BUS_WRITES=1`}),` on the API this runs as a `,(0,B.jsx)(`b`,{children:`dry-run`}),` and records what it would do (see Runs). With the switch on, it executes as `,(0,B.jsx)(`code`,{children:`groundwork-console`}),`.`]}),u&&(0,B.jsxs)(`div`,{className:`p-2 rounded-kit border ${u.status===`ok`?`border-moss-line bg-moss-wash/50`:`border-brick-line bg-brick-wash/50`}`,children:[(0,B.jsxs)(`div`,{className:`font-mono text-[12px]`,children:[(0,B.jsx)(G,{tone:u.status===`ok`?`ok`:`bad`,children:u.status}),` `,(0,B.jsx)(`b`,{children:u.label})]}),(0,B.jsx)(`pre`,{className:`m-0 mt-1 font-mono text-[12px] whitespace-pre-wrap`,children:u.log.join(`
|
|
39
|
+
`+e.error:``]})]});return(0,B.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-walnut/30 flex items-start justify-center pt-[10vh]`,onMouseDown:e=>{e.target===e.currentTarget&&s()},children:(0,B.jsxs)(`div`,{className:`w-[600px] bg-paper border rounded-kit shadow-panel ${t?`border-brick`:`border-sand`}`,children:[(0,B.jsx)(`div`,{className:`px-4 py-3 border-b border-sand font-display font-bold text-[18px] ${t?`text-brick`:`text-umber`}`,children:e}),(0,B.jsxs)(`div`,{className:`p-4 grid gap-3 text-[13px] text-umber`,children:[n,o&&!h&&(0,B.jsx)(`div`,{children:(0,B.jsx)(K,{size:`sm`,onClick:v,disabled:d,children:d?`…`:`Preview (dry-run · writes nothing)`})}),h&&y(h,`preview`),!p&&(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsxs)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:[`Type `,r,` to `,o?`apply — the preview above changed nothing`:`confirm`]}),(0,B.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]}),p&&y(p,`result`)]}),(0,B.jsxs)(`div`,{className:`px-4 py-3 border-t border-sand flex justify-end gap-2`,children:[(0,B.jsx)(K,{size:`sm`,onClick:s,children:p?`Close`:`Cancel`}),!p&&(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:_,disabled:l!==r||d,children:d?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(Na,{}),` Running…`]}):o?`Apply`:`Run`})]})]})})}var Kf=`18px 1.6fr 1fr 1fr 1fr 1.2fr auto`,qf=[[`automation`,`groundwork-console: reads + prefixed sends only; no record authority`],[`coordinator`,`routes work, noise sink, faces the fleet`],[`coord-worker`,`lane owner, own worktree, cites every DONE`],[`coord-qa`,`quality gate; PASS/FAIL @ head`],[`coord-ci`,`release operator; merges on cited PASS`],[`coord-aide`,`David’s comms point; owns QUEUE`],[`coord-audit`,`read-only architecture drift`],[`coord-fleet`,`stands up a fleet in tmux`],[`coord-handover`,`context-clear snapshot`]],Jf=e=>e===null?`—`:e<6e4?`just now`:e<36e5?`${Math.round(e/6e4)} min`:e<864e5?`${Math.round(e/36e5)} h`:`${Math.round(e/864e5)} d`;function Yf(){let{current:e,projects:t}=Ha(),{data:n,error:r,loading:i}=q(`/bus/agents`,2e4),[a,o]=(0,P.useState)(`project`),{runs:s}=Ga(),c=q(`/kit`).data,[l,u]=(0,P.useState)(!1),d=s.find(e=>(e.label===`bus doctor`||e.label===`bus doctor · fix`)&&e.status===`ok`),f=(d?.result?.findings??[]).filter(e=>e.fixable&&e.level!==`ok`),p=(d?.result?.findings??[]).find(e=>e.check===`dist-behind-source`&&e.level!==`ok`),m=q(`/health`,6e4).data?.requires?.paths?.kitCheckout??null,h=d?.result,g=async()=>{u(!0);try{await Ia(`/actions/bus-doctor`)}finally{u(!1)}},[_,v]=(0,P.useState)(!1),[y,b]=(0,P.useState)(null),[x,S]=(0,P.useState)(null),[C,w]=(0,P.useState)(!1),[T,E]=(0,P.useState)(!1),D=q(a===`project`&&e?`/projects/${e}/fleet`:null,2e4).data,O=q(`/admin/bus-writes`,1e4).data?.enabled??!1,k=ar(),A=n??[],j=t.find(t=>t.name===e)?.room,M=A.filter(t=>t.project===e||j&&t.project===j),N=a===`project`?M:A,ee=A.find(e=>/coordinator/i.test(e.role??``)&&/kit|agent-workflow/i.test(e.project??``)&&e.reachability!==`dead`)?.agentId??null,F=N.filter(e=>e.reachability===`dead`&&![`groundwork-console`,`david`].includes(e.agentId)).map(e=>e.agentId),I=N.filter(e=>e.reachability===`live`).length,te=e=>t.find(t=>t.name===e.project||t.room&&t.room===e.project)?.name,ne=e=>te(e)??`~${e.project??`—`}`,re=a===`all`?[...new Set(A.map(ne))].sort((e,t)=>!!e.startsWith(`~`)-+!!t.startsWith(`~`)||e.localeCompare(t)):[e],L=e=>{if(e.startsWith(`~`))return{title:`#${e.slice(1)}`,path:`not registered as a project`,registered:!1};let n=t.find(t=>t.name===e);return{title:e,path:n?.room?`#${n.room}`:`no room linked`,registered:!0}};return(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_340px] gap-4 p-4 max-[980px]:grid-cols-1`,children:[(0,B.jsxs)(`div`,{className:`grid gap-3.5 content-start min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3 flex-wrap`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`span`,{className:`font-display font-bold text-[34px] leading-[1.1] tracking-[-.015em] text-ember`,children:`Fleets`}),(0,B.jsxs)(`span`,{className:`ml-3 text-[13px] text-umber whitespace-nowrap`,children:[a===`project`?`${e} · `:`all projects · `,N.length,` registered · `,I,` live`]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap justify-end`,children:[(0,B.jsxs)(`span`,{className:`inline-flex border border-dust rounded-kit overflow-hidden whitespace-nowrap`,children:[(0,B.jsxs)(`button`,{onClick:()=>o(`project`),"aria-pressed":a===`project`,className:`px-2.5 py-[5px] text-[12px] font-medium border-0 cursor-pointer ${a===`project`?`bg-walnut text-paper`:`bg-paper text-umber`}`,children:[e||`project`,` · `,M.length]}),(0,B.jsxs)(`button`,{onClick:()=>o(`all`),"aria-pressed":a===`all`,className:`px-2.5 py-[5px] text-[12px] font-medium border-0 cursor-pointer ${a===`all`?`bg-walnut text-paper`:`bg-paper text-umber`}`,children:[`all · `,A.length]})]}),(0,B.jsx)(K,{size:`sm`,onClick:()=>k(`/monitor`),children:`Monitor`}),(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:()=>w(!0),title:`spawn an agent into tmux for this project`,children:`Spawn agent…`}),(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(K,{size:`sm`,onClick:()=>E(e=>!e),"aria-expanded":T,children:`Admin ▾`}),T&&(0,B.jsxs)(`div`,{className:`absolute right-0 top-[calc(100%+6px)] z-40 w-[260px] bg-paper border border-sand rounded-kit shadow-panel whitespace-normal text-left`,onMouseLeave:()=>E(!1),children:[(0,B.jsxs)(`button`,{className:`w-full text-left px-3 py-2 text-[13px] border-0 bg-transparent cursor-pointer hover:bg-linen border-b border-sand`,onClick:()=>{E(!1),g()},disabled:l,children:[l?`Running doctor…`:`Run bus doctor`,(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-tan`,children:`MCP doctor as groundwork-console · read-only`})]}),(0,B.jsxs)(`button`,{className:`w-full text-left px-3 py-2 text-[13px] border-0 bg-transparent cursor-pointer hover:bg-linen border-b border-sand`,onClick:()=>{E(!1),b({kind:`prune`})},children:[`Prune bus data…`,(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-tan`,children:`old messages/status/inbox · dry-run first`})]}),(0,B.jsxs)(`button`,{className:`w-full text-left px-3 py-2 text-[13px] border-0 bg-transparent cursor-pointer hover:bg-linen border-b border-sand disabled:opacity-50`,onClick:()=>{E(!1),b({kind:`dead`})},disabled:F.length===0,children:[`Unregister dead (`,F.length,a===`project`?` in ${e}`:``,`)…`,(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-tan`,children:`force_unregister agents inactive > 24 h`})]}),j&&(0,B.jsxs)(`button`,{className:`w-full text-left px-3 py-2 text-[13px] border-0 bg-transparent cursor-pointer hover:bg-linen text-brick`,onClick:()=>{E(!1),v(!0)},children:[`Decommission fleet + #`,j,`…`,(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-tan`,children:`unregister members + delete room`})]}),!O&&(0,B.jsx)(`div`,{className:`px-3 py-2 font-mono text-[11px] text-tan border-t border-sand`,children:`bus writes are off — admin actions dry-run / refuse`})]})]})]})]}),C&&(0,B.jsx)(Jd,{project:e,canWrite:O,onClose:()=>{w(!1)}}),x&&(0,B.jsx)(id,{agentId:x,onClose:()=>S(null)}),y?.kind===`fix`&&(0,B.jsx)(Gf,{title:`Bus doctor · fix fixable (${f.length})`,confirmWord:`FIX`,action:`/actions/bus-doctor`,payload:{fix:!0},onClose:()=>{b(null),g()},body:(0,B.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,B.jsxs)(`div`,{children:[`Runs the MCP `,(0,B.jsx)(`code`,{children:`doctor`}),` with `,(0,B.jsx)(`code`,{children:`fix: true`}),` as `,(0,B.jsx)(`code`,{children:`groundwork-console`}),` — only its own fix path, only the findings it tags `,(0,B.jsx)(`b`,{children:`fixable`}),`. Before/after counts and the delta are shown in the result; nothing in `,(0,B.jsx)(`code`,{children:`~/agent-coord`}),` is edited by hand. Gated by bus writes.`]}),(0,B.jsx)(`ul`,{className:`m-0 pl-4 grid gap-0.5`,children:f.map(e=>(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`code`,{children:e.check}),e.detail?(0,B.jsxs)(`span`,{className:`text-umber`,children:[` — `,e.detail.slice(0,120)]}):null]},e.check))}),!O&&(0,B.jsx)(`div`,{className:`text-brick`,children:`bus writes are off — the API will answer 403 until you switch them on in the header.`})]})}),y?.kind===`rebuild`&&(0,B.jsx)(Gf,{title:`Rebuild kit MCP`,confirmWord:`BUILD`,action:`/actions/rebuild-kit-mcp`,payload:{},onClose:()=>{b(null),g()},body:(0,B.jsxs)(`div`,{children:[`dist-behind-source is not doctor-fixable: the kit checkout's `,(0,B.jsx)(`code`,{children:`src/`}),` is newer than `,(0,B.jsx)(`code`,{children:`dist/`}),`. Runs `,(0,B.jsx)(`code`,{children:`pnpm --filter agent-coord-mcp build`}),` in `,(0,B.jsx)(`code`,{children:m}),` (the doctor's own advice: `,(0,B.jsx)(`code`,{children:`npm run build`}),`, then restart sessions). Live MCP sessions keep the old inode until agents restart / re-attach. Shell Run, bus-writes gated.`]})}),y?.kind===`prune`&&(0,B.jsx)(Gf,{title:`Prune bus data`,confirmWord:`PRUNE`,action:`/actions/prune`,payload:{dryRun:!1,olderThanDays:30,targets:[`rooms`,`status`,`inbox`,`receipts`,`members`],removeOrphanInboxes:!0},preview:()=>Ia(`/actions/prune`,{dryRun:!0,olderThanDays:30,targets:[`rooms`,`status`,`inbox`,`receipts`,`members`],removeOrphanInboxes:!0}),onClose:()=>b(null),body:(0,B.jsxs)(`div`,{children:[`MCP `,(0,B.jsx)(`code`,{children:`prune`}),`: removes room messages / status entries / inbox items / receipts older than `,(0,B.jsx)(`b`,{children:`30 days`}),` (decisions kept longer), orphan inboxes and stale memberships. Preview first — the tool has a native dry-run. Requires bus writes on.`]})}),y?.kind===`dead`&&(0,B.jsx)(Gf,{danger:!0,title:`Unregister ${F.length} dead agent${F.length===1?``:`s`}`,confirmWord:`UNREGISTER`,action:`/actions/unregister-dead`,payload:{agentIds:F},onClose:()=>b(null),body:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`code`,{children:`force_unregister`}),` for every agent in `,(0,B.jsx)(`b`,{children:a===`project`?e:`all projects`}),` whose last activity is over 24 h old: `,(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-walnut break-words`,children:F.join(`, `)}),`. Registry entries, transports and inbox markers go; room history stays. Requires bus writes on.`]})}),y?.kind===`one`&&(0,B.jsx)(Gf,{danger:!0,title:`Unregister ${y.id}`,confirmWord:y.id,action:`/actions/unregister`,payload:{agentId:y.id},onClose:()=>b(null),body:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`code`,{children:`force_unregister`}),` `,(0,B.jsx)(`b`,{children:y.id}),`. Requires bus writes on.`]})}),_&&j&&(0,B.jsx)(Xf,{room:j,project:e,agents:M.map(e=>e.agentId),onClose:()=>v(!1)}),r&&(0,B.jsxs)(U,{className:`px-4 py-3 text-[13px] text-brick`,children:[`API error: `,r]}),a===`project`&&D?.state===`present`&&(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`Fleet`,icon:`fleet`,path:`${D.live.length} live · topology`}),(0,B.jsx)(`div`,{className:`px-3 py-3`,children:(0,B.jsx)(Yd,{project:e,fleet:D,canWrite:O,onOpenPane:e=>S(e)})})]}),a===`project`&&(0,B.jsx)(Qd,{project:e,canWrite:O}),N.length===0&&!i&&a===`all`&&(0,B.jsx)(U,{className:`px-4 py-3 text-[13px] text-umber`,children:`No agents registered on the bus.`}),re.filter(e=>a!==`all`||N.some(t=>ne(t)===e)).map(e=>{let t=L(e),n=a===`all`?N.filter(t=>ne(t)===e):N;return(0,B.jsxs)(U,{children:[a===`all`&&(0,B.jsx)(W,{title:t.title,icon:`fleet`,path:`${t.path} · ${n.length} agent${n.length===1?``:`s`}`,children:!t.registered&&(0,B.jsx)(G,{tone:`outline`,children:`not registered`})}),(0,B.jsxs)(Aa,{cols:Kf,children:[(0,B.jsx)(`span`,{}),(0,B.jsx)(`span`,{children:`Agent`}),(0,B.jsx)(`span`,{children:`Role`}),(0,B.jsx)(`span`,{children:`Project`}),(0,B.jsx)(`span`,{children:`Transport`}),(0,B.jsx)(`span`,{children:`Pane · last seen`}),(0,B.jsx)(`span`,{})]}),n.map(e=>(0,B.jsxs)(`div`,{className:`grid gap-3 items-center px-3 min-h-10 border-b border-sand last:border-b-0 hover:bg-linen/60`,style:{gridTemplateColumns:Kf},children:[(0,B.jsx)(Ma,{state:e.reachability,active:e.active}),(0,B.jsx)(`span`,{className:`font-mono font-medium text-[13px] truncate`,children:e.agentId}),(0,B.jsx)(`span`,{className:`text-umber text-[13px] truncate`,children:e.role??`—`}),(0,B.jsx)(`span`,{className:`font-mono text-[13px] truncate`,children:e.project??`—`}),(0,B.jsx)(`span`,{className:`justify-self-start`,children:e.transport?(0,B.jsx)(G,{tone:`outline`,children:e.transport}):e.reachability===`dead`?(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-tan`,children:`—`}):(0,B.jsx)(G,{tone:`warn`,children:`not attached`})}),(0,B.jsxs)(`span`,{className:`font-mono text-[12px] text-ink3`,children:[e.progress&&e.progress.state!==`emitting`&&(0,B.jsx)(G,{tone:e.progress.state===`silent-on-bus`?`warn`:`outline`,children:e.progress.state===`unknown`?`nothing on the bus in window`:e.progress.state}),e.progress&&e.progress.state!==`emitting`?` `:``,e.pane?(0,B.jsx)(`button`,{className:`border-0 bg-transparent p-0 font-mono text-[12px] text-ember-deep cursor-pointer underline decoration-dotted`,onClick:()=>S(e.agentId),title:`view pane`,children:e.pane}):`—`,` · `,Jf(e.heartbeatAgeMs),e.paneCommand?(0,B.jsxs)(`span`,{className:`text-tan`,children:[` · `,e.paneCommand]}):``]}),e.reachability===`dead`?(0,B.jsx)(K,{tone:`ghost`,size:`sm`,onClick:()=>b({kind:`one`,id:e.agentId}),children:`Unregister`}):(0,B.jsx)(K,{tone:`ghost`,size:`sm`,onClick:()=>xd(e.agentId),children:`DM`})]},e.agentId))]},e)})]}),(0,B.jsxs)(`aside`,{className:`grid gap-3.5 content-start min-w-0`,children:[(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`Liveness rule`,icon:`health`,path:`pane activity ∨ heartbeat`}),(0,B.jsxs)(`div`,{className:`px-3 py-2 text-[13px] text-umber`,children:[`last seen = freshest of tmux `,(0,B.jsx)(`code`,{children:`window_activity`}),`, heartbeat, transport/inbox mtimes · `,(0,B.jsx)(`b`,{className:`text-walnut`,children:`live`}),` < 15 min · idle < 24 h · dead beyond. Pulsing dot = pane content changed in the last 60 s (the bottom 3 lines — status/timer strip — are ignored, so an idle harness redrawing its clock does not pulse). Click a pane id to watch it (read-only).`]})]}),(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`Roles`,icon:`fleet`,path:`playbook ${c?.packages?.playbook?.version??`…`}`}),(0,B.jsx)(`div`,{className:`px-3 pt-1.5 pb-2.5 grid gap-1 text-[13px] text-umber`,children:qf.map(([e,t])=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`b`,{className:`text-walnut`,children:e}),` — `,t]},e))})]}),(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`Bus doctor`,icon:`doctor`,path:h?`mcp doctor · ${new Date(d.endedAt??d.startedAt).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`:`mcp doctor as groundwork-console`,children:h&&(0,B.jsx)(G,{tone:h.healthy?`ok`:`warn`,children:h.healthy?`healthy`:`${h.summary.warn} warn · ${h.summary.error} error`})}),!h&&(0,B.jsxs)(`div`,{className:`px-3 py-2 text-[13px] text-umber`,children:[`Press `,(0,B.jsx)(`b`,{children:`Run doctor`}),` — calls the MCP `,(0,B.jsx)(`code`,{children:`doctor`}),` tool as `,(0,B.jsx)(`code`,{children:`groundwork-console`}),` (automation). Read-only; `,(0,B.jsx)(`code`,{children:`fix`}),` stays gated.`]}),h?.findings.filter(e=>e.level!==`ok`).map(e=>(0,B.jsxs)(`div`,{className:`grid grid-cols-[var(--spacing-gutter)_1fr] min-h-10 items-center border-b border-sand last:border-b-0`,children:[(0,B.jsx)(`div`,{className:`self-stretch flex items-center justify-center font-mono text-[12px] text-tan border-r border-sand`,children:`!`}),(0,B.jsxs)(`div`,{className:`px-3 py-2 min-w-0`,children:[(0,B.jsx)(G,{tone:e.level===`error`?`bad`:`warn`,children:e.check}),e.fixable&&(0,B.jsx)(`span`,{className:`ml-1.5 inline-flex`,children:(0,B.jsx)(G,{tone:`outline`,children:`fixable`})}),e.detail&&(0,B.jsx)(`div`,{className:`text-[13px] text-umber mt-1 break-words`,children:e.detail})]})]},e.check)),h&&(0,B.jsxs)(`div`,{className:`px-3 py-2 text-[12px] font-mono text-ink3 flex items-center gap-2 flex-wrap`,children:[h.summary.ok,` ok · `,h.summary.warn,` warn · `,h.summary.error,` error`,d?.result?.delta&&(0,B.jsxs)(`span`,{className:d.result.delta.warn+d.result.delta.error<0?`text-leaf`:`text-tan`,children:[`· after fix: Δ warn `,d.result.delta.warn,` · error `,d.result.delta.error,d.result.fixed?.fixedFindings.length?` · fixed: ${d.result.fixed.fixedFindings.join(`, `)}`:` · nothing changed`]}),(0,B.jsxs)(`span`,{className:`ml-auto flex gap-1.5`,children:[f.length>0&&(0,B.jsxs)(K,{size:`sm`,tone:O?`primary`:`default`,onClick:()=>b({kind:`fix`}),title:O?`run the MCP doctor's own fix for the findings it tags fixable`:`bus writes are off — the fix is a bus write`,children:[`Fix fixable (`,f.length,`)`]}),p&&(m?(0,B.jsx)(K,{size:`sm`,onClick:()=>b({kind:`rebuild`}),title:`src/ newer than dist/ in the kit checkout — rebuild the MCP (pnpm --filter agent-coord-mcp build)`,children:`Rebuild kit MCP…`}):(0,B.jsx)(K,{size:`sm`,onClick:()=>xd(ee??``,{answers:void 0}),disabled:!ee,title:ee?`ask ${ee} to publish/rebuild the MCP`:`no live kit coordinator`,children:`Ask kit coordinator`}))]})]})]})]})]})}function Xf({room:e,project:t,agents:n,onClose:r}){let[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(!1),[c,l]=(0,P.useState)(!1),[u,d]=(0,P.useState)(null);return(0,B.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-walnut/30 flex items-start justify-center pt-[12vh]`,onMouseDown:e=>{e.target===e.currentTarget&&r()},children:(0,B.jsxs)(`div`,{className:`w-[560px] bg-paper border border-brick rounded-kit shadow-panel`,children:[(0,B.jsxs)(`div`,{className:`px-4 py-3 border-b border-sand font-display font-bold text-[18px] text-brick`,children:[`Decommission fleet + channel #`,e]}),(0,B.jsxs)(`div`,{className:`p-4 grid gap-3 text-[13px]`,children:[(0,B.jsxs)(`div`,{className:`text-umber`,children:[`This will `,(0,B.jsxs)(`b`,{className:`text-walnut`,children:[`force_unregister `,n.length,` agent`,n.length===1?``:`s`]}),` (`,n.slice(0,6).join(`, `),n.length>6?`…`:``,`), then `,(0,B.jsxs)(`b`,{className:`text-walnut`,children:[`delete_room #`,e]}),` (message history is kept in `,(0,B.jsx)(`code`,{children:`~/agent-coord/history`}),`). Repo and seam files are never touched.`]}),(0,B.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),` also remove `,(0,B.jsx)(`b`,{children:t}),` from groundwork-console.config.json`]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Type the room name to confirm`}),(0,B.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),placeholder:e,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]}),(0,B.jsxs)(`div`,{className:`text-[12px] text-umber`,children:[`Bus writes are gated: without `,(0,B.jsx)(`code`,{children:`GROUNDWORK_CONSOLE_BUS_WRITES=1`}),` on the API this runs as a `,(0,B.jsx)(`b`,{children:`dry-run`}),` and records what it would do (see Runs). With the switch on, it executes as `,(0,B.jsx)(`code`,{children:`groundwork-console`}),`.`]}),u&&(0,B.jsxs)(`div`,{className:`p-2 rounded-kit border ${u.status===`ok`?`border-moss-line bg-moss-wash/50`:`border-brick-line bg-brick-wash/50`}`,children:[(0,B.jsxs)(`div`,{className:`font-mono text-[12px]`,children:[(0,B.jsx)(G,{tone:u.status===`ok`?`ok`:`bad`,children:u.status}),` `,(0,B.jsx)(`b`,{children:u.label})]}),(0,B.jsx)(`pre`,{className:`m-0 mt-1 font-mono text-[12px] whitespace-pre-wrap`,children:u.log.join(`
|
|
40
40
|
`)})]})]}),(0,B.jsxs)(`div`,{className:`px-4 py-3 border-t border-sand flex justify-end gap-2`,children:[(0,B.jsx)(K,{size:`sm`,onClick:r,children:u?`Close`:`Cancel`}),!u&&(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:async()=>{l(!0);try{d(await Ia(`/actions/decommission`,{room:e,confirm:i,removeProject:o}))}finally{l(!1)}},disabled:i!==e||c,children:c?`Running…`:`Decommission`})]})]})})}var Zf=`1.4fr .6fr .9fr .9fr 1.2fr 2fr`,Qf=({on:e,label:t})=>(0,B.jsx)(`span`,{className:`font-mono text-[11px] px-1.5 py-0.5 rounded ${e?`bg-linen text-umber`:`text-tan line-through opacity-60`}`,children:t}),$f=e=>e?e.replace(/^\/Users\/[^/]+/,`~`):null;function ep(){let{current:e}=Ha(),{data:t,error:n,refresh:r}=q(e?`/projects/${e}/skills`:null,6e4),[i,a]=(0,P.useState)(null),[o,s]=(0,P.useState)(!1),c=q(i===`pb`||i===`reload`?`/actions/reload-skills`:null,3e4);if(n)return(0,B.jsx)(`div`,{className:`p-4`,children:(0,B.jsxs)(U,{className:`px-4 py-3 text-[13px] text-brick`,children:[`API error: `,n]})});if(!t)return(0,B.jsx)(`div`,{className:`p-4 text-umber`,children:`Scanning skills…`});let l=t.groundwork,u=t.playbook,d=l.skills.filter(e=>e.installed&&e.inSync===!1).length+u.cards.filter(e=>e.installed&&(e.inSync===!1||e.legacyEssay)).length+ +!!l.driftedVersion+u.legacyDirs.length;return(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_340px] gap-4 p-4 max-[980px]:grid-cols-1`,children:[i===`gwinit`&&(0,B.jsx)(Gf,{title:`groundwork init · ${e}`,confirmWord:e,action:`/actions/groundwork-init/${e}`,payload:{},onClose:()=>{a(null),r()},body:(0,B.jsxs)(`div`,{children:[`Runs `,(0,B.jsx)(`code`,{children:`groundwork init <repo>`}),` — installs the skills, IDE mirrors and the `,(0,B.jsx)(`code`,{children:`docs/`}),` scaffold (WORKSTREAMS/QUEUE/DONE/FACTS, methodology, templates, phases/) into the working tree. Nothing is committed; review with `,(0,B.jsx)(`code`,{children:`git status`}),`. Only offered when `,(0,B.jsx)(`code`,{children:`docs/.groundwork/VERSION`}),` is missing.`]})}),i===`gw`&&(0,B.jsx)(Gf,{title:`groundwork update · ${e}`,confirmWord:e,action:`/actions/groundwork-update/${e}`,payload:{all:!0,docs:!0},onClose:()=>{a(null),r()},body:(0,B.jsxs)(`div`,{children:[`Runs `,(0,B.jsxs)(`code`,{children:[`groundwork update `,`<repo>`,` --all --docs`]}),` from the kit (`,l.kitVersion,`): refreshes installed skills + IDE mirrors, adds skills added upstream, refreshes the generic reference docs (methodology, COMMANDS, _INDEX), bumps `,(0,B.jsx)(`code`,{children:`docs/.groundwork/VERSION`}),`. `,(0,B.jsx)(`b`,{className:`text-walnut`,children:`Writes into the repo working tree`}),` (uncommitted — review in Docs, which highlights the changes). Project docs (PRD, WORKSTREAMS…) are left alone.`]})}),i===`pb`&&(0,B.jsx)(Gf,{title:`agent-coordination update (global)`,confirmWord:`UPDATE`,action:`/actions/playbook-update`,payload:{dryRun:!1},preview:()=>Ia(`/actions/playbook-update`,{dryRun:!0}),onDone:()=>s(!0),onClose:()=>{r(),o?(s(!1),a(`reload`)):a(null)},body:(0,B.jsxs)(`div`,{children:[`Re-syncs the playbook field cards into every harness home found on this machine (`,(u.homes??[]).map(e=>e.harness).join(`, `)||`claude`,` → `,(0,B.jsx)(`code`,{children:`--harness=`}),` all detected, so grok & co. mirrors refresh too) from `,(0,B.jsx)(`code`,{children:$f(u.source)??`kit ${u.kitVersion}`}),`; removes legacy dirs. Machine-global. `,(0,B.jsx)(`b`,{className:`text-walnut`,children:`Preview = dry-run plan, writes nothing; Apply (type UPDATE) writes.`})]})}),i===`reload`&&(c.data?.supported?(0,B.jsx)(Gf,{title:`reload skills · ${c.data.agents.length} live session${c.data.agents.length===1?``:`s`}`,confirmWord:`RELOAD`,action:`/actions/reload-skills`,payload:{},onClose:()=>a(null),body:(0,B.jsxs)(`div`,{children:[`The playbook cards on disk changed. Type `,(0,B.jsx)(`code`,{children:`/reload-skills`}),` RAW into every live tmux-attached agent's CLI (MCP `,(0,B.jsx)(`code`,{children:`send_command`}),`, bus-writes gated) so running sessions pick the new cards up without a restart: `,(0,B.jsx)(`span`,{className:`font-mono text-[12px]`,children:c.data.agents.join(` · `)||`— none live —`}),`. Per-agent delivery (confirmed / pending) lands in the Run.`]})}):(0,B.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-walnut/30 flex items-start justify-center pt-[10vh]`,onMouseDown:e=>{e.target===e.currentTarget&&a(null)},children:(0,B.jsxs)(`div`,{className:`w-[560px] bg-paper border border-sand rounded-kit shadow-panel p-4 grid gap-2 text-[13px] text-umber`,children:[(0,B.jsx)(`div`,{className:`font-display font-bold text-[18px]`,children:`reload skills in live sessions`}),(0,B.jsx)(`div`,{children:c.data?(0,B.jsxs)(B.Fragment,{children:[`Not available: `,c.data.hint,` (connected allowlist: `,(0,B.jsx)(`code`,{children:c.data.allowlist?.join(` `)??`unknown`}),`). Ask agents to run `,(0,B.jsx)(`code`,{children:`/reload-skills`}),` themselves, or restart their sessions.`]}):c.error?`API error: ${c.error}`:`checking the connected agent-coord-mcp…`}),(0,B.jsx)(`div`,{className:`flex justify-end`,children:(0,B.jsx)(K,{size:`sm`,onClick:()=>a(null),children:`Close`})})]})})),(0,B.jsxs)(`div`,{className:`grid gap-3.5 content-start min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`font-display font-bold text-[34px] leading-[1.1] tracking-[-.015em] text-ember`,children:`Skills`}),(0,B.jsxs)(`span`,{className:`ml-3 text-[13px] text-umber`,children:[`what each harness can run — `,e,` and globally · byte-compared to the kit`]})]}),(0,B.jsxs)(`span`,{className:`text-[13px] text-umber`,children:[d,` need attention`]})]}),(0,B.jsxs)(U,{children:[(0,B.jsxs)(W,{title:`Groundwork · per repo`,icon:`skills`,eyebrow:`payload/skills · .claude/skills`,path:`marker ${l.versionMarker??`—`} · kit ${l.kitVersion}`,children:[l.driftedVersion&&(0,B.jsxs)(G,{tone:`warn`,children:[`behind `,l.kitVersion]}),!l.versionMarker&&(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:()=>a(`gwinit`),title:`this repo has no docs/.groundwork/VERSION — install Groundwork`,children:`groundwork init…`}),l.versionMarker&&(0,B.jsx)(K,{size:`sm`,tone:l.driftedVersion?`primary`:`default`,onClick:()=>a(`gw`),children:`groundwork update…`})]}),(0,B.jsxs)(Aa,{cols:Zf,children:[(0,B.jsx)(`span`,{children:`Skill`}),(0,B.jsx)(`span`,{children:`Tier`}),(0,B.jsx)(`span`,{children:`Installed`}),(0,B.jsx)(`span`,{children:`In sync`}),(0,B.jsx)(`span`,{children:`Mirrors`}),(0,B.jsx)(`span`,{children:`Description`})]}),l.skills.map(e=>(0,B.jsxs)(`div`,{className:`grid gap-3 items-center px-3 min-h-10 border-b border-sand last:border-b-0 hover:bg-linen/60`,style:{gridTemplateColumns:Zf},children:[(0,B.jsxs)(`span`,{className:`font-mono font-medium text-[13px]`,children:[`/`,e.name]}),(0,B.jsx)(`span`,{children:(0,B.jsx)(G,{tone:e.tier===`min`?`neutral`:`outline`,children:e.tier===`min`?`core`:`optional`})}),(0,B.jsx)(`span`,{children:e.installed?(0,B.jsx)(G,{tone:`ok`,children:`installed`}):(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-tan`,children:`—`})}),(0,B.jsx)(`span`,{children:e.installed?e.inSync?(0,B.jsx)(G,{tone:`ok`,children:`= kit`}):(0,B.jsx)(G,{tone:`warn`,children:`differs`}):(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-tan`,children:`—`})}),(0,B.jsxs)(`span`,{className:`flex gap-1`,children:[(0,B.jsx)(Qf,{on:e.mirrors.cursor,label:`cursor`}),(0,B.jsx)(Qf,{on:e.mirrors.vscode,label:`vscode`})]}),(0,B.jsx)(`span`,{className:`text-[13px] text-umber truncate`,title:e.description,children:e.description})]},e.name))]}),(0,B.jsxs)(U,{children:[(0,B.jsxs)(W,{title:`Playbook · machine-global`,icon:`skills`,eyebrow:`field cards`,path:`${(u.homes??[]).map(e=>`${e.harness}: ${e.dir.replace(/^\/Users\/[^/]+/,`~`)}`).join(` · `)||`~/.claude/skills`} · kit ${u.kitVersion}`,children:[(0,B.jsx)(K,{size:`sm`,onClick:()=>a(`pb`),children:`agent-coordination update…`}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,title:`type /reload-skills raw into every live tmux-attached session (needs agent-coord-mcp ≥0.25.0)`,onClick:()=>a(`reload`),children:`reload skills…`})]}),(0,B.jsxs)(Aa,{cols:Zf,children:[(0,B.jsx)(`span`,{children:`Card`}),(0,B.jsx)(`span`,{children:`Slices`}),(0,B.jsx)(`span`,{children:`Installed`}),(0,B.jsx)(`span`,{children:`In sync`}),(0,B.jsx)(`span`,{children:`Mirrors`}),(0,B.jsx)(`span`,{children:`Description`})]}),u.cards.map(e=>(0,B.jsxs)(`div`,{className:`grid gap-3 items-center px-3 min-h-10 border-b border-sand last:border-b-0 hover:bg-linen/60`,style:{gridTemplateColumns:Zf},children:[(0,B.jsxs)(`span`,{className:`font-mono font-medium text-[13px]`,children:[`/`,e.name]}),(0,B.jsx)(`span`,{children:e.legacyEssay?(0,B.jsx)(G,{tone:`warn`,children:`775-line essay`}):(0,B.jsxs)(G,{tone:`outline`,children:[e.slices,` slice`,e.slices===1?``:`s`]})}),(0,B.jsx)(`span`,{children:e.installed?(0,B.jsx)(G,{tone:`ok`,children:`installed`}):(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-tan`,children:`—`})}),(0,B.jsx)(`span`,{children:e.installed?e.inSync?(0,B.jsx)(G,{tone:`ok`,children:`= kit`}):(0,B.jsx)(G,{tone:`warn`,children:`differs`}):(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-tan`,children:`—`})}),(0,B.jsxs)(`span`,{className:`flex gap-1 flex-wrap`,children:[(0,B.jsx)(Qf,{on:e.installed,label:`claude`}),(0,B.jsx)(Qf,{on:!!e.homes?.grok?.installed,label:`grok${e.homes?.grok?.installed&&e.homes.grok.inSync===!1?` ≠`:``}`}),(0,B.jsx)(Qf,{on:e.mirrors.cursor,label:`cursor`}),(0,B.jsx)(Qf,{on:e.mirrors.vscode,label:`vscode`}),(0,B.jsx)(Qf,{on:e.mirrors.opencode,label:`opencode`})]}),(0,B.jsx)(`span`,{className:`text-[13px] text-umber truncate`,title:e.description,children:e.description})]},e.name)),u.legacyDirs.length>0&&(0,B.jsxs)(`div`,{className:`px-3 py-2 border-t border-sand text-[13px]`,children:[(0,B.jsx)(G,{tone:`warn`,children:`legacy dirs`}),` `,(0,B.jsxs)(`span`,{className:`text-umber`,children:[u.legacyDirs.join(`, `),` still in `,u.globalDir,` — installer removes them`]})]})]})]}),(0,B.jsxs)(`aside`,{className:`grid gap-3.5 content-start min-w-0`,children:[(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`How this is measured`,icon:`doctor`}),(0,B.jsxs)(`div`,{className:`px-3 py-2 text-[13px] text-umber grid gap-1.5`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`b`,{className:`text-walnut`,children:`In sync`}),` — SHA-1 of the installed `,(0,B.jsx)(`code`,{children:`SKILL.md`}),` equals what the installer writes: groundwork byte-copies (`,(0,B.jsx)(`code`,{children:$f(l.source)??`?`}),`); the playbook installer rewrites `,(0,B.jsx)(`code`,{children:`{{tool:…}}`}),` placeholders per harness first, so the card is compared after that rewrite (`,u.rewrite??`kit rewrite`,`, source `,(0,B.jsx)(`code`,{children:$f(u.source)??`?`}),`).`]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`b`,{className:`text-walnut`,children:`Mirrors`}),` — presence of `,(0,B.jsx)(`code`,{children:`.cursor/commands/<n>.md`}),`, `,(0,B.jsx)(`code`,{children:`.vscode/prompts/<n>.prompt.md`}),`, `,(0,B.jsx)(`code`,{children:`~/.config/opencode/skills/<n>`}),`.`]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`b`,{className:`text-walnut`,children:`Marker`}),` — `,(0,B.jsx)(`code`,{children:`docs/.groundwork/VERSION`}),` vs the kit’s groundwork version.`]}),(0,B.jsxs)(`div`,{children:[`Asked grok for `,(0,B.jsx)(`code`,{children:`groundwork list --json`}),` / `,(0,B.jsx)(`code`,{children:`agent-coordination list --json`}),` to replace the scan.`]})]})]}),(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`Harness mirrors`,icon:`skills`,path:`seam skills-mirror`}),(0,B.jsxs)(`div`,{className:`px-3 py-2 grid gap-2 text-[13px] text-umber`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`b`,{className:`text-walnut`,children:`Claude Code`}),` — canonical `,(0,B.jsx)(`code`,{children:`SKILL.md`}),`; playbook global.`]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`b`,{className:`text-walnut`,children:`Cursor`}),` — `,(0,B.jsx)(`code`,{children:`.cursor/commands`}),`, GENERATED banner.`]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`b`,{className:`text-walnut`,children:`VS Code`}),` — `,(0,B.jsx)(`code`,{children:`.vscode/prompts`}),`, mode from allowed-tools.`]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`b`,{className:`text-walnut`,children:`OpenCode`}),` — auto-discovers `,(0,B.jsx)(`code`,{children:`~/.claude/skills`}),`; templated MCP tool names.`]})]})]})]})]})}var tp=[[`Tier 0 · QA gate`,`typecheck · build · real tests · independent behaviour check → VERDICT PASS @ head`,`coord-qa`],[`Tier 1 · merge → qa`,`CI merges on cited PASS, squash-verify, auto-deploy to qa in < 10 min, smoke`,`coord-ci`],[`Tier 2 · async`,`long suites, perf, security — never blocking; results chased by ci`,`coord-ci`],[`Prod · promotion`,`David only. Fix-forward on qa.`,`david`]],np={"Open PRs":`prs`,"Cutover Gates":`gates`,"Needs David":`needsDavid`,Risks:`risks`,Rooms:`rooms`,"Decisions Recorded":`decisions`},rp=e=>/pass|merged|deployed|✅|green|done/i.test(e)?`ok`:/fail|red|blocked/i.test(e)?`bad`:/david/i.test(e)?`david`:/hold|risk|pending|open/i.test(e)?`warn`:`neutral`,ip=e=>!!e&&Ea.includes(e),ap=e=>e?new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):``;function op({s:e}){let t=e.table?e.table.headers.map(()=>`1fr`).join(` `):``;return(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:e.title,icon:np[e.title],eyebrow:`## ${e.title} · coordinator-only`,path:`docs/WORKSTREAMS.md`}),e.table&&e.table.rows.length>0&&(0,B.jsx)(Aa,{cols:t,children:e.table.headers.map(e=>(0,B.jsx)(`span`,{children:e},e))}),e.table&&e.table.rows.length===1&&Object.values(e.table.rows[0]).every(e=>/^(—|-|none|n\/a|)$/i.test(e.trim())||/none open/i.test(e))?(0,B.jsx)(`div`,{className:`px-3 py-3 text-[13px] text-umber`,children:`none open`}):e.table?.rows.map((n,r)=>(0,B.jsx)(ka,{glyph:`|`,raw:Object.values(n).join(` | `),children:(0,B.jsx)(`div`,{className:`grid gap-3 items-center py-1.5`,style:{gridTemplateColumns:t},children:e.table.headers.map((e,t)=>{let r=n[e]??``,i=/status|state|gate|verdict/i.test(e),a=r.length<=28&&!/[`(]/.test(r);return(0,B.jsx)(`span`,{className:`min-w-0 truncate ${t===0?`font-medium`:`text-[13px] text-umber`}`,title:r,children:i&&r&&a?(0,B.jsx)(G,{tone:rp(r),children:r}):r||(0,B.jsx)(`span`,{className:`text-tan`,children:`—`})},e)})})},r)),e.bullets?.map((e,t)=>(0,B.jsx)(ka,{glyph:`-`,children:(0,B.jsx)(`div`,{className:`py-2 text-[14px]`,children:e})},t)),!e.table?.rows.length&&!e.bullets?.length&&(0,B.jsx)(`div`,{className:`px-3 py-3 text-[13px] text-umber`,children:`empty`})]})}function sp(){let{current:e}=Ha(),{data:t,error:n}=q(e?`/projects/${e}/release`:null,3e4),r=q(`/kit`).data;if(n)return(0,B.jsx)(`div`,{className:`p-4`,children:(0,B.jsxs)(U,{className:`px-4 py-3 text-[13px] text-brick`,children:[`API error: `,n]})});let i=t?.extensions??[],a=i.filter(e=>e.title!==`Rooms`);return(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_340px] gap-4 p-4 max-[980px]:grid-cols-1`,children:[(0,B.jsxs)(`div`,{className:`grid gap-3.5 content-start min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`font-display font-bold text-[34px] leading-[1.1] tracking-[-.015em] text-ember`,children:`Release`}),(0,B.jsxs)(`span`,{className:`ml-3 text-[13px] text-umber`,children:[e,` · coordinator-extension sections of docs/WORKSTREAMS.md + bus VERDICT/DONE`]})]}),(0,B.jsx)(`span`,{className:`text-[13px] text-umber`,children:`tier-1 ceiling 10 min · prod = David`})]}),(0,B.jsx)(`div`,{className:`grid grid-cols-4 border border-sand rounded-kit overflow-hidden max-[980px]:grid-cols-2`,children:tp.map(([e,t,n],r)=>(0,B.jsxs)(`div`,{className:`px-3.5 py-3 border-r border-sand last:border-r-0 ${r===3?`bg-ember-wash`:`bg-paper`}`,children:[(0,B.jsx)(`b`,{className:`block font-bold text-[13px] mb-1 ${r===3?`text-ember-deep`:`text-umber`}`,children:e}),(0,B.jsx)(`span`,{className:`text-[12px] leading-[1.5]`,children:t}),(0,B.jsx)(`span`,{className:`block font-mono font-medium text-[11px] text-ink3 mt-1.5`,children:n})]},e))}),!t&&(0,B.jsx)(`div`,{className:`text-umber text-[13px]`,children:`Reading WORKSTREAMS…`}),t&&i.length===0&&(0,B.jsx)(U,{className:`px-4 py-3 text-[13px] text-umber`,children:`No coordinator-extension sections in this project’s WORKSTREAMS.md (solo project, or not adopted yet).`}),a.map(e=>(0,B.jsx)(op,{s:e},e.title))]}),(0,B.jsxs)(`aside`,{className:`grid gap-3.5 content-start min-w-0`,children:[(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`Dock telemetry`,icon:`bus`,path:`VERDICT / DONE from the room`}),(t?.telemetry??[]).length===0&&(0,B.jsx)(`div`,{className:`px-3 py-2 text-[13px] text-umber`,children:`no VERDICT/DONE messages yet`}),(t?.telemetry??[]).map((e,t)=>{let n=String(e.text??``),r=e.prefix??n.split(/[:\s]/)[0];return(0,B.jsxs)(`div`,{className:`grid grid-cols-[var(--spacing-gutter)_1fr] border-b border-sand last:border-b-0`,children:[(0,B.jsx)(`div`,{className:`py-2.5 flex justify-center font-mono text-[12px] text-tan border-r border-sand`,children:`#`}),(0,B.jsxs)(`div`,{className:`px-3 pt-2 pb-2.5 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex gap-2 items-baseline mb-0.5`,children:[(0,B.jsx)(`span`,{className:`font-semibold text-[13px]`,children:e.from}),(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-ink3`,children:ap(e.ts)})]}),(0,B.jsxs)(`div`,{className:`text-[13px] break-words line-clamp-3`,children:[ip(r)&&(0,B.jsx)(Oa,{prefix:r,fail:/FAIL/.test(n)}),n.replace(/^\w[\w ]*:?\s*/,``)]})]})]},e.id??t)})]}),i.find(e=>e.title===`Rooms`)&&(0,B.jsx)(op,{s:i.find(e=>e.title===`Rooms`)}),(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`Kit versions`,icon:`kit`,path:`kit.json`}),(0,B.jsx)(`div`,{className:`px-3 py-2 grid gap-1 font-mono text-[12px] text-umber`,children:r?.packages?Object.entries(r.packages).map(([e,t])=>(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] gap-2`,children:[(0,B.jsx)(`span`,{children:t.name}),(0,B.jsx)(`b`,{className:`text-walnut`,children:t.version})]},e)):`—`})]}),t&&(0,B.jsx)(`div`,{className:`text-[11px] font-mono text-tan px-1`,children:t.source})]})]})}var cp={queued:`outline`,running:`warn`,ok:`ok`,failed:`bad`,cancelled:`neutral`},lp={mcp:`MCP tool`,cli:`CLI`,bus:`bus send`,shell:`shell`,seam:`seam write`},up=e=>{let t=(e.endedAt??Date.now())-e.startedAt;return t<1e3?`${t} ms`:`${(t/1e3).toFixed(1)} s`},dp=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});function fp(){let{runs:e,running:t}=Ga(),[n]=Fi(),[r,i]=(0,P.useState)(n.get(`run`));(0,P.useEffect)(()=>{let e=n.get(`run`);e&&i(e)},[n]);let a=e.find(e=>e.id===r)??e[0];return(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_480px] gap-4 p-4 max-[1100px]:grid-cols-1`,children:[(0,B.jsxs)(`div`,{className:`grid gap-3.5 content-start min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`font-display font-bold text-[34px] leading-[1.1] tracking-[-.015em] text-ember`,children:`Runs`}),(0,B.jsxs)(`span`,{className:`ml-3 text-[13px] text-umber`,children:[`every action the console performs — MCP tools, CLIs, bus sends, shells · `,t,` running`]})]}),(0,B.jsxs)(`span`,{className:`text-[13px] text-umber`,children:[`last `,e.length]})]}),(0,B.jsxs)(U,{children:[e.length===0&&(0,B.jsxs)(`div`,{className:`px-3 py-3 text-[13px] text-umber`,children:[`Nothing has run yet. Try `,(0,B.jsx)(`b`,{children:`Run doctor`}),` on Fleets or `,(0,B.jsx)(`b`,{children:`Doctor`}),` on the Board.`]}),e.map(e=>(0,B.jsxs)(`button`,{onClick:()=>i(e.id),className:`w-full text-left grid grid-cols-[var(--spacing-gutter)_1fr_auto] items-center min-h-10 border-b border-sand last:border-b-0 border-0 bg-transparent cursor-pointer hover:bg-linen/60 ${a?.id===e.id?`bg-linen/70`:``}`,children:[(0,B.jsx)(`span`,{className:`self-stretch flex items-center justify-center font-mono text-[12px] border-r border-sand ${e.status===`running`?`text-amber animate-pulse`:e.status===`failed`?`text-brick`:`text-tan`}`,children:e.status===`running`?(0,B.jsx)(Na,{size:12}):e.status===`ok`?`✓`:e.status===`failed`?`✗`:`○`}),(0,B.jsx)(`span`,{className:`px-3 py-1.5 min-w-0`,children:(0,B.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,B.jsx)(G,{tone:cp[e.status],children:e.status}),(0,B.jsx)(`b`,{className:`text-[13px] truncate`,children:e.label}),(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:lp[e.kind]}),e.project&&(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-ink3`,children:e.project}),e.sideEffects&&(0,B.jsx)(G,{tone:`david`,children:`side effects`})]})}),(0,B.jsxs)(`span`,{className:`px-3 font-mono text-[12px] text-ink3 whitespace-nowrap`,children:[dp(e.startedAt),` · `,up(e)]})]},e.id))]})]}),(0,B.jsxs)(`aside`,{className:`grid gap-3.5 content-start min-w-0`,children:[a?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:a.label,icon:`health`,path:`${a.id} · ${lp[a.kind]}`,children:(0,B.jsx)(G,{tone:cp[a.status],children:a.status})}),a.args&&(0,B.jsx)(`div`,{className:`px-3 py-2 font-mono text-[12px] text-ink3 border-b border-sand break-all`,children:JSON.stringify(a.args)}),(0,B.jsx)(`pre`,{className:`m-0 px-3 py-2 font-mono text-[12px] leading-[1.6] text-umber whitespace-pre-wrap max-h-[40vh] overflow-auto min-w-0 max-w-full break-words overscroll-contain`,children:a.log.join(`
|
|
41
41
|
`)||`—`}),a.error&&(0,B.jsx)(`div`,{className:`px-3 py-2 border-t border-sand text-[13px] text-brick`,children:a.error})]}),a.result!==void 0&&(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`Result`,icon:`docs`}),(0,B.jsx)(`pre`,{className:`m-0 px-3 py-2 font-mono text-[12px] leading-[1.55] text-walnut whitespace-pre-wrap max-h-[45vh] overflow-auto min-w-0 max-w-full break-words overscroll-contain`,children:typeof a.result==`string`?a.result:JSON.stringify(a.result,null,2)})]})]}):(0,B.jsx)(U,{className:`px-4 py-3 text-[13px] text-umber`,children:`Select a run to see its log and result.`}),(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`What can run`,icon:`gates`}),(0,B.jsxs)(`div`,{className:`px-3 py-2 text-[13px] text-umber grid gap-1`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`b`,{className:`text-walnut`,children:`now`}),` — read-only MCP tools (doctor, list_*, status, read_messages…) as `,(0,B.jsx)(`code`,{children:`groundwork-console`}),` / automation; read-only CLIs (groundwork doctor/status/list).`]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`b`,{className:`text-walnut`,children:`gated`}),` — bus sends (rules engine, replies), prune / unregister, seam writes, shells. Each will appear here with a `,(0,B.jsx)(`span`,{className:`inline-flex`,children:(0,B.jsx)(G,{tone:`david`,children:`side effects`})}),` marker.`]}),(0,B.jsx)(`div`,{className:`text-tan`,children:`Last 200 runs are kept in ~/.groundwork-console/runs.json (survive API restarts; logs truncated to 60 lines on disk).`})]})]})]})]})}var pp=22,mp=14,hp=4,gp=10,_p=[`#C8782A`,`#4A6A2C`,`#5C7A96`,`#C4587A`,`#8A6A3C`,`#C88A1E`,`#6B5B95`,`#2E7D7B`,`#A0522D`,`#556B2F`];function vp(e){let t=new Map;e.forEach((e,n)=>t.set(e.sha,n));let n=new Map,r=[],i=[];for(let t of e){let e=r.indexOf(t.sha);for(e<0&&(e=r.indexOf(null),e<0&&(e=r.length)),r[e]=null,n.set(t.sha,e),i.push(e),t.parents.forEach((t,i)=>{if(n.has(t))return;let a=r.indexOf(t);if(i===0&&a<0){r[e]=t;return}if(a>=0)return;let o=r.indexOf(null);o<0&&(o=r.length),r[o]=t});r.length&&r[r.length-1]===null;)r.pop()}let a=[];return e.forEach((e,n)=>{for(let r of e.parents){let o=t.get(r);o!==void 0&&a.push({from:n,fromLane:i[n],to:o,toLane:i[o],color:e.parents[0]===r?i[o]:i[n]})}}),{laneOfRow:i,edges:a,stubs:e.flatMap((e,n)=>e.parents.filter(e=>!t.has(e)).map(()=>({row:n,lane:i[n]}))),lanes:Math.max(1,...i.map(e=>e+1)),rowOf:t}}var yp=e=>{let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);return n<1?`now`:n<60?`${n} min`:n<1440?`${Math.floor(n/60)} h`:n<43200?`${Math.floor(n/1440)} d`:`${Math.floor(n/43200)} mo`},bp=e=>e.startsWith(`HEAD`)?`head`:e.startsWith(`tag: `)?`tag`:e.includes(`/`)?`remote`:`branch`;function xp({commits:e,head:t,worktrees:n=[],maxHeight:r=440,onSelect:i}){let a=(0,P.useMemo)(()=>e.slice(0,200),[e]),o=(0,P.useMemo)(()=>vp(a),[a]),[s,c]=(0,P.useState)(null),l=(0,P.useMemo)(()=>{let e=new Map;for(let t of n)t.branch&&e.set(t.branch.replace(/^refs\/heads\//,``),t);return e},[n]);if(a.length===0)return(0,B.jsx)(`div`,{className:`px-3 py-3 text-[13px] text-umber`,children:`No commits.`});let u=20+o.lanes*mp,d=a.length*pp,f=e=>gp+e*mp+mp/2,p=e=>e*pp+pp/2,m=e=>{navigator.clipboard?.writeText(e.sha).then(()=>{c(e.sha),setTimeout(()=>c(null),1200)}).catch(()=>{}),i?.(e)};return(0,B.jsx)(`div`,{className:`relative overflow-auto overscroll-contain border border-sand rounded-kit bg-paper`,style:{maxHeight:r},role:`list`,"aria-label":`commit graph · ${a.length} commits · ${o.lanes} lanes`,children:(0,B.jsxs)(`div`,{className:`relative`,style:{height:d,minWidth:u+480},children:[(0,B.jsxs)(`svg`,{width:u,height:d,className:`absolute left-0 top-0`,"aria-hidden":!0,children:[o.edges.map((e,t)=>{let n=f(e.fromLane),r=p(e.from),i=f(e.toLane),a=p(e.to),o=_p[e.color%_p.length],s=n===i?`M${n},${r} L${i},${a}`:`M${n},${r} C${n},${r+pp*.6} ${i},${a-pp*.6} ${i},${a}`;return(0,B.jsx)(`path`,{d:s,stroke:o,strokeWidth:2,fill:`none`,opacity:.9},t)}),o.stubs.map((e,t)=>(0,B.jsx)(`path`,{d:`M${f(e.lane)},${p(e.row)} L${f(e.lane)},${p(e.row)+pp*.7}`,stroke:_p[e.lane%_p.length],strokeWidth:2,strokeDasharray:`2 3`,fill:`none`},`s${t}`)),a.map((e,n)=>{let r=o.laneOfRow[n],i=e.sha===t,a=e.parents.length>1;return(0,B.jsx)(`circle`,{cx:f(r),cy:p(n),r:i?5.5:a?5:hp,fill:a?`var(--color-paper)`:_p[r%_p.length],stroke:_p[r%_p.length],strokeWidth:i?3:2},e.sha)})]}),a.map((e,n)=>{let r=o.laneOfRow[n],i=e.sha===t;return(0,B.jsxs)(`button`,{type:`button`,role:`listitem`,onClick:()=>m(e),title:`${e.sha}\n${e.subject}\n${e.author} · ${yp(e.date)} ago · ${new Date(e.date).toLocaleString()}\nclick to copy sha`,className:`absolute left-0 right-0 grid grid-cols-[auto_1fr_auto_auto] items-center gap-2 pr-3 text-left border-0 cursor-pointer hover:bg-linen/70 ${i?`bg-cream/50`:`bg-transparent`}`,style:{top:n*pp,height:pp,paddingLeft:u+4},children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-ink3 w-[62px]`,style:{color:_p[r%_p.length]},children:s===e.sha?`copied ✓`:e.short}),(0,B.jsxs)(`span`,{className:`min-w-0 truncate text-[12.5px] text-walnut`,children:[e.refs.map(e=>{let t=bp(e),n=e.replace(/^HEAD -> /,``).replace(/^tag: /,``),r=t===`tag`?void 0:l.get(n);return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 mr-1.5 px-1.5 rounded font-mono text-[10px] leading-[16px] border align-middle ${t===`head`?`bg-ember-wash text-ember-deep border-ember/40 font-semibold`:t===`tag`?`bg-amber-wash text-amber border-amber-line`:t===`remote`?`bg-cream text-ink3 border-sand`:`bg-linen text-umber border-dust`}`,title:r?`checked out in ${r.path}${r.agent?` by ${r.agent}`:``}`:e,children:[t===`head`&&e.startsWith(`HEAD ->`)?`HEAD → `:``,t===`tag`?`⌁ `:``,n,r&&(0,B.jsxs)(`span`,{className:`text-leaf`,"aria-label":`checked out in a worktree`,children:[`⌂`,r.agent?` ${r.agent}`:``]})]},e)}),e.subject]}),(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-ink3 truncate max-w-[120px]`,children:e.author}),(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan w-[48px] text-right`,children:yp(e.date)})]},e.sha)})]})})}var Sp=`minmax(220px,1.6fr) .5fr 1fr .8fr 1fr 1.1fr 1.4fr`,Cp=`minmax(240px,1.8fr) 1.2fr .7fr .6fr 1fr .6fr`,wp=e=>e.replace(/^\/Users\/[^/]+/,`~`),Tp=e=>{navigator.clipboard?.writeText(e)},Ep=(e,t)=>{try{localStorage.setItem(`groundwork-console.summon.draft.${e}`,t)}catch{}xd(e)},Dp=e=>e===`MERGED`?`ok`:e===`OPEN`?`david`:`neutral`;function Op(){let{current:e}=Ha(),t=e?`/projects/${e}/git`:null,n=q(t?`${t}/graph?limit=200`:null,15e3),r=q(t?`${t}/branches`:null,15e3),i=q(t?`${t}/worktrees`:null,15e3),[a,o]=(0,P.useState)(!0),[s,c]=(0,P.useState)(!1);if(!e)return(0,B.jsx)(`div`,{className:`p-4 text-umber`,children:`Pick a project.`});let l=r.error??i.error??n.error,u=(r.data?.branches??[]).filter(e=>(a||!e.remote)&&(s||!e.merged||e.name===r.data?.defaultBranch||e.name===r.data?.base||!!e.worktree)),d=(r.data?.branches.length??0)-u.length;return(0,B.jsxs)(`div`,{className:`grid gap-3.5 p-4 content-start min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between flex-wrap gap-2`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`font-display font-bold text-[34px] leading-[1.1] tracking-[-.015em] text-ember`,children:`Git`}),(0,B.jsx)(`span`,{className:`ml-3 text-[13px] text-umber`,children:`branches · worktrees · who owns what — read-only, no git writes`})]}),(0,B.jsx)(`div`,{className:`font-mono text-[12px] text-tan`,children:r.data?`${r.data.branches.length} refs · vs ${r.data.base??`origin/${r.data.defaultBranch}`}${r.data.baseFound===!1?` (missing — no ahead/behind)`:``} · ${r.data.ghAvailable?`gh ✓`:`gh unavailable — PRs hidden`}`:r.loading?`reading git…`:``})]}),l&&(0,B.jsxs)(U,{className:`px-4 py-3 text-[13px] text-brick`,children:[`API error: `,l]}),(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`Commit graph`,icon:`git`,eyebrow:`git log --all · date order`,path:n.data?`${n.data.commits.length} commits · HEAD ${n.data.head.slice(0,7)}`:void 0}),(0,B.jsx)(`div`,{className:`px-3 py-2`,children:n.data?(0,B.jsx)(xp,{commits:n.data.commits,head:n.data.head,worktrees:i.data?.worktrees??[],onSelect:e=>Tp(e.sha)}):(0,B.jsx)(`div`,{className:`text-[13px] text-tan py-4 text-center`,children:n.error?`graph unavailable`:`loading graph…`})})]}),(0,B.jsxs)(U,{children:[(0,B.jsxs)(W,{title:`Branches`,icon:`git`,eyebrow:`local + remote · ahead/behind vs origin/main`,path:d>0?`${d} hidden by filters`:void 0,children:[(0,B.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 text-[12px] text-umber cursor-pointer`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked)}),` remote`]}),(0,B.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 text-[12px] text-umber cursor-pointer ml-2`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked)}),` merged`]})]}),(0,B.jsxs)(Aa,{cols:Sp,children:[(0,B.jsx)(`span`,{children:`Branch`}),(0,B.jsx)(`span`,{children:`Where`}),(0,B.jsx)(`span`,{children:`HEAD`}),(0,B.jsx)(`span`,{children:`vs main`}),(0,B.jsx)(`span`,{children:`Flags`}),(0,B.jsx)(`span`,{children:`Owner`}),(0,B.jsx)(`span`,{children:`PR`})]}),r.loading&&!r.data&&(0,B.jsx)(`div`,{className:`px-3 py-3 text-[13px] text-tan`,children:`reading branches…`}),u.map(e=>(0,B.jsx)(kp,{b:e,defaultBranch:r.data?.defaultBranch??`main`},e.name+(e.remote?`@r`:``))),r.data&&!u.length&&(0,B.jsx)(`div`,{className:`px-3 py-3 text-[13px] text-tan`,children:`nothing to show with these filters`})]}),(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`Worktrees`,icon:`git`,eyebrow:`git worktree list · fleet siblings <repo>-<agent>`,path:i.data?`${i.data.worktrees.length} checkouts`:void 0}),(0,B.jsxs)(Aa,{cols:Cp,children:[(0,B.jsx)(`span`,{children:`Path`}),(0,B.jsx)(`span`,{children:`Branch`}),(0,B.jsx)(`span`,{children:`HEAD`}),(0,B.jsx)(`span`,{children:`Dirty`}),(0,B.jsx)(`span`,{children:`Owner`}),(0,B.jsx)(`span`,{children:`State`})]}),(i.data?.worktrees??[]).map(e=>(0,B.jsx)(Ap,{w:e},e.path)),i.data&&!i.data.worktrees.length&&(0,B.jsx)(`div`,{className:`px-3 py-3 text-[13px] text-tan`,children:`no worktrees (not a git repo?)`})]})]})}function kp({b:e,defaultBranch:t}){let n=e.name===t||e.name.endsWith(`/${t}`),r=Date.parse(e.date);return(0,B.jsxs)(`div`,{className:`grid gap-3 items-center px-3 min-h-10 border-b border-sand last:border-b-0 hover:bg-linen/60 text-[13px]`,style:{gridTemplateColumns:Sp},children:[(0,B.jsxs)(`span`,{className:`min-w-0`,children:[(0,B.jsx)(`span`,{className:`font-mono font-medium truncate block ${n?`text-ember`:`text-walnut`}`,title:e.name,children:e.name}),(0,B.jsx)(`span`,{className:`block text-[12px] text-umber truncate`,title:e.subject,children:e.subject})]}),(0,B.jsx)(`span`,{children:e.remote?(0,B.jsx)(G,{tone:`outline`,children:`remote`}):(0,B.jsx)(G,{tone:`neutral`,children:`local`})}),(0,B.jsxs)(`span`,{className:`min-w-0`,children:[(0,B.jsx)(`button`,{className:`font-mono text-[12px] text-walnut hover:text-ember`,title:`copy ${e.sha}`,onClick:()=>Tp(e.sha),children:e.short}),(0,B.jsx)(`span`,{className:`block text-[11px] text-tan`,title:e.date,children:Number.isFinite(r)?Ld(r):``})]}),(0,B.jsx)(`span`,{className:`flex gap-1 flex-wrap`,children:n&&!e.remote?(0,B.jsx)(G,{tone:`solid`,children:`default`}):e.ahead===null||e.behind===null?(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-tan`,children:`—`}):(0,B.jsxs)(B.Fragment,{children:[e.ahead>0&&(0,B.jsxs)(G,{tone:`david`,children:[`+`,e.ahead]}),e.behind>0&&(0,B.jsxs)(G,{tone:e.behind>20?`warn`:`neutral`,children:[`−`,e.behind]}),e.ahead===0&&e.behind===0&&(0,B.jsx)(G,{tone:`ok`,children:`even`})]})}),(0,B.jsxs)(`span`,{className:`flex gap-1 flex-wrap`,children:[e.merged&&!n&&(0,B.jsx)(G,{tone:`ok`,children:`merged`}),e.stale&&(0,B.jsx)(G,{tone:`warn`,children:`stale`}),e.worktree&&(0,B.jsxs)(`span`,{className:`font-mono text-[11px] text-umber`,title:e.worktree,children:[`⌂ `,wp(e.worktree).split(`/`).pop()]})]}),(0,B.jsx)(`span`,{className:`min-w-0`,children:e.owner?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,B.jsx)(ld,{id:e.owner,size:`sm`}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,title:`DM ${e.owner} about ${e.name}`,onClick:()=>Ep(e.owner,`re branch \`${e.name}\` @ ${e.short}${e.pr?` (PR #${e.pr.number} ${e.pr.state})`:``}: `),children:`DM`})]}):(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-tan`,children:`—`})}),(0,B.jsx)(`span`,{className:`min-w-0`,children:e.pr?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 min-w-0`,children:[(0,B.jsxs)(`a`,{className:`font-mono text-[12px] text-walnut hover:text-ember underline decoration-dust`,href:e.pr.url,target:`_blank`,rel:`noreferrer`,title:e.pr.title,children:[`#`,e.pr.number]}),(0,B.jsx)(G,{tone:Dp(e.pr.state),children:e.pr.state.toLowerCase()}),e.pr.qa&&(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-umber truncate`,title:`QA / gate: ${e.pr.qa}`,children:e.pr.qa})]}):(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-tan`,children:`—`})})]})}function Ap({w:e}){return(0,B.jsxs)(`div`,{className:`grid gap-3 items-center px-3 min-h-10 border-b border-sand last:border-b-0 hover:bg-linen/60 text-[13px]`,style:{gridTemplateColumns:Cp},children:[(0,B.jsxs)(`span`,{className:`min-w-0 inline-flex items-center gap-1.5`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-walnut truncate`,title:e.path,children:wp(e.path)}),e.isMain&&(0,B.jsx)(G,{tone:`solid`,children:`main checkout`})]}),(0,B.jsx)(`span`,{className:`font-mono text-[12px] truncate`,title:e.branch??`detached HEAD`,children:e.branch??(0,B.jsx)(`span`,{className:`text-tan`,children:`detached`})}),(0,B.jsx)(`span`,{children:(0,B.jsx)(`button`,{className:`font-mono text-[12px] text-walnut hover:text-ember`,title:`copy ${e.sha}`,onClick:()=>Tp(e.sha),children:e.short})}),(0,B.jsx)(`span`,{children:e.dirty?(0,B.jsx)(G,{tone:`warn`,children:`dirty`}):(0,B.jsx)(G,{tone:`ok`,children:`clean`})}),(0,B.jsx)(`span`,{children:e.agent?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,B.jsx)(ld,{id:e.agent,size:`sm`}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,title:`DM ${e.agent} about this worktree`,onClick:()=>Ep(e.agent,`re worktree ${wp(e.path)} (${e.branch??`detached`} @ ${e.short}${e.dirty?`, dirty`:``}): `),children:`DM`})]}):(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-tan`,children:`—`})}),(0,B.jsxs)(`span`,{className:`flex gap-1`,children:[e.prunable&&(0,B.jsx)(G,{tone:`bad`,children:`prunable`}),e.detached&&(0,B.jsx)(G,{tone:`outline`,children:`detached`})]})]})}var jp=Oi([{path:`/`,Component:Id,children:[{index:!0,Component:nf},{path:`board`,Component:_f},{path:`bus`,Component:Tf},{path:`monitor`,Component:Vf},{path:`ops`,Component:Uf,children:[{index:!0,element:(0,B.jsx)(Lr,{to:`/ops/fleets`,replace:!0})},{path:`fleets`,Component:Yf},{path:`skills`,Component:ep},{path:`release`,Component:sp},{path:`runs`,Component:fp},{path:`events`,Component:Wf}]},{path:`fleet`,element:(0,B.jsx)(Lr,{to:`/ops/fleets`,replace:!0})},{path:`release`,element:(0,B.jsx)(Lr,{to:`/ops/release`,replace:!0})},{path:`skills`,element:(0,B.jsx)(Lr,{to:`/ops/skills`,replace:!0})},{path:`runs`,element:(0,B.jsx)(Lr,{to:`/ops/runs`,replace:!0})},{path:`docs/:doc?`,Component:Nf},{path:`git`,Component:Op}]}]);try{for(let e of Object.keys(localStorage))for(let t of[`kit-console.`,`gwc.`])if(e.startsWith(t)){let n=`groundwork-console.`+e.slice(t.length);localStorage.getItem(n)===null&&localStorage.setItem(n,localStorage.getItem(e)),localStorage.removeItem(e)}}catch{}(0,ni.createRoot)(document.getElementById(`root`)).render((0,B.jsx)(P.StrictMode,{children:(0,B.jsx)(Va,{children:(0,B.jsx)(Wa,{children:(0,B.jsx)(ro,{children:(0,B.jsx)(Nr,{router:jp})})})})}));export{o as n,l as r,oi as t};
|