agi-farm 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -47
- package/dashboard-dist/assets/{Agents-DgFIbq8z.js → Agents-BGp0VBL6.js} +1 -1
- package/dashboard-dist/assets/{Approvals-BQCkyOKZ.js → Approvals-wArbqSa0.js} +1 -1
- package/dashboard-dist/assets/{Broadcast-C1P7QZAp.js → Broadcast-CMCcYnIx.js} +1 -1
- package/dashboard-dist/assets/{Comms-DfoH3vg_.js → Comms-zQvLg7tX.js} +1 -1
- package/dashboard-dist/assets/{Crons-hqntDvlR.js → Crons-BzbHl0I3.js} +1 -1
- package/dashboard-dist/assets/{HITL-D6eTUZeZ.js → HITL-CwEsd-qm.js} +1 -1
- package/dashboard-dist/assets/{Jobs-VwINz0NT.js → Jobs-CV2HnDQL.js} +1 -1
- package/dashboard-dist/assets/{Knowledge-C15Hq12L.js → Knowledge-C0I0KvXG.js} +1 -1
- package/dashboard-dist/assets/{Tasks-CEzAlrR1.js → Tasks-CM3yheWF.js} +1 -1
- package/dashboard-dist/assets/index-BFnAHHHY.js +2 -0
- package/dashboard-dist/assets/{index-Csnw3mqG.css → index-DaVmOqH2.css} +1 -1
- package/dashboard-dist/index.html +2 -2
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -1
- package/openclaw.plugin.json +10 -1
- package/package.json +1 -1
- package/server/dashboard.js +32 -1
- package/server/updater.js +154 -0
- package/dashboard-dist/assets/index-DW5W626L.js +0 -2
package/README.md
CHANGED
|
@@ -29,34 +29,40 @@
|
|
|
29
29
|
| 🔄 **Auto-Dispatcher** | Smart task delegation with HITL, backoff & dependencies |
|
|
30
30
|
| 📦 **Portable Bundle** | Export your entire team to GitHub with one command |
|
|
31
31
|
| 🏗️ **ESM Native** | Built for Node 20+ with full ES Module support |
|
|
32
|
-
| 🛡️ **Production Hardened** | Security-audited with CSRF, Origin validation, and timing-safe auth |
|
|
32
|
+
| 🛡️ **Production Hardened** | Security-audited with CSRF, Origin validation, CSP headers, and timing-safe auth |
|
|
33
|
+
| 🔄 **Auto-Update** | Detects new releases on GitHub with one-click install from the dashboard |
|
|
33
34
|
| ⚙️ **Feature-Flagged Runtime** | Optional jobs, skills, memory, policy, approvals, and metering modules |
|
|
34
35
|
| 🧪 **103 Automated Tests** | Unit + integration + API smoke coverage with Jest/ESM |
|
|
35
36
|
|
|
36
37
|
---
|
|
37
38
|
|
|
38
|
-
## 🆕
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
|
|
59
|
-
|
|
39
|
+
## 🆕 What's New in v1.1.0
|
|
40
|
+
|
|
41
|
+
### Auto-Update System
|
|
42
|
+
- 🔄 **GitHub release detection**: plugin polls GitHub Releases API (6-hour cache) to detect new versions
|
|
43
|
+
- 📢 **Dashboard update banner**: amber notification bar shows current → latest version with release notes link
|
|
44
|
+
- ⚡ **One-click install**: "Update Now" button runs `npm install -g agi-farm@latest` directly from the dashboard
|
|
45
|
+
- ⚙️ **Configurable**: `autoCheckUpdates` option in plugin config (default: `true`)
|
|
46
|
+
|
|
47
|
+
### Feature-Flagged Core Runtime
|
|
48
|
+
- 🚀 **Core runtime added**: jobs, background worker, skills, memory index, policy gates, approvals, audit log, and usage metering
|
|
49
|
+
- 🧭 **New dashboard tabs**: Jobs, Approvals, Usage, Processes, Failures, Decisions, Memory
|
|
50
|
+
- 🔌 **New REST APIs**: `/api/jobs`, `/api/skills`, `/api/memory/search`, `/api/policies`, `/api/approvals`, `/api/usage`
|
|
51
|
+
- 🧪 **API integration smoke tests**: dashboard server tested end-to-end
|
|
52
|
+
|
|
53
|
+
### Interactive Dashboard
|
|
54
|
+
- ➕ **Task Creation** — create tasks directly from the Tasks tab with assignee, priority, and dependencies
|
|
55
|
+
- 💬 **Agent Messaging** — send messages to individual agents from their cards
|
|
56
|
+
- 📝 **Broadcast Compose** — post team-wide announcements from the Broadcast tab
|
|
57
|
+
- 📚 **Knowledge CRUD** — add and remove knowledge entries from the dashboard
|
|
58
|
+
- 🔍 **Search & Sort** — filter tasks and agents with real-time search; sortable task columns
|
|
59
|
+
|
|
60
|
+
### Security & Infrastructure
|
|
61
|
+
- 🔐 **CSRF + Origin hardening**: same-origin validation, timing-safe auth, CSP headers
|
|
62
|
+
- 🛡️ **Input validation**: `isSafeId()`, `sanitizeNote()`, path traversal protection
|
|
63
|
+
- 🧪 **103 automated tests** — unit, integration, API, updater, data extraction
|
|
64
|
+
- 🔔 **Toast notifications** — non-blocking success/error toasts for all actions
|
|
65
|
+
- 🛡️ **Atomic file writes** — `.tmp` → `rename` pattern with in-memory file locks
|
|
60
66
|
|
|
61
67
|
---
|
|
62
68
|
|
|
@@ -64,22 +70,26 @@
|
|
|
64
70
|
|
|
65
71
|
### Dashboard Overview
|
|
66
72
|
```
|
|
67
|
-
|
|
68
|
-
│ 🦅 AGI
|
|
69
|
-
|
|
70
|
-
│
|
|
71
|
-
|
|
72
|
-
│
|
|
73
|
-
|
|
74
|
-
│
|
|
75
|
-
│
|
|
76
|
-
│
|
|
77
|
-
│ │
|
|
78
|
-
│
|
|
79
|
-
│
|
|
80
|
-
│
|
|
81
|
-
│
|
|
82
|
-
|
|
73
|
+
┌──────────────────────────────────────────────────────────────────────┐
|
|
74
|
+
│ 🦅 AGI Ops Room ● LIVE Online: 8/11 Pending: 4 Budget: $45 │
|
|
75
|
+
├──────────────────────────────────────────────────────────────────────┤
|
|
76
|
+
│ 🔄 Update available: v1.0.2 → v1.1.0 [Release Notes] [Update Now]│
|
|
77
|
+
├──────────────────────────────────────────────────────────────────────┤
|
|
78
|
+
│ Overview │ Agents │ Tasks │ Projects │ Crons │ HITL │ Alerts │ ... │
|
|
79
|
+
├──────────────────────────────────────────────────────────────────────┤
|
|
80
|
+
│ │
|
|
81
|
+
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
|
|
82
|
+
│ │ 📊 42 │ │ ✅ 38 │ │ ⏳ 4 │ │ 🚨 2 │ │
|
|
83
|
+
│ │ Tasks │ │ Done │ │ Active │ │ HITL │ │
|
|
84
|
+
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
|
|
85
|
+
│ │
|
|
86
|
+
│ ┌───────────────────────────────────────────────────────────┐ │
|
|
87
|
+
│ │ 🔮 Sage ✅ Ready 📨 3 msgs ⭐ 94% [Send Message] │ │
|
|
88
|
+
│ │ ⚒️ Forge 🔄 Busy 📨 7 msgs ⭐ 89% [Send Message] │ │
|
|
89
|
+
│ │ 🐛 Pixel ✅ Ready 📨 2 msgs ⭐ 96% [Send Message] │ │
|
|
90
|
+
│ └───────────────────────────────────────────────────────────┘ │
|
|
91
|
+
│ │
|
|
92
|
+
└──────────────────────────────────────────────────────────────────────┘
|
|
83
93
|
```
|
|
84
94
|
|
|
85
95
|
### Team Architecture
|
|
@@ -174,7 +184,8 @@ Answer the setup prompts and your team will be live in ~2 minutes:
|
|
|
174
184
|
├── 📂 dist/ Compiled TypeScript (backend)
|
|
175
185
|
├── 📂 dashboard-dist/ Built React frontend (production)
|
|
176
186
|
├── 🌐 server/
|
|
177
|
-
│ ├── 🖥️ dashboard.js SSE server (Node.js)
|
|
187
|
+
│ ├── 🖥️ dashboard.js SSE server + CRUD API (Node.js)
|
|
188
|
+
│ ├── 🔄 updater.js GitHub release checker + auto-update
|
|
178
189
|
│ └── 🛠️ utils.js Core parsing & logic (Unit Tested)
|
|
179
190
|
├── 📜 scripts/
|
|
180
191
|
│ ├── 🎯 setup.js Setup wizard
|
|
@@ -215,13 +226,13 @@ Answer the setup prompts and your team will be live in ~2 minutes:
|
|
|
215
226
|
│ │ SlowDataCache │ │ Broadcaster │ │
|
|
216
227
|
│ │ (30s cache) │───▶│ (SSE fan-out) │ │
|
|
217
228
|
│ └─────────────────────┘ └──────────────────┘ │
|
|
218
|
-
│
|
|
219
|
-
│
|
|
220
|
-
│
|
|
221
|
-
│
|
|
222
|
-
│
|
|
223
|
-
│
|
|
224
|
-
│
|
|
229
|
+
│ │ │ │
|
|
230
|
+
│ ┌─────────────────────┐ │ SSE stream │
|
|
231
|
+
│ │ UpdateChecker │ ▼ │
|
|
232
|
+
│ │ (6h GitHub cache) │ ┌──────────────────┐ │
|
|
233
|
+
│ └─────────────────────┘ │ React Frontend │ │
|
|
234
|
+
│ │ (Vite + Recharts)│ │
|
|
235
|
+
│ └──────────────────┘ │
|
|
225
236
|
│ │
|
|
226
237
|
└──────────────────────────────────────────────────────────────┘
|
|
227
238
|
```
|
|
@@ -337,6 +348,7 @@ Configure AGI Farm in your `openclaw.json`:
|
|
|
337
348
|
"dashboardPort": 8080,
|
|
338
349
|
"dashboardHost": "127.0.0.1",
|
|
339
350
|
"autoStartDashboard": true,
|
|
351
|
+
"autoCheckUpdates": true,
|
|
340
352
|
"workspacePath": "~/.openclaw/workspace",
|
|
341
353
|
"bundlePath": "~/.openclaw/workspace/agi-farm-bundle",
|
|
342
354
|
"featureJobs": false,
|
|
@@ -359,6 +371,7 @@ Configure AGI Farm in your `openclaw.json`:
|
|
|
359
371
|
| `dashboardPort` | number | 8080 | Port for live ops dashboard |
|
|
360
372
|
| `dashboardHost` | string | "127.0.0.1" | Bind address for dashboard |
|
|
361
373
|
| `autoStartDashboard` | boolean | true | Auto-start dashboard on load |
|
|
374
|
+
| `autoCheckUpdates` | boolean | true | Check GitHub for new releases on startup |
|
|
362
375
|
| `workspacePath` | string | ~/.openclaw/workspace | Path to OpenClaw workspace |
|
|
363
376
|
| `bundlePath` | string | <workspace>/agi-farm-bundle | Path to bundle directory |
|
|
364
377
|
| `featureJobs` | boolean | false | Enable jobs runtime APIs + background worker |
|
|
@@ -411,6 +424,7 @@ All data updates in real-time from workspace files:
|
|
|
411
424
|
|
|
412
425
|
The dashboard enables direct control over team operations via authenticated REST endpoints (all require CSRF token):
|
|
413
426
|
|
|
427
|
+
**HITL & Cron Controls:**
|
|
414
428
|
- `POST /api/hitl/:id/approve` — Continue task with optional notes
|
|
415
429
|
- `POST /api/hitl/:id/reject` — Block task and notify agent
|
|
416
430
|
- `POST /api/cron/:id/trigger` — Manually run a specific cron job
|
|
@@ -424,6 +438,17 @@ The dashboard enables direct control over team operations via authenticated REST
|
|
|
424
438
|
- `GET /api/approvals` + `POST /api/approvals/:id/(approve|reject)` — Human approval queue
|
|
425
439
|
- `GET /api/usage` — Usage and cost aggregates for dashboard
|
|
426
440
|
|
|
441
|
+
**CRUD Operations:**
|
|
442
|
+
- `POST /api/task` — Create a new task with assignee, priority, dependencies
|
|
443
|
+
- `POST /api/agent/:id/message` — Send a message to a specific agent
|
|
444
|
+
- `POST /api/broadcast` — Post a team-wide broadcast message
|
|
445
|
+
- `POST /api/knowledge` — Add a shared knowledge entry
|
|
446
|
+
- `DELETE /api/knowledge/:id` — Remove a knowledge entry
|
|
447
|
+
|
|
448
|
+
**Auto-Update:**
|
|
449
|
+
- `GET /api/update-check` — Force a fresh GitHub release check
|
|
450
|
+
- `POST /api/update-install` — Install latest version via npm
|
|
451
|
+
|
|
427
452
|
**Total push latency:** ~350ms from file change to browser update
|
|
428
453
|
|
|
429
454
|
---
|
|
@@ -554,6 +579,8 @@ This plugin is designed with defense-in-depth security:
|
|
|
554
579
|
| **Note sanitization** | HITL notes stripped of control chars; CLI flag injection prevented |
|
|
555
580
|
| **Rate limiting** | 120 req/min (read), 30 req/min (mutations) per IP |
|
|
556
581
|
| **File locking** | Cron file writes use mutex to prevent concurrent corruption |
|
|
582
|
+
| **Atomic writes** | All file mutations use `.tmp` → `rename` pattern with in-memory locks |
|
|
583
|
+
| **Shell injection** | Update installer uses `execFile` (not `exec`) to prevent injection |
|
|
557
584
|
| **Credential isolation** | Uses OpenClaw CLI — no API keys stored in plugin |
|
|
558
585
|
| Supports encrypted secrets (`SECRETS/`, AES-256-GCM) | Expose secret values in API responses |
|
|
559
586
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as p,a4 as e}from"./vendor-5MxLWm27.js";import{a as f}from"./index-
|
|
1
|
+
import{r as p,a4 as e}from"./vendor-5MxLWm27.js";import{a as f}from"./index-BFnAHHHY.js";import{L as h}from"./LastUpdated-BVeFtHFH.js";function S({data:s,lastUpdated:r,toast:d}){const{agents:c=[],cache_age_seconds:i}=s,l=i??null,[o,g]=p.useState(""),m=c.filter(t=>{if(!o)return!0;const a=o.toLowerCase();return(t.name||"").toLowerCase().includes(a)||(t.id||"").toLowerCase().includes(a)||(t.role||"").toLowerCase().includes(a)});return e.jsxs("div",{className:"fade-in",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",marginBottom:12,gap:12,flexWrap:"wrap"},children:[e.jsx("input",{className:"input-base",placeholder:"Search agents...",value:o,onChange:t=>g(t.target.value),style:{flex:"0 1 200px"}}),e.jsxs("span",{style:{fontSize:10,color:"var(--muted)"},children:[m.length," agent",m.length!==1?"s":""]}),l!=null&&e.jsxs("span",{style:{fontSize:10,color:l>25?"var(--amber)":"var(--muted)"},children:["🔄 cached ",l,"s ago"]}),e.jsx(h,{ts:r})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(280px,1fr))",gap:14},children:m.map(t=>e.jsx(v,{agent:t,toast:d},t.id))})]})}function v({agent:s,toast:r}){const[d,c]=p.useState(!1),[i,l]=p.useState(""),[o,g]=p.useState(!1),m={active:"dot-active",available:"dot-available",busy:"dot-busy",error:"dot-error"}[s.status]||"dot-offline",t={active:"badge-active",available:"badge-available",busy:"badge-busy",error:"badge-error"}[s.status]||"badge-offline",a=s.credibility??1,u=async()=>{if(i.trim()){g(!0);try{await f(`/api/comms/${s.id}/send`,{message:i.trim()}),r(`Message sent to ${s.name}`,"success"),l(""),c(!1)}catch(n){r(n.message,"error")}g(!1)}};return e.jsxs("div",{className:"card",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:12},children:[e.jsx("span",{style:{fontSize:28},children:s.emoji||"🤖"}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:700,fontSize:15},children:s.name}),e.jsx("div",{style:{color:"var(--muted)",fontSize:11},children:s.role})]}),e.jsxs("div",{style:{textAlign:"right"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,justifyContent:"flex-end"},children:[e.jsx("span",{className:`dot ${m}`}),e.jsx("span",{className:`badge ${t}`,children:s.status})]}),s.inbox_count>0&&e.jsxs("div",{style:{fontSize:11,color:"var(--amber)",marginTop:4},children:["📬 ",s.inbox_count," msgs"]})]})]}),e.jsx("div",{style:{fontSize:10,color:"var(--muted)",marginBottom:10,fontFamily:"monospace"},children:s.model||"—"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:8,marginBottom:10},children:[e.jsx(x,{label:"Done",value:s.tasks_completed??0}),e.jsx(x,{label:"Failed",value:s.tasks_failed??0,color:"var(--red)"}),e.jsx(x,{label:"Quality",value:`⭐${(s.quality_score||0).toFixed(1)}`,color:"var(--amber)"})]}),e.jsxs("div",{style:{fontSize:9,color:"var(--muted)",marginBottom:10,display:"flex",justifyContent:"space-between"},children:[e.jsxs("span",{children:["Heartbeat: ",s.heartbeat_age_minutes!=null?`${s.heartbeat_age_minutes}m ago`:"offline"]}),e.jsxs("span",{children:["ID: ",s.id]})]}),e.jsxs("div",{style:{marginBottom:10},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:10,color:"var(--muted)",marginBottom:4},children:[e.jsx("span",{children:"Credibility"}),e.jsxs("span",{children:[(a*100).toFixed(0),"%"]})]}),e.jsx("div",{className:"progress-track",children:e.jsx("div",{className:"progress-fill",style:{width:`${a*100}%`,background:a>.8?"var(--green)":a>.5?"var(--amber)":"var(--red)"}})})]}),s.specializations?.length>0&&e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:10},children:s.specializations.map(n=>e.jsx("span",{style:{fontSize:9,padding:"2px 6px",background:"rgba(0,229,255,.07)",color:"var(--cyan)",border:"1px solid rgba(0,229,255,.2)",borderRadius:3},children:n},n))}),d?e.jsxs("div",{style:{display:"flex",gap:6,marginTop:8},children:[e.jsx("input",{className:"input-base",style:{flex:1},placeholder:"Type a message...",value:i,onChange:n=>l(n.target.value),onKeyDown:n=>n.key==="Enter"&&u(),maxLength:2e3}),e.jsx("button",{className:"btn-primary",onClick:u,disabled:o||!i.trim(),children:o?"...":"Send"}),e.jsx("button",{className:"input-base",style:{cursor:"pointer",padding:"4px 8px"},onClick:()=>c(!1),children:"X"})]}):e.jsx("button",{className:"input-base",style:{width:"100%",cursor:"pointer",marginTop:8,textAlign:"center",fontSize:10,color:"var(--muted)"},onClick:()=>c(!0),children:"Send Message"})]})}function x({label:s,value:r,color:d="var(--text)"}){return e.jsxs("div",{style:{textAlign:"center",padding:"6px",background:"var(--surface)",borderRadius:4},children:[e.jsx("div",{style:{fontSize:9,color:"var(--muted)",marginBottom:2},children:s}),e.jsx("div",{style:{fontSize:14,fontWeight:700,color:d},children:r})]})}export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as v,a4 as r}from"./vendor-5MxLWm27.js";import{L as x}from"./LastUpdated-BVeFtHFH.js";import{d as u,e as h}from"./index-
|
|
1
|
+
import{r as v,a4 as r}from"./vendor-5MxLWm27.js";import{L as x}from"./LastUpdated-BVeFtHFH.js";import{d as u,e as h}from"./index-BFnAHHHY.js";function b({data:t,lastUpdated:i}){const{approvals:n=[],featureFlags:o={}}=t,[s,l]=v.useState({});if(!o.approvals)return r.jsx("div",{className:"card",children:"Approvals feature is disabled. Enable `featureApprovals` in plugin config."});const a=n.filter(e=>e.status==="pending");async function d(e){try{await u(e,s[e]||"")}catch{}}async function p(e){try{await h(e,s[e]||"")}catch{}}return r.jsxs("div",{className:"fade-in",style:{display:"grid",gap:14},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[r.jsxs("div",{className:"section-title",style:{marginBottom:0},children:["Approvals (",a.length," pending)"]}),r.jsx(x,{ts:i})]}),a.length===0&&r.jsx("div",{className:"card",style:{color:"var(--muted)"},children:"No pending approvals."}),a.map(e=>r.jsxs("div",{className:"card",style:{display:"grid",gap:8},children:[r.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[r.jsx("span",{style:{fontWeight:700},children:e.action}),r.jsx("span",{className:"badge badge-hitl",children:"pending"}),r.jsx("span",{style:{color:"var(--muted)",fontSize:10},children:e.id})]}),r.jsxs("div",{style:{color:"var(--muted)",fontSize:12},children:["Job: ",e.jobId]}),r.jsxs("div",{style:{color:"var(--muted)",fontSize:12},children:["Reason: ",e.note||"approval required"]}),r.jsx("input",{value:s[e.id]||"",onChange:c=>l(g=>({...g,[e.id]:c.target.value})),placeholder:"Optional note",style:{width:"100%",background:"var(--bg3)",border:"1px solid var(--border)",borderRadius:6,color:"var(--text)",padding:"8px 10px",fontFamily:"inherit"}}),r.jsxs("div",{style:{display:"flex",gap:8},children:[r.jsx("button",{onClick:()=>d(e.id),style:{background:"rgba(0,230,118,.1)",border:"1px solid rgba(0,230,118,.35)",color:"var(--green)",borderRadius:5,padding:"5px 10px",cursor:"pointer",fontFamily:"inherit",fontSize:11},children:"Approve"}),r.jsx("button",{onClick:()=>p(e.id),style:{background:"rgba(255,23,68,.1)",border:"1px solid rgba(255,23,68,.35)",color:"var(--red)",borderRadius:5,padding:"5px 10px",cursor:"pointer",fontFamily:"inherit",fontSize:11},children:"Reject"})]})]},e.id))]})}export{b as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as n,a4 as t}from"./vendor-5MxLWm27.js";import{a as m}from"./index-
|
|
1
|
+
import{r as n,a4 as t}from"./vendor-5MxLWm27.js";import{a as m}from"./index-BFnAHHHY.js";function v({data:a,toast:e}){const{broadcast:s=""}=a,i=n.useRef(null);n.useEffect(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)},[s]);const[o,l]=n.useState(""),[c,d]=n.useState(!1),u=async()=>{if(o.trim()){d(!0);try{await m("/api/broadcast",{message:o.trim()}),e("Broadcast posted","success"),l("")}catch(r){e(r.message,"error")}d(!1)}},p=s.split(`
|
|
2
2
|
`);return t.jsxs("div",{className:"fade-in",children:[t.jsxs("div",{style:{display:"flex",gap:8,marginBottom:10},children:[t.jsx("input",{className:"input-base",style:{flex:1},placeholder:"Post a broadcast message...",value:o,onChange:r=>l(r.target.value),onKeyDown:r=>r.key==="Enter"&&u(),maxLength:2e3}),t.jsx("button",{className:"btn-primary",onClick:u,disabled:c||!o.trim(),children:c?"Posting...":"Post"})]}),t.jsxs("div",{style:{background:"var(--bg2)",border:"1px solid var(--border)",borderRadius:8,padding:16,fontFamily:"JetBrains Mono, monospace",fontSize:12,height:"calc(100vh - 160px)",overflowY:"auto"},ref:i,children:[p.length===0||s.trim()===""?t.jsx("span",{style:{color:"var(--muted)"},children:"No broadcasts yet."}):p.map((r,f)=>t.jsx(g,{line:r},f)),t.jsx("div",{style:{height:8}})]})]})}function g({line:a}){const e=a.toLowerCase();let s="var(--text)";return e.includes("[critical]")||e.includes("🔴")?s="var(--red)":e.includes("[blocked]")||e.includes("⚠")?s="var(--amber)":e.includes("[hitl]")||e.includes("🚨")?s="var(--purple)":e.includes("[done]")||e.includes("✅")?s="var(--green)":a.startsWith("#")?s="var(--cyan)":a.startsWith("---")?s="rgba(84,110,122,.5)":(e.includes("task_id:")||e.includes("from:"))&&(s="var(--muted)"),t.jsx("div",{style:{color:s,padding:"1px 0",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a||" "})}export{v as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as x,a4 as s}from"./vendor-5MxLWm27.js";import{a as C}from"./index-
|
|
1
|
+
import{r as x,a4 as s}from"./vendor-5MxLWm27.js";import{a as C}from"./index-BFnAHHHY.js";import{L as z}from"./LastUpdated-BVeFtHFH.js";function w({content:r,label:d,color:o}){if(!r||r.trim()===""||r.trim()===`# ${d}
|
|
2
2
|
|
|
3
3
|
_No messages._`)return s.jsxs("div",{style:{color:"var(--muted)",fontSize:11,padding:"8px 0"},children:["No ",d.toLowerCase()," messages."]});const c=r.split(`
|
|
4
4
|
`);return s.jsx("div",{style:{fontFamily:"monospace",fontSize:11,lineHeight:1.7,maxHeight:400,overflowY:"auto"},children:c.map((t,i)=>{let n="var(--text)";return t.startsWith("## ")||t.startsWith("# ")?n=o:t.startsWith("---")?n="rgba(255,255,255,.1)":t.startsWith("- ")?n="var(--muted)":t.startsWith("**")&&(n="var(--amber)"),s.jsx("div",{style:{color:n,padding:"1px 0",borderBottom:t.startsWith("---")?"1px solid rgba(255,255,255,.06)":"none"},children:t||" "},i)})})}function L({data:r,lastUpdated:d,toast:o}){const{comms:c={},agents:t=[]}=r,[i,n]=x.useState(t[0]?.id||null),[a,b]=x.useState("inbox"),[m,p]=x.useState(""),[g,f]=x.useState(!1),y=async()=>{if(!(!m.trim()||!i)){f(!0);try{await C(`/api/comms/${i}/send`,{message:m.trim()}),o("Message sent","success"),p("")}catch(e){o(e.message,"error")}f(!1)}},v=c[i]||{inbox:"",outbox:""},l=t.find(e=>e.id===i),u=e=>(e?.match(/^## /gm)||[]).length;return s.jsxs("div",{className:"fade-in",style:{display:"grid",gridTemplateColumns:"200px 1fr",gap:14,minHeight:500},children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[s.jsx("div",{className:"section-title",children:"Agents"}),t.map(e=>{const h=c[e.id]||{},j=u(h.inbox),S=u(h.outbox);return s.jsxs("button",{onClick:()=>n(e.id),style:{background:i===e.id?"rgba(0,229,255,.12)":"var(--surface)",border:`1px solid ${i===e.id?"rgba(0,229,255,.4)":"var(--border)"}`,borderRadius:6,padding:"8px 10px",cursor:"pointer",textAlign:"left",display:"flex",alignItems:"center",gap:8,fontFamily:"inherit"},children:[s.jsx("span",{style:{fontSize:18},children:e.emoji}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsx("div",{style:{fontSize:12,fontWeight:600,color:i===e.id?"var(--cyan)":"var(--text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),s.jsxs("div",{style:{fontSize:10,color:"var(--muted)"},children:["📬",j," · 📤",S]})]})]},e.id)})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[l&&s.jsx("span",{style:{fontSize:20},children:l.emoji}),l&&s.jsx("span",{style:{fontWeight:700,fontSize:14},children:l.name}),s.jsx("div",{style:{display:"flex",gap:4,marginLeft:8},children:["inbox","outbox"].map(e=>s.jsxs("button",{onClick:()=>b(e),style:{background:a===e?"rgba(0,229,255,.15)":"var(--surface)",border:`1px solid ${a===e?"rgba(0,229,255,.4)":"var(--border)"}`,color:a===e?"var(--cyan)":"var(--muted)",padding:"4px 12px",borderRadius:4,fontSize:11,cursor:"pointer",fontFamily:"inherit",textTransform:"capitalize"},children:[e==="inbox"?"📬":"📤"," ",e]},e))}),s.jsx(z,{ts:d})]}),s.jsx("div",{className:"card",style:{flex:1},children:s.jsx(w,{content:v[a],label:a==="inbox"?"Inbox":"Outbox",color:a==="inbox"?"var(--cyan)":"var(--green)"})}),i&&s.jsxs("div",{className:"card",style:{display:"flex",gap:8,alignItems:"flex-end"},children:[s.jsx("textarea",{className:"input-base",placeholder:`Send message to ${l?.name||i}...`,value:m,onChange:e=>p(e.target.value),style:{flex:1,minHeight:60,resize:"vertical",fontFamily:"inherit"},maxLength:2e3}),s.jsx("button",{className:"btn-primary",onClick:y,disabled:g||!m.trim(),children:g?"Sending...":"Send"})]})]})]})}export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,a4 as r}from"./vendor-5MxLWm27.js";import{L as b}from"./LastUpdated-BVeFtHFH.js";import{a as m}from"./index-
|
|
1
|
+
import{r as x,a4 as r}from"./vendor-5MxLWm27.js";import{L as b}from"./LastUpdated-BVeFtHFH.js";import{a as m}from"./index-BFnAHHHY.js";function _(e){return e?e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.round(e/6e4)}m ${Math.round(e%6e4/1e3)}s`:"—"}function v(e){return e==null?"—":e<0?"overdue":e<60?`${e}s`:e<3600?`${Math.round(e/60)}m`:`${Math.round(e/3600)}h`}function S(e){return e==null?"—":e<60?`${e}s ago`:e<3600?`${Math.round(e/60)}m ago`:`${Math.round(e/3600)}h ago`}function j({status:e,errors:o}){return o>=3?r.jsx("span",{className:"dot dot-error",title:`${o} consecutive errors`}):e==="error"?r.jsx("span",{className:"dot dot-error"}):e==="running"?r.jsx("span",{className:"dot dot-active"}):e==="ok"?r.jsx("span",{className:"dot dot-available"}):r.jsx("span",{className:"dot dot-offline"})}function k({job:e,agents:o,onTrigger:s,onToggle:f}){const[a,c]=x.useState(!1),[l,u]=x.useState(!1),[i,g]=x.useState(e.enabled!==!1),d=o.find(p=>p.id===e.agentId),t=e._consecutive_errors||0,n=t>=3||e._status==="error";async function h(){c(!0),await m(`/api/cron/${e.id}/trigger`),s?.(e.id),setTimeout(()=>c(!1),2e3)}async function y(){u(!0);const p=await m(`/api/cron/${e.id}/toggle`);p.ok&&g(p.enabled),u(!1),f?.(e.id,p.enabled)}return r.jsxs(r.Fragment,{children:[r.jsxs("tr",{style:{borderBottom:"1px solid rgba(255,255,255,.03)",background:n?"rgba(255,23,68,.03)":"transparent",opacity:i?1:.5},children:[r.jsx("td",{style:{padding:"8px 12px"},children:r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[r.jsx(j,{status:e._status,errors:t}),r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:12,fontWeight:t>=3?700:400,color:n?"var(--red)":"var(--text)"},children:e.name}),e.description&&r.jsx("div",{style:{fontSize:10,color:"var(--muted)"},children:e.description.slice(0,60)})]})]})}),r.jsx("td",{style:{padding:"8px 12px",fontSize:11},children:d?r.jsxs("span",{children:[d.emoji," ",d.name]}):r.jsx("span",{style:{color:"var(--muted)"},children:e.agentId})}),r.jsx("td",{style:{padding:"8px 12px",fontSize:10,color:"var(--muted)",fontFamily:"monospace"},children:e.schedule?.kind==="every"?`every ${Math.round((e.schedule.everyMs||0)/6e4)}m`:e.schedule?.cronExpression||e.schedule?.kind||"—"}),r.jsx("td",{style:{padding:"8px 12px",fontSize:11,color:v(e._next_run_sec)==="overdue"?"var(--red)":"var(--muted)"},children:v(e._next_run_sec)}),r.jsx("td",{style:{padding:"8px 12px",fontSize:11,color:"var(--muted)"},children:S(e._last_run_sec)}),r.jsx("td",{style:{padding:"8px 12px",fontSize:11,color:"var(--muted)"},children:_(e._duration_ms)}),r.jsxs("td",{style:{padding:"8px 12px"},children:[n&&r.jsxs("span",{style:{fontSize:10,padding:"2px 6px",borderRadius:3,fontWeight:700,background:"rgba(255,23,68,.15)",color:"var(--red)",border:"1px solid rgba(255,23,68,.3)"},children:[t,"× err"]}),!n&&e._status==="ok"&&r.jsx("span",{style:{fontSize:10,padding:"2px 6px",borderRadius:3,background:"rgba(0,230,118,.1)",color:"var(--green)",border:"1px solid rgba(0,230,118,.25)"},children:"ok"})]}),r.jsx("td",{style:{padding:"8px 12px"},children:r.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[r.jsx("button",{onClick:h,disabled:a,title:"Trigger now",style:{background:"rgba(0,229,255,.1)",border:"1px solid rgba(0,229,255,.3)",color:"var(--cyan)",padding:"3px 8px",borderRadius:4,cursor:a?"not-allowed":"pointer",fontSize:10,fontFamily:"inherit"},children:a?"...":"▶ Run"}),r.jsx("button",{onClick:y,disabled:l,title:i?"Disable":"Enable",style:{background:i?"rgba(255,214,0,.08)":"rgba(0,230,118,.08)",border:`1px solid ${i?"rgba(255,214,0,.3)":"rgba(0,230,118,.3)"}`,color:i?"var(--amber)":"var(--green)",padding:"3px 8px",borderRadius:4,cursor:l?"not-allowed":"pointer",fontSize:10,fontFamily:"inherit"},children:l?"...":i?"⏸ Off":"▶ On"})]})})]}),n&&e._last_error&&r.jsx("tr",{style:{background:"rgba(255,23,68,.04)"},children:r.jsxs("td",{colSpan:8,style:{padding:"4px 12px 8px 40px",fontSize:10,color:"var(--red)",fontFamily:"monospace"},children:["↳ ",e._last_error]})})]})}function w({data:e,lastUpdated:o}){const{crons:s=[],agents:f=[]}=e,[a,c]=x.useState("all"),l=s.filter(t=>(t._consecutive_errors||0)>=3||t._status==="error"),u=s.filter(t=>t._status==="running"),i=s.filter(t=>t.enabled===!1),g=s.filter(t=>a==="error"?(t._consecutive_errors||0)>=3||t._status==="error":a==="running"?t._status==="running":a==="disabled"?t.enabled===!1:!0),d={};return g.forEach(t=>{const n=t.agentId||"unknown";d[n]||(d[n]=[]),d[n].push(t)}),r.jsxs("div",{className:"fade-in",style:{display:"grid",gap:14},children:[r.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4,1fr)",gap:10},children:[["Total",s.length,"var(--muted)"],["Erroring",l.length,l.length?"var(--red)":"var(--muted)"],["Running",u.length,u.length?"var(--cyan)":"var(--muted)"],["Disabled",i.length,i.length?"var(--amber)":"var(--muted)"]].map(([t,n,h])=>r.jsxs("div",{className:"card",style:{textAlign:"center",cursor:"pointer"},onClick:()=>c(t.toLowerCase()),children:[r.jsx("div",{className:"section-title",children:t}),r.jsx("div",{style:{fontSize:22,fontWeight:700,color:h},children:n})]},t))}),r.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[["all","error","running","disabled"].map(t=>r.jsx("button",{onClick:()=>c(t),style:{background:a===t?"rgba(0,229,255,.15)":"var(--surface)",border:`1px solid ${a===t?"rgba(0,229,255,.4)":"var(--border)"}`,color:a===t?"var(--cyan)":"var(--muted)",padding:"4px 12px",borderRadius:4,fontSize:11,cursor:"pointer",fontFamily:"inherit"},children:t},t)),r.jsx(b,{ts:o})]}),r.jsx("div",{className:"card",style:{padding:0,overflow:"hidden"},children:r.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[r.jsx("thead",{children:r.jsx("tr",{style:{background:"var(--bg3)",borderBottom:"1px solid var(--border)"},children:["Job","Agent","Schedule","Next","Last Run","Duration","Status","Actions"].map(t=>r.jsx("th",{style:{padding:"8px 12px",textAlign:"left",fontSize:10,color:"var(--muted)",fontWeight:600,textTransform:"uppercase",letterSpacing:".05em"},children:t},t))})}),r.jsxs("tbody",{children:[g.length===0&&r.jsx("tr",{children:r.jsx("td",{colSpan:8,style:{padding:"20px",color:"var(--muted)",textAlign:"center"},children:"No cron jobs match filter"})}),g.map(t=>r.jsx(k,{job:t,agents:f},t.id))]})]})})]})}export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as g,a4 as e}from"./vendor-5MxLWm27.js";import{L as h}from"./LastUpdated-BVeFtHFH.js";import{a as f}from"./index-
|
|
1
|
+
import{r as g,a4 as e}from"./vendor-5MxLWm27.js";import{L as h}from"./LastUpdated-BVeFtHFH.js";import{a as f}from"./index-BFnAHHHY.js";function v(t){if(!t)return"—";try{const i=Math.round((Date.now()-new Date(t))/6e4);return i<1?"just now":i<60?`${i}m ago`:i<1440?`${Math.round(i/60)}h ago`:`${Math.round(i/1440)}d ago`}catch{return t}}function m({task:t,agents:i,onAction:p}){const[c,a]=g.useState(""),[n,r]=g.useState(null),l=i.find(s=>s.id===t.assigned_to),o=v(t.created_at),d=(t.sla?.priority||t.priority||"").toUpperCase();async function x(s){r(s);try{await f(`/api/hitl/${t.id}/${s}`,{note:c||void 0}),p(t.id,s)}catch(u){console.error(u)}r(null)}return e.jsxs("div",{style:{background:"var(--bg2)",border:"1px solid rgba(224,64,251,.35)",borderRadius:10,padding:18,display:"grid",gap:14,boxShadow:"0 0 20px rgba(224,64,251,.08)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12},children:[e.jsx("span",{style:{fontSize:28},children:"🚨"}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontWeight:700,fontSize:15},children:t.title}),e.jsx("span",{style:{fontSize:10,fontFamily:"monospace",color:"var(--muted)"},children:t.id}),d&&e.jsx("span",{className:d==="P1"?"p1":d==="P2"?"p2":"p3",children:d})]}),e.jsxs("div",{style:{fontSize:11,color:"var(--muted)"},children:[l&&e.jsxs("span",{children:[l.emoji," ",l.name," · "]}),"Waiting ",e.jsx("span",{style:{color:"var(--amber)",fontWeight:600},children:o}),t.sla?.deadline&&e.jsxs("span",{children:[" · Due ",new Date(t.sla.deadline).toLocaleString()]})]})]})]}),e.jsxs("div",{style:{padding:"12px 14px",background:"rgba(224,64,251,.08)",border:"1px solid rgba(224,64,251,.25)",borderRadius:7},children:[e.jsx("div",{style:{fontSize:10,color:"var(--purple)",fontWeight:700,textTransform:"uppercase",letterSpacing:".06em",marginBottom:6},children:"Decision Required"}),e.jsx("div",{style:{fontSize:13,color:"var(--text)",lineHeight:1.6},children:t.hitl_reason||"Human decision required before proceeding."})]}),t.description&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:"var(--muted)",fontWeight:600,textTransform:"uppercase",letterSpacing:".05em",marginBottom:4},children:"Context"}),e.jsx("div",{style:{fontSize:12,color:"var(--text)",lineHeight:1.6},children:t.description})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:"var(--muted)",marginBottom:6},children:"Optional note (sent to agent)"}),e.jsx("input",{value:c,onChange:s=>a(s.target.value),placeholder:"Add context for the agent...",style:{width:"100%",background:"var(--bg3)",border:"1px solid var(--border)",borderRadius:5,padding:"8px 10px",fontSize:12,color:"var(--text)",fontFamily:"inherit",outline:"none",boxSizing:"border-box"}})]}),e.jsxs("div",{style:{display:"flex",gap:10},children:[e.jsx("button",{onClick:()=>x("approve"),disabled:!!n,style:{flex:1,padding:"10px",background:"rgba(0,230,118,.15)",border:"1px solid rgba(0,230,118,.4)",color:"var(--green)",borderRadius:6,cursor:n?"not-allowed":"pointer",fontFamily:"inherit",fontSize:13,fontWeight:700,transition:"all .15s"},children:n==="approve"?"...":"✅ Approve — Continue"}),e.jsx("button",{onClick:()=>x("reject"),disabled:!!n,style:{flex:1,padding:"10px",background:"rgba(255,23,68,.1)",border:"1px solid rgba(255,23,68,.35)",color:"var(--red)",borderRadius:6,cursor:n?"not-allowed":"pointer",fontFamily:"inherit",fontSize:13,fontWeight:700,transition:"all .15s"},children:n==="reject"?"...":"❌ Reject — Block Task"})]})]})}function S({data:t,lastUpdated:i}){const{hitl_tasks:p=[],agents:c=[]}=t,[a,n]=g.useState(new Set),r=p.filter(o=>!a.has(o.id));function l(o){n(d=>new Set([...d,o]))}return e.jsxs("div",{className:"fade-in",style:{display:"grid",gap:14},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:14,fontWeight:700,color:r.length?"var(--red)":"var(--green)"},children:r.length?`🚨 ${r.length} decision${r.length>1?"s":""} awaiting your input`:"✅ No pending HITL decisions"}),e.jsx(h,{ts:i})]}),r.length===0&&e.jsx("div",{className:"card",style:{color:"var(--muted)",fontSize:13},children:"All clear — no human decisions required right now. Agents are running autonomously."}),r.map(o=>e.jsx(m,{task:o,agents:c,onAction:l},o.id)),a.size>0&&e.jsxs("div",{style:{padding:"10px 14px",background:"rgba(0,230,118,.06)",border:"1px solid rgba(0,230,118,.2)",borderRadius:6,fontSize:12,color:"var(--green)"},children:["✅ ",a.size," decision",a.size>1?"s":""," resolved this session — agents notified via task status update."]})]})}export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,a4 as e}from"./vendor-5MxLWm27.js";import{L as k}from"./LastUpdated-BVeFtHFH.js";import{c as C,b as J,r as N}from"./index-
|
|
1
|
+
import{r as s,a4 as e}from"./vendor-5MxLWm27.js";import{L as k}from"./LastUpdated-BVeFtHFH.js";import{c as C,b as J,r as N}from"./index-BFnAHHHY.js";function R({step:a}){const i=a.status==="complete"?"var(--green)":a.status==="running"?"var(--cyan)":a.status==="failed"?"var(--red)":a.status==="blocked"?"var(--amber)":"var(--muted)";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:11,padding:"3px 0"},children:[e.jsx("span",{style:{color:i},children:"●"}),e.jsx("span",{style:{minWidth:70},children:a.kind}),e.jsx("span",{style:{color:"var(--muted)"},children:a.status}),e.jsxs("span",{style:{color:"var(--muted)"},children:["attempt ",a.attempt||0,"/",a.maxAttempts||2]})]})}function F({data:a,lastUpdated:i}){const{jobs:l=[],featureFlags:b={}}=a,[n,o]=s.useState(""),[c,h]=s.useState("P2"),[p,u]=s.useState(""),[g,x]=s.useState(!1),[m,y]=s.useState(""),v=!b.jobs,d=s.useMemo(()=>[...l].sort((t,r)=>new Date(r.createdAt)-new Date(t.createdAt)),[l]);async function f(t){if(t.preventDefault(),!!n.trim()){x(!0),y("");try{await C({intent:n.trim(),priority:c,tags:p.split(",").map(r=>r.trim()).filter(Boolean)}),o(""),u("")}catch(r){y(r.message||"create_failed")}x(!1)}}async function j(t){try{await J(t)}catch{}}async function S(t){try{await N(t)}catch{}}return v?e.jsx("div",{className:"card",children:"Jobs feature is disabled. Enable `featureJobs` in plugin config."}):e.jsxs("div",{className:"fade-in",style:{display:"grid",gap:14},children:[e.jsxs("form",{onSubmit:f,className:"card",style:{display:"grid",gap:10},children:[e.jsx("div",{className:"section-title",children:"Create Job"}),e.jsx("input",{value:n,onChange:t=>o(t.target.value),placeholder:"High-level intent...",style:{width:"100%",background:"var(--bg3)",border:"1px solid var(--border)",borderRadius:6,color:"var(--text)",padding:"8px 10px",fontFamily:"inherit"}}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"120px 1fr auto",gap:10},children:[e.jsxs("select",{value:c,onChange:t=>h(t.target.value),style:{background:"var(--bg3)",border:"1px solid var(--border)",borderRadius:6,color:"var(--text)",padding:"8px"},children:[e.jsx("option",{value:"P1",children:"P1"}),e.jsx("option",{value:"P2",children:"P2"}),e.jsx("option",{value:"P3",children:"P3"})]}),e.jsx("input",{value:p,onChange:t=>u(t.target.value),placeholder:"tags (comma separated)",style:{width:"100%",background:"var(--bg3)",border:"1px solid var(--border)",borderRadius:6,color:"var(--text)",padding:"8px 10px",fontFamily:"inherit"}}),e.jsx("button",{type:"submit",disabled:g,style:{background:"rgba(0,229,255,.15)",border:"1px solid rgba(0,229,255,.4)",color:"var(--cyan)",borderRadius:6,padding:"8px 12px",cursor:"pointer"},children:g?"...":"Create"})]}),m&&e.jsx("div",{style:{color:"var(--red)",fontSize:11},children:m})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[e.jsxs("div",{className:"section-title",style:{marginBottom:0},children:["Jobs (",d.length,")"]}),e.jsx(k,{ts:i})]}),d.length===0&&e.jsx("div",{className:"card",style:{color:"var(--muted)"},children:"No jobs yet."}),d.map(t=>e.jsxs("div",{className:"card",style:{display:"grid",gap:8},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsx("span",{style:{fontWeight:700},children:t.title}),e.jsx("span",{className:"badge badge-pending",style:{textTransform:"none"},children:t.status}),e.jsx("span",{style:{color:"var(--muted)",fontSize:10},children:t.id}),e.jsx("span",{style:{marginLeft:"auto",color:"var(--muted)",fontSize:11},children:new Date(t.createdAt).toLocaleString()})]}),e.jsx("div",{style:{color:"var(--muted)",fontSize:12},children:t.intent}),e.jsx("div",{style:{display:"grid",gap:2},children:(t.steps||[]).map(r=>e.jsx(R,{step:r},r.id))}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{onClick:()=>j(t.id),disabled:["complete","failed","cancelled","blocked"].includes(t.status),style:{background:"rgba(255,23,68,.1)",border:"1px solid rgba(255,23,68,.35)",color:"var(--red)",borderRadius:5,padding:"5px 10px",cursor:"pointer",fontFamily:"inherit",fontSize:11},children:"Cancel"}),e.jsx("button",{onClick:()=>S(t.id),disabled:!["failed","blocked"].includes(t.status),style:{background:"rgba(0,230,118,.1)",border:"1px solid rgba(0,230,118,.35)",color:"var(--green)",borderRadius:5,padding:"5px 10px",cursor:"pointer",fontFamily:"inherit",fontSize:11},children:"Retry"})]})]},t.id))]})}export{F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,a4 as a}from"./vendor-5MxLWm27.js";import{a as N,f as z}from"./index-
|
|
1
|
+
import{r as i,a4 as a}from"./vendor-5MxLWm27.js";import{a as N,f as z}from"./index-BFnAHHHY.js";import{L as E}from"./LastUpdated-BVeFtHFH.js";function R({data:m,lastUpdated:f,toast:c}){const{shared_knowledge:l=[],agents:y=[]}=m,[g,v]=i.useState(""),[o,b]=i.useState("all"),[j,p]=i.useState(!1),[s,d]=i.useState({title:"",content:"",category:"general",tags:""}),[u,x]=i.useState(!1),w=async()=>{if(s.content.trim()){x(!0);try{const e={...s,tags:s.tags?s.tags.split(",").map(t=>t.trim()).filter(Boolean):[]};await N("/api/knowledge",e),c("Knowledge entry created","success"),p(!1),d({title:"",content:"",category:"general",tags:""})}catch(e){c(e.message,"error")}x(!1)}},C=async e=>{if(confirm("Delete this knowledge entry?"))try{await z(`/api/knowledge/${e}`),c("Entry deleted","success")}catch(t){c(t.message,"error")}},S=i.useMemo(()=>{const e=new Set(l.map(t=>t.category||"general"));return["all",...Array.from(e).sort()]},[l]),h=i.useMemo(()=>l.filter(e=>{const t=o==="all"||(e.category||"general")===o,n=g.toLowerCase(),r=!n||(e.content||e.summary||"").toLowerCase().includes(n)||(e.title||"").toLowerCase().includes(n)||(e.tags||[]).some(k=>k.toLowerCase().includes(n));return t&&r}),[l,g,o]);return a.jsxs("div",{className:"fade-in",style:{display:"grid",gap:14},children:[a.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[a.jsx("input",{value:g,onChange:e=>v(e.target.value),placeholder:"Search knowledge base...",style:{flex:1,minWidth:200,background:"var(--bg3)",border:"1px solid var(--border)",borderRadius:5,padding:"7px 12px",fontSize:12,color:"var(--text)",fontFamily:"inherit",outline:"none"}}),S.map(e=>a.jsx("button",{onClick:()=>b(e),style:{background:o===e?"rgba(0,229,255,.15)":"var(--surface)",border:`1px solid ${o===e?"rgba(0,229,255,.4)":"var(--border)"}`,color:o===e?"var(--cyan)":"var(--muted)",padding:"5px 12px",borderRadius:4,fontSize:11,cursor:"pointer",fontFamily:"inherit",textTransform:"capitalize"},children:e},e)),a.jsx("button",{className:"btn-primary",onClick:()=>p(e=>!e),children:"+ New Entry"}),a.jsx(E,{ts:f})]}),j&&a.jsxs("div",{className:"card",style:{display:"grid",gap:8},children:[a.jsx("input",{className:"input-base",placeholder:"Title",value:s.title,onChange:e=>d(t=>({...t,title:e.target.value}))}),a.jsx("textarea",{className:"input-base",placeholder:"Content *",value:s.content,onChange:e=>d(t=>({...t,content:e.target.value})),style:{minHeight:80,resize:"vertical",fontFamily:"inherit"},maxLength:5e3}),a.jsxs("div",{style:{display:"flex",gap:8},children:[a.jsx("input",{className:"input-base",placeholder:"Category",value:s.category,onChange:e=>d(t=>({...t,category:e.target.value})),style:{flex:1}}),a.jsx("input",{className:"input-base",placeholder:"Tags (comma separated)",value:s.tags,onChange:e=>d(t=>({...t,tags:e.target.value})),style:{flex:2}})]}),a.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[a.jsx("button",{className:"btn-primary",onClick:w,disabled:u||!s.content.trim(),children:u?"Creating...":"Create"}),a.jsx("button",{className:"input-base",style:{cursor:"pointer"},onClick:()=>p(!1),children:"Cancel"})]})]}),a.jsxs("div",{style:{fontSize:11,color:"var(--muted)"},children:[h.length," / ",l.length," entries",l.length===0&&" — Cipher will populate this during synthesis crons"]}),h.length===0&&a.jsx("div",{className:"card",style:{color:"var(--muted)",fontSize:13},children:l.length===0?"Knowledge base is empty. Cipher's synthesis cron populates SHARED_KNOWLEDGE.json every 6 hours.":"No entries match your search."}),a.jsx("div",{style:{display:"grid",gap:10},children:h.map((e,t)=>{const n=y.find(r=>r.id===e.added_by||r.id===e.author);return a.jsxs("div",{className:"card",children:[a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10,marginBottom:8},children:[a.jsxs("div",{style:{flex:1},children:[e.title&&a.jsx("div",{style:{fontWeight:700,fontSize:13,marginBottom:4},children:e.title}),a.jsx("div",{style:{fontSize:12,color:"var(--text)",lineHeight:1.6},children:e.content||e.summary||e.insight||"—"})]}),a.jsx("span",{style:{fontSize:10,padding:"2px 7px",borderRadius:3,flexShrink:0,background:"rgba(0,229,255,.07)",color:"var(--cyan)",border:"1px solid rgba(0,229,255,.2)",textTransform:"capitalize"},children:e.category||"general"}),e.id&&a.jsx("button",{className:"btn-danger",onClick:r=>{r.stopPropagation(),C(e.id)},children:"X"})]}),e.tags?.length>0&&a.jsx("div",{style:{display:"flex",gap:4,flexWrap:"wrap",marginBottom:8},children:e.tags.map(r=>a.jsx("span",{style:{fontSize:9,padding:"1px 5px",borderRadius:3,background:"rgba(255,214,0,.08)",color:"var(--amber)",border:"1px solid rgba(255,214,0,.2)"},children:r},r))}),a.jsxs("div",{style:{fontSize:10,color:"var(--muted)",display:"flex",gap:12,flexWrap:"wrap"},children:[n&&a.jsxs("span",{children:[n.emoji," ",n.name]}),e.source_task&&a.jsxs("span",{children:["Task: ",a.jsx("span",{style:{color:"var(--cyan)"},children:e.source_task})]}),e.added_at&&a.jsx("span",{children:new Date(e.added_at).toLocaleString()}),e.confidence&&a.jsxs("span",{children:["Confidence: ",Math.round(e.confidence*100),"%"]})]})]},e.id||t)})})]})}export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as d,a4 as e}from"./vendor-5MxLWm27.js";import{a as A}from"./index-DW5W626L.js";import{L as E}from"./LastUpdated-BVeFtHFH.js";const M=["all","pending","in-progress","complete","failed","blocked","🚨 hitl"],j=25;function H(s=1e4){const[i,c]=d.useState(0);return d.useEffect(()=>{const n=setInterval(()=>c(o=>o+1),s);return()=>clearInterval(n)},[s]),i}function O({deadline:s}){if(H(1e4),!s)return e.jsx("span",{style:{color:"var(--muted)"},children:"—"});try{const i=new Date(s),c=Math.round((i-Date.now())/6e4),n=Math.abs(c),o=c<0,r=o?"var(--red)":c<60?"var(--amber)":"var(--muted)",g=n<60?`${o?"-":""}${n}m`:n<1440?`${o?"-":""}${Math.round(n/60)}h`:i.toLocaleDateString();return e.jsxs("span",{title:i.toLocaleString(),style:{color:r,fontSize:11,fontWeight:o?700:400},children:[g,o?" overdue":""]})}catch{return e.jsx("span",{style:{color:"var(--muted)",fontSize:11},children:s})}}function U({task:s,expanded:i,onToggle:c}){const n=(s.sla?.priority||s.priority||"").toUpperCase(),o=(s.status||"").toLowerCase().replace(/ /g,"-"),r={complete:"badge-complete",pending:"badge-pending","in-progress":"badge-in-progress",failed:"badge-failed",needs_human_decision:"badge-hitl",blocked:"badge-blocked"}[o]||"badge-pending",g=s.status==="needs_human_decision";return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{onClick:c,style:{borderBottom:i?"none":"1px solid rgba(255,255,255,.03)",background:g?"rgba(255,23,68,.04)":"transparent",cursor:"pointer"},children:[e.jsx("td",{style:{padding:"8px 12px",color:"var(--cyan)",fontFamily:"monospace",fontSize:11},children:s.id||"—"}),e.jsx("td",{style:{padding:"8px 12px"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[g&&e.jsx("span",{children:"🚨"}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:280},children:s.title||"—"})]})}),e.jsx("td",{style:{padding:"8px 12px",color:"var(--muted)",fontSize:11},children:s.assigned_to||"—"}),e.jsx("td",{style:{padding:"8px 12px"},children:n&&e.jsx("span",{className:n==="P1"?"p1":n==="P2"?"p2":"p3",children:n})}),e.jsx("td",{style:{padding:"8px 12px"},children:e.jsx("span",{className:`badge ${r}`,children:s.status||"—"})}),e.jsx("td",{style:{padding:"8px 12px"},children:e.jsx(O,{deadline:s.sla?.deadline||s.sla?.target})}),e.jsx("td",{style:{padding:"8px 12px",color:"var(--muted)",fontSize:11,textAlign:"center"},children:i?"▲":"▼"})]}),i&&e.jsx("tr",{style:{background:"rgba(0,229,255,.03)",borderBottom:"1px solid rgba(0,229,255,.08)"},children:e.jsx("td",{colSpan:7,style:{padding:"10px 14px 14px 14px"},children:e.jsxs("div",{style:{display:"grid",gap:10},children:[s.hitl_reason&&e.jsxs("div",{style:{padding:"8px 12px",background:"rgba(224,64,251,.08)",border:"1px solid rgba(224,64,251,.25)",borderRadius:6},children:[e.jsx("span",{style:{fontSize:10,color:"var(--purple)",fontWeight:700,textTransform:"uppercase",letterSpacing:".05em"},children:"🚨 HITL Reason"}),e.jsx("div",{style:{fontSize:12,color:"var(--text)",marginTop:4},children:s.hitl_reason})]}),s.description&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:"var(--muted)",fontWeight:600,textTransform:"uppercase",letterSpacing:".05em",marginBottom:4},children:"Description"}),e.jsx("div",{style:{fontSize:12,color:"var(--text)",lineHeight:1.6},children:s.description})]}),s.output&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:"var(--green)",fontWeight:600,textTransform:"uppercase",letterSpacing:".05em",marginBottom:4},children:"✅ Output"}),e.jsx("div",{style:{fontSize:12,color:"var(--text)",lineHeight:1.6,background:"rgba(0,230,118,.04)",padding:"8px 10px",borderRadius:5,border:"1px solid rgba(0,230,118,.15)"},children:s.output})]}),e.jsxs("div",{style:{display:"flex",gap:20,flexWrap:"wrap",fontSize:10,color:"var(--muted)",borderTop:"1px solid rgba(255,255,255,.04)",paddingTop:8},children:[s.type&&e.jsxs("span",{children:["Type: ",e.jsx("span",{style:{color:"var(--cyan)"},children:s.type})]}),s.proc_id&&e.jsxs("span",{children:["Proc: ",e.jsx("span",{style:{color:"var(--cyan)"},children:s.proc_id})]}),s.created_at&&e.jsxs("span",{children:["Created: ",new Date(s.created_at).toLocaleString()]}),s.completed_at&&e.jsxs("span",{style:{color:"var(--green)"},children:["Completed: ",new Date(s.completed_at).toLocaleString()]}),s.depends_on?.length>0&&e.jsxs("span",{children:["Depends on: ",s.depends_on.join(", ")]})]})]})})})]})}function Z({data:s,lastUpdated:i,toast:c}){const{tasks:n=[],agents:o=[]}=s,[r,g]=d.useState("all"),[p,v]=d.useState(0),[P,b]=d.useState(null),[y,L]=d.useState(""),[x,D]=d.useState(null),[S,C]=d.useState("asc"),[I,f]=d.useState(!1),[l,u]=d.useState({id:"",title:"",description:"",priority:"P2",assigned_to:"",type:"dev"}),[k,w]=d.useState(!1),R=t=>{x===t?C(a=>a==="asc"?"desc":"asc"):(D(t),C("asc"))},B=async()=>{if(!(!l.id||!l.title)){w(!0);try{await A("/api/tasks",l),c("Task created","success"),f(!1),u({id:"",title:"",description:"",priority:"P2",assigned_to:"",type:"dev"})}catch(t){c(t.message,"error")}w(!1)}},T=n.filter(t=>{if(r==="🚨 hitl"?t.status!=="needs_human_decision":r!=="all"&&t.status!==r)return!1;if(!y)return!0;const a=y.toLowerCase();return(t.id||"").toLowerCase().includes(a)||(t.title||"").toLowerCase().includes(a)||(t.assigned_to||"").toLowerCase().includes(a)}),m=x?[...T].sort((t,a)=>{const z=(t[x]||"").toString().toLowerCase(),N=(a[x]||"").toString().toLowerCase();return S==="asc"?z.localeCompare(N):N.localeCompare(z)}):T,h=Math.ceil(m.length/j),_=m.slice(p*j,(p+1)*j),W=t=>b(a=>a===t?null:t),F=t=>{g(t),v(0),b(null)},$=t=>t==="🚨 hitl"?n.filter(a=>a.status==="needs_human_decision").length:n.filter(a=>a.status===t).length;return e.jsxs("div",{className:"fade-in",children:[e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:14,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("input",{className:"input-base",placeholder:"Search tasks...",value:y,onChange:t=>{L(t.target.value),v(0)},style:{flex:"0 1 180px"}}),M.map(t=>e.jsxs("button",{onClick:()=>F(t),style:{background:r===t?"rgba(0,229,255,.15)":"var(--surface)",border:`1px solid ${r===t?"rgba(0,229,255,.5)":"var(--border)"}`,color:r===t?"var(--cyan)":"var(--muted)",padding:"4px 12px",borderRadius:4,fontSize:11,cursor:"pointer",fontFamily:"inherit"},children:[t,t!=="all"&&` (${$(t)})`]},t)),e.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"var(--muted)"},children:[m.length," task",m.length!==1?"s":""]}),e.jsx("button",{className:"btn-primary",onClick:()=>f(t=>!t),children:"+ New Task"}),e.jsx(E,{ts:i})]}),I&&e.jsxs("div",{className:"card",style:{marginBottom:14,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:8},children:[e.jsx("input",{className:"input-base",placeholder:"Task ID *",value:l.id,onChange:t=>u(a=>({...a,id:t.target.value}))}),e.jsx("input",{className:"input-base",placeholder:"Title *",value:l.title,onChange:t=>u(a=>({...a,title:t.target.value})),style:{gridColumn:"span 2"}}),e.jsx("input",{className:"input-base",placeholder:"Description",value:l.description,onChange:t=>u(a=>({...a,description:t.target.value})),style:{gridColumn:"span 2"}}),e.jsxs("select",{className:"input-base",value:l.priority,onChange:t=>u(a=>({...a,priority:t.target.value})),children:[e.jsx("option",{value:"P1",children:"P1"}),e.jsx("option",{value:"P2",children:"P2"}),e.jsx("option",{value:"P3",children:"P3"})]}),e.jsxs("select",{className:"input-base",value:l.assigned_to,onChange:t=>u(a=>({...a,assigned_to:t.target.value})),children:[e.jsx("option",{value:"",children:"Assign to..."}),o.map(t=>e.jsxs("option",{value:t.id,children:[t.emoji," ",t.name]},t.id))]}),e.jsxs("select",{className:"input-base",value:l.type,onChange:t=>u(a=>({...a,type:t.target.value})),children:[e.jsx("option",{value:"dev",children:"dev"}),e.jsx("option",{value:"research",children:"research"}),e.jsx("option",{value:"review",children:"review"}),e.jsx("option",{value:"ops",children:"ops"})]}),e.jsxs("div",{style:{gridColumn:"span 3",display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{className:"btn-primary",onClick:B,disabled:k||!l.id||!l.title,children:k?"Creating...":"Create Task"}),e.jsx("button",{className:"input-base",style:{cursor:"pointer"},onClick:()=>f(!1),children:"Cancel"})]})]}),e.jsx("div",{className:"card",style:{padding:0,overflow:"hidden"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[e.jsx("thead",{children:e.jsx("tr",{style:{background:"var(--bg3)",borderBottom:"1px solid var(--border)"},children:[["id","ID"],["title","Title"],["assigned_to","Assigned To"],["priority","Priority"],["status","Status"],[null,"Deadline"],[null,""]].map(([t,a])=>e.jsxs("th",{onClick:t?()=>R(t):void 0,style:{padding:"8px 12px",textAlign:"left",fontSize:10,color:x===t?"var(--cyan)":"var(--muted)",fontWeight:600,textTransform:"uppercase",letterSpacing:".05em",cursor:t?"pointer":"default",userSelect:"none"},children:[a,x===t?S==="asc"?" ▲":" ▼":""]},a))})}),e.jsxs("tbody",{children:[_.length===0&&e.jsx("tr",{children:e.jsxs("td",{colSpan:7,style:{padding:"40px 12px",color:"var(--muted)",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:24,marginBottom:12},children:"📋"}),e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"var(--text)"},children:"No tasks found"}),e.jsx("div",{style:{fontSize:11,marginTop:4},children:r==="all"?"Your farm hasn't generated any tasks yet.":`No tasks matching the "${r.replace("🚨 ","")}" status.`})]})}),_.map(t=>e.jsx(U,{task:t,expanded:P===t.id,onToggle:()=>W(t.id)},t.id))]})]})}),h>1&&e.jsxs("div",{style:{display:"flex",gap:8,marginTop:12,alignItems:"center",justifyContent:"center"},children:[e.jsx("button",{onClick:()=>v(t=>Math.max(0,t-1)),disabled:p===0,style:{background:"var(--surface)",border:"1px solid var(--border)",color:p===0?"var(--muted)":"var(--cyan)",padding:"4px 12px",borderRadius:4,cursor:p===0?"not-allowed":"pointer",fontFamily:"inherit",fontSize:11},children:"← Prev"}),e.jsxs("span",{style:{fontSize:11,color:"var(--muted)"},children:["Page ",p+1," / ",h," (",m.length," total)"]}),e.jsx("button",{onClick:()=>v(t=>Math.min(h-1,t+1)),disabled:p===h-1,style:{background:"var(--surface)",border:"1px solid var(--border)",color:p===h-1?"var(--muted)":"var(--cyan)",padding:"4px 12px",borderRadius:4,cursor:p===h-1?"not-allowed":"pointer",fontFamily:"inherit",fontSize:11},children:"Next →"})]})]})}export{Z as default};
|
|
1
|
+
import{r as d,a4 as e}from"./vendor-5MxLWm27.js";import{a as A}from"./index-BFnAHHHY.js";import{L as E}from"./LastUpdated-BVeFtHFH.js";const M=["all","pending","in-progress","complete","failed","blocked","🚨 hitl"],j=25;function H(s=1e4){const[i,c]=d.useState(0);return d.useEffect(()=>{const n=setInterval(()=>c(o=>o+1),s);return()=>clearInterval(n)},[s]),i}function O({deadline:s}){if(H(1e4),!s)return e.jsx("span",{style:{color:"var(--muted)"},children:"—"});try{const i=new Date(s),c=Math.round((i-Date.now())/6e4),n=Math.abs(c),o=c<0,r=o?"var(--red)":c<60?"var(--amber)":"var(--muted)",g=n<60?`${o?"-":""}${n}m`:n<1440?`${o?"-":""}${Math.round(n/60)}h`:i.toLocaleDateString();return e.jsxs("span",{title:i.toLocaleString(),style:{color:r,fontSize:11,fontWeight:o?700:400},children:[g,o?" overdue":""]})}catch{return e.jsx("span",{style:{color:"var(--muted)",fontSize:11},children:s})}}function U({task:s,expanded:i,onToggle:c}){const n=(s.sla?.priority||s.priority||"").toUpperCase(),o=(s.status||"").toLowerCase().replace(/ /g,"-"),r={complete:"badge-complete",pending:"badge-pending","in-progress":"badge-in-progress",failed:"badge-failed",needs_human_decision:"badge-hitl",blocked:"badge-blocked"}[o]||"badge-pending",g=s.status==="needs_human_decision";return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{onClick:c,style:{borderBottom:i?"none":"1px solid rgba(255,255,255,.03)",background:g?"rgba(255,23,68,.04)":"transparent",cursor:"pointer"},children:[e.jsx("td",{style:{padding:"8px 12px",color:"var(--cyan)",fontFamily:"monospace",fontSize:11},children:s.id||"—"}),e.jsx("td",{style:{padding:"8px 12px"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[g&&e.jsx("span",{children:"🚨"}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:280},children:s.title||"—"})]})}),e.jsx("td",{style:{padding:"8px 12px",color:"var(--muted)",fontSize:11},children:s.assigned_to||"—"}),e.jsx("td",{style:{padding:"8px 12px"},children:n&&e.jsx("span",{className:n==="P1"?"p1":n==="P2"?"p2":"p3",children:n})}),e.jsx("td",{style:{padding:"8px 12px"},children:e.jsx("span",{className:`badge ${r}`,children:s.status||"—"})}),e.jsx("td",{style:{padding:"8px 12px"},children:e.jsx(O,{deadline:s.sla?.deadline||s.sla?.target})}),e.jsx("td",{style:{padding:"8px 12px",color:"var(--muted)",fontSize:11,textAlign:"center"},children:i?"▲":"▼"})]}),i&&e.jsx("tr",{style:{background:"rgba(0,229,255,.03)",borderBottom:"1px solid rgba(0,229,255,.08)"},children:e.jsx("td",{colSpan:7,style:{padding:"10px 14px 14px 14px"},children:e.jsxs("div",{style:{display:"grid",gap:10},children:[s.hitl_reason&&e.jsxs("div",{style:{padding:"8px 12px",background:"rgba(224,64,251,.08)",border:"1px solid rgba(224,64,251,.25)",borderRadius:6},children:[e.jsx("span",{style:{fontSize:10,color:"var(--purple)",fontWeight:700,textTransform:"uppercase",letterSpacing:".05em"},children:"🚨 HITL Reason"}),e.jsx("div",{style:{fontSize:12,color:"var(--text)",marginTop:4},children:s.hitl_reason})]}),s.description&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:"var(--muted)",fontWeight:600,textTransform:"uppercase",letterSpacing:".05em",marginBottom:4},children:"Description"}),e.jsx("div",{style:{fontSize:12,color:"var(--text)",lineHeight:1.6},children:s.description})]}),s.output&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:"var(--green)",fontWeight:600,textTransform:"uppercase",letterSpacing:".05em",marginBottom:4},children:"✅ Output"}),e.jsx("div",{style:{fontSize:12,color:"var(--text)",lineHeight:1.6,background:"rgba(0,230,118,.04)",padding:"8px 10px",borderRadius:5,border:"1px solid rgba(0,230,118,.15)"},children:s.output})]}),e.jsxs("div",{style:{display:"flex",gap:20,flexWrap:"wrap",fontSize:10,color:"var(--muted)",borderTop:"1px solid rgba(255,255,255,.04)",paddingTop:8},children:[s.type&&e.jsxs("span",{children:["Type: ",e.jsx("span",{style:{color:"var(--cyan)"},children:s.type})]}),s.proc_id&&e.jsxs("span",{children:["Proc: ",e.jsx("span",{style:{color:"var(--cyan)"},children:s.proc_id})]}),s.created_at&&e.jsxs("span",{children:["Created: ",new Date(s.created_at).toLocaleString()]}),s.completed_at&&e.jsxs("span",{style:{color:"var(--green)"},children:["Completed: ",new Date(s.completed_at).toLocaleString()]}),s.depends_on?.length>0&&e.jsxs("span",{children:["Depends on: ",s.depends_on.join(", ")]})]})]})})})]})}function Z({data:s,lastUpdated:i,toast:c}){const{tasks:n=[],agents:o=[]}=s,[r,g]=d.useState("all"),[p,v]=d.useState(0),[P,b]=d.useState(null),[y,L]=d.useState(""),[x,D]=d.useState(null),[S,C]=d.useState("asc"),[I,f]=d.useState(!1),[l,u]=d.useState({id:"",title:"",description:"",priority:"P2",assigned_to:"",type:"dev"}),[k,w]=d.useState(!1),R=t=>{x===t?C(a=>a==="asc"?"desc":"asc"):(D(t),C("asc"))},B=async()=>{if(!(!l.id||!l.title)){w(!0);try{await A("/api/tasks",l),c("Task created","success"),f(!1),u({id:"",title:"",description:"",priority:"P2",assigned_to:"",type:"dev"})}catch(t){c(t.message,"error")}w(!1)}},T=n.filter(t=>{if(r==="🚨 hitl"?t.status!=="needs_human_decision":r!=="all"&&t.status!==r)return!1;if(!y)return!0;const a=y.toLowerCase();return(t.id||"").toLowerCase().includes(a)||(t.title||"").toLowerCase().includes(a)||(t.assigned_to||"").toLowerCase().includes(a)}),m=x?[...T].sort((t,a)=>{const z=(t[x]||"").toString().toLowerCase(),N=(a[x]||"").toString().toLowerCase();return S==="asc"?z.localeCompare(N):N.localeCompare(z)}):T,h=Math.ceil(m.length/j),_=m.slice(p*j,(p+1)*j),W=t=>b(a=>a===t?null:t),F=t=>{g(t),v(0),b(null)},$=t=>t==="🚨 hitl"?n.filter(a=>a.status==="needs_human_decision").length:n.filter(a=>a.status===t).length;return e.jsxs("div",{className:"fade-in",children:[e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:14,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("input",{className:"input-base",placeholder:"Search tasks...",value:y,onChange:t=>{L(t.target.value),v(0)},style:{flex:"0 1 180px"}}),M.map(t=>e.jsxs("button",{onClick:()=>F(t),style:{background:r===t?"rgba(0,229,255,.15)":"var(--surface)",border:`1px solid ${r===t?"rgba(0,229,255,.5)":"var(--border)"}`,color:r===t?"var(--cyan)":"var(--muted)",padding:"4px 12px",borderRadius:4,fontSize:11,cursor:"pointer",fontFamily:"inherit"},children:[t,t!=="all"&&` (${$(t)})`]},t)),e.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"var(--muted)"},children:[m.length," task",m.length!==1?"s":""]}),e.jsx("button",{className:"btn-primary",onClick:()=>f(t=>!t),children:"+ New Task"}),e.jsx(E,{ts:i})]}),I&&e.jsxs("div",{className:"card",style:{marginBottom:14,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:8},children:[e.jsx("input",{className:"input-base",placeholder:"Task ID *",value:l.id,onChange:t=>u(a=>({...a,id:t.target.value}))}),e.jsx("input",{className:"input-base",placeholder:"Title *",value:l.title,onChange:t=>u(a=>({...a,title:t.target.value})),style:{gridColumn:"span 2"}}),e.jsx("input",{className:"input-base",placeholder:"Description",value:l.description,onChange:t=>u(a=>({...a,description:t.target.value})),style:{gridColumn:"span 2"}}),e.jsxs("select",{className:"input-base",value:l.priority,onChange:t=>u(a=>({...a,priority:t.target.value})),children:[e.jsx("option",{value:"P1",children:"P1"}),e.jsx("option",{value:"P2",children:"P2"}),e.jsx("option",{value:"P3",children:"P3"})]}),e.jsxs("select",{className:"input-base",value:l.assigned_to,onChange:t=>u(a=>({...a,assigned_to:t.target.value})),children:[e.jsx("option",{value:"",children:"Assign to..."}),o.map(t=>e.jsxs("option",{value:t.id,children:[t.emoji," ",t.name]},t.id))]}),e.jsxs("select",{className:"input-base",value:l.type,onChange:t=>u(a=>({...a,type:t.target.value})),children:[e.jsx("option",{value:"dev",children:"dev"}),e.jsx("option",{value:"research",children:"research"}),e.jsx("option",{value:"review",children:"review"}),e.jsx("option",{value:"ops",children:"ops"})]}),e.jsxs("div",{style:{gridColumn:"span 3",display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{className:"btn-primary",onClick:B,disabled:k||!l.id||!l.title,children:k?"Creating...":"Create Task"}),e.jsx("button",{className:"input-base",style:{cursor:"pointer"},onClick:()=>f(!1),children:"Cancel"})]})]}),e.jsx("div",{className:"card",style:{padding:0,overflow:"hidden"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[e.jsx("thead",{children:e.jsx("tr",{style:{background:"var(--bg3)",borderBottom:"1px solid var(--border)"},children:[["id","ID"],["title","Title"],["assigned_to","Assigned To"],["priority","Priority"],["status","Status"],[null,"Deadline"],[null,""]].map(([t,a])=>e.jsxs("th",{onClick:t?()=>R(t):void 0,style:{padding:"8px 12px",textAlign:"left",fontSize:10,color:x===t?"var(--cyan)":"var(--muted)",fontWeight:600,textTransform:"uppercase",letterSpacing:".05em",cursor:t?"pointer":"default",userSelect:"none"},children:[a,x===t?S==="asc"?" ▲":" ▼":""]},a))})}),e.jsxs("tbody",{children:[_.length===0&&e.jsx("tr",{children:e.jsxs("td",{colSpan:7,style:{padding:"40px 12px",color:"var(--muted)",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:24,marginBottom:12},children:"📋"}),e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"var(--text)"},children:"No tasks found"}),e.jsx("div",{style:{fontSize:11,marginTop:4},children:r==="all"?"Your farm hasn't generated any tasks yet.":`No tasks matching the "${r.replace("🚨 ","")}" status.`})]})}),_.map(t=>e.jsx(U,{task:t,expanded:P===t.id,onToggle:()=>W(t.id)},t.id))]})]})}),h>1&&e.jsxs("div",{style:{display:"flex",gap:8,marginTop:12,alignItems:"center",justifyContent:"center"},children:[e.jsx("button",{onClick:()=>v(t=>Math.max(0,t-1)),disabled:p===0,style:{background:"var(--surface)",border:"1px solid var(--border)",color:p===0?"var(--muted)":"var(--cyan)",padding:"4px 12px",borderRadius:4,cursor:p===0?"not-allowed":"pointer",fontFamily:"inherit",fontSize:11},children:"← Prev"}),e.jsxs("span",{style:{fontSize:11,color:"var(--muted)"},children:["Page ",p+1," / ",h," (",m.length," total)"]}),e.jsx("button",{onClick:()=>v(t=>Math.min(h-1,t+1)),disabled:p===h-1,style:{background:"var(--surface)",border:"1px solid var(--border)",color:p===h-1?"var(--muted)":"var(--cyan)",padding:"4px 12px",borderRadius:4,cursor:p===h-1?"not-allowed":"pointer",fontFamily:"inherit",fontSize:11},children:"Next →"})]})]})}export{Z as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Overview-OVGZf4_H.js","assets/vendor-5MxLWm27.js","assets/LastUpdated-BVeFtHFH.js","assets/Agents-BGp0VBL6.js","assets/Tasks-CM3yheWF.js","assets/Projects-BBOHTOLq.js","assets/charts-BhPBsBGB.js","assets/Jobs-CV2HnDQL.js","assets/Approvals-wArbqSa0.js","assets/Usage-MqbkYIgO.js","assets/Crons-BzbHl0I3.js","assets/HITL-CwEsd-qm.js","assets/Alerts-ChDOowdj.js","assets/Velocity-C1jcs0W8.js","assets/Budget-D8f3izqR.js","assets/OKRs-BFjYFYsj.js","assets/Knowledge-C0I0KvXG.js","assets/Comms-zQvLg7tX.js","assets/RD-DRBHxZUS.js","assets/Broadcast-CMCcYnIx.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as n,a4 as e,a5 as z}from"./vendor-5MxLWm27.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))l(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&l(i)}).observe(document,{childList:!0,subtree:!0});function o(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerPolicy&&(a.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?a.credentials="include":r.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function l(r){if(r.ep)return;r.ep=!0;const a=o(r);fetch(r.href,a)}})();const N="modulepreload",V=function(t){return"/"+t},L={},p=function(s,o,l){let r=Promise.resolve();if(o&&o.length>0){let y=function(c){return Promise.all(c.map(m=>Promise.resolve(m).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),u=i?.nonce||i?.getAttribute("nonce");r=y(o.map(c=>{if(c=V(c),c in L)return;L[c]=!0;const m=c.endsWith(".css"),d=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=m?"stylesheet":N,m||(f.as="script"),f.crossOrigin="",f.href=c,u&&f.setAttribute("nonce",u),document.head.appendChild(f),m)return new Promise((v,_)=>{f.addEventListener("load",v),f.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${c}`)))})}))}function a(i){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=i,window.dispatchEvent(u),!u.defaultPrevented)throw i}return r.then(i=>{for(const u of i||[])u.status==="rejected"&&a(u.reason);return s().catch(a)})};let b=null;async function U(){const t=await fetch("/api/session");if(!t.ok)throw new Error("failed_to_fetch_session");const s=await t.json();if(!s?.csrfToken)throw new Error("missing_csrf_token");return s.csrfToken}async function w(){return b||(b=U().catch(t=>{throw b=null,t})),b}async function me(t){const s=await w(),o=await fetch(t,{method:"DELETE",headers:{"x-agi-farm-csrf":s}});let l={};try{l=await o.json()}catch{l={}}if(!o.ok)throw new Error(l?.error||`request_failed_${o.status}`);return l}async function E(t,s=null){const r={method:"POST",headers:{"Content-Type":"application/json","x-agi-farm-csrf":await w()}};s!==null&&(r.body=JSON.stringify(s));const a=await fetch(t,r);let i={};try{i=await a.json()}catch{i={}}if(!a.ok)throw new Error(i?.error||`request_failed_${a.status}`);return i}async function he(t){return E("/api/jobs",t)}async function ye(t){return E(`/api/jobs/${t}/cancel`)}async function ge(t){return E(`/api/jobs/${t}/retry`)}async function ve(t,s=""){return E(`/api/approvals/${t}/approve`,{note:s})}async function _e(t,s=""){return E(`/api/approvals/${t}/reject`,{note:s})}const $=1e4,O=3e3;function B(){const[t,s]=n.useState(window.INITIAL_DATA||null),[o,l]=n.useState(!1),[r,a]=n.useState(window.INITIAL_DATA?new Date:null),[i,u]=n.useState(0),y=n.useRef(null),c=n.useRef(!0),m=n.useRef(null),d=n.useRef(null),f=n.useRef(null),v=n.useCallback(h=>{!h||h.error||h.type==="keepalive"||(s(g=>({...h})),a(new Date),u(g=>g+1))},[]),_=n.useCallback(()=>{m.current&&clearInterval(m.current),m.current=setInterval(async()=>{if(!(!c.current||!f.current))try{const h=await fetch("/api/data",{headers:{"x-agi-farm-csrf":f.current}});h.ok&&v(await h.json())}catch{}},$)},[v]),x=n.useCallback(async()=>{if(!c.current)return;if(y.current)try{y.current.close()}catch{}if(!f.current)try{f.current=await w()}catch{d.current=setTimeout(x,O);return}const h=new EventSource(`/api/stream?token=${encodeURIComponent(f.current)}`);y.current=h,h.onopen=()=>{c.current&&(l(!0),d.current&&(clearTimeout(d.current),d.current=null))},h.onmessage=g=>{if(c.current)try{v(JSON.parse(g.data))}catch{}},h.onerror=()=>{if(c.current){l(!1);try{h.close()}catch{}y.current=null,d.current=setTimeout(x,O)}}},[v]);return n.useEffect(()=>(c.current=!0,x(),_(),()=>{if(c.current=!1,y.current)try{y.current.close()}catch{}m.current&&clearInterval(m.current),d.current&&clearTimeout(d.current)}),[x,_]),{data:t,connected:o,lastUpdated:r,updateCount:i}}function W(){const[t,s]=n.useState(new Date);return n.useEffect(()=>{const o=setInterval(()=>s(new Date),1e3);return()=>clearInterval(o)},[]),e.jsx("span",{style:{color:"var(--muted)",fontSize:11},children:t.toLocaleTimeString()})}function H({data:t,connected:s,lastUpdated:o,updateCount:l,toast:r}){const a=t?.agents||[],i=t?.task_counts||{},u=t?.budget||{},y=u.limits||{},m=(u.current||{}).daily_usd??0,d=y.daily_usd??0,f=d>0?Math.min(100,m/d*100):0,v=a.filter(j=>["active","available","busy"].includes(j.status)).length;s&&t?.gateway_online;const _=s?t?.gateway_online===!1?"NO GATEWAY":"LIVE":"OFFLINE",x=s?t?.gateway_online===!1?"var(--amber)":"var(--green)":"var(--red)",h=s?t?.gateway_online===!1?"dot-busy":"dot-active":"dot-error",g=t?.update_info,[P,k]=n.useState(()=>sessionStorage.getItem("update-dismissed")==="true"),[I,A]=n.useState(!1),S=g?.updateAvailable&&!P,C=async()=>{A(!0);try{const j=await E("/api/update-install");j.success?r?.("Update installed! Restart the plugin to use the new version.","success"):r?.(j.error||"Update failed","error")}catch(j){r?.(j.message,"error")}A(!1)},D=()=>{k(!0),sessionStorage.setItem("update-dismissed","true")};return e.jsxs(e.Fragment,{children:[e.jsxs("header",{style:{height:52,background:"var(--bg2)",borderBottom:S?"none":"1px solid var(--border)",display:"flex",alignItems:"center",padding:"0 16px",gap:20,position:"sticky",top:0,zIndex:100},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,minWidth:160},children:[e.jsx("span",{style:{fontSize:18},children:"🦅"}),e.jsx("span",{style:{fontFamily:"Rajdhani, sans-serif",fontWeight:700,fontSize:16,color:"var(--cyan)",letterSpacing:1},children:"AGI Ops Room"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},title:t?.gateway_online===!1?"OpenClaw gateway unreachable":"",children:[e.jsx("span",{className:`dot ${h}`}),e.jsx("span",{style:{fontSize:10,fontWeight:600,color:x},children:_})]}),e.jsx("div",{style:{width:1,height:20,background:"var(--border)"}}),e.jsx(T,{label:"Online",value:`${v}/${a.length}`,color:"var(--cyan)"}),e.jsx(T,{label:"Pending",value:i.pending??0,color:"var(--amber)"}),e.jsx(T,{label:"HITL 🚨",value:i.needs_human_decision??0,color:"var(--purple)",alert:(i.needs_human_decision??0)>0}),e.jsx(T,{label:"Budget",value:`$${m.toFixed(2)}/$${d}`,color:f>(u.alerts?.daily_threshold_pct??70)?"var(--red)":"var(--green)"}),e.jsx("div",{style:{flex:1}}),l>0&&e.jsxs("span",{style:{fontSize:9,color:"var(--cyan)",opacity:.5},children:["#",l]}),o&&e.jsxs("span",{style:{fontSize:10,color:"var(--muted)"},children:["↻ ",o.toLocaleTimeString()]}),e.jsx(W,{})]}),S&&e.jsxs("div",{className:"update-banner",children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{children:"🔄"}),e.jsxs("span",{children:["Update available: ",e.jsxs("strong",{children:["v",g.currentVersion]})," → ",e.jsxs("strong",{children:["v",g.latestVersion]})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[g.releaseUrl&&e.jsx("a",{href:g.releaseUrl,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--cyan)",fontSize:11,textDecoration:"underline"},children:"Release Notes"}),e.jsx("button",{className:"btn-primary",onClick:C,disabled:I,style:{fontSize:11,padding:"3px 10px"},children:I?"Updating...":"Update Now"}),e.jsx("button",{onClick:D,style:{background:"none",border:"none",color:"var(--muted)",cursor:"pointer",fontSize:14,padding:"0 4px",fontFamily:"inherit"},children:"✕"})]})]})]})}function T({label:t,value:s,color:o,alert:l}){return e.jsxs("div",{style:{textAlign:"center"},children:[e.jsx("div",{style:{fontSize:9,color:"var(--muted)",textTransform:"uppercase",letterSpacing:".06em"},children:t}),e.jsx("div",{style:{fontSize:14,fontWeight:700,color:l?"var(--red)":o},children:s})]})}const F={HITL:"var(--red)",Alerts:"var(--red)",Crons:"var(--amber)",Approvals:"var(--purple)"};function J({tabs:t,active:s,onChange:o,badges:l={}}){return e.jsx("nav",{style:{height:44,background:"var(--bg3)",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"stretch",padding:"0 16px",gap:2,position:"sticky",top:52,zIndex:99,overflowX:"auto"},children:t.map(r=>{const a=l[r];return e.jsxs("button",{onClick:()=>o(r),style:{background:"none",border:"none",cursor:"pointer",padding:"0 14px",fontSize:12,fontFamily:"inherit",fontWeight:s===r?600:400,color:s===r?"var(--cyan)":"var(--muted)",borderBottom:s===r?"2px solid var(--cyan)":"2px solid transparent",transition:"all .15s",whiteSpace:"nowrap",position:"relative",display:"flex",alignItems:"center",gap:5},children:[r,a>0&&e.jsx("span",{style:{fontSize:9,fontWeight:700,padding:"1px 5px",borderRadius:8,background:F[r]||"var(--cyan)",color:"#fff",lineHeight:1.4,minWidth:16,textAlign:"center",animation:r==="HITL"?"pulse 2s infinite":"none"},children:a})]},r)})})}const R=n.lazy(()=>p(()=>import("./Overview-OVGZf4_H.js"),__vite__mapDeps([0,1,2]))),M=n.lazy(()=>p(()=>import("./Agents-BGp0VBL6.js"),__vite__mapDeps([3,1,2]))),K=n.lazy(()=>p(()=>import("./Tasks-CM3yheWF.js"),__vite__mapDeps([4,1,2]))),q=n.lazy(()=>p(()=>import("./Projects-BBOHTOLq.js"),__vite__mapDeps([5,1,2,6]))),G=n.lazy(()=>p(()=>import("./Jobs-CV2HnDQL.js"),__vite__mapDeps([7,1,2]))),X=n.lazy(()=>p(()=>import("./Approvals-wArbqSa0.js"),__vite__mapDeps([8,1,2]))),Y=n.lazy(()=>p(()=>import("./Usage-MqbkYIgO.js"),__vite__mapDeps([9,1,2]))),Q=n.lazy(()=>p(()=>import("./Crons-BzbHl0I3.js"),__vite__mapDeps([10,1,2]))),Z=n.lazy(()=>p(()=>import("./HITL-CwEsd-qm.js"),__vite__mapDeps([11,1,2]))),ee=n.lazy(()=>p(()=>import("./Alerts-ChDOowdj.js"),__vite__mapDeps([12,1,2]))),te=n.lazy(()=>p(()=>import("./Velocity-C1jcs0W8.js"),__vite__mapDeps([13,1,2,6]))),re=n.lazy(()=>p(()=>import("./Budget-D8f3izqR.js"),__vite__mapDeps([14,1,2,6]))),ne=n.lazy(()=>p(()=>import("./OKRs-BFjYFYsj.js"),__vite__mapDeps([15,1,2]))),se=n.lazy(()=>p(()=>import("./Knowledge-C0I0KvXG.js"),__vite__mapDeps([16,1,2]))),oe=n.lazy(()=>p(()=>import("./Comms-zQvLg7tX.js"),__vite__mapDeps([17,1,2]))),ae=n.lazy(()=>p(()=>import("./RD-DRBHxZUS.js"),__vite__mapDeps([18,1]))),ie=n.lazy(()=>p(()=>import("./Broadcast-CMCcYnIx.js"),__vite__mapDeps([19,1]))),ce=["Overview","Agents","Tasks","Projects","Jobs","Approvals","Usage","Crons","HITL","Alerts","Velocity","Budget","OKRs","Knowledge","Comms","R&D","Broadcast"],le={Overview:R,Agents:M,Tasks:K,Projects:q,Jobs:G,Approvals:X,Usage:Y,Crons:Q,HITL:Z,Alerts:ee,Velocity:te,Budget:re,OKRs:ne,Knowledge:se,Comms:oe,"R&D":ae,Broadcast:ie};function ue(){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"calc(100vh - 100px)",gap:16},children:[e.jsx("span",{style:{fontSize:32},children:"🦅"}),e.jsx("div",{style:{color:"var(--cyan)",fontSize:14,fontWeight:600},children:"Connecting to Ops Room…"}),e.jsx("div",{style:{color:"var(--muted)",fontSize:11},children:"Waiting for SSE push from dashboard.js"})]})}function de(){return e.jsx("div",{className:"card",style:{color:"var(--muted)"},children:"Loading tab..."})}function pe(){const[t,s]=n.useState("Overview"),{data:o,connected:l,lastUpdated:r,updateCount:a}=B(),i={data:o,lastUpdated:r},u=o?{HITL:(o.hitl_tasks||[]).length,Alerts:(o.alerts||[]).length,Crons:(o.crons||[]).filter(c=>(c._consecutive_errors||0)>=3).length,Approvals:(o.approvals||[]).filter(c=>c.status==="pending").length}:{},y=n.useMemo(()=>le[t]||R,[t]);return e.jsxs("div",{style:{minHeight:"100vh"},children:[e.jsx(H,{data:o,connected:l,lastUpdated:r,updateCount:a,toast}),e.jsx(J,{tabs:ce,active:t,onChange:s,badges:u}),e.jsx("main",{style:{padding:16},children:o?e.jsx(n.Suspense,{fallback:e.jsx(de,{}),children:e.jsx(y,{...i})}):e.jsx(ue,{})})]})}z.createRoot(document.getElementById("root")).render(e.jsx(n.StrictMode,{children:e.jsx(pe,{})}));export{E as a,ye as b,he as c,ve as d,_e as e,me as f,ge as r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@import"https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Rajdhani:wght@400;500;600;700&display=swap";*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:root{--bg: #080810;--bg2: #0d0d1a;--bg3: #111122;--cyan: #00e5ff;--amber: #ffd600;--green: #00e676;--red: #ff1744;--purple: #e040fb;--text: #e0e0e0;--muted: #546e7a;--surface: rgba(255,255,255,.03);--border: rgba(0,229,255,.1);--border-h: rgba(0,229,255,.4);--shadow: 0 0 20px rgba(0,229,255,.08)}html,body{height:100%;background:var(--bg);color:var(--text);font-family:JetBrains Mono,monospace;font-size:13px;line-height:1.5}body:after{content:"";position:fixed;inset:0;pointer-events:none;z-index:9999;background:repeating-linear-gradient(0deg,transparent,transparent 2px,rgba(0,0,0,.03) 2px,rgba(0,0,0,.03) 4px)}#root{min-height:100vh}@keyframes pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.75)}}@keyframes glow-pulse{0%,to{box-shadow:0 0 6px #00e5ff66}50%{box-shadow:0 0 16px #00e5ffe6}}@keyframes fadeIn{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.fade-in{animation:fadeIn .3s ease}.dot{display:inline-block;width:8px;height:8px;border-radius:50%;flex-shrink:0}.dot-active{background:var(--green);animation:pulse 2s infinite}.dot-available{background:var(--cyan)}.dot-busy{background:var(--amber);animation:pulse 1.5s infinite}.dot-error{background:var(--red);animation:pulse 1s infinite}.dot-offline{background:var(--muted)}.badge{padding:2px 7px;border-radius:3px;font-size:10px;font-weight:600;text-transform:uppercase}.badge-active{background:#00e67626;color:var(--green);border:1px solid rgba(0,230,118,.3)}.badge-available{background:#00e5ff1a;color:var(--cyan);border:1px solid rgba(0,229,255,.3)}.badge-busy{background:#ffd6001f;color:var(--amber);border:1px solid rgba(255,214,0,.3)}.badge-error{background:#ff17441f;color:var(--red);border:1px solid rgba(255,23,68,.3)}.badge-offline{background:#546e7a1f;color:var(--muted);border:1px solid rgba(84,110,122,.3)}.badge-complete{background:#00e6761a;color:var(--green);border:1px solid rgba(0,230,118,.25)}.badge-pending{background:#00e5ff14;color:var(--cyan);border:1px solid rgba(0,229,255,.2)}.badge-in-progress{background:#ffd6001a;color:var(--amber);border:1px solid rgba(255,214,0,.25)}.badge-failed{background:#ff17441a;color:var(--red);border:1px solid rgba(255,23,68,.25)}.badge-hitl{background:#e040fb1f;color:var(--purple);border:1px solid rgba(224,64,251,.3)}.badge-blocked{background:#ff17441f;color:var(--red);border:1px solid rgba(255,23,68,.3)}.p1{background:#ff174426;color:var(--red);border:1px solid rgba(255,23,68,.4);padding:1px 5px;border-radius:2px;font-size:9px;font-weight:700}.p2{background:#ffd6001f;color:var(--amber);border:1px solid rgba(255,214,0,.4);padding:1px 5px;border-radius:2px;font-size:9px;font-weight:700}.p3{background:#00e5ff14;color:var(--cyan);border:1px solid rgba(0,229,255,.3);padding:1px 5px;border-radius:2px;font-size:9px;font-weight:700}.card{background:var(--bg2);border:1px solid var(--border);border-radius:8px;padding:14px}.card:hover{border-color:var(--border-h);box-shadow:var(--shadow)}.progress-track{height:6px;background:#ffffff0f;border-radius:3px;overflow:hidden}.progress-fill{height:100%;border-radius:3px;transition:width .4s ease}.section-title{font-size:10px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);margin-bottom:10px}::-webkit-scrollbar{width:4px;height:4px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:#00e5ff33;border-radius:2px}button:focus-visible,input:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}.card:focus-within{border-color:var(--border-h);box-shadow:var(--shadow)}input::placeholder,textarea::placeholder{color:var(--muted);opacity:.6}@keyframes toastIn{0%{opacity:0;transform:translate(40px)}to{opacity:1;transform:translate(0)}}.toast-enter{animation:toastIn .25s ease}.input-base{background:var(--surface);border:1px solid var(--border);color:var(--text);border-radius:4px;padding:6px 10px;font-size:11px;font-family:inherit}.input-base:focus{border-color:var(--border-h);outline:none}.btn-primary{background:#00e5ff1f;border:1px solid rgba(0,229,255,.4);color:var(--cyan);padding:6px 14px;border-radius:4px;font-size:11px;cursor:pointer;font-family:inherit;font-weight:600}.btn-primary:hover{background:#00e5ff33}.btn-primary:disabled{opacity:.4;cursor:not-allowed}.btn-danger{background:#ff17441a;border:1px solid rgba(255,23,68,.3);color:var(--red);padding:4px 8px;border-radius:4px;font-size:10px;cursor:pointer;font-family:inherit}.btn-danger:hover{background:#ff174433}
|
|
1
|
+
@import"https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Rajdhani:wght@400;500;600;700&display=swap";*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:root{--bg: #080810;--bg2: #0d0d1a;--bg3: #111122;--cyan: #00e5ff;--amber: #ffd600;--green: #00e676;--red: #ff1744;--purple: #e040fb;--text: #e0e0e0;--muted: #546e7a;--surface: rgba(255,255,255,.03);--border: rgba(0,229,255,.1);--border-h: rgba(0,229,255,.4);--shadow: 0 0 20px rgba(0,229,255,.08)}html,body{height:100%;background:var(--bg);color:var(--text);font-family:JetBrains Mono,monospace;font-size:13px;line-height:1.5}body:after{content:"";position:fixed;inset:0;pointer-events:none;z-index:9999;background:repeating-linear-gradient(0deg,transparent,transparent 2px,rgba(0,0,0,.03) 2px,rgba(0,0,0,.03) 4px)}#root{min-height:100vh}@keyframes pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.75)}}@keyframes glow-pulse{0%,to{box-shadow:0 0 6px #00e5ff66}50%{box-shadow:0 0 16px #00e5ffe6}}@keyframes fadeIn{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.fade-in{animation:fadeIn .3s ease}.dot{display:inline-block;width:8px;height:8px;border-radius:50%;flex-shrink:0}.dot-active{background:var(--green);animation:pulse 2s infinite}.dot-available{background:var(--cyan)}.dot-busy{background:var(--amber);animation:pulse 1.5s infinite}.dot-error{background:var(--red);animation:pulse 1s infinite}.dot-offline{background:var(--muted)}.badge{padding:2px 7px;border-radius:3px;font-size:10px;font-weight:600;text-transform:uppercase}.badge-active{background:#00e67626;color:var(--green);border:1px solid rgba(0,230,118,.3)}.badge-available{background:#00e5ff1a;color:var(--cyan);border:1px solid rgba(0,229,255,.3)}.badge-busy{background:#ffd6001f;color:var(--amber);border:1px solid rgba(255,214,0,.3)}.badge-error{background:#ff17441f;color:var(--red);border:1px solid rgba(255,23,68,.3)}.badge-offline{background:#546e7a1f;color:var(--muted);border:1px solid rgba(84,110,122,.3)}.badge-complete{background:#00e6761a;color:var(--green);border:1px solid rgba(0,230,118,.25)}.badge-pending{background:#00e5ff14;color:var(--cyan);border:1px solid rgba(0,229,255,.2)}.badge-in-progress{background:#ffd6001a;color:var(--amber);border:1px solid rgba(255,214,0,.25)}.badge-failed{background:#ff17441a;color:var(--red);border:1px solid rgba(255,23,68,.25)}.badge-hitl{background:#e040fb1f;color:var(--purple);border:1px solid rgba(224,64,251,.3)}.badge-blocked{background:#ff17441f;color:var(--red);border:1px solid rgba(255,23,68,.3)}.p1{background:#ff174426;color:var(--red);border:1px solid rgba(255,23,68,.4);padding:1px 5px;border-radius:2px;font-size:9px;font-weight:700}.p2{background:#ffd6001f;color:var(--amber);border:1px solid rgba(255,214,0,.4);padding:1px 5px;border-radius:2px;font-size:9px;font-weight:700}.p3{background:#00e5ff14;color:var(--cyan);border:1px solid rgba(0,229,255,.3);padding:1px 5px;border-radius:2px;font-size:9px;font-weight:700}.card{background:var(--bg2);border:1px solid var(--border);border-radius:8px;padding:14px}.card:hover{border-color:var(--border-h);box-shadow:var(--shadow)}.progress-track{height:6px;background:#ffffff0f;border-radius:3px;overflow:hidden}.progress-fill{height:100%;border-radius:3px;transition:width .4s ease}.section-title{font-size:10px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);margin-bottom:10px}::-webkit-scrollbar{width:4px;height:4px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:#00e5ff33;border-radius:2px}button:focus-visible,input:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}.card:focus-within{border-color:var(--border-h);box-shadow:var(--shadow)}input::placeholder,textarea::placeholder{color:var(--muted);opacity:.6}@keyframes toastIn{0%{opacity:0;transform:translate(40px)}to{opacity:1;transform:translate(0)}}.toast-enter{animation:toastIn .25s ease}.input-base{background:var(--surface);border:1px solid var(--border);color:var(--text);border-radius:4px;padding:6px 10px;font-size:11px;font-family:inherit}.input-base:focus{border-color:var(--border-h);outline:none}.btn-primary{background:#00e5ff1f;border:1px solid rgba(0,229,255,.4);color:var(--cyan);padding:6px 14px;border-radius:4px;font-size:11px;cursor:pointer;font-family:inherit;font-weight:600}.btn-primary:hover{background:#00e5ff33}.btn-primary:disabled{opacity:.4;cursor:not-allowed}.btn-danger{background:#ff17441a;border:1px solid rgba(255,23,68,.3);color:var(--red);padding:4px 8px;border-radius:4px;font-size:10px;cursor:pointer;font-family:inherit}.btn-danger:hover{background:#ff174433}.update-banner{display:flex;align-items:center;justify-content:space-between;padding:8px 16px;background:#ffd60014;border-bottom:1px solid rgba(255,214,0,.25);font-size:12px;color:var(--amber);position:sticky;top:52px;z-index:99;animation:bannerSlide .3s ease}@keyframes bannerSlide{0%{opacity:0;transform:translateY(-100%)}to{opacity:1;transform:translateY(0)}}
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; connect-src 'self'; img-src 'self' data:;" />
|
|
8
8
|
<title>AGI Farm — Ops Room</title>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-BFnAHHHY.js"></script>
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/vendor-5MxLWm27.js">
|
|
11
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
11
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DaVmOqH2.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|
|
14
14
|
<div id="root"></div>
|
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export interface AGIFarmConfig {
|
|
|
29
29
|
dashboardHost: string;
|
|
30
30
|
/** Auto-start dashboard on plugin load */
|
|
31
31
|
autoStartDashboard: boolean;
|
|
32
|
+
/** Check GitHub for plugin updates on startup */
|
|
33
|
+
autoCheckUpdates: boolean;
|
|
32
34
|
/** Path to OpenClaw workspace */
|
|
33
35
|
workspacePath?: string;
|
|
34
36
|
/** Path to AGI Farm bundle */
|
|
@@ -70,6 +72,10 @@ declare class AGIFarmExtension implements OpenClawExtension {
|
|
|
70
72
|
* Register plugin commands (stub)
|
|
71
73
|
*/
|
|
72
74
|
private registerCommands;
|
|
75
|
+
/**
|
|
76
|
+
* Check GitHub for plugin updates (non-blocking, best-effort)
|
|
77
|
+
*/
|
|
78
|
+
private checkForUpdates;
|
|
73
79
|
/**
|
|
74
80
|
* Get dashboard URL
|
|
75
81
|
*/
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mapp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,EAAE,SAAc;IAChB,IAAI,SAAyC;IAC7C,OAAO,SAAe;IAEtB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,OAAO,CAAiC;IAChD,OAAO,CAAC,gBAAgB,CAA6B;gBAEzC,MAAM,GAAE,OAAO,CAAC,aAAa,CAAM;IAI/C;;OAEG;IACG,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBtD;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ/B;;OAEG;YACW,cAAc;IA4C5B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAMxB;;OAEG;YACW,eAAe;IA6C7B;;OAEG;IACH,eAAe,IAAI,MAAM;IAIzB;;OAEG;IACH,kBAAkB,IAAI,OAAO;CAG9B;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,iBAAiB,CAEzF;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -15,6 +15,7 @@ const DEFAULT_CONFIG = {
|
|
|
15
15
|
dashboardPort: 8080,
|
|
16
16
|
dashboardHost: "127.0.0.1",
|
|
17
17
|
autoStartDashboard: true,
|
|
18
|
+
autoCheckUpdates: true,
|
|
18
19
|
featureJobs: false,
|
|
19
20
|
featureSkills: false,
|
|
20
21
|
featureMemory: false,
|
|
@@ -22,6 +23,7 @@ const DEFAULT_CONFIG = {
|
|
|
22
23
|
featureMetering: false,
|
|
23
24
|
featureApprovals: false,
|
|
24
25
|
};
|
|
26
|
+
const GITHUB_RELEASES_URL = "https://api.github.com/repos/oabdelmaksoud/AGI-FARM-PLUGIN/releases/latest";
|
|
25
27
|
// ── AGI Farm Extension ────────────────────────────────────────────────────────
|
|
26
28
|
/**
|
|
27
29
|
* AGI Farm Plugin Extension
|
|
@@ -50,6 +52,10 @@ class AGIFarmExtension {
|
|
|
50
52
|
}
|
|
51
53
|
// Register commands
|
|
52
54
|
this.registerCommands(context);
|
|
55
|
+
// Non-blocking update check
|
|
56
|
+
if (this.config.autoCheckUpdates) {
|
|
57
|
+
this.checkForUpdates().catch(() => { });
|
|
58
|
+
}
|
|
53
59
|
}
|
|
54
60
|
/**
|
|
55
61
|
* Called when OpenClaw is shutting down
|
|
@@ -108,6 +114,48 @@ class AGIFarmExtension {
|
|
|
108
114
|
// This method stub exists for future programmatic runtime command registration if needed
|
|
109
115
|
context.logger.debug("[agi-farm] Commands registered statically via openclaw.plugin.json");
|
|
110
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Check GitHub for plugin updates (non-blocking, best-effort)
|
|
119
|
+
*/
|
|
120
|
+
async checkForUpdates() {
|
|
121
|
+
try {
|
|
122
|
+
const res = await fetch(GITHUB_RELEASES_URL, {
|
|
123
|
+
headers: {
|
|
124
|
+
Accept: "application/vnd.github+json",
|
|
125
|
+
"User-Agent": `agi-farm/${this.version}`,
|
|
126
|
+
},
|
|
127
|
+
signal: AbortSignal.timeout(10_000),
|
|
128
|
+
});
|
|
129
|
+
if (!res.ok)
|
|
130
|
+
return;
|
|
131
|
+
const data = (await res.json());
|
|
132
|
+
const latest = (data.tag_name || "").replace(/^v/, "");
|
|
133
|
+
if (!latest)
|
|
134
|
+
return;
|
|
135
|
+
// Simple SemVer compare
|
|
136
|
+
const cur = this.version.split(".").map(Number);
|
|
137
|
+
const lat = latest.split(".").map(Number);
|
|
138
|
+
let isNewer = false;
|
|
139
|
+
for (let i = 0; i < 3; i++) {
|
|
140
|
+
if ((lat[i] || 0) > (cur[i] || 0)) {
|
|
141
|
+
isNewer = true;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
if ((lat[i] || 0) < (cur[i] || 0))
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
if (isNewer) {
|
|
148
|
+
this.context?.logger.info(`[agi-farm] ⚡ Update available: v${this.version} → v${latest}`);
|
|
149
|
+
if (data.html_url) {
|
|
150
|
+
this.context?.logger.info(`[agi-farm] Release: ${data.html_url}`);
|
|
151
|
+
}
|
|
152
|
+
this.context?.logger.info(`[agi-farm] Run: npm update -g agi-farm`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
// Network errors silently ignored — update check is best-effort
|
|
157
|
+
}
|
|
158
|
+
}
|
|
111
159
|
/**
|
|
112
160
|
* Get dashboard URL
|
|
113
161
|
*/
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,aAAa,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAEtF,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,WAAW,GAAY,OAAO,CAAC,iBAAiB,CAAyB,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,aAAa,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAEtF,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG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kB;QAChB,OAAO,IAAI,CAAC,gBAAgB,KAAK,IAAI,CAAC;IACxC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,MAA8B;IACpE,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC;AAED,eAAe;AACf,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "agi-farm",
|
|
3
3
|
"kind": "team-orchestration",
|
|
4
4
|
"name": "AGI Farm — Multi-Agent Team Builder",
|
|
5
|
-
"version": "1.0
|
|
5
|
+
"version": "1.1.0",
|
|
6
6
|
"description": "Bootstrap complete multi-agent AI teams with auto-dispatcher, live dashboard, and infrastructure. Includes interactive wizard, SOUL.md generation, comms setup, cron registration, and React + SSE ops room.",
|
|
7
7
|
"author": "oabdelmaksoud",
|
|
8
8
|
"homepage": "https://github.com/oabdelmaksoud/AGI-FARM-PLUGIN",
|
|
@@ -35,6 +35,11 @@
|
|
|
35
35
|
"type": "string",
|
|
36
36
|
"description": "Path to AGI Farm bundle (defaults to <workspace>/agi-farm-bundle)"
|
|
37
37
|
},
|
|
38
|
+
"autoCheckUpdates": {
|
|
39
|
+
"type": "boolean",
|
|
40
|
+
"default": true,
|
|
41
|
+
"description": "Automatically check GitHub for plugin updates on startup"
|
|
42
|
+
},
|
|
38
43
|
"featureJobs": {
|
|
39
44
|
"type": "boolean",
|
|
40
45
|
"default": false,
|
|
@@ -89,6 +94,10 @@
|
|
|
89
94
|
"label": "Bundle Path",
|
|
90
95
|
"description": "Path to AGI Farm team bundle directory"
|
|
91
96
|
},
|
|
97
|
+
"autoCheckUpdates": {
|
|
98
|
+
"label": "Auto-Check Updates",
|
|
99
|
+
"description": "Check GitHub for new releases when plugin loads"
|
|
100
|
+
},
|
|
92
101
|
"featureJobs": {
|
|
93
102
|
"label": "Feature: Jobs",
|
|
94
103
|
"description": "Enable jobs runtime APIs and background worker"
|
package/package.json
CHANGED
package/server/dashboard.js
CHANGED
|
@@ -8,7 +8,11 @@ import chokidar from 'chokidar';
|
|
|
8
8
|
import os from 'os';
|
|
9
9
|
import open from 'open';
|
|
10
10
|
import crypto from 'crypto';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
parseAgentsJson, parseCronList,
|
|
13
|
+
extractExperiments, extractBacklogItems, extractProcesses,
|
|
14
|
+
enrichProjects,
|
|
15
|
+
} from './utils.js';
|
|
12
16
|
import { getFeatureFlags } from './services/feature-flags.js';
|
|
13
17
|
import { AuditService } from './services/audit.js';
|
|
14
18
|
import { JobsService } from './services/jobs.js';
|
|
@@ -17,6 +21,7 @@ import { MemoryService } from './services/memory.js';
|
|
|
17
21
|
import { PolicyService } from './services/policy.js';
|
|
18
22
|
import { MeteringService } from './services/metering.js';
|
|
19
23
|
import { WorkerService } from './services/worker.js';
|
|
24
|
+
import { UpdateChecker } from './updater.js';
|
|
20
25
|
|
|
21
26
|
const __filename = fileURLToPath(import.meta.url);
|
|
22
27
|
const __dirname = path.dirname(__filename);
|
|
@@ -269,6 +274,8 @@ function toggleCronEnabled(id) {
|
|
|
269
274
|
return { ok: true, enabled: next };
|
|
270
275
|
}
|
|
271
276
|
|
|
277
|
+
const updateChecker = new UpdateChecker();
|
|
278
|
+
|
|
272
279
|
function buildWorkspaceSnapshot(cache, services) {
|
|
273
280
|
const tasks = asArray(readJson(path.join(WORKSPACE, 'TASKS.json')));
|
|
274
281
|
const agentStatus = asObject(readJson(path.join(WORKSPACE, 'AGENT_STATUS.json')));
|
|
@@ -365,6 +372,7 @@ function buildWorkspaceSnapshot(cache, services) {
|
|
|
365
372
|
featureFlags: flags,
|
|
366
373
|
gateway_online: true,
|
|
367
374
|
cache_age_seconds: Math.floor(cache.ageSeconds()),
|
|
375
|
+
update_info: updateChecker.getStatus(),
|
|
368
376
|
};
|
|
369
377
|
}
|
|
370
378
|
|
|
@@ -738,6 +746,26 @@ async function main() {
|
|
|
738
746
|
res.json(services.metering.getUsage());
|
|
739
747
|
});
|
|
740
748
|
|
|
749
|
+
// ── Update Check Endpoints ─────────────────────────────────────────────────
|
|
750
|
+
app.get('/api/update-check', requireCsrf, async (req, res) => {
|
|
751
|
+
try {
|
|
752
|
+
const status = await updateChecker.check();
|
|
753
|
+
res.json(status);
|
|
754
|
+
} catch (err) {
|
|
755
|
+
res.status(500).json({ error: 'update_check_failed' });
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
|
|
759
|
+
app.post('/api/update-install', requireCsrf, actionLimiter, async (req, res) => {
|
|
760
|
+
try {
|
|
761
|
+
const result = await updateChecker.performUpdate();
|
|
762
|
+
res.json(result);
|
|
763
|
+
} catch (err) {
|
|
764
|
+
res.status(500).json({ success: false, error: err.message });
|
|
765
|
+
}
|
|
766
|
+
});
|
|
767
|
+
|
|
768
|
+
// ── File Watcher ───────────────────────────────────────────────────────────
|
|
741
769
|
let debounceTimer = null;
|
|
742
770
|
const watcher = chokidar.watch(WORKSPACE, {
|
|
743
771
|
ignored: /(^|[\/\\])\../,
|
|
@@ -772,6 +800,9 @@ async function main() {
|
|
|
772
800
|
if (!NO_BROWSER) {
|
|
773
801
|
open(`http://${HOST}:${PORT}`).catch(() => {});
|
|
774
802
|
}
|
|
803
|
+
|
|
804
|
+
// Non-blocking update check on startup
|
|
805
|
+
updateChecker.check().catch(() => {});
|
|
775
806
|
});
|
|
776
807
|
}
|
|
777
808
|
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Auto-update checker for AGI Farm plugin.
|
|
4
|
+
*
|
|
5
|
+
* Polls the GitHub Releases API to detect new versions and can perform
|
|
6
|
+
* self-update via `npm install -g agi-farm@latest`.
|
|
7
|
+
*/
|
|
8
|
+
import { createRequire } from 'module';
|
|
9
|
+
import { execFile } from 'child_process';
|
|
10
|
+
|
|
11
|
+
const require = createRequire(import.meta.url);
|
|
12
|
+
|
|
13
|
+
const GITHUB_API_URL = 'https://api.github.com/repos/oabdelmaksoud/AGI-FARM-PLUGIN/releases/latest';
|
|
14
|
+
const CACHE_MS = 6 * 60 * 60 * 1000; // 6 hours
|
|
15
|
+
const UPDATE_TIMEOUT_MS = 60_000; // 60 seconds for npm install
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Compare two SemVer strings (e.g. "1.0.2" vs "1.1.0").
|
|
19
|
+
* Returns 1 if a > b, -1 if a < b, 0 if equal.
|
|
20
|
+
*/
|
|
21
|
+
export function compareSemVer(a, b) {
|
|
22
|
+
const pa = (a || '0.0.0').split('.').map(Number);
|
|
23
|
+
const pb = (b || '0.0.0').split('.').map(Number);
|
|
24
|
+
for (let i = 0; i < 3; i++) {
|
|
25
|
+
const va = pa[i] || 0;
|
|
26
|
+
const vb = pb[i] || 0;
|
|
27
|
+
if (va > vb) return 1;
|
|
28
|
+
if (va < vb) return -1;
|
|
29
|
+
}
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class UpdateChecker {
|
|
34
|
+
constructor() {
|
|
35
|
+
/** @type {string} */
|
|
36
|
+
this.currentVersion = '0.0.0';
|
|
37
|
+
try {
|
|
38
|
+
const pkg = require('../package.json');
|
|
39
|
+
this.currentVersion = pkg.version || '0.0.0';
|
|
40
|
+
} catch { /* fallback */ }
|
|
41
|
+
|
|
42
|
+
/** @type {string|null} */
|
|
43
|
+
this.latestVersion = null;
|
|
44
|
+
/** @type {string|null} */
|
|
45
|
+
this.releaseUrl = null;
|
|
46
|
+
/** @type {string|null} */
|
|
47
|
+
this.releaseNotes = null;
|
|
48
|
+
/** @type {string|null} */
|
|
49
|
+
this.publishedAt = null;
|
|
50
|
+
/** @type {Date|null} */
|
|
51
|
+
this.lastCheck = null;
|
|
52
|
+
/** @type {boolean} */
|
|
53
|
+
this.updateAvailable = false;
|
|
54
|
+
/** @type {boolean} */
|
|
55
|
+
this.checking = false;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Fetch latest release from GitHub and compare versions.
|
|
60
|
+
* Results are cached for CACHE_MS. Network errors are silently caught.
|
|
61
|
+
*/
|
|
62
|
+
async check() {
|
|
63
|
+
// Return cached result if still fresh
|
|
64
|
+
if (this.lastCheck && (Date.now() - this.lastCheck.getTime()) < CACHE_MS) {
|
|
65
|
+
return this.getStatus();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Prevent concurrent checks
|
|
69
|
+
if (this.checking) return this.getStatus();
|
|
70
|
+
this.checking = true;
|
|
71
|
+
|
|
72
|
+
try {
|
|
73
|
+
const res = await fetch(GITHUB_API_URL, {
|
|
74
|
+
headers: {
|
|
75
|
+
'Accept': 'application/vnd.github+json',
|
|
76
|
+
'User-Agent': `agi-farm/${this.currentVersion}`,
|
|
77
|
+
},
|
|
78
|
+
signal: AbortSignal.timeout(10_000),
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
if (!res.ok) {
|
|
82
|
+
console.warn(`[updater] GitHub API returned ${res.status}`);
|
|
83
|
+
return this.getStatus();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const data = await res.json();
|
|
87
|
+
const tagName = (data.tag_name || '').replace(/^v/, '');
|
|
88
|
+
|
|
89
|
+
this.latestVersion = tagName;
|
|
90
|
+
this.releaseUrl = data.html_url || null;
|
|
91
|
+
this.releaseNotes = data.body ? data.body.slice(0, 500) : null;
|
|
92
|
+
this.publishedAt = data.published_at || null;
|
|
93
|
+
this.lastCheck = new Date();
|
|
94
|
+
this.updateAvailable = compareSemVer(tagName, this.currentVersion) > 0;
|
|
95
|
+
|
|
96
|
+
if (this.updateAvailable) {
|
|
97
|
+
console.log(`[updater] Update available: v${this.currentVersion} → v${tagName}`);
|
|
98
|
+
}
|
|
99
|
+
} catch (err) {
|
|
100
|
+
// Network errors, timeouts, etc. — silently ignore
|
|
101
|
+
console.warn(`[updater] Check failed: ${err.message}`);
|
|
102
|
+
} finally {
|
|
103
|
+
this.checking = false;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return this.getStatus();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Return current update status (safe to call anytime).
|
|
111
|
+
*/
|
|
112
|
+
getStatus() {
|
|
113
|
+
return {
|
|
114
|
+
updateAvailable: this.updateAvailable,
|
|
115
|
+
currentVersion: this.currentVersion,
|
|
116
|
+
latestVersion: this.latestVersion,
|
|
117
|
+
releaseUrl: this.releaseUrl,
|
|
118
|
+
releaseNotes: this.releaseNotes,
|
|
119
|
+
publishedAt: this.publishedAt,
|
|
120
|
+
lastCheck: this.lastCheck ? this.lastCheck.toISOString() : null,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Perform self-update via npm install.
|
|
126
|
+
* Uses execFile (NOT exec) to prevent shell injection.
|
|
127
|
+
*/
|
|
128
|
+
async performUpdate() {
|
|
129
|
+
return new Promise((resolve) => {
|
|
130
|
+
const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
131
|
+
|
|
132
|
+
execFile(npmCmd, ['install', '-g', 'agi-farm@latest'], {
|
|
133
|
+
timeout: UPDATE_TIMEOUT_MS,
|
|
134
|
+
env: { ...process.env },
|
|
135
|
+
}, (error, stdout, stderr) => {
|
|
136
|
+
if (error) {
|
|
137
|
+
console.error(`[updater] Update failed: ${error.message}`);
|
|
138
|
+
resolve({
|
|
139
|
+
success: false,
|
|
140
|
+
output: stderr || error.message,
|
|
141
|
+
error: error.message,
|
|
142
|
+
});
|
|
143
|
+
} else {
|
|
144
|
+
console.log(`[updater] Update complete: ${stdout.trim()}`);
|
|
145
|
+
resolve({
|
|
146
|
+
success: true,
|
|
147
|
+
output: stdout.trim(),
|
|
148
|
+
error: null,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Overview-OVGZf4_H.js","assets/vendor-5MxLWm27.js","assets/LastUpdated-BVeFtHFH.js","assets/Agents-DgFIbq8z.js","assets/Tasks-CEzAlrR1.js","assets/Projects-BBOHTOLq.js","assets/charts-BhPBsBGB.js","assets/Jobs-VwINz0NT.js","assets/Approvals-BQCkyOKZ.js","assets/Usage-MqbkYIgO.js","assets/Crons-hqntDvlR.js","assets/HITL-D6eTUZeZ.js","assets/Alerts-ChDOowdj.js","assets/Velocity-C1jcs0W8.js","assets/Budget-D8f3izqR.js","assets/OKRs-BFjYFYsj.js","assets/Knowledge-C15Hq12L.js","assets/Comms-DfoH3vg_.js","assets/RD-DRBHxZUS.js","assets/Broadcast-C1P7QZAp.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as n,a4 as r,a5 as L}from"./vendor-5MxLWm27.js";(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const t of document.querySelectorAll('link[rel="modulepreload"]'))l(t);new MutationObserver(t=>{for(const a of t)if(a.type==="childList")for(const c of a.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&l(c)}).observe(document,{childList:!0,subtree:!0});function s(t){const a={};return t.integrity&&(a.integrity=t.integrity),t.referrerPolicy&&(a.referrerPolicy=t.referrerPolicy),t.crossOrigin==="use-credentials"?a.credentials="include":t.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function l(t){if(t.ep)return;t.ep=!0;const a=s(t);fetch(t.href,a)}})();const O="modulepreload",S=function(e){return"/"+e},w={},u=function(o,s,l){let t=Promise.resolve();if(s&&s.length>0){let m=function(i){return Promise.all(i.map(d=>Promise.resolve(d).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),f=c?.nonce||c?.getAttribute("nonce");t=m(s.map(i=>{if(i=S(i),i in w)return;w[i]=!0;const d=i.endsWith(".css"),_=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${_}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":O,d||(p.as="script"),p.crossOrigin="",p.href=i,f&&p.setAttribute("nonce",f),document.head.appendChild(p),d)return new Promise((v,h)=>{p.addEventListener("load",v),p.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${i}`)))})}))}function a(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return t.then(c=>{for(const f of c||[])f.status==="rejected"&&a(f.reason);return o().catch(a)})};let T=null;async function R(){const e=await fetch("/api/session");if(!e.ok)throw new Error("failed_to_fetch_session");const o=await e.json();if(!o?.csrfToken)throw new Error("missing_csrf_token");return o.csrfToken}async function j(){return T||(T=R().catch(e=>{throw T=null,e})),T}async function ae(e){const o=await j(),s=await fetch(e,{method:"DELETE",headers:{"x-agi-farm-csrf":o}});let l={};try{l=await s.json()}catch{l={}}if(!s.ok)throw new Error(l?.error||`request_failed_${s.status}`);return l}async function x(e,o=null){const t={method:"POST",headers:{"Content-Type":"application/json","x-agi-farm-csrf":await j()}};o!==null&&(t.body=JSON.stringify(o));const a=await fetch(e,t);let c={};try{c=await a.json()}catch{c={}}if(!a.ok)throw new Error(c?.error||`request_failed_${a.status}`);return c}async function ie(e){return x("/api/jobs",e)}async function ce(e){return x(`/api/jobs/${e}/cancel`)}async function le(e){return x(`/api/jobs/${e}/retry`)}async function ue(e,o=""){return x(`/api/approvals/${e}/approve`,{note:o})}async function de(e,o=""){return x(`/api/approvals/${e}/reject`,{note:o})}const P=1e4,A=3e3;function C(){const[e,o]=n.useState(window.INITIAL_DATA||null),[s,l]=n.useState(!1),[t,a]=n.useState(window.INITIAL_DATA?new Date:null),[c,f]=n.useState(0),m=n.useRef(null),i=n.useRef(!0),d=n.useRef(null),_=n.useRef(null),p=n.useRef(null),v=n.useCallback(y=>{!y||y.error||y.type==="keepalive"||(o(E=>({...y})),a(new Date),f(E=>E+1))},[]),h=n.useCallback(()=>{d.current&&clearInterval(d.current),d.current=setInterval(async()=>{if(!(!i.current||!p.current))try{const y=await fetch("/api/data",{headers:{"x-agi-farm-csrf":p.current}});y.ok&&v(await y.json())}catch{}},P)},[v]),g=n.useCallback(async()=>{if(!i.current)return;if(m.current)try{m.current.close()}catch{}if(!p.current)try{p.current=await j()}catch{_.current=setTimeout(g,A);return}const y=new EventSource(`/api/stream?token=${encodeURIComponent(p.current)}`);m.current=y,y.onopen=()=>{i.current&&(l(!0),_.current&&(clearTimeout(_.current),_.current=null))},y.onmessage=E=>{if(i.current)try{v(JSON.parse(E.data))}catch{}},y.onerror=()=>{if(i.current){l(!1);try{y.close()}catch{}m.current=null,_.current=setTimeout(g,A)}}},[v]);return n.useEffect(()=>(i.current=!0,g(),h(),()=>{if(i.current=!1,m.current)try{m.current.close()}catch{}d.current&&clearInterval(d.current),_.current&&clearTimeout(_.current)}),[g,h]),{data:e,connected:s,lastUpdated:t,updateCount:c}}function k(){const[e,o]=n.useState(new Date);return n.useEffect(()=>{const s=setInterval(()=>o(new Date),1e3);return()=>clearInterval(s)},[]),r.jsx("span",{style:{color:"var(--muted)",fontSize:11},children:e.toLocaleTimeString()})}function D({data:e,connected:o,lastUpdated:s,updateCount:l}){const t=e?.agents||[],a=e?.task_counts||{},c=e?.budget||{},f=c.limits||{},i=(c.current||{}).daily_usd??0,d=f.daily_usd??0,_=d>0?Math.min(100,i/d*100):0,p=t.filter(y=>["active","available","busy"].includes(y.status)).length;o&&e?.gateway_online;const v=o?e?.gateway_online===!1?"NO GATEWAY":"LIVE":"OFFLINE",h=o?e?.gateway_online===!1?"var(--amber)":"var(--green)":"var(--red)",g=o?e?.gateway_online===!1?"dot-busy":"dot-active":"dot-error";return r.jsxs("header",{style:{height:52,background:"var(--bg2)",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"center",padding:"0 16px",gap:20,position:"sticky",top:0,zIndex:100},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,minWidth:160},children:[r.jsx("span",{style:{fontSize:18},children:"🦅"}),r.jsx("span",{style:{fontFamily:"Rajdhani, sans-serif",fontWeight:700,fontSize:16,color:"var(--cyan)",letterSpacing:1},children:"AGI Ops Room"})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},title:e?.gateway_online===!1?"OpenClaw gateway unreachable":"",children:[r.jsx("span",{className:`dot ${g}`}),r.jsx("span",{style:{fontSize:10,fontWeight:600,color:h},children:v})]}),r.jsx("div",{style:{width:1,height:20,background:"var(--border)"}}),r.jsx(b,{label:"Online",value:`${p}/${t.length}`,color:"var(--cyan)"}),r.jsx(b,{label:"Pending",value:a.pending??0,color:"var(--amber)"}),r.jsx(b,{label:"HITL 🚨",value:a.needs_human_decision??0,color:"var(--purple)",alert:(a.needs_human_decision??0)>0}),r.jsx(b,{label:"Budget",value:`$${i.toFixed(2)}/$${d}`,color:_>(c.alerts?.daily_threshold_pct??70)?"var(--red)":"var(--green)"}),r.jsx("div",{style:{flex:1}}),l>0&&r.jsxs("span",{style:{fontSize:9,color:"var(--cyan)",opacity:.5},children:["#",l]}),s&&r.jsxs("span",{style:{fontSize:10,color:"var(--muted)"},children:["↻ ",s.toLocaleTimeString()]}),r.jsx(k,{})]})}function b({label:e,value:o,color:s,alert:l}){return r.jsxs("div",{style:{textAlign:"center"},children:[r.jsx("div",{style:{fontSize:9,color:"var(--muted)",textTransform:"uppercase",letterSpacing:".06em"},children:e}),r.jsx("div",{style:{fontSize:14,fontWeight:700,color:l?"var(--red)":s},children:o})]})}const z={HITL:"var(--red)",Alerts:"var(--red)",Crons:"var(--amber)",Approvals:"var(--purple)"};function V({tabs:e,active:o,onChange:s,badges:l={}}){return r.jsx("nav",{style:{height:44,background:"var(--bg3)",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"stretch",padding:"0 16px",gap:2,position:"sticky",top:52,zIndex:99,overflowX:"auto"},children:e.map(t=>{const a=l[t];return r.jsxs("button",{onClick:()=>s(t),style:{background:"none",border:"none",cursor:"pointer",padding:"0 14px",fontSize:12,fontFamily:"inherit",fontWeight:o===t?600:400,color:o===t?"var(--cyan)":"var(--muted)",borderBottom:o===t?"2px solid var(--cyan)":"2px solid transparent",transition:"all .15s",whiteSpace:"nowrap",position:"relative",display:"flex",alignItems:"center",gap:5},children:[t,a>0&&r.jsx("span",{style:{fontSize:9,fontWeight:700,padding:"1px 5px",borderRadius:8,background:z[t]||"var(--cyan)",color:"#fff",lineHeight:1.4,minWidth:16,textAlign:"center",animation:t==="HITL"?"pulse 2s infinite":"none"},children:a})]},t)})})}const I=n.lazy(()=>u(()=>import("./Overview-OVGZf4_H.js"),__vite__mapDeps([0,1,2]))),N=n.lazy(()=>u(()=>import("./Agents-DgFIbq8z.js"),__vite__mapDeps([3,1,2]))),$=n.lazy(()=>u(()=>import("./Tasks-CEzAlrR1.js"),__vite__mapDeps([4,1,2]))),B=n.lazy(()=>u(()=>import("./Projects-BBOHTOLq.js"),__vite__mapDeps([5,1,2,6]))),W=n.lazy(()=>u(()=>import("./Jobs-VwINz0NT.js"),__vite__mapDeps([7,1,2]))),H=n.lazy(()=>u(()=>import("./Approvals-BQCkyOKZ.js"),__vite__mapDeps([8,1,2]))),U=n.lazy(()=>u(()=>import("./Usage-MqbkYIgO.js"),__vite__mapDeps([9,1,2]))),J=n.lazy(()=>u(()=>import("./Crons-hqntDvlR.js"),__vite__mapDeps([10,1,2]))),M=n.lazy(()=>u(()=>import("./HITL-D6eTUZeZ.js"),__vite__mapDeps([11,1,2]))),K=n.lazy(()=>u(()=>import("./Alerts-ChDOowdj.js"),__vite__mapDeps([12,1,2]))),F=n.lazy(()=>u(()=>import("./Velocity-C1jcs0W8.js"),__vite__mapDeps([13,1,2,6]))),q=n.lazy(()=>u(()=>import("./Budget-D8f3izqR.js"),__vite__mapDeps([14,1,2,6]))),G=n.lazy(()=>u(()=>import("./OKRs-BFjYFYsj.js"),__vite__mapDeps([15,1,2]))),X=n.lazy(()=>u(()=>import("./Knowledge-C15Hq12L.js"),__vite__mapDeps([16,1,2]))),Y=n.lazy(()=>u(()=>import("./Comms-DfoH3vg_.js"),__vite__mapDeps([17,1,2]))),Q=n.lazy(()=>u(()=>import("./RD-DRBHxZUS.js"),__vite__mapDeps([18,1]))),Z=n.lazy(()=>u(()=>import("./Broadcast-C1P7QZAp.js"),__vite__mapDeps([19,1]))),ee=["Overview","Agents","Tasks","Projects","Jobs","Approvals","Usage","Crons","HITL","Alerts","Velocity","Budget","OKRs","Knowledge","Comms","R&D","Broadcast"],te={Overview:I,Agents:N,Tasks:$,Projects:B,Jobs:W,Approvals:H,Usage:U,Crons:J,HITL:M,Alerts:K,Velocity:F,Budget:q,OKRs:G,Knowledge:X,Comms:Y,"R&D":Q,Broadcast:Z};function re(){return r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"calc(100vh - 100px)",gap:16},children:[r.jsx("span",{style:{fontSize:32},children:"🦅"}),r.jsx("div",{style:{color:"var(--cyan)",fontSize:14,fontWeight:600},children:"Connecting to Ops Room…"}),r.jsx("div",{style:{color:"var(--muted)",fontSize:11},children:"Waiting for SSE push from dashboard.js"})]})}function ne(){return r.jsx("div",{className:"card",style:{color:"var(--muted)"},children:"Loading tab..."})}function oe(){const[e,o]=n.useState("Overview"),{data:s,connected:l,lastUpdated:t,updateCount:a}=C(),c={data:s,lastUpdated:t},f=s?{HITL:(s.hitl_tasks||[]).length,Alerts:(s.alerts||[]).length,Crons:(s.crons||[]).filter(i=>(i._consecutive_errors||0)>=3).length,Approvals:(s.approvals||[]).filter(i=>i.status==="pending").length}:{},m=n.useMemo(()=>te[e]||I,[e]);return r.jsxs("div",{style:{minHeight:"100vh"},children:[r.jsx(D,{data:s,connected:l,lastUpdated:t,updateCount:a}),r.jsx(V,{tabs:ee,active:e,onChange:o,badges:f}),r.jsx("main",{style:{padding:16},children:s?r.jsx(n.Suspense,{fallback:r.jsx(ne,{}),children:r.jsx(m,{...c})}):r.jsx(re,{})})]})}L.createRoot(document.getElementById("root")).render(r.jsx(n.StrictMode,{children:r.jsx(oe,{})}));export{x as a,ce as b,ie as c,ue as d,de as e,ae as f,le as r};
|