@link-assistant/hive-mind 0.40.0 → 0.40.3

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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # @link-assistant/hive-mind
2
2
 
3
+ ## 0.40.3
4
+
5
+ ### Patch Changes
6
+
7
+ - f8ebd99: Make Playwright MCP usage guidelines conditional based on MCP availability
8
+
9
+ - Add `checkPlaywrightMcpAvailability()` function to detect if Playwright MCP is installed
10
+ - Conditionally include Playwright MCP section in Claude system prompt only when MCP is detected
11
+ - Integration in both main execution (solve.mjs) and watch mode (solve.watch.lib.mjs)
12
+ - Resolves merge conflicts from main branch
13
+
14
+ ## 0.40.1
15
+
16
+ ### Patch Changes
17
+
18
+ - 1ee78c9: fix: prefer Anthropic provider for public price calculation
19
+
20
+ When calculating public pricing for Claude models, fetchModelInfo now checks the Anthropic provider first instead of using the first match from the models.dev API (which was Helicone). This ensures pricing calculations show "Provider: Anthropic" as expected.
21
+
3
22
  ## 0.40.0
4
23
 
5
24
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/hive-mind",
3
- "version": "0.40.0",
3
+ "version": "0.40.3",
4
4
  "description": "AI-powered issue solver and hive mind for collaborative problem solving",
5
5
  "main": "src/hive.mjs",
6
6
  "type": "module",
@@ -360,6 +360,33 @@ export const handleClaudeRuntimeSwitch = async (argv) => {
360
360
  process.exit(0);
361
361
  }
362
362
  };
