@zibby/core 0.1.6 → 0.1.9

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": "@zibby/core",
3
- "version": "0.1.6",
3
+ "version": "0.1.9",
4
4
  "description": "Core test automation engine with multi-agent and multi-MCP support",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -80,11 +80,9 @@
80
80
  "dotenv": "^16.4.0",
81
81
  "handlebars": "^4.7.8",
82
82
  "zod": "^3.23.0",
83
+ "@zibby/mcp-browser": "^0.1.0",
83
84
  "zod-to-json-schema": "^3.25.1"
84
85
  },
85
- "optionalDependencies": {
86
- "@zibby/mcp-browser": "*"
87
- },
88
86
  "peerDependencies": {
89
87
  "@playwright/test": ">=1.49.0",
90
88
  "playwright": ">=1.49.0"
@@ -24,27 +24,39 @@ fi
24
24
 
25
25
  echo " Using Node: $NODE_PATH"
26
26
 
27
- # Step 3: Install Zibby MCP Browser (forked Playwright MCP with stable ID support)
27
+ # Step 3: Find Zibby MCP Browser (stable IDs + event recording)
28
28
  echo "Setting up Zibby MCP Browser..."
29
- ZIBBY_MCP_DIR="$SCRIPT_DIR/../../mcps/browser"
30
- ZIBBY_MCP_BIN="$ZIBBY_MCP_DIR/bin/mcp-browser-zibby.js"
31
-
32
- if [ -f "$ZIBBY_MCP_BIN" ]; then
33
- # Install dependencies (skip if already resolvable via workspace hoisting)
34
- if [ ! -d "$ZIBBY_MCP_DIR/node_modules" ]; then
35
- if "$NODE_PATH" -e "require.resolve('@playwright/mcp', {paths:['$ZIBBY_MCP_DIR']})" 2>/dev/null; then
36
- echo " ✅ Dependencies available"
37
- else
38
- echo " 📥 Installing dependencies..."
39
- (cd "$ZIBBY_MCP_DIR" && npm install --silent > /dev/null 2>&1) || echo " ⚠️ Could not install dependencies"
40
- fi
29
+
30
+ # Resolve @zibby/mcp-browser from node_modules (works in workspace, global, and npx installs)
31
+ ZIBBY_MCP_PKG=$("$NODE_PATH" -e "try{console.log(require.resolve('@zibby/mcp-browser/package.json',{paths:['$SCRIPT_DIR/..']}))}catch{}" 2>/dev/null)
32
+ if [ -n "$ZIBBY_MCP_PKG" ]; then
33
+ ZIBBY_MCP_BIN="$(dirname "$ZIBBY_MCP_PKG")/bin/mcp-browser-zibby.js"
34
+ fi
35
+
36
+ # Fallback: try workspace path (dev only)
37
+ if [ -z "$ZIBBY_MCP_BIN" ] || [ ! -f "$ZIBBY_MCP_BIN" ]; then
38
+ ZIBBY_MCP_DIR="$SCRIPT_DIR/../../mcps/browser"
39
+ if [ -f "$ZIBBY_MCP_DIR/bin/mcp-browser-zibby.js" ]; then
40
+ ZIBBY_MCP_BIN="$ZIBBY_MCP_DIR/bin/mcp-browser-zibby.js"
41
41
  fi
42
- echo "Zibby MCP Browser ready"
43
- else
44
- echo "Zibby MCP Browser not found at $ZIBBY_MCP_BIN"
42
+ fi
43
+
44
+ # Final fallback: official @playwright/mcp (no stable IDs or event recording)
45
+ if [ -z "$ZIBBY_MCP_BIN" ] || [ ! -f "$ZIBBY_MCP_BIN" ]; then
46
+ PLAYWRIGHT_MCP_PKG=$("$NODE_PATH" -e "try{console.log(require.resolve('@playwright/mcp/package.json',{paths:['$SCRIPT_DIR/..']}))}catch{}" 2>/dev/null)
47
+ if [ -n "$PLAYWRIGHT_MCP_PKG" ]; then
48
+ ZIBBY_MCP_BIN="$(dirname "$PLAYWRIGHT_MCP_PKG")/cli.js"
49
+ echo " ⚠️ Using @playwright/mcp (official) — stable IDs and event recording unavailable"
50
+ fi
51
+ fi
52
+
53
+ if [ -z "$ZIBBY_MCP_BIN" ] || [ ! -f "$ZIBBY_MCP_BIN" ]; then
54
+ echo "❌ No Playwright MCP found. Run: npm install @zibby/mcp-browser"
45
55
  exit 1
46
56
  fi
47
57
 
58
+ echo " ✅ Zibby MCP Browser ready"
59
+
48
60
  # Install ffmpeg for video recording
49
61
  echo "🎬 Installing ffmpeg for video recording..."
50
62
  if command -v playwright &> /dev/null 2>&1; then
package/src/index.js CHANGED
@@ -101,7 +101,8 @@ export async function runTest(specPath, config = {}) {
101
101
  const testSpec = readFileSync(specPath, 'utf-8');
102
102
 
103
103
  const adapter = null;
104
- let agent = await loadLocalAgent(cwd, agentConfig);
104
+ const { agent: localAgent, error: localAgentError } = await loadLocalAgent(cwd, agentConfig);
105
+ let agent = localAgent;
105
106
 
106
107
  if (!agent && config.fallbackAgentModule) {
107
108
  const mod = config.fallbackAgentModule;
@@ -111,6 +112,10 @@ export async function runTest(specPath, config = {}) {
111
112
  }
112
113
  }
113
114
 
115
+ if (!agent && localAgentError) {
116
+ console.warn(`⚠️ Failed to load local agent: ${localAgentError}`);
117
+ }
118
+
114
119
  if (!agent) {
115
120
  throw new Error(
116
121
  `No agent found. Please run:\n` +
@@ -271,7 +276,7 @@ async function loadLocalAgent(cwd, config) {
271
276
  const localAgentPath = pathJoin(cwd, '.zibby/graph.js');
272
277
 
273
278
  if (!fsExistsSync(localAgentPath)) {
274
- return null;
279
+ return { agent: null, error: null };
275
280
  }
276
281
 
277
282
  const agentModule = await import(pathToFileURL(localAgentPath).href);
@@ -311,8 +316,7 @@ async function loadLocalAgent(cwd, config) {
311
316
  }
312
317
 
313
318
  if (!AgentClass) {
314
- console.warn('⚠️ Could not find any WorkflowAgent export in local graph.js');
315
- return null;
319
+ return { agent: null, error: 'Could not find any WorkflowAgent export in local graph.js' };
316
320
  }
317
321
 
318
322
  if (!AgentClass.name?.includes('auto-detected')) {
@@ -320,10 +324,9 @@ async function loadLocalAgent(cwd, config) {
320
324
  }
321
325
  }
322
326
 
323
- return new AgentClass(config);
327
+ return { agent: new AgentClass(config), error: null };
324
328
  } catch (error) {
325
- console.warn(`⚠️ Failed to load local agent: ${error.message}`);
326
- return null;
329
+ return { agent: null, error: error.message };
327
330
  }
328
331
  }
329
332