@monoes/monomindcli 1.10.31 → 1.10.32

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.
@@ -1,32 +1,21 @@
1
1
  ---
2
2
  name: browse
3
- description: Launch agent-browser for web UI testing and automation — installs if missing, then runs the agent-browser-testing skill
3
+ description: Launch monomind browse for web UI testing and automation — native TypeScript CDP client, no external binary needed
4
4
  ---
5
5
 
6
6
  Invoke the agent-browser-testing skill to test or automate a web UI.
7
7
 
8
- Run this shell command immediately without asking for confirmation:
9
-
10
- ```bash
11
- if ! command -v agent-browser &>/dev/null; then
12
- echo "Installing agent-browser..."
13
- npm install -g agent-browser
14
- else
15
- echo "agent-browser $(agent-browser --version) ready"
16
- fi
17
- ```
18
-
19
- After confirming agent-browser is available, invoke the skill:
8
+ `monomind browse` is built-in no install needed. Invoke the skill:
20
9
 
21
10
  Skill("agent-browser-testing")
22
11
 
23
12
  Pass the user's argument (if any) as the URL or task description: $1
24
13
 
25
- Use the full agent-browser workflow:
26
- 1. `agent-browser open <url>`
27
- 2. `agent-browser snapshot -i`
14
+ Use the full monomind browse workflow:
15
+ 1. `npx monomind browse open <url>`
16
+ 2. `npx monomind browse snapshot -i`
28
17
  3. Act using element refs (@e1, @e2, ...)
29
18
  4. Re-snapshot to verify
30
- 5. Report results (PASS / FAIL / ⚠️ WARN)
19
+ 5. Report results (PASS / FAIL / WARN)
31
20
 
32
21
  Examples: `/browse`, `/browse https://example.com`, `/browse test the login flow`
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+ // Extracted from hook-handler.cjs — handles 'budget-status' command.
3
+
4
+ module.exports = {
5
+ handle: function(hCtx) {
6
+ var _getBudgetStatus = hCtx._getBudgetStatus;
7
+ var b = _getBudgetStatus();
8
+ if (!b) { console.log('No budget data yet — token tracking not initialized.'); return; }
9
+ console.log('Today: $' + b.todayCost.toFixed(2) + ' / $' + b.dailyLimit + ' (' + b.dailyPct + '%)' + (b.autoTuned ? ' [auto-tuned]' : ''));
10
+ console.log('Month: $' + b.monthCost.toFixed(2) + ' / $' + b.monthlyLimit + ' (' + b.monthlyPct + '%)');
11
+ console.log('Status: ' + (b.breached ? 'BREACHED' : b.spike ? 'SPIKE' : b.alert ? 'ALERT' : 'OK'));
12
+ console.log('Edit .monomind/budget.json to adjust. Delete to re-tune.');
13
+ },
14
+ };
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+ // Extracted from hook-handler.cjs — handles 'compact-manual' and 'compact-auto' events.
3
+ // Receives hCtx and mode ('manual'|'auto') from dispatcher.
4
+
5
+ const path = require('path');
6
+ const fs = require('fs');
7
+
8
+ module.exports = {
9
+ handle: async function(hCtx, mode) {
10
+ var intelligence = hCtx.intelligence;
11
+ var runWithTimeout = hCtx.runWithTimeout;
12
+ var _injectCompactGraphMap = hCtx._injectCompactGraphMap;
13
+ var CWD = hCtx.CWD;
14
+
15
+ if (intelligence && intelligence.consolidate) {
16
+ try { await runWithTimeout(function() { return intelligence.consolidate(); }, 'intelligence.consolidate()'); } catch (e) { /* non-fatal */ }
17
+ }
18
+ try {
19
+ var lastRoute = path.join(CWD, '.monomind', 'last-route.json');
20
+ if (fs.existsSync(lastRoute)) {
21
+ var route = JSON.parse(fs.readFileSync(lastRoute, 'utf-8'));
22
+ console.log('[COMPACT_CONTEXT] Last route: ' + route.agent + ' (' + (route.confidence != null ? (route.confidence * 100).toFixed(0) : '?') + '%)');
23
+ }
24
+ } catch (e) { /* non-fatal */ }
25
+ _injectCompactGraphMap();
26
+ if (mode === 'auto') {
27
+ console.log('[COMPACT] Auto compaction — intelligence consolidated, context preserved');
28
+ console.log('GOLDEN RULE: 1 message = all parallel operations');
29
+ } else {
30
+ console.log('[COMPACT] Manual compaction — intelligence consolidated, context preserved');
31
+ }
32
+ },
33
+ };
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+ // Extracted from hook-handler.cjs — handles 'loops-status' command.
3
+
4
+ const path = require('path');
5
+ const fs = require('fs');
6
+
7
+ module.exports = {
8
+ handle: function(hCtx) {
9
+ var CWD = hCtx.CWD;
10
+ var loopsDir = path.join(CWD, '.monomind', 'loops');
11
+ if (!fs.existsSync(loopsDir)) { console.log('No loops directory.'); return; }
12
+ var files = fs.readdirSync(loopsDir).filter(function(f) {
13
+ return f.endsWith('.json') && !f.includes('-hil') && !f.endsWith('.stop');
14
+ });
15
+ var STALE_MS = 6 * 60 * 60 * 1000;
16
+ var now = Date.now();
17
+ var active = [], stale = [];
18
+ files.forEach(function(f) {
19
+ try {
20
+ var d = JSON.parse(fs.readFileSync(path.join(loopsDir, f), 'utf-8'));
21
+ var last = d.lastRunAt || d.startedAt || 0;
22
+ var ageMs = last ? (now - last) : Infinity;
23
+ if (ageMs > STALE_MS) stale.push({ d: d, ageH: Math.round(ageMs / 3600000) });
24
+ else active.push(d);
25
+ } catch (_) {}
26
+ });
27
+ if (active.length === 0 && stale.length === 0) {
28
+ console.log('No loops.'); return;
29
+ }
30
+ if (active.length > 0) {
31
+ console.log('Active (' + active.length + '):');
32
+ active.forEach(function(d) {
33
+ console.log(' · ' + (d.command || '?') + ' [' + (d.type || '?') + '] run ' + (d.currentRep || 0) +
34
+ (d.maxReps ? '/' + d.maxReps : '') + ' · ' + (d.status || '?'));
35
+ });
36
+ }
37
+ if (stale.length > 0) {
38
+ console.log('Stale (' + stale.length + ' >6h):');
39
+ stale.forEach(function(s) {
40
+ console.log(' · ' + (s.d.command || '?') + ' run ' + (s.d.currentRep || 0) +
41
+ ' · ' + s.ageH + 'h ago · ' + (s.d.status || '?'));
42
+ });
43
+ }
44
+ },
45
+ };
@@ -318,21 +318,27 @@ module.exports = {
318
318
  }
