monomind 1.10.39 → 1.10.40

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monomind",
3
- "version": "1.10.39",
3
+ "version": "1.10.40",
4
4
  "description": "Monomind - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -2,6 +2,4 @@ export interface BatchCommand {
2
2
  command: string;
3
3
  args: string[];
4
4
  }
5
- export declare function parseBatchCommands(input: string[]): Promise<BatchCommand[]>;
6
- export declare function parseBatchJson(json: string): Promise<BatchCommand[]>;
7
5
  //# sourceMappingURL=batch.d.ts.map
@@ -1,11 +1,2 @@
1
- export async function parseBatchCommands(input) {
2
- return input.map((raw) => {
3
- const parts = raw.trim().split(/\s+/);
4
- return { command: parts[0], args: parts.slice(1) };
5
- });
6
- }
7
- export async function parseBatchJson(json) {
8
- const parsed = JSON.parse(json);
9
- return parsed.map(([command, ...args]) => ({ command, args }));
10
- }
1
+ export {};
11
2
  //# sourceMappingURL=batch.js.map
@@ -98,6 +98,7 @@ export class CdpClient {
98
98
  this.ws?.close();
99
99
  this.ws = null;
100
100
  this.connected = false;
101
+ this.eventListeners.clear();
101
102
  }
102
103
  isConnected() {
103
104
  return this.connected;
@@ -14,7 +14,10 @@ export function setupDialogAutoHandling(client, sessionId, autoAccept = true) {
14
14
  };
15
15
  _pendingDialogs.set(sessionId, info);
16
16
  if (autoAccept && (info.type === 'alert' || info.type === 'beforeunload')) {
17
- await client.send('Page.handleJavaScriptDialog', { accept: true }, sessionId);
17
+ try {
18
+ await client.send('Page.handleJavaScriptDialog', { accept: true }, sessionId);
19
+ }
20
+ catch { /* dialog may have already been dismissed */ }
18
21
  _pendingDialogs.set(sessionId, null);
19
22
  }
20
23
  });
