@cef-ai/cli 0.2.1 → 0.2.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 +2 -2
- package/dist/commands/dev/server.js +34 -6
- package/dist/commands/dev/{ui.js → static/app.js} +50 -401
- package/dist/commands/dev/static/index.html +205 -0
- package/dist/commands/dev/static/static/app.js +633 -0
- package/dist/commands/dev/static/static/index.html +205 -0
- package/dist/commands/dev/static/static/style.css +184 -0
- package/dist/commands/dev/static/style.css +184 -0
- package/dist/lib/config.js +14 -1
- package/dist/lib/runtime/agent-router.js +2 -13
- package/dist/lib/runtime/index.js +2 -4
- package/dist/lib/transpile.d.ts +1 -0
- package/dist/lib/transpile.js +9 -0
- package/example/.env.example +2 -2
- package/package.json +6 -5
- package/dist/commands/dev/ui.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1007,8 +1007,8 @@ Create a `.env` file in the same directory as your `cef.config.yaml`:
|
|
|
1007
1007
|
|
|
1008
1008
|
```bash
|
|
1009
1009
|
CEF_AUTH_TOKEN=your-jwt-token-here
|
|
1010
|
-
CEF_ORCHESTRATOR_URL=https://compute
|
|
1011
|
-
CEF_ROB_API_URL=https://
|
|
1010
|
+
CEF_ORCHESTRATOR_URL=https://orchestrator.compute.test.ddcdragon.com
|
|
1011
|
+
CEF_ROB_API_URL=https://rob.compute.test.ddcdragon.com/rms-node-backend
|
|
1012
1012
|
```
|
|
1013
1013
|
|
|
1014
1014
|
| Variable | Required For | Description |
|
|
@@ -1,7 +1,32 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
1
4
|
import http from 'http';
|
|
2
5
|
import { WebSocketServer } from 'ws';
|
|
3
|
-
|
|
6
|
+
const STATIC_DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), 'static');
|
|
7
|
+
const MIME_TYPES = {
|
|
8
|
+
'.html': 'text/html; charset=utf-8',
|
|
9
|
+
'.css': 'text/css; charset=utf-8',
|
|
10
|
+
'.js': 'application/javascript; charset=utf-8',
|
|
11
|
+
};
|
|
12
|
+
function loadStaticFiles() {
|
|
13
|
+
const files = new Map();
|
|
14
|
+
for (const name of fs.readdirSync(STATIC_DIR)) {
|
|
15
|
+
const ext = path.extname(name);
|
|
16
|
+
const contentType = MIME_TYPES[ext];
|
|
17
|
+
if (!contentType)
|
|
18
|
+
continue;
|
|
19
|
+
const content = fs.readFileSync(path.join(STATIC_DIR, name));
|
|
20
|
+
files.set('/' + name, { content, contentType });
|
|
21
|
+
}
|
|
22
|
+
// Alias "/" to "/index.html"
|
|
23
|
+
const index = files.get('/index.html');
|
|
24
|
+
if (index)
|
|
25
|
+
files.set('/', index);
|
|
26
|
+
return files;
|
|
27
|
+
}
|
|
4
28
|
export function createDevServer(runtime, options) {
|
|
29
|
+
const staticFiles = loadStaticFiles();
|
|
5
30
|
const wsClients = new Set();
|
|
6
31
|
// Stream logs and trace events to WebSocket clients
|
|
7
32
|
const broadcast = (msg) => {
|
|
@@ -94,11 +119,14 @@ export function createDevServer(runtime, options) {
|
|
|
94
119
|
return;
|
|
95
120
|
}
|
|
96
121
|
}
|
|
97
|
-
// ─── Dev UI
|
|
98
|
-
if (req.method === 'GET'
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
122
|
+
// ─── Static files (Dev UI) ──────────────────────────────────
|
|
123
|
+
if (req.method === 'GET') {
|
|
124
|
+
const file = staticFiles.get(pathname);
|
|
125
|
+
if (file) {
|
|
126
|
+
res.writeHead(200, { 'Content-Type': file.contentType });
|
|
127
|
+
res.end(file.content);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
102
130
|
}
|
|
103
131
|
// ─── 404 ────────────────────────────────────────────────────
|
|
104
132
|
json(res, { error: 'Not found' }, 404);
|