@agentplate/cli 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/README.md +40 -0
- package/package.json +1 -1
- package/src/version.ts +1 -1
- package/ui/dist/assets/{index-DjRGeS6V.js → index-oIei_EDk.js} +1 -1
- package/ui/dist/index.html +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,35 @@ All notable changes to Agentplate are documented here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/), and the project aims to adhere to
|
|
5
5
|
[Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [1.5.0] — 2026-06-02
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **Role-based 3D Office.** Every agent is now a distinct voxel character keyed to
|
|
12
|
+
its capability — a team color plus headgear and a held prop (builder
|
|
13
|
+
hard-hat + pickaxe, scout explorer-cap + map, reviewer glasses + magnifier,
|
|
14
|
+
deployer rocket, …). The **coordinator presides from a corner office** (rug, wide
|
|
15
|
+
desk, `DIRECTOR` nameplate) at the head of the room. Room polish: back-wall
|
|
16
|
+
windows, posters, role-colored desk fascia, warmer lighting, and a role key in
|
|
17
|
+
the legend.
|
|
18
|
+
- **README screenshot gallery** of all web-UI screens (`assets/screenshots/`),
|
|
19
|
+
captured from a live `agentplate serve`.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- **Office agent visibility is now lifecycle-aware.** Live agents always show; a
|
|
24
|
+
`completed` agent lingers briefly ("Done") then leaves; a reaped (`stopped`)
|
|
25
|
+
agent leaves immediately. Finished **workers are visible** again instead of
|
|
26
|
+
vanishing instantly.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- Office name/state labels no longer overlap the info/legend overlay panels (drei
|
|
31
|
+
`<Html>` z-index clamped below the panels).
|
|
32
|
+
- Restored project-wide UI typechecking under `@types/react@19` — a global `JSX`
|
|
33
|
+
namespace shim (`ui/src/jsx.d.ts`) and the standard `vite/client` ambient types
|
|
34
|
+
(`ui/src/vite-env.d.ts`).
|
|
35
|
+
|
|
7
36
|
## [1.4.0] — 2026-06-02
|
|
8
37
|
|
|
9
38
|
### Added
|
package/README.md
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
<p align="center">
|
|
24
24
|
<a href="#quick-start">Quick start</a> ·
|
|
25
|
+
<a href="#screenshots">Screenshots</a> ·
|
|
25
26
|
<a href="#features">Features</a> ·
|
|
26
27
|
<a href="#commands">Commands</a> ·
|
|
27
28
|
<a href="#architecture">Architecture</a> ·
|
|
@@ -34,6 +35,45 @@
|
|
|
34
35
|
> self-improving skills, multi-runtime support, the web UI (`agentplate serve`),
|
|
35
36
|
> and the build→deploy pipeline are all working and tested.
|
|
36
37
|
|
|
38
|
+
## Screenshots
|
|
39
|
+
|
|
40
|
+
Everything below is a single running **`agentplate serve`** — the CLI, the live TUI,
|
|
41
|
+
and this web UI all read the same SQLite stores, so the dashboard is a true mirror of
|
|
42
|
+
the swarm, not a mock.
|
|
43
|
+
|
|
44
|
+
<p align="center">
|
|
45
|
+
<img src="assets/screenshots/dashboard.png" alt="Mission Control — the whole agent swarm at a glance" width="860" />
|
|
46
|
+
<br /><sub><b>Mission Control</b> — every agent and its live state at a glance.</sub>
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
<p align="center">
|
|
50
|
+
<img src="assets/screenshots/office.png" alt="The Office — agents act out their work in a 3D voxel office" width="860" />
|
|
51
|
+
<br /><sub><b>The Office</b> — a 3D voxel floor where each role acts out its work and the coordinator presides from the corner office.</sub>
|
|
52
|
+
</p>
|
|
53
|
+
|
|
54
|
+
<table>
|
|
55
|
+
<tr>
|
|
56
|
+
<td width="33%" align="center"><img src="assets/screenshots/costs.png" alt="Token & cost analytics" /><br /><sub><b>Costs & analytics</b><br />tokens + spend, by agent and by day</sub></td>
|
|
57
|
+
<td width="33%" align="center"><img src="assets/screenshots/skills.png" alt="Self-improving skill library" /><br /><sub><b>Self-improving skills</b><br />distilled playbooks ranked by confidence</sub></td>
|
|
58
|
+
<td width="33%" align="center"><img src="assets/screenshots/handoffs.png" alt="Agent-to-agent handoffs" /><br /><sub><b>Handoffs</b><br />the agent coordination protocol, live</sub></td>
|
|
59
|
+
</tr>
|
|
60
|
+
<tr>
|
|
61
|
+
<td width="33%" align="center"><img src="assets/screenshots/deploy.png" alt="Build to deploy pipeline" /><br /><sub><b>Deploy</b><br />targets + an append-only audit trail</sub></td>
|
|
62
|
+
<td width="33%" align="center"><img src="assets/screenshots/tasks.png" alt="Live task queue" /><br /><sub><b>Tasks</b><br />the live work queue, rolled up from sessions</sub></td>
|
|
63
|
+
<td width="33%" align="center"><img src="assets/screenshots/runs.png" alt="Runs and sessions" /><br /><sub><b>Runs & sessions</b><br />every run and the agents within it</sub></td>
|
|
64
|
+
</tr>
|
|
65
|
+
<tr>
|
|
66
|
+
<td width="33%" align="center"><img src="assets/screenshots/agents.png" alt="All agents and their states" /><br /><sub><b>Agents</b><br />every worker, every state, drill into any one</sub></td>
|
|
67
|
+
<td width="33%" align="center"><img src="assets/screenshots/activity.png" alt="Live activity stream" /><br /><sub><b>Activity</b><br />a live terminal-style event stream</sub></td>
|
|
68
|
+
<td width="33%" align="center"><img src="assets/screenshots/chat.png" alt="Chat with the coordinator" /><br /><sub><b>Chat</b><br />talk to the coordinator, queue tasks</sub></td>
|
|
69
|
+
</tr>
|
|
70
|
+
<tr>
|
|
71
|
+
<td width="33%" align="center"><img src="assets/screenshots/system.png" alt="Host system monitor" /><br /><sub><b>System</b><br />real-time host CPU / RAM / disk</sub></td>
|
|
72
|
+
<td width="33%" align="center"><img src="assets/screenshots/settings.png" alt="Project configuration" /><br /><sub><b>Settings</b><br />provider, model, runtime, and run state</sub></td>
|
|
73
|
+
<td width="33%"></td>
|
|
74
|
+
</tr>
|
|
75
|
+
</table>
|
|
76
|
+
|
|
37
77
|
## Why Agentplate
|
|
38
78
|
|
|
39
79
|
Most "AI coding agent" tools give you *one* agent in *one* session. Agentplate turns a
|
package/package.json
CHANGED
package/src/version.ts
CHANGED
|
@@ -4224,4 +4224,4 @@ No matching component was found for:
|
|
|
4224
4224
|
void main() {
|
|
4225
4225
|
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
4226
4226
|
}
|
|
4227
|
-
`}),[u]);return v.createElement(`group`,ML({},w,{ref:F}),d&&!B&&v.createElement(`mesh`,{castShadow:p,receiveShadow:m,ref:z},g||v.createElement(`planeGeometry`,null),h||v.createElement(`shaderMaterial`,{side:2,vertexShader:oe.vertexShader,fragmentShader:oe.fragmentShader})))}),l4=Object.defineProperty,u4=(e,t,n)=>t in e?l4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d4=(e,t,n)=>(u4(e,typeof t==`symbol`?t:t+``,n),n),f4=class{constructor(){d4(this,`_listeners`)}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let n=this._listeners[e];if(n!==void 0){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let t=this._listeners[e.type];if(t!==void 0){e.target=this;let n=t.slice(0);for(let t=0,r=n.length;t<r;t++)n[t].call(this,e);e.target=null}}},p4=Object.defineProperty,m4=(e,t,n)=>t in e?p4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,h4=(e,t,n)=>(m4(e,typeof t==`symbol`?t:t+``,n),n),g4=new gV(0,0,0,`YXZ`),_4=new X,v4={type:`change`},y4={type:`lock`},b4={type:`unlock`},x4=.002,S4=Math.PI/2,C4=class extends f4{constructor(e,t){super(),h4(this,`camera`),h4(this,`domElement`),h4(this,`isLocked`),h4(this,`minPolarAngle`),h4(this,`maxPolarAngle`),h4(this,`pointerSpeed`),h4(this,`onMouseMove`,e=>{!this.domElement||this.isLocked===!1||(g4.setFromQuaternion(this.camera.quaternion),g4.y-=e.movementX*x4*this.pointerSpeed,g4.x-=e.movementY*x4*this.pointerSpeed,g4.x=Math.max(S4-this.maxPolarAngle,Math.min(S4-this.minPolarAngle,g4.x)),this.camera.quaternion.setFromEuler(g4),this.dispatchEvent(v4))}),h4(this,`onPointerlockChange`,()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(y4),this.isLocked=!0):(this.dispatchEvent(b4),this.isLocked=!1))}),h4(this,`onPointerlockError`,()=>{console.error(`THREE.PointerLockControls: Unable to use Pointer Lock API`)}),h4(this,`connect`,e=>{this.domElement=e||this.domElement,this.domElement&&(this.domElement.ownerDocument.addEventListener(`mousemove`,this.onMouseMove),this.domElement.ownerDocument.addEventListener(`pointerlockchange`,this.onPointerlockChange),this.domElement.ownerDocument.addEventListener(`pointerlockerror`,this.onPointerlockError))}),h4(this,`disconnect`,()=>{this.domElement&&(this.domElement.ownerDocument.removeEventListener(`mousemove`,this.onMouseMove),this.domElement.ownerDocument.removeEventListener(`pointerlockchange`,this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener(`pointerlockerror`,this.onPointerlockError))}),h4(this,`dispose`,()=>{this.disconnect()}),h4(this,`getObject`,()=>this.camera),h4(this,`direction`,new X(0,0,-1)),h4(this,`getDirection`,e=>e.copy(this.direction).applyQuaternion(this.camera.quaternion)),h4(this,`moveForward`,e=>{_4.setFromMatrixColumn(this.camera.matrix,0),_4.crossVectors(this.camera.up,_4),this.camera.position.addScaledVector(_4,e)}),h4(this,`moveRight`,e=>{_4.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(_4,e)}),h4(this,`lock`,()=>{this.domElement&&this.domElement.requestPointerLock()}),h4(this,`unlock`,()=>{this.domElement&&this.domElement.ownerDocument.exitPointerLock()}),this.camera=e,this.domElement=t,this.isLocked=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.pointerSpeed=1,t&&this.connect(t)}},w4=Object.defineProperty,T4=(e,t,n)=>t in e?w4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E4=(e,t,n)=>(T4(e,typeof t==`symbol`?t:t+``,n),n),D4=new EU,O4=new hW,k4=Math.cos(Math.PI/180*70),A4=(e,t)=>(e%t+t)%t,j4=class extends f4{constructor(e,t){super(),E4(this,`object`),E4(this,`domElement`),E4(this,`enabled`,!0),E4(this,`target`,new X),E4(this,`minDistance`,0),E4(this,`maxDistance`,1/0),E4(this,`minZoom`,0),E4(this,`maxZoom`,1/0),E4(this,`minPolarAngle`,0),E4(this,`maxPolarAngle`,Math.PI),E4(this,`minAzimuthAngle`,-1/0),E4(this,`maxAzimuthAngle`,1/0),E4(this,`enableDamping`,!1),E4(this,`dampingFactor`,.05),E4(this,`enableZoom`,!0),E4(this,`zoomSpeed`,1),E4(this,`enableRotate`,!0),E4(this,`rotateSpeed`,1),E4(this,`enablePan`,!0),E4(this,`panSpeed`,1),E4(this,`screenSpacePanning`,!0),E4(this,`keyPanSpeed`,7),E4(this,`zoomToCursor`,!1),E4(this,`autoRotate`,!1),E4(this,`autoRotateSpeed`,2),E4(this,`reverseOrbit`,!1),E4(this,`reverseHorizontalOrbit`,!1),E4(this,`reverseVerticalOrbit`,!1),E4(this,`keys`,{LEFT:`ArrowLeft`,UP:`ArrowUp`,RIGHT:`ArrowRight`,BOTTOM:`ArrowDown`}),E4(this,`mouseButtons`,{LEFT:NL.ROTATE,MIDDLE:NL.DOLLY,RIGHT:NL.PAN}),E4(this,`touches`,{ONE:PL.ROTATE,TWO:PL.DOLLY_PAN}),E4(this,`target0`),E4(this,`position0`),E4(this,`zoom0`),E4(this,`_domElementKeyEvents`,null),E4(this,`getPolarAngle`),E4(this,`getAzimuthalAngle`),E4(this,`setPolarAngle`),E4(this,`setAzimuthalAngle`),E4(this,`getDistance`),E4(this,`getZoomScale`),E4(this,`listenToKeyEvents`),E4(this,`stopListenToKeyEvents`),E4(this,`saveState`),E4(this,`reset`),E4(this,`update`),E4(this,`connect`),E4(this,`dispose`),E4(this,`dollyIn`),E4(this,`dollyOut`),E4(this,`getScale`),E4(this,`setScale`),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>l.phi,this.getAzimuthalAngle=()=>l.theta,this.setPolarAngle=e=>{let t=A4(e,2*Math.PI),r=l.phi;r<0&&(r+=2*Math.PI),t<0&&(t+=2*Math.PI);let i=Math.abs(t-r);2*Math.PI-i<i&&(t<r?t+=2*Math.PI:r+=2*Math.PI),u.phi=t-r,n.update()},this.setAzimuthalAngle=e=>{let t=A4(e,2*Math.PI),r=l.theta;r<0&&(r+=2*Math.PI),t<0&&(t+=2*Math.PI);let i=Math.abs(t-r);2*Math.PI-i<i&&(t<r?t+=2*Math.PI:r+=2*Math.PI),u.theta=t-r,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=e=>{e.addEventListener(`keydown`,be),this._domElementKeyEvents=e},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener(`keydown`,be),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(r),n.update(),s=o.NONE},this.update=(()=>{let t=new X,i=new X(0,1,0),a=new PB().setFromUnitVectors(e.up,i),p=a.clone().invert(),m=new X,h=new PB,g=2*Math.PI;return function(){let _=n.object.position;a.setFromUnitVectors(e.up,i),p.copy(a).invert(),t.copy(_).sub(n.target),t.applyQuaternion(a),l.setFromVector3(t),n.autoRotate&&s===o.NONE&&k(D()),n.enableDamping?(l.theta+=u.theta*n.dampingFactor,l.phi+=u.phi*n.dampingFactor):(l.theta+=u.theta,l.phi+=u.phi);let v=n.minAzimuthAngle,y=n.maxAzimuthAngle;isFinite(v)&&isFinite(y)&&(v<-Math.PI?v+=g:v>Math.PI&&(v-=g),y<-Math.PI?y+=g:y>Math.PI&&(y-=g),v<=y?l.theta=Math.max(v,Math.min(y,l.theta)):l.theta=l.theta>(v+y)/2?Math.max(v,l.theta):Math.min(y,l.theta)),l.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,l.phi)),l.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(f,n.dampingFactor):n.target.add(f),n.zoomToCursor&&w||n.object.isOrthographicCamera?l.radius=R(l.radius):l.radius=R(l.radius*d),t.setFromSpherical(l),t.applyQuaternion(p),_.copy(n.target).add(t),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,f.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),f.set(0,0,0));let b=!1;if(n.zoomToCursor&&w){let r=null;if(n.object instanceof kJ&&n.object.isPerspectiveCamera){let e=t.length();r=R(e*d);let i=e-r;n.object.position.addScaledVector(S,i),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let e=new X(C.x,C.y,0);e.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/d)),n.object.updateProjectionMatrix(),b=!0;let i=new X(C.x,C.y,0);i.unproject(n.object),n.object.position.sub(i).add(e),n.object.updateMatrixWorld(),r=t.length()}else console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.`),n.zoomToCursor=!1;r!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(r).add(n.object.position):(D4.origin.copy(n.object.position),D4.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(D4.direction))<k4?e.lookAt(n.target):(O4.setFromNormalAndCoplanarPoint(n.object.up,n.target),D4.intersectPlane(O4,n.target))))}else n.object instanceof PJ&&n.object.isOrthographicCamera&&(b=d!==1,b&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/d)),n.object.updateProjectionMatrix()));return d=1,w=!1,b||m.distanceToSquared(n.object.position)>c||8*(1-h.dot(n.object.quaternion))>c?(n.dispatchEvent(r),m.copy(n.object.position),h.copy(n.object.quaternion),b=!1,!0):!1}})(),this.connect=e=>{n.domElement=e,n.domElement.style.touchAction=`none`,n.domElement.addEventListener(`contextmenu`,Ce),n.domElement.addEventListener(`pointerdown`,he),n.domElement.addEventListener(`pointercancel`,H),n.domElement.addEventListener(`wheel`,ye)},this.dispose=()=>{var e,t,r,i,a,o;n.domElement&&(n.domElement.style.touchAction=`auto`),(e=n.domElement)==null||e.removeEventListener(`contextmenu`,Ce),(t=n.domElement)==null||t.removeEventListener(`pointerdown`,he),(r=n.domElement)==null||r.removeEventListener(`pointercancel`,H),(i=n.domElement)==null||i.removeEventListener(`wheel`,ye),(a=n.domElement)==null||a.ownerDocument.removeEventListener(`pointermove`,ge),(o=n.domElement)==null||o.ownerDocument.removeEventListener(`pointerup`,H),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener(`keydown`,be)};let n=this,r={type:`change`},i={type:`start`},a={type:`end`},o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},s=o.NONE,c=1e-6,l=new QY,u=new QY,d=1,f=new X,p=new Y,m=new Y,h=new Y,g=new Y,_=new Y,v=new Y,y=new Y,b=new Y,x=new Y,S=new X,C=new Y,w=!1,T=[],E={};function D(){return 2*Math.PI/60/60*n.autoRotateSpeed}function O(){return .95**n.zoomSpeed}function k(e){n.reverseOrbit||n.reverseHorizontalOrbit?u.theta+=e:u.theta-=e}function A(e){n.reverseOrbit||n.reverseVerticalOrbit?u.phi+=e:u.phi-=e}let j=(()=>{let e=new X;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),f.add(e)}})(),M=(()=>{let e=new X;return function(t,r){n.screenSpacePanning===!0?e.setFromMatrixColumn(r,1):(e.setFromMatrixColumn(r,0),e.crossVectors(n.object.up,e)),e.multiplyScalar(t),f.add(e)}})(),N=(()=>{let e=new X;return function(t,r){let i=n.domElement;if(i&&n.object instanceof kJ&&n.object.isPerspectiveCamera){let a=n.object.position;e.copy(a).sub(n.target);let o=e.length();o*=Math.tan(n.object.fov/2*Math.PI/180),j(2*t*o/i.clientHeight,n.object.matrix),M(2*r*o/i.clientHeight,n.object.matrix)}else i&&n.object instanceof PJ&&n.object.isOrthographicCamera?(j(t*(n.object.right-n.object.left)/n.object.zoom/i.clientWidth,n.object.matrix),M(r*(n.object.top-n.object.bottom)/n.object.zoom/i.clientHeight,n.object.matrix)):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.`),n.enablePan=!1)}})();function P(e){n.object instanceof kJ&&n.object.isPerspectiveCamera||n.object instanceof PJ&&n.object.isOrthographicCamera?d=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),n.enableZoom=!1)}function F(e){P(d/e)}function I(e){P(d*e)}function L(e){if(!n.zoomToCursor||!n.domElement)return;w=!0;let t=n.domElement.getBoundingClientRect(),r=e.clientX-t.left,i=e.clientY-t.top,a=t.width,o=t.height;C.x=r/a*2-1,C.y=-(i/o)*2+1,S.set(C.x,C.y,1).unproject(n.object).sub(n.object.position).normalize()}function R(e){return Math.max(n.minDistance,Math.min(n.maxDistance,e))}function ee(e){p.set(e.clientX,e.clientY)}function te(e){L(e),y.set(e.clientX,e.clientY)}function z(e){g.set(e.clientX,e.clientY)}function ne(e){m.set(e.clientX,e.clientY),h.subVectors(m,p).multiplyScalar(n.rotateSpeed);let t=n.domElement;t&&(k(2*Math.PI*h.x/t.clientHeight),A(2*Math.PI*h.y/t.clientHeight)),p.copy(m),n.update()}function B(e){b.set(e.clientX,e.clientY),x.subVectors(b,y),x.y>0?F(O()):x.y<0&&I(O()),y.copy(b),n.update()}function re(e){_.set(e.clientX,e.clientY),v.subVectors(_,g).multiplyScalar(n.panSpeed),N(v.x,v.y),g.copy(_),n.update()}function ie(e){L(e),e.deltaY<0?I(O()):e.deltaY>0&&F(O()),n.update()}function ae(e){let t=!1;switch(e.code){case n.keys.UP:N(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:N(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:N(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:N(-n.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),n.update())}function oe(){if(T.length==1)p.set(T[0].pageX,T[0].pageY);else{let e=.5*(T[0].pageX+T[1].pageX),t=.5*(T[0].pageY+T[1].pageY);p.set(e,t)}}function se(){if(T.length==1)g.set(T[0].pageX,T[0].pageY);else{let e=.5*(T[0].pageX+T[1].pageX),t=.5*(T[0].pageY+T[1].pageY);g.set(e,t)}}function ce(){let e=T[0].pageX-T[1].pageX,t=T[0].pageY-T[1].pageY,n=Math.sqrt(e*e+t*t);y.set(0,n)}function le(){n.enableZoom&&ce(),n.enablePan&&se()}function ue(){n.enableZoom&&ce(),n.enableRotate&&oe()}function de(e){if(T.length==1)m.set(e.pageX,e.pageY);else{let t=De(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);m.set(n,r)}h.subVectors(m,p).multiplyScalar(n.rotateSpeed);let t=n.domElement;t&&(k(2*Math.PI*h.x/t.clientHeight),A(2*Math.PI*h.y/t.clientHeight)),p.copy(m)}function fe(e){if(T.length==1)_.set(e.pageX,e.pageY);else{let t=De(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);_.set(n,r)}v.subVectors(_,g).multiplyScalar(n.panSpeed),N(v.x,v.y),g.copy(_)}function pe(e){let t=De(e),r=e.pageX-t.x,i=e.pageY-t.y,a=Math.sqrt(r*r+i*i);b.set(0,a),x.set(0,(b.y/y.y)**+n.zoomSpeed),F(x.y),y.copy(b)}function V(e){n.enableZoom&&pe(e),n.enablePan&&fe(e)}function me(e){n.enableZoom&&pe(e),n.enableRotate&&de(e)}function he(e){var t,r;n.enabled!==!1&&(T.length===0&&((t=n.domElement)==null||t.ownerDocument.addEventListener(`pointermove`,ge),(r=n.domElement)==null||r.ownerDocument.addEventListener(`pointerup`,H)),we(e),e.pointerType===`touch`?xe(e):_e(e))}function ge(e){n.enabled!==!1&&(e.pointerType===`touch`?Se(e):ve(e))}function H(e){var t,r,i;Te(e),T.length===0&&((t=n.domElement)==null||t.releasePointerCapture(e.pointerId),(r=n.domElement)==null||r.ownerDocument.removeEventListener(`pointermove`,ge),(i=n.domElement)==null||i.ownerDocument.removeEventListener(`pointerup`,H)),n.dispatchEvent(a),s=o.NONE}function _e(e){let t;switch(e.button){case 0:t=n.mouseButtons.LEFT;break;case 1:t=n.mouseButtons.MIDDLE;break;case 2:t=n.mouseButtons.RIGHT;break;default:t=-1}switch(t){case NL.DOLLY:if(n.enableZoom===!1)return;te(e),s=o.DOLLY;break;case NL.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(n.enablePan===!1)return;z(e),s=o.PAN}else{if(n.enableRotate===!1)return;ee(e),s=o.ROTATE}break;case NL.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(n.enableRotate===!1)return;ee(e),s=o.ROTATE}else{if(n.enablePan===!1)return;z(e),s=o.PAN}break;default:s=o.NONE}s!==o.NONE&&n.dispatchEvent(i)}function ve(e){if(n.enabled!==!1)switch(s){case o.ROTATE:if(n.enableRotate===!1)return;ne(e);break;case o.DOLLY:if(n.enableZoom===!1)return;B(e);break;case o.PAN:if(n.enablePan===!1)return;re(e);break}}function ye(e){n.enabled===!1||n.enableZoom===!1||s!==o.NONE&&s!==o.ROTATE||(e.preventDefault(),n.dispatchEvent(i),ie(e),n.dispatchEvent(a))}function be(e){n.enabled===!1||n.enablePan===!1||ae(e)}function xe(e){switch(Ee(e),T.length){case 1:switch(n.touches.ONE){case PL.ROTATE:if(n.enableRotate===!1)return;oe(),s=o.TOUCH_ROTATE;break;case PL.PAN:if(n.enablePan===!1)return;se(),s=o.TOUCH_PAN;break;default:s=o.NONE}break;case 2:switch(n.touches.TWO){case PL.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;le(),s=o.TOUCH_DOLLY_PAN;break;case PL.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;ue(),s=o.TOUCH_DOLLY_ROTATE;break;default:s=o.NONE}break;default:s=o.NONE}s!==o.NONE&&n.dispatchEvent(i)}function Se(e){switch(Ee(e),s){case o.TOUCH_ROTATE:if(n.enableRotate===!1)return;de(e),n.update();break;case o.TOUCH_PAN:if(n.enablePan===!1)return;fe(e),n.update();break;case o.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;V(e),n.update();break;case o.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;me(e),n.update();break;default:s=o.NONE}}function Ce(e){n.enabled!==!1&&e.preventDefault()}function we(e){T.push(e)}function Te(e){delete E[e.pointerId];for(let t=0;t<T.length;t++)if(T[t].pointerId==e.pointerId){T.splice(t,1);return}}function Ee(e){let t=E[e.pointerId];t===void 0&&(t=new Y,E[e.pointerId]=t),t.set(e.pageX,e.pageY)}function De(e){return E[(e.pointerId===T[0].pointerId?T[1]:T[0]).pointerId]}this.dollyIn=(e=O())=>{I(e),n.update()},this.dollyOut=(e=O())=>{F(e),n.update()},this.getScale=()=>d,this.setScale=e=>{P(e),n.update()},this.getZoomScale=()=>O(),t!==void 0&&this.connect(t),this.update()}},M4=v.forwardRef(({makeDefault:e,camera:t,regress:n,domElement:r,enableDamping:i=!0,keyEvents:a=!1,onChange:o,onStart:s,onEnd:c,...l},u)=>{let d=w0(e=>e.invalidate),f=w0(e=>e.camera),p=w0(e=>e.gl),m=w0(e=>e.events),h=w0(e=>e.setEvents),g=w0(e=>e.set),_=w0(e=>e.get),y=w0(e=>e.performance),b=t||f,x=r||m.connected||p.domElement,S=v.useMemo(()=>new j4(b),[b]);return T0(()=>{S.enabled&&S.update()},-1),v.useEffect(()=>(a&&S.connect(a===!0?x:a),S.connect(x),()=>void S.dispose()),[a,x,n,S,d]),v.useEffect(()=>{let e=e=>{d(),n&&y.regress(),o&&o(e)},t=e=>{s&&s(e)},r=e=>{c&&c(e)};return S.addEventListener(`change`,e),S.addEventListener(`start`,t),S.addEventListener(`end`,r),()=>{S.removeEventListener(`start`,t),S.removeEventListener(`end`,r),S.removeEventListener(`change`,e)}},[o,s,c,S,d,h]),v.useEffect(()=>{if(e){let e=_().controls;return g({controls:S}),()=>g({controls:e})}},[e,S]),v.createElement(`primitive`,ML({ref:u,object:S,enableDamping:i},l))}),N4=v.forwardRef(({domElement:e,selector:t,onChange:n,onLock:r,onUnlock:i,enabled:a=!0,makeDefault:o,...s},c)=>{let{camera:l,...u}=s,d=w0(e=>e.setEvents),f=w0(e=>e.gl),p=w0(e=>e.camera),m=w0(e=>e.invalidate),h=w0(e=>e.events),g=w0(e=>e.get),_=w0(e=>e.set),y=l||p,b=e||h.connected||f.domElement,x=v.useMemo(()=>new C4(y),[y]);return v.useEffect(()=>{if(a){x.connect(b);let e=g().events.compute;return d({compute(e,t){let n=t.size.width/2,r=t.size.height/2;t.pointer.set(n/t.size.width*2-1,-(r/t.size.height)*2+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),()=>{x.disconnect(),d({compute:e})}}},[a,x]),v.useEffect(()=>{let e=e=>{m(),n&&n(e)};x.addEventListener(`change`,e),r&&x.addEventListener(`lock`,r),i&&x.addEventListener(`unlock`,i);let a=()=>x.lock(),o=t?Array.from(document.querySelectorAll(t)):[document];return o.forEach(e=>e&&e.addEventListener(`click`,a)),()=>{x.removeEventListener(`change`,e),r&&x.removeEventListener(`lock`,r),i&&x.removeEventListener(`unlock`,i),o.forEach(e=>e?e.removeEventListener(`click`,a):void 0)}},[n,r,i,t,x,m]),v.useEffect(()=>{if(o){let e=g().controls;return _({controls:x}),()=>_({controls:e})}},[o,x]),v.createElement(`primitive`,ML({ref:c,object:x},u))}),P4=NB.damp;function F4(e,t,n,r){return e+Math.atan2(Math.sin(t-e),Math.cos(t-e))*(1-Math.exp(-n*r))}var I4={working:{color:`#41d15f`,label:`Working`},booting:{color:`#3b82f6`,label:`Thinking`},idle:{color:`#9aa0a8`,label:`Idle`},completed:{color:`#9aa0a8`,label:`Idle`},stopped:{color:`#9aa0a8`,label:`Idle`},failed:{color:`#f5402d`,label:`Error`}};function L4(e){return I4[e]??{color:`#9aa0a8`,label:`Idle`}}var R4=[{color:`#41d15f`,label:`Working`},{color:`#3b82f6`,label:`Thinking`},{color:`#9aa0a8`,label:`Idle`},{color:`#f5402d`,label:`Error`}],z4=`#a9612f`,B4=`#7c4420`,V4=`#b9763c`,H4=`#a9692f`,U4=`#1b2030`,W4=`#bcd2e6`,G4=`#e8b690`,K4=`#2c3550`,q4=`#27314d`;function J4(e){return e===`working`||e===`booting`?`working`:e===`idle`?`idle`:`away`}function Y4(e){switch(e){case`dispatch`:case`assign`:return`Assigning`;case`worker_done`:return`Handing off`;case`merge_ready`:return`Ready to merge`;case`merged`:return`Merged`;case`escalation`:return`Escalating`;case`merge_failed`:return`Merge conflict`;case`deploy_gate`:return`Deploy gate`;default:return e.replace(/_/g,` `)}}var X4=.78,Z4=.56,Q4=.4,$4=.36;function e3({agent:e,deskPos:t,behavior:n,meeting:r,onSelect:i}){let a=te(e.agentName),o=n===`away`,[s,c]=(0,v.useState)(!1),l=(0,v.useRef)(null),u=(0,v.useRef)(null),d=(0,v.useRef)(null),f=(0,v.useRef)(null),p=(0,v.useRef)(null),m=(0,v.useRef)(null),h=(0,v.useRef)(null),g=(0,v.useRef)(null),_=(0,v.useRef)(null),y=(0,v.useRef)(null),b=(0,v.useRef)(null),[x,,S]=t,C=[x,0,S+.62],w=[x+.85,0,S+1.05],T=n===`meeting`&&r?{tx:r.pos[0],tz:r.pos[2],faceX:r.faceX,faceZ:r.faceZ}:n===`working`?{tx:C[0],tz:C[2],faceX:x,faceZ:S-1}:{tx:w[0],tz:w[2],faceX:x,faceZ:S},E=(0,v.useRef)({...T,behavior:n,sit:n===`working`,speaker:r?.speaker??!1});E.current={...T,behavior:n,sit:n===`working`,speaker:r?.speaker??!1};let D=(0,v.useRef)(!1);(0,v.useEffect)(()=>{l.current&&!D.current&&(l.current.position.set(w[0],0,w[2]),D.current=!0)},[w]),T0((t,n)=>{let r=l.current,i=u.current;if(!r||!i)return;let a=Math.min(n,.05),o=E.current,s=t.clock.elapsedTime+e.agentName.length,c=r.position.x,v=r.position.z,x=Math.hypot(o.tx-c,o.tz-v)>.12;r.position.x=P4(c,o.tx,2.4,a),r.position.z=P4(v,o.tz,2.4,a);let S=x?Math.atan2(o.tx-c,o.tz-v):Math.atan2(o.faceX-c,o.faceZ-v);r.rotation.y=F4(r.rotation.y,S,8,a);let C=o.sit&&!x;i.position.y=P4(i.position.y,C?Z4:X4,7,a);let w=0,T=0,D=0,O=0,k=.06,A=.06,j=-.05,M=-.05,N=0,P=0,F=0,I=0;if(x){let e=s*7;w=.45*Math.sin(e),T=.45*Math.sin(e+Math.PI),D=.25*(1-Math.cos(e)),O=.25*(1-Math.cos(e+Math.PI)),k=.4*Math.sin(e+Math.PI),A=.4*Math.sin(e),I=Math.abs(Math.sin(e))*.04}else C?(w=-1.45,T=-1.45,D=1.4,O=1.4,k=-.7,A=-.7,j=-.9+.16*Math.sin(s*11),M=-.9+.16*Math.sin(s*11+1.6),N=.12):o.behavior===`meeting`&&o.speaker?(A=-.7+.5*Math.sin(s*3.4),M=-1,k=.08,j=-.15,N=.06*Math.sin(s*3.4)):o.behavior===`meeting`?N=.05+.05*Math.sin(s*1.6):(F=Math.sin(s*1.2)*.03,P=Math.sin(s*.5)*.3);r.position.y=P4(r.position.y,I,6,a),r.rotation.z=P4(r.rotation.z,F,4,a),d.current&&(d.current.rotation.x=P4(d.current.rotation.x,w,9,a)),f.current&&(f.current.rotation.x=P4(f.current.rotation.x,T,9,a)),p.current&&(p.current.rotation.x=P4(p.current.rotation.x,D,9,a)),m.current&&(m.current.rotation.x=P4(m.current.rotation.x,O,9,a)),h.current&&(h.current.rotation.x=P4(h.current.rotation.x,k,10,a)),g.current&&(g.current.rotation.x=P4(g.current.rotation.x,A,10,a)),_.current&&(_.current.rotation.x=P4(_.current.rotation.x,j,10,a)),y.current&&(y.current.rotation.x=P4(y.current.rotation.x,M,10,a)),b.current&&(b.current.rotation.x=P4(b.current.rotation.x,N,8,a),b.current.rotation.y=P4(b.current.rotation.y,P,6,a))});let O=o?.5:1,k=(0,R.jsx)(`meshStandardMaterial`,{color:G4,transparent:o,opacity:O}),A=(0,R.jsx)(`meshStandardMaterial`,{color:a,transparent:o,opacity:O}),j=(0,R.jsx)(`meshStandardMaterial`,{color:K4,transparent:o,opacity:O});return(0,R.jsxs)(`group`,{ref:l,onClick:t=>{t.stopPropagation(),i(e.agentName)},onPointerOver:e=>{e.stopPropagation(),c(!0),document.body.style.cursor=`pointer`},onPointerOut:()=>{c(!1),document.body.style.cursor=`auto`},children:[(0,R.jsxs)(`group`,{ref:u,position:[0,X4,0],children:[(0,R.jsxs)(`mesh`,{position:[0,0,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.5,.26,.3]}),j]}),(0,R.jsxs)(`group`,{ref:d,position:[-.13,0,0],children:[(0,R.jsxs)(`mesh`,{position:[0,-.4/2,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.22,Q4,.28]}),j]}),(0,R.jsxs)(`group`,{ref:p,position:[0,-.4,0],children:[(0,R.jsxs)(`mesh`,{position:[0,-.36/2,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.2,$4,.26]}),j]}),(0,R.jsxs)(`mesh`,{position:[0,-.33999999999999997,.07],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.22,.1,.34]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#15171c`,transparent:o,opacity:O})]})]})]}),(0,R.jsxs)(`group`,{ref:f,position:[.13,0,0],children:[(0,R.jsxs)(`mesh`,{position:[0,-.4/2,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.22,Q4,.28]}),j]}),(0,R.jsxs)(`group`,{ref:m,position:[0,-.4,0],children:[(0,R.jsxs)(`mesh`,{position:[0,-.36/2,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.2,$4,.26]}),j]}),(0,R.jsxs)(`mesh`,{position:[0,-.33999999999999997,.07],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.22,.1,.34]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#15171c`,transparent:o,opacity:O})]})]})]}),(0,R.jsxs)(`mesh`,{position:[0,.36,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.55,.7,.3]}),(0,R.jsx)(`meshStandardMaterial`,{color:a,emissive:a,emissiveIntensity:s?.3:.05,transparent:o,opacity:O})]}),(0,R.jsxs)(`group`,{ref:h,position:[-.36,.6,0],children:[(0,R.jsxs)(`mesh`,{position:[0,-.17,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.15,.34,.22]}),A]}),(0,R.jsx)(`group`,{ref:_,position:[0,-.34,0],children:(0,R.jsxs)(`mesh`,{position:[0,-.16,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.13,.32,.2]}),k]})})]}),(0,R.jsxs)(`group`,{ref:g,position:[.36,.6,0],children:[(0,R.jsxs)(`mesh`,{position:[0,-.17,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.15,.34,.22]}),A]}),(0,R.jsx)(`group`,{ref:y,position:[0,-.34,0],children:(0,R.jsxs)(`mesh`,{position:[0,-.16,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.13,.32,.2]}),k]})})]}),(0,R.jsxs)(`group`,{ref:b,position:[0,.84,0],children:[(0,R.jsxs)(`mesh`,{castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.45,.45,.45]}),k]}),(0,R.jsxs)(`mesh`,{position:[-.1,.04,.23],children:[(0,R.jsx)(`boxGeometry`,{args:[.07,.07,.02]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#222`})]}),(0,R.jsxs)(`mesh`,{position:[.1,.04,.23],children:[(0,R.jsx)(`boxGeometry`,{args:[.07,.07,.02]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#222`})]})]})]}),n===`meeting`&&r?.speech?(0,R.jsx)(c4,{position:[0,2.55,0],center:!0,distanceFactor:9,children:(0,R.jsx)(`div`,{style:{fontFamily:`ui-sans-serif, system-ui, sans-serif`,fontSize:12,fontWeight:600,color:`#1a1a18`,background:`#fdfbf5`,border:`2px solid ${a}`,borderRadius:10,padding:`5px 9px`,maxWidth:190,lineHeight:1.3,boxShadow:`0 4px 14px rgba(0,0,0,0.35)`,pointerEvents:`none`},children:r.speech})}):null,(0,R.jsx)(c4,{position:[0,2.05,0],center:!0,distanceFactor:10,children:(0,R.jsxs)(`div`,{style:{fontFamily:`ui-monospace, monospace`,fontSize:12,fontWeight:700,color:a,background:`rgba(10,11,13,0.85)`,border:`1px solid ${a}`,borderRadius:6,padding:`2px 7px`,whiteSpace:`nowrap`,transform:s?`scale(1.08)`:`scale(1)`,pointerEvents:`none`},children:[e.agentName,(0,R.jsx)(`span`,{style:{color:L4(e.state).color,marginLeft:6,fontWeight:600},children:n===`meeting`?`Meeting`:L4(e.state).label})]})})]})}function t3({agent:e,position:t}){let n=L4(e.state).color,r=e.state===`working`||e.state===`booting`;return(0,R.jsxs)(`group`,{position:t,children:[(0,R.jsxs)(`mesh`,{position:[0,.92,0],castShadow:!0,receiveShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[1.5,.08,.85]}),(0,R.jsx)(`meshStandardMaterial`,{color:z4})]}),[[-.66,-.34],[.66,-.34],[-.66,.34],[.66,.34]].map(([e,t])=>(0,R.jsxs)(`mesh`,{position:[e,.46,t],children:[(0,R.jsx)(`boxGeometry`,{args:[.08,.92,.08]}),(0,R.jsx)(`meshStandardMaterial`,{color:B4})]},`${e},${t}`)),(0,R.jsxs)(`mesh`,{position:[0,1,-.28],children:[(0,R.jsx)(`boxGeometry`,{args:[.06,.16,.06]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#15171c`})]}),(0,R.jsxs)(`mesh`,{position:[0,.97,-.28],children:[(0,R.jsx)(`boxGeometry`,{args:[.22,.03,.12]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#15171c`})]}),(0,R.jsxs)(`mesh`,{position:[0,1.32,-.3],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.66,.44,.05]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#15171c`})]}),(0,R.jsxs)(`mesh`,{position:[0,1.32,-.272],children:[(0,R.jsx)(`boxGeometry`,{args:[.6,.38,.02]}),(0,R.jsx)(`meshStandardMaterial`,{color:n,emissive:n,emissiveIntensity:r?.85:.4})]}),(0,R.jsxs)(`mesh`,{position:[0,.97,.06],children:[(0,R.jsx)(`boxGeometry`,{args:[.5,.03,.16]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#1c1e24`})]}),(0,R.jsxs)(`mesh`,{position:[.32,.97,.08],children:[(0,R.jsx)(`boxGeometry`,{args:[.08,.03,.12]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#1c1e24`})]}),(0,R.jsxs)(`mesh`,{position:[-.38,.97,.1],children:[(0,R.jsx)(`boxGeometry`,{args:[.2,.02,.26]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#e8e6df`})]}),(0,R.jsxs)(`group`,{position:[0,0,.78],children:[(0,R.jsxs)(`mesh`,{position:[0,.5,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.5,.08,.5]}),(0,R.jsx)(`meshStandardMaterial`,{color:q4})]}),(0,R.jsxs)(`mesh`,{position:[0,.84,.22],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.5,.62,.08]}),(0,R.jsx)(`meshStandardMaterial`,{color:q4})]}),(0,R.jsxs)(`mesh`,{position:[0,.27,0],children:[(0,R.jsx)(`boxGeometry`,{args:[.08,.46,.08]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#15171c`})]}),(0,R.jsxs)(`mesh`,{position:[0,.06,0],children:[(0,R.jsx)(`boxGeometry`,{args:[.5,.05,.5]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#15171c`})]})]})]})}function n3({position:e,busy:t}){return(0,R.jsxs)(`group`,{position:e,children:[(0,R.jsxs)(`mesh`,{position:[0,1.5,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.08,1.2,1.9]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#f4f4f0`})]}),(0,R.jsxs)(`mesh`,{position:[0,.45,-.8],children:[(0,R.jsx)(`boxGeometry`,{args:[.08,1,.08]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#5b4632`})]}),(0,R.jsxs)(`mesh`,{position:[0,.45,.8],children:[(0,R.jsx)(`boxGeometry`,{args:[.08,1,.08]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#5b4632`})]}),(0,R.jsxs)(`mesh`,{position:[.05,1.7,.1],children:[(0,R.jsx)(`boxGeometry`,{args:[.02,.06,1.2]}),(0,R.jsx)(`meshStandardMaterial`,{color:t?`#fb4b38`:`#c9c4ba`})]}),(0,R.jsxs)(`mesh`,{position:[.05,1.45,-.1],children:[(0,R.jsx)(`boxGeometry`,{args:[.02,.05,.9]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#9aa0a8`})]}),(0,R.jsx)(c4,{position:[.06,2.25,0],center:!0,distanceFactor:12,rotation:[0,Math.PI/2,0],children:(0,R.jsx)(`div`,{style:{fontFamily:`ui-sans-serif, system-ui, sans-serif`,fontSize:12,fontWeight:800,letterSpacing:`0.08em`,color:t?`#fb4b38`:`#6b7188`,pointerEvents:`none`,whiteSpace:`nowrap`},children:`STANDUP`})})]})}function r3({halfX:e,halfZ:t}){let n=1.15,r=[],i=0;for(let a=-t+n/2;a<t;a+=n)r.push((0,R.jsxs)(`mesh`,{position:[0,0,a],receiveShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[e*2,.04,n-.04]}),(0,R.jsx)(`meshStandardMaterial`,{color:i%2==0?V4:H4})]},i)),i++;return(0,R.jsx)(`group`,{children:r})}function i3({halfX:e,halfZ:t}){return(0,R.jsxs)(`group`,{children:[(0,R.jsxs)(`mesh`,{position:[0,4/2,-t],receiveShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[e*2,4,.3]}),(0,R.jsx)(`meshStandardMaterial`,{color:U4})]}),(0,R.jsxs)(`mesh`,{position:[-e,4/2,0],receiveShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.3,4,t*2]}),(0,R.jsx)(`meshStandardMaterial`,{color:U4})]}),(0,R.jsxs)(`mesh`,{position:[e,4/2,0],receiveShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.3,4,t*2]}),(0,R.jsx)(`meshStandardMaterial`,{color:U4})]})]})}function a3({position:e}){return(0,R.jsxs)(`group`,{position:e,children:[(0,R.jsxs)(`mesh`,{position:[0,.18,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.34,.36,.34]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#b5651d`})]}),(0,R.jsxs)(`mesh`,{position:[0,.5,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.1,.3,.1]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#3f7d2e`})]}),(0,R.jsxs)(`mesh`,{position:[-.12,.62,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.2,.12,.2]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#4caf50`})]}),(0,R.jsxs)(`mesh`,{position:[.12,.66,.04],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.18,.12,.18]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#5fbf57`})]})]})}function o3({position:e}){return(0,R.jsxs)(`mesh`,{position:[e[0],.3,e[2]],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.4,.6,.4]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#8b2622`})]})}function s3({position:e}){return(0,R.jsxs)(`group`,{position:e,children:[(0,R.jsxs)(`mesh`,{rotation:[Math.PI/2,0,0],children:[(0,R.jsx)(`cylinderGeometry`,{args:[.32,.32,.05,24]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#f4f4f0`})]}),(0,R.jsxs)(`mesh`,{position:[0,.08,.04],children:[(0,R.jsx)(`boxGeometry`,{args:[.03,.16,.02]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#222`})]}),(0,R.jsxs)(`mesh`,{position:[.06,0,.04],children:[(0,R.jsx)(`boxGeometry`,{args:[.12,.03,.02]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#222`})]})]})}function c3({position:e}){return(0,R.jsxs)(`group`,{position:e,children:[(0,R.jsxs)(`mesh`,{children:[(0,R.jsx)(`boxGeometry`,{args:[1.7,1.1,.08]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#f4f4f0`})]}),(0,R.jsx)(c4,{position:[0,.42,.06],center:!0,distanceFactor:11,children:(0,R.jsx)(`div`,{style:{fontFamily:`ui-monospace, monospace`,fontSize:13,fontWeight:800,letterSpacing:`0.08em`,color:`#444`,pointerEvents:`none`,whiteSpace:`nowrap`},children:`ROADMAP`})})]})}function l3(){let{camera:e}=w0(),t=(0,v.useRef)({});return(0,v.useEffect)(()=>{e.position.set(0,1.7,6);let n=e=>{t.current[e.code]=!0},r=e=>{t.current[e.code]=!1};return window.addEventListener(`keydown`,n),window.addEventListener(`keyup`,r),()=>{window.removeEventListener(`keydown`,n),window.removeEventListener(`keyup`,r)}},[e]),T0((n,r)=>{let i=6*Math.min(r,.05),a=new X;e.getWorldDirection(a),a.y=0,a.normalize();let o=new X().crossVectors(a,new X(0,1,0)).normalize(),s=new X;t.current.KeyW&&s.add(a),t.current.KeyS&&s.sub(a),t.current.KeyD&&s.add(o),t.current.KeyA&&s.sub(o),s.lengthSq()>0&&(s.normalize().multiplyScalar(i),e.position.add(s),e.position.y=1.7)}),(0,R.jsx)(N4,{})}function u3(e){let t=Math.ceil(Math.sqrt(e)),n=Math.ceil(e/t),r=3.6,i=3.4,a=[];for(let o=0;o<e;o++){let e=o%t,s=Math.floor(o/t);a.push([(e-(t-1)/2)*r,0,(s-(n-1)/2)*i])}return{positions:a,halfX:Math.max(8,t*r/2+3),halfZ:Math.max(8,n*i/2+3.5)}}var d3=45e3,f3=6;function p3({agents:e,handoffs:t,now:n,onSelect:r,fps:i}){let{positions:a,halfX:o,halfZ:s}=u3(Math.max(e.length,1)),c=-(o-1.1),l=new Set(e.map(e=>e.agentName)),u=[],d=new Map;for(let e of t)n-Date.parse(e.createdAt)>d3||(l.has(e.from)&&(u.includes(e.from)||u.push(e.from),d.has(e.from)||d.set(e.from,{text:`${Y4(e.type)}: ${e.subject}`,speaker:!0})),l.has(e.to)&&(u.includes(e.to)||u.push(e.to),d.has(e.to)||d.set(e.to,{text:null,speaker:!1})));let f=u.slice(0,f3);function p(e,t){let n=2.5,r=t<=1?0:Math.min(Math.PI*.62,.4+t*.18),i=t<=1?0:-r/2+r*(e/(t-1));return[c+n*Math.cos(i),0,0+n*Math.sin(i)]}return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`ambientLight`,{intensity:.6}),(0,R.jsx)(`directionalLight`,{position:[6,12,8],intensity:.85,castShadow:!0}),(0,R.jsx)(`pointLight`,{position:[-6,8,-6],intensity:.25,color:`#f5402d`}),(0,R.jsx)(`hemisphereLight`,{args:[W4,`#3a2c1f`,.4]}),(0,R.jsx)(r3,{halfX:o,halfZ:s}),(0,R.jsx)(i3,{halfX:o,halfZ:s}),e.map((e,t)=>(0,R.jsx)(t3,{agent:e,position:a[t]??[0,0,0]},`desk-${e.id}`)),e.map((e,t)=>{let n=f.indexOf(e.agentName),i=n>=0,o=i?`meeting`:J4(e.state),s=d.get(e.agentName),l=i?{pos:p(n,f.length),faceX:c,faceZ:0,speech:s?.text??null,speaker:s?.speaker??!1}:null;return(0,R.jsx)(e3,{agent:e,deskPos:a[t]??[0,0,0],behavior:o,meeting:l,onSelect:r},`actor-${e.id}`)}),(0,R.jsx)(n3,{position:[c,0,0],busy:f.length>0}),(0,R.jsx)(a3,{position:[-o+1.4,0,s-2]}),(0,R.jsx)(a3,{position:[o-1.6,0,s-1.4]}),(0,R.jsx)(o3,{position:[o-1.2,0,-s+1.4]}),(0,R.jsx)(s3,{position:[-2,2.7,-s+.22]}),(0,R.jsx)(c3,{position:[2.6,2.3,-s+.3]}),i?(0,R.jsx)(l3,{}):(0,R.jsx)(M4,{enablePan:!0,minDistance:4,maxDistance:s*2.4,maxPolarAngle:Math.PI/2.1})]})}function m3({icon:e,children:t}){return(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:7},children:[(0,R.jsx)(e,{size:14,style:{flex:`0 0 auto`}}),(0,R.jsx)(`span`,{children:t})]})}function h3({agents:e,onSelect:t}){let[n,r]=(0,v.useState)(!1),{data:i}=hL(k,5e3),[a,o]=(0,v.useState)(()=>Date.now());return(0,v.useEffect)(()=>{let e=window.setInterval(()=>o(Date.now()),5e3);return()=>window.clearInterval(e)},[]),(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`page-head`,children:[(0,R.jsxs)(`h1`,{className:`page-title`,children:[(0,R.jsx)(Mt,{icon:et}),` Office`]}),(0,R.jsx)(`p`,{className:`page-sub`,children:`Agents act out their work: idle agents stand, working agents sit and type, and when two hand off a task they meet at the whiteboard to talk it through. Click an avatar for detail.`})]}),(0,R.jsx)(`div`,{className:`card`,style:{padding:0,overflow:`hidden`,position:`relative`,height:`calc(100vh - 230px)`,minHeight:460},children:e.length===0?(0,R.jsx)(`div`,{className:`empty`,style:{paddingTop:140},children:`The office is empty — spawn an agent to populate it.`}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(q2,{shadows:!0,camera:{position:[0,7,13],fov:45},style:{background:W4},children:(0,R.jsx)(p3,{agents:e,handoffs:i??[],now:a,onSelect:t,fps:n})}),(0,R.jsxs)(`div`,{style:{position:`absolute`,top:14,left:14,background:`rgba(10,11,13,0.82)`,border:`1px solid var(--border)`,borderRadius:10,padding:`12px 14px`,fontSize:13,color:`var(--text)`,minWidth:188,backdropFilter:`blur(4px)`},children:[(0,R.jsxs)(`div`,{style:{fontWeight:800,marginBottom:8,display:`flex`,alignItems:`center`,gap:7},children:[(0,R.jsx)(et,{size:16}),` The Office`]}),(0,R.jsxs)(`div`,{className:`dim`,style:{display:`flex`,flexDirection:`column`,gap:6,fontSize:12.5},children:[(0,R.jsxs)(m3,{icon:n?Et:Tt,children:[(0,R.jsx)(`b`,{style:{color:`var(--text)`},children:`Mode:`}),` `,n?`FPS`:`Orbit`]}),n?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(m3,{icon:Dt,children:`WASD: Move`}),(0,R.jsx)(m3,{icon:Ot,children:`Mouse: Look`}),(0,R.jsx)(m3,{icon:Dt,children:`Esc: Release`})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(m3,{icon:Ot,children:`Mouse: Rotate view`}),(0,R.jsx)(m3,{icon:At,children:`Scroll: Zoom`}),(0,R.jsx)(m3,{icon:kt,children:`Click: Select`})]})]}),(0,R.jsx)(`button`,{type:`button`,className:`btn primary`,style:{marginTop:10,width:`100%`},onClick:()=>r(e=>!e),children:n?`Switch to Orbit Mode`:`Switch to FPS Mode`})]}),(0,R.jsxs)(`div`,{style:{position:`absolute`,bottom:14,right:14,background:`rgba(10,11,13,0.82)`,border:`1px solid var(--border)`,borderRadius:10,padding:`10px 14px`,fontSize:12.5,color:`var(--text)`,backdropFilter:`blur(4px)`},children:[(0,R.jsx)(`div`,{style:{fontWeight:800,marginBottom:6},children:`State`}),R4.map(e=>(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`2px 0`},children:[(0,R.jsx)(`span`,{style:{width:9,height:9,borderRadius:`50%`,background:e.color,display:`inline-block`}}),e.label]},e.label)),(0,R.jsx)(`div`,{style:{fontWeight:800,margin:`10px 0 6px`,borderTop:`1px solid var(--border)`,paddingTop:8},children:`Behavior`}),(0,R.jsxs)(`div`,{className:`dim`,style:{lineHeight:1.7},children:[(0,R.jsx)(`div`,{children:`Standing — idle`}),(0,R.jsx)(`div`,{children:`Sitting & typing — working`}),(0,R.jsx)(`div`,{children:`At whiteboard — handing off`})]})]})]})})]})}function g3(e){if(!e)return`—`;let t=e.includes(`-`)?e.slice(e.lastIndexOf(`-`)+1):e;return t.length>8?t.slice(0,8):t}var _3=new Set([`working`,`booting`]);function v3({onSelect:e}){let{data:t}=hL(S,5e3),{data:n}=hL(C,5e3),[r,i]=(0,v.useState)(`all`),a=t??[],o=n??[],s=(0,v.useMemo)(()=>{let e=new Set;for(let t of o)t.capability&&e.add(t.capability);return Array.from(e).sort()},[o]),c=(0,v.useMemo)(()=>o.filter(e=>_3.has(e.state)).length,[o]),l=(0,v.useMemo)(()=>[...r===`all`?o:o.filter(e=>e.capability===r)].sort((e,t)=>new Date(t.lastActivity).getTime()-new Date(e.lastActivity).getTime()),[o,r]);return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`page-head`,children:[(0,R.jsxs)(`h1`,{className:`page-title`,children:[(0,R.jsx)(Mt,{icon:it,tone:`cyan`}),` Runs & Sessions`]}),(0,R.jsx)(`p`,{className:`page-sub`,children:`All agent runs and the sessions within them`})]}),(0,R.jsxs)(`div`,{className:`stat-grid`,children:[(0,R.jsx)(oe,{label:`Total Runs`,value:a.length,icon:(0,R.jsx)(it,{size:20}),iconTone:`cyan`}),(0,R.jsx)(oe,{label:`Total Sessions`,value:o.length,icon:(0,R.jsx)(yt,{size:20}),iconTone:`info`}),(0,R.jsx)(oe,{label:`Active`,value:c,icon:(0,R.jsx)(mt,{size:20}),iconTone:`accent`,valueClass:c>0?``:`dim`,sub:`${c} working / booting`}),(0,R.jsx)(oe,{label:`Capabilities`,value:s.length,icon:(0,R.jsx)(at,{size:20}),iconTone:`violet`})]}),(0,R.jsx)(se,{title:`Sessions`,right:s.length>0?(0,R.jsxs)(`div`,{className:`seg`,children:[(0,R.jsx)(`button`,{type:`button`,className:r===`all`?`active`:``,onClick:()=>i(`all`),children:`All`}),s.map(e=>(0,R.jsx)(`button`,{type:`button`,className:r===e?`active`:``,onClick:()=>i(e),children:e},e))]}):(0,R.jsxs)(`span`,{className:`card-meta`,children:[o.length,` total`]}),children:(0,R.jsx)(`div`,{className:`grid-wrap`,children:(0,R.jsxs)(`table`,{className:`grid`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`th`,{children:`Session`}),(0,R.jsx)(`th`,{children:`Capability`}),(0,R.jsx)(`th`,{children:`State`}),(0,R.jsx)(`th`,{children:`Task`}),(0,R.jsx)(`th`,{children:`Run`}),(0,R.jsx)(`th`,{children:`Updated`})]})}),(0,R.jsx)(`tbody`,{children:l.length===0?(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{colSpan:6,children:(0,R.jsx)(`div`,{className:`empty`,children:`No sessions to show.`})})}):l.map(t=>{let n=ce(t.state);return(0,R.jsxs)(`tr`,{className:`row-click`,onClick:()=>e(t.agentName),children:[(0,R.jsxs)(`td`,{children:[(0,R.jsx)(`span`,{style:{fontWeight:700},children:t.agentName}),` `,(0,R.jsx)(ae,{tone:`neutral`,children:t.capability})]}),(0,R.jsx)(`td`,{className:`dim`,children:t.capability}),(0,R.jsx)(`td`,{children:(0,R.jsx)(ae,{tone:n.tone,children:n.label})}),(0,R.jsx)(`td`,{className:`mono nowrap`,children:t.taskId||`—`}),(0,R.jsx)(`td`,{className:`mono nowrap faint`,children:g3(t.runId)}),(0,R.jsx)(`td`,{className:`dim nowrap`,children:ne(t.lastActivity)})]},t.id)})})]})})})]})}function y3({k:e,value:t}){return(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`td`,{className:`dim nowrap`,children:e}),(0,R.jsx)(`td`,{className:`mono`,children:t})]})}function b3({overview:e}){return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`page-head`,children:[(0,R.jsxs)(`div`,{className:`page-title`,children:[(0,R.jsx)(Mt,{icon:lt,tone:`info`}),` Settings`]}),(0,R.jsx)(`div`,{className:`page-sub`,children:`Project configuration (read-only)`})]}),(0,R.jsxs)(`div`,{className:`row-2col`,children:[(0,R.jsx)(se,{title:`Project`,children:(0,R.jsx)(`div`,{className:`grid-wrap`,children:(0,R.jsx)(`table`,{className:`grid`,children:(0,R.jsxs)(`tbody`,{children:[(0,R.jsx)(y3,{k:`Project`,value:e?.project??`—`}),(0,R.jsx)(y3,{k:`Runtime`,value:e?.runtime??`—`}),(0,R.jsx)(y3,{k:`Provider`,value:e?.provider??`—`}),(0,R.jsx)(y3,{k:`Model`,value:e?.model??`—`}),(0,R.jsx)(y3,{k:`Deploy target`,value:e?.deployTarget??`(none)`}),(0,R.jsx)(y3,{k:`Current run`,value:e?.currentRun?.id??`—`}),(0,R.jsx)(y3,{k:`Agents`,value:e?(0,R.jsx)(ae,{tone:`accent`,children:e.agentCount}):`—`})]})})})}),(0,R.jsxs)(se,{title:`About`,children:[(0,R.jsxs)(`p`,{className:`dim`,style:{lineHeight:1.6,margin:`0 0 12px`},children:[(0,R.jsx)(`strong`,{style:{color:`var(--accent)`},children:`Agentplate`}),` is a self-improving multi-agent orchestration system that takes work from build to deploy. A single session becomes a coordinated team of agents running in isolated git worktrees, messaging through a SQLite mail bus and merging back with tiered conflict resolution.`]}),(0,R.jsxs)(`p`,{className:`dim`,style:{lineHeight:1.6,margin:`0 0 12px`},children:[`Operate the swarm through the `,(0,R.jsx)(`span`,{className:`mono`,children:`agentplate`}),` `,`CLI, the live TUI dashboard, or this web UI.`]}),(0,R.jsxs)(`p`,{className:`faint`,style:{lineHeight:1.6,margin:0},children:[`Edit `,(0,R.jsx)(`span`,{className:`mono`,children:`.agentplate/config.yaml`}),` or run`,` `,(0,R.jsx)(`span`,{className:`mono`,children:`agentplate setup`}),` to change settings.`]})]})]})]})}function x3(e){return e===`active`?`ok`:e===`quarantined`?`warn`:`neutral`}function S3(){let{data:e,error:t,loading:n}=hL(w,5e3),r=e??[],i=r.filter(e=>e.status===`active`).length,a=r.length>0?r.reduce((e,t)=>e+t.confidence,0)/r.length:0;return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`page-head`,children:[(0,R.jsxs)(`h1`,{className:`page-title`,children:[(0,R.jsx)(Mt,{icon:at,tone:`violet`}),` Skills`]}),(0,R.jsx)(`p`,{className:`page-sub`,children:`Distilled, self-improving expertise ranked by confidence.`})]}),t?(0,R.jsx)(se,{children:(0,R.jsx)(`span`,{className:`badge err`,children:t})}):null,(0,R.jsxs)(`div`,{className:`stat-grid`,children:[(0,R.jsx)(oe,{label:`Total skills`,value:r.length,icon:(0,R.jsx)(at,{size:20}),iconTone:`violet`}),(0,R.jsx)(oe,{label:`Active`,value:i,icon:(0,R.jsx)(mt,{size:20}),iconTone:`accent`,valueClass:`accent`}),(0,R.jsx)(oe,{label:`Avg confidence`,value:`${Math.round(a*100)}%`,icon:(0,R.jsx)(bt,{size:20}),iconTone:`ok`,valueClass:`sm`})]}),(0,R.jsx)(se,{title:`Skill library`,meta:`${r.length} skill${r.length===1?``:`s`}`,children:(0,R.jsx)(`div`,{className:`grid-wrap`,children:(0,R.jsxs)(`table`,{className:`grid`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`th`,{children:`Skill`}),(0,R.jsx)(`th`,{children:`Status`}),(0,R.jsx)(`th`,{children:`Confidence`}),(0,R.jsx)(`th`,{children:`Applied`}),(0,R.jsx)(`th`,{children:`Success`}),(0,R.jsx)(`th`,{children:`Ver`})]})}),(0,R.jsx)(`tbody`,{children:n&&r.length===0?(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{colSpan:6,className:`empty`,children:`Loading skills…`})}):r.length===0?(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{colSpan:6,className:`empty`,children:`No skills distilled yet.`})}):r.map(e=>{let t=Math.max(0,Math.min(100,Math.round(e.confidence*100)));return(0,R.jsxs)(`tr`,{children:[(0,R.jsxs)(`td`,{children:[(0,R.jsx)(`strong`,{children:e.title||e.slug}),e.goal?(0,R.jsx)(`div`,{className:`dim`,style:{fontSize:12,marginTop:2},children:e.goal}):null]}),(0,R.jsx)(`td`,{children:(0,R.jsx)(ae,{tone:x3(e.status),children:e.status})}),(0,R.jsx)(`td`,{children:(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,minWidth:130},children:[(0,R.jsx)(`div`,{className:`bar`,style:{flex:1},children:(0,R.jsx)(`span`,{style:{width:`${t}%`}})}),(0,R.jsxs)(`span`,{className:`mono dim nowrap`,style:{fontSize:12},children:[t,`%`]})]})}),(0,R.jsx)(`td`,{className:`dim`,children:e.appliedCount}),(0,R.jsx)(`td`,{className:`dim`,children:Math.round(e.successCount*100)/100}),(0,R.jsxs)(`td`,{className:`dim mono`,children:[`v`,e.version]})]},e.slug)})})]})})})]})}function C3(e){return e>=90?`#f5402d`:e>=70?`#fbbf24`:`#34d399`}function w3({pct:e}){return(0,R.jsx)(`div`,{className:`bar`,style:{marginTop:14},children:(0,R.jsx)(`span`,{style:{width:`${Math.max(0,Math.min(100,e))}%`,background:C3(e)}})})}function T3({pct:e}){return(0,R.jsxs)(`span`,{className:`mono`,style:{fontSize:30,fontWeight:700,color:C3(e),lineHeight:1},children:[Math.round(e),(0,R.jsx)(`span`,{style:{fontSize:18},children:`%`})]})}function E3(){let{data:e,error:t,loading:n}=hL(j,5e3);return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`page-head`,children:(0,R.jsxs)(`div`,{className:`head-row`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`page-title`,children:[(0,R.jsx)(Mt,{icon:Qe,tone:`info`}),` System Monitor`]}),(0,R.jsx)(`div`,{className:`page-sub`,children:`Real-time monitoring of the server running agentplate serve`})]}),(0,R.jsx)(ae,{tone:`ok`,children:`● Live`})]})}),n&&!e?(0,R.jsx)(`div`,{className:`empty`,children:`Loading system metrics…`}):null,t?(0,R.jsxs)(`div`,{className:`empty`,children:[`Failed to load system metrics: `,t]}):null,e?(0,R.jsx)(D3,{m:e}):null]})}function D3({m:e}){let[t,n,r]=e.cpu.loadAvg,i=e.disk.percent!=null&&e.disk.usedBytes!=null&&e.disk.totalBytes!=null;return(0,R.jsxs)(`div`,{className:`row-2col`,children:[(0,R.jsxs)(se,{title:`CPU`,right:(0,R.jsxs)(`span`,{className:`faint mono`,children:[e.cpu.cores,` cores`]}),children:[(0,R.jsxs)(`div`,{className:`row-2col`,style:{alignItems:`center`},children:[(0,R.jsx)(T3,{pct:e.cpu.percent}),(0,R.jsxs)(`div`,{className:`dim mono`,style:{fontSize:12,textAlign:`right`},children:[`Load Average`,(0,R.jsx)(`br`,{}),t.toFixed(2),` / `,n.toFixed(2),` / `,r.toFixed(2)]})]}),(0,R.jsx)(w3,{pct:e.cpu.percent})]}),(0,R.jsxs)(se,{title:`RAM`,children:[(0,R.jsxs)(`div`,{className:`row-2col`,style:{alignItems:`center`},children:[(0,R.jsx)(T3,{pct:e.memory.percent}),(0,R.jsxs)(`div`,{className:`dim mono`,style:{fontSize:12,textAlign:`right`},children:[B(e.memory.usedBytes),` / `,B(e.memory.totalBytes)]})]}),(0,R.jsx)(w3,{pct:e.memory.percent})]}),(0,R.jsx)(se,{title:`DISK`,children:i?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`row-2col`,style:{alignItems:`center`},children:[(0,R.jsx)(T3,{pct:e.disk.percent}),(0,R.jsxs)(`div`,{className:`dim mono`,style:{fontSize:12,textAlign:`right`},children:[B(e.disk.usedBytes),` / `,B(e.disk.totalBytes)]})]}),(0,R.jsx)(w3,{pct:e.disk.percent})]}):(0,R.jsx)(`div`,{className:`empty`,children:`Disk metrics unavailable`})}),(0,R.jsx)(se,{title:`Host`,children:(0,R.jsxs)(`div`,{className:`row-2col`,style:{rowGap:12},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`faint`,style:{fontSize:11,textTransform:`uppercase`},children:`Hostname`}),(0,R.jsx)(`div`,{className:`mono`,style:{fontSize:15,fontWeight:600},children:e.hostname})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`faint`,style:{fontSize:11,textTransform:`uppercase`},children:`Platform`}),(0,R.jsx)(`div`,{className:`mono`,style:{fontSize:15,fontWeight:600},children:e.platform})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`faint`,style:{fontSize:11,textTransform:`uppercase`},children:`Uptime`}),(0,R.jsx)(`div`,{className:`mono`,style:{fontSize:15,fontWeight:600},children:ie(e.uptimeSeconds)})]})]})})]})}function O3(e){switch(e){case`active`:return`accent`;case`done`:return`ok`;case`failed`:return`err`;case`pending`:return`info`;default:return`neutral`}}function k3({tasks:e,live:t}){let[n,r]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(t||e.length>0)return;let n=!1;return A().then(e=>{n||r(e)}).catch(()=>{}),()=>{n=!0}},[t,e.length]);let i=e.length>0?e:n??[],a=i.filter(e=>e.status===`active`).length,o=i.filter(e=>e.status===`done`).length;return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`page-head`,children:[(0,R.jsxs)(`h1`,{className:`page-title`,children:[(0,R.jsx)(Mt,{icon:tt,tone:`violet`}),` Tasks`]}),(0,R.jsxs)(`p`,{className:`page-sub`,children:[t?`Live work queue via WebSocket.`:`Socket offline — last known tasks.`,` Refreshes every 5s.`]})]}),(0,R.jsxs)(`div`,{className:`stat-grid`,children:[(0,R.jsx)(oe,{label:`Total tasks`,value:i.length,icon:(0,R.jsx)(tt,{size:20}),iconTone:`violet`}),(0,R.jsx)(oe,{label:`Active`,value:a,icon:(0,R.jsx)(mt,{size:20}),iconTone:`accent`,valueClass:`accent`}),(0,R.jsx)(oe,{label:`Done`,value:o,icon:(0,R.jsx)(xt,{size:20}),iconTone:`ok`})]}),(0,R.jsx)(se,{title:`Tasks`,meta:`${i.length} total · ${a} active · ${o} done`,children:(0,R.jsx)(`div`,{className:`grid-wrap`,children:(0,R.jsxs)(`table`,{className:`grid`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`th`,{children:`Task`}),(0,R.jsx)(`th`,{children:`Status`}),(0,R.jsx)(`th`,{children:`Capabilities`}),(0,R.jsx)(`th`,{children:`Agents`}),(0,R.jsx)(`th`,{children:`Last activity`})]})}),(0,R.jsx)(`tbody`,{children:i.length===0?(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{colSpan:5,className:`empty`,children:`No tasks yet. Submit one from the Chat tab.`})}):i.map(e=>(0,R.jsxs)(`tr`,{children:[(0,R.jsxs)(`td`,{children:[(0,R.jsx)(`strong`,{className:`mono`,children:e.taskId}),e.summary?(0,R.jsx)(`div`,{className:`dim`,children:e.summary}):null]}),(0,R.jsx)(`td`,{children:(0,R.jsx)(ae,{tone:O3(e.status),children:e.status})}),(0,R.jsx)(`td`,{className:`dim`,children:e.capabilities.length>0?e.capabilities.join(`, `):`—`}),(0,R.jsx)(`td`,{className:`dim`,children:e.agentCount>0?(0,R.jsxs)(`span`,{title:e.agents.join(`, `),children:[e.agentCount,` (`,e.agents.slice(0,2).join(`, `),e.agents.length>2?`…`:``,`)`]}):`—`}),(0,R.jsx)(`td`,{className:`dim nowrap`,children:e.lastActivity?ne(e.lastActivity):`—`})]},e.taskId))})]})})})]})}function A3({state:e}){let{tone:t,label:n}=ce(e);return(0,R.jsx)(ae,{tone:t,children:n})}function j3({label:e,value:t}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`faint`,style:{fontSize:12,padding:`5px 0`},children:e}),(0,R.jsx)(`span`,{style:{padding:`5px 0`,minWidth:0,wordBreak:`break-word`},children:t})]})}function M3({m:e,dir:t}){return(0,R.jsxs)(`li`,{style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`,paddingBottom:8,borderBottom:`1px solid var(--border-soft)`},children:[(0,R.jsx)(ae,{tone:t===`in`?`info`:`accent`,children:t===`in`?`◀ in`:`out ▶`}),(0,R.jsx)(`span`,{className:`mono dim`,children:t===`in`?e.from:e.to}),(0,R.jsx)(`span`,{className:`faint`,style:{fontSize:12},children:e.type}),(0,R.jsx)(`span`,{style:{flex:1,minWidth:120},children:e.subject}),(0,R.jsx)(`span`,{className:`dim`,style:{fontSize:12},children:ne(e.createdAt)})]})}var N3={display:`grid`,gridTemplateColumns:`minmax(110px, max-content) 1fr`,columnGap:16,alignItems:`baseline`,fontSize:13},P3={listStyle:`none`,margin:0,padding:0,display:`flex`,flexDirection:`column`,gap:10};function F3({name:e,onClose:t}){let{data:n,error:r}=hL(()=>O(e),5e3),i=n?.session??null,a=[...(n?.inbox??[]).map(e=>({m:e,dir:`in`})),...(n?.sent??[]).map(e=>({m:e,dir:`out`}))].sort((e,t)=>e.m.createdAt<t.m.createdAt?1:-1);return(0,R.jsx)(`div`,{onClick:t,role:`presentation`,style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.5)`,display:`flex`,justifyContent:`flex-end`,zIndex:50},children:(0,R.jsxs)(`aside`,{onClick:e=>e.stopPropagation(),role:`dialog`,"aria-label":`Agent ${e}`,style:{width:`min(560px, 100%)`,height:`100%`,background:`var(--bg-card)`,borderLeft:`1px solid var(--border)`,overflowY:`auto`,padding:18},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,justifyContent:`space-between`,gap:12,marginBottom:18},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{style:{fontSize:24,fontWeight:800,letterSpacing:`-0.02em`,color:te(e)},children:e}),(0,R.jsxs)(`div`,{className:`dim`,style:{fontSize:12,marginTop:4},children:[i?i.capability:`agent`,` · refreshes every 5s`]})]}),(0,R.jsx)(`button`,{type:`button`,className:`btn`,onClick:t,"aria-label":`Close`,children:`×`})]}),r?(0,R.jsx)(`div`,{style:{background:`var(--err-soft)`,border:`1px solid var(--accent-border)`,color:`var(--err)`,borderRadius:`9px`,padding:`10px 14px`,marginBottom:16,fontSize:13,fontWeight:600},children:r}):null,i?(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,R.jsx)(se,{title:`Session`,children:(0,R.jsxs)(`div`,{style:N3,children:[(0,R.jsx)(j3,{label:`State`,value:(0,R.jsx)(A3,{state:i.state})}),(0,R.jsx)(j3,{label:`Capability`,value:i.capability}),(0,R.jsx)(j3,{label:`Task`,value:(0,R.jsx)(`span`,{className:`mono`,children:i.taskId||`—`})}),(0,R.jsx)(j3,{label:`Run`,value:(0,R.jsx)(`span`,{className:`mono`,children:i.runId})}),(0,R.jsx)(j3,{label:`Parent`,value:i.parentAgent??`—`}),(0,R.jsx)(j3,{label:`Depth`,value:String(i.depth)}),(0,R.jsx)(j3,{label:`Branch`,value:(0,R.jsx)(`span`,{className:`mono`,children:i.branchName||`—`})}),(0,R.jsx)(j3,{label:`PID`,value:i.pid==null?`—`:String(i.pid)}),(0,R.jsx)(j3,{label:`Worktree`,value:(0,R.jsx)(`span`,{className:`mono`,children:i.worktreePath})}),(0,R.jsx)(j3,{label:`Started`,value:z(i.startedAt)}),(0,R.jsx)(j3,{label:`Last activity`,value:`${ne(i.lastActivity)} (${z(i.lastActivity)})`}),(0,R.jsx)(j3,{label:`Runtime session`,value:(0,R.jsx)(`span`,{className:`mono`,children:i.runtimeSessionId??`—`})})]})}),(0,R.jsx)(se,{title:`Handoff communications`,meta:`${a.length} messages`,children:a.length===0?(0,R.jsx)(`div`,{className:`empty`,children:`No mail to or from this agent yet.`}):(0,R.jsx)(`ul`,{style:P3,children:a.map(({m:e,dir:t})=>(0,R.jsx)(M3,{m:e,dir:t},`${e.id}-${t}`))})}),n?.children&&n.children.length>0?(0,R.jsx)(se,{title:`Spawned agents`,meta:`${n.children.length}`,children:(0,R.jsx)(`ul`,{style:P3,children:n.children.map(e=>(0,R.jsxs)(`li`,{style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`},children:[(0,R.jsx)(A3,{state:e.state}),(0,R.jsx)(`span`,{className:`mono`,style:{color:te(e.agentName)},children:e.agentName}),(0,R.jsxs)(`span`,{className:`dim`,children:[e.capability,` · `,e.taskId]})]},e.id))})}):null,(0,R.jsx)(se,{title:`Recent activity`,meta:`${n?.events.length??0} events`,children:!n||n.events.length===0?(0,R.jsx)(`div`,{className:`empty`,children:`No events recorded yet.`}):(0,R.jsx)(`ul`,{style:P3,children:n.events.map(e=>(0,R.jsxs)(`li`,{style:{display:`flex`,alignItems:`baseline`,gap:8,flexWrap:`wrap`},children:[(0,R.jsx)(`span`,{className:`dim`,style:{fontSize:12},children:ne(e.createdAt)}),(0,R.jsx)(`span`,{className:`mono`,style:{fontSize:12.5},children:e.tool?`${e.type}: ${e.tool}`:e.type}),e.detail?(0,R.jsxs)(`span`,{className:`dim`,children:[`— `,e.detail]}):null]},e.id))})})]}):(0,R.jsx)(`div`,{className:`empty`,children:`No live session for this agent.`})]})})}var I3=[{id:`dashboard`,label:`Dashboard`},{id:`system`,label:`System`},{id:`agents`,label:`Agents`},{id:`office`,label:`Office`},{id:`tasks`,label:`Tasks`},{id:`handoffs`,label:`Handoffs`},{id:`activity`,label:`Activity`},{id:`sessions`,label:`Runs`},{id:`skills`,label:`Skills`},{id:`costs`,label:`Costs`},{id:`chat`,label:`Chat`},{id:`deploy`,label:`Deploy`},{id:`settings`,label:`Settings`}],L3={idle:0,working:0,completed:0,stalled:0};function R3(e){let t={idle:0,working:0,completed:0,stalled:0};for(let n of e)n.state===`working`||n.state===`booting`?t.working++:n.state===`idle`?t.idle++:n.state===`completed`?t.completed++:t.stalled++;return t}function z3(){let[e,t]=(0,v.useState)(`dashboard`),[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(L3),[u,d]=(0,v.useState)([]),[f,p]=(0,v.useState)([]),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(null),[y,b]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),b(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,v.useEffect)(()=>{let e=I({onSnapshot:e=>{a(e.overview),s(Array.isArray(e.agents)?e.agents:[]),l(e.statusCounts??L3),d(Array.isArray(e.tasks)?e.tasks:[]),p(Array.isArray(e.feed)?e.feed:[])},onStatus:r});return()=>e.close()},[]);let S=(0,v.useRef)(n);(0,v.useEffect)(()=>{S.current=n},[n]),(0,v.useEffect)(()=>{let e=!1,t=async()=>{if(!S.current)try{let[t,n,r,i]=await Promise.all([C(),x().catch(()=>null),A().catch(()=>[]),D(40).catch(()=>[])]);if(e)return;s(t),l(R3(t)),n&&a(n),d(r),p(i)}catch{}};t();let n=window.setInterval(t,4e3);return()=>{e=!0,window.clearInterval(n)}},[]),(0,v.useEffect)(()=>{let e=!1,t=()=>j().then(t=>!e&&h(t)).catch(()=>{});t();let n=window.setInterval(t,5e3);return()=>{e=!0,window.clearInterval(n)}},[]);let w=(0,v.useMemo)(()=>{switch(e){case`dashboard`:return(0,R.jsx)(jL,{overview:i,agents:o,counts:c,onOpenOffice:()=>t(`office`),onSelect:_});case`system`:return(0,R.jsx)(E3,{});case`agents`:return(0,R.jsx)(Gt,{agents:o,counts:c,onSelect:_});case`office`:return(0,R.jsx)(h3,{agents:o,onSelect:_});case`tasks`:return(0,R.jsx)(k3,{tasks:u,live:n});case`handoffs`:return(0,R.jsx)(AL,{});case`activity`:return(0,R.jsx)(OL,{feed:f,live:n});case`sessions`:return(0,R.jsx)(v3,{onSelect:_});case`skills`:return(0,R.jsx)(S3,{});case`costs`:return(0,R.jsx)(xL,{});case`chat`:return(0,R.jsx)(Yt,{feed:f});case`deploy`:return(0,R.jsx)(TL,{});case`settings`:return(0,R.jsx)(b3,{overview:i});default:return null}},[e,i,o,c,u,f,n]),T=(i?.project??`A`).charAt(0).toUpperCase(),E=(0,v.useMemo)(()=>new Set(o.map(e=>e.agentName)),[o]);return(0,R.jsxs)(`div`,{className:`os`,children:[(0,R.jsxs)(`nav`,{className:`rail`,children:[(0,R.jsx)(`div`,{className:`rail-logo`,title:`Agentplate`,children:(0,R.jsx)(Ft,{size:26,color:`#fff`})}),I3.map(n=>{let r=jt[n.id];return(0,R.jsxs)(`button`,{type:`button`,className:`rail-item ${e===n.id?`active`:``}`,onClick:()=>t(n.id),children:[(0,R.jsx)(`span`,{className:`ri-icon`,children:r?(0,R.jsx)(r,{size:20,strokeWidth:2}):null}),(0,R.jsx)(`span`,{className:`ri-label`,children:n.label})]},n.id)})]}),(0,R.jsxs)(`header`,{className:`topbar`,children:[(0,R.jsxs)(`div`,{className:`topbar-brand`,children:[(0,R.jsx)(`span`,{className:`brand-glyph`,children:(0,R.jsx)(It,{size:20})}),(0,R.jsx)(`span`,{children:`Agentplate`}),(0,R.jsx)(`span`,{className:`ver-pill`,children:`OS`})]}),(0,R.jsx)(`div`,{className:`topbar-spacer`}),(0,R.jsxs)(`button`,{type:`button`,className:`topbar-search`,onClick:()=>b(!0),children:[(0,R.jsx)(ut,{size:15,strokeWidth:2}),(0,R.jsx)(`span`,{children:`Search…`}),(0,R.jsx)(`kbd`,{children:`⌘K`})]}),(0,R.jsx)(Wt,{feed:f,agentNames:E,onSelectAgent:_}),(0,R.jsx)(`div`,{className:`topbar-user`,children:(0,R.jsx)(`span`,{className:`avatar`,children:T})})]}),(0,R.jsx)(`main`,{className:`main`,children:w}),(0,R.jsxs)(`footer`,{className:`statusbar`,children:[(0,R.jsx)(B3,{label:`CPU`,value:m?`${m.cpu.percent}%`:`—`,pct:m?.cpu.percent??0}),(0,R.jsx)(B3,{label:`RAM`,value:m?`${m.memory.percent}%`:`—`,pct:m?.memory.percent??0}),(0,R.jsx)(B3,{label:`DISK`,value:m?.disk.percent==null?`—`:`${m.disk.percent}%`,pct:m?.disk.percent??0}),(0,R.jsx)(`div`,{className:`sb-spacer`}),(0,R.jsxs)(`span`,{className:`sb-item`,children:[(0,R.jsx)(`span`,{className:`sb-dot`,style:{background:n?`var(--ok)`:`var(--err)`}}),(0,R.jsx)(`span`,{className:`sb-key`,children:n?`LIVE`:`OFFLINE`})]}),m?(0,R.jsxs)(`span`,{className:`sb-item`,children:[(0,R.jsx)(`span`,{className:`sb-key`,children:`UPTIME`}),(0,R.jsx)(`span`,{className:`sb-val`,children:ie(m.uptimeSeconds)})]}):null,m?(0,R.jsx)(`span`,{className:`sb-item faint`,children:m.hostname}):null]}),g?(0,R.jsx)(F3,{name:g,onClose:()=>_(null)}):null,(0,R.jsx)(Lt,{open:y,nav:I3,agents:o.map(e=>e.agentName),onClose:()=>b(!1),onNavigate:e=>t(e),onSelectAgent:_})]})}function B3({label:e,value:t,pct:n}){let r=n>=90?`var(--err)`:n>=70?`var(--warn)`:`var(--ok)`;return(0,R.jsxs)(`span`,{className:`sb-item`,children:[(0,R.jsx)(`span`,{className:`sb-key`,children:e}),(0,R.jsx)(`span`,{className:`sb-val`,children:t}),(0,R.jsx)(`span`,{className:`sb-bar`,children:(0,R.jsx)(`span`,{style:{width:`${Math.min(100,n)}%`,background:r}})})]})}var V3=document.getElementById(`root`);if(!V3)throw Error(`Root element #root not found`);(0,y.createRoot)(V3).render((0,R.jsx)(v.StrictMode,{children:(0,R.jsx)(z3,{})}));
|
|
4227
|
+
`}),[u]);return v.createElement(`group`,ML({},w,{ref:F}),d&&!B&&v.createElement(`mesh`,{castShadow:p,receiveShadow:m,ref:z},g||v.createElement(`planeGeometry`,null),h||v.createElement(`shaderMaterial`,{side:2,vertexShader:oe.vertexShader,fragmentShader:oe.fragmentShader})))}),l4=Object.defineProperty,u4=(e,t,n)=>t in e?l4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d4=(e,t,n)=>(u4(e,typeof t==`symbol`?t:t+``,n),n),f4=class{constructor(){d4(this,`_listeners`)}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let n=this._listeners[e];if(n!==void 0){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let t=this._listeners[e.type];if(t!==void 0){e.target=this;let n=t.slice(0);for(let t=0,r=n.length;t<r;t++)n[t].call(this,e);e.target=null}}},p4=Object.defineProperty,m4=(e,t,n)=>t in e?p4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,h4=(e,t,n)=>(m4(e,typeof t==`symbol`?t:t+``,n),n),g4=new gV(0,0,0,`YXZ`),_4=new X,v4={type:`change`},y4={type:`lock`},b4={type:`unlock`},x4=.002,S4=Math.PI/2,C4=class extends f4{constructor(e,t){super(),h4(this,`camera`),h4(this,`domElement`),h4(this,`isLocked`),h4(this,`minPolarAngle`),h4(this,`maxPolarAngle`),h4(this,`pointerSpeed`),h4(this,`onMouseMove`,e=>{!this.domElement||this.isLocked===!1||(g4.setFromQuaternion(this.camera.quaternion),g4.y-=e.movementX*x4*this.pointerSpeed,g4.x-=e.movementY*x4*this.pointerSpeed,g4.x=Math.max(S4-this.maxPolarAngle,Math.min(S4-this.minPolarAngle,g4.x)),this.camera.quaternion.setFromEuler(g4),this.dispatchEvent(v4))}),h4(this,`onPointerlockChange`,()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(y4),this.isLocked=!0):(this.dispatchEvent(b4),this.isLocked=!1))}),h4(this,`onPointerlockError`,()=>{console.error(`THREE.PointerLockControls: Unable to use Pointer Lock API`)}),h4(this,`connect`,e=>{this.domElement=e||this.domElement,this.domElement&&(this.domElement.ownerDocument.addEventListener(`mousemove`,this.onMouseMove),this.domElement.ownerDocument.addEventListener(`pointerlockchange`,this.onPointerlockChange),this.domElement.ownerDocument.addEventListener(`pointerlockerror`,this.onPointerlockError))}),h4(this,`disconnect`,()=>{this.domElement&&(this.domElement.ownerDocument.removeEventListener(`mousemove`,this.onMouseMove),this.domElement.ownerDocument.removeEventListener(`pointerlockchange`,this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener(`pointerlockerror`,this.onPointerlockError))}),h4(this,`dispose`,()=>{this.disconnect()}),h4(this,`getObject`,()=>this.camera),h4(this,`direction`,new X(0,0,-1)),h4(this,`getDirection`,e=>e.copy(this.direction).applyQuaternion(this.camera.quaternion)),h4(this,`moveForward`,e=>{_4.setFromMatrixColumn(this.camera.matrix,0),_4.crossVectors(this.camera.up,_4),this.camera.position.addScaledVector(_4,e)}),h4(this,`moveRight`,e=>{_4.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(_4,e)}),h4(this,`lock`,()=>{this.domElement&&this.domElement.requestPointerLock()}),h4(this,`unlock`,()=>{this.domElement&&this.domElement.ownerDocument.exitPointerLock()}),this.camera=e,this.domElement=t,this.isLocked=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.pointerSpeed=1,t&&this.connect(t)}},w4=Object.defineProperty,T4=(e,t,n)=>t in e?w4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E4=(e,t,n)=>(T4(e,typeof t==`symbol`?t:t+``,n),n),D4=new EU,O4=new hW,k4=Math.cos(Math.PI/180*70),A4=(e,t)=>(e%t+t)%t,j4=class extends f4{constructor(e,t){super(),E4(this,`object`),E4(this,`domElement`),E4(this,`enabled`,!0),E4(this,`target`,new X),E4(this,`minDistance`,0),E4(this,`maxDistance`,1/0),E4(this,`minZoom`,0),E4(this,`maxZoom`,1/0),E4(this,`minPolarAngle`,0),E4(this,`maxPolarAngle`,Math.PI),E4(this,`minAzimuthAngle`,-1/0),E4(this,`maxAzimuthAngle`,1/0),E4(this,`enableDamping`,!1),E4(this,`dampingFactor`,.05),E4(this,`enableZoom`,!0),E4(this,`zoomSpeed`,1),E4(this,`enableRotate`,!0),E4(this,`rotateSpeed`,1),E4(this,`enablePan`,!0),E4(this,`panSpeed`,1),E4(this,`screenSpacePanning`,!0),E4(this,`keyPanSpeed`,7),E4(this,`zoomToCursor`,!1),E4(this,`autoRotate`,!1),E4(this,`autoRotateSpeed`,2),E4(this,`reverseOrbit`,!1),E4(this,`reverseHorizontalOrbit`,!1),E4(this,`reverseVerticalOrbit`,!1),E4(this,`keys`,{LEFT:`ArrowLeft`,UP:`ArrowUp`,RIGHT:`ArrowRight`,BOTTOM:`ArrowDown`}),E4(this,`mouseButtons`,{LEFT:NL.ROTATE,MIDDLE:NL.DOLLY,RIGHT:NL.PAN}),E4(this,`touches`,{ONE:PL.ROTATE,TWO:PL.DOLLY_PAN}),E4(this,`target0`),E4(this,`position0`),E4(this,`zoom0`),E4(this,`_domElementKeyEvents`,null),E4(this,`getPolarAngle`),E4(this,`getAzimuthalAngle`),E4(this,`setPolarAngle`),E4(this,`setAzimuthalAngle`),E4(this,`getDistance`),E4(this,`getZoomScale`),E4(this,`listenToKeyEvents`),E4(this,`stopListenToKeyEvents`),E4(this,`saveState`),E4(this,`reset`),E4(this,`update`),E4(this,`connect`),E4(this,`dispose`),E4(this,`dollyIn`),E4(this,`dollyOut`),E4(this,`getScale`),E4(this,`setScale`),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>l.phi,this.getAzimuthalAngle=()=>l.theta,this.setPolarAngle=e=>{let t=A4(e,2*Math.PI),r=l.phi;r<0&&(r+=2*Math.PI),t<0&&(t+=2*Math.PI);let i=Math.abs(t-r);2*Math.PI-i<i&&(t<r?t+=2*Math.PI:r+=2*Math.PI),u.phi=t-r,n.update()},this.setAzimuthalAngle=e=>{let t=A4(e,2*Math.PI),r=l.theta;r<0&&(r+=2*Math.PI),t<0&&(t+=2*Math.PI);let i=Math.abs(t-r);2*Math.PI-i<i&&(t<r?t+=2*Math.PI:r+=2*Math.PI),u.theta=t-r,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=e=>{e.addEventListener(`keydown`,be),this._domElementKeyEvents=e},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener(`keydown`,be),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(r),n.update(),s=o.NONE},this.update=(()=>{let t=new X,i=new X(0,1,0),a=new PB().setFromUnitVectors(e.up,i),p=a.clone().invert(),m=new X,h=new PB,g=2*Math.PI;return function(){let _=n.object.position;a.setFromUnitVectors(e.up,i),p.copy(a).invert(),t.copy(_).sub(n.target),t.applyQuaternion(a),l.setFromVector3(t),n.autoRotate&&s===o.NONE&&k(D()),n.enableDamping?(l.theta+=u.theta*n.dampingFactor,l.phi+=u.phi*n.dampingFactor):(l.theta+=u.theta,l.phi+=u.phi);let v=n.minAzimuthAngle,y=n.maxAzimuthAngle;isFinite(v)&&isFinite(y)&&(v<-Math.PI?v+=g:v>Math.PI&&(v-=g),y<-Math.PI?y+=g:y>Math.PI&&(y-=g),v<=y?l.theta=Math.max(v,Math.min(y,l.theta)):l.theta=l.theta>(v+y)/2?Math.max(v,l.theta):Math.min(y,l.theta)),l.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,l.phi)),l.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(f,n.dampingFactor):n.target.add(f),n.zoomToCursor&&w||n.object.isOrthographicCamera?l.radius=R(l.radius):l.radius=R(l.radius*d),t.setFromSpherical(l),t.applyQuaternion(p),_.copy(n.target).add(t),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,f.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),f.set(0,0,0));let b=!1;if(n.zoomToCursor&&w){let r=null;if(n.object instanceof kJ&&n.object.isPerspectiveCamera){let e=t.length();r=R(e*d);let i=e-r;n.object.position.addScaledVector(S,i),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let e=new X(C.x,C.y,0);e.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/d)),n.object.updateProjectionMatrix(),b=!0;let i=new X(C.x,C.y,0);i.unproject(n.object),n.object.position.sub(i).add(e),n.object.updateMatrixWorld(),r=t.length()}else console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.`),n.zoomToCursor=!1;r!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(r).add(n.object.position):(D4.origin.copy(n.object.position),D4.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(D4.direction))<k4?e.lookAt(n.target):(O4.setFromNormalAndCoplanarPoint(n.object.up,n.target),D4.intersectPlane(O4,n.target))))}else n.object instanceof PJ&&n.object.isOrthographicCamera&&(b=d!==1,b&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/d)),n.object.updateProjectionMatrix()));return d=1,w=!1,b||m.distanceToSquared(n.object.position)>c||8*(1-h.dot(n.object.quaternion))>c?(n.dispatchEvent(r),m.copy(n.object.position),h.copy(n.object.quaternion),b=!1,!0):!1}})(),this.connect=e=>{n.domElement=e,n.domElement.style.touchAction=`none`,n.domElement.addEventListener(`contextmenu`,Ce),n.domElement.addEventListener(`pointerdown`,he),n.domElement.addEventListener(`pointercancel`,H),n.domElement.addEventListener(`wheel`,ye)},this.dispose=()=>{var e,t,r,i,a,o;n.domElement&&(n.domElement.style.touchAction=`auto`),(e=n.domElement)==null||e.removeEventListener(`contextmenu`,Ce),(t=n.domElement)==null||t.removeEventListener(`pointerdown`,he),(r=n.domElement)==null||r.removeEventListener(`pointercancel`,H),(i=n.domElement)==null||i.removeEventListener(`wheel`,ye),(a=n.domElement)==null||a.ownerDocument.removeEventListener(`pointermove`,ge),(o=n.domElement)==null||o.ownerDocument.removeEventListener(`pointerup`,H),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener(`keydown`,be)};let n=this,r={type:`change`},i={type:`start`},a={type:`end`},o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},s=o.NONE,c=1e-6,l=new QY,u=new QY,d=1,f=new X,p=new Y,m=new Y,h=new Y,g=new Y,_=new Y,v=new Y,y=new Y,b=new Y,x=new Y,S=new X,C=new Y,w=!1,T=[],E={};function D(){return 2*Math.PI/60/60*n.autoRotateSpeed}function O(){return .95**n.zoomSpeed}function k(e){n.reverseOrbit||n.reverseHorizontalOrbit?u.theta+=e:u.theta-=e}function A(e){n.reverseOrbit||n.reverseVerticalOrbit?u.phi+=e:u.phi-=e}let j=(()=>{let e=new X;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),f.add(e)}})(),M=(()=>{let e=new X;return function(t,r){n.screenSpacePanning===!0?e.setFromMatrixColumn(r,1):(e.setFromMatrixColumn(r,0),e.crossVectors(n.object.up,e)),e.multiplyScalar(t),f.add(e)}})(),N=(()=>{let e=new X;return function(t,r){let i=n.domElement;if(i&&n.object instanceof kJ&&n.object.isPerspectiveCamera){let a=n.object.position;e.copy(a).sub(n.target);let o=e.length();o*=Math.tan(n.object.fov/2*Math.PI/180),j(2*t*o/i.clientHeight,n.object.matrix),M(2*r*o/i.clientHeight,n.object.matrix)}else i&&n.object instanceof PJ&&n.object.isOrthographicCamera?(j(t*(n.object.right-n.object.left)/n.object.zoom/i.clientWidth,n.object.matrix),M(r*(n.object.top-n.object.bottom)/n.object.zoom/i.clientHeight,n.object.matrix)):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.`),n.enablePan=!1)}})();function P(e){n.object instanceof kJ&&n.object.isPerspectiveCamera||n.object instanceof PJ&&n.object.isOrthographicCamera?d=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),n.enableZoom=!1)}function F(e){P(d/e)}function I(e){P(d*e)}function L(e){if(!n.zoomToCursor||!n.domElement)return;w=!0;let t=n.domElement.getBoundingClientRect(),r=e.clientX-t.left,i=e.clientY-t.top,a=t.width,o=t.height;C.x=r/a*2-1,C.y=-(i/o)*2+1,S.set(C.x,C.y,1).unproject(n.object).sub(n.object.position).normalize()}function R(e){return Math.max(n.minDistance,Math.min(n.maxDistance,e))}function ee(e){p.set(e.clientX,e.clientY)}function te(e){L(e),y.set(e.clientX,e.clientY)}function z(e){g.set(e.clientX,e.clientY)}function ne(e){m.set(e.clientX,e.clientY),h.subVectors(m,p).multiplyScalar(n.rotateSpeed);let t=n.domElement;t&&(k(2*Math.PI*h.x/t.clientHeight),A(2*Math.PI*h.y/t.clientHeight)),p.copy(m),n.update()}function B(e){b.set(e.clientX,e.clientY),x.subVectors(b,y),x.y>0?F(O()):x.y<0&&I(O()),y.copy(b),n.update()}function re(e){_.set(e.clientX,e.clientY),v.subVectors(_,g).multiplyScalar(n.panSpeed),N(v.x,v.y),g.copy(_),n.update()}function ie(e){L(e),e.deltaY<0?I(O()):e.deltaY>0&&F(O()),n.update()}function ae(e){let t=!1;switch(e.code){case n.keys.UP:N(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:N(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:N(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:N(-n.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),n.update())}function oe(){if(T.length==1)p.set(T[0].pageX,T[0].pageY);else{let e=.5*(T[0].pageX+T[1].pageX),t=.5*(T[0].pageY+T[1].pageY);p.set(e,t)}}function se(){if(T.length==1)g.set(T[0].pageX,T[0].pageY);else{let e=.5*(T[0].pageX+T[1].pageX),t=.5*(T[0].pageY+T[1].pageY);g.set(e,t)}}function ce(){let e=T[0].pageX-T[1].pageX,t=T[0].pageY-T[1].pageY,n=Math.sqrt(e*e+t*t);y.set(0,n)}function le(){n.enableZoom&&ce(),n.enablePan&&se()}function ue(){n.enableZoom&&ce(),n.enableRotate&&oe()}function de(e){if(T.length==1)m.set(e.pageX,e.pageY);else{let t=De(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);m.set(n,r)}h.subVectors(m,p).multiplyScalar(n.rotateSpeed);let t=n.domElement;t&&(k(2*Math.PI*h.x/t.clientHeight),A(2*Math.PI*h.y/t.clientHeight)),p.copy(m)}function fe(e){if(T.length==1)_.set(e.pageX,e.pageY);else{let t=De(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);_.set(n,r)}v.subVectors(_,g).multiplyScalar(n.panSpeed),N(v.x,v.y),g.copy(_)}function pe(e){let t=De(e),r=e.pageX-t.x,i=e.pageY-t.y,a=Math.sqrt(r*r+i*i);b.set(0,a),x.set(0,(b.y/y.y)**+n.zoomSpeed),F(x.y),y.copy(b)}function V(e){n.enableZoom&&pe(e),n.enablePan&&fe(e)}function me(e){n.enableZoom&&pe(e),n.enableRotate&&de(e)}function he(e){var t,r;n.enabled!==!1&&(T.length===0&&((t=n.domElement)==null||t.ownerDocument.addEventListener(`pointermove`,ge),(r=n.domElement)==null||r.ownerDocument.addEventListener(`pointerup`,H)),we(e),e.pointerType===`touch`?xe(e):_e(e))}function ge(e){n.enabled!==!1&&(e.pointerType===`touch`?Se(e):ve(e))}function H(e){var t,r,i;Te(e),T.length===0&&((t=n.domElement)==null||t.releasePointerCapture(e.pointerId),(r=n.domElement)==null||r.ownerDocument.removeEventListener(`pointermove`,ge),(i=n.domElement)==null||i.ownerDocument.removeEventListener(`pointerup`,H)),n.dispatchEvent(a),s=o.NONE}function _e(e){let t;switch(e.button){case 0:t=n.mouseButtons.LEFT;break;case 1:t=n.mouseButtons.MIDDLE;break;case 2:t=n.mouseButtons.RIGHT;break;default:t=-1}switch(t){case NL.DOLLY:if(n.enableZoom===!1)return;te(e),s=o.DOLLY;break;case NL.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(n.enablePan===!1)return;z(e),s=o.PAN}else{if(n.enableRotate===!1)return;ee(e),s=o.ROTATE}break;case NL.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(n.enableRotate===!1)return;ee(e),s=o.ROTATE}else{if(n.enablePan===!1)return;z(e),s=o.PAN}break;default:s=o.NONE}s!==o.NONE&&n.dispatchEvent(i)}function ve(e){if(n.enabled!==!1)switch(s){case o.ROTATE:if(n.enableRotate===!1)return;ne(e);break;case o.DOLLY:if(n.enableZoom===!1)return;B(e);break;case o.PAN:if(n.enablePan===!1)return;re(e);break}}function ye(e){n.enabled===!1||n.enableZoom===!1||s!==o.NONE&&s!==o.ROTATE||(e.preventDefault(),n.dispatchEvent(i),ie(e),n.dispatchEvent(a))}function be(e){n.enabled===!1||n.enablePan===!1||ae(e)}function xe(e){switch(Ee(e),T.length){case 1:switch(n.touches.ONE){case PL.ROTATE:if(n.enableRotate===!1)return;oe(),s=o.TOUCH_ROTATE;break;case PL.PAN:if(n.enablePan===!1)return;se(),s=o.TOUCH_PAN;break;default:s=o.NONE}break;case 2:switch(n.touches.TWO){case PL.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;le(),s=o.TOUCH_DOLLY_PAN;break;case PL.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;ue(),s=o.TOUCH_DOLLY_ROTATE;break;default:s=o.NONE}break;default:s=o.NONE}s!==o.NONE&&n.dispatchEvent(i)}function Se(e){switch(Ee(e),s){case o.TOUCH_ROTATE:if(n.enableRotate===!1)return;de(e),n.update();break;case o.TOUCH_PAN:if(n.enablePan===!1)return;fe(e),n.update();break;case o.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;V(e),n.update();break;case o.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;me(e),n.update();break;default:s=o.NONE}}function Ce(e){n.enabled!==!1&&e.preventDefault()}function we(e){T.push(e)}function Te(e){delete E[e.pointerId];for(let t=0;t<T.length;t++)if(T[t].pointerId==e.pointerId){T.splice(t,1);return}}function Ee(e){let t=E[e.pointerId];t===void 0&&(t=new Y,E[e.pointerId]=t),t.set(e.pageX,e.pageY)}function De(e){return E[(e.pointerId===T[0].pointerId?T[1]:T[0]).pointerId]}this.dollyIn=(e=O())=>{I(e),n.update()},this.dollyOut=(e=O())=>{F(e),n.update()},this.getScale=()=>d,this.setScale=e=>{P(e),n.update()},this.getZoomScale=()=>O(),t!==void 0&&this.connect(t),this.update()}},M4=v.forwardRef(({makeDefault:e,camera:t,regress:n,domElement:r,enableDamping:i=!0,keyEvents:a=!1,onChange:o,onStart:s,onEnd:c,...l},u)=>{let d=w0(e=>e.invalidate),f=w0(e=>e.camera),p=w0(e=>e.gl),m=w0(e=>e.events),h=w0(e=>e.setEvents),g=w0(e=>e.set),_=w0(e=>e.get),y=w0(e=>e.performance),b=t||f,x=r||m.connected||p.domElement,S=v.useMemo(()=>new j4(b),[b]);return T0(()=>{S.enabled&&S.update()},-1),v.useEffect(()=>(a&&S.connect(a===!0?x:a),S.connect(x),()=>void S.dispose()),[a,x,n,S,d]),v.useEffect(()=>{let e=e=>{d(),n&&y.regress(),o&&o(e)},t=e=>{s&&s(e)},r=e=>{c&&c(e)};return S.addEventListener(`change`,e),S.addEventListener(`start`,t),S.addEventListener(`end`,r),()=>{S.removeEventListener(`start`,t),S.removeEventListener(`end`,r),S.removeEventListener(`change`,e)}},[o,s,c,S,d,h]),v.useEffect(()=>{if(e){let e=_().controls;return g({controls:S}),()=>g({controls:e})}},[e,S]),v.createElement(`primitive`,ML({ref:u,object:S,enableDamping:i},l))}),N4=v.forwardRef(({domElement:e,selector:t,onChange:n,onLock:r,onUnlock:i,enabled:a=!0,makeDefault:o,...s},c)=>{let{camera:l,...u}=s,d=w0(e=>e.setEvents),f=w0(e=>e.gl),p=w0(e=>e.camera),m=w0(e=>e.invalidate),h=w0(e=>e.events),g=w0(e=>e.get),_=w0(e=>e.set),y=l||p,b=e||h.connected||f.domElement,x=v.useMemo(()=>new C4(y),[y]);return v.useEffect(()=>{if(a){x.connect(b);let e=g().events.compute;return d({compute(e,t){let n=t.size.width/2,r=t.size.height/2;t.pointer.set(n/t.size.width*2-1,-(r/t.size.height)*2+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),()=>{x.disconnect(),d({compute:e})}}},[a,x]),v.useEffect(()=>{let e=e=>{m(),n&&n(e)};x.addEventListener(`change`,e),r&&x.addEventListener(`lock`,r),i&&x.addEventListener(`unlock`,i);let a=()=>x.lock(),o=t?Array.from(document.querySelectorAll(t)):[document];return o.forEach(e=>e&&e.addEventListener(`click`,a)),()=>{x.removeEventListener(`change`,e),r&&x.removeEventListener(`lock`,r),i&&x.removeEventListener(`unlock`,i),o.forEach(e=>e?e.removeEventListener(`click`,a):void 0)}},[n,r,i,t,x,m]),v.useEffect(()=>{if(o){let e=g().controls;return _({controls:x}),()=>_({controls:e})}},[o,x]),v.createElement(`primitive`,ML({ref:c,object:x},u))}),P4=NB.damp;function F4(e,t,n,r){return e+Math.atan2(Math.sin(t-e),Math.cos(t-e))*(1-Math.exp(-n*r))}var I4={working:{color:`#41d15f`,label:`Working`},booting:{color:`#3b82f6`,label:`Thinking`},idle:{color:`#9aa0a8`,label:`Idle`},completed:{color:`#5eead4`,label:`Done`},stopped:{color:`#9aa0a8`,label:`Idle`},failed:{color:`#f5402d`,label:`Error`}};function L4(e){return I4[e]??{color:`#9aa0a8`,label:`Idle`}}var R4=[{color:`#41d15f`,label:`Working`},{color:`#3b82f6`,label:`Thinking`},{color:`#9aa0a8`,label:`Idle`},{color:`#5eead4`,label:`Done`},{color:`#f5402d`,label:`Error`}],z4=[20,0],B4=30,V4=`#a9612f`,H4=`#7c4420`,U4=`#b9763c`,W4=`#a9692f`,G4=`#1b2030`,K4=`#bcd2e6`,q4=`#e8b690`,J4=`#2c3550`,Y4=`#27314d`,X4=`#7a3b3b`,Z4={coordinator:{color:`#f5b301`,hat:`headset`,prop:`clipboard`,label:`Coordinator`},lead:{color:`#4f86f7`,hat:`hardhat`,prop:`clipboard`,label:`Lead`},builder:{color:`#f59e0b`,hat:`hardhat`,prop:`pickaxe`,label:`Builder`},scout:{color:`#34d399`,hat:`explorer`,prop:`map`,label:`Scout`},reviewer:{color:`#a78bfa`,hat:`glasses`,prop:`magnifier`,label:`Reviewer`},merger:{color:`#22d3ee`,hat:`cap`,prop:`wrench`,label:`Merger`},architect:{color:`#f778ba`,hat:`none`,prop:`blueprint`,label:`Architect`},devops:{color:`#fb7185`,hat:`beanie`,prop:`wrench`,label:`DevOps`},deployer:{color:`#ff8a3d`,hat:`cap`,prop:`rocket`,label:`Deployer`},verifier:{color:`#60a5fa`,hat:`headlamp`,prop:`checkmark`,label:`Verifier`}};function Q4(e){return Z4[e]??{color:`#9aa0a8`,hat:`none`,prop:`none`,label:e}}function $4(e){return e===`working`||e===`booting`?`working`:e===`idle`?`idle`:`away`}var e3=6e4;function t3(e,t){switch(e.state){case`working`:case`booting`:case`idle`:case`failed`:return!0;case`completed`:return t-Date.parse(e.lastActivity)<e3;case`stopped`:return!1;default:return!0}}function n3(e){switch(e){case`dispatch`:case`assign`:return`Assigning`;case`worker_done`:return`Handing off`;case`merge_ready`:return`Ready to merge`;case`merged`:return`Merged`;case`escalation`:return`Escalating`;case`merge_failed`:return`Merge conflict`;case`deploy_gate`:return`Deploy gate`;default:return e.replace(/_/g,` `)}}function r3({kind:e,color:t,dim:n,op:r}){let i=`#2a2e36`,a=e=>(0,R.jsx)(`meshStandardMaterial`,{color:e,transparent:n,opacity:r});switch(e){case`hardhat`:return(0,R.jsxs)(`group`,{children:[(0,R.jsxs)(`mesh`,{position:[0,.3,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.5,.2,.5]}),a(t)]}),(0,R.jsxs)(`mesh`,{position:[0,.22,.04],children:[(0,R.jsx)(`boxGeometry`,{args:[.58,.05,.62]}),a(t)]})]});case`cap`:return(0,R.jsxs)(`group`,{children:[(0,R.jsxs)(`mesh`,{position:[0,.3,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.48,.18,.48]}),a(t)]}),(0,R.jsxs)(`mesh`,{position:[0,.25,.28],children:[(0,R.jsx)(`boxGeometry`,{args:[.34,.05,.24]}),a(t)]})]});case`explorer`:return(0,R.jsxs)(`group`,{children:[(0,R.jsxs)(`mesh`,{position:[0,.24,0],rotation:[Math.PI/2,0,0],children:[(0,R.jsx)(`cylinderGeometry`,{args:[.46,.46,.04,20]}),a(`#7c5a36`)]}),(0,R.jsxs)(`mesh`,{position:[0,.34,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.38,.22,.38]}),a(`#8a6a40`)]})]});case`glasses`:return(0,R.jsxs)(`group`,{position:[0,.04,.235],children:[(0,R.jsxs)(`mesh`,{children:[(0,R.jsx)(`boxGeometry`,{args:[.46,.04,.03]}),a(i)]}),(0,R.jsxs)(`mesh`,{position:[-.11,0,.01],children:[(0,R.jsx)(`boxGeometry`,{args:[.15,.13,.02]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#bfeaff`,transparent:!0,opacity:.55*r})]}),(0,R.jsxs)(`mesh`,{position:[.11,0,.01],children:[(0,R.jsx)(`boxGeometry`,{args:[.15,.13,.02]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#bfeaff`,transparent:!0,opacity:.55*r})]})]});case`headset`:return(0,R.jsxs)(`group`,{children:[(0,R.jsxs)(`mesh`,{position:[0,.3,0],children:[(0,R.jsx)(`boxGeometry`,{args:[.52,.08,.14]}),a(i)]}),(0,R.jsxs)(`mesh`,{position:[-.27,.12,0],children:[(0,R.jsx)(`boxGeometry`,{args:[.08,.18,.18]}),a(t)]}),(0,R.jsxs)(`mesh`,{position:[.27,.12,0],children:[(0,R.jsx)(`boxGeometry`,{args:[.08,.18,.18]}),a(t)]}),(0,R.jsxs)(`mesh`,{position:[.2,0,.2],rotation:[0,0,.5],children:[(0,R.jsx)(`boxGeometry`,{args:[.04,.04,.22]}),a(i)]})]});case`beanie`:return(0,R.jsxs)(`group`,{children:[(0,R.jsxs)(`mesh`,{position:[0,.29,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.5,.26,.5]}),a(t)]}),(0,R.jsxs)(`mesh`,{position:[0,.18,0],children:[(0,R.jsx)(`boxGeometry`,{args:[.54,.09,.54]}),a(`#e8e6df`)]})]});case`headlamp`:return(0,R.jsxs)(`group`,{children:[(0,R.jsxs)(`mesh`,{position:[0,.3,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.48,.16,.48]}),a(t)]}),(0,R.jsxs)(`mesh`,{position:[0,.18,.26],children:[(0,R.jsx)(`boxGeometry`,{args:[.12,.1,.06]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#fff7d6`,emissive:`#fff7d6`,emissiveIntensity:n?.2:.9,transparent:n,opacity:r})]})]});default:return null}}function i3({kind:e,dim:t,op:n}){let r=e=>(0,R.jsx)(`meshStandardMaterial`,{color:e,transparent:t,opacity:n});return(0,R.jsx)(`group`,{position:[0,-.36,.08],children:(()=>{switch(e){case`pickaxe`:return(0,R.jsxs)(`group`,{children:[(0,R.jsxs)(`mesh`,{position:[0,-.08,0],children:[(0,R.jsx)(`boxGeometry`,{args:[.04,.5,.04]}),r(`#7c4a24`)]}),(0,R.jsxs)(`mesh`,{position:[0,.16,0],rotation:[0,0,Math.PI/2],children:[(0,R.jsx)(`boxGeometry`,{args:[.05,.34,.06]}),r(`#9aa0a8`)]})]});case`map`:return(0,R.jsxs)(`mesh`,{rotation:[.4,0,0],children:[(0,R.jsx)(`boxGeometry`,{args:[.28,.32,.02]}),r(`#e8dcc0`)]});case`magnifier`:return(0,R.jsxs)(`group`,{children:[(0,R.jsxs)(`mesh`,{position:[0,-.12,0],children:[(0,R.jsx)(`boxGeometry`,{args:[.04,.22,.04]}),r(`#3a2e22`)]}),(0,R.jsxs)(`mesh`,{position:[0,.04,0],rotation:[Math.PI/2,0,0],children:[(0,R.jsx)(`torusGeometry`,{args:[.1,.025,8,18]}),r(`#cbd5e1`)]})]});case`wrench`:return(0,R.jsxs)(`group`,{rotation:[0,0,.3],children:[(0,R.jsxs)(`mesh`,{children:[(0,R.jsx)(`boxGeometry`,{args:[.06,.34,.05]}),r(`#cbd5e1`)]}),(0,R.jsxs)(`mesh`,{position:[0,.2,0],children:[(0,R.jsx)(`boxGeometry`,{args:[.16,.1,.06]}),r(`#aab2bd`)]})]});case`blueprint`:return(0,R.jsxs)(`mesh`,{rotation:[0,0,Math.PI/2],children:[(0,R.jsx)(`cylinderGeometry`,{args:[.05,.05,.34,12]}),r(`#2f6fb0`)]});case`rocket`:return(0,R.jsxs)(`group`,{rotation:[.2,0,0],children:[(0,R.jsxs)(`mesh`,{position:[0,.02,0],children:[(0,R.jsx)(`cylinderGeometry`,{args:[.08,.08,.26,14]}),r(`#eef2f7`)]}),(0,R.jsxs)(`mesh`,{position:[0,.2,0],children:[(0,R.jsx)(`coneGeometry`,{args:[.08,.12,14]}),r(`#f5402d`)]}),(0,R.jsxs)(`mesh`,{position:[0,-.14,0],children:[(0,R.jsx)(`boxGeometry`,{args:[.06,.08,.06]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#ff8a3d`,emissive:`#ff8a3d`,emissiveIntensity:t?.2:.9,transparent:t,opacity:n})]})]});case`clipboard`:return(0,R.jsxs)(`group`,{rotation:[.5,0,0],children:[(0,R.jsxs)(`mesh`,{children:[(0,R.jsx)(`boxGeometry`,{args:[.24,.32,.02]}),r(`#3a4250`)]}),(0,R.jsxs)(`mesh`,{position:[0,-.01,.015],children:[(0,R.jsx)(`boxGeometry`,{args:[.2,.26,.01]}),r(`#f4f4f0`)]}),(0,R.jsxs)(`mesh`,{position:[0,.16,.02],children:[(0,R.jsx)(`boxGeometry`,{args:[.1,.04,.02]}),r(`#aab2bd`)]})]});case`ruler`:return(0,R.jsxs)(`mesh`,{children:[(0,R.jsx)(`boxGeometry`,{args:[.04,.42,.02]}),r(`#fbbf24`)]});case`checkmark`:return(0,R.jsxs)(`group`,{children:[(0,R.jsxs)(`mesh`,{position:[-.04,-.04,0],rotation:[0,0,Math.PI/4],children:[(0,R.jsx)(`boxGeometry`,{args:[.05,.16,.04]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#41d15f`,emissive:`#41d15f`,emissiveIntensity:t?.1:.6,transparent:t,opacity:n})]}),(0,R.jsxs)(`mesh`,{position:[.08,.04,0],rotation:[0,0,-Math.PI/4],children:[(0,R.jsx)(`boxGeometry`,{args:[.05,.3,.04]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#41d15f`,emissive:`#41d15f`,emissiveIntensity:t?.1:.6,transparent:t,opacity:n})]})]});default:return null}})()})}var a3=.78,o3=.56,s3=.4,c3=.36;function l3({agent:e,deskPos:t,behavior:n,meeting:r,station:i,onSelect:a}){let o=Q4(e.capability),s=o.color,c=te(e.agentName),l=n===`away`,u=e.capability===`coordinator`,[d,f]=(0,v.useState)(!1),p=(0,v.useRef)(null),m=(0,v.useRef)(null),h=(0,v.useRef)(null),g=(0,v.useRef)(null),_=(0,v.useRef)(null),y=(0,v.useRef)(null),b=(0,v.useRef)(null),x=(0,v.useRef)(null),S=(0,v.useRef)(null),C=(0,v.useRef)(null),w=(0,v.useRef)(null),[T,,E]=t,D=[T,0,E+.62],O=[T+.85,0,E+1.05],k=n===`meeting`?!1:i?i.sit:n===`working`,A=n===`meeting`&&r?{tx:r.pos[0],tz:r.pos[2],faceX:r.faceX,faceZ:r.faceZ}:i?{tx:i.pos[0],tz:i.pos[2],faceX:i.faceX,faceZ:i.faceZ}:n===`working`?{tx:D[0],tz:D[2],faceX:T,faceZ:E-1}:{tx:O[0],tz:O[2],faceX:T,faceZ:E},j=i?i.pos:O,M=(0,v.useRef)({...A,behavior:n,sit:k,speaker:r?.speaker??!1});M.current={...A,behavior:n,sit:k,speaker:r?.speaker??!1};let N=(0,v.useRef)(!1);(0,v.useEffect)(()=>{p.current&&!N.current&&(p.current.position.set(j[0],0,j[2]),N.current=!0)},[j]),T0((t,n)=>{let r=p.current,i=m.current;if(!r||!i)return;let a=Math.min(n,.05),o=M.current,s=t.clock.elapsedTime+e.agentName.length,c=r.position.x,l=r.position.z,u=Math.hypot(o.tx-c,o.tz-l)>.12;r.position.x=P4(c,o.tx,2.4,a),r.position.z=P4(l,o.tz,2.4,a);let d=u?Math.atan2(o.tx-c,o.tz-l):Math.atan2(o.faceX-c,o.faceZ-l);r.rotation.y=F4(r.rotation.y,d,8,a);let f=o.sit&&!u;i.position.y=P4(i.position.y,f?o3:a3,7,a);let v=0,T=0,E=0,D=0,O=.06,k=.06,A=-.05,j=-.05,N=0,P=0,F=0,I=0;if(u){let e=s*7;v=.45*Math.sin(e),T=.45*Math.sin(e+Math.PI),E=.25*(1-Math.cos(e)),D=.25*(1-Math.cos(e+Math.PI)),O=.4*Math.sin(e+Math.PI),k=.4*Math.sin(e),I=Math.abs(Math.sin(e))*.04}else f?(v=-1.45,T=-1.45,E=1.4,D=1.4,O=-.7,k=-.7,A=-.9+.16*Math.sin(s*11),j=-.9+.16*Math.sin(s*11+1.6),N=.12):o.behavior===`meeting`&&o.speaker?(k=-.7+.5*Math.sin(s*3.4),j=-1,O=.08,A=-.15,N=.06*Math.sin(s*3.4)):o.behavior===`meeting`?N=.05+.05*Math.sin(s*1.6):(F=Math.sin(s*1.2)*.03,P=Math.sin(s*.5)*.3);r.position.y=P4(r.position.y,I,6,a),r.rotation.z=P4(r.rotation.z,F,4,a),h.current&&(h.current.rotation.x=P4(h.current.rotation.x,v,9,a)),g.current&&(g.current.rotation.x=P4(g.current.rotation.x,T,9,a)),_.current&&(_.current.rotation.x=P4(_.current.rotation.x,E,9,a)),y.current&&(y.current.rotation.x=P4(y.current.rotation.x,D,9,a)),b.current&&(b.current.rotation.x=P4(b.current.rotation.x,O,10,a)),x.current&&(x.current.rotation.x=P4(x.current.rotation.x,k,10,a)),S.current&&(S.current.rotation.x=P4(S.current.rotation.x,A,10,a)),C.current&&(C.current.rotation.x=P4(C.current.rotation.x,j,10,a)),w.current&&(w.current.rotation.x=P4(w.current.rotation.x,N,8,a),w.current.rotation.y=P4(w.current.rotation.y,P,6,a))});let P=l?.5:1,F=(0,R.jsx)(`meshStandardMaterial`,{color:q4,transparent:l,opacity:P}),I=(0,R.jsx)(`meshStandardMaterial`,{color:s,transparent:l,opacity:P}),L=(0,R.jsx)(`meshStandardMaterial`,{color:J4,transparent:l,opacity:P});return(0,R.jsxs)(`group`,{ref:p,scale:u?1.14:1,onClick:t=>{t.stopPropagation(),a(e.agentName)},onPointerOver:e=>{e.stopPropagation(),f(!0),document.body.style.cursor=`pointer`},onPointerOut:()=>{f(!1),document.body.style.cursor=`auto`},children:[(0,R.jsxs)(`group`,{ref:m,position:[0,a3,0],children:[(0,R.jsxs)(`mesh`,{position:[0,0,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.5,.26,.3]}),L]}),(0,R.jsxs)(`group`,{ref:h,position:[-.13,0,0],children:[(0,R.jsxs)(`mesh`,{position:[0,-.4/2,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.22,s3,.28]}),L]}),(0,R.jsxs)(`group`,{ref:_,position:[0,-.4,0],children:[(0,R.jsxs)(`mesh`,{position:[0,-.36/2,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.2,c3,.26]}),L]}),(0,R.jsxs)(`mesh`,{position:[0,-.33999999999999997,.07],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.22,.1,.34]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#15171c`,transparent:l,opacity:P})]})]})]}),(0,R.jsxs)(`group`,{ref:g,position:[.13,0,0],children:[(0,R.jsxs)(`mesh`,{position:[0,-.4/2,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.22,s3,.28]}),L]}),(0,R.jsxs)(`group`,{ref:y,position:[0,-.4,0],children:[(0,R.jsxs)(`mesh`,{position:[0,-.36/2,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.2,c3,.26]}),L]}),(0,R.jsxs)(`mesh`,{position:[0,-.33999999999999997,.07],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.22,.1,.34]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#15171c`,transparent:l,opacity:P})]})]})]}),(0,R.jsxs)(`mesh`,{position:[0,.36,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.55,.7,.3]}),(0,R.jsx)(`meshStandardMaterial`,{color:s,emissive:s,emissiveIntensity:d?.3:.05,transparent:l,opacity:P})]}),(0,R.jsxs)(`mesh`,{position:[0,.5,.16],children:[(0,R.jsx)(`boxGeometry`,{args:[.56,.12,.02]}),(0,R.jsx)(`meshStandardMaterial`,{color:c,transparent:l,opacity:P})]}),(0,R.jsxs)(`group`,{ref:b,position:[-.36,.6,0],children:[(0,R.jsxs)(`mesh`,{position:[0,-.17,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.15,.34,.22]}),I]}),(0,R.jsx)(`group`,{ref:S,position:[0,-.34,0],children:(0,R.jsxs)(`mesh`,{position:[0,-.16,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.13,.32,.2]}),F]})})]}),(0,R.jsxs)(`group`,{ref:x,position:[.36,.6,0],children:[(0,R.jsxs)(`mesh`,{position:[0,-.17,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.15,.34,.22]}),I]}),(0,R.jsxs)(`group`,{ref:C,position:[0,-.34,0],children:[(0,R.jsxs)(`mesh`,{position:[0,-.16,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.13,.32,.2]}),F]}),(0,R.jsx)(i3,{kind:o.prop,dim:l,op:P})]})]}),(0,R.jsxs)(`group`,{ref:w,position:[0,.84,0],children:[(0,R.jsxs)(`mesh`,{castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.45,.45,.45]}),F]}),(0,R.jsxs)(`mesh`,{position:[-.1,.04,.23],children:[(0,R.jsx)(`boxGeometry`,{args:[.07,.07,.02]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#222`})]}),(0,R.jsxs)(`mesh`,{position:[.1,.04,.23],children:[(0,R.jsx)(`boxGeometry`,{args:[.07,.07,.02]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#222`})]}),(0,R.jsx)(r3,{kind:o.hat,color:s,dim:l,op:P})]})]}),n===`meeting`&&r?.speech?(0,R.jsx)(c4,{position:[0,2.55,0],center:!0,distanceFactor:9,zIndexRange:z4,children:(0,R.jsx)(`div`,{style:{fontFamily:`ui-sans-serif, system-ui, sans-serif`,fontSize:12,fontWeight:600,color:`#1a1a18`,background:`#fdfbf5`,border:`2px solid ${c}`,borderRadius:10,padding:`5px 9px`,maxWidth:190,lineHeight:1.3,boxShadow:`0 4px 14px rgba(0,0,0,0.35)`,pointerEvents:`none`},children:r.speech})}):null,(0,R.jsx)(c4,{position:[0,2.1,0],center:!0,distanceFactor:10,zIndexRange:z4,children:(0,R.jsxs)(`div`,{style:{fontFamily:`ui-monospace, monospace`,fontSize:12,fontWeight:700,color:c,background:`rgba(10,11,13,0.85)`,border:`1px solid ${c}`,borderRadius:6,padding:`2px 7px`,whiteSpace:`nowrap`,transform:d?`scale(1.08)`:`scale(1)`,pointerEvents:`none`},children:[e.agentName,(0,R.jsx)(`span`,{style:{color:s,marginLeft:6,fontWeight:600},children:o.label}),(0,R.jsx)(`span`,{style:{color:L4(e.state).color,marginLeft:6,fontWeight:600},children:n===`meeting`?`Meeting`:L4(e.state).label})]})})]})}function u3({agent:e,position:t}){let n=L4(e.state).color,r=e.state===`working`||e.state===`booting`,i=Q4(e.capability).color;return(0,R.jsxs)(`group`,{position:t,children:[(0,R.jsxs)(`mesh`,{position:[0,.92,0],castShadow:!0,receiveShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[1.5,.08,.85]}),(0,R.jsx)(`meshStandardMaterial`,{color:V4})]}),(0,R.jsxs)(`mesh`,{position:[0,.74,.42],children:[(0,R.jsx)(`boxGeometry`,{args:[1.5,.28,.03]}),(0,R.jsx)(`meshStandardMaterial`,{color:i})]}),[[-.66,-.34],[.66,-.34],[-.66,.34],[.66,.34]].map(([e,t])=>(0,R.jsxs)(`mesh`,{position:[e,.46,t],children:[(0,R.jsx)(`boxGeometry`,{args:[.08,.92,.08]}),(0,R.jsx)(`meshStandardMaterial`,{color:H4})]},`${e},${t}`)),(0,R.jsxs)(`mesh`,{position:[0,1,-.28],children:[(0,R.jsx)(`boxGeometry`,{args:[.06,.16,.06]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#15171c`})]}),(0,R.jsxs)(`mesh`,{position:[0,.97,-.28],children:[(0,R.jsx)(`boxGeometry`,{args:[.22,.03,.12]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#15171c`})]}),(0,R.jsxs)(`mesh`,{position:[0,1.32,-.3],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.66,.44,.05]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#15171c`})]}),(0,R.jsxs)(`mesh`,{position:[0,1.32,-.272],children:[(0,R.jsx)(`boxGeometry`,{args:[.6,.38,.02]}),(0,R.jsx)(`meshStandardMaterial`,{color:n,emissive:n,emissiveIntensity:r?.85:.4})]}),(0,R.jsxs)(`mesh`,{position:[0,.97,.06],children:[(0,R.jsx)(`boxGeometry`,{args:[.5,.03,.16]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#1c1e24`})]}),(0,R.jsxs)(`mesh`,{position:[.32,.97,.08],children:[(0,R.jsx)(`boxGeometry`,{args:[.08,.03,.12]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#1c1e24`})]}),(0,R.jsxs)(`mesh`,{position:[-.38,.97,.1],children:[(0,R.jsx)(`boxGeometry`,{args:[.2,.02,.26]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#e8e6df`})]}),(0,R.jsxs)(`group`,{position:[0,0,.78],children:[(0,R.jsxs)(`mesh`,{position:[0,.5,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.5,.08,.5]}),(0,R.jsx)(`meshStandardMaterial`,{color:Y4})]}),(0,R.jsxs)(`mesh`,{position:[0,.84,.22],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.5,.62,.08]}),(0,R.jsx)(`meshStandardMaterial`,{color:Y4})]}),(0,R.jsxs)(`mesh`,{position:[0,.27,0],children:[(0,R.jsx)(`boxGeometry`,{args:[.08,.46,.08]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#15171c`})]}),(0,R.jsxs)(`mesh`,{position:[0,.06,0],children:[(0,R.jsx)(`boxGeometry`,{args:[.5,.05,.5]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#15171c`})]})]})]})}function d3({position:e}){let t=Z4.coordinator?.color??`#f5b301`;return(0,R.jsxs)(`group`,{position:e,rotation:[0,Math.PI,0],children:[(0,R.jsxs)(`mesh`,{position:[0,.02,0],receiveShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[3.6,.04,2.8]}),(0,R.jsx)(`meshStandardMaterial`,{color:X4})]}),(0,R.jsxs)(`mesh`,{position:[0,.03,0],children:[(0,R.jsx)(`boxGeometry`,{args:[3,.04,2.2]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#8e4a4a`})]}),(0,R.jsxs)(`mesh`,{position:[0,.98,0],castShadow:!0,receiveShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[2.2,.12,1.1]}),(0,R.jsx)(`meshStandardMaterial`,{color:V4})]}),(0,R.jsxs)(`mesh`,{position:[0,.62,.55],children:[(0,R.jsx)(`boxGeometry`,{args:[2.2,.64,.06]}),(0,R.jsx)(`meshStandardMaterial`,{color:H4})]}),(0,R.jsxs)(`mesh`,{position:[0,.78,.58],children:[(0,R.jsx)(`boxGeometry`,{args:[2.2,.16,.02]}),(0,R.jsx)(`meshStandardMaterial`,{color:t})]}),(0,R.jsxs)(`mesh`,{position:[0,1.36,-.34],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.8,.5,.05]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#15171c`})]}),(0,R.jsxs)(`group`,{position:[0,0,-.85],children:[(0,R.jsxs)(`mesh`,{position:[0,.52,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.6,.1,.6]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#1b2233`})]}),(0,R.jsxs)(`mesh`,{position:[0,.95,-.26],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.6,.8,.1]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#1b2233`})]})]}),(0,R.jsx)(c4,{position:[0,1.12,-.6],center:!0,distanceFactor:11,zIndexRange:z4,children:(0,R.jsx)(`div`,{style:{fontFamily:`ui-monospace, monospace`,fontSize:12,fontWeight:800,letterSpacing:`0.12em`,color:t,background:`rgba(10,11,13,0.85)`,border:`1px solid ${t}`,borderRadius:6,padding:`2px 8px`,whiteSpace:`nowrap`,pointerEvents:`none`},children:`DIRECTOR`})})]})}function f3({position:e,busy:t}){return(0,R.jsxs)(`group`,{position:e,children:[(0,R.jsxs)(`mesh`,{position:[0,1.5,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.08,1.2,1.9]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#f4f4f0`})]}),(0,R.jsxs)(`mesh`,{position:[0,.45,-.8],children:[(0,R.jsx)(`boxGeometry`,{args:[.08,1,.08]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#5b4632`})]}),(0,R.jsxs)(`mesh`,{position:[0,.45,.8],children:[(0,R.jsx)(`boxGeometry`,{args:[.08,1,.08]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#5b4632`})]}),(0,R.jsxs)(`mesh`,{position:[.05,1.7,.1],children:[(0,R.jsx)(`boxGeometry`,{args:[.02,.06,1.2]}),(0,R.jsx)(`meshStandardMaterial`,{color:t?`#fb4b38`:`#c9c4ba`})]}),(0,R.jsxs)(`mesh`,{position:[.05,1.45,-.1],children:[(0,R.jsx)(`boxGeometry`,{args:[.02,.05,.9]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#9aa0a8`})]}),(0,R.jsx)(c4,{position:[.06,2.25,0],center:!0,distanceFactor:12,rotation:[0,Math.PI/2,0],zIndexRange:z4,children:(0,R.jsx)(`div`,{style:{fontFamily:`ui-sans-serif, system-ui, sans-serif`,fontSize:12,fontWeight:800,letterSpacing:`0.08em`,color:t?`#fb4b38`:`#6b7188`,pointerEvents:`none`,whiteSpace:`nowrap`},children:`STANDUP`})})]})}function p3({halfX:e,halfZ:t}){let n=1.15,r=[],i=0;for(let a=-t+n/2;a<t;a+=n)r.push((0,R.jsxs)(`mesh`,{position:[0,0,a],receiveShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[e*2,.04,n-.04]}),(0,R.jsx)(`meshStandardMaterial`,{color:i%2==0?U4:W4})]},i)),i++;return(0,R.jsx)(`group`,{children:r})}function m3({halfX:e,halfZ:t}){return(0,R.jsxs)(`group`,{children:[(0,R.jsxs)(`mesh`,{position:[0,4/2,-t],receiveShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[e*2,4,.3]}),(0,R.jsx)(`meshStandardMaterial`,{color:G4})]}),(0,R.jsxs)(`mesh`,{position:[-e,4/2,0],receiveShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.3,4,t*2]}),(0,R.jsx)(`meshStandardMaterial`,{color:G4})]}),(0,R.jsxs)(`mesh`,{position:[e,4/2,0],receiveShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.3,4,t*2]}),(0,R.jsx)(`meshStandardMaterial`,{color:G4})]})]})}function h3({position:e,rotationY:t=0}){return(0,R.jsxs)(`group`,{position:e,rotation:[0,t,0],children:[(0,R.jsxs)(`mesh`,{children:[(0,R.jsx)(`boxGeometry`,{args:[1.7,1.4,.06]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#3a2c1f`})]}),(0,R.jsxs)(`mesh`,{position:[0,0,.04],children:[(0,R.jsx)(`boxGeometry`,{args:[1.5,1.2,.04]}),(0,R.jsx)(`meshStandardMaterial`,{color:K4,emissive:K4,emissiveIntensity:.6})]}),(0,R.jsxs)(`mesh`,{position:[0,0,.06],children:[(0,R.jsx)(`boxGeometry`,{args:[.05,1.2,.02]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#3a2c1f`})]}),(0,R.jsxs)(`mesh`,{position:[0,0,.06],children:[(0,R.jsx)(`boxGeometry`,{args:[1.5,.05,.02]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#3a2c1f`})]})]})}function g3({position:e,rotationY:t=0,color:n}){return(0,R.jsxs)(`group`,{position:e,rotation:[0,t,0],children:[(0,R.jsxs)(`mesh`,{children:[(0,R.jsx)(`boxGeometry`,{args:[.9,1.2,.04]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#0f1118`})]}),(0,R.jsxs)(`mesh`,{position:[0,0,.03],children:[(0,R.jsx)(`boxGeometry`,{args:[.78,1.08,.02]}),(0,R.jsx)(`meshStandardMaterial`,{color:n,emissive:n,emissiveIntensity:.25})]})]})}function _3({position:e}){return(0,R.jsxs)(`group`,{position:e,children:[(0,R.jsxs)(`mesh`,{position:[0,.18,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.34,.36,.34]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#b5651d`})]}),(0,R.jsxs)(`mesh`,{position:[0,.5,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.1,.3,.1]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#3f7d2e`})]}),(0,R.jsxs)(`mesh`,{position:[-.12,.62,0],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.2,.12,.2]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#4caf50`})]}),(0,R.jsxs)(`mesh`,{position:[.12,.66,.04],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.18,.12,.18]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#5fbf57`})]})]})}function v3({position:e}){return(0,R.jsxs)(`mesh`,{position:[e[0],.3,e[2]],castShadow:!0,children:[(0,R.jsx)(`boxGeometry`,{args:[.4,.6,.4]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#8b2622`})]})}function y3({position:e}){return(0,R.jsxs)(`group`,{position:e,children:[(0,R.jsxs)(`mesh`,{rotation:[Math.PI/2,0,0],children:[(0,R.jsx)(`cylinderGeometry`,{args:[.32,.32,.05,24]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#f4f4f0`})]}),(0,R.jsxs)(`mesh`,{position:[0,.08,.04],children:[(0,R.jsx)(`boxGeometry`,{args:[.03,.16,.02]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#222`})]}),(0,R.jsxs)(`mesh`,{position:[.06,0,.04],children:[(0,R.jsx)(`boxGeometry`,{args:[.12,.03,.02]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#222`})]})]})}function b3({position:e}){return(0,R.jsxs)(`group`,{position:e,children:[(0,R.jsxs)(`mesh`,{children:[(0,R.jsx)(`boxGeometry`,{args:[1.7,1.1,.08]}),(0,R.jsx)(`meshStandardMaterial`,{color:`#f4f4f0`})]}),(0,R.jsx)(c4,{position:[0,.42,.06],center:!0,distanceFactor:11,zIndexRange:z4,children:(0,R.jsx)(`div`,{style:{fontFamily:`ui-monospace, monospace`,fontSize:13,fontWeight:800,letterSpacing:`0.08em`,color:`#444`,pointerEvents:`none`,whiteSpace:`nowrap`},children:`ROADMAP`})})]})}function x3(){let{camera:e}=w0(),t=(0,v.useRef)({});return(0,v.useEffect)(()=>{e.position.set(0,1.7,6);let n=e=>{t.current[e.code]=!0},r=e=>{t.current[e.code]=!1};return window.addEventListener(`keydown`,n),window.addEventListener(`keyup`,r),()=>{window.removeEventListener(`keydown`,n),window.removeEventListener(`keyup`,r)}},[e]),T0((n,r)=>{let i=6*Math.min(r,.05),a=new X;e.getWorldDirection(a),a.y=0,a.normalize();let o=new X().crossVectors(a,new X(0,1,0)).normalize(),s=new X;t.current.KeyW&&s.add(a),t.current.KeyS&&s.sub(a),t.current.KeyD&&s.add(o),t.current.KeyA&&s.sub(o),s.lengthSq()>0&&(s.normalize().multiplyScalar(i),e.position.add(s),e.position.y=1.7)}),(0,R.jsx)(N4,{})}function S3(e){let t=Math.ceil(Math.sqrt(e)),n=Math.ceil(e/t),r=3.6,i=3.4,a=[];for(let o=0;o<e;o++){let e=o%t,s=Math.floor(o/t);a.push([(e-(t-1)/2)*r,0,(s-(n-1)/2)*i])}return{positions:a,halfX:Math.max(8,t*r/2+3),halfZ:Math.max(9,n*i/2+5)}}var C3=45e3,w3=6;function T3({agents:e,handoffs:t,now:n,onSelect:r,fps:i}){let a=e.find(e=>e.capability===`coordinator`)??null,o=a?e.filter(e=>e!==a):e,{positions:s,halfX:c,halfZ:l}=S3(Math.max(o.length,1)),u=-(c-1.1),d=-(l-1.8),f=[0,0,d],p={pos:[0,0,d-.95],faceX:0,faceZ:d+10,sit:!1},m=new Set(e.map(e=>e.agentName)),h=[],g=new Map;for(let e of t)n-Date.parse(e.createdAt)>C3||(m.has(e.from)&&(h.includes(e.from)||h.push(e.from),g.has(e.from)||g.set(e.from,{text:`${n3(e.type)}: ${e.subject}`,speaker:!0})),m.has(e.to)&&(h.includes(e.to)||h.push(e.to),g.has(e.to)||g.set(e.to,{text:null,speaker:!1})));let _=h.slice(0,w3);function v(e,t){let n=2.5,r=t<=1?0:Math.min(Math.PI*.62,.4+t*.18),i=t<=1?0:-r/2+r*(e/(t-1));return[u+n*Math.cos(i),0,0+n*Math.sin(i)]}function y(e,t,n){let i=_.indexOf(e.agentName),a=i>=0,o=a?`meeting`:$4(e.state),s=g.get(e.agentName);return(0,R.jsx)(l3,{agent:e,deskPos:t,behavior:o,meeting:a?{pos:v(i,_.length),faceX:u,faceZ:0,speech:s?.text??null,speaker:s?.speaker??!1}:null,station:n,onSelect:r},`actor-${e.id}`)}return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`ambientLight`,{intensity:.62}),(0,R.jsx)(`directionalLight`,{position:[6,12,8],intensity:.85,castShadow:!0}),(0,R.jsx)(`pointLight`,{position:[-6,8,-6],intensity:.22,color:`#f5402d`}),(0,R.jsx)(`pointLight`,{position:[0,6,6],intensity:.3,color:`#ffd9a0`}),(0,R.jsx)(`hemisphereLight`,{args:[K4,`#3a2c1f`,.4]}),(0,R.jsx)(p3,{halfX:c,halfZ:l}),(0,R.jsx)(m3,{halfX:c,halfZ:l}),o.map((e,t)=>(0,R.jsx)(u3,{agent:e,position:s[t]??[0,0,0]},`desk-${e.id}`)),o.map((e,t)=>y(e,s[t]??[0,0,0],null)),a?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(d3,{position:f}),y(a,f,p)]}):null,(0,R.jsx)(f3,{position:[u,0,0],busy:_.length>0}),(0,R.jsx)(h3,{position:[-c*.45,2.4,-l+.18]}),(0,R.jsx)(h3,{position:[c*.45,2.4,-l+.18]}),(0,R.jsx)(g3,{position:[-c+.2,2.2,l*.3],rotationY:Math.PI/2,color:`#4f86f7`}),(0,R.jsx)(g3,{position:[c-.2,2.2,-l*.2],rotationY:-Math.PI/2,color:`#34d399`}),(0,R.jsx)(_3,{position:[-c+1.4,0,l-2]}),(0,R.jsx)(_3,{position:[c-1.6,0,l-1.4]}),(0,R.jsx)(v3,{position:[c-1.2,0,l-.8]}),(0,R.jsx)(y3,{position:[-2.6,2.7,-l+.22]}),(0,R.jsx)(b3,{position:[2.8,2.3,-l+.3]}),i?(0,R.jsx)(x3,{}):(0,R.jsx)(M4,{enablePan:!0,minDistance:4,maxDistance:l*2.4,maxPolarAngle:Math.PI/2.1})]})}function E3({icon:e,children:t}){return(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:7},children:[(0,R.jsx)(e,{size:14,style:{flex:`0 0 auto`}}),(0,R.jsx)(`span`,{children:t})]})}function D3({color:e}){return(0,R.jsx)(`span`,{style:{width:9,height:9,borderRadius:`50%`,background:e,display:`inline-block`,flex:`0 0 auto`}})}function O3({agents:e,onSelect:t}){let[n,r]=(0,v.useState)(!1),{data:i}=hL(k,5e3),[a,o]=(0,v.useState)(()=>Date.now());(0,v.useEffect)(()=>{let e=window.setInterval(()=>o(Date.now()),5e3);return()=>window.clearInterval(e)},[]);let s=(0,v.useMemo)(()=>e.filter(e=>t3(e,a)),[e,a]),c=(0,v.useMemo)(()=>{let e=new Set,t=[];for(let n of s)e.has(n.capability)||(e.add(n.capability),t.push({cap:n.capability,kit:Q4(n.capability)}));return t},[s]);return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`page-head`,children:[(0,R.jsxs)(`h1`,{className:`page-title`,children:[(0,R.jsx)(Mt,{icon:et}),` Office`]}),(0,R.jsx)(`p`,{className:`page-sub`,children:`Agents act out their work by role: each wears a kit (the coordinator presides from the corner office), idle agents stand, working agents sit and type, and handoffs meet at the whiteboard. Finished agents linger briefly, then leave. Click an avatar for detail.`})]}),(0,R.jsx)(`div`,{className:`card`,style:{padding:0,overflow:`hidden`,position:`relative`,height:`calc(100vh - 230px)`,minHeight:460},children:s.length===0?(0,R.jsx)(`div`,{className:`empty`,style:{paddingTop:140},children:`The office is empty — spawn an agent to populate it.`}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(q2,{shadows:!0,camera:{position:[0,7,13],fov:45},style:{background:K4},children:(0,R.jsx)(T3,{agents:s,handoffs:i??[],now:a,onSelect:t,fps:n})}),(0,R.jsxs)(`div`,{style:{position:`absolute`,top:14,left:14,zIndex:B4,background:`rgba(10,11,13,0.82)`,border:`1px solid var(--border)`,borderRadius:10,padding:`12px 14px`,fontSize:13,color:`var(--text)`,minWidth:188,backdropFilter:`blur(4px)`},children:[(0,R.jsxs)(`div`,{style:{fontWeight:800,marginBottom:8,display:`flex`,alignItems:`center`,gap:7},children:[(0,R.jsx)(et,{size:16}),` The Office`]}),(0,R.jsxs)(`div`,{className:`dim`,style:{display:`flex`,flexDirection:`column`,gap:6,fontSize:12.5},children:[(0,R.jsxs)(E3,{icon:n?Et:Tt,children:[(0,R.jsx)(`b`,{style:{color:`var(--text)`},children:`Mode:`}),` `,n?`FPS`:`Orbit`]}),n?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(E3,{icon:Dt,children:`WASD: Move`}),(0,R.jsx)(E3,{icon:Ot,children:`Mouse: Look`}),(0,R.jsx)(E3,{icon:Dt,children:`Esc: Release`})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(E3,{icon:Ot,children:`Mouse: Rotate view`}),(0,R.jsx)(E3,{icon:At,children:`Scroll: Zoom`}),(0,R.jsx)(E3,{icon:kt,children:`Click: Select`})]})]}),(0,R.jsx)(`button`,{type:`button`,className:`btn primary`,style:{marginTop:10,width:`100%`},onClick:()=>r(e=>!e),children:n?`Switch to Orbit Mode`:`Switch to FPS Mode`})]}),(0,R.jsxs)(`div`,{style:{position:`absolute`,bottom:14,right:14,zIndex:B4,background:`rgba(10,11,13,0.82)`,border:`1px solid var(--border)`,borderRadius:10,padding:`10px 14px`,fontSize:12.5,color:`var(--text)`,maxHeight:`calc(100% - 28px)`,overflowY:`auto`,backdropFilter:`blur(4px)`},children:[(0,R.jsx)(`div`,{style:{fontWeight:800,marginBottom:6},children:`State`}),R4.map(e=>(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`2px 0`},children:[(0,R.jsx)(D3,{color:e.color}),e.label]},e.label)),c.length>0?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{style:{fontWeight:800,margin:`10px 0 6px`,borderTop:`1px solid var(--border)`,paddingTop:8},children:`Roles`}),c.map(e=>(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`2px 0`},children:[(0,R.jsx)(D3,{color:e.kit.color}),e.kit.label]},e.cap))]}):null,(0,R.jsx)(`div`,{style:{fontWeight:800,margin:`10px 0 6px`,borderTop:`1px solid var(--border)`,paddingTop:8},children:`Behavior`}),(0,R.jsxs)(`div`,{className:`dim`,style:{lineHeight:1.7},children:[(0,R.jsx)(`div`,{children:`Standing — idle`}),(0,R.jsx)(`div`,{children:`Sitting & typing — working`}),(0,R.jsx)(`div`,{children:`At whiteboard — handing off`})]})]})]})})]})}function k3(e){if(!e)return`—`;let t=e.includes(`-`)?e.slice(e.lastIndexOf(`-`)+1):e;return t.length>8?t.slice(0,8):t}var A3=new Set([`working`,`booting`]);function j3({onSelect:e}){let{data:t}=hL(S,5e3),{data:n}=hL(C,5e3),[r,i]=(0,v.useState)(`all`),a=t??[],o=n??[],s=(0,v.useMemo)(()=>{let e=new Set;for(let t of o)t.capability&&e.add(t.capability);return Array.from(e).sort()},[o]),c=(0,v.useMemo)(()=>o.filter(e=>A3.has(e.state)).length,[o]),l=(0,v.useMemo)(()=>[...r===`all`?o:o.filter(e=>e.capability===r)].sort((e,t)=>new Date(t.lastActivity).getTime()-new Date(e.lastActivity).getTime()),[o,r]);return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`page-head`,children:[(0,R.jsxs)(`h1`,{className:`page-title`,children:[(0,R.jsx)(Mt,{icon:it,tone:`cyan`}),` Runs & Sessions`]}),(0,R.jsx)(`p`,{className:`page-sub`,children:`All agent runs and the sessions within them`})]}),(0,R.jsxs)(`div`,{className:`stat-grid`,children:[(0,R.jsx)(oe,{label:`Total Runs`,value:a.length,icon:(0,R.jsx)(it,{size:20}),iconTone:`cyan`}),(0,R.jsx)(oe,{label:`Total Sessions`,value:o.length,icon:(0,R.jsx)(yt,{size:20}),iconTone:`info`}),(0,R.jsx)(oe,{label:`Active`,value:c,icon:(0,R.jsx)(mt,{size:20}),iconTone:`accent`,valueClass:c>0?``:`dim`,sub:`${c} working / booting`}),(0,R.jsx)(oe,{label:`Capabilities`,value:s.length,icon:(0,R.jsx)(at,{size:20}),iconTone:`violet`})]}),(0,R.jsx)(se,{title:`Sessions`,right:s.length>0?(0,R.jsxs)(`div`,{className:`seg`,children:[(0,R.jsx)(`button`,{type:`button`,className:r===`all`?`active`:``,onClick:()=>i(`all`),children:`All`}),s.map(e=>(0,R.jsx)(`button`,{type:`button`,className:r===e?`active`:``,onClick:()=>i(e),children:e},e))]}):(0,R.jsxs)(`span`,{className:`card-meta`,children:[o.length,` total`]}),children:(0,R.jsx)(`div`,{className:`grid-wrap`,children:(0,R.jsxs)(`table`,{className:`grid`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`th`,{children:`Session`}),(0,R.jsx)(`th`,{children:`Capability`}),(0,R.jsx)(`th`,{children:`State`}),(0,R.jsx)(`th`,{children:`Task`}),(0,R.jsx)(`th`,{children:`Run`}),(0,R.jsx)(`th`,{children:`Updated`})]})}),(0,R.jsx)(`tbody`,{children:l.length===0?(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{colSpan:6,children:(0,R.jsx)(`div`,{className:`empty`,children:`No sessions to show.`})})}):l.map(t=>{let n=ce(t.state);return(0,R.jsxs)(`tr`,{className:`row-click`,onClick:()=>e(t.agentName),children:[(0,R.jsxs)(`td`,{children:[(0,R.jsx)(`span`,{style:{fontWeight:700},children:t.agentName}),` `,(0,R.jsx)(ae,{tone:`neutral`,children:t.capability})]}),(0,R.jsx)(`td`,{className:`dim`,children:t.capability}),(0,R.jsx)(`td`,{children:(0,R.jsx)(ae,{tone:n.tone,children:n.label})}),(0,R.jsx)(`td`,{className:`mono nowrap`,children:t.taskId||`—`}),(0,R.jsx)(`td`,{className:`mono nowrap faint`,children:k3(t.runId)}),(0,R.jsx)(`td`,{className:`dim nowrap`,children:ne(t.lastActivity)})]},t.id)})})]})})})]})}function M3({k:e,value:t}){return(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`td`,{className:`dim nowrap`,children:e}),(0,R.jsx)(`td`,{className:`mono`,children:t})]})}function N3({overview:e}){return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`page-head`,children:[(0,R.jsxs)(`div`,{className:`page-title`,children:[(0,R.jsx)(Mt,{icon:lt,tone:`info`}),` Settings`]}),(0,R.jsx)(`div`,{className:`page-sub`,children:`Project configuration (read-only)`})]}),(0,R.jsxs)(`div`,{className:`row-2col`,children:[(0,R.jsx)(se,{title:`Project`,children:(0,R.jsx)(`div`,{className:`grid-wrap`,children:(0,R.jsx)(`table`,{className:`grid`,children:(0,R.jsxs)(`tbody`,{children:[(0,R.jsx)(M3,{k:`Project`,value:e?.project??`—`}),(0,R.jsx)(M3,{k:`Runtime`,value:e?.runtime??`—`}),(0,R.jsx)(M3,{k:`Provider`,value:e?.provider??`—`}),(0,R.jsx)(M3,{k:`Model`,value:e?.model??`—`}),(0,R.jsx)(M3,{k:`Deploy target`,value:e?.deployTarget??`(none)`}),(0,R.jsx)(M3,{k:`Current run`,value:e?.currentRun?.id??`—`}),(0,R.jsx)(M3,{k:`Agents`,value:e?(0,R.jsx)(ae,{tone:`accent`,children:e.agentCount}):`—`})]})})})}),(0,R.jsxs)(se,{title:`About`,children:[(0,R.jsxs)(`p`,{className:`dim`,style:{lineHeight:1.6,margin:`0 0 12px`},children:[(0,R.jsx)(`strong`,{style:{color:`var(--accent)`},children:`Agentplate`}),` is a self-improving multi-agent orchestration system that takes work from build to deploy. A single session becomes a coordinated team of agents running in isolated git worktrees, messaging through a SQLite mail bus and merging back with tiered conflict resolution.`]}),(0,R.jsxs)(`p`,{className:`dim`,style:{lineHeight:1.6,margin:`0 0 12px`},children:[`Operate the swarm through the `,(0,R.jsx)(`span`,{className:`mono`,children:`agentplate`}),` `,`CLI, the live TUI dashboard, or this web UI.`]}),(0,R.jsxs)(`p`,{className:`faint`,style:{lineHeight:1.6,margin:0},children:[`Edit `,(0,R.jsx)(`span`,{className:`mono`,children:`.agentplate/config.yaml`}),` or run`,` `,(0,R.jsx)(`span`,{className:`mono`,children:`agentplate setup`}),` to change settings.`]})]})]})]})}function P3(e){return e===`active`?`ok`:e===`quarantined`?`warn`:`neutral`}function F3(){let{data:e,error:t,loading:n}=hL(w,5e3),r=e??[],i=r.filter(e=>e.status===`active`).length,a=r.length>0?r.reduce((e,t)=>e+t.confidence,0)/r.length:0;return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`page-head`,children:[(0,R.jsxs)(`h1`,{className:`page-title`,children:[(0,R.jsx)(Mt,{icon:at,tone:`violet`}),` Skills`]}),(0,R.jsx)(`p`,{className:`page-sub`,children:`Distilled, self-improving expertise ranked by confidence.`})]}),t?(0,R.jsx)(se,{children:(0,R.jsx)(`span`,{className:`badge err`,children:t})}):null,(0,R.jsxs)(`div`,{className:`stat-grid`,children:[(0,R.jsx)(oe,{label:`Total skills`,value:r.length,icon:(0,R.jsx)(at,{size:20}),iconTone:`violet`}),(0,R.jsx)(oe,{label:`Active`,value:i,icon:(0,R.jsx)(mt,{size:20}),iconTone:`accent`,valueClass:`accent`}),(0,R.jsx)(oe,{label:`Avg confidence`,value:`${Math.round(a*100)}%`,icon:(0,R.jsx)(bt,{size:20}),iconTone:`ok`,valueClass:`sm`})]}),(0,R.jsx)(se,{title:`Skill library`,meta:`${r.length} skill${r.length===1?``:`s`}`,children:(0,R.jsx)(`div`,{className:`grid-wrap`,children:(0,R.jsxs)(`table`,{className:`grid`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`th`,{children:`Skill`}),(0,R.jsx)(`th`,{children:`Status`}),(0,R.jsx)(`th`,{children:`Confidence`}),(0,R.jsx)(`th`,{children:`Applied`}),(0,R.jsx)(`th`,{children:`Success`}),(0,R.jsx)(`th`,{children:`Ver`})]})}),(0,R.jsx)(`tbody`,{children:n&&r.length===0?(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{colSpan:6,className:`empty`,children:`Loading skills…`})}):r.length===0?(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{colSpan:6,className:`empty`,children:`No skills distilled yet.`})}):r.map(e=>{let t=Math.max(0,Math.min(100,Math.round(e.confidence*100)));return(0,R.jsxs)(`tr`,{children:[(0,R.jsxs)(`td`,{children:[(0,R.jsx)(`strong`,{children:e.title||e.slug}),e.goal?(0,R.jsx)(`div`,{className:`dim`,style:{fontSize:12,marginTop:2},children:e.goal}):null]}),(0,R.jsx)(`td`,{children:(0,R.jsx)(ae,{tone:P3(e.status),children:e.status})}),(0,R.jsx)(`td`,{children:(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,minWidth:130},children:[(0,R.jsx)(`div`,{className:`bar`,style:{flex:1},children:(0,R.jsx)(`span`,{style:{width:`${t}%`}})}),(0,R.jsxs)(`span`,{className:`mono dim nowrap`,style:{fontSize:12},children:[t,`%`]})]})}),(0,R.jsx)(`td`,{className:`dim`,children:e.appliedCount}),(0,R.jsx)(`td`,{className:`dim`,children:Math.round(e.successCount*100)/100}),(0,R.jsxs)(`td`,{className:`dim mono`,children:[`v`,e.version]})]},e.slug)})})]})})})]})}function I3(e){return e>=90?`#f5402d`:e>=70?`#fbbf24`:`#34d399`}function L3({pct:e}){return(0,R.jsx)(`div`,{className:`bar`,style:{marginTop:14},children:(0,R.jsx)(`span`,{style:{width:`${Math.max(0,Math.min(100,e))}%`,background:I3(e)}})})}function R3({pct:e}){return(0,R.jsxs)(`span`,{className:`mono`,style:{fontSize:30,fontWeight:700,color:I3(e),lineHeight:1},children:[Math.round(e),(0,R.jsx)(`span`,{style:{fontSize:18},children:`%`})]})}function z3(){let{data:e,error:t,loading:n}=hL(j,5e3);return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`page-head`,children:(0,R.jsxs)(`div`,{className:`head-row`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`page-title`,children:[(0,R.jsx)(Mt,{icon:Qe,tone:`info`}),` System Monitor`]}),(0,R.jsx)(`div`,{className:`page-sub`,children:`Real-time monitoring of the server running agentplate serve`})]}),(0,R.jsx)(ae,{tone:`ok`,children:`● Live`})]})}),n&&!e?(0,R.jsx)(`div`,{className:`empty`,children:`Loading system metrics…`}):null,t?(0,R.jsxs)(`div`,{className:`empty`,children:[`Failed to load system metrics: `,t]}):null,e?(0,R.jsx)(B3,{m:e}):null]})}function B3({m:e}){let[t,n,r]=e.cpu.loadAvg,i=e.disk.percent!=null&&e.disk.usedBytes!=null&&e.disk.totalBytes!=null;return(0,R.jsxs)(`div`,{className:`row-2col`,children:[(0,R.jsxs)(se,{title:`CPU`,right:(0,R.jsxs)(`span`,{className:`faint mono`,children:[e.cpu.cores,` cores`]}),children:[(0,R.jsxs)(`div`,{className:`row-2col`,style:{alignItems:`center`},children:[(0,R.jsx)(R3,{pct:e.cpu.percent}),(0,R.jsxs)(`div`,{className:`dim mono`,style:{fontSize:12,textAlign:`right`},children:[`Load Average`,(0,R.jsx)(`br`,{}),t.toFixed(2),` / `,n.toFixed(2),` / `,r.toFixed(2)]})]}),(0,R.jsx)(L3,{pct:e.cpu.percent})]}),(0,R.jsxs)(se,{title:`RAM`,children:[(0,R.jsxs)(`div`,{className:`row-2col`,style:{alignItems:`center`},children:[(0,R.jsx)(R3,{pct:e.memory.percent}),(0,R.jsxs)(`div`,{className:`dim mono`,style:{fontSize:12,textAlign:`right`},children:[B(e.memory.usedBytes),` / `,B(e.memory.totalBytes)]})]}),(0,R.jsx)(L3,{pct:e.memory.percent})]}),(0,R.jsx)(se,{title:`DISK`,children:i?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`row-2col`,style:{alignItems:`center`},children:[(0,R.jsx)(R3,{pct:e.disk.percent}),(0,R.jsxs)(`div`,{className:`dim mono`,style:{fontSize:12,textAlign:`right`},children:[B(e.disk.usedBytes),` / `,B(e.disk.totalBytes)]})]}),(0,R.jsx)(L3,{pct:e.disk.percent})]}):(0,R.jsx)(`div`,{className:`empty`,children:`Disk metrics unavailable`})}),(0,R.jsx)(se,{title:`Host`,children:(0,R.jsxs)(`div`,{className:`row-2col`,style:{rowGap:12},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`faint`,style:{fontSize:11,textTransform:`uppercase`},children:`Hostname`}),(0,R.jsx)(`div`,{className:`mono`,style:{fontSize:15,fontWeight:600},children:e.hostname})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`faint`,style:{fontSize:11,textTransform:`uppercase`},children:`Platform`}),(0,R.jsx)(`div`,{className:`mono`,style:{fontSize:15,fontWeight:600},children:e.platform})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`faint`,style:{fontSize:11,textTransform:`uppercase`},children:`Uptime`}),(0,R.jsx)(`div`,{className:`mono`,style:{fontSize:15,fontWeight:600},children:ie(e.uptimeSeconds)})]})]})})]})}function V3(e){switch(e){case`active`:return`accent`;case`done`:return`ok`;case`failed`:return`err`;case`pending`:return`info`;default:return`neutral`}}function H3({tasks:e,live:t}){let[n,r]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(t||e.length>0)return;let n=!1;return A().then(e=>{n||r(e)}).catch(()=>{}),()=>{n=!0}},[t,e.length]);let i=e.length>0?e:n??[],a=i.filter(e=>e.status===`active`).length,o=i.filter(e=>e.status===`done`).length;return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`page-head`,children:[(0,R.jsxs)(`h1`,{className:`page-title`,children:[(0,R.jsx)(Mt,{icon:tt,tone:`violet`}),` Tasks`]}),(0,R.jsxs)(`p`,{className:`page-sub`,children:[t?`Live work queue via WebSocket.`:`Socket offline — last known tasks.`,` Refreshes every 5s.`]})]}),(0,R.jsxs)(`div`,{className:`stat-grid`,children:[(0,R.jsx)(oe,{label:`Total tasks`,value:i.length,icon:(0,R.jsx)(tt,{size:20}),iconTone:`violet`}),(0,R.jsx)(oe,{label:`Active`,value:a,icon:(0,R.jsx)(mt,{size:20}),iconTone:`accent`,valueClass:`accent`}),(0,R.jsx)(oe,{label:`Done`,value:o,icon:(0,R.jsx)(xt,{size:20}),iconTone:`ok`})]}),(0,R.jsx)(se,{title:`Tasks`,meta:`${i.length} total · ${a} active · ${o} done`,children:(0,R.jsx)(`div`,{className:`grid-wrap`,children:(0,R.jsxs)(`table`,{className:`grid`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`th`,{children:`Task`}),(0,R.jsx)(`th`,{children:`Status`}),(0,R.jsx)(`th`,{children:`Capabilities`}),(0,R.jsx)(`th`,{children:`Agents`}),(0,R.jsx)(`th`,{children:`Last activity`})]})}),(0,R.jsx)(`tbody`,{children:i.length===0?(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{colSpan:5,className:`empty`,children:`No tasks yet. Submit one from the Chat tab.`})}):i.map(e=>(0,R.jsxs)(`tr`,{children:[(0,R.jsxs)(`td`,{children:[(0,R.jsx)(`strong`,{className:`mono`,children:e.taskId}),e.summary?(0,R.jsx)(`div`,{className:`dim`,children:e.summary}):null]}),(0,R.jsx)(`td`,{children:(0,R.jsx)(ae,{tone:V3(e.status),children:e.status})}),(0,R.jsx)(`td`,{className:`dim`,children:e.capabilities.length>0?e.capabilities.join(`, `):`—`}),(0,R.jsx)(`td`,{className:`dim`,children:e.agentCount>0?(0,R.jsxs)(`span`,{title:e.agents.join(`, `),children:[e.agentCount,` (`,e.agents.slice(0,2).join(`, `),e.agents.length>2?`…`:``,`)`]}):`—`}),(0,R.jsx)(`td`,{className:`dim nowrap`,children:e.lastActivity?ne(e.lastActivity):`—`})]},e.taskId))})]})})})]})}function U3({state:e}){let{tone:t,label:n}=ce(e);return(0,R.jsx)(ae,{tone:t,children:n})}function W3({label:e,value:t}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`faint`,style:{fontSize:12,padding:`5px 0`},children:e}),(0,R.jsx)(`span`,{style:{padding:`5px 0`,minWidth:0,wordBreak:`break-word`},children:t})]})}function G3({m:e,dir:t}){return(0,R.jsxs)(`li`,{style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`,paddingBottom:8,borderBottom:`1px solid var(--border-soft)`},children:[(0,R.jsx)(ae,{tone:t===`in`?`info`:`accent`,children:t===`in`?`◀ in`:`out ▶`}),(0,R.jsx)(`span`,{className:`mono dim`,children:t===`in`?e.from:e.to}),(0,R.jsx)(`span`,{className:`faint`,style:{fontSize:12},children:e.type}),(0,R.jsx)(`span`,{style:{flex:1,minWidth:120},children:e.subject}),(0,R.jsx)(`span`,{className:`dim`,style:{fontSize:12},children:ne(e.createdAt)})]})}var K3={display:`grid`,gridTemplateColumns:`minmax(110px, max-content) 1fr`,columnGap:16,alignItems:`baseline`,fontSize:13},q3={listStyle:`none`,margin:0,padding:0,display:`flex`,flexDirection:`column`,gap:10};function J3({name:e,onClose:t}){let{data:n,error:r}=hL(()=>O(e),5e3),i=n?.session??null,a=[...(n?.inbox??[]).map(e=>({m:e,dir:`in`})),...(n?.sent??[]).map(e=>({m:e,dir:`out`}))].sort((e,t)=>e.m.createdAt<t.m.createdAt?1:-1);return(0,R.jsx)(`div`,{onClick:t,role:`presentation`,style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.5)`,display:`flex`,justifyContent:`flex-end`,zIndex:50},children:(0,R.jsxs)(`aside`,{onClick:e=>e.stopPropagation(),role:`dialog`,"aria-label":`Agent ${e}`,style:{width:`min(560px, 100%)`,height:`100%`,background:`var(--bg-card)`,borderLeft:`1px solid var(--border)`,overflowY:`auto`,padding:18},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,justifyContent:`space-between`,gap:12,marginBottom:18},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{style:{fontSize:24,fontWeight:800,letterSpacing:`-0.02em`,color:te(e)},children:e}),(0,R.jsxs)(`div`,{className:`dim`,style:{fontSize:12,marginTop:4},children:[i?i.capability:`agent`,` · refreshes every 5s`]})]}),(0,R.jsx)(`button`,{type:`button`,className:`btn`,onClick:t,"aria-label":`Close`,children:`×`})]}),r?(0,R.jsx)(`div`,{style:{background:`var(--err-soft)`,border:`1px solid var(--accent-border)`,color:`var(--err)`,borderRadius:`9px`,padding:`10px 14px`,marginBottom:16,fontSize:13,fontWeight:600},children:r}):null,i?(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,R.jsx)(se,{title:`Session`,children:(0,R.jsxs)(`div`,{style:K3,children:[(0,R.jsx)(W3,{label:`State`,value:(0,R.jsx)(U3,{state:i.state})}),(0,R.jsx)(W3,{label:`Capability`,value:i.capability}),(0,R.jsx)(W3,{label:`Task`,value:(0,R.jsx)(`span`,{className:`mono`,children:i.taskId||`—`})}),(0,R.jsx)(W3,{label:`Run`,value:(0,R.jsx)(`span`,{className:`mono`,children:i.runId})}),(0,R.jsx)(W3,{label:`Parent`,value:i.parentAgent??`—`}),(0,R.jsx)(W3,{label:`Depth`,value:String(i.depth)}),(0,R.jsx)(W3,{label:`Branch`,value:(0,R.jsx)(`span`,{className:`mono`,children:i.branchName||`—`})}),(0,R.jsx)(W3,{label:`PID`,value:i.pid==null?`—`:String(i.pid)}),(0,R.jsx)(W3,{label:`Worktree`,value:(0,R.jsx)(`span`,{className:`mono`,children:i.worktreePath})}),(0,R.jsx)(W3,{label:`Started`,value:z(i.startedAt)}),(0,R.jsx)(W3,{label:`Last activity`,value:`${ne(i.lastActivity)} (${z(i.lastActivity)})`}),(0,R.jsx)(W3,{label:`Runtime session`,value:(0,R.jsx)(`span`,{className:`mono`,children:i.runtimeSessionId??`—`})})]})}),(0,R.jsx)(se,{title:`Handoff communications`,meta:`${a.length} messages`,children:a.length===0?(0,R.jsx)(`div`,{className:`empty`,children:`No mail to or from this agent yet.`}):(0,R.jsx)(`ul`,{style:q3,children:a.map(({m:e,dir:t})=>(0,R.jsx)(G3,{m:e,dir:t},`${e.id}-${t}`))})}),n?.children&&n.children.length>0?(0,R.jsx)(se,{title:`Spawned agents`,meta:`${n.children.length}`,children:(0,R.jsx)(`ul`,{style:q3,children:n.children.map(e=>(0,R.jsxs)(`li`,{style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`},children:[(0,R.jsx)(U3,{state:e.state}),(0,R.jsx)(`span`,{className:`mono`,style:{color:te(e.agentName)},children:e.agentName}),(0,R.jsxs)(`span`,{className:`dim`,children:[e.capability,` · `,e.taskId]})]},e.id))})}):null,(0,R.jsx)(se,{title:`Recent activity`,meta:`${n?.events.length??0} events`,children:!n||n.events.length===0?(0,R.jsx)(`div`,{className:`empty`,children:`No events recorded yet.`}):(0,R.jsx)(`ul`,{style:q3,children:n.events.map(e=>(0,R.jsxs)(`li`,{style:{display:`flex`,alignItems:`baseline`,gap:8,flexWrap:`wrap`},children:[(0,R.jsx)(`span`,{className:`dim`,style:{fontSize:12},children:ne(e.createdAt)}),(0,R.jsx)(`span`,{className:`mono`,style:{fontSize:12.5},children:e.tool?`${e.type}: ${e.tool}`:e.type}),e.detail?(0,R.jsxs)(`span`,{className:`dim`,children:[`— `,e.detail]}):null]},e.id))})})]}):(0,R.jsx)(`div`,{className:`empty`,children:`No live session for this agent.`})]})})}var Y3=[{id:`dashboard`,label:`Dashboard`},{id:`system`,label:`System`},{id:`agents`,label:`Agents`},{id:`office`,label:`Office`},{id:`tasks`,label:`Tasks`},{id:`handoffs`,label:`Handoffs`},{id:`activity`,label:`Activity`},{id:`sessions`,label:`Runs`},{id:`skills`,label:`Skills`},{id:`costs`,label:`Costs`},{id:`chat`,label:`Chat`},{id:`deploy`,label:`Deploy`},{id:`settings`,label:`Settings`}],X3={idle:0,working:0,completed:0,stalled:0};function Z3(e){let t={idle:0,working:0,completed:0,stalled:0};for(let n of e)n.state===`working`||n.state===`booting`?t.working++:n.state===`idle`?t.idle++:n.state===`completed`?t.completed++:t.stalled++;return t}function Q3(){let[e,t]=(0,v.useState)(`dashboard`),[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(X3),[u,d]=(0,v.useState)([]),[f,p]=(0,v.useState)([]),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(null),[y,b]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),b(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,v.useEffect)(()=>{let e=I({onSnapshot:e=>{a(e.overview),s(Array.isArray(e.agents)?e.agents:[]),l(e.statusCounts??X3),d(Array.isArray(e.tasks)?e.tasks:[]),p(Array.isArray(e.feed)?e.feed:[])},onStatus:r});return()=>e.close()},[]);let S=(0,v.useRef)(n);(0,v.useEffect)(()=>{S.current=n},[n]),(0,v.useEffect)(()=>{let e=!1,t=async()=>{if(!S.current)try{let[t,n,r,i]=await Promise.all([C(),x().catch(()=>null),A().catch(()=>[]),D(40).catch(()=>[])]);if(e)return;s(t),l(Z3(t)),n&&a(n),d(r),p(i)}catch{}};t();let n=window.setInterval(t,4e3);return()=>{e=!0,window.clearInterval(n)}},[]),(0,v.useEffect)(()=>{let e=!1,t=()=>j().then(t=>!e&&h(t)).catch(()=>{});t();let n=window.setInterval(t,5e3);return()=>{e=!0,window.clearInterval(n)}},[]);let w=(0,v.useMemo)(()=>{switch(e){case`dashboard`:return(0,R.jsx)(jL,{overview:i,agents:o,counts:c,onOpenOffice:()=>t(`office`),onSelect:_});case`system`:return(0,R.jsx)(z3,{});case`agents`:return(0,R.jsx)(Gt,{agents:o,counts:c,onSelect:_});case`office`:return(0,R.jsx)(O3,{agents:o,onSelect:_});case`tasks`:return(0,R.jsx)(H3,{tasks:u,live:n});case`handoffs`:return(0,R.jsx)(AL,{});case`activity`:return(0,R.jsx)(OL,{feed:f,live:n});case`sessions`:return(0,R.jsx)(j3,{onSelect:_});case`skills`:return(0,R.jsx)(F3,{});case`costs`:return(0,R.jsx)(xL,{});case`chat`:return(0,R.jsx)(Yt,{feed:f});case`deploy`:return(0,R.jsx)(TL,{});case`settings`:return(0,R.jsx)(N3,{overview:i});default:return null}},[e,i,o,c,u,f,n]),T=(i?.project??`A`).charAt(0).toUpperCase(),E=(0,v.useMemo)(()=>new Set(o.map(e=>e.agentName)),[o]);return(0,R.jsxs)(`div`,{className:`os`,children:[(0,R.jsxs)(`nav`,{className:`rail`,children:[(0,R.jsx)(`div`,{className:`rail-logo`,title:`Agentplate`,children:(0,R.jsx)(Ft,{size:26,color:`#fff`})}),Y3.map(n=>{let r=jt[n.id];return(0,R.jsxs)(`button`,{type:`button`,className:`rail-item ${e===n.id?`active`:``}`,onClick:()=>t(n.id),children:[(0,R.jsx)(`span`,{className:`ri-icon`,children:r?(0,R.jsx)(r,{size:20,strokeWidth:2}):null}),(0,R.jsx)(`span`,{className:`ri-label`,children:n.label})]},n.id)})]}),(0,R.jsxs)(`header`,{className:`topbar`,children:[(0,R.jsxs)(`div`,{className:`topbar-brand`,children:[(0,R.jsx)(`span`,{className:`brand-glyph`,children:(0,R.jsx)(It,{size:20})}),(0,R.jsx)(`span`,{children:`Agentplate`}),(0,R.jsx)(`span`,{className:`ver-pill`,children:`OS`})]}),(0,R.jsx)(`div`,{className:`topbar-spacer`}),(0,R.jsxs)(`button`,{type:`button`,className:`topbar-search`,onClick:()=>b(!0),children:[(0,R.jsx)(ut,{size:15,strokeWidth:2}),(0,R.jsx)(`span`,{children:`Search…`}),(0,R.jsx)(`kbd`,{children:`⌘K`})]}),(0,R.jsx)(Wt,{feed:f,agentNames:E,onSelectAgent:_}),(0,R.jsx)(`div`,{className:`topbar-user`,children:(0,R.jsx)(`span`,{className:`avatar`,children:T})})]}),(0,R.jsx)(`main`,{className:`main`,children:w}),(0,R.jsxs)(`footer`,{className:`statusbar`,children:[(0,R.jsx)($3,{label:`CPU`,value:m?`${m.cpu.percent}%`:`—`,pct:m?.cpu.percent??0}),(0,R.jsx)($3,{label:`RAM`,value:m?`${m.memory.percent}%`:`—`,pct:m?.memory.percent??0}),(0,R.jsx)($3,{label:`DISK`,value:m?.disk.percent==null?`—`:`${m.disk.percent}%`,pct:m?.disk.percent??0}),(0,R.jsx)(`div`,{className:`sb-spacer`}),(0,R.jsxs)(`span`,{className:`sb-item`,children:[(0,R.jsx)(`span`,{className:`sb-dot`,style:{background:n?`var(--ok)`:`var(--err)`}}),(0,R.jsx)(`span`,{className:`sb-key`,children:n?`LIVE`:`OFFLINE`})]}),m?(0,R.jsxs)(`span`,{className:`sb-item`,children:[(0,R.jsx)(`span`,{className:`sb-key`,children:`UPTIME`}),(0,R.jsx)(`span`,{className:`sb-val`,children:ie(m.uptimeSeconds)})]}):null,m?(0,R.jsx)(`span`,{className:`sb-item faint`,children:m.hostname}):null]}),g?(0,R.jsx)(J3,{name:g,onClose:()=>_(null)}):null,(0,R.jsx)(Lt,{open:y,nav:Y3,agents:o.map(e=>e.agentName),onClose:()=>b(!1),onNavigate:e=>t(e),onSelectAgent:_})]})}function $3({label:e,value:t,pct:n}){let r=n>=90?`var(--err)`:n>=70?`var(--warn)`:`var(--ok)`;return(0,R.jsxs)(`span`,{className:`sb-item`,children:[(0,R.jsx)(`span`,{className:`sb-key`,children:e}),(0,R.jsx)(`span`,{className:`sb-val`,children:t}),(0,R.jsx)(`span`,{className:`sb-bar`,children:(0,R.jsx)(`span`,{style:{width:`${Math.min(100,n)}%`,background:r}})})]})}var e6=document.getElementById(`root`);if(!e6)throw Error(`Root element #root not found`);(0,y.createRoot)(e6).render((0,R.jsx)(v.StrictMode,{children:(0,R.jsx)(Q3,{})}));
|
package/ui/dist/index.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<link rel="icon" type="image/svg+xml" href="./favicon.svg" />
|
|
8
8
|
<meta name="theme-color" content="#fb4b38" />
|
|
9
9
|
<title>Agentplate</title>
|
|
10
|
-
<script type="module" crossorigin src="./assets/index-
|
|
10
|
+
<script type="module" crossorigin src="./assets/index-oIei_EDk.js"></script>
|
|
11
11
|
<link rel="stylesheet" crossorigin href="./assets/index-DAq3_wei.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|