@@ -169,7 +169,7 @@ function globToRegex(pattern) {
169
169
  .replace(/[-[\]{}()+?.,\\^$|#\s]/g, '\\$&')
170
170
  .replace(/\*\*/g, '.*')
171
171
  .replace(/\*/g, '[^/]*');
172
- return new RegExp(escaped);
172
+ return new RegExp(`^${escaped}$`);
173
173
  }
174
174
  function globToFetchPattern(pattern) {
175
175
  return pattern.replace(/\*\*/g, '*');
@@ -14,6 +14,7 @@ export async function captureScreenshot(client, sessionId, options = {}) {
14
14
  }, sessionId);
15
15
  const { w, h } = JSON.parse(dims.result?.value ?? '{"w":1280,"h":720}');
16
16
  params.clip = { x: 0, y: 0, width: w, height: h, scale: 1 };
17
+ params.captureBeyondViewport = true;
17
18
  }
18
19
  const result = await client.send('Page.captureScreenshot', params, sessionId);
19
20
  const data = result.data;
@@ -3,6 +3,6 @@ import type { CdpTarget } from './types.js';
3
3
  export declare function listTabs(port: number): Promise<CdpTarget[]>;
4
4
  export declare function newTab(port: number, url?: string): Promise<CdpTarget>;
5
5
  export declare function closeTab(client: CdpClient, sessionId: string, targetId: string): Promise<void>;
6
- export declare function activateTab(client: CdpClient, sessionId: string, targetId: string): Promise<void>;
7
- export declare function switchToFrame(client: CdpClient, sessionId: string, frameSelector: string): Promise<string | null>;
6
+ export declare function activateTab(client: CdpClient, sessionId: string, targetId: string): Promise<string>;
7
+ export declare function switchToFrame(_client: CdpClient, _sessionId: string, _frameSelector: string): Promise<string | null>;
8
8
  //# sourceMappingURL=tabs.d.ts.map
@@ -11,15 +11,12 @@ export async function closeTab(client, sessionId, targetId) {
11
11
  }
12
12
  export async function activateTab(client, sessionId, targetId) {
13
13
  await client.send('Target.activateTarget', { targetId }, sessionId);
14
+ const result = await client.send('Target.attachToTarget', { targetId, flatten: true }, sessionId);
15
+ return result.sessionId;
14
16
  }
15
- export async function switchToFrame(client, sessionId, frameSelector) {
16
- const result = await client.send('Runtime.evaluate', {
17
- expression: `
18
- const frame = document.querySelector(${JSON.stringify(frameSelector)});
19
- frame ? frame.src || frame.name || null : null
20
- `,
21
- returnByValue: true,
22
- }, sessionId);
23
- return result.result?.value ?? null;
17
+ export async function switchToFrame(_client, _sessionId, _frameSelector) {
18
+ throw new Error('switchToFrame is not yet implemented. ' +
19
+ 'For same-origin frames, CDP commands already apply to the whole page. ' +
20
+ 'For cross-origin (OOPIF) frames, call Target.attachToTarget with the frame target ID.');
24
21
  }
25
22
  //# sourceMappingURL=tabs.js.map
@@ -50,8 +50,13 @@ export async function stopTrace(client, sessionId, outputPath) {
50
50
  throw new Error('No active trace for this session');
51
51
  try {
52
52
  const [completePromise, cancelOnce] = client.onceWithOff('Tracing.tracingComplete', sessionId);
53
- let timedOut = false;
54
- const timeoutPromise = new Promise((_, reject) => setTimeout(() => { timedOut = true; cancelOnce(); reject(new Error('Timeout waiting for Tracing.tracingComplete')); }, 30_000));
53
+ let timeoutHandle;
54
+ const timeoutPromise = new Promise((_, reject) => {
55
+ timeoutHandle = setTimeout(() => {
56
+ cancelOnce();
57
+ reject(new Error('Timeout waiting for Tracing.tracingComplete'));
58
+ }, 30_000);
59
+ });
55
60
  try {
56
61
  await client.send('Tracing.end', {}, sessionId);
57
62
  await Promise.race([completePromise, timeoutPromise]);
@@ -60,8 +65,9 @@ export async function stopTrace(client, sessionId, outputPath) {
60
65
  cancelOnce();
61
66
  throw err;
62
67
  }
63
- if (timedOut)
64
- throw new Error('Timeout waiting for Tracing.tracingComplete');
68
+ finally {
69
+ clearTimeout(timeoutHandle);
70
+ }
65
71
  }
66
72
  finally {
67
73
  state.offData();
@@ -128,7 +128,7 @@ function globToRegex(pattern) {
128
128
  .replace(/[-[\]{}()+?.,\\^$|#\s]/g, '\\$&')
129
129
  .replace(/\*\*/g, '.*')
130
130
  .replace(/\*/g, '[^/]*');
131
- return new RegExp(escaped);
131
+ return new RegExp(`^${escaped}$`);
132
132
  }
133
133
  function sleep(ms) {
134
134
  return new Promise((r) => setTimeout(r, ms));
@@ -471,7 +471,10 @@ const setCommand = {
471
471
  break;
472
472
  }
473
473
  case 'offline': {
474
- const enabled = ctx.args[1] !== 'false';
474
+ const offlineArg = ctx.args[1];
475
+ if (offlineArg === undefined)
476
+ throw new Error('Usage: set offline <true|false>');
477
+ const enabled = offlineArg !== 'false';
475
478
  await browser.setOfflineMode(client, sessionId, enabled);
476
479
  output.printSuccess(`Offline mode: ${enabled}`);
477
480
  break;
@@ -1093,7 +1096,7 @@ const tabCommand = {
1093
1096
  }
1094
1097
  default: {
1095
1098
  // Try to treat arg as tab ID to switch to
1096
- await browser.activateTab(client, sessionId, action);
1099
+ _sessionId = await browser.activateTab(client, sessionId, action);
1097
1100
  output.printSuccess(`Switched to tab: ${action}`);
1098
1101
  }
1099
1102
  }
@@ -1115,7 +1118,7 @@ const consoleLogCommand = {
1115
1118
  output.printSuccess('Console cleared');
1116
1119
  return { success: true };
1117
1120
  }
1118
- const msgs = browser.getConsoleMessages();
1121
+ const msgs = browser.getConsoleMessages(_sessionId);
1119
1122
  if (ctx.flags.json) {
1120
1123
  print(JSON.stringify(msgs));
1121
1124
  }
@@ -1142,7 +1145,7 @@ const errorsCommand = {
1142
1145
  output.printSuccess('Errors cleared');
1143
1146
  return { success: true };
1144
1147
  }
1145
- const errs = browser.getPageErrors();
1148
+ const errs = browser.getPageErrors(_sessionId);
1146
1149
  if (ctx.flags.json) {
1147
1150
  print(JSON.stringify(errs));
1148
1151
  }
@@ -1448,6 +1451,36 @@ const pushstateCommand = {
1448
1451
  return { success: true };
1449
1452
  },
1450
1453
  };
1454
+ function tokenizeBatchCommand(input) {
1455
+ const tokens = [];
1456
+ let current = '';
1457
+ let inQuote = null;
1458
+ for (const ch of input.trim()) {
1459
+ if (inQuote) {
1460
+ if (ch === inQuote) {
1461
+ inQuote = null;
1462
+ }
1463
+ else {
1464
+ current += ch;
1465
+ }
1466
+ }
1467
+ else if (ch === '"' || ch === "'") {
1468
+ inQuote = ch;
1469
+ }
1470
+ else if (/\s/.test(ch)) {
1471
+ if (current) {
1472
+ tokens.push(current);
1473
+ current = '';
1474
+ }
1475
+ }
1476
+ else {
1477
+ current += ch;
1478
+ }
1479
+ }
1480
+ if (current)
1481
+ tokens.push(current);
1482
+ return tokens;
1483
+ }
1451
1484
  const batchCommand = {
1452
1485
  name: 'batch',
1453
1486
  description: 'Execute multiple commands. Usage: monomind browse batch "open url" "snapshot -i" "click @e1"',
@@ -1461,7 +1494,7 @@ const batchCommand = {
1461
1494
  throw new Error('Usage: monomind browse batch "cmd1" "cmd2" ...');
1462
1495
  const results = [];
1463
1496
  for (const cmdStr of commands) {
1464
- const parts = cmdStr.trim().split(/\s+/);
1497
+ const parts = tokenizeBatchCommand(cmdStr);
1465
1498
  const subName = parts[0];
1466
1499
  const subArgs = parts.slice(1);
1467
1500
  const subCmd = browseCommand.subcommands?.find((s) => s.name === subName);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monoes/monomindcli",
3
- "version": "1.10.39",
3
+ "version": "1.10.40",
4
4
  "type": "module",
5
5
  "description": "Monomind CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",