agentgui 1.0.34 → 1.0.35
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/bin/gmgui.cjs +14 -6
- package/package.json +1 -1
- package/static/app.js +51 -1
package/bin/gmgui.cjs
CHANGED
|
@@ -21,9 +21,12 @@ async function gmgui(args = []) {
|
|
|
21
21
|
const useBun = hasBun();
|
|
22
22
|
const installer = useBun ? 'bun' : 'npm';
|
|
23
23
|
|
|
24
|
-
// Ensure dependencies are installed
|
|
24
|
+
// Ensure dependencies are installed only if node_modules is missing
|
|
25
|
+
// Skip this for bunx which manages dependencies independently
|
|
25
26
|
const nodeModulesPath = path.join(projectRoot, 'node_modules');
|
|
26
|
-
|
|
27
|
+
const isBunx = process.env.npm_execpath && process.env.npm_execpath.includes('bunx');
|
|
28
|
+
|
|
29
|
+
if (!isBunx && !fs.existsSync(nodeModulesPath)) {
|
|
27
30
|
console.log(`Installing dependencies with ${installer}...`);
|
|
28
31
|
const installResult = spawnSync(installer, ['install'], {
|
|
29
32
|
cwd: projectRoot,
|
|
@@ -45,12 +48,17 @@ async function gmgui(args = []) {
|
|
|
45
48
|
stdio: 'inherit'
|
|
46
49
|
});
|
|
47
50
|
|
|
51
|
+
ps.on('error', reject);
|
|
52
|
+
|
|
53
|
+
// Keep this process alive indefinitely to keep the server running
|
|
54
|
+
// The server will handle all actual work; this process just provides the bridge
|
|
55
|
+
process.stdin.resume();
|
|
56
|
+
|
|
57
|
+
// If server exits unexpectedly, log it but keep trying
|
|
48
58
|
ps.on('exit', (code) => {
|
|
49
|
-
|
|
50
|
-
|
|
59
|
+
console.error(`Server process exited with code ${code}`);
|
|
60
|
+
// Don't reject or resolve - just keep waiting
|
|
51
61
|
});
|
|
52
|
-
|
|
53
|
-
ps.on('error', reject);
|
|
54
62
|
});
|
|
55
63
|
} else {
|
|
56
64
|
throw new Error(`Unknown command: ${command}`);
|
package/package.json
CHANGED
package/static/app.js
CHANGED
|
@@ -1458,7 +1458,57 @@ class GMGUIApp {
|
|
|
1458
1458
|
}
|
|
1459
1459
|
const content = document.createElement('div');
|
|
1460
1460
|
content.className = 'html-content';
|
|
1461
|
-
|
|
1461
|
+
|
|
1462
|
+
// Get current theme to apply to HTML content
|
|
1463
|
+
const currentTheme = document.documentElement.getAttribute('data-theme') ||
|
|
1464
|
+
(window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
|
|
1465
|
+
|
|
1466
|
+
// Apply theme-aware CSS for consistent colors in dark/light mode
|
|
1467
|
+
const themeCSS = currentTheme === 'dark'
|
|
1468
|
+
? `<style>
|
|
1469
|
+
.html-content {
|
|
1470
|
+
color: #f8fafc;
|
|
1471
|
+
background: transparent;
|
|
1472
|
+
}
|
|
1473
|
+
.html-content p { color: #cbd5e1; }
|
|
1474
|
+
.html-content h1, .html-content h2, .html-content h3,
|
|
1475
|
+
.html-content h4, .html-content h5, .html-content h6 {
|
|
1476
|
+
color: #f8fafc;
|
|
1477
|
+
}
|
|
1478
|
+
.html-content a { color: #6366f1; }
|
|
1479
|
+
.html-content code { color: #c7d2fe; background: rgba(0,0,0,0.3); }
|
|
1480
|
+
.html-content pre { background: rgba(0,0,0,0.5); color: #e0e7ff; }
|
|
1481
|
+
.html-content table { border-color: #334155; }
|
|
1482
|
+
.html-content th { background: #1a202c; color: #f8fafc; }
|
|
1483
|
+
.html-content td { border-color: #334155; }
|
|
1484
|
+
.html-content blockquote { border-color: #334155; color: #cbd5e1; }
|
|
1485
|
+
.html-content ul, .html-content ol { color: #cbd5e1; }
|
|
1486
|
+
.html-content li { color: #cbd5e1; }
|
|
1487
|
+
</style>`
|
|
1488
|
+
: `<style>
|
|
1489
|
+
.html-content {
|
|
1490
|
+
color: #1d2129;
|
|
1491
|
+
background: transparent;
|
|
1492
|
+
}
|
|
1493
|
+
.html-content p { color: #475569; }
|
|
1494
|
+
.html-content h1, .html-content h2, .html-content h3,
|
|
1495
|
+
.html-content h4, .html-content h5, .html-content h6 {
|
|
1496
|
+
color: #1d2129;
|
|
1497
|
+
}
|
|
1498
|
+
.html-content a { color: #4f46e5; }
|
|
1499
|
+
.html-content code { color: #6366f1; background: rgba(99,102,241,0.1); }
|
|
1500
|
+
.html-content pre { background: #f3f4f6; color: #1d2129; }
|
|
1501
|
+
.html-content table { border-color: #e5e7eb; }
|
|
1502
|
+
.html-content th { background: #f9fafb; color: #1d2129; }
|
|
1503
|
+
.html-content td { border-color: #e5e7eb; }
|
|
1504
|
+
.html-content blockquote { border-color: #e5e7eb; color: #475569; }
|
|
1505
|
+
.html-content ul, .html-content ol { color: #475569; }
|
|
1506
|
+
.html-content li { color: #475569; }
|
|
1507
|
+
</style>`;
|
|
1508
|
+
|
|
1509
|
+
const enhancedHtml = themeCSS + this.sanitizeHtml(event.html);
|
|
1510
|
+
content.innerHTML = enhancedHtml;
|
|
1511
|
+
content.setAttribute('data-theme', currentTheme);
|
|
1462
1512
|
wrap.appendChild(content);
|
|
1463
1513
|
return wrap;
|
|
1464
1514
|
}
|