agi-farm 1.0.3 → 1.1.1

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 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
- ## 🆕 Recent Updates
39
-
40
- - 🚀 **Core runtime added (feature-flagged)**: jobs, background worker, skills, memory index, policy gates, approvals, audit log, and usage metering.
41
- - 🧭 **New dashboard tabs**: Jobs, Approvals, and Usage with live SSE updates.
42
- - 🔌 **New REST APIs**: `/api/jobs`, `/api/skills`, `/api/memory/search`, `/api/policies`, `/api/approvals`, `/api/usage`.
43
- - 🧪 **API integration smoke tests**: dashboard server is now tested end-to-end (job creation, approvals, metering, policy denies).
44
- - **Frontend performance pass**: lazy-loaded tabs + chunked Vite bundles to reduce initial payload.
45
- - 🔐 **CSRF token endpoint hardened**: `/api/session` now requires same-origin validation.
46
- - 🛡️ **SSE & data endpoints authenticated**: `/api/stream` and `/api/data` require CSRF token.
47
- - 🔒 **Security headers**: CSP, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, XSS-Protection.
48
- - 🧹 **Path traversal fix**: agent IDs from `AGENT_STATUS.json` are validated through `isSafeId()`.
49
- - 🚫 **HITL note sanitization**: `sanitizeNote()` strips control chars and prevents CLI flag injection.
50
- - 🔄 **Cron file locking**: `toggleCronEnabled` uses a mutex to prevent concurrent write races.
51
- - ⚙️ **CI hardened**: added eslint + `npm audit --audit-level=high`.
52
- - 📦 **All commands exposed**: all 7 commands available as global executables via `package.json` `bin`.
53
- - 🔐 **Origin validation**: mutation endpoints now validate `Origin` header only localhost origins accepted.
54
- - 🔒 **Timing-safe auth hardened**: CSRF token comparison no longer leaks token length via timing.
55
- - 📦 **Removed unused `sse.js`**: dependency cleaned from `package.json`.
56
- - 🔄 **Dynamic versioning**: extension reads version from `package.json` instead of hardcoding.
57
- - 🛠️ **ESM `__dirname` fix**: `src/index.ts` now uses `import.meta.dirname` with proper fallback.
58
- - 🧰 **Shared utilities**: extracted `runCommand` to `scripts/lib/run-command.js` — eliminates duplication.
59
- - **Env var consistency**: `export.js` and `status.js` now respect `AGI_FARM_WORKSPACE` like all other scripts.
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 Farm Dashboard Budget: $45.23/100 [LIVE]
69
- ├─────────────────────────────────────────────────────────────────┤
70
-
71
- │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
72
- 📊 42 38 4 🚨 2
73
- │ │ Tasks │ │ Done │ │ Active │ │ SLA Risk │ │
74
- └──────────┘ └──────────┘ └──────────┘ └──────────┘
75
-
76
- ┌─────────────────────────────────────────────────────────┐
77
- │ │ 🔮 Sage ✅ Ready 📨 3 msgs ⭐ 94% quality │ │
78
- │ ⚒️ Forge 🔄 Busy 📨 7 msgs ⭐ 89% quality
79
- 🐛 Pixel ✅ Ready 📨 2 msgs ⭐ 96% quality │ │
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 HITLAlerts ...
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
@@ -160,6 +170,39 @@ Answer the setup prompts and your team will be live in ~2 minutes:
160
170
  | 📤 `agi-farm export` | `agi-farm-export` | Push bundle to GitHub |
161
171
  | 🖥️ `agi-farm dashboard` | `agi-farm-dashboard` | Launch live ops room (SSE, :8080) |
162
172
  | ⚡ `agi-farm dispatch` | `agi-farm-dispatch` | Run auto-dispatcher manually |
173
+ | 🍎 `agi-farm launchagent` | `agi-farm-launchagent` | Install/uninstall macOS LaunchAgent for persistent dashboard |
174
+
175
+ ---
176
+
177
+ ## 🍎 Persistent Dashboard (macOS LaunchAgent)
178
+
179
+ The dashboard can run as a macOS LaunchAgent — it starts on login and auto-restarts if it crashes, independent of the OpenClaw gateway lifecycle.
180
+
181
+ ### Install
182
+
183
+ ```bash
184
+ # Install with defaults (port 8080, localhost)
185
+ agi-farm-launchagent
186
+
187
+ # Custom port and workspace
188
+ agi-farm-launchagent --port 9090 --workspace ~/my-workspace
189
+ ```
190
+
191
+ ### Uninstall
192
+
193
+ ```bash
194
+ agi-farm-launchagent --uninstall
195
+ ```
196
+
197
+ ### Why use this?
198
+
199
+ The plugin lifecycle (`onLoad`) spawns the dashboard as a child process. If the gateway exits, restarts, or doesn't reliably complete the lifecycle, the dashboard dies with it. The LaunchAgent runs the dashboard as an independent OS-level service:
200
+
201
+ - **RunAtLoad** — starts automatically on login
202
+ - **KeepAlive** — restarts if it crashes
203
+ - **Logs** — stdout/stderr saved to `/tmp/openclaw/agi-farm-dashboard.log`
204
+
205
+ > **Linux users**: Use `systemd` with a similar service unit. See the plist template in `templates/` for reference.
163
206
 
164
207
  ---
165
208
 
@@ -174,7 +217,8 @@ Answer the setup prompts and your team will be live in ~2 minutes:
174
217
  ├── 📂 dist/ Compiled TypeScript (backend)
175
218
  ├── 📂 dashboard-dist/ Built React frontend (production)
176
219
  ├── 🌐 server/