319
319
  } catch (e) { /* non-fatal */ }
320
320
 
321
- // Monomind Control UI Status.
322
- try {
323
- var http = require('http');
324
- var controlPort = 4242;
325
- var req = http.get('http://localhost:' + controlPort + '/', function(res) {
326
- if (res.statusCode === 200) {
327
- console.log('[CONTROL_UI] UP — http://localhost:' + controlPort);
328
- }
329
- res.resume();
330
- });
331
- req.on('error', function() {
332
- console.log('[CONTROL_UI] offlinerun: npx monomind mcp start');
333
- });
334
- req.setTimeout(800, function() { req.destroy(); });
335
- } catch (e) { /* non-fatal */ }
321
+ // Monomind Control UI Status — only probe when a daemon has previously run
322
+ // (indicated by daemon.pid or monomind.config.json). Skips silently in fresh
323
+ // environments and test fixtures that have no daemon history.
324
+ var _controlUiShouldProbe = fs.existsSync(path.join(CWD, '.monomind', 'daemon.pid'))
325
+ || fs.existsSync(path.join(CWD, 'monomind.config.json'));
326
+ if (_controlUiShouldProbe) {
327
+ try {
328
+ var http = require('http');
329
+ var controlPort = 4242;
330
+ var req = http.get('http://localhost:' + controlPort + '/', function(res) {
331
+ if (res.statusCode === 200) {
332
+ console.log('[CONTROL_UI] UPhttp://localhost:' + controlPort);
333
+ }
334
+ res.resume();
335
+ });
336
+ req.on('error', function() {
337
+ console.log('[CONTROL_UI] offline — run: npx monomind mcp start');
338
+ });
339
+ req.setTimeout(800, function() { req.destroy(); });
340
+ } catch (e) { /* non-fatal */ }
341
+ }
336
342
 
337
343
  // Worker Queue Resume (SR-003).
