agi-farm 1.0.0 → 1.0.3
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 +143 -61
- package/dashboard-dist/assets/Agents-DgFIbq8z.js +1 -0
- package/dashboard-dist/assets/Alerts-ChDOowdj.js +1 -0
- package/dashboard-dist/assets/Approvals-BQCkyOKZ.js +1 -0
- package/dashboard-dist/assets/Broadcast-C1P7QZAp.js +2 -0
- package/dashboard-dist/assets/Budget-D8f3izqR.js +1 -0
- package/dashboard-dist/assets/Comms-DfoH3vg_.js +4 -0
- package/dashboard-dist/assets/Crons-hqntDvlR.js +1 -0
- package/dashboard-dist/assets/HITL-D6eTUZeZ.js +1 -0
- package/dashboard-dist/assets/Jobs-VwINz0NT.js +1 -0
- package/dashboard-dist/assets/Knowledge-C15Hq12L.js +1 -0
- package/dashboard-dist/assets/LastUpdated-BVeFtHFH.js +1 -0
- package/dashboard-dist/assets/OKRs-BFjYFYsj.js +1 -0
- package/dashboard-dist/assets/Overview-OVGZf4_H.js +2 -0
- package/dashboard-dist/assets/Projects-BBOHTOLq.js +2 -0
- package/dashboard-dist/assets/RD-DRBHxZUS.js +1 -0
- package/dashboard-dist/assets/Tasks-CEzAlrR1.js +1 -0
- package/dashboard-dist/assets/Usage-MqbkYIgO.js +1 -0
- package/dashboard-dist/assets/Velocity-C1jcs0W8.js +1 -0
- package/dashboard-dist/assets/charts-BhPBsBGB.js +36 -0
- package/dashboard-dist/assets/{index-CAS2IEKB.css → index-Csnw3mqG.css} +1 -1
- package/dashboard-dist/assets/index-DW5W626L.js +2 -0
- package/dashboard-dist/assets/vendor-5MxLWm27.js +9 -0
- package/dashboard-dist/index.html +5 -3
- package/dist/index.d.ts +87 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +132 -0
- package/dist/index.js.map +1 -0
- package/openclaw.plugin.json +57 -3
- package/package.json +23 -19
- package/scripts/dashboard.js +4 -1
- package/scripts/dispatch.js +12 -0
- package/scripts/export.js +1 -1
- package/scripts/lib/run-command.js +16 -0
- package/scripts/setup.js +1 -10
- package/scripts/status.js +1 -1
- package/scripts/teardown.js +1 -10
- package/server/dashboard.js +430 -108
- package/server/services/audit.js +17 -0
- package/server/services/feature-flags.js +14 -0
- package/server/services/jobs.js +226 -0
- package/server/services/memory.js +66 -0
- package/server/services/metering.js +62 -0
- package/server/services/policy.js +124 -0
- package/server/services/secrets.js +66 -0
- package/server/services/skills.js +72 -0
- package/server/services/storage.js +43 -0
- package/server/services/worker.js +212 -0
- package/server/utils.js +125 -0
- package/dashboard-dist/assets/index-BkPgvUOQ.js +0 -50
package/README.md
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
**Build production-ready AI teams with a single command**
|
|
8
8
|
|
|
9
|
+
[](https://www.npmjs.com/package/agi-farm)
|
|
9
10
|
[](https://opensource.org/licenses/MIT)
|
|
10
11
|
[](https://docs.openclaw.ai)
|
|
11
12
|
[](https://nodejs.org/)
|
|
12
|
-
[](https://www.typescriptlang.org/)
|
|
13
13
|
|
|
14
14
|
[Quick Start](#-quick-start) • [Features](#-what-it-does) • [Documentation](#-commands) • [Architecture](#-architecture)
|
|
15
15
|
|
|
@@ -29,8 +29,34 @@
|
|
|
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** |
|
|
33
|
-
|
|
|
32
|
+
| 🛡️ **Production Hardened** | Security-audited with CSRF, Origin validation, and timing-safe auth |
|
|
33
|
+
| ⚙️ **Feature-Flagged Runtime** | Optional jobs, skills, memory, policy, approvals, and metering modules |
|
|
34
|
+
| 🧪 **103 Automated Tests** | Unit + integration + API smoke coverage with Jest/ESM |
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
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.
|
|
34
60
|
|
|
35
61
|
---
|
|
36
62
|
|
|
@@ -88,37 +114,35 @@
|
|
|
88
114
|
### Install
|
|
89
115
|
|
|
90
116
|
```bash
|
|
91
|
-
# Install from npm
|
|
92
|
-
|
|
117
|
+
# Install officially from npm
|
|
118
|
+
npm install -g agi-farm
|
|
93
119
|
|
|
94
|
-
# Or
|
|
95
|
-
openclaw plugins install
|
|
120
|
+
# Or via OpenClaw plugin manager
|
|
121
|
+
openclaw plugins install agi-farm
|
|
96
122
|
```
|
|
97
123
|
|
|
98
124
|
### Run Setup Wizard
|
|
99
125
|
|
|
100
126
|
```bash
|
|
101
127
|
# Start the interactive wizard
|
|
102
|
-
|
|
128
|
+
agi-farm setup
|
|
103
129
|
```
|
|
104
130
|
|
|
105
|
-
Answer
|
|
131
|
+
Answer the setup prompts and your team will be live in ~2 minutes:
|
|
106
132
|
|
|
107
133
|
```
|
|
108
134
|
🧙 AGI Farm Setup Wizard
|
|
109
135
|
|
|
110
136
|
? Team name (e.g., "CooperCorp"): MyTeam
|
|
137
|
+
? Orchestrator name: Cooper
|
|
111
138
|
? Team size: 11 agents (Full Stack)
|
|
112
|
-
? Domain:
|
|
113
|
-
?
|
|
114
|
-
? GitHub repo: myteam/ai-agents
|
|
139
|
+
? Domain: general
|
|
140
|
+
? Collaboration frameworks: langgraph
|
|
115
141
|
? Confirm setup? Yes
|
|
116
142
|
|
|
117
143
|
✅ Creating 11 agents...
|
|
118
144
|
✅ Setting up workspace...
|
|
119
|
-
✅
|
|
120
|
-
✅ Creating GitHub bundle...
|
|
121
|
-
✅ Launching dashboard...
|
|
145
|
+
✅ Initializing AGI Farm registries...
|
|
122
146
|
|
|
123
147
|
🎉 Your AI team is ready!
|
|
124
148
|
```
|
|
@@ -127,15 +151,15 @@ Answer 6 questions and your team will be live in ~2 minutes:
|
|
|
127
151
|
|
|
128
152
|
## 📦 Commands
|
|
129
153
|
|
|
130
|
-
| Command |
|
|
131
|
-
|
|
132
|
-
| 🎯
|
|
133
|
-
| 🗑️
|
|
134
|
-
| 📊
|
|
135
|
-
| 🔧
|
|
136
|
-
| 📤
|
|
137
|
-
| 🖥️
|
|
138
|
-
| ⚡
|
|
154
|
+
| Command | CLI Shortcut | Description |
|
|
155
|
+
|---------|-------------|-------------|
|
|
156
|
+
| 🎯 `agi-farm setup` | `agi-farm` | Full wizard — agents, workspace, crons |
|
|
157
|
+
| 🗑️ `agi-farm teardown` | `agi-farm-teardown` | Full uninstall — removes agents, bundle, and registries |
|
|
158
|
+
| 📊 `agi-farm status` | `agi-farm-status` | Team health: agents, tasks, cron status |
|
|
159
|
+
| 🔧 `agi-farm rebuild` | `agi-farm-rebuild` | Regenerate workspace from bundle |
|
|
160
|
+
| 📤 `agi-farm export` | `agi-farm-export` | Push bundle to GitHub |
|
|
161
|
+
| 🖥️ `agi-farm dashboard` | `agi-farm-dashboard` | Launch live ops room (SSE, :8080) |
|
|
162
|
+
| ⚡ `agi-farm dispatch` | `agi-farm-dispatch` | Run auto-dispatcher manually |
|
|
139
163
|
|
|
140
164
|
---
|
|
141
165
|
|
|
@@ -144,11 +168,11 @@ Answer 6 questions and your team will be live in ~2 minutes:
|
|
|
144
168
|
### Plugin Structure
|
|
145
169
|
|
|
146
170
|
```
|
|
147
|
-
.openclaw/extensions/agi-farm/
|
|
171
|
+
.openclaw/extensions/agi-farm/ (or global node_modules/agi-farm/)
|
|
148
172
|
├── 📦 package.json Plugin manifest (ESM)
|
|
149
173
|
├── ⚙️ openclaw.plugin.json Config schema & commands
|
|
150
|
-
├── 📂
|
|
151
|
-
|
|
174
|
+
├── 📂 dist/ Compiled TypeScript (backend)
|
|
175
|
+
├── 📂 dashboard-dist/ Built React frontend (production)
|
|
152
176
|
├── 🌐 server/
|
|
153
177
|
│ ├── 🖥️ dashboard.js SSE server (Node.js)
|
|
154
178
|
│ └── 🛠️ utils.js Core parsing & logic (Unit Tested)
|
|
@@ -159,9 +183,11 @@ Answer 6 questions and your team will be live in ~2 minutes:
|
|
|
159
183
|
│ ├── 🔧 rebuild.js Rebuilder
|
|
160
184
|
│ ├── 📤 export.js GitHub exporter
|
|
161
185
|
│ ├── 🖥️ dashboard.js Dashboard launcher
|
|
162
|
-
│
|
|
186
|
+
│ ├── ⚡ dispatch.js Auto-dispatcher
|
|
187
|
+
│ └── 📂 lib/
|
|
188
|
+
│ └── 🛠️ run-command.js Shared CLI utility
|
|
163
189
|
├── 📋 templates/ Agent & workspace templates
|
|
164
|
-
├── ⚛️ dashboard-react/ Vite + React 18
|
|
190
|
+
├── ⚛️ dashboard-react/ Vite + React 18 source (Dev)
|
|
165
191
|
└── 📚 skills/
|
|
166
192
|
└── 📖 SKILL.md Embedded documentation
|
|
167
193
|
```
|
|
@@ -284,16 +310,16 @@ Complete team for complex systems - **RECOMMENDED**
|
|
|
284
310
|
|
|
285
311
|
Choose the right model for each role to optimize cost and quality:
|
|
286
312
|
|
|
287
|
-
| Role | Model
|
|
313
|
+
| Role | Recommended Model | Why | Cost/Quality |
|
|
288
314
|
|------|-----------|-----|--------------|
|
|
289
|
-
| 🦅 Orchestrator |
|
|
290
|
-
| 🔮 Architect |
|
|
291
|
-
| ⚒️ Engineer |
|
|
292
|
-
| 🐛 Debugger |
|
|
293
|
-
| 🔭 Analyst |
|
|
294
|
-
| 🛡️ QA |
|
|
295
|
-
| ⚓ Content |
|
|
296
|
-
| 🧪 R&D |
|
|
315
|
+
| 🦅 Orchestrator | `anthropic/claude-3-5-sonnet` | High-level planning & delegation | 💰💰💰 / ⭐⭐⭐ |
|
|
316
|
+
| 🔮 Architect | `anthropic/claude-3-opus` | Deep reasoning & system design | 💰💰💰 / ⭐⭐⭐ |
|
|
317
|
+
| ⚒️ Engineer | `google/gemini-1.5-pro` | Reliable code gen & large context | 💰💰 / ⭐⭐ |
|
|
318
|
+
| 🐛 Debugger | `anthropic/claude-3-5-sonnet` | Precision logic & error analysis | 💰💰 / ⭐⭐⭐ |
|
|
319
|
+
| 🔭 Analyst | `google/gemini-2.0-flash` | Ultra-fast data synthesis | 💰 / ⭐⭐ |
|
|
320
|
+
| 🛡️ QA | `anthropic/claude-3-haiku` | Rapid pattern validation | 💰 / ⭐ |
|
|
321
|
+
| ⚓ Content | `google/gemini-1.5-pro` | Rich multimodal generation | 💰💰 / ⭐⭐⭐ |
|
|
322
|
+
| 🧪 R&D | `deepseek/deepseek-reasoner` | Structured creative experimentation | 💰 / ⭐⭐⭐ |
|
|
297
323
|
|
|
298
324
|
---
|
|
299
325
|
|
|
@@ -312,7 +338,13 @@ Configure AGI Farm in your `openclaw.json`:
|
|
|
312
338
|
"dashboardHost": "127.0.0.1",
|
|
313
339
|
"autoStartDashboard": true,
|
|
314
340
|
"workspacePath": "~/.openclaw/workspace",
|
|
315
|
-
"bundlePath": "~/.openclaw/workspace/agi-farm-bundle"
|
|
341
|
+
"bundlePath": "~/.openclaw/workspace/agi-farm-bundle",
|
|
342
|
+
"featureJobs": false,
|
|
343
|
+
"featureSkills": false,
|
|
344
|
+
"featureMemory": false,
|
|
345
|
+
"featurePolicy": false,
|
|
346
|
+
"featureMetering": false,
|
|
347
|
+
"featureApprovals": false
|
|
316
348
|
}
|
|
317
349
|
}
|
|
318
350
|
}
|
|
@@ -329,6 +361,26 @@ Configure AGI Farm in your `openclaw.json`:
|
|
|
329
361
|
| `autoStartDashboard` | boolean | true | Auto-start dashboard on load |
|
|
330
362
|
| `workspacePath` | string | ~/.openclaw/workspace | Path to OpenClaw workspace |
|
|
331
363
|
| `bundlePath` | string | <workspace>/agi-farm-bundle | Path to bundle directory |
|
|
364
|
+
| `featureJobs` | boolean | false | Enable jobs runtime APIs + background worker |
|
|
365
|
+
| `featureSkills` | boolean | false | Enable skills registry and routing endpoints |
|
|
366
|
+
| `featureMemory` | boolean | false | Enable memory indexing + search endpoint |
|
|
367
|
+
| `featurePolicy` | boolean | false | Enable policy evaluation on runtime/mutation actions |
|
|
368
|
+
| `featureMetering` | boolean | false | Enable usage metering collection + API |
|
|
369
|
+
| `featureApprovals` | boolean | false | Enable approval workflows for policy-gated actions |
|
|
370
|
+
|
|
371
|
+
### Runtime Files Added By Core Modules
|
|
372
|
+
|
|
373
|
+
When feature flags are enabled, AGI Farm lazily creates these additive workspace files:
|
|
374
|
+
|
|
375
|
+
- `JOBS.json`
|
|
376
|
+
- `JOB_RUNS.jsonl`
|
|
377
|
+
- `SKILLS_REGISTRY.json`
|
|
378
|
+
- `MEMORY_INDEX.json`
|
|
379
|
+
- `POLICIES.json`
|
|
380
|
+
- `APPROVALS.json`
|
|
381
|
+
- `AUDIT_LOG.jsonl`
|
|
382
|
+
- `USAGE_METERING.json`
|
|
383
|
+
- `SECRETS/` (encrypted blobs + metadata)
|
|
332
384
|
|
|
333
385
|
---
|
|
334
386
|
|
|
@@ -351,15 +403,26 @@ All data updates in real-time from workspace files:
|
|
|
351
403
|
| 📚 Knowledge | `SHARED_KNOWLEDGE.json` | Instant | ~50ms |
|
|
352
404
|
| 🧠 Memory | `MEMORY.md` | Instant | ~50ms |
|
|
353
405
|
| 🔄 Agent Models | `openclaw agents list` | Cached | ~30s |
|
|
406
|
+
| 🗂️ Jobs | `JOBS.json` | Instant | ~50ms |
|
|
407
|
+
| ✅ Approvals | `APPROVALS.json` | Instant | ~50ms |
|
|
408
|
+
| 📊 Usage | `USAGE_METERING.json` | Instant | ~50ms |
|
|
354
409
|
|
|
355
410
|
### Interactive Actions (API)
|
|
356
411
|
|
|
357
|
-
The dashboard enables direct control over team operations via
|
|
412
|
+
The dashboard enables direct control over team operations via authenticated REST endpoints (all require CSRF token):
|
|
358
413
|
|
|
359
414
|
- `POST /api/hitl/:id/approve` — Continue task with optional notes
|
|
360
415
|
- `POST /api/hitl/:id/reject` — Block task and notify agent
|
|
361
416
|
- `POST /api/cron/:id/trigger` — Manually run a specific cron job
|
|
362
417
|
- `POST /api/cron/:id/toggle` — Enable or disable a cron job
|
|
418
|
+
- `POST /api/jobs` — Create a background job from high-level intent
|
|
419
|
+
- `GET /api/jobs` / `GET /api/jobs/:id` — List and inspect jobs
|
|
420
|
+
- `POST /api/jobs/:id/cancel` / `POST /api/jobs/:id/retry` — Control failed/running jobs
|
|
421
|
+
- `GET /api/skills` + `POST /api/skills/:id/(enable|disable)` — Manage skill activation
|
|
422
|
+
- `GET /api/memory/search?q=&tags=` — Search memory index
|
|
423
|
+
- `GET /api/policies` — Retrieve active policy rules
|
|
424
|
+
- `GET /api/approvals` + `POST /api/approvals/:id/(approve|reject)` — Human approval queue
|
|
425
|
+
- `GET /api/usage` — Usage and cost aggregates for dashboard
|
|
363
426
|
|
|
364
427
|
**Total push latency:** ~350ms from file change to browser update
|
|
365
428
|
|
|
@@ -408,7 +471,7 @@ The auto-dispatcher intelligently routes tasks to agents:
|
|
|
408
471
|
|
|
409
472
|
```bash
|
|
410
473
|
# Manual dry-run
|
|
411
|
-
|
|
474
|
+
agi-farm dispatch
|
|
412
475
|
|
|
413
476
|
# Check logs
|
|
414
477
|
tail -f ~/.openclaw/workspace/logs/auto-dispatch.log
|
|
@@ -426,8 +489,8 @@ cd AGI-FARM-PLUGIN
|
|
|
426
489
|
# Install dependencies
|
|
427
490
|
npm install
|
|
428
491
|
|
|
429
|
-
# Build
|
|
430
|
-
npm run build
|
|
492
|
+
# Build backend and dashboard
|
|
493
|
+
npm run build:all
|
|
431
494
|
|
|
432
495
|
# Link to OpenClaw extensions
|
|
433
496
|
ln -s $(pwd) ~/.openclaw/extensions/agi-farm
|
|
@@ -438,7 +501,10 @@ ln -s $(pwd) ~/.openclaw/extensions/agi-farm
|
|
|
438
501
|
## 💻 Development
|
|
439
502
|
|
|
440
503
|
```bash
|
|
441
|
-
# Build
|
|
504
|
+
# Build everything (TS + Dashboard)
|
|
505
|
+
npm run build:all
|
|
506
|
+
|
|
507
|
+
# Build backend only
|
|
442
508
|
npm run build
|
|
443
509
|
|
|
444
510
|
# Watch mode for development
|
|
@@ -463,27 +529,33 @@ npm run start-dashboard
|
|
|
463
529
|
|
|
464
530
|
| Symptom | Fix | Command |
|
|
465
531
|
|---------|-----|---------|
|
|
466
|
-
| ❌ Plugin fails to load |
|
|
467
|
-
| 📊 Dashboard shows stale data |
|
|
468
|
-
| 🤖 Agent stuck >30 min |
|
|
469
|
-
| ⚠️ `openclaw` not found | Add to PATH | `export PATH=$PATH
|
|
470
|
-
| 🔐
|
|
471
|
-
| ⏰ Cron
|
|
472
|
-
| 📄
|
|
473
|
-
| 🐌 Rate-limit too aggressive | Adjust backoff | Edit dispatch script |
|
|
532
|
+
| ❌ Plugin fails to load | Check global install | `npm list -g agi-farm` |
|
|
533
|
+
| 📊 Dashboard shows stale data | Sync with workspace | `agi-farm status` |
|
|
534
|
+
| 🤖 Agent stuck >30 min | Verify heartbeats | `cat ~/.openclaw/workspace/HEARTBEAT.md` |
|
|
535
|
+
| ⚠️ `openclaw` not found | Add to PATH | `export PATH=$PATH:$(npm bin -g)` |
|
|
536
|
+
| 🔐 Access Denied | Check npm login | `npm whoami` |
|
|
537
|
+
| ⏰ Cron registration error | Clean crontab | `openclaw cron list --fix` |
|
|
538
|
+
| 📄 JSON Parse Error | Re-run setup | `agi-farm setup --force` |
|
|
474
539
|
|
|
475
540
|
---
|
|
476
541
|
|
|
477
542
|
## 🔒 Security
|
|
478
543
|
|
|
479
|
-
This plugin is designed with
|
|
480
|
-
|
|
481
|
-
|
|
|
482
|
-
|
|
483
|
-
|
|
|
484
|
-
|
|
|
485
|
-
|
|
|
486
|
-
|
|
|
544
|
+
This plugin is designed with defense-in-depth security:
|
|
545
|
+
|
|
546
|
+
| Layer | Protection |
|
|
547
|
+
|-------|-----------|
|
|
548
|
+
| **Network** | Dashboard binds to `127.0.0.1` only — not exposed to LAN or internet |
|
|
549
|
+
| **Origin validation** | `/api/session` gated by Origin/Referer — cross-origin token theft blocked |
|
|
550
|
+
| **CSRF tokens** | All mutation endpoints require timing-safe CSRF token comparison |
|
|
551
|
+
| **SSE authentication** | `/api/stream` and `/api/data` require CSRF token — prevents cross-origin data exfiltration |
|
|
552
|
+
| **Security headers** | CSP, X-Frame-Options (DENY), X-Content-Type-Options, Referrer-Policy |
|
|
553
|
+
| **Input validation** | Agent IDs validated via `isSafeId()` regex — blocks path traversal |
|
|
554
|
+
| **Note sanitization** | HITL notes stripped of control chars; CLI flag injection prevented |
|
|
555
|
+
| **Rate limiting** | 120 req/min (read), 30 req/min (mutations) per IP |
|
|
556
|
+
| **File locking** | Cron file writes use mutex to prevent concurrent corruption |
|
|
557
|
+
| **Credential isolation** | Uses OpenClaw CLI — no API keys stored in plugin |
|
|
558
|
+
| Supports encrypted secrets (`SECRETS/`, AES-256-GCM) | Expose secret values in API responses |
|
|
487
559
|
|
|
488
560
|
**Your credentials stay in OpenClaw's configuration.**
|
|
489
561
|
|
|
@@ -522,6 +594,16 @@ MIT License — built for [OpenClaw](https://docs.openclaw.ai)
|
|
|
522
594
|
|
|
523
595
|
Copyright (c) 2025 oabdelmaksoud
|
|
524
596
|
|
|
597
|
+
## 📈 Star History
|
|
598
|
+
|
|
599
|
+
<a href="https://www.star-history.com/?repos=oabdelmaksoud%2FAGI-FARM-PLUGIN&type=date&legend=top-left">
|
|
600
|
+
<picture>
|
|
601
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/image?repos=oabdelmaksoud/AGI-FARM-PLUGIN&type=date&theme=dark&legend=bottom-right" />
|
|
602
|
+
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/image?repos=oabdelmaksoud/AGI-FARM-PLUGIN&type=date&legend=bottom-right" />
|
|
603
|
+
<img alt="Star History Chart" src="https://api.star-history.com/image?repos=oabdelmaksoud/AGI-FARM-PLUGIN&type=date&legend=bottom-right" />
|
|
604
|
+
</picture>
|
|
605
|
+
</a>
|
|
606
|
+
|
|
525
607
|
---
|
|
526
608
|
|
|
527
609
|
## 🔗 Links
|
|
@@ -529,7 +611,7 @@ Copyright (c) 2025 oabdelmaksoud
|
|
|
529
611
|
- **GitHub**: https://github.com/oabdelmaksoud/AGI-FARM-PLUGIN
|
|
530
612
|
- **Issues**: https://github.com/oabdelmaksoud/AGI-FARM-PLUGIN/issues
|
|
531
613
|
- **OpenClaw Docs**: https://docs.openclaw.ai
|
|
532
|
-
- **NPM Package**:
|
|
614
|
+
- **NPM Package**: https://www.npmjs.com/package/agi-farm
|
|
533
615
|
|
|
534
616
|
---
|
|
535
617
|
|
|
@@ -0,0 +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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as f,a4 as r}from"./vendor-5MxLWm27.js";import{L as j}from"./LastUpdated-BVeFtHFH.js";const h={critical:"var(--red)",high:"var(--red)",medium:"var(--amber)",low:"var(--muted)"},y={hitl:"🚨",sla_breach:"⏰",agent_error:"🔴",cron_error:"⚙️",blocked:"🚫"},g={hitl:"HITL",sla_breach:"SLA",agent_error:"Agent",cron_error:"Cron",blocked:"Blocked"};function S(n){if(!n)return"";try{const s=Math.round((Date.now()-new Date(n))/6e4);return s<1?"just now":s<60?`${s}m ago`:`${Math.round(s/60)}h ago`}catch{return""}}function _({data:n,lastUpdated:s}){const{alerts:o=[],agents:u=[]}=n,[a,p]=f.useState(new Set),[t,v]=f.useState("all"),x=o.filter(e=>!a.has(e.id)),m=x.filter(e=>t==="all"||e.type===t),b=["all",...new Set(o.map(e=>e.type))],d={critical:0,high:0,medium:0,low:0};return x.forEach(e=>{d[e.severity]!==void 0&&d[e.severity]++}),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:Object.entries(d).map(([e,i])=>r.jsxs("div",{className:"card",style:{textAlign:"center"},children:[r.jsx("div",{className:"section-title",style:{textTransform:"capitalize"},children:e}),r.jsx("div",{style:{fontSize:22,fontWeight:700,color:i?h[e]:"var(--muted)"},children:i})]},e))}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[b.map(e=>r.jsxs("button",{onClick:()=>v(e),style:{background:t===e?"rgba(0,229,255,.15)":"var(--surface)",border:`1px solid ${t===e?"rgba(0,229,255,.4)":"var(--border)"}`,color:t===e?"var(--cyan)":"var(--muted)",padding:"4px 12px",borderRadius:4,fontSize:11,cursor:"pointer",fontFamily:"inherit"},children:[y[e]||""," ",g[e]||e]},e)),a.size>0&&r.jsxs("button",{onClick:()=>p(new Set),style:{marginLeft:"auto",background:"none",border:"1px solid var(--border)",color:"var(--muted)",padding:"4px 10px",borderRadius:4,fontSize:11,cursor:"pointer",fontFamily:"inherit"},children:["↺ Restore ",a.size," dismissed"]}),r.jsx(j,{ts:s})]}),m.length===0&&r.jsxs("div",{className:"card",style:{color:"var(--green)",fontSize:13},children:["✅ ",o.length===0?"No alerts — all systems nominal.":"All alerts dismissed for this session."]}),m.map(e=>{const i=h[e.severity]||"var(--muted)",l=u.find(c=>c.id===e.agent_id);return r.jsxs("div",{style:{background:"var(--bg2)",borderRadius:8,border:`1px solid ${i}44`,boxShadow:`0 0 12px ${i}0d`,display:"flex",gap:14,padding:"14px 16px",alignItems:"flex-start"},children:[r.jsx("span",{style:{fontSize:22,flexShrink:0},children:y[e.type]||"⚠️"}),r.jsxs("div",{style:{flex:1,minWidth:0},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4,flexWrap:"wrap"},children:[r.jsx("span",{style:{fontWeight:700,fontSize:13},children:e.title}),r.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:3,fontWeight:700,textTransform:"uppercase",color:i,background:`${i}18`,border:`1px solid ${i}44`},children:e.severity})]}),e.detail&&r.jsx("div",{style:{fontSize:12,color:"var(--muted)",lineHeight:1.5,marginBottom:4},children:e.detail}),r.jsxs("div",{style:{fontSize:10,color:"var(--muted)",display:"flex",gap:10},children:[l&&r.jsxs("span",{children:[l.emoji," ",l.name]}),r.jsx("span",{children:g[e.type]}),r.jsx("span",{children:S(e.ts)}),e.task_id&&r.jsx("span",{style:{color:"var(--cyan)"},children:e.task_id}),e.cron_id&&r.jsxs("span",{style:{color:"var(--cyan)",fontFamily:"monospace",fontSize:9},children:[e.cron_id.slice(0,8),"…"]})]})]}),r.jsx("button",{onClick:()=>p(c=>new Set([...c,e.id])),title:"Dismiss alert",style:{background:"none",border:"1px solid var(--border)",color:"var(--muted)",padding:"3px 8px",borderRadius:4,cursor:"pointer",fontSize:10,fontFamily:"inherit",flexShrink:0},children:"✕"})]},e.id)})]})}export{_ as default};
|
|
@@ -0,0 +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};
|
|
@@ -0,0 +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(`
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a4 as e}from"./vendor-5MxLWm27.js";import{L as b}from"./LastUpdated-BVeFtHFH.js";import{R as u,B as v,X as S,Y as w,T as k,d as _,f as z}from"./charts-BhPBsBGB.js";function C({data:c,lastUpdated:p}){const{budget:i={}}=c,a=i.limits||{},t=i.current||{},n=i.alerts||{},r=i.per_agent||{},m=i.per_model||{},h=i.notes||null,y=i.last_updated||null,j=[{label:"Daily",spent:t.daily_usd??0,limit:a.daily_usd??0,threshold:n.daily_threshold_pct??70},{label:"Weekly",spent:t.weekly_usd??0,limit:a.weekly_usd??0,threshold:n.weekly_threshold_pct??70},{label:"Monthly",spent:t.monthly_usd??0,limit:a.monthly_usd??0,threshold:80}];return e.jsxs("div",{className:"fade-in",style:{display:"grid",gap:14},children:[h&&e.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,214,0,.07)",border:"1px solid rgba(255,214,0,.25)",borderRadius:6,fontSize:11,color:"var(--amber)",display:"flex",alignItems:"flex-start",gap:8},children:[e.jsx("span",{children:"⚠"}),e.jsxs("div",{children:[e.jsx("span",{children:h}),y&&e.jsxs("span",{style:{color:"var(--muted)",marginLeft:12},children:["Last updated: ",new Date(y).toLocaleString()]})]}),e.jsx(b,{ts:p})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3,1fr)",gap:14},children:j.map(({label:s,spent:l,limit:x,threshold:d})=>{const o=x>0?Math.min(100,l/x*100):0,g=o>=d;return e.jsxs("div",{className:"card",children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:8},children:[e.jsx("span",{className:"section-title",children:s}),e.jsxs("span",{style:{fontSize:11,fontWeight:700,color:g?"var(--red)":"var(--cyan)"},children:["$",l.toFixed(2)," / $",x]})]}),e.jsxs("div",{className:"progress-track",style:{position:"relative"},children:[e.jsx("div",{className:"progress-fill",style:{width:`${o}%`,background:o>d?"var(--red)":o>d*.8?"var(--amber)":"var(--cyan)"}}),e.jsx("div",{style:{position:"absolute",top:-2,bottom:-2,left:`${d}%`,width:1,background:"var(--amber)",opacity:.6}})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:4,fontSize:10,color:"var(--muted)"},children:[e.jsxs("span",{children:[o.toFixed(1),"% used"]}),e.jsxs("span",{style:{color:"var(--amber)"},children:["⚠ at ",d,"%"]})]})]},s)})}),Object.keys(r).length>0&&e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"section-title",style:{marginBottom:12},children:"Agent Spend Distribution"}),e.jsx(u,{width:"100%",height:Math.max(200,Object.keys(r).length*32),children:e.jsxs(v,{data:Object.entries(r).map(([s,l])=>({name:s,spent:typeof l=="object"?l.spent??0:l})).sort((s,l)=>l.spent-s.spent),layout:"vertical",margin:{left:80,right:20,top:5,bottom:5},children:[e.jsx(S,{type:"number",tick:{fill:"#546e7a",fontSize:10},tickFormatter:s=>`$${s.toFixed(2)}`}),e.jsx(w,{type:"category",dataKey:"name",tick:{fill:"#b0bec5",fontSize:11},width:75}),e.jsx(k,{formatter:s=>[`$${s.toFixed(3)}`,"Spent"],contentStyle:{background:"#1a1a2e",border:"1px solid #2a2a4a",borderRadius:6,fontSize:11}}),e.jsx(_,{dataKey:"spent",radius:[0,4,4,0],children:Object.entries(r).map(([s],l)=>e.jsx(z,{fill:["#00e5ff","#00e676","#ffd600","#e040fb","#ff6e40","#18ffff","#76ff03","#ffab40"][l%8],fillOpacity:.7},s))})]})})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:14},children:[e.jsx(f,{title:"By Agent",data:r}),e.jsx(f,{title:"By Model",data:m})]})]})}function f({title:c,data:p}){const i=Object.entries(p).sort(([,a],[,t])=>{const n=typeof a=="object"?a.spent??0:a;return(typeof t=="object"?t.spent??0:t)-n});return e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"section-title",children:c}),i.length===0?e.jsx("div",{style:{color:"var(--muted)",fontSize:11,paddingTop:8},children:"No spend data yet"}):e.jsxs("table",{style:{width:"100%",fontSize:11,borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{borderBottom:"1px solid var(--border)"},children:[e.jsx("th",{style:{textAlign:"left",padding:"4px 0",color:"var(--muted)",fontSize:10},children:"Name"}),e.jsx("th",{style:{textAlign:"right",padding:"4px 0",color:"var(--muted)",fontSize:10},children:"Spent"}),e.jsx("th",{style:{textAlign:"right",padding:"4px 0",color:"var(--muted)",fontSize:10},children:"Calls"})]})}),e.jsx("tbody",{children:i.map(([a,t])=>{const n=typeof t=="object"?t.spent??0:t,r=typeof t=="object"?t.calls??"—":"—";return e.jsxs("tr",{style:{borderBottom:"1px solid rgba(255,255,255,.03)"},children:[e.jsx("td",{style:{padding:"5px 0",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a}),e.jsxs("td",{style:{padding:"5px 0",textAlign:"right",color:"var(--cyan)",fontWeight:600},children:["$",n.toFixed(3)]}),e.jsx("td",{style:{padding:"5px 0",textAlign:"right",color:"var(--muted)"},children:r})]},a)})})]})]})}export{C as default};
|
|
@@ -0,0 +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}
|
|
2
|
+
|
|
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
|
+
`);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};
|
|
@@ -0,0 +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};
|
|
@@ -0,0 +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};
|
|
@@ -0,0 +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};
|
|
@@ -0,0 +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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a4 as a}from"./vendor-5MxLWm27.js";function n({ts:e,count:t}){return e?a.jsxs("span",{style:{fontSize:9,color:"var(--muted)",marginLeft:"auto",display:"flex",alignItems:"center",gap:6},children:[t!=null&&a.jsxs("span",{style:{color:"var(--cyan)",opacity:.6},children:["#",t]}),"↻ ",e.toLocaleTimeString()]}):null}export{n as L};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a4 as e}from"./vendor-5MxLWm27.js";import{L as v}from"./LastUpdated-BVeFtHFH.js";function f({data:l,lastUpdated:m}){const i=l.okrs||{},a=i.objectives||i.okrs||[];return e.jsxs("div",{className:"fade-in",style:{display:"grid",gap:14},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",marginBottom:2},children:[e.jsx("span",{style:{fontSize:10,color:"var(--muted)",textTransform:"uppercase",letterSpacing:".08em"},children:i.quarter||"OKRs"}),e.jsx(v,{ts:m})]}),a.length===0&&e.jsxs("div",{className:"card",style:{color:"var(--muted)",fontSize:13},children:["No OKRs defined yet. Add objectives to ",e.jsx("code",{children:"OKRs.json"})," in your workspace."]}),a.map((r,o)=>e.jsxs("div",{className:"card",children:[e.jsx("div",{style:{fontWeight:700,fontSize:14,marginBottom:14,color:"var(--cyan)"},children:r.objective||r.title||`Objective ${o+1}`}),(r.key_results||r.krs||[]).map((t,d)=>{const c=t.current??0,n=t.target??100,s=n>0?Math.min(100,c/n*100):0,p=t.unit?` ${t.unit}`:"";return e.jsxs("div",{style:{marginBottom:14,paddingLeft:12,borderLeft:"2px solid rgba(0,229,255,.2)"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:5},children:[e.jsx("span",{style:{fontSize:12,flex:1,paddingRight:12},children:t.result||t.title||t.description||`KR ${d+1}`}),e.jsxs("span",{style:{fontSize:11,fontWeight:600,whiteSpace:"nowrap",color:s>=100?"var(--green)":"var(--amber)"},children:[c," / ",n,p]})]}),e.jsx("div",{className:"progress-track",children:e.jsx("div",{className:"progress-fill",style:{width:`${s}%`,background:s>=100?"var(--green)":s>=70?"var(--cyan)":s>=40?"var(--amber)":"var(--red)"}})}),e.jsxs("div",{style:{fontSize:10,color:"var(--muted)",marginTop:3},children:[s.toFixed(0),"%"]})]},t.id||d)})]},r.id||o))]})}export{f as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a4 as e}from"./vendor-5MxLWm27.js";import{L as w}from"./LastUpdated-BVeFtHFH.js";function C({agent:t}){const r={active:"dot-active",available:"dot-available",busy:"dot-busy",error:"dot-error"}[t.status]||"dot-offline";return e.jsxs("div",{className:"card",style:{padding:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[e.jsx("span",{style:{fontSize:18},children:t.emoji||"🤖"}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:600,fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),e.jsx("div",{style:{color:"var(--muted)",fontSize:10},children:t.role})]}),t.inbox_count>0&&e.jsxs("span",{style:{fontSize:10,color:"var(--amber)",fontWeight:600},children:["📬",t.inbox_count]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{className:`dot ${r}`}),e.jsx("span",{style:{fontSize:10,color:"var(--muted)",textTransform:"capitalize"},children:t.status}),e.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"var(--muted)"},children:["⭐",(t.avg_quality||0).toFixed(1)]})]})]})}function A({data:t,lastUpdated:r}){const{agents:m=[],tasks:n=[],task_counts:d={},sla_at_risk:l=[],projects:f=[],budget:g={},knowledge_count:S=0,memory_lines:N=0,broadcast:z="",crons:u=[],alerts:_=[],dispatcher:o={}}=t,c=u.filter(s=>(s._consecutive_errors||0)>=3).length,h=u.length,v=_.filter(s=>s.severity==="critical").length,k=g.limits||{},x=(g.current||{}).daily_usd??0,y=k.daily_usd??1,j=g.alerts?.daily_threshold_pct??70,b=z.split(`
|
|
2
|
+
`).filter(s=>s.trim()).slice(-3);return e.jsxs("div",{className:"fade-in",style:{display:"grid",gap:14},children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6,1fr)",gap:10},children:[["Pending",d.pending??0,"var(--amber)"],["In Progress",d["in-progress"]??0,"var(--cyan)"],["Complete",d.complete??0,"var(--green)"],["HITL 🚨",d.needs_human_decision??0,"var(--purple)"],["Knowledge",S,"var(--cyan)"],["Memory",`${N}L`,"var(--muted)"]].map(([s,p,i])=>e.jsxs("div",{className:"card",style:{textAlign:"center"},children:[e.jsx("div",{className:"section-title",children:s}),e.jsx("div",{style:{fontSize:22,fontWeight:700,color:s==="HITL 🚨"&&p>0?"var(--red)":i},children:p})]},s))}),v>0&&e.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,23,68,.08)",border:"1px solid rgba(255,23,68,.35)",borderRadius:6,display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{style:{fontSize:16},children:"🚨"}),e.jsxs("span",{style:{fontSize:12,color:"var(--red)",fontWeight:600},children:[v," critical alert",v>1?"s":""," require attention"]}),e.jsx("span",{style:{fontSize:11,color:"var(--muted)",marginLeft:"auto"},children:"→ Alerts tab"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[e.jsx("div",{className:"card",style:{borderColor:c?"rgba(255,214,0,.3)":"var(--border)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:16},children:"⚙️"}),e.jsxs("div",{children:[e.jsx("div",{className:"section-title",style:{marginBottom:2},children:"Cron Health"}),e.jsx("div",{style:{fontSize:13,fontWeight:700,color:c?"var(--amber)":"var(--green)"},children:c?`${c}/${h} erroring`:`${h}/${h} healthy`})]})]})}),e.jsx("div",{className:"card",children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:16},children:"🤖"}),e.jsxs("div",{children:[e.jsx("div",{className:"section-title",style:{marginBottom:2},children:"Dispatcher"}),e.jsxs("div",{style:{fontSize:11,color:"var(--muted)"},children:["Last: ",o.last_run?new Date(o.last_run).toLocaleTimeString():"—",o.last_summary?.triggered?.length>0&&e.jsxs("span",{style:{color:"var(--cyan)",marginLeft:8},children:["↑ ",o.last_summary.triggered.length," triggered"]})]})]})]})})]}),e.jsxs("div",{className:"card",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",marginBottom:6},children:[e.jsx("span",{className:"section-title",style:{marginBottom:0},children:"Daily Budget"}),e.jsxs("span",{style:{fontSize:11,color:"var(--muted)",marginLeft:8},children:["$",x.toFixed(2)," / $",y]}),e.jsx(w,{ts:r})]}),e.jsxs("div",{className:"progress-track",style:{position:"relative"},children:[e.jsx("div",{className:"progress-fill",style:{width:`${Math.min(100,x/y*100)}%`,background:x/y>j/100?"var(--red)":"var(--cyan)"}}),e.jsx("div",{style:{position:"absolute",top:-2,bottom:-2,left:`${j}%`,width:1,background:"var(--amber)",opacity:.5}})]})]}),e.jsxs("div",{className:"card",style:{borderColor:l.length>0?"rgba(255,23,68,.4)":"var(--border)"},children:[e.jsx("div",{className:"section-title",style:{color:l.length>0?"var(--red)":"var(--muted)"},children:l.length>0?`⚠ SLA At Risk (${l.length})`:"✅ No SLA at risk"}),l.map(s=>e.jsxs("div",{style:{display:"flex",gap:10,padding:"4px 0",fontSize:11},children:[e.jsx("span",{style:{color:"var(--muted)",minWidth:60},children:s.id}),e.jsx("span",{style:{flex:1},children:s.title}),e.jsx("span",{style:{color:"var(--red)"},children:s.sla?.deadline||""})]},s.id))]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:14},children:[e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"section-title",children:"Agent Status"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(140px,1fr))",gap:8},children:m.map(s=>e.jsx(C,{agent:s},s.id))})]}),e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"section-title",children:"Recent Tasks"}),n.slice(-10).reverse().map(s=>e.jsx(L,{task:s},s.id)),n.length===0&&e.jsx("div",{style:{color:"var(--muted)",fontSize:11},children:"No tasks yet"})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:14},children:[e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"section-title",children:"Active Projects"}),f.filter(s=>["active","ACTIVE"].includes(s.status)).length===0?e.jsx("div",{style:{color:"var(--muted)",fontSize:11},children:"No active projects"}):f.filter(s=>["active","ACTIVE"].includes(s.status)).map(s=>e.jsxs("div",{style:{padding:"8px 10px",marginBottom:8,background:"var(--surface)",borderRadius:6,border:"1px solid var(--border)"},children:[e.jsx("div",{style:{fontWeight:600,fontSize:12,marginBottom:3},children:s.name||s.id}),e.jsx("div",{style:{color:"var(--muted)",fontSize:11},children:s.description||""})]},s.id))]}),e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"section-title",children:"Broadcast (last 3)"}),b.length===0?e.jsx("div",{style:{color:"var(--muted)",fontSize:11},children:"No broadcasts yet"}):b.map((s,p)=>{const i=s.toLowerCase();let a="var(--text)";return i.includes("[critical]")||i.includes("🔴")?a="var(--red)":i.includes("[blocked]")?a="var(--amber)":i.includes("[hitl]")||i.includes("🚨")?a="var(--purple)":(i.includes("[done]")||i.includes("✅"))&&(a="var(--green)"),e.jsx("div",{style:{color:a,fontSize:11,padding:"3px 0",lineHeight:1.5,wordBreak:"break-word"},children:s},p)})]})]})]})}function L({task:t}){const r=(t.sla?.priority||t.priority||"").toUpperCase(),m=(t.status||"").toLowerCase().replace(/ /g,"-"),n={complete:"badge-complete",pending:"badge-pending","in-progress":"badge-in-progress",failed:"badge-failed",needs_human_decision:"badge-hitl",blocked:"badge-blocked"}[m]||"badge-pending";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"5px 0",borderBottom:"1px solid rgba(255,255,255,.04)"},children:[e.jsx("span",{style:{color:"var(--muted)",fontSize:10,minWidth:50},children:t.id||"—"}),e.jsx("span",{style:{flex:1,fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.title||"—"}),r&&e.jsx("span",{className:r==="P1"?"p1":r==="P2"?"p2":"p3",children:r}),e.jsx("span",{className:`badge ${n}`,children:t.status||"—"})]})}export{A as default};
|