{
  "$schema": "https://weavetab.dev/schema/plugin.json",
  "name": "wt-choas",
  "displayName": "Chaos",
  "version": "1.3.0",
  "description": "Browser chaos engineering and fault injection plugin for Weavetab by fy2ne. CDP network throttling, CPU slowdown, API fault mocking, DOM boundary fuzzing, and automated crash telemetry.",
  "entry": "dist/index.js",
  "agentsMd": "AGENTS.md",
  "engines": {
    "weavetab": "^2.6.2",
    "node": ">=18.0.0"
  },
  "environments": [
    "mcp"
  ],
  "authors": [
    {
      "name": "fy2ne",
      "role": "Author",
      "url": "https://fy2ne.me"
    }
  ],
  "license": "MIT",
  "tags": [
    "Chaos",
    "CDP",
    "Network",
    "Fuzzing",
    "Testing",
    "Community"
  ],
  "links": {
    "github": "https://github.com/fy2ne/chaos",
    "npm": "https://www.npmjs.com/package/wt-choas"
  },
  "defaultConfig": {
    "autoListen": true,
    "maxLogEntries": 100
  },
  "permissions": {
    "cdp": {
      "evaluate": true,
      "network": true,
      "reason": "Emulates network conditions, throttles CPU rate, intercepts requests via Fetch, and injects boundary payloads into DOM elements."
    },
    "tools": {
      "add": true,
      "reason": "Registers the chaos_inject, chaos_fuzz, and chaos_report MCP tools."
    },
    "commands": {
      "add": true,
      "reason": "Registers the presets and payloads CLI commands for inspecting chaos profiles and fuzzing vectors."
    },
    "prompts": {
      "add": true,
      "reason": "Registers the /chaos-audit workflow prompt utility."
    },
    "resources": {
      "add": true,
      "reason": "Registers the @chaos://presets resource utility."
    }
  },
  "tools": [
    {
      "name": "chaos_inject",
      "description": "Runtime environmental fault injection over CDP. Emulates network throttling (offline/slow_3g/fast_3g/custom latency), CPU execution throttling (4x/6x slowdown), and API fault mocking (status codes, connection failures, artificial delays, custom responses via CDP Fetch).",
      "inputSchema": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "enum": ["apply", "reset"],
            "description": "Whether to apply faults or reset environmental conditions back to normal (default: 'apply')."
          },
          "network_profile": {
            "type": "string",
            "enum": ["offline", "slow_3g", "fast_3g", "custom", "reset"],
            "description": "Pre-configured network degradation profile or 'reset' to restore unthrottled network."
          },
          "latency_ms": {
            "type": "number",
            "description": "Additional latency in milliseconds for custom network profile (e.g. 500)."
          },
          "download_kbps": {
            "type": "number",
            "description": "Max download throughput in kbps for custom network profile (e.g. 250)."
          },
          "upload_kbps": {
            "type": "number",
            "description": "Max upload throughput in kbps for custom network profile (e.g. 100)."
          },
          "cpu_throttle_rate": {
            "type": "number",
            "description": "CPU throttling multiplier (e.g. 1 for normal, 4 for 4x slowdown, 6 for 6x slowdown)."
          },
          "mock_api": {
            "type": "object",
            "properties": {
              "url_pattern": {
                "type": "string",
                "description": "URL glob pattern to intercept (e.g. '*api/checkout*' or '*user*')."
              },
              "status_code": {
                "type": "number",
                "description": "HTTP status code to return (e.g. 500, 502, 503, 429)."
              },
              "response_body": {
                "type": "string",
                "description": "Mocked JSON or text payload to return in response body."
              },
              "fail_reason": {
                "type": "string",
                "enum": ["Failed", "Aborted", "TimedOut", "ConnectionReset"],
                "description": "Connection-level failure reason instead of HTTP status."
              },
              "delay_ms": {
                "type": "number",
                "description": "Simulated response latency/delay in milliseconds before mock responds."
              }
            },
            "description": "CDP Fetch API fault interception rules."
          }
        }
      }
    },
    {
      "name": "chaos_fuzz",
      "description": "Autonomous boundary testing and race-condition generator on forms and buttons. Executes rapid multi-clicks to trigger race conditions and injects boundary payloads (oversized, unicode edge, numeric bounds, injection probes) into DOM and Shadow DOM inputs.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": ["race_click", "boundary_forms", "all"],
            "description": "Fuzzing mode: 'race_click' fires rapid concurrent clicks, 'boundary_forms' injects edge-case values, 'all' runs both."
          },
          "selector": {
            "type": "string",
            "description": "Target CSS selector (e.g. 'button.submit', 'form#signup', or 'input'). Defaults to form or button inside body."
          },
          "burst_count": {
            "type": "number",
            "description": "Number of rapid consecutive clicks to dispatch for race-condition testing (default: 20)."
          },
          "payload_type": {
            "type": "string",
            "enum": ["all", "oversized", "unicode_edge", "numeric_bounds", "injection_probe"],
            "description": "Type of boundary value payload to inject into inputs (default: 'all')."
          },
          "auto_submit": {
            "type": "boolean",
            "description": "Whether to automatically trigger submit button click or form submission after injecting boundary inputs."
          },
          "shadow_dom": {
            "type": "boolean",
            "description": "Whether to recursively traverse and fuzz Shadow DOM elements (default: true)."
          },
          "key_events": {
            "type": "boolean",
            "description": "Whether to fire synthetic keyboard events (Enter/Tab) during clicks and input mutations."
          }
        }
      }
    },
    {
      "name": "chaos_report",
      "description": "Captures CDP Runtime exceptions, network error codes (>= 400), and failed requests to generate structured Markdown or JSON bug reports with exact reproduction steps.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "enum": ["report", "start", "clear"],
            "description": "Operation: 'report' outputs bug report, 'start' attaches error listeners to current tab, 'clear' resets captured events."
          },
          "format": {
            "type": "string",
            "enum": ["markdown", "json"],
            "description": "Output format: 'markdown' (default) or machine-readable 'json'."
          }
        }
      }
    }
  ],
  "commands": [
    {
      "name": "presets",
      "description": "Print built-in network and API chaos profiles with ready-to-run tool payloads.",
      "usage": "weavetab plugin use wt-choas presets",
      "examples": [
        "weavetab plugin use wt-choas presets"
      ],
      "options": []
    },
    {
      "name": "payloads",
      "description": "List boundary fuzzing test vectors by category.",
      "usage": "weavetab plugin use wt-choas payloads [--category <name>]",
      "examples": [
        "weavetab plugin use wt-choas payloads",
        "weavetab plugin use wt-choas payloads --category numeric_bounds"
      ],
      "options": [
        {
          "name": "category",
          "type": "string",
          "description": "Payload category filter (all, oversized, unicode_edge, numeric_bounds, injection_probe)",
          "required": false
        }
      ]
    },
    {
      "name": "fuzz-run",
      "description": "Execute autonomous boundary fuzzing against target CSS selector directly via CLI.",
      "usage": "weavetab plugin use wt-choas fuzz-run --selector <css>",
      "examples": [
        "weavetab plugin use wt-choas fuzz-run --selector \"#login-form\""
      ],
      "options": [
        {
          "name": "selector",
          "type": "string",
          "description": "Target CSS selector for inputs or buttons",
          "required": true
        },
        {
          "name": "payload_type",
          "type": "string",
          "description": "Payload category filter",
          "required": false
        }
      ]
    }
  ],
  "prompts": [
    {
      "name": "chaos-audit",
      "description": "Multi-step resilience audit workflow for forms, buttons, and API endpoints.",
      "arguments": [
        {
          "name": "selector",
          "description": "Primary form or submit button CSS selector",
          "required": false
        }
      ]
    },
    {
      "name": "api-stress",
      "description": "Simulate API failures (502, 429, timeouts) and inspect page recovery.",
      "arguments": [
        {
          "name": "pattern",
          "description": "API endpoint URL glob pattern to mock",
          "required": true
        },
        {
          "name": "status",
          "description": "HTTP status code to simulate (e.g. 502, 429)",
          "required": false
        }
      ]
    }
  ],
  "resources": [
    {
      "uri": "chaos://presets",
      "name": "Chaos Fault Presets",
      "description": "Standard network throttling profiles and API failure templates.",
      "mimeType": "application/json"
    },
    {
      "uri": "chaos://report",
      "name": "chaos-report",
      "description": "Live summary of recent CDP Runtime exceptions, network error codes, and chaos steps.",
      "mimeType": "application/json"
    }
  ]
}
