@yemi33/minions 0.1.502 → 0.1.503
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/CHANGELOG.md +5 -0
- package/dashboard.js +15 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dashboard.js
CHANGED
|
@@ -1681,18 +1681,24 @@ const server = http.createServer(async (req, res) => {
|
|
|
1681
1681
|
async function handleAgentLive(req, res, match) {
|
|
1682
1682
|
const agentId = match[1];
|
|
1683
1683
|
const livePath = path.join(MINIONS_DIR, 'agents', agentId, 'live-output.log');
|
|
1684
|
-
const content = safeRead(livePath);
|
|
1685
1684
|
res.setHeader('Content-Type', 'text/plain; charset=utf-8');
|
|
1686
1685
|
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
1687
|
-
|
|
1686
|
+
const params = new URL(req.url, 'http://localhost').searchParams;
|
|
1687
|
+
const rawTail = parseInt(params.get('tail'));
|
|
1688
|
+
if (params.has('tail') && isNaN(rawTail)) return jsonReply(res, 400, { error: 'tail must be a number' });
|
|
1689
|
+
const tailBytes = isNaN(rawTail) ? 8192 : Math.max(1, Math.min(65536, rawTail));
|
|
1690
|
+
// Read only the tail bytes from disk instead of entire file
|
|
1691
|
+
try {
|
|
1692
|
+
const stat = fs.statSync(livePath);
|
|
1693
|
+
if (stat.size === 0) { res.end('No live output. Agent may not be running.'); return; }
|
|
1694
|
+
const start = Math.max(0, stat.size - tailBytes);
|
|
1695
|
+
const buf = Buffer.alloc(Math.min(tailBytes, stat.size));
|
|
1696
|
+
const fd = fs.openSync(livePath, 'r');
|
|
1697
|
+
fs.readSync(fd, buf, 0, buf.length, start);
|
|
1698
|
+
fs.closeSync(fd);
|
|
1699
|
+
res.end(buf.toString('utf8'));
|
|
1700
|
+
} catch {
|
|
1688
1701
|
res.end('No live output. Agent may not be running.');
|
|
1689
|
-
} else {
|
|
1690
|
-
// Return last N bytes via ?tail=N param (default last 8KB)
|
|
1691
|
-
const params = new URL(req.url, 'http://localhost').searchParams;
|
|
1692
|
-
const rawTail = parseInt(params.get('tail'));
|
|
1693
|
-
if (params.has('tail') && isNaN(rawTail)) return jsonReply(res, 400, { error: 'tail must be a number' });
|
|
1694
|
-
const tailBytes = isNaN(rawTail) ? 8192 : Math.max(1, Math.min(10000, rawTail));
|
|
1695
|
-
res.end(content.length > tailBytes ? content.slice(-tailBytes) : content);
|
|
1696
1702
|
}
|
|
1697
1703
|
return;
|
|
1698
1704
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yemi33/minions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.503",
|
|
4
4
|
"description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
|
|
5
5
|
"bin": {
|
|
6
6
|
"minions": "bin/minions.js"
|