338
344
  try {
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+ // Extracted from hook-handler.cjs — handles 'stats' command.
3
+
4
+ module.exports = {
5
+ handle: async function(hCtx) {
6
+ var intelligence = hCtx.intelligence;
7
+ var args = hCtx.args;
8
+ if (intelligence && intelligence.stats) {
9
+ await Promise.resolve(intelligence.stats(args.includes('--json')));
10
+ } else {
11
+ console.log('[WARN] Intelligence module not available. Run session-restore first.');
12
+ }
13
+ },
14
+ };
@@ -248,34 +248,13 @@ const handlers = {
248
248
 
249
249
 
250
250
  'compact-manual': async () => {
251
- if (intelligence && intelligence.consolidate) {
252
- try { await runWithTimeout(function() { return intelligence.consolidate(); }, 'intelligence.consolidate()'); } catch (e) { /* non-fatal */ }
253
- }
254
- try {
255
- var lastRoute = path.join(CWD, '.monomind', 'last-route.json');
256
- if (fs.existsSync(lastRoute)) {
257
- var route = JSON.parse(fs.readFileSync(lastRoute, 'utf-8'));
258
- console.log('[COMPACT_CONTEXT] Last route: ' + route.agent + ' (' + (route.confidence != null ? (route.confidence * 100).toFixed(0) : '?') + '%)');
259
- }
260
- } catch (e) { /* non-fatal */ }
261
- _injectCompactGraphMap();
262
- console.log('[COMPACT] Manual compaction — intelligence consolidated, context preserved');
251
+ const h = require('./handlers/compact-handler.cjs');
252
+ await h.handle(hCtx, 'manual');
263
253
  },
264
254
 
265
255
  'compact-auto': async () => {
266
- if (intelligence && intelligence.consolidate) {
267
- try { await runWithTimeout(function() { return intelligence.consolidate(); }, 'intelligence.consolidate()'); } catch (e) { /* non-fatal */ }
268
- }
269
- try {
270
- var lastRoute = path.join(CWD, '.monomind', 'last-route.json');
271
- if (fs.existsSync(lastRoute)) {
272
- var route = JSON.parse(fs.readFileSync(lastRoute, 'utf-8'));
273
- console.log('[COMPACT_CONTEXT] Last route: ' + route.agent + ' (' + (route.confidence != null ? (route.confidence * 100).toFixed(0) : '?') + '%)');
274
- }
275
- } catch (e) { /* non-fatal */ }
276
- _injectCompactGraphMap();
277
- console.log('[COMPACT] Auto compaction — intelligence consolidated, context preserved');
278
- console.log('GOLDEN RULE: 1 message = all parallel operations');
256
+ const h = require('./handlers/compact-handler.cjs');
257
+ await h.handle(hCtx, 'auto');
279
258
  },
280
259
 
281
260
  'agent-start': () => {
@@ -294,49 +273,13 @@ const handlers = {
294
273
  },
295
274
 
296
275
  'budget-status': () => {
297
- var b = _getBudgetStatus();
298
- if (!b) { console.log('No budget data yet — token tracking not initialized.'); return; }
299
- console.log('Today: $' + b.todayCost.toFixed(2) + ' / $' + b.dailyLimit + ' (' + b.dailyPct + '%)' + (b.autoTuned ? ' [auto-tuned]' : ''));
300
- console.log('Month: $' + b.monthCost.toFixed(2) + ' / $' + b.monthlyLimit + ' (' + b.monthlyPct + '%)');
301
- console.log('Status: ' + (b.breached ? 'BREACHED' : b.spike ? 'SPIKE' : b.alert ? 'ALERT' : 'OK'));
302
- console.log('Edit .monomind/budget.json to adjust. Delete to re-tune.');
276
+ const h = require('./handlers/budget-status-handler.cjs');
277
+ h.handle(hCtx);
303
278
  },
304
279
 
305
280
  'loops-status': () => {
306
- var loopsDir = path.join(CWD, '.monomind', 'loops');
307
- if (!fs.existsSync(loopsDir)) { console.log('No loops directory.'); return; }
308
- var files = fs.readdirSync(loopsDir).filter(function(f) {
309
- return f.endsWith('.json') && !f.includes('-hil') && !f.endsWith('.stop');
310
- });
311
- var STALE_MS = 6 * 60 * 60 * 1000;
312
- var now = Date.now();
313
- var active = [], stale = [];
314
- files.forEach(function(f) {
315
- try {
316
- var d = JSON.parse(fs.readFileSync(path.join(loopsDir, f), 'utf-8'));
317
- var last = d.lastRunAt || d.startedAt || 0;
318
- var ageMs = last ? (now - last) : Infinity;
319
- if (ageMs > STALE_MS) stale.push({ d: d, ageH: Math.round(ageMs / 3600000) });
320
- else active.push(d);
321
- } catch (_) {}
322
- });
323
- if (active.length === 0 && stale.length === 0) {
324
- console.log('No loops.'); return;
325
- }
326
- if (active.length > 0) {
327
- console.log('Active (' + active.length + '):');
328
- active.forEach(function(d) {
329
- console.log(' · ' + (d.command || '?') + ' [' + (d.type || '?') + '] run ' + (d.currentRep || 0) +
330
- (d.maxReps ? '/' + d.maxReps : '') + ' · ' + (d.status || '?'));
331
- });
332
- }
333
- if (stale.length > 0) {
334
- console.log('Stale (' + stale.length + ' >6h):');
335
- stale.forEach(function(s) {
336
- console.log(' · ' + (s.d.command || '?') + ' run ' + (s.d.currentRep || 0) +
337
- ' · ' + s.ageH + 'h ago · ' + (s.d.status || '?'));
338
- });
339
- }
281
+ const h = require('./handlers/loops-status-handler.cjs');
282
+ h.handle(hCtx);
340
283
  },
341
284
 
342
285
  'status': () => {
@@ -344,11 +287,8 @@ const handlers = {
344
287
  },
345
288
 
346
289
  'stats': async () => {
347
- if (intelligence && intelligence.stats) {
348
- await Promise.resolve(intelligence.stats(args.includes('--json')));
349
- } else {
350
- console.log('[WARN] Intelligence module not available. Run session-restore first.');
351
- }
290
+ const h = require('./handlers/stats-handler.cjs');
291
+ await h.handle(hCtx);
352
292
  },
353
293
  };
354
294