177
- │ ├── 🖥️ dashboard.js SSE server (Node.js)
220
+ │ ├── 🖥️ dashboard.js SSE server + CRUD API (Node.js)
221
+ │ ├── 🔄 updater.js GitHub release checker + auto-update
178
222
  │ └── 🛠️ utils.js Core parsing & logic (Unit Tested)
179
223
  ├── 📜 scripts/
180
224
  │ ├── 🎯 setup.js Setup wizard
@@ -215,13 +259,13 @@ Answer the setup prompts and your team will be live in ~2 minutes:
215
259
  │ │ SlowDataCache │ │ Broadcaster │ │
216
260
  │ │ (30s cache) │───▶│ (SSE fan-out) │ │
217
261
  │ └─────────────────────┘ └──────────────────┘ │
218
- │ │
219
- │ SSE stream │
220
- ▼ │
221
- ┌──────────────────┐ │
222
- │ React Frontend │ │
223
- │ (Vite + Recharts)│ │
224
- └──────────────────┘ │
262
+
263
+ ┌─────────────────────┐ │ SSE stream │
264
+ │ UpdateChecker │ ▼ │
265
+ │ (6h GitHub cache) │ ┌──────────────────┐ │
266
+ └─────────────────────┘ │ React Frontend │ │
267
+ │ (Vite + Recharts)│ │
268
+ └──────────────────┘ │
225
269
  │ │
226
270
  └──────────────────────────────────────────────────────────────┘
227
271
  ```
@@ -337,6 +381,7 @@ Configure AGI Farm in your `openclaw.json`:
337
381
  "dashboardPort": 8080,
338
382
  "dashboardHost": "127.0.0.1",
339
383
  "autoStartDashboard": true,
384
+ "autoCheckUpdates": true,
340
385
  "workspacePath": "~/.openclaw/workspace",
341
386
  "bundlePath": "~/.openclaw/workspace/agi-farm-bundle",
342
387
  "featureJobs": false,
@@ -359,6 +404,7 @@ Configure AGI Farm in your `openclaw.json`:
359
404
  | `dashboardPort` | number | 8080 | Port for live ops dashboard |
360
405
  | `dashboardHost` | string | "127.0.0.1" | Bind address for dashboard |
361
406
  | `autoStartDashboard` | boolean | true | Auto-start dashboard on load |
407
+ | `autoCheckUpdates` | boolean | true | Check GitHub for new releases on startup |
362
408
  | `workspacePath` | string | ~/.openclaw/workspace | Path to OpenClaw workspace |
363
409
  | `bundlePath` | string | <workspace>/agi-farm-bundle | Path to bundle directory |
364
410
  | `featureJobs` | boolean | false | Enable jobs runtime APIs + background worker |
@@ -411,6 +457,7 @@ All data updates in real-time from workspace files:
411
457
 
412
458
  The dashboard enables direct control over team operations via authenticated REST endpoints (all require CSRF token):
413
459
 
460
+ **HITL & Cron Controls:**
414
461
  - `POST /api/hitl/:id/approve` — Continue task with optional notes
415
462
  - `POST /api/hitl/:id/reject` — Block task and notify agent
416
463
  - `POST /api/cron/:id/trigger` — Manually run a specific cron job
@@ -424,6 +471,17 @@ The dashboard enables direct control over team operations via authenticated REST
424
471
  - `GET /api/approvals` + `POST /api/approvals/:id/(approve|reject)` — Human approval queue
425
472
  - `GET /api/usage` — Usage and cost aggregates for dashboard
426
473
 
474
+ **CRUD Operations:**
475
+ - `POST /api/task` — Create a new task with assignee, priority, dependencies
476
+ - `POST /api/agent/:id/message` — Send a message to a specific agent
477
+ - `POST /api/broadcast` — Post a team-wide broadcast message
478
+ - `POST /api/knowledge` — Add a shared knowledge entry
479
+ - `DELETE /api/knowledge/:id` — Remove a knowledge entry
480
+
481
+ **Auto-Update:**
482
+ - `GET /api/update-check` — Force a fresh GitHub release check
483
+ - `POST /api/update-install` — Install latest version via npm
484
+
427
485
  **Total push latency:** ~350ms from file change to browser update
428
486
 
429
487
  ---
@@ -554,6 +612,8 @@ This plugin is designed with defense-in-depth security:
554
612
  | **Note sanitization** | HITL notes stripped of control chars; CLI flag injection prevented |
555
613
  | **Rate limiting** | 120 req/min (read), 30 req/min (mutations) per IP |
556
614
  | **File locking** | Cron file writes use mutex to prevent concurrent corruption |
615
+ | **Atomic writes** | All file mutations use `.tmp` → `rename` pattern with in-memory locks |
616
+ | **Shell injection** | Update installer uses `execFile` (not `exec`) to prevent injection |
557
617
  | **Credential isolation** | Uses OpenClaw CLI — no API keys stored in plugin |
558
618
  | Supports encrypted secrets (`SECRETS/`, AES-256-GCM) | Expose secret values in API responses |
559
619
 
@@ -1 +1 @@
1
- import{r as p,a4 as e}from"./vendor-5MxLWm27.js";import{a as f}from"./index-DW5W626L.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
+ 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-DW5W626L.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
+ 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-DW5W626L.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(`
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-DW5W626L.js";import{L as z}from"./LastUpdated-BVeFtHFH.js";function w({content:r,label:d,color:o}){if(!r||r.trim()===""||r.trim()===`# ${d}
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-DW5W626L.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
+ 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-DW5W626L.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
+ 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-DW5W626L.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
+ 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-DW5W626L.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
+ 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)}}