363
+ /**
364
+ * Check if Playwright MCP is available and connected to Claude
365
+ * @returns {Promise<boolean>} True if Playwright MCP is available, false otherwise
366
+ */
367
+ export const checkPlaywrightMcpAvailability = async () => {
368
+ try {
369
+ // Try to run a simple claude command that would list MCP servers if available
370
+ // Use a timeout to avoid hanging if Claude is not installed
371
+ const result = await $`timeout 5 claude mcp list 2>&1`.catch(() => null);
372
+
373
+ if (!result || result.code !== 0) {
374
+ return false;
375
+ }
376
+
377
+ const output = result.stdout?.toString() || '';
378
+
379
+ // Check if playwright is in the list of MCP servers
380
+ if (output.toLowerCase().includes('playwright')) {
381
+ return true;
382
+ }
383
+
384
+ return false;
385
+ } catch {
386
+ // If any error occurs, assume Playwright MCP is not available
387
+ return false;
388
+ }
389
+ };
363
390
  /**
364
391
  * Execute Claude with all prompts and settings
365
392
  * This is the main entry point that handles all prompt building and execution
@@ -493,7 +520,15 @@ export const fetchModelInfo = async (modelId) => {
493
520
  res.on('end', () => {
494
521
  try {
495
522
  const apiData = JSON.parse(data);
496
- // Search for the model across all providers
523
+ // For public pricing calculation, prefer Anthropic provider for Claude models
524
+ // Check Anthropic provider first
525
+ if (apiData.anthropic?.models?.[modelId]) {
526
+ const modelInfo = apiData.anthropic.models[modelId];
527
+ modelInfo.provider = apiData.anthropic.name || 'Anthropic';
528
+ resolve(modelInfo);
529
+ return;
530
+ }
531
+ // Search for the model across all other providers
497
532
  for (const provider of Object.values(apiData)) {
498
533
  if (provider.models && provider.models[modelId]) {
499
534
  const modelInfo = provider.models[modelId];
@@ -193,7 +193,8 @@ Self review.
193
193
  - When you check your solution draft, run all tests locally.
194
194
  - When you check your solution draft, verify git status shows a clean working tree with no uncommitted changes.
195
195
  - When you compare with repo style, use gh pr diff [number].
196
- - When you finalize, confirm code, tests, and description are consistent.${argv && argv.promptPlanSubAgent ? '\n\nPlan sub-agent usage.\n - When you start working on a task, consider using the Plan sub-agent to research the codebase and create an implementation plan.\n - When using the Plan sub-agent, you can add it as the first item in your todo list.\n - When you delegate planning, use the Task tool with subagent_type="Plan" before starting implementation work.' : ''}`;
196
+ - When you finalize, confirm code, tests, and description are consistent.${argv && argv.promptPlaywrightMcp ? '\n\nPlaywright MCP usage (browser automation via mcp__playwright__* tools).\n - When you develop frontend web applications (HTML, CSS, JavaScript, React, Vue, Angular, etc.), use Playwright MCP tools to test the UI in a real browser.\n - When WebFetch tool fails to retrieve expected content (e.g., returns empty content, JavaScript-rendered pages, or login-protected pages), use Playwright MCP tools (browser_navigate, browser_snapshot) as a fallback for web browsing.\n - When you need to interact with dynamic web pages that require JavaScript execution, use Playwright MCP tools.\n - When you need to visually verify how a web page looks or take screenshots, use browser_take_screenshot from Playwright MCP.\n - When you need to fill forms, click buttons, or perform user interactions on web pages, use Playwright MCP tools (browser_click, browser_type, browser_fill_form).\n - When you need to test responsive design or different viewport sizes, use browser_resize from Playwright MCP.\n - When you finish using the browser, always close it with browser_close to free resources.' : ''}${argv && argv.promptPlanSubAgent ? '\n\nPlan sub-agent usage.\n - When you start working on a task, consider using the Plan sub-agent to research the codebase and create an implementation plan.\n - When using the Plan sub-agent, you can add it as the first item in your todo list.\n - When you delegate planning, use the Task tool with subagent_type="Plan" before starting implementation work.' : ''}`;
197
+
197
198
  };
198
199
 
199
200
  // Export all functions as default object too
package/src/solve.mjs CHANGED
@@ -815,6 +815,18 @@ try {
815
815
  });
816
816
  } else {
817
817
  // Default to Claude
818
+ // Check for Playwright MCP availability if using Claude tool
819
+ if (argv.tool === 'claude' || !argv.tool) {
820
+ const { checkPlaywrightMcpAvailability } = claudeLib;
821
+ const playwrightMcpAvailable = await checkPlaywrightMcpAvailability();
822
+ if (playwrightMcpAvailable) {
823
+ await log('🎭 Playwright MCP detected - enabling browser automation hints', { verbose: true });
824
+ argv.promptPlaywrightMcp = true;
825
+ } else {
826
+ await log('â„šī¸ Playwright MCP not detected - browser automation hints will be disabled', { verbose: true });
827
+ argv.promptPlaywrightMcp = false;
828
+ }
829
+ }
818
830
  const claudeResult = await executeClaude({
819
831
  issueUrl,
820
832
  issueNumber,
@@ -403,11 +403,23 @@ export const watchForFeedback = async (params) => {
403
403
  } else {
404
404
  // Use Claude (default)
405
405
  const claudeExecLib = await import('./claude.lib.mjs');
406
- const { executeClaude } = claudeExecLib;
406
+ const { executeClaude, checkPlaywrightMcpAvailability } = claudeExecLib;
407
407
 
408
408
  // Get claude path
409
409
  const claudePath = argv.claudePath || 'claude';
410
410
 
411
+ // Check for Playwright MCP availability if using Claude tool
412
+ if (argv.tool === 'claude' || !argv.tool) {
413
+ const playwrightMcpAvailable = await checkPlaywrightMcpAvailability();
414
+ if (playwrightMcpAvailable) {
415
+ await log('🎭 Playwright MCP detected - enabling browser automation hints', { verbose: true });
416
+ argv.promptPlaywrightMcp = true;
417
+ } else {
418
+ await log('â„šī¸ Playwright MCP not detected - browser automation hints will be disabled', { verbose: true });
419
+ argv.promptPlaywrightMcp = false;
420
+ }
421
+ }
422
+
411
423
  toolResult = await executeClaude({
412
424
  issueUrl,
413
425
  issueNumber,