Shell
feat: add Playwright Agent Coordinator toolkit
Eddie Belaval8bfec0a60bdc
diff --git a/hooks.json b/hooks.jsonindex 64dac90..cc19a8e 100644--- a/hooks.json+++ b/hooks.json@@ -40,6 +40,14 @@"pre-tool": {"Bash": ["~/.claude/hooks/agentic/pev-verification.sh"+ ],+ "mcp__playwright-server__*": [+ "~/.claude/playwright-coordinator/hooks/pre-playwright.sh"+ ]+ },+ "post-tool": {+ "mcp__playwright-server__*": [+ "~/.claude/playwright-coordinator/hooks/post-playwright.sh"]},"pre-pr-creation": "~/.claude/hooks/deployment-check.sh"diff --git a/mcpServers.json b/mcpServers.jsonindex d4d0b4a..4bb63d6 100644--- a/mcpServers.json+++ b/mcpServers.json@@ -29,6 +29,18 @@"env": {"SUPABASE_ACCESS_TOKEN": "${SUPABASE_ACCESS_TOKEN}"}+ },+ "playwright-coordinator": {+ "description": "Multi-agent browser pool coordinator - manages Playwright context reservations across parallel agents",+ "command": "node",+ "args": ["~/.claude/playwright-coordinator/mcp-server/dist/index.js"],+ "tools": [+ "playwright_reserve",+ "playwright_release",+ "playwright_pool_status",+ "playwright_heartbeat",+ "playwright_force_cleanup"+ ]}}}diff --git a/toolkits/playwright-coordinator/.gitignore b/toolkits/playwright-coordinator/.gitignorenew file mode 100644index 0000000..db6e481--- /dev/null+++ b/toolkits/playwright-coordinator/.gitignore@@ -0,0 +1,5 @@+node_modules/+events.log+state.json+mcp-server/dist/+*.logdiff --git a/toolkits/playwright-coordinator/ETIQUETTE.md b/toolkits/playwright-coordinator/ETIQUETTE.mdnew file mode 100644index 0000000..9a22765--- /dev/null+++ b/toolkits/playwright-coordinator/ETIQUETTE.md@@ -0,0 +1,243 @@+# Playwright Agent Etiquette++**Version 1.0** | Browser coordination rules for multi-agent environments++---++## The Golden Rules++1. **Reserve before you touch** - Never use Playwright MCP without a reservation+2. **Release when you're done** - Don't hoard contexts+3. **Heartbeat during long tasks** - Let others know you're alive+4. **Check before complex operations** - Verify you still have access+5. **Share sparingly** - Only when truly needed++---++## Before Using Playwright++```+EVERY agent MUST:+1. Call `check <your-agent-id>` to see if you have access+2. If no access, call `reserve <your-agent-id> <purpose>`+3. If reservation fails, WAIT or find alternative approach+4. Only then use Playwright MCP tools+```++### Reservation Protocol++```typescript+// Pseudo-code every agent should follow+async function beforePlaywrightWork(agentId: string, purpose: string) {+ // Step 1: Check existing access+ const access = await coordinator.check(agentId);+ if (access.canUse) {+ return access.contextId; // Good to go+ }++ // Step 2: Try to reserve+ const reservation = await coordinator.reserve(agentId, purpose);++ if (reservation.success) {+ return reservation.contextId;+ }++ // Step 3: Handle waiting+ if (reservation.waitPosition) {+ console.log(`Queue position: ${reservation.waitPosition}`);+ console.log(`Estimated wait: ${reservation.estimatedWaitMs}ms`);++ // DECISION POINT: Wait or use alternative?+ // - If task is urgent: wait and retry+ // - If task can be deferred: skip browser work+ // - If task has alternative: use that instead+ }++ throw new Error('Could not acquire browser context');+}+```++---++## Allowed vs Forbidden Actions++### YOU MAY++- Reserve a context for legitimate browser work+- Hold a context for up to 5 minutes of active use+- Send heartbeats during long operations+- Share your context with ONE other agent for collaboration+- Release and re-reserve if your task changes significantly++### YOU MUST NOT++- Use Playwright without checking/reserving first+- Hold a context while waiting for user input+- Hold a context while doing non-browser work+- Reserve multiple contexts simultaneously+- Ignore the queue when contexts are unavailable+- Share contexts for parallel independent work (use separate reservations)++---++## Task Duration Guidelines++| Task Type | Max Hold Time | Heartbeat Frequency |+|-----------|---------------|---------------------|+| Quick check (screenshot, status) | 30 seconds | Not needed |+| Form interaction | 2 minutes | Every 30 seconds |+| Multi-step flow | 5 minutes | Every 30 seconds |+| Complex testing | 5 minutes, then re-reserve | Every 30 seconds |++**If your task exceeds 5 minutes:**+1. Break it into phases+2. Release between phases+3. Re-reserve for each phase+4. This allows other agents to get access++---++## Handling Contention++When `reserve` returns `waitPosition`:++### Option A: Wait (for critical browser work)+```+while (!reserved) {+ wait(30 seconds)+ retry reserve+}+```++### Option B: Defer (for non-critical work)+```+log("Browser busy, will retry later")+continue with non-browser tasks+schedule browser work for later+```++### Option C: Alternative (when possible)+```+// Instead of browser screenshot+use API to fetch data+use cached data+ask user to check manually+```++---++## Sharing Protocol++Sharing is for **collaboration**, not parallelism.++### Valid Sharing Scenarios+- Agent A logs in, Agent B needs to continue that session+- Agent A fills a form, Agent B needs to verify the result+- Debugging requires two agents looking at same state++### Invalid Sharing Scenarios+- Two agents doing independent work "to save time"+- Sharing to avoid waiting in queue+- Sharing without time limit++### How to Share++Owner agent:+```bash+# Share for 2 minutes (120000ms)+npx ts-node cli.ts share agent-owner agent-helper 120000+```++Helper agent:+```bash+# Check access (will see shared context)+npx ts-node cli.ts check agent-helper+# Returns: { canUse: true, contextId: "context_3", isShared: true }+```++**The owner is responsible for releasing when ALL work is done.**++---++## Error Recovery++### Agent Crashes Mid-Work+- Contexts auto-cleanup after 10 minutes of no heartbeat+- Stale locks auto-release after 30 seconds+- Waiting agents get notified when contexts free up++### Lock Timeout+```+If you see "Could not acquire lock - try again":+1. Wait 1 second+2. Retry the command+3. If persistent (>5 retries), check for zombie processes+```++### Manual Cleanup+If an agent dies without releasing:+```bash+# Force release all contexts for that agent+npx ts-node cli.ts cleanup dead-agent-id+```++---++## Quick Reference++```bash+# Before browser work+npx ts-node cli.ts check my-agent-id++# Reserve a context+npx ts-node cli.ts reserve my-agent-id "purpose description"++# Keep alive during long work+npx ts-node cli.ts heartbeat my-agent-id++# When done+npx ts-node cli.ts release my-agent-id++# Check pool status+npx ts-node cli.ts status++# Emergency cleanup+npx ts-node cli.ts cleanup stuck-agent-id+```++---++## Integration with Claude Agents++For Claude Code agents, add to your workflow:++```markdown+## Browser Work Protocol++Before any Playwright MCP calls:+1. Reserve: `coordinator reserve <session-id> <purpose>`+2. Verify: Check the result for success+3. Work: Do your browser tasks+4. Heartbeat: If >30s, send heartbeats+5. Release: Always release when done++If reservation fails with waitPosition:+- Inform user: "Browser pool busy, position X in queue"+- Decide: Wait, defer, or use alternative+```++---++## FAQ++**Q: What if I forget to release?**+A: Auto-cleanup runs every minute. After 10 minutes of no activity, your context is reclaimed. But don't rely on this - it delays other agents.++**Q: Can I reserve "just in case"?**+A: No. Only reserve when you're about to do browser work. Reserve-and-hold wastes shared resources.++**Q: What's my agent ID?**+A: Use your session ID, task ID, or any unique identifier that persists for your work session.++**Q: How do I know if another agent is using my target page?**+A: You don't - browser contexts are isolated. Each agent gets separate browser state. Sharing creates explicit collaboration, not implicit state sharing.diff --git a/toolkits/playwright-coordinator/cli.ts b/toolkits/playwright-coordinator/cli.tsnew file mode 100644index 0000000..a8582f1--- /dev/null+++ b/toolkits/playwright-coordinator/cli.ts@@ -0,0 +1,162 @@+#!/usr/bin/env npx ts-node+/**+ * Playwright Coordinator CLI+ *+ * Usage:+ * npx ts-node cli.ts reserve <agent-id> <purpose>+ * npx ts-node cli.ts release <agent-id>+ * npx ts-node cli.ts share <owner-agent-id> <target-agent-id> [expires-ms]+ * npx ts-node cli.ts check <agent-id>+ * npx ts-node cli.ts status+ * npx ts-node cli.ts heartbeat <agent-id>+ * npx ts-node cli.ts cleanup <agent-id>+ */++import {+ reserveContext,+ releaseContext,+ shareContext,+ canUseContext,+ getStatus,+ heartbeat,+ forceReleaseAll,+} from './coordinator';++async function main() {+ const [, , command, ...args] = process.argv;++ if (!command) {+ printUsage();+ process.exit(1);+ }++ try {+ switch (command) {+ case 'reserve': {+ const [agentId, ...purposeParts] = args;+ const purpose = purposeParts.join(' ') || 'general';+ if (!agentId) {+ console.error('Error: agent-id required');+ process.exit(1);+ }+ const result = await reserveContext(agentId, purpose);+ console.log(JSON.stringify(result, null, 2));+ process.exit(result.success ? 0 : 1);+ break;+ }++ case 'release': {+ const [agentId] = args;+ if (!agentId) {+ console.error('Error: agent-id required');+ process.exit(1);+ }+ const result = await releaseContext(agentId);+ console.log(JSON.stringify(result, null, 2));+ process.exit(result.success ? 0 : 1);+ break;+ }++ case 'share': {+ const [ownerAgentId, targetAgentId, expiresMs] = args;+ if (!ownerAgentId || !targetAgentId) {+ console.error('Error: owner-agent-id and target-agent-id required');+ process.exit(1);+ }+ const result = await shareContext(+ ownerAgentId,+ targetAgentId,+ expiresMs ? parseInt(expiresMs, 10) : undefined+ );+ console.log(JSON.stringify(result, null, 2));+ process.exit(result.success ? 0 : 1);+ break;+ }++ case 'check': {+ const [agentId] = args;+ if (!agentId) {+ console.error('Error: agent-id required');+ process.exit(1);+ }+ const result = await canUseContext(agentId);+ console.log(JSON.stringify(result, null, 2));+ process.exit(result.canUse ? 0 : 1);+ break;+ }++ case 'status': {+ const status = await getStatus();+ console.log('\n=== Playwright Pool Status ===\n');+ console.log(`Available: ${status.available}`);+ console.log(`Reserved: ${status.reserved}`);+ console.log(`Shared: ${status.shared}`);+ console.log(`Waiting: ${status.waiting}`);+ console.log('\n--- Contexts ---');+ for (const ctx of status.contexts) {+ const icon = ctx.status === 'available' ? 'π’' : ctx.status === 'reserved' ? 'π‘' : 'π΅';+ console.log(`${icon} ${ctx.id}: ${ctx.status}${ctx.agentId ? ` (${ctx.agentId})` : ''}`);+ if (ctx.purpose) {+ console.log(` ββ ${ctx.purpose}`);+ }+ }+ console.log('');+ break;+ }++ case 'heartbeat': {+ const [agentId] = args;+ if (!agentId) {+ console.error('Error: agent-id required');+ process.exit(1);+ }+ const success = await heartbeat(agentId);+ console.log(success ? 'OK' : 'No context found');+ process.exit(success ? 0 : 1);+ break;+ }++ case 'cleanup': {+ const [agentId] = args;+ if (!agentId) {+ console.error('Error: agent-id required');+ process.exit(1);+ }+ const released = await forceReleaseAll(agentId);+ console.log(`Released ${released} context(s)`);+ break;+ }++ default:+ console.error(`Unknown command: ${command}`);+ printUsage();+ process.exit(1);+ }+ } catch (err) {+ console.error('Error:', err instanceof Error ? err.message : err);+ process.exit(1);+ }+}++function printUsage() {+ console.log(`+Playwright Coordinator CLI++Commands:+ reserve <agent-id> <purpose> Reserve a browser context+ release <agent-id> Release your context back to pool+ share <owner> <target> [ms] Share context with another agent+ check <agent-id> Check if you can use Playwright+ status Show pool status+ heartbeat <agent-id> Update activity timestamp+ cleanup <agent-id> Force release all for an agent++Examples:+ npx ts-node cli.ts reserve agent-123 "Testing checkout flow"+ npx ts-node cli.ts status+ npx ts-node cli.ts release agent-123+ npx ts-node cli.ts share agent-123 agent-456 300000+`);+}++main();diff --git a/toolkits/playwright-coordinator/coordinator.ts b/toolkits/playwright-coordinator/coordinator.tsnew file mode 100644index 0000000..2b9b07a--- /dev/null+++ b/toolkits/playwright-coordinator/coordinator.ts@@ -0,0 +1,486 @@+/**+ * Playwright Agent Coordinator+ *+ * Manages browser context pool for multiple concurrent agents.+ * Uses file-based locking to prevent race conditions.+ */++import * as fs from 'fs/promises';+import * as path from 'path';+import {+ CoordinatorState,+ CoordinatorConfig,+ BrowserContext,+ ReservationResult,+ ReleaseResult,+ ShareResult,+ SharedSession,+ EventLog,+} from './types';++const STATE_FILE = path.join(__dirname, 'state.json');+const LOCK_FILE = path.join(__dirname, 'state.lock');+const LOG_FILE = path.join(__dirname, 'events.log');++const DEFAULT_CONFIG: CoordinatorConfig = {+ maxContexts: 6,+ reservationTimeoutMs: 5 * 60 * 1000, // 5 minutes+ cleanupIntervalMs: 60 * 1000, // 1 minute+ lockTimeoutMs: 5000, // 5 seconds+ lockRetryDelayMs: 100,+ maxLockRetries: 50,+};++// ============================================+// File Locking (Critical for atomicity)+// ============================================++async function acquireLock(config: CoordinatorConfig): Promise<boolean> {+ const startTime = Date.now();+ let retries = 0;++ while (retries < config.maxLockRetries) {+ try {+ // Create lock file exclusively (fails if exists)+ await fs.writeFile(LOCK_FILE, JSON.stringify({+ pid: process.pid,+ timestamp: new Date().toISOString(),+ }), { flag: 'wx' });+ return true;+ } catch (err: unknown) {+ if ((err as NodeJS.ErrnoException).code === 'EEXIST') {+ // Lock exists - check if stale+ try {+ const lockData = await fs.readFile(LOCK_FILE, 'utf-8');+ const lock = JSON.parse(lockData);+ const lockAge = Date.now() - new Date(lock.timestamp).getTime();++ // Stale lock (> 30 seconds) - remove it+ if (lockAge > 30000) {+ await fs.unlink(LOCK_FILE);+ continue;+ }+ } catch {+ // Lock file corrupted, remove it+ try { await fs.unlink(LOCK_FILE); } catch { /* ignore */ }+ }++ // Wait and retry+ await sleep(config.lockRetryDelayMs + Math.random() * 50);+ retries++;+ } else {+ throw err;+ }+ }++ if (Date.now() - startTime > config.lockTimeoutMs) {+ return false;+ }+ }++ return false;+}++async function releaseLock(): Promise<void> {+ try {+ await fs.unlink(LOCK_FILE);+ } catch {+ // Already released or never acquired+ }+}++function sleep(ms: number): Promise<void> {+ return new Promise(resolve => setTimeout(resolve, ms));+}++// ============================================+// State Management+// ============================================++function createDefaultState(): CoordinatorState {+ const contexts: Record<string, BrowserContext> = {};++ for (let i = 1; i <= DEFAULT_CONFIG.maxContexts; i++) {+ contexts[`context_${i}`] = {+ id: `context_${i}`,+ status: 'available',+ agentId: null,+ reservedAt: null,+ purpose: null,+ lastActivity: null,+ };+ }++ return {+ version: 1,+ updatedAt: new Date().toISOString(),+ config: DEFAULT_CONFIG,+ contexts,+ sharedSessions: {},+ waitingAgents: [],+ };+}++async function loadState(): Promise<CoordinatorState> {+ try {+ const data = await fs.readFile(STATE_FILE, 'utf-8');+ return JSON.parse(data);+ } catch (err: unknown) {+ if ((err as NodeJS.ErrnoException).code === 'ENOENT') {+ const defaultState = createDefaultState();+ await saveState(defaultState);+ return defaultState;+ }+ throw err;+ }+}++async function saveState(state: CoordinatorState): Promise<void> {+ state.updatedAt = new Date().toISOString();+ state.version++;+ await fs.writeFile(STATE_FILE, JSON.stringify(state, null, 2));+}++async function logEvent(event: EventLog['event']): Promise<void> {+ const entry: EventLog = {+ timestamp: new Date().toISOString(),+ event,+ };+ await fs.appendFile(LOG_FILE, JSON.stringify(entry) + '\n');+}++// ============================================+// Core Operations+// ============================================++/**+ * Reserve a browser context for exclusive use+ */+export async function reserveContext(+ agentId: string,+ purpose: string+): Promise<ReservationResult> {+ const locked = await acquireLock(DEFAULT_CONFIG);+ if (!locked) {+ return { success: false, error: 'Could not acquire lock - try again' };+ }++ try {+ const state = await loadState();++ // Clean up stale reservations first+ await cleanupStaleReservations(state);++ // Check if agent already has a context+ const existingContext = Object.values(state.contexts).find(+ ctx => ctx.agentId === agentId && ctx.status === 'reserved'+ );+ if (existingContext) {+ return {+ success: true,+ contextId: existingContext.id,+ error: 'Already have a reserved context',+ };+ }++ // Find an available context+ const available = Object.values(state.contexts).find(+ ctx => ctx.status === 'available'+ );++ if (!available) {+ // Add to waiting list+ const alreadyWaiting = state.waitingAgents.some(w => w.agentId === agentId);+ if (!alreadyWaiting) {+ state.waitingAgents.push({+ agentId,+ requestedAt: new Date().toISOString(),+ purpose,+ priority: 'normal',+ });+ await saveState(state);+ }++ const position = state.waitingAgents.findIndex(w => w.agentId === agentId) + 1;+ return {+ success: false,+ error: 'No contexts available',+ waitPosition: position,+ estimatedWaitMs: position * 60000, // ~1 min per position+ };+ }++ // Reserve the context+ available.status = 'reserved';+ available.agentId = agentId;+ available.reservedAt = new Date().toISOString();+ available.purpose = purpose;+ available.lastActivity = new Date().toISOString();++ // Remove from waiting list if present+ state.waitingAgents = state.waitingAgents.filter(w => w.agentId !== agentId);++ await saveState(state);+ await logEvent({ type: 'reserved', agentId, contextId: available.id, purpose });++ return { success: true, contextId: available.id };+ } finally {+ await releaseLock();+ }+}++/**+ * Release a browser context back to the pool+ */+export async function releaseContext(agentId: string): Promise<ReleaseResult> {+ const locked = await acquireLock(DEFAULT_CONFIG);+ if (!locked) {+ return { success: false, error: 'Could not acquire lock - try again' };+ }++ try {+ const state = await loadState();++ const context = Object.values(state.contexts).find(+ ctx => ctx.agentId === agentId+ );++ if (!context) {+ return { success: false, error: 'No context found for this agent' };+ }++ const contextId = context.id;++ // Clean up any shared sessions for this context+ const sessionsToRemove = Object.entries(state.sharedSessions)+ .filter(([, session]) => session.contextId === contextId)+ .map(([id]) => id);++ for (const sessionId of sessionsToRemove) {+ delete state.sharedSessions[sessionId];+ }++ // Reset the context+ context.status = 'available';+ context.agentId = null;+ context.reservedAt = null;+ context.purpose = null;+ context.lastActivity = null;++ // Notify next waiting agent (they'll need to re-request)+ if (state.waitingAgents.length > 0) {+ const nextAgent = state.waitingAgents[0];+ console.log(`[Coordinator] Context available - next in queue: ${nextAgent.agentId}`);+ }++ await saveState(state);+ await logEvent({ type: 'released', agentId, contextId });++ return { success: true, contextId };+ } finally {+ await releaseLock();+ }+}++/**+ * Share a context with another agent+ */+export async function shareContext(+ ownerAgentId: string,+ targetAgentId: string,+ expiresInMs?: number+): Promise<ShareResult> {+ const locked = await acquireLock(DEFAULT_CONFIG);+ if (!locked) {+ return { success: false, error: 'Could not acquire lock - try again' };+ }++ try {+ const state = await loadState();++ // Find owner's context+ const context = Object.values(state.contexts).find(+ ctx => ctx.agentId === ownerAgentId && ctx.status === 'reserved'+ );++ if (!context) {+ return { success: false, error: 'Owner does not have a reserved context' };+ }++ // Create shared session+ const sessionId = `share_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;+ const session: SharedSession = {+ sessionId,+ contextId: context.id,+ ownerAgentId,+ allowedAgentIds: [targetAgentId],+ createdAt: new Date().toISOString(),+ expiresAt: expiresInMs+ ? new Date(Date.now() + expiresInMs).toISOString()+ : null,+ };++ // Mark context as shared+ context.status = 'shared';+ state.sharedSessions[sessionId] = session;++ await saveState(state);+ await logEvent({ type: 'shared', ownerAgentId, targetAgentId, sessionId });++ return { success: true, sessionId };+ } finally {+ await releaseLock();+ }+}++/**+ * Update activity timestamp (heartbeat)+ */+export async function heartbeat(agentId: string): Promise<boolean> {+ const locked = await acquireLock(DEFAULT_CONFIG);+ if (!locked) return false;++ try {+ const state = await loadState();+ const context = Object.values(state.contexts).find(+ ctx => ctx.agentId === agentId+ );++ if (context) {+ context.lastActivity = new Date().toISOString();+ await saveState(state);+ return true;+ }+ return false;+ } finally {+ await releaseLock();+ }+}++/**+ * Get current pool status+ */+export async function getStatus(): Promise<{+ available: number;+ reserved: number;+ shared: number;+ waiting: number;+ contexts: BrowserContext[];+}> {+ const state = await loadState();+ const contexts = Object.values(state.contexts);++ return {+ available: contexts.filter(c => c.status === 'available').length,+ reserved: contexts.filter(c => c.status === 'reserved').length,+ shared: contexts.filter(c => c.status === 'shared').length,+ waiting: state.waitingAgents.length,+ contexts,+ };+}++/**+ * Check if an agent can use a context (own or shared)+ */+export async function canUseContext(agentId: string): Promise<{+ canUse: boolean;+ contextId?: string;+ isShared: boolean;+}> {+ const state = await loadState();++ // Check if agent owns a context+ const ownedContext = Object.values(state.contexts).find(+ ctx => ctx.agentId === agentId+ );+ if (ownedContext) {+ return { canUse: true, contextId: ownedContext.id, isShared: false };+ }++ // Check if agent has access via shared session+ const sharedSession = Object.values(state.sharedSessions).find(+ session => session.allowedAgentIds.includes(agentId) &&+ (!session.expiresAt || new Date(session.expiresAt) > new Date())+ );+ if (sharedSession) {+ return { canUse: true, contextId: sharedSession.contextId, isShared: true };+ }++ return { canUse: false, isShared: false };+}++// ============================================+// Cleanup+// ============================================++async function cleanupStaleReservations(state: CoordinatorState): Promise<void> {+ const now = Date.now();+ const staleContexts: string[] = [];++ for (const context of Object.values(state.contexts)) {+ if (context.status !== 'available' && context.lastActivity) {+ const lastActivity = new Date(context.lastActivity).getTime();+ const age = now - lastActivity;++ // Stale if no activity for 2x the timeout+ if (age > state.config.reservationTimeoutMs * 2) {+ staleContexts.push(context.id);+ context.status = 'available';+ context.agentId = null;+ context.reservedAt = null;+ context.purpose = null;+ context.lastActivity = null;+ }+ }+ }++ // Clean expired shared sessions+ for (const [sessionId, session] of Object.entries(state.sharedSessions)) {+ if (session.expiresAt && new Date(session.expiresAt) < new Date()) {+ delete state.sharedSessions[sessionId];+ }+ }++ if (staleContexts.length > 0) {+ await logEvent({ type: 'cleanup', staleContexts });+ }+}++/**+ * Force release all contexts for an agent (emergency cleanup)+ */+export async function forceReleaseAll(agentId: string): Promise<number> {+ const locked = await acquireLock(DEFAULT_CONFIG);+ if (!locked) return 0;++ try {+ const state = await loadState();+ let released = 0;++ for (const context of Object.values(state.contexts)) {+ if (context.agentId === agentId) {+ context.status = 'available';+ context.agentId = null;+ context.reservedAt = null;+ context.purpose = null;+ context.lastActivity = null;+ released++;+ }+ }++ // Remove from waiting list+ state.waitingAgents = state.waitingAgents.filter(w => w.agentId !== agentId);++ // Remove shared sessions+ for (const [sessionId, session] of Object.entries(state.sharedSessions)) {+ if (session.ownerAgentId === agentId) {+ delete state.sharedSessions[sessionId];+ }+ }++ await saveState(state);+ return released;+ } finally {+ await releaseLock();+ }+}diff --git a/toolkits/playwright-coordinator/hooks/post-playwright.sh b/toolkits/playwright-coordinator/hooks/post-playwright.shnew file mode 100755index 0000000..1a014ca--- /dev/null+++ b/toolkits/playwright-coordinator/hooks/post-playwright.sh@@ -0,0 +1,24 @@+#!/bin/bash+# Post-Playwright Hook+# Sends heartbeat after Playwright tool calls to keep reservation alive++set -e++# Get session ID+AGENT_ID="${CLAUDE_SESSION_ID:-session-$$}"++# Read tool input from stdin+INPUT=$(cat)++# Extract tool name+TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // empty')++# Check if this is a Playwright tool+if [[ "$TOOL_NAME" == mcp__playwright-server__* ]]; then+ # Send heartbeat+ COORDINATOR_DIR="$HOME/.claude/playwright-coordinator"+ cd "$COORDINATOR_DIR" && npx ts-node cli.ts heartbeat "$AGENT_ID" >/dev/null 2>&1 || true+ echo "[Playwright Coordinator] Heartbeat sent for: $AGENT_ID" >&2+fi++exit 0diff --git a/toolkits/playwright-coordinator/hooks/pre-playwright.sh b/toolkits/playwright-coordinator/hooks/pre-playwright.shnew file mode 100755index 0000000..fc8a080--- /dev/null+++ b/toolkits/playwright-coordinator/hooks/pre-playwright.sh@@ -0,0 +1,51 @@+#!/bin/bash+# Pre-Playwright Hook+# Auto-reserves a browser context before any Playwright MCP tool call+#+# This hook is triggered by Claude's PreToolUse hook matcher for mcp__playwright-server__*++set -e++# Get session ID from environment or generate one+AGENT_ID="${CLAUDE_SESSION_ID:-session-$$}"++# Read tool input from stdin+INPUT=$(cat)++# Extract tool name+TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // empty')++# Log for debugging (to stderr so it doesn't interfere)+echo "[Playwright Coordinator] Pre-hook for: $TOOL_NAME (agent: $AGENT_ID)" >&2++# Check if this is a Playwright tool+if [[ "$TOOL_NAME" == mcp__playwright-server__* ]]; then+ # Try to reserve a context+ COORDINATOR_DIR="$HOME/.claude/playwright-coordinator"++ # Use the CLI to reserve+ RESULT=$(cd "$COORDINATOR_DIR" && npx ts-node cli.ts reserve "$AGENT_ID" "Auto-reserved for $TOOL_NAME" 2>/dev/null || echo '{"success":false}')++ SUCCESS=$(echo "$RESULT" | jq -r '.success // false')++ if [[ "$SUCCESS" == "true" ]]; then+ CONTEXT_ID=$(echo "$RESULT" | jq -r '.contextId // "unknown"')+ echo "[Playwright Coordinator] Reserved context: $CONTEXT_ID" >&2+ else+ # Check if we're in queue+ WAIT_POS=$(echo "$RESULT" | jq -r '.waitPosition // 0')+ if [[ "$WAIT_POS" != "0" && "$WAIT_POS" != "null" ]]; then+ echo "[Playwright Coordinator] BLOCKED - Queue position: $WAIT_POS" >&2+ echo "ERROR: Browser pool is full. You are position $WAIT_POS in queue. Wait and retry, or use an alternative approach." >&2+ exit 2 # Exit code 2 blocks the tool+ fi++ # Check for error+ ERROR=$(echo "$RESULT" | jq -r '.error // "Unknown error"')+ echo "[Playwright Coordinator] Warning: $ERROR" >&2+ # Don't block, let it proceed (might already have a context)+ fi+fi++# Pass through - allow the tool to proceed+exit 0diff --git a/toolkits/playwright-coordinator/install.sh b/toolkits/playwright-coordinator/install.shnew file mode 100755index 0000000..34fd483--- /dev/null+++ b/toolkits/playwright-coordinator/install.sh@@ -0,0 +1,126 @@+#!/bin/bash+# Playwright Agent Coordinator - Installation Script+# Built at ID8Labs - https://id8labs.com+#+# This script installs the Playwright Agent Coordination System+# for multi-agent browser pool management.++set -e++echo "π Playwright Agent Coordinator Installer"+echo "=========================================="+echo ""++INSTALL_DIR="$HOME/.claude/playwright-coordinator"++# Check if already installed+if [ -d "$INSTALL_DIR" ] && [ -f "$INSTALL_DIR/coordinator.ts" ]; then+ echo "β Already installed at $INSTALL_DIR"+ echo ""+ read -p "Reinstall/update? (y/N): " -n 1 -r+ echo+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then+ echo "Aborted."+ exit 0+ fi+fi++echo "π¦ Installing to $INSTALL_DIR..."+mkdir -p "$INSTALL_DIR"++# Check for Node.js+if ! command -v node &> /dev/null; then+ echo "β Node.js is required but not installed."+ echo " Install from: https://nodejs.org/"+ exit 1+fi++echo "β Node.js found: $(node --version)"++# Install dependencies+echo "π₯ Installing dependencies..."+cd "$INSTALL_DIR"++if [ ! -f "package.json" ]; then+ cat > package.json << 'PKGJSON'+{+ "name": "playwright-coordinator",+ "version": "1.0.0",+ "description": "Multi-agent Playwright browser pool coordinator",+ "type": "module",+ "scripts": {+ "build": "tsc",+ "cli": "npx ts-node cli.ts"+ },+ "dependencies": {+ "@modelcontextprotocol/sdk": "^1.0.0",+ "typescript": "^5.0.0",+ "ts-node": "^10.9.0"+ }+}+PKGJSON+fi++npm install --silent 2>/dev/null || npm install++# Initialize state if needed+if [ ! -f "state.json" ]; then+ echo "π Initializing pool state..."+ cat > state.json << 'STATEJSON'+{+ "contexts": {+ "context_1": { "status": "available" },+ "context_2": { "status": "available" },+ "context_3": { "status": "available" },+ "context_4": { "status": "available" },+ "context_5": { "status": "available" },+ "context_6": { "status": "available" }+ },+ "waitQueue": [],+ "shareRequests": [],+ "lastCleanup": null+}+STATEJSON+fi++# Make hooks executable+if [ -d "hooks" ]; then+ chmod +x hooks/*.sh 2>/dev/null || true+fi++# Build MCP server+if [ -d "mcp-server" ] && [ -f "mcp-server/src/index.ts" ]; then+ echo "π¨ Building MCP server..."+ cd mcp-server+ npm install --silent 2>/dev/null || npm install+ npm run build 2>/dev/null || npx tsc+ cd ..+fi++echo ""+echo "β Installation complete!"+echo ""+echo "π Next steps:"+echo ""+echo "1. Add to ~/.mcp.json:"+echo ' "playwright-coordinator": {'+echo ' "command": "node",'+echo ' "args": ["'$INSTALL_DIR'/mcp-server/dist/index.js"]'+echo ' }'+echo ""+echo "2. Add hooks to ~/.claude/settings.local.json:"+echo ' "PreToolUse": [{'+echo ' "matcher": "mcp__playwright-server__*",'+echo ' "hooks": [{ "type": "command", "command": "'$INSTALL_DIR'/hooks/pre-playwright.sh" }]'+echo ' }],'+echo ' "PostToolUse": [{'+echo ' "matcher": "mcp__playwright-server__*",'+echo ' "hooks": [{ "type": "command", "command": "'$INSTALL_DIR'/hooks/post-playwright.sh" }]'+echo ' }]'+echo ""+echo "3. Restart Claude Code"+echo ""+echo "π Docs: $INSTALL_DIR/ETIQUETTE.md"+echo "π§ Test: Use playwright_pool_status MCP tool"+echo ""+echo "Built at ID8Labs - We don't ask for permission to solve our problems."diff --git a/toolkits/playwright-coordinator/mcp-server/package-lock.json b/toolkits/playwright-coordinator/mcp-server/package-lock.jsonnew file mode 100644index 0000000..f90144f--- /dev/null+++ b/toolkits/playwright-coordinator/mcp-server/package-lock.json@@ -0,0 +1,1348 @@+{+ "name": "playwright-coordinator-mcp",+ "version": "1.0.0",+ "lockfileVersion": 3,+ "requires": true,+ "packages": {+ "": {+ "name": "playwright-coordinator-mcp",+ "version": "1.0.0",+ "dependencies": {+ "@modelcontextprotocol/sdk": "^1.0.0"+ },+ "bin": {+ "playwright-coordinator-mcp": "dist/index.js"+ },+ "devDependencies": {+ "@types/node": "^20.0.0",+ "ts-node": "^10.9.0",+ "typescript": "^5.0.0"+ }+ },+ "node_modules/@cspotcode/source-map-support": {+ "version": "0.8.1",+ "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",+ "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@jridgewell/trace-mapping": "0.3.9"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@hono/node-server": {+ "version": "1.19.7",+ "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.19.7.tgz",+ "integrity": "sha512-vUcD0uauS7EU2caukW8z5lJKtoGMokxNbJtBiwHgpqxEXokaHCBkQUmCHhjFB1VUTWdqj25QoMkMKzgjq+uhrw==",+ "license": "MIT",+ "engines": {+ "node": ">=18.14.1"+ },+ "peerDependencies": {+ "hono": "^4"+ }+ },+ "node_modules/@jridgewell/resolve-uri": {+ "version": "3.1.2",+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6.0.0"+ }+ },+ "node_modules/@jridgewell/sourcemap-codec": {+ "version": "1.5.5",+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",+ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@jridgewell/trace-mapping": {+ "version": "0.3.9",+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",+ "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@jridgewell/resolve-uri": "^3.0.3",+ "@jridgewell/sourcemap-codec": "^1.4.10"+ }+ },+ "node_modules/@modelcontextprotocol/sdk": {+ "version": "1.25.2",+ "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.25.2.tgz",+ "integrity": "sha512-LZFeo4F9M5qOhC/Uc1aQSrBHxMrvxett+9KLHt7OhcExtoiRN9DKgbZffMP/nxjutWDQpfMDfP3nkHI4X9ijww==",+ "license": "MIT",+ "dependencies": {+ "@hono/node-server": "^1.19.7",+ "ajv": "^8.17.1",+ "ajv-formats": "^3.0.1",+ "content-type": "^1.0.5",+ "cors": "^2.8.5",+ "cross-spawn": "^7.0.5",+ "eventsource": "^3.0.2",+ "eventsource-parser": "^3.0.0",+ "express": "^5.0.1",+ "express-rate-limit": "^7.5.0",+ "jose": "^6.1.1",+ "json-schema-typed": "^8.0.2",+ "pkce-challenge": "^5.0.0",+ "raw-body": "^3.0.0",+ "zod": "^3.25 || ^4.0",+ "zod-to-json-schema": "^3.25.0"+ },+ "engines": {+ "node": ">=18"+ },+ "peerDependencies": {+ "@cfworker/json-schema": "^4.1.1",+ "zod": "^3.25 || ^4.0"+ },+ "peerDependenciesMeta": {+ "@cfworker/json-schema": {+ "optional": true+ },+ "zod": {+ "optional": false+ }+ }+ },+ "node_modules/@tsconfig/node10": {+ "version": "1.0.12",+ "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.12.tgz",+ "integrity": "sha512-UCYBaeFvM11aU2y3YPZ//O5Rhj+xKyzy7mvcIoAjASbigy8mHMryP5cK7dgjlz2hWxh1g5pLw084E0a/wlUSFQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@tsconfig/node12": {+ "version": "1.0.11",+ "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",+ "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@tsconfig/node14": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",+ "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@tsconfig/node16": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",+ "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@types/node": {+ "version": "20.19.27",+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.27.tgz",+ "integrity": "sha512-N2clP5pJhB2YnZJ3PIHFk5RkygRX5WO/5f0WC08tp0wd+sv0rsJk3MqWn3CbNmT2J505a5336jaQj4ph1AdMug==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "undici-types": "~6.21.0"+ }+ },+ "node_modules/accepts": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",+ "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==",+ "license": "MIT",+ "dependencies": {+ "mime-types": "^3.0.0",+ "negotiator": "^1.0.0"+ },+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/acorn": {+ "version": "8.15.0",+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",+ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",+ "dev": true,+ "license": "MIT",+ "bin": {+ "acorn": "bin/acorn"+ },+ "engines": {+ "node": ">=0.4.0"+ }+ },+ "node_modules/acorn-walk": {+ "version": "8.3.4",+ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz",+ "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "acorn": "^8.11.0"+ },+ "engines": {+ "node": ">=0.4.0"+ }+ },+ "node_modules/ajv": {+ "version": "8.17.1",+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz",+ "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==",+ "license": "MIT",+ "dependencies": {+ "fast-deep-equal": "^3.1.3",+ "fast-uri": "^3.0.1",+ "json-schema-traverse": "^1.0.0",+ "require-from-string": "^2.0.2"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/epoberezkin"+ }+ },+ "node_modules/ajv-formats": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz",+ "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==",+ "license": "MIT",+ "dependencies": {+ "ajv": "^8.0.0"+ },+ "peerDependencies": {+ "ajv": "^8.0.0"+ },+ "peerDependenciesMeta": {+ "ajv": {+ "optional": true+ }+ }+ },+ "node_modules/arg": {+ "version": "4.1.3",+ "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",+ "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/body-parser": {+ "version": "2.2.2",+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz",+ "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==",+ "license": "MIT",+ "dependencies": {+ "bytes": "^3.1.2",+ "content-type": "^1.0.5",+ "debug": "^4.4.3",+ "http-errors": "^2.0.0",+ "iconv-lite": "^0.7.0",+ "on-finished": "^2.4.1",+ "qs": "^6.14.1",+ "raw-body": "^3.0.1",+ "type-is": "^2.0.1"+ },+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/bytes": {+ "version": "3.1.2",+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",+ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/call-bind-apply-helpers": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",+ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0",+ "function-bind": "^1.1.2"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/call-bound": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",+ "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",+ "license": "MIT",+ "dependencies": {+ "call-bind-apply-helpers": "^1.0.2",+ "get-intrinsic": "^1.3.0"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/content-disposition": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz",+ "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==",+ "license": "MIT",+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/content-type": {+ "version": "1.0.5",+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",+ "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/cookie": {+ "version": "0.7.2",+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",+ "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/cookie-signature": {+ "version": "1.2.2",+ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz",+ "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==",+ "license": "MIT",+ "engines": {+ "node": ">=6.6.0"+ }+ },+ "node_modules/cors": {+ "version": "2.8.5",+ "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",+ "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",+ "license": "MIT",+ "dependencies": {+ "object-assign": "^4",+ "vary": "^1"+ },+ "engines": {+ "node": ">= 0.10"+ }+ },+ "node_modules/create-require": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",+ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/cross-spawn": {+ "version": "7.0.6",+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",+ "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",+ "license": "MIT",+ "dependencies": {+ "path-key": "^3.1.0",+ "shebang-command": "^2.0.0",+ "which": "^2.0.1"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/debug": {+ "version": "4.4.3",+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",+ "license": "MIT",+ "dependencies": {+ "ms": "^2.1.3"+ },+ "engines": {+ "node": ">=6.0"+ },+ "peerDependenciesMeta": {+ "supports-color": {+ "optional": true+ }+ }+ },+ "node_modules/depd": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/diff": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",+ "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",+ "dev": true,+ "license": "BSD-3-Clause",+ "engines": {+ "node": ">=0.3.1"+ }+ },+ "node_modules/dunder-proto": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",+ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",+ "license": "MIT",+ "dependencies": {+ "call-bind-apply-helpers": "^1.0.1",+ "es-errors": "^1.3.0",+ "gopd": "^1.2.0"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/ee-first": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",+ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",+ "license": "MIT"+ },+ "node_modules/encodeurl": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/es-define-property": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/es-errors": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/es-object-atoms": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",+ "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/escape-html": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",+ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",+ "license": "MIT"+ },+ "node_modules/etag": {+ "version": "1.8.1",+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",+ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/eventsource": {+ "version": "3.0.7",+ "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.7.tgz",+ "integrity": "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==",+ "license": "MIT",+ "dependencies": {+ "eventsource-parser": "^3.0.1"+ },+ "engines": {+ "node": ">=18.0.0"+ }+ },+ "node_modules/eventsource-parser": {+ "version": "3.0.6",+ "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.0.6.tgz",+ "integrity": "sha512-Vo1ab+QXPzZ4tCa8SwIHJFaSzy4R6SHf7BY79rFBDf0idraZWAkYrDjDj8uWaSm3S2TK+hJ7/t1CEmZ7jXw+pg==",+ "license": "MIT",+ "engines": {+ "node": ">=18.0.0"+ }+ },+ "node_modules/express": {+ "version": "5.2.1",+ "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz",+ "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==",+ "license": "MIT",+ "dependencies": {+ "accepts": "^2.0.0",+ "body-parser": "^2.2.1",+ "content-disposition": "^1.0.0",+ "content-type": "^1.0.5",+ "cookie": "^0.7.1",+ "cookie-signature": "^1.2.1",+ "debug": "^4.4.0",+ "depd": "^2.0.0",+ "encodeurl": "^2.0.0",+ "escape-html": "^1.0.3",+ "etag": "^1.8.1",+ "finalhandler": "^2.1.0",+ "fresh": "^2.0.0",+ "http-errors": "^2.0.0",+ "merge-descriptors": "^2.0.0",+ "mime-types": "^3.0.0",+ "on-finished": "^2.4.1",+ "once": "^1.4.0",+ "parseurl": "^1.3.3",+ "proxy-addr": "^2.0.7",+ "qs": "^6.14.0",+ "range-parser": "^1.2.1",+ "router": "^2.2.0",+ "send": "^1.1.0",+ "serve-static": "^2.2.0",+ "statuses": "^2.0.1",+ "type-is": "^2.0.1",+ "vary": "^1.1.2"+ },+ "engines": {+ "node": ">= 18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/express-rate-limit": {+ "version": "7.5.1",+ "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-7.5.1.tgz",+ "integrity": "sha512-7iN8iPMDzOMHPUYllBEsQdWVB6fPDMPqwjBaFrgr4Jgr/+okjvzAy+UHlYYL/Vs0OsOrMkwS6PJDkFlJwoxUnw==",+ "license": "MIT",+ "engines": {+ "node": ">= 16"+ },+ "funding": {+ "url": "https://github.com/sponsors/express-rate-limit"+ },+ "peerDependencies": {+ "express": ">= 4.11"+ }+ },+ "node_modules/fast-deep-equal": {+ "version": "3.1.3",+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",+ "license": "MIT"+ },+ "node_modules/fast-uri": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz",+ "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/fastify"+ },+ {+ "type": "opencollective",+ "url": "https://opencollective.com/fastify"+ }+ ],+ "license": "BSD-3-Clause"+ },+ "node_modules/finalhandler": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz",+ "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==",+ "license": "MIT",+ "dependencies": {+ "debug": "^4.4.0",+ "encodeurl": "^2.0.0",+ "escape-html": "^1.0.3",+ "on-finished": "^2.4.1",+ "parseurl": "^1.3.3",+ "statuses": "^2.0.1"+ },+ "engines": {+ "node": ">= 18.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/forwarded": {+ "version": "0.2.0",+ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",+ "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/fresh": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",+ "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/function-bind": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/get-intrinsic": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",+ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",+ "license": "MIT",+ "dependencies": {+ "call-bind-apply-helpers": "^1.0.2",+ "es-define-property": "^1.0.1",+ "es-errors": "^1.3.0",+ "es-object-atoms": "^1.1.1",+ "function-bind": "^1.1.2",+ "get-proto": "^1.0.1",+ "gopd": "^1.2.0",+ "has-symbols": "^1.1.0",+ "hasown": "^2.0.2",+ "math-intrinsics": "^1.1.0"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/get-proto": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",+ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",+ "license": "MIT",+ "dependencies": {+ "dunder-proto": "^1.0.1",+ "es-object-atoms": "^1.0.0"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/gopd": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/has-symbols": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/hasown": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",+ "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",+ "license": "MIT",+ "dependencies": {+ "function-bind": "^1.1.2"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/hono": {+ "version": "4.11.3",+ "resolved": "https://registry.npmjs.org/hono/-/hono-4.11.3.tgz",+ "integrity": "sha512-PmQi306+M/ct/m5s66Hrg+adPnkD5jiO6IjA7WhWw0gSBSo1EcRegwuI1deZ+wd5pzCGynCcn2DprnE4/yEV4w==",+ "license": "MIT",+ "peer": true,+ "engines": {+ "node": ">=16.9.0"+ }+ },+ "node_modules/http-errors": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",+ "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",+ "license": "MIT",+ "dependencies": {+ "depd": "~2.0.0",+ "inherits": "~2.0.4",+ "setprototypeof": "~1.2.0",+ "statuses": "~2.0.2",+ "toidentifier": "~1.0.1"+ },+ "engines": {+ "node": ">= 0.8"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/iconv-lite": {+ "version": "0.7.2",+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz",+ "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==",+ "license": "MIT",+ "dependencies": {+ "safer-buffer": ">= 2.1.2 < 3.0.0"+ },+ "engines": {+ "node": ">=0.10.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/inherits": {+ "version": "2.0.4",+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",+ "license": "ISC"+ },+ "node_modules/ipaddr.js": {+ "version": "1.9.1",+ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",+ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.10"+ }+ },+ "node_modules/is-promise": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",+ "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",+ "license": "MIT"+ },+ "node_modules/isexe": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",+ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",+ "license": "ISC"+ },+ "node_modules/jose": {+ "version": "6.1.3",+ "resolved": "https://registry.npmjs.org/jose/-/jose-6.1.3.tgz",+ "integrity": "sha512-0TpaTfihd4QMNwrz/ob2Bp7X04yuxJkjRGi4aKmOqwhov54i6u79oCv7T+C7lo70MKH6BesI3vscD1yb/yzKXQ==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/panva"+ }+ },+ "node_modules/json-schema-traverse": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",+ "license": "MIT"+ },+ "node_modules/json-schema-typed": {+ "version": "8.0.2",+ "resolved": "https://registry.npmjs.org/json-schema-typed/-/json-schema-typed-8.0.2.tgz",+ "integrity": "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==",+ "license": "BSD-2-Clause"+ },+ "node_modules/make-error": {+ "version": "1.3.6",+ "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",+ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/math-intrinsics": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/media-typer": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz",+ "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/merge-descriptors": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz",+ "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==",+ "license": "MIT",+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/mime-db": {+ "version": "1.54.0",+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",+ "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/mime-types": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz",+ "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==",+ "license": "MIT",+ "dependencies": {+ "mime-db": "^1.54.0"+ },+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/ms": {+ "version": "2.1.3",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",+ "license": "MIT"+ },+ "node_modules/negotiator": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",+ "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/object-assign": {+ "version": "4.1.1",+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/object-inspect": {+ "version": "1.13.4",+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",+ "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/on-finished": {+ "version": "2.4.1",+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",+ "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",+ "license": "MIT",+ "dependencies": {+ "ee-first": "1.1.1"+ },+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/once": {+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",+ "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",+ "license": "ISC",+ "dependencies": {+ "wrappy": "1"+ }+ },+ "node_modules/parseurl": {+ "version": "1.3.3",+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/path-key": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/path-to-regexp": {+ "version": "8.3.0",+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz",+ "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==",+ "license": "MIT",+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/pkce-challenge": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz",+ "integrity": "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==",+ "license": "MIT",+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/proxy-addr": {+ "version": "2.0.7",+ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",+ "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",+ "license": "MIT",+ "dependencies": {+ "forwarded": "0.2.0",+ "ipaddr.js": "1.9.1"+ },+ "engines": {+ "node": ">= 0.10"+ }+ },+ "node_modules/qs": {+ "version": "6.14.1",+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz",+ "integrity": "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==",+ "license": "BSD-3-Clause",+ "dependencies": {+ "side-channel": "^1.1.0"+ },+ "engines": {+ "node": ">=0.6"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/range-parser": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",+ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/raw-body": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz",+ "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==",+ "license": "MIT",+ "dependencies": {+ "bytes": "~3.1.2",+ "http-errors": "~2.0.1",+ "iconv-lite": "~0.7.0",+ "unpipe": "~1.0.0"+ },+ "engines": {+ "node": ">= 0.10"+ }+ },+ "node_modules/require-from-string": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",+ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/router": {+ "version": "2.2.0",+ "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",+ "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",+ "license": "MIT",+ "dependencies": {+ "debug": "^4.4.0",+ "depd": "^2.0.0",+ "is-promise": "^4.0.0",+ "parseurl": "^1.3.3",+ "path-to-regexp": "^8.0.0"+ },+ "engines": {+ "node": ">= 18"+ }+ },+ "node_modules/safer-buffer": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",+ "license": "MIT"+ },+ "node_modules/send": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz",+ "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==",+ "license": "MIT",+ "dependencies": {+ "debug": "^4.4.3",+ "encodeurl": "^2.0.0",+ "escape-html": "^1.0.3",+ "etag": "^1.8.1",+ "fresh": "^2.0.0",+ "http-errors": "^2.0.1",+ "mime-types": "^3.0.2",+ "ms": "^2.1.3",+ "on-finished": "^2.4.1",+ "range-parser": "^1.2.1",+ "statuses": "^2.0.2"+ },+ "engines": {+ "node": ">= 18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/serve-static": {+ "version": "2.2.1",+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz",+ "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==",+ "license": "MIT",+ "dependencies": {+ "encodeurl": "^2.0.0",+ "escape-html": "^1.0.3",+ "parseurl": "^1.3.3",+ "send": "^1.2.0"+ },+ "engines": {+ "node": ">= 18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/setprototypeof": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",+ "license": "ISC"+ },+ "node_modules/shebang-command": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",+ "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",+ "license": "MIT",+ "dependencies": {+ "shebang-regex": "^3.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/shebang-regex": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",+ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/side-channel": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",+ "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0",+ "object-inspect": "^1.13.3",+ "side-channel-list": "^1.0.0",+ "side-channel-map": "^1.0.1",+ "side-channel-weakmap": "^1.0.2"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/side-channel-list": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz",+ "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0",+ "object-inspect": "^1.13.3"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/side-channel-map": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",+ "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",+ "license": "MIT",+ "dependencies": {+ "call-bound": "^1.0.2",+ "es-errors": "^1.3.0",+ "get-intrinsic": "^1.2.5",+ "object-inspect": "^1.13.3"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/side-channel-weakmap": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",+ "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",+ "license": "MIT",+ "dependencies": {+ "call-bound": "^1.0.2",+ "es-errors": "^1.3.0",+ "get-intrinsic": "^1.2.5",+ "object-inspect": "^1.13.3",+ "side-channel-map": "^1.0.1"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/statuses": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",+ "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/toidentifier": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",+ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",+ "license": "MIT",+ "engines": {+ "node": ">=0.6"+ }+ },+ "node_modules/ts-node": {+ "version": "10.9.2",+ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",+ "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@cspotcode/source-map-support": "^0.8.0",+ "@tsconfig/node10": "^1.0.7",+ "@tsconfig/node12": "^1.0.7",+ "@tsconfig/node14": "^1.0.0",+ "@tsconfig/node16": "^1.0.2",+ "acorn": "^8.4.1",+ "acorn-walk": "^8.1.1",+ "arg": "^4.1.0",+ "create-require": "^1.1.0",+ "diff": "^4.0.1",+ "make-error": "^1.1.1",+ "v8-compile-cache-lib": "^3.0.1",+ "yn": "3.1.1"+ },+ "bin": {+ "ts-node": "dist/bin.js",+ "ts-node-cwd": "dist/bin-cwd.js",+ "ts-node-esm": "dist/bin-esm.js",+ "ts-node-script": "dist/bin-script.js",+ "ts-node-transpile-only": "dist/bin-transpile.js",+ "ts-script": "dist/bin-script-deprecated.js"+ },+ "peerDependencies": {+ "@swc/core": ">=1.2.50",+ "@swc/wasm": ">=1.2.50",+ "@types/node": "*",+ "typescript": ">=2.7"+ },+ "peerDependenciesMeta": {+ "@swc/core": {+ "optional": true+ },+ "@swc/wasm": {+ "optional": true+ }+ }+ },+ "node_modules/type-is": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz",+ "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==",+ "license": "MIT",+ "dependencies": {+ "content-type": "^1.0.5",+ "media-typer": "^1.1.0",+ "mime-types": "^3.0.0"+ },+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/typescript": {+ "version": "5.9.3",+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",+ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",+ "dev": true,+ "license": "Apache-2.0",+ "bin": {+ "tsc": "bin/tsc",+ "tsserver": "bin/tsserver"+ },+ "engines": {+ "node": ">=14.17"+ }+ },+ "node_modules/undici-types": {+ "version": "6.21.0",+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",+ "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/unpipe": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",+ "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/v8-compile-cache-lib": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",+ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/vary": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",+ "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/which": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",+ "license": "ISC",+ "dependencies": {+ "isexe": "^2.0.0"+ },+ "bin": {+ "node-which": "bin/node-which"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/wrappy": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",+ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",+ "license": "ISC"+ },+ "node_modules/yn": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",+ "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/zod": {+ "version": "4.3.5",+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.5.tgz",+ "integrity": "sha512-k7Nwx6vuWx1IJ9Bjuf4Zt1PEllcwe7cls3VNzm4CQ1/hgtFUK2bRNG3rvnpPUhFjmqJKAKtjV576KnUkHocg/g==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/colinhacks"+ }+ },+ "node_modules/zod-to-json-schema": {+ "version": "3.25.1",+ "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.1.tgz",+ "integrity": "sha512-pM/SU9d3YAggzi6MtR4h7ruuQlqKtad8e9S0fmxcMi+ueAK5Korys/aWcV9LIIHTVbj01NdzxcnXSN+O74ZIVA==",+ "license": "ISC",+ "peerDependencies": {+ "zod": "^3.25 || ^4"+ }+ }+ }+}diff --git a/toolkits/playwright-coordinator/mcp-server/package.json b/toolkits/playwright-coordinator/mcp-server/package.jsonnew file mode 100644index 0000000..86de588--- /dev/null+++ b/toolkits/playwright-coordinator/mcp-server/package.json@@ -0,0 +1,22 @@+{+ "name": "playwright-coordinator-mcp",+ "version": "1.0.0",+ "description": "MCP server that wraps Playwright with multi-agent coordination",+ "main": "dist/index.js",+ "bin": {+ "playwright-coordinator-mcp": "./dist/index.js"+ },+ "scripts": {+ "build": "tsc",+ "start": "node dist/index.js",+ "dev": "ts-node src/index.ts"+ },+ "dependencies": {+ "@modelcontextprotocol/sdk": "^1.0.0"+ },+ "devDependencies": {+ "@types/node": "^20.0.0",+ "ts-node": "^10.9.0",+ "typescript": "^5.0.0"+ }+}diff --git a/toolkits/playwright-coordinator/mcp-server/src/index.ts b/toolkits/playwright-coordinator/mcp-server/src/index.tsnew file mode 100644index 0000000..99623d7--- /dev/null+++ b/toolkits/playwright-coordinator/mcp-server/src/index.ts@@ -0,0 +1,454 @@+#!/usr/bin/env node+/**+ * Playwright Coordinator MCP Server+ *+ * Provides coordination tools for multi-agent Playwright access.+ * Works with PreToolUse hooks to auto-reserve contexts.+ */++import { Server } from '@modelcontextprotocol/sdk/server/index.js';+import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';+import {+ CallToolRequestSchema,+ ListToolsRequestSchema,+} from '@modelcontextprotocol/sdk/types.js';+import * as fs from 'fs/promises';+import * as path from 'path';++// Path to coordinator state+const COORDINATOR_DIR = path.join(__dirname, '..', '..');+const STATE_FILE = path.join(COORDINATOR_DIR, 'state.json');+const LOCK_FILE = path.join(COORDINATOR_DIR, 'state.lock');+const LOG_FILE = path.join(COORDINATOR_DIR, 'events.log');++// Types (inline to avoid import issues)+interface BrowserContext {+ id: string;+ status: 'available' | 'reserved' | 'shared';+ agentId: string | null;+ reservedAt: string | null;+ purpose: string | null;+ lastActivity: string | null;+}++interface CoordinatorState {+ version: number;+ updatedAt: string;+ config: {+ maxContexts: number;+ reservationTimeoutMs: number;+ };+ contexts: Record<string, BrowserContext>;+ sharedSessions: Record<string, unknown>;+ waitingAgents: Array<{+ agentId: string;+ requestedAt: string;+ purpose: string;+ }>;+}++// ============================================+// File Locking+// ============================================++async function acquireLock(): Promise<boolean> {+ const maxRetries = 50;+ let retries = 0;++ while (retries < maxRetries) {+ try {+ await fs.writeFile(LOCK_FILE, JSON.stringify({+ pid: process.pid,+ timestamp: new Date().toISOString(),+ }), { flag: 'wx' });+ return true;+ } catch (err: unknown) {+ if ((err as NodeJS.ErrnoException).code === 'EEXIST') {+ try {+ const lockData = await fs.readFile(LOCK_FILE, 'utf-8');+ const lock = JSON.parse(lockData);+ const lockAge = Date.now() - new Date(lock.timestamp).getTime();+ if (lockAge > 30000) {+ await fs.unlink(LOCK_FILE);+ continue;+ }+ } catch {+ try { await fs.unlink(LOCK_FILE); } catch { /* ignore */ }+ }+ await new Promise(r => setTimeout(r, 100 + Math.random() * 50));+ retries++;+ } else {+ throw err;+ }+ }+ }+ return false;+}++async function releaseLock(): Promise<void> {+ try { await fs.unlink(LOCK_FILE); } catch { /* ignore */ }+}++// ============================================+// State Management+// ============================================++async function loadState(): Promise<CoordinatorState> {+ try {+ const data = await fs.readFile(STATE_FILE, 'utf-8');+ return JSON.parse(data);+ } catch {+ // Return default state if file doesn't exist+ const defaultState: CoordinatorState = {+ version: 1,+ updatedAt: new Date().toISOString(),+ config: { maxContexts: 6, reservationTimeoutMs: 300000 },+ contexts: {},+ sharedSessions: {},+ waitingAgents: [],+ };+ for (let i = 1; i <= 6; i++) {+ defaultState.contexts[`context_${i}`] = {+ id: `context_${i}`,+ status: 'available',+ agentId: null,+ reservedAt: null,+ purpose: null,+ lastActivity: null,+ };+ }+ return defaultState;+ }+}++async function saveState(state: CoordinatorState): Promise<void> {+ state.updatedAt = new Date().toISOString();+ state.version++;+ await fs.writeFile(STATE_FILE, JSON.stringify(state, null, 2));+}++async function logEvent(event: unknown): Promise<void> {+ const entry = { timestamp: new Date().toISOString(), event };+ await fs.appendFile(LOG_FILE, JSON.stringify(entry) + '\n');+}++// ============================================+// Coordination Functions+// ============================================++async function reserveContext(agentId: string, purpose: string) {+ const locked = await acquireLock();+ if (!locked) return { success: false, error: 'Could not acquire lock' };++ try {+ const state = await loadState();++ // Check if agent already has context+ const existing = Object.values(state.contexts).find(+ c => c.agentId === agentId && c.status !== 'available'+ );+ if (existing) {+ existing.lastActivity = new Date().toISOString();+ await saveState(state);+ return { success: true, contextId: existing.id, alreadyHeld: true };+ }++ // Find available+ const available = Object.values(state.contexts).find(c => c.status === 'available');+ if (!available) {+ // Queue+ if (!state.waitingAgents.some(w => w.agentId === agentId)) {+ state.waitingAgents.push({ agentId, requestedAt: new Date().toISOString(), purpose });+ await saveState(state);+ }+ const pos = state.waitingAgents.findIndex(w => w.agentId === agentId) + 1;+ return { success: false, error: 'No contexts available', waitPosition: pos };+ }++ // Reserve+ available.status = 'reserved';+ available.agentId = agentId;+ available.reservedAt = new Date().toISOString();+ available.purpose = purpose;+ available.lastActivity = new Date().toISOString();+ state.waitingAgents = state.waitingAgents.filter(w => w.agentId !== agentId);+ await saveState(state);+ await logEvent({ type: 'reserved', agentId, contextId: available.id, purpose });++ return { success: true, contextId: available.id };+ } finally {+ await releaseLock();+ }+}++async function releaseContext(agentId: string) {+ const locked = await acquireLock();+ if (!locked) return { success: false, error: 'Could not acquire lock' };++ try {+ const state = await loadState();+ const context = Object.values(state.contexts).find(c => c.agentId === agentId);++ if (!context) {+ return { success: false, error: 'No context found for agent' };+ }++ const contextId = context.id;+ context.status = 'available';+ context.agentId = null;+ context.reservedAt = null;+ context.purpose = null;+ context.lastActivity = null;++ await saveState(state);+ await logEvent({ type: 'released', agentId, contextId });++ return { success: true, contextId };+ } finally {+ await releaseLock();+ }+}++async function heartbeat(agentId: string) {+ const locked = await acquireLock();+ if (!locked) return false;++ try {+ const state = await loadState();+ const context = Object.values(state.contexts).find(c => c.agentId === agentId);+ if (context) {+ context.lastActivity = new Date().toISOString();+ await saveState(state);+ return true;+ }+ return false;+ } finally {+ await releaseLock();+ }+}++async function getPoolStatus() {+ const state = await loadState();+ const contexts = Object.values(state.contexts);+ return {+ available: contexts.filter(c => c.status === 'available').length,+ reserved: contexts.filter(c => c.status === 'reserved').length,+ shared: contexts.filter(c => c.status === 'shared').length,+ waiting: state.waitingAgents.length,+ contexts: contexts.map(c => ({+ id: c.id,+ status: c.status,+ agentId: c.agentId,+ purpose: c.purpose,+ lastActivity: c.lastActivity,+ })),+ waitingAgents: state.waitingAgents,+ };+}++async function forceCleanup(agentId: string) {+ const locked = await acquireLock();+ if (!locked) return { released: 0 };++ try {+ const state = await loadState();+ let released = 0;++ for (const context of Object.values(state.contexts)) {+ if (context.agentId === agentId) {+ context.status = 'available';+ context.agentId = null;+ context.reservedAt = null;+ context.purpose = null;+ context.lastActivity = null;+ released++;+ }+ }++ state.waitingAgents = state.waitingAgents.filter(w => w.agentId !== agentId);+ await saveState(state);++ return { released };+ } finally {+ await releaseLock();+ }+}++// ============================================+// MCP Server+// ============================================++const server = new Server(+ {+ name: 'playwright-coordinator',+ version: '1.0.0',+ },+ {+ capabilities: {+ tools: {},+ },+ }+);++// List available tools+server.setRequestHandler(ListToolsRequestSchema, async () => {+ return {+ tools: [+ {+ name: 'playwright_reserve',+ description: 'Reserve a browser context for Playwright use. Call this before using any Playwright tools.',+ inputSchema: {+ type: 'object',+ properties: {+ agent_id: {+ type: 'string',+ description: 'Unique identifier for this agent/session',+ },+ purpose: {+ type: 'string',+ description: 'Brief description of what you will use Playwright for',+ },+ },+ required: ['agent_id', 'purpose'],+ },+ },+ {+ name: 'playwright_release',+ description: 'Release your browser context back to the pool. Call this when done with Playwright.',+ inputSchema: {+ type: 'object',+ properties: {+ agent_id: {+ type: 'string',+ description: 'Your agent/session identifier',+ },+ },+ required: ['agent_id'],+ },+ },+ {+ name: 'playwright_heartbeat',+ description: 'Send a heartbeat to indicate you are still using Playwright. Call during long operations.',+ inputSchema: {+ type: 'object',+ properties: {+ agent_id: {+ type: 'string',+ description: 'Your agent/session identifier',+ },+ },+ required: ['agent_id'],+ },+ },+ {+ name: 'playwright_pool_status',+ description: 'Check the current status of the Playwright browser pool.',+ inputSchema: {+ type: 'object',+ properties: {},+ },+ },+ {+ name: 'playwright_force_cleanup',+ description: 'Force release all contexts held by an agent (emergency cleanup).',+ inputSchema: {+ type: 'object',+ properties: {+ agent_id: {+ type: 'string',+ description: 'Agent ID to clean up',+ },+ },+ required: ['agent_id'],+ },+ },+ ],+ };+});++// Handle tool calls+server.setRequestHandler(CallToolRequestSchema, async (request) => {+ const { name, arguments: args } = request.params;++ try {+ switch (name) {+ case 'playwright_reserve': {+ const { agent_id, purpose } = args as { agent_id: string; purpose: string };+ const result = await reserveContext(agent_id, purpose);+ return {+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],+ };+ }++ case 'playwright_release': {+ const { agent_id } = args as { agent_id: string };+ const result = await releaseContext(agent_id);+ return {+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],+ };+ }++ case 'playwright_heartbeat': {+ const { agent_id } = args as { agent_id: string };+ const success = await heartbeat(agent_id);+ return {+ content: [{ type: 'text', text: success ? 'Heartbeat OK' : 'No context found' }],+ };+ }++ case 'playwright_pool_status': {+ const status = await getPoolStatus();+ const lines = [+ '=== Playwright Pool Status ===',+ `Available: ${status.available}`,+ `Reserved: ${status.reserved}`,+ `Shared: ${status.shared}`,+ `Waiting: ${status.waiting}`,+ '',+ '--- Contexts ---',+ ...status.contexts.map(c => {+ const icon = c.status === 'available' ? 'π’' : c.status === 'reserved' ? 'π‘' : 'π΅';+ return `${icon} ${c.id}: ${c.status}${c.agentId ? ` (${c.agentId})` : ''}${c.purpose ? ` - ${c.purpose}` : ''}`;+ }),+ ];+ if (status.waitingAgents.length > 0) {+ lines.push('', '--- Waiting ---');+ status.waitingAgents.forEach((w, i) => {+ lines.push(`${i + 1}. ${w.agentId} - ${w.purpose}`);+ });+ }+ return {+ content: [{ type: 'text', text: lines.join('\n') }],+ };+ }++ case 'playwright_force_cleanup': {+ const { agent_id } = args as { agent_id: string };+ const result = await forceCleanup(agent_id);+ return {+ content: [{ type: 'text', text: `Released ${result.released} context(s)` }],+ };+ }++ default:+ return {+ content: [{ type: 'text', text: `Unknown tool: ${name}` }],+ isError: true,+ };+ }+ } catch (error) {+ return {+ content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : error}` }],+ isError: true,+ };+ }+});++// Start server+async function main() {+ const transport = new StdioServerTransport();+ await server.connect(transport);+ console.error('Playwright Coordinator MCP server running');+}++main().catch(console.error);diff --git a/toolkits/playwright-coordinator/mcp-server/tsconfig.json b/toolkits/playwright-coordinator/mcp-server/tsconfig.jsonnew file mode 100644index 0000000..19bd5bc--- /dev/null+++ b/toolkits/playwright-coordinator/mcp-server/tsconfig.json@@ -0,0 +1,15 @@+{+ "compilerOptions": {+ "target": "ES2022",+ "module": "CommonJS",+ "moduleResolution": "Node",+ "esModuleInterop": true,+ "strict": true,+ "skipLibCheck": true,+ "outDir": "./dist",+ "rootDir": "./src",+ "declaration": true+ },+ "include": ["src/**/*.ts"],+ "exclude": ["node_modules", "dist"]+}diff --git a/toolkits/playwright-coordinator/package-lock.json b/toolkits/playwright-coordinator/package-lock.jsonnew file mode 100644index 0000000..5f94df5--- /dev/null+++ b/toolkits/playwright-coordinator/package-lock.json@@ -0,0 +1,235 @@+{+ "name": "playwright-coordinator",+ "version": "1.0.0",+ "lockfileVersion": 3,+ "requires": true,+ "packages": {+ "": {+ "name": "playwright-coordinator",+ "version": "1.0.0",+ "devDependencies": {+ "@types/node": "^20.0.0",+ "ts-node": "^10.9.0",+ "typescript": "^5.0.0"+ }+ },+ "node_modules/@cspotcode/source-map-support": {+ "version": "0.8.1",+ "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",+ "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@jridgewell/trace-mapping": "0.3.9"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@jridgewell/resolve-uri": {+ "version": "3.1.2",+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6.0.0"+ }+ },+ "node_modules/@jridgewell/sourcemap-codec": {+ "version": "1.5.5",+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",+ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@jridgewell/trace-mapping": {+ "version": "0.3.9",+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",+ "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@jridgewell/resolve-uri": "^3.0.3",+ "@jridgewell/sourcemap-codec": "^1.4.10"+ }+ },+ "node_modules/@tsconfig/node10": {+ "version": "1.0.12",+ "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.12.tgz",+ "integrity": "sha512-UCYBaeFvM11aU2y3YPZ//O5Rhj+xKyzy7mvcIoAjASbigy8mHMryP5cK7dgjlz2hWxh1g5pLw084E0a/wlUSFQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@tsconfig/node12": {+ "version": "1.0.11",+ "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",+ "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@tsconfig/node14": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",+ "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@tsconfig/node16": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",+ "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@types/node": {+ "version": "20.19.27",+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.27.tgz",+ "integrity": "sha512-N2clP5pJhB2YnZJ3PIHFk5RkygRX5WO/5f0WC08tp0wd+sv0rsJk3MqWn3CbNmT2J505a5336jaQj4ph1AdMug==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "undici-types": "~6.21.0"+ }+ },+ "node_modules/acorn": {+ "version": "8.15.0",+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",+ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",+ "dev": true,+ "license": "MIT",+ "bin": {+ "acorn": "bin/acorn"+ },+ "engines": {+ "node": ">=0.4.0"+ }+ },+ "node_modules/acorn-walk": {+ "version": "8.3.4",+ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz",+ "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "acorn": "^8.11.0"+ },+ "engines": {+ "node": ">=0.4.0"+ }+ },+ "node_modules/arg": {+ "version": "4.1.3",+ "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",+ "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/create-require": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",+ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/diff": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",+ "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",+ "dev": true,+ "license": "BSD-3-Clause",+ "engines": {+ "node": ">=0.3.1"+ }+ },+ "node_modules/make-error": {+ "version": "1.3.6",+ "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",+ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/ts-node": {+ "version": "10.9.2",+ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",+ "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@cspotcode/source-map-support": "^0.8.0",+ "@tsconfig/node10": "^1.0.7",+ "@tsconfig/node12": "^1.0.7",+ "@tsconfig/node14": "^1.0.0",+ "@tsconfig/node16": "^1.0.2",+ "acorn": "^8.4.1",+ "acorn-walk": "^8.1.1",+ "arg": "^4.1.0",+ "create-require": "^1.1.0",+ "diff": "^4.0.1",+ "make-error": "^1.1.1",+ "v8-compile-cache-lib": "^3.0.1",+ "yn": "3.1.1"+ },+ "bin": {+ "ts-node": "dist/bin.js",+ "ts-node-cwd": "dist/bin-cwd.js",+ "ts-node-esm": "dist/bin-esm.js",+ "ts-node-script": "dist/bin-script.js",+ "ts-node-transpile-only": "dist/bin-transpile.js",+ "ts-script": "dist/bin-script-deprecated.js"+ },+ "peerDependencies": {+ "@swc/core": ">=1.2.50",+ "@swc/wasm": ">=1.2.50",+ "@types/node": "*",+ "typescript": ">=2.7"+ },+ "peerDependenciesMeta": {+ "@swc/core": {+ "optional": true+ },+ "@swc/wasm": {+ "optional": true+ }+ }+ },+ "node_modules/typescript": {+ "version": "5.9.3",+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",+ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",+ "dev": true,+ "license": "Apache-2.0",+ "bin": {+ "tsc": "bin/tsc",+ "tsserver": "bin/tsserver"+ },+ "engines": {+ "node": ">=14.17"+ }+ },+ "node_modules/undici-types": {+ "version": "6.21.0",+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",+ "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/v8-compile-cache-lib": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",+ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/yn": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",+ "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ }+ }+}diff --git a/toolkits/playwright-coordinator/package.json b/toolkits/playwright-coordinator/package.jsonnew file mode 100644index 0000000..abb28b6--- /dev/null+++ b/toolkits/playwright-coordinator/package.json@@ -0,0 +1,17 @@+{+ "name": "playwright-coordinator",+ "version": "1.0.0",+ "description": "Multi-agent browser context coordination for Playwright",+ "main": "coordinator.js",+ "scripts": {+ "build": "tsc",+ "cli": "npx ts-node cli.ts",+ "status": "npx ts-node cli.ts status",+ "test": "npx ts-node test-scenario.ts"+ },+ "devDependencies": {+ "@types/node": "^20.0.0",+ "ts-node": "^10.9.0",+ "typescript": "^5.0.0"+ }+}diff --git a/toolkits/playwright-coordinator/test-scenario.ts b/toolkits/playwright-coordinator/test-scenario.tsnew file mode 100644index 0000000..13209a2--- /dev/null+++ b/toolkits/playwright-coordinator/test-scenario.ts@@ -0,0 +1,106 @@+/**+ * Test Scenario: Multi-Agent Browser Coordination+ *+ * Simulates 6 agents competing for browser contexts.+ */++import {+ reserveContext,+ releaseContext,+ shareContext,+ canUseContext,+ getStatus,+ heartbeat,+ forceReleaseAll,+} from './coordinator';++async function sleep(ms: number) {+ return new Promise(resolve => setTimeout(resolve, ms));+}++async function runTest() {+ console.log('=== Playwright Coordinator Test Scenario ===\n');++ // Clean slate+ console.log('1. Cleaning up any existing state...');+ for (let i = 1; i <= 6; i++) {+ await forceReleaseAll(`test-agent-${i}`);+ }++ let status = await getStatus();+ console.log(` Available: ${status.available}\n`);++ // Test: Multiple agents reserving+ console.log('2. Six agents try to reserve contexts...');+ const agents = ['alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta'];+ const reservations = [];++ for (const agent of agents) {+ const result = await reserveContext(`agent-${agent}`, `Testing by ${agent}`);+ reservations.push({ agent, result });+ console.log(` agent-${agent}: ${result.success ? `Got ${result.contextId}` : result.error}`);+ }++ status = await getStatus();+ console.log(`\n Pool status: ${status.available} available, ${status.reserved} reserved\n`);++ // Test: 7th agent tries to reserve (should queue)+ console.log('3. Seventh agent tries to reserve (pool full)...');+ const overflow = await reserveContext('agent-overflow', 'Should queue');+ console.log(` Result: ${overflow.success ? 'Got context' : `Queued at position ${overflow.waitPosition}`}\n`);++ // Test: Heartbeat+ console.log('4. Agent alpha sends heartbeat...');+ const hbResult = await heartbeat('agent-alpha');+ console.log(` Heartbeat: ${hbResult ? 'OK' : 'Failed'}\n`);++ // Test: Sharing+ console.log('5. Agent alpha shares context with agent overflow...');+ const shareResult = await shareContext('agent-alpha', 'agent-overflow', 60000);+ console.log(` Share: ${shareResult.success ? `Session ${shareResult.sessionId}` : shareResult.error}`);++ const overflowCheck = await canUseContext('agent-overflow');+ console.log(` Overflow can now use: ${overflowCheck.canUse} (shared: ${overflowCheck.isShared})\n`);++ // Test: Release+ console.log('6. Releasing contexts...');+ for (const agent of agents.slice(0, 3)) {+ const result = await releaseContext(`agent-${agent}`);+ console.log(` agent-${agent}: ${result.success ? 'Released' : result.error}`);+ }++ status = await getStatus();+ console.log(`\n Pool status: ${status.available} available, ${status.reserved} reserved\n`);++ // Test: Overflow agent can now reserve their own+ console.log('7. Overflow agent now reserves own context...');+ const overflowReserve = await reserveContext('agent-overflow', 'Finally got my own');+ console.log(` Result: ${overflowReserve.success ? `Got ${overflowReserve.contextId}` : overflowReserve.error}\n`);++ // Final status+ console.log('8. Final pool status:');+ status = await getStatus();+ console.log(` Available: ${status.available}`);+ console.log(` Reserved: ${status.reserved}`);+ console.log(` Shared: ${status.shared}`);+ console.log(` Waiting: ${status.waiting}`);++ console.log('\n Contexts:');+ for (const ctx of status.contexts) {+ const icon = ctx.status === 'available' ? 'π’' : ctx.status === 'reserved' ? 'π‘' : 'π΅';+ console.log(` ${icon} ${ctx.id}: ${ctx.status}${ctx.agentId ? ` (${ctx.agentId})` : ''}`);+ }++ // Cleanup+ console.log('\n9. Cleaning up...');+ for (const agent of [...agents, 'overflow']) {+ await forceReleaseAll(`agent-${agent}`);+ }++ status = await getStatus();+ console.log(` All cleaned: ${status.available} available\n`);++ console.log('=== Test Complete ===');+}++runTest().catch(console.error);diff --git a/toolkits/playwright-coordinator/tsconfig.json b/toolkits/playwright-coordinator/tsconfig.jsonnew file mode 100644index 0000000..0f06478--- /dev/null+++ b/toolkits/playwright-coordinator/tsconfig.json@@ -0,0 +1,20 @@+{+ "compilerOptions": {+ "target": "ES2022",+ "module": "CommonJS",+ "moduleResolution": "Node",+ "esModuleInterop": true,+ "strict": true,+ "skipLibCheck": true,+ "outDir": "./dist",+ "rootDir": ".",+ "declaration": true+ },+ "ts-node": {+ "compilerOptions": {+ "module": "CommonJS"+ }+ },+ "include": ["*.ts"],+ "exclude": ["node_modules", "dist"]+}diff --git a/toolkits/playwright-coordinator/types.ts b/toolkits/playwright-coordinator/types.tsnew file mode 100644index 0000000..6afa861--- /dev/null+++ b/toolkits/playwright-coordinator/types.ts@@ -0,0 +1,85 @@+/**+ * Playwright Agent Coordination System - Types+ *+ * Enables multiple Claude agents to share browser resources+ * without conflicts or race conditions.+ */++export type ContextStatus = 'available' | 'reserved' | 'shared';++export interface BrowserContext {+ id: string;+ status: ContextStatus;+ agentId: string | null;+ reservedAt: string | null;+ purpose: string | null;+ lastActivity: string | null;+}++export interface SharedSession {+ sessionId: string;+ contextId: string;+ ownerAgentId: string;+ allowedAgentIds: string[];+ createdAt: string;+ expiresAt: string | null;+}++export interface CoordinatorConfig {+ maxContexts: number;+ reservationTimeoutMs: number;+ cleanupIntervalMs: number;+ lockTimeoutMs: number;+ lockRetryDelayMs: number;+ maxLockRetries: number;+}++export interface CoordinatorState {+ version: number;+ updatedAt: string;+ config: CoordinatorConfig;+ contexts: Record<string, BrowserContext>;+ sharedSessions: Record<string, SharedSession>;+ waitingAgents: WaitingAgent[];+}++export interface WaitingAgent {+ agentId: string;+ requestedAt: string;+ purpose: string;+ priority: 'normal' | 'high';+}++export interface ReservationResult {+ success: boolean;+ contextId?: string;+ error?: string;+ waitPosition?: number;+ estimatedWaitMs?: number;+}++export interface ReleaseResult {+ success: boolean;+ contextId?: string;+ error?: string;+}++export interface ShareResult {+ success: boolean;+ sessionId?: string;+ error?: string;+}++// Events for coordination logging+export type CoordinatorEvent =+ | { type: 'reserved'; agentId: string; contextId: string; purpose: string }+ | { type: 'released'; agentId: string; contextId: string }+ | { type: 'shared'; ownerAgentId: string; targetAgentId: string; sessionId: string }+ | { type: 'timeout'; agentId: string; contextId: string }+ | { type: 'cleanup'; staleContexts: string[] }+ | { type: 'error'; agentId: string; message: string };++export interface EventLog {+ timestamp: string;+ event: CoordinatorEvent;+}