{
  "$schema": "https://farmslot.io/schemas/action-manifest-v1.schema.json",
  "actions": {
    "command": {
      "description": "Run a shell command from the project root.",
      "examples": [
        {
          "action": "command",
          "cmd": "pwd",
          "intent": "Prepare the project state needed for this proof.",
          "next": "done"
        }
      ],
      "schema": {
        "type": "object",
        "properties": {
          "cmd": {
            "type": "string"
          },
          "command": {
            "type": "string"
          },
          "cwd": {
            "type": "string"
          },
          "timeout_ms": {
            "type": "number"
          },
          "allow_failure": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      }
    },
    "wait": {
      "description": "Base wait action.",
      "examples": [
        {
          "action": "wait",
          "duration_ms": 1,
          "intent": "Allow the requested asynchronous state to settle.",
          "next": "done"
        }
      ],
      "schema": {
        "type": "object",
        "properties": {
          "duration_ms": {
            "type": "integer"
          },
          "ms": {
            "type": "integer"
          }
        },
        "additionalProperties": false
      }
    },
    "assert_file": {
      "description": "Assert that a project file exists and optionally contains text.",
      "examples": [
        {
          "action": "assert_file",
          "path": "reports/result.txt",
          "contains": "ok",
          "intent": "Confirm the requested project file state.",
          "next": "done"
        }
      ],
      "schema": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "contains": {
            "type": "string"
          }
        },
        "required": [
          "path"
        ],
        "additionalProperties": false
      }
    },
    "assert_json": {
      "description": "Assert a JSON file value with a JSONPath-style selector.",
      "examples": [
        {
          "action": "assert_json",
          "path": "reports/result.json",
          "assert": {
            "path": "$.status",
            "operator": "eq",
            "value": "ok"
          },
          "intent": "Confirm the recorded data satisfies the requested condition.",
          "next": "done"
        }
      ],
      "schema": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "assert": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string"
              },
              "operator": {
                "type": "string"
              },
              "value": {
                "type": [
                  "string",
                  "number",
                  "integer",
                  "boolean",
                  "object",
                  "array"
                ],
                "items": {
                  "type": [
                    "string",
                    "number",
                    "integer",
                    "boolean",
                    "object"
                  ]
                }
              },
              "all": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              },
              "any": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              },
              "none": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            },
            "additionalProperties": false
          }
        },
        "required": [
          "path",
          "assert"
        ],
        "additionalProperties": false
      }
    },
    "assert_exit_code": {
      "description": "Assert the exit code captured from a command node output.",
      "examples": [
        {
          "action": "assert_exit_code",
          "source": "run-tests",
          "expected": 0,
          "intent": "Confirm the project command completed with the expected result.",
          "next": "done"
        }
      ],
      "schema": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string"
          },
          "node": {
            "type": "string"
          },
          "expected": {
            "type": "number"
          }
        },
        "additionalProperties": false
      }
    },
    "assert_output": {
      "description": "Assert stdout or stderr captured from a command node output.",
      "examples": [
        {
          "action": "assert_output",
          "source": "run-tests",
          "stream": "stdout",
          "contains": "PASS",
          "intent": "Confirm the recorded output satisfies the requested condition.",
          "next": "done"
        }
      ],
      "schema": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string"
          },
          "node": {
            "type": "string"
          },
          "stream": {
            "type": "string"
          },
          "contains": {
            "type": "string"
          },
          "match": {
            "type": "string"
          },
          "assert": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string"
              },
              "operator": {
                "type": "string"
              },
              "value": {
                "type": [
                  "string",
                  "number",
                  "integer",
                  "boolean",
                  "object",
                  "array"
                ],
                "items": {
                  "type": [
                    "string",
                    "number",
                    "integer",
                    "boolean",
                    "object"
                  ]
                }
              },
              "all": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              },
              "any": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              },
              "none": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      }
    },
    "watch_logs": {
      "description": "Base log assertion/capture action.",
      "examples": [
        {
          "action": "watch_logs",
          "path": "logs/app.log",
          "intent": "Observe the runtime behavior needed for this proof.",
          "next": "done"
        }
      ],
      "schema": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "contains": {
            "type": "string"
          },
          "scope": {
            "type": "string",
            "enum": [
              "run",
              "file"
            ]
          }
        },
        "required": [
          "path"
        ],
        "additionalProperties": false
      }
    },
    "index_artifacts": {
      "description": "Index extra recipe-authored artifacts that already exist on disk.",
      "examples": [
        {
          "action": "index_artifacts",
          "artifacts": [
            {
              "path": "reports/result.json",
              "type": "report",
              "category": "validation",
              "label": "Validation report"
            }
          ],
          "intent": "Preserve generated evidence in the review package.",
          "next": "done"
        }
      ],
      "schema": {
        "type": "object",
        "properties": {
          "artifacts": {
            "type": "array",
            "items": {
              "type": [
                "string",
                "object"
              ],
              "properties": {
                "path": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "nodeId": {
                  "type": "string"
                },
                "mimeType": {
                  "type": "string"
                },
                "category": {
                  "type": "string"
                },
                "proofTarget": {
                  "type": "string"
                },
                "covers": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "additionalProperties": false
            }
          }
        },
        "required": [
          "artifacts"
        ],
        "additionalProperties": false
      }
    },
    "end": {
      "description": "Base terminal action.",
      "examples": [
        {
          "action": "end",
          "status": "pass"
        }
      ]
    },
    "call": {
      "description": "Invoke a named recipe by ref and run its steps inline.",
      "examples": [
        {
          "action": "call",
          "ref": "shared/setup",
          "intent": "Run a shared recipe",
          "next": "done"
        }
      ]
    },
    "switch": {
      "description": "Choose a graph branch when one resolved string equals another.",
      "examples": [
        {
          "action": "switch",
          "value": "{{params.mode}}",
          "equals": "background_resume",
          "cases": {
            "match": "background"
          },
          "default": "warm",
          "intent": "Choose the graph path matching the observed state."
        }
      ],
      "schema": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string"
          },
          "equals": {
            "type": "string"
          }
        },
        "required": [
          "value",
          "equals"
        ],
        "additionalProperties": false
      },
      "result_cases": [
        "match"
      ]
    },
    "app.status": {
      "description": "Report the core checkout shape and headless compatibility mode for the perps controller.",
      "examples": [
        {
          "action": "app.status",
          "intent": "Record the resolved application state before continuing.",
          "next": "done"
        }
      ],
      "schema": {
        "type": "object",
        "properties": {},
        "additionalProperties": false
      }
    },
    "metamask.wallet.list_accounts": {
      "description": "List redacted headless fixture accounts available to Core controller actions.",
      "schema": {
        "type": "object",
        "properties": {
          "scope": {
            "type": "string",
            "default": "named",
            "enum": [
              "selected",
              "named",
              "evm",
              "all"
            ],
            "description": "Account scope. Core fixtures are EVM-only today; selected filters to the explicit controller account input."
          },
          "account": {
            "type": "string",
            "default": "dev1",
            "description": "Optional account name to mark as selected for the next controller operation; defaults to dev1."
          },
          "account_name": {
            "type": "string",
            "description": "Alias for account."
          }
        },
        "additionalProperties": false
      },
      "examples": [
        {
          "action": "metamask.wallet.list_accounts",
          "intent": "Discover the accounts available to headless controller actions",
          "next": "done"
        }
      ],
      "execution_capabilities": []
    },
    "metamask.perps.read_positions": {
      "description": "core Read live Perps positions directly from the Perps controller; without a selector, return all live positions.",
      "schema": {
        "type": "object",
        "properties": {
          "market": {
            "type": "string",
            "description": "Single market symbol, e.g. BTC or ETH. Alias: symbol."
          },
          "symbol": {
            "type": "string",
            "description": "Alias for market."
          },
          "markets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Explicit list of market symbols."
          },
          "symbols": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Alias for markets."
          },
          "mode": {
            "type": "string",
            "enum": [
              "matching",
              "all"
            ],
            "description": "matching selects requested symbols; all selects every live item returned by the controller."
          },
          "selector": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "matching",
                  "all"
                ]
              },
              "market": {
                "type": "string"
              },
              "symbol": {
                "type": "string"
              },
              "markets": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "symbols": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "side": {
                "type": "string",
                "enum": [
                  "long",
                  "short"
                ]
              }
            },
            "additionalProperties": false
          },
          "side": {
            "type": "string",
            "enum": [
              "long",
              "short"
            ],
            "description": "Optional position side filter."
          },
          "account": {
            "type": "string",
            "description": "EVM address to read positions for; defaults to the canonical wallet fixture account."
          },
          "network": {
            "type": "string",
            "enum": [
              "testnet",
              "mainnet"
            ],
            "default": "testnet",
            "description": "Controller network for this isolated Core read."
          },
          "timeout_ms": {
            "type": "number"
          }
        },
        "additionalProperties": false
      },
      "examples": [
        {
          "action": "metamask.perps.read_positions",
          "mode": "all",
          "intent": "Read Perps positions from the headless controller",
          "next": "done"
        }
      ],
      "execution_capabilities": []
    },
    "metamask.perps.read_orders": {
      "description": "core Read live Perps open orders directly from the Perps controller; without a selector, return all live orders.",
      "schema": {
        "type": "object",
        "properties": {
          "market": {
            "type": "string",
            "description": "Single market symbol, e.g. BTC or ETH. Alias: symbol."
          },
          "symbol": {
            "type": "string",
            "description": "Alias for market."
          },
          "markets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Explicit list of market symbols."
          },
          "symbols": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Alias for markets."
          },
          "mode": {
            "type": "string",
            "enum": [
              "matching",
              "all"
            ],
            "description": "matching selects requested symbols; all selects every live item returned by the controller."
          },
          "selector": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "matching",
                  "all"
                ]
              },
              "market": {
                "type": "string"
              },
              "symbol": {
                "type": "string"
              },
              "markets": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "symbols": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "side": {
                "type": "string",
                "enum": [
                  "long",
                  "short"
                ]
              }
            },
            "additionalProperties": false
          },
          "side": {
            "type": "string",
            "enum": [
              "long",
              "short"
            ],
            "description": "Optional order side filter."
          },
          "account": {
            "type": "string",
            "description": "EVM address to read orders for; defaults to the canonical wallet fixture account."
          },
          "network": {
            "type": "string",
            "enum": [
              "testnet",
              "mainnet"
            ],
            "default": "testnet",
            "description": "Controller network for this isolated Core read."
          },
          "timeout_ms": {
            "type": "number"
          }
        },
        "additionalProperties": false
      },
      "examples": [
        {
          "action": "metamask.perps.read_orders",
          "mode": "all",
          "intent": "Read Perps open orders from the headless controller",
          "next": "done"
        }
      ],
      "execution_capabilities": []
    },
    "metamask.perps.read_account": {
      "description": "core Read live Perps account state (balances, margin) directly from the perps controller (HyperLiquid testnet, HTTP read-only).",
      "schema": {
        "type": "object",
        "properties": {
          "account": {
            "type": "string",
            "description": "EVM address to read account state for; defaults to the canonical wallet fixture account."
          },
          "timeout_ms": {
            "type": "number"
          },
          "network": {
            "type": "string",
            "enum": [
              "testnet",
              "mainnet"
            ],
            "description": "Venue to act on. Defaults to testnet. Mainnet uses REAL funds: reads work with network=mainnet alone, while signing additionally requires CORE_PERPS_ALLOW_MAINNET_WRITES=1 in the environment."
          }
        },
        "additionalProperties": false
      },
      "examples": [
        {
          "action": "metamask.perps.read_account",
          "intent": "Read Perps account state from the headless controller",
          "next": "done"
        }
      ],
      "execution_capabilities": []
    },
    "metamask.perps.read_snapshot": {
      "description": "Read global market and account snapshots through the public PerpsController API used by wallet clients.",
      "schema": {
        "type": "object",
        "properties": {
          "scope": {
            "type": "string",
            "enum": [
              "markets",
              "account",
              "all"
            ],
            "default": "all",
            "description": "Select the public controller snapshot calls to execute."
          },
          "account": {
            "type": "string",
            "description": "Wallet fixture account name or EVM address; defaults to dev1."
          },
          "account_name": {
            "type": "string",
            "description": "Alias for a wallet fixture account name."
          },
          "network": {
            "type": "string",
            "enum": [
              "testnet",
              "mainnet"
            ],
            "default": "testnet"
          },
          "terminal_market_data_url": {
            "type": "string",
            "description": "Optional full URL for the legacy Terminal market-data endpoint."
          },
          "terminal_global_snapshot_url": {
            "type": "string",
            "description": "Optional full URL for the Terminal schema-v2 global snapshot endpoint."
          },
          "timeout_ms": {
            "type": "number"
          }
        },
        "additionalProperties": false
      },
      "examples": [
        {
          "action": "metamask.perps.read_snapshot",
          "scope": "all",
          "intent": "Read coherent Perps snapshots through the public controller API",
          "next": "done"
        }
      ],
      "execution_capabilities": []
    },
    "metamask.perps.place_order": {
      "description": "core Place a real Perps order on HyperLiquid testnet by driving the headless perps controller placeOrder() through the full signing/provider path. Supports market (default), resting limit orders (order_type=limit with price/offset_pct), and resting trigger placements (stop_market | stop_limit | take_profit_market | take_profit_limit with trigger_price/trigger_offset_pct), plus reduce_only and attached/partial TP/SL (take_profit_price/take_profit_size, stop_loss_price/stop_loss_size, tpsl_linkage). Venue is selected with network (testnet default; mainnet signs with REAL funds and also requires CORE_PERPS_ALLOW_MAINNET_WRITES=1). Plain limit orders accept time_in_force GTC | ALO (post-only).",
      "schema": {
        "type": "object",
        "properties": {
          "market": {
            "type": "string",
            "description": "Single market symbol, e.g. BTC or ETH. Alias: symbol."
          },
          "symbol": {
            "type": "string",
            "description": "Alias for market."
          },
          "markets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Explicit list of market symbols (place_order requires exactly one)."
          },
          "symbols": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Alias for markets."
          },
          "selector": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "matching",
                  "all"
                ]
              },
              "market": {
                "type": "string"
              },
              "symbol": {
                "type": "string"
              },
              "markets": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "symbols": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "side": {
                "type": "string",
                "enum": [
                  "long",
                  "short"
                ]
              }
            },
            "additionalProperties": false
          },
          "side": {
            "type": "string",
            "enum": [
              "long",
              "short"
            ],
            "description": "Required order direction."
          },
          "order_type": {
            "type": "string",
            "enum": [
              "market",
              "limit",
              "stop_market",
              "stop_limit",
              "take_profit_market",
              "take_profit_limit"
            ],
            "description": "market (default) fills immediately; limit places a RESTING order at price/offset_pct that does not fill; stop_market | stop_limit | take_profit_market | take_profit_limit place a RESTING TRIGGER order that activates at trigger_price and then executes as a market or limit order per the suffix. Alias: orderType."
          },
          "orderType": {
            "type": "string",
            "enum": [
              "market",
              "limit",
              "stop_market",
              "stop_limit",
              "take_profit_market",
              "take_profit_limit"
            ],
            "description": "Alias for order_type."
          },
          "limit_price": {
            "type": [
              "string",
              "number"
            ],
            "description": "Absolute resting limit price (limit orders). Takes precedence over offset_pct. Alias: price/limitPrice."
          },
          "limitPrice": {
            "type": [
              "string",
              "number"
            ],
            "description": "Alias for limit_price."
          },
          "price": {
            "type": [
              "string",
              "number"
            ],
            "description": "Alias for limit_price."
          },
          "offset_pct": {
            "type": [
              "string",
              "number"
            ],
            "description": "Limit price as a percent offset from live mid for plain limits, or from the trigger for *_limit orders. Plain limits default to -30 buy / +30 sell; trigger limits default to +1 buy / -1 sell so they are executable after activation. Alias: offsetPct."
          },
          "offsetPct": {
            "type": [
              "string",
              "number"
            ],
            "description": "Alias for offset_pct."
          },
          "amount": {
            "type": [
              "string",
              "number"
            ],
            "description": "USD notional alias."
          },
          "notional": {
            "type": [
              "string",
              "number"
            ],
            "description": "USD notional alias."
          },
          "leverage": {
            "type": "number",
            "default": 3
          },
          "account": {
            "type": "string",
            "description": "EVM address to trade for; defaults to the canonical wallet fixture account."
          },
          "timeout_ms": {
            "type": "number"
          },
          "trigger_price": {
            "type": [
              "string",
              "number"
            ],
            "description": "Absolute trigger price for stop_*/take_profit_* placements. Takes precedence over trigger_offset_pct. Alias: triggerPrice."
          },
          "triggerPrice": {
            "type": [
              "string",
              "number"
            ],
            "description": "Alias for trigger_price."
          },
          "trigger_offset_pct": {
            "type": [
              "string",
              "number"
            ],
            "description": "Trigger price as a percent offset from live mid (default keeps the trigger ~30% away so it does not fire during a proof). Alias: triggerOffsetPct."
          },
          "triggerOffsetPct": {
            "type": [
              "string",
              "number"
            ],
            "description": "Alias for trigger_offset_pct."
          },
          "reduce_only": {
            "type": "boolean",
            "description": "Place as reduce-only, so the order can only close an existing position. Alias: reduceOnly."
          },
          "reduceOnly": {
            "type": "boolean",
            "description": "Alias for reduce_only."
          },
          "take_profit_price": {
            "type": [
              "string",
              "number"
            ],
            "description": "Attached take profit price. Alias: takeProfitPrice."
          },
          "takeProfitPrice": {
            "type": [
              "string",
              "number"
            ],
            "description": "Alias for take_profit_price."
          },
          "take_profit_size": {
            "type": [
              "string",
              "number"
            ],
            "description": "Quantity covered by the attached take profit (partial TP). Omit to cover the whole order. Alias: takeProfitSize."
          },
          "takeProfitSize": {
            "type": [
              "string",
              "number"
            ],
            "description": "Alias for take_profit_size."
          },
          "stop_loss_price": {
            "type": [
              "string",
              "number"
            ],
            "description": "Attached stop loss price. Alias: stopLossPrice."
          },
          "stopLossPrice": {
            "type": [
              "string",
              "number"
            ],
            "description": "Alias for stop_loss_price."
          },
          "stop_loss_size": {
            "type": [
              "string",
              "number"
            ],
            "description": "Quantity covered by the attached stop loss (partial SL). Omit to cover the whole order. Alias: stopLossSize."
          },
          "stopLossSize": {
            "type": [
              "string",
              "number"
            ],
            "description": "Alias for stop_loss_size."
          },
          "tpsl_linkage": {
            "type": "string",
            "enum": [
              "",
              "none",
              "order",
              "position"
            ],
            "description": "How an attached TP/SL is linked: to this order ('order'), to the resulting position ('position'), or absent ('none'). Provider-agnostic replacement for HyperLiquid grouping. Alias: tpslLinkage."
          },
          "tpslLinkage": {
            "type": "string",
            "enum": [
              "",
              "none",
              "order",
              "position"
            ],
            "description": "Alias for tpsl_linkage."
          },
          "max_slippage_bps": {
            "type": "number",
            "description": "Slippage tolerance in basis points; also caps the limit price derived from the trigger for *_market trigger placements. Alias: maxSlippageBps."
          },
          "maxSlippageBps": {
            "type": "number",
            "description": "Alias for max_slippage_bps."
          },
          "network": {
            "type": "string",
            "enum": [
              "testnet",
              "mainnet"
            ],
            "description": "Venue to act on. Defaults to testnet. Mainnet uses REAL funds: reads work with network=mainnet alone, while signing additionally requires CORE_PERPS_ALLOW_MAINNET_WRITES=1 in the environment."
          },
          "time_in_force": {
            "type": "string",
            "enum": [
              "",
              "GTC",
              "ALO"
            ],
            "description": "Time in force for plain limit orders: GTC (default) or ALO (post-only). Alias: timeInForce."
          },
          "timeInForce": {
            "type": "string",
            "enum": [
              "",
              "GTC",
              "ALO"
            ],
            "description": "Alias for time_in_force."
          },
          "post_only": {
            "type": "boolean",
            "description": "Protocol-agnostic post-only flag; maps to the controller time-in-force ALO. Alias: postOnly."
          },
          "postOnly": {
            "type": "boolean",
            "description": "Alias for post_only."
          },
          "expect_error": {
            "type": "string",
            "description": "Typed controller error code this call must be refused with, e.g. ORDER_TPSL_SIZE_INVALID. The refusal must carry the code as data: a message that merely mentions it does not match. Empty expects the call to succeed."
          },
          "take_profit_offset_pct": {
            "type": [
              "string",
              "number"
            ],
            "description": "Attached take profit price as a percentage from live mid. Preferred over take_profit_price: it holds across markets and over time."
          },
          "takeProfitOffsetPct": {
            "type": [
              "string",
              "number"
            ],
            "description": "camelCase alias of take_profit_offset_pct."
          },
          "stop_loss_offset_pct": {
            "type": [
              "string",
              "number"
            ],
            "description": "Attached stop loss price as a percentage from live mid. Preferred over stop_loss_price for the same reason."
          },
          "stopLossOffsetPct": {
            "type": [
              "string",
              "number"
            ],
            "description": "camelCase alias of stop_loss_offset_pct."
          }
        },
        "additionalProperties": false
      },
      "examples": [
        {
          "action": "metamask.perps.place_order",
          "market": "BTC",
          "side": "long",
          "notional": "11",
          "leverage": 2,
          "intent": "Place the requested Perps order via the headless controller",
          "next": "done"
        },
        {
          "action": "metamask.perps.place_order",
          "market": "BTC",
          "side": "long",
          "order_type": "limit",
          "offset_pct": -30,
          "notional": "11",
          "leverage": 2,
          "intent": "Place a resting Perps limit order via the headless controller",
          "next": "done"
        }
      ],
      "execution_capabilities": [
        "app-mutation",
        "external-mutation"
      ]
    },
    "metamask.perps.close_positions": {
      "description": "core Close selected live Perps positions on HyperLiquid testnet by driving the headless perps controller closePosition() through the full signing/provider path. Testnet only.",
      "schema": {
        "type": "object",
        "properties": {
          "market": {
            "type": "string",
            "description": "Single market symbol, e.g. BTC or ETH. Alias: symbol."
          },
          "symbol": {
            "type": "string",
            "description": "Alias for market."
          },
          "markets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Explicit list of market symbols."
          },
          "symbols": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Alias for markets."
          },
          "mode": {
            "type": "string",
            "enum": [
              "matching",
              "all"
            ],
            "description": "matching selects requested symbols; all selects every live position."
          },
          "selector": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "matching",
                  "all"
                ]
              },
              "market": {
                "type": "string"
              },
              "symbol": {
                "type": "string"
              },
              "markets": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "symbols": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "side": {
                "type": "string",
                "enum": [
                  "long",
                  "short"
                ]
              }
            },
            "additionalProperties": false
          },
          "side": {
            "type": "string",
            "enum": [
              "long",
              "short"
            ],
            "description": "Optional position side filter."
          },
          "account": {
            "type": "string",
            "description": "EVM address to close for; defaults to the canonical wallet fixture account."
          },
          "timeout_ms": {
            "type": "number"
          },
          "network": {
            "type": "string",
            "enum": [
              "testnet",
              "mainnet"
            ],
            "description": "Venue to act on. Defaults to testnet. Mainnet uses REAL funds: reads work with network=mainnet alone, while signing additionally requires CORE_PERPS_ALLOW_MAINNET_WRITES=1 in the environment."
          },
          "expect_error": {
            "type": "string",
            "description": "Typed controller error code this call must be refused with, e.g. ORDER_TPSL_SIZE_INVALID. The refusal must carry the code as data: a message that merely mentions it does not match. Empty expects the call to succeed."
          }
        },
        "additionalProperties": false
      },
      "examples": [
        {
          "action": "metamask.perps.close_positions",
          "market": "BTC",
          "intent": "Close selected Perps positions via the headless controller",
          "next": "done"
        }
      ],
      "execution_capabilities": [
        "app-mutation",
        "external-mutation"
      ]
    },
    "metamask.perps.assert_positions": {
      "description": "core Assert live Perps positions are present or absent for an explicit market selection or mode=all.",
      "schema": {
        "type": "object",
        "properties": {
          "market": {
            "type": "string",
            "description": "Single market symbol, e.g. BTC or ETH. Alias: symbol."
          },
          "symbol": {
            "type": "string",
            "description": "Alias for market."
          },
          "markets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Explicit list of market symbols."
          },
          "symbols": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Alias for markets."
          },
          "mode": {
            "type": "string",
            "enum": [
              "matching",
              "all"
            ],
            "description": "matching selects requested symbols; all selects every live position."
          },
          "selector": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "matching",
                  "all"
                ]
              },
              "market": {
                "type": "string"
              },
              "symbol": {
                "type": "string"
              },
              "markets": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "symbols": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "side": {
                "type": "string",
                "enum": [
                  "long",
                  "short"
                ]
              }
            },
            "additionalProperties": false
          },
          "side": {
            "type": "string",
            "enum": [
              "long",
              "short"
            ],
            "description": "Optional position side filter."
          },
          "state": {
            "type": "string",
            "enum": [
              "none",
              "absent",
              "closed",
              "open",
              "present"
            ],
            "description": "Expected selected position state."
          },
          "account": {
            "type": "string",
            "description": "EVM address to read for; defaults to the canonical wallet fixture account."
          },
          "network": {
            "type": "string",
            "enum": [
              "testnet",
              "mainnet"
            ],
            "default": "testnet",
            "description": "Controller network for this isolated Core assertion."
          },
          "timeout_ms": {
            "type": "number"
          },
          "expect_count": {
            "type": [
              "string",
              "number"
            ],
            "description": "Assert the exact number of matching items. Stronger than the default at-least-one check: it catches a replace that added an order beside the previous one instead of sweeping it."
          },
          "expectCount": {
            "type": [
              "string",
              "number"
            ],
            "description": "camelCase alias of expect_count."
          }
        },
        "required": [
          "state"
        ],
        "additionalProperties": false
      },
      "examples": [
        {
          "action": "metamask.perps.assert_positions",
          "state": "open",
          "market": "BTC",
          "intent": "Assert the expected Perps position state via the headless controller",
          "next": "done"
        }
      ],
      "execution_capabilities": []
    },
    "metamask.perps.ensure_positions": {
      "description": "core Higher-level wrapper that reads selected positions, places or closes via the headless controller as needed, then asserts the final position state. Testnet only.",
      "schema": {
        "type": "object",
        "properties": {
          "market": {
            "type": "string",
            "description": "Single market symbol, e.g. BTC or ETH. Alias: symbol."
          },
          "symbol": {
            "type": "string",
            "description": "Alias for market."
          },
          "markets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Explicit list of market symbols."
          },
          "symbols": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Alias for markets."
          },
          "mode": {
            "type": "string",
            "enum": [
              "matching",
              "all"
            ],
            "description": "matching selects requested symbols; all selects every live position."
          },
          "selector": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "matching",
                  "all"
                ]
              },
              "market": {
                "type": "string"
              },
              "symbol": {
                "type": "string"
              },
              "markets": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "symbols": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "side": {
                "type": "string",
                "enum": [
                  "long",
                  "short"
                ]
              }
            },
            "additionalProperties": false
          },
          "side": {
            "type": "string",
            "enum": [
              "long",
              "short"
            ],
            "description": "Required when state=open/present; otherwise filters selected positions."
          },
          "state": {
            "type": "string",
            "enum": [
              "none",
              "absent",
              "closed",
              "open",
              "present"
            ],
            "description": "Desired selected position state to converge to."
          },
          "amount": {
            "type": [
              "string",
              "number"
            ],
            "description": "USD notional alias (used when placing to reach state open)."
          },
          "notional": {
            "type": [
              "string",
              "number"
            ],
            "description": "USD notional alias."
          },
          "leverage": {
            "type": "number"
          },
          "account": {
            "type": "string",
            "description": "EVM address to trade for; defaults to the canonical wallet fixture account."
          },
          "timeout_ms": {
            "type": "number"
          },
          "network": {
            "type": "string",
            "enum": [
              "testnet",
              "mainnet"
            ],
            "description": "Venue to act on. Defaults to testnet. Mainnet uses REAL funds: reads work with network=mainnet alone, while signing additionally requires CORE_PERPS_ALLOW_MAINNET_WRITES=1 in the environment."
          }
        },
        "required": [
          "state"
        ],
        "additionalProperties": false
      },
      "examples": [
        {
          "action": "metamask.perps.ensure_positions",
          "state": "none",
          "market": "BTC",
          "intent": "Converge Perps positions to the requested state via the headless controller",
          "next": "done"
        },
        {
          "action": "metamask.perps.ensure_positions",
          "market": "ETH",
          "side": "long",
          "state": "open",
          "notional": "10",
          "intent": "Converge ETH positions to one explicit testnet precondition",
          "next": "done"
        }
      ],
      "execution_capabilities": [
        "app-mutation",
        "external-mutation"
      ]
    },
    "metamask.perps.close_orders": {
      "description": "core Default to testnet for Perps mutations; mainnet is read-only unless explicitly requested. Cancel selected live Perps open orders. Use selector/mode params to cancel matching symbols or all orders.",
      "schema": {
        "type": "object",
        "properties": {
          "market": {
            "type": "string",
            "description": "Single market symbol, e.g. BTC or ETH. Alias: symbol."
          },
          "symbol": {
            "type": "string",
            "description": "Alias for market."
          },
          "markets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Explicit list of market symbols."
          },
          "symbols": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Alias for markets."
          },
          "mode": {
            "type": "string",
            "enum": [
              "matching",
              "all"
            ],
            "description": "matching selects requested symbols; all selects every live item returned by the product."
          },
          "selector": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "matching",
                  "all"
                ]
              },
              "market": {
                "type": "string"
              },
              "symbol": {
                "type": "string"
              },
              "markets": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "symbols": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "side": {
                "type": "string",
                "enum": [
                  "long",
                  "short"
                ]
              }
            },
            "additionalProperties": false
          },
          "side": {
            "type": "string",
            "enum": [
              "long",
              "short"
            ],
            "description": "Optional position/order side filter."
          },
          "timeout_ms": {
            "type": "number"
          },
          "network": {
            "type": "string",
            "enum": [
              "testnet",
              "mainnet"
            ],
            "description": "Venue to act on. Defaults to testnet. Mainnet uses REAL funds: reads work with network=mainnet alone, while signing additionally requires CORE_PERPS_ALLOW_MAINNET_WRITES=1 in the environment."
          },
          "expect_error": {
            "type": "string",
            "description": "Typed controller error code this call must be refused with, e.g. ORDER_TPSL_SIZE_INVALID. The refusal must carry the code as data: a message that merely mentions it does not match. Empty expects the call to succeed."
          }
        },
        "additionalProperties": false
      },
      "examples": [
        {
          "action": "metamask.perps.close_orders",
          "mode": "all",
          "intent": "Cancel selected Perps orders before continuing",
          "next": "done"
        },
        {
          "action": "metamask.perps.close_orders",
          "market": "BTC",
          "intent": "Cancel selected Perps orders before continuing",
          "next": "done"
        }
      ],
      "execution_capabilities": [
        "app-mutation",
        "external-mutation"
      ]
    },
    "metamask.perps.assert_orders": {
      "description": "core Assert live Perps open orders are present or absent for an explicit market selection or mode=all. Optional expect_* fields assert the trigger data of the matching orders (placement type, trigger price, execution mode, reduce-only flag, size).",
      "schema": {
        "type": "object",
        "properties": {
          "market": {
            "type": "string",
            "description": "Single market symbol, e.g. BTC or ETH. Alias: symbol."
          },
          "symbol": {
            "type": "string",
            "description": "Alias for market."
          },
          "markets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Explicit list of market symbols."
          },
          "symbols": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Alias for markets."
          },
          "mode": {
            "type": "string",
            "enum": [
              "matching",
              "all"
            ],
            "description": "matching selects requested symbols; all selects every live item returned by the product."
          },
          "selector": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "matching",
                  "all"
                ]
              },
              "market": {
                "type": "string"
              },
              "symbol": {
                "type": "string"
              },
              "markets": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "symbols": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "side": {
                "type": "string",
                "enum": [
                  "long",
                  "short"
                ]
              }
            },
            "additionalProperties": false
          },
          "side": {
            "type": "string",
            "enum": [
              "long",
              "short"
            ],
            "description": "Optional position/order side filter."
          },
          "network": {
            "type": "string",
            "enum": [
              "testnet",
              "mainnet"
            ],
            "default": "testnet",
            "description": "Controller network for this isolated Core assertion."
          },
          "timeout_ms": {
            "type": "number"
          },
          "state": {
            "type": "string",
            "enum": [
              "none",
              "absent",
              "closed",
              "open",
              "present"
            ],
            "description": "Desired/expected selected collection state."
          },
          "expect_trigger_order_type": {
            "type": "string",
            "enum": [
              "stop_market",
              "stop_limit",
              "take_profit_market",
              "take_profit_limit"
            ],
            "description": "Require every matching order to be this trigger placement type (read back from the exchange)."
          },
          "expect_trigger_price": {
            "type": [
              "string",
              "number"
            ],
            "description": "Require every matching order to carry this trigger price."
          },
          "expect_execution": {
            "type": "string",
            "enum": [
              "market",
              "limit"
            ],
            "description": "Require the execution mode a matching trigger order runs as once it fires."
          },
          "expect_reduce_only": {
            "type": "boolean",
            "description": "Require the reduce-only flag on every matching order."
          },
          "expect_size": {
            "type": [
              "string",
              "number"
            ],
            "description": "Require this size on every matching order (proves a partial TP/SL quantity)."
          },
          "only_trigger_orders": {
            "type": "boolean",
            "description": "Consider only trigger orders (stop / take profit) on the selected market, so expectations are not applied to a plain parent order resting alongside them. Alias: onlyTriggerOrders."
          },
          "expect_count": {
            "type": [
              "string",
              "number"
            ],
            "description": "Assert the exact number of matching items. Stronger than the default at-least-one check: it catches a replace that added an order beside the previous one instead of sweeping it."
          },
          "expectCount": {
            "type": [
              "string",
              "number"
            ],
            "description": "camelCase alias of expect_count."
          },
          "expect_take_profit_child": {
            "type": [
              "string",
              "boolean"
            ],
            "description": "Assert a matching order exposes takeProfitOrderId, and that the take profit child it names is live as a reduce-only trigger. Proves the child was linked, which a count cannot."
          },
          "expect_stop_loss_child": {
            "type": [
              "string",
              "boolean"
            ],
            "description": "Assert a matching order exposes stopLossOrderId, and that the stop loss child it names is live as a reduce-only trigger. Proves the child was linked, which a count cannot."
          },
          "expectTakeProfitChild": {
            "type": [
              "string",
              "boolean"
            ],
            "description": "Alias for expect_take_profit_child."
          },
          "expectStopLossChild": {
            "type": [
              "string",
              "boolean"
            ],
            "description": "Alias for expect_stop_loss_child."
          }
        },
        "required": [
          "state"
        ],
        "additionalProperties": false
      },
      "examples": [
        {
          "action": "metamask.perps.assert_orders",
          "state": "none",
          "market": "BTC",
          "intent": "Assert the expected Perps open order state",
          "next": "done"
        }
      ],
      "execution_capabilities": []
    },
    "metamask.perps.ensure_orders": {
      "description": "core Default to testnet for Perps mutations; mainnet is read-only unless explicitly requested.Higher-level wrapper that reads selected orders, cancels when needed, then asserts final order state.",
      "schema": {
        "type": "object",
        "properties": {
          "market": {
            "type": "string",
            "description": "Single market symbol, e.g. BTC or ETH. Alias: symbol."
          },
          "symbol": {
            "type": "string",
            "description": "Alias for market."
          },
          "markets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Explicit list of market symbols."
          },
          "symbols": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Alias for markets."
          },
          "mode": {
            "type": "string",
            "enum": [
              "matching",
              "all"
            ],
            "description": "matching selects requested symbols; all selects every live item returned by the product."
          },
          "selector": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "matching",
                  "all"
                ]
              },
              "market": {
                "type": "string"
              },
              "symbol": {
                "type": "string"
              },
              "markets": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "symbols": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "side": {
                "type": "string",
                "enum": [
                  "long",
                  "short"
                ]
              }
            },
            "additionalProperties": false
          },
          "side": {
            "type": "string",
            "enum": [
              "long",
              "short"
            ],
            "description": "Required when state=open/present; otherwise filters selected orders."
          },
          "timeout_ms": {
            "type": "number"
          },
          "amount": {
            "type": [
              "string",
              "number"
            ],
            "description": "Explicit USD notional used only when creating a missing open order. Alias: notional."
          },
          "notional": {
            "type": [
              "string",
              "number"
            ],
            "description": "Alias for amount."
          },
          "leverage": {
            "type": "number",
            "description": "Leverage used only when creating a missing open order."
          },
          "state": {
            "type": "string",
            "enum": [
              "none",
              "absent",
              "closed",
              "open",
              "present"
            ],
            "description": "Desired/expected selected collection state."
          },
          "network": {
            "type": "string",
            "enum": [
              "testnet",
              "mainnet"
            ],
            "description": "Venue to act on. Defaults to testnet. Mainnet uses REAL funds: reads work with network=mainnet alone, while signing additionally requires CORE_PERPS_ALLOW_MAINNET_WRITES=1 in the environment."
          }
        },
        "required": [
          "state"
        ],
        "additionalProperties": false
      },
      "examples": [
        {
          "action": "metamask.perps.ensure_orders",
          "state": "none",
          "mode": "all",
          "intent": "Converge Perps orders to the requested state",
          "next": "done"
        },
        {
          "action": "metamask.perps.ensure_orders",
          "market": "ETH",
          "side": "short",
          "state": "open",
          "notional": "10",
          "leverage": 2,
          "intent": "Converge ETH open orders to one explicit testnet precondition",
          "next": "done"
        }
      ],
      "execution_capabilities": [
        "app-mutation",
        "external-mutation"
      ]
    },
    "metamask.perps.start_state": {
      "description": "core Default to testnet for Perps mutations; mainnet is read-only unless explicitly requested.Recommended configurable Perps start state that composes reusable domain operations before the proof window. Headless: converges POSITION and ORDER baselines on testnet via the controller; no navigation/page/HUD.",
      "schema": {
        "type": "object",
        "properties": {
          "profile": {
            "type": "string",
            "description": "Optional profile such as clean_market_testnet, open_position_testnet, open_order_testnet, or provider_mainnet_readonly."
          },
          "account": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "description": "Requested Perps provider, e.g. hyperliquid."
          },
          "network": {
            "type": "string",
            "enum": [
              "testnet",
              "mainnet"
            ]
          },
          "market": {
            "type": "string"
          },
          "symbol": {
            "type": "string"
          },
          "markets": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "symbols": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "positions": {
            "type": [
              "object",
              "boolean"
            ],
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "matching",
                  "all"
                ]
              },
              "market": {
                "type": "string"
              },
              "symbol": {
                "type": "string"
              },
              "markets": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "symbols": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "side": {
                "type": "string",
                "enum": [
                  "long",
                  "short"
                ]
              },
              "state": {
                "type": "string",
                "enum": [
                  "none",
                  "closed",
                  "absent",
                  "open",
                  "present"
                ]
              },
              "amount": {
                "type": [
                  "string",
                  "number"
                ]
              },
              "notional": {
                "type": [
                  "string",
                  "number"
                ]
              },
              "size": {
                "type": [
                  "string",
                  "number"
                ]
              },
              "leverage": {
                "type": "number"
              },
              "order_type": {
                "type": "string"
              },
              "orderType": {
                "type": "string"
              },
              "limit_price": {
                "type": "number"
              },
              "limitPrice": {
                "type": "number"
              },
              "offset_pct": {
                "type": "number"
              },
              "offsetPct": {
                "type": "number"
              },
              "current_price": {
                "type": "number"
              },
              "currentPrice": {
                "type": "number"
              },
              "max_slippage_bps": {
                "type": "number"
              },
              "maxSlippageBps": {
                "type": "number"
              },
              "close_attempts": {
                "type": "integer"
              },
              "close_retry_delay_ms": {
                "type": "integer"
              },
              "timeout_ms": {
                "type": "number"
              }
            },
            "additionalProperties": false
          },
          "orders": {
            "type": [
              "object",
              "boolean"
            ],
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "matching",
                  "all"
                ]
              },
              "market": {
                "type": "string"
              },
              "symbol": {
                "type": "string"
              },
              "markets": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "symbols": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "side": {
                "type": "string",
                "enum": [
                  "long",
                  "short"
                ]
              },
              "state": {
                "type": "string",
                "enum": [
                  "none",
                  "closed",
                  "absent",
                  "open",
                  "present"
                ]
              },
              "amount": {
                "type": [
                  "string",
                  "number"
                ]
              },
              "notional": {
                "type": [
                  "string",
                  "number"
                ]
              },
              "size": {
                "type": [
                  "string",
                  "number"
                ]
              },
              "leverage": {
                "type": "number"
              },
              "order_type": {
                "type": "string"
              },
              "orderType": {
                "type": "string"
              },
              "limit_price": {
                "type": "number"
              },
              "limitPrice": {
                "type": "number"
              },
              "offset_pct": {
                "type": "number"
              },
              "offsetPct": {
                "type": "number"
              },
              "current_price": {
                "type": "number"
              },
              "currentPrice": {
                "type": "number"
              },
              "max_slippage_bps": {
                "type": "number"
              },
              "maxSlippageBps": {
                "type": "number"
              },
              "close_attempts": {
                "type": "integer"
              },
              "close_retry_delay_ms": {
                "type": "integer"
              },
              "timeout_ms": {
                "type": "number"
              }
            },
            "additionalProperties": false
          },
          "timeout_ms": {
            "type": "number"
          },
          "side": {
            "type": "string",
            "enum": [
              "long",
              "short"
            ]
          },
          "account_name": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "matching",
              "all"
            ]
          }
        },
        "additionalProperties": false
      },
      "examples": [
        {
          "action": "metamask.perps.start_state",
          "profile": "clean_market_testnet",
          "market": "BTC",
          "positions": {
            "state": "none"
          },
          "orders": {
            "state": "none"
          },
          "intent": "Prepare the Perps start state for the proof",
          "network": "testnet",
          "next": "done"
        },
        {
          "action": "metamask.perps.start_state",
          "profile": "open_position_testnet",
          "market": "ETH",
          "side": "long",
          "positions": {
            "state": "open",
            "notional": "10",
            "leverage": 2
          },
          "intent": "Prepare the Perps start state for the proof",
          "network": "testnet",
          "next": "done"
        }
      ],
      "execution_capabilities": [
        "app-mutation",
        "external-mutation"
      ]
    },
    "metamask.perps.teardown_state": {
      "description": "core Recommended configurable Perps teardown state that restores the selected environment after proof. Headless: converges POSITION and ORDER baselines on testnet via the controller; no navigation/page/HUD.",
      "schema": {
        "type": "object",
        "properties": {
          "profile": {
            "type": "string",
            "description": "Optional profile such as clean_market_testnet, open_position_testnet, open_order_testnet, or provider_mainnet_readonly."
          },
          "account": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "description": "Requested Perps provider, e.g. hyperliquid."
          },
          "network": {
            "type": "string",
            "enum": [
              "testnet",
              "mainnet"
            ]
          },
          "market": {
            "type": "string"
          },
          "symbol": {
            "type": "string"
          },
          "markets": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "symbols": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "positions": {
            "type": [
              "object",
              "boolean"
            ],
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "matching",
                  "all"
                ]
              },
              "market": {
                "type": "string"
              },
              "symbol": {
                "type": "string"
              },
              "markets": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "symbols": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "side": {
                "type": "string",
                "enum": [
                  "long",
                  "short"
                ]
              },
              "state": {
                "type": "string",
                "enum": [
                  "none",
                  "closed",
                  "absent",
                  "open",
                  "present"
                ]
              },
              "amount": {
                "type": [
                  "string",
                  "number"
                ]
              },
              "notional": {
                "type": [
                  "string",
                  "number"
                ]
              },
              "size": {
                "type": [
                  "string",
                  "number"
                ]
              },
              "leverage": {
                "type": "number"
              },
              "order_type": {
                "type": "string"
              },
              "orderType": {
                "type": "string"
              },
              "limit_price": {
                "type": "number"
              },
              "limitPrice": {
                "type": "number"
              },
              "offset_pct": {
                "type": "number"
              },
              "offsetPct": {
                "type": "number"
              },
              "current_price": {
                "type": "number"
              },
              "currentPrice": {
                "type": "number"
              },
              "max_slippage_bps": {
                "type": "number"
              },
              "maxSlippageBps": {
                "type": "number"
              },
              "close_attempts": {
                "type": "integer"
              },
              "close_retry_delay_ms": {
                "type": "integer"
              },
              "timeout_ms": {
                "type": "number"
              }
            },
            "additionalProperties": false
          },
          "orders": {
            "type": [
              "object",
              "boolean"
            ],
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "matching",
                  "all"
                ]
              },
              "market": {
                "type": "string"
              },
              "symbol": {
                "type": "string"
              },
              "markets": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "symbols": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "side": {
                "type": "string",
                "enum": [
                  "long",
                  "short"
                ]
              },
              "state": {
                "type": "string",
                "enum": [
                  "none",
                  "closed",
                  "absent",
                  "open",
                  "present"
                ]
              },
              "amount": {
                "type": [
                  "string",
                  "number"
                ]
              },
              "notional": {
                "type": [
                  "string",
                  "number"
                ]
              },
              "size": {
                "type": [
                  "string",
                  "number"
                ]
              },
              "leverage": {
                "type": "number"
              },
              "order_type": {
                "type": "string"
              },
              "orderType": {
                "type": "string"
              },
              "limit_price": {
                "type": "number"
              },
              "limitPrice": {
                "type": "number"
              },
              "offset_pct": {
                "type": "number"
              },
              "offsetPct": {
                "type": "number"
              },
              "current_price": {
                "type": "number"
              },
              "currentPrice": {
                "type": "number"
              },
              "max_slippage_bps": {
                "type": "number"
              },
              "maxSlippageBps": {
                "type": "number"
              },
              "close_attempts": {
                "type": "integer"
              },
              "close_retry_delay_ms": {
                "type": "integer"
              },
              "timeout_ms": {
                "type": "number"
              }
            },
            "additionalProperties": false
          },
          "timeout_ms": {
            "type": "number"
          },
          "side": {
            "type": "string",
            "enum": [
              "long",
              "short"
            ]
          },
          "account_name": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "matching",
              "all"
            ]
          }
        },
        "additionalProperties": false
      },
      "examples": [
        {
          "action": "metamask.perps.teardown_state",
          "market": "BTC",
          "positions": {
            "state": "none"
          },
          "orders": {
            "state": "none"
          },
          "intent": "Restore Perps state after the proof",
          "next": "done"
        },
        {
          "action": "metamask.perps.teardown_state",
          "market": "BTC",
          "intent": "Restore Perps state after the proof",
          "next": "done"
        }
      ],
      "execution_capabilities": [
        "app-mutation",
        "external-mutation"
      ]
    },
    "metamask.perps.update_position_tpsl": {
      "description": "core Set or replace the TP/SL attached to an existing Perps POSITION by driving the headless perps controller updatePositionTPSL() through the full signing/provider path. Covers whole-position TP/SL and PARTIAL (quantity-scoped) TP/SL via take_profit_size / stop_loss_size, which the provider expresses as standalone reduce-only trigger orders because a position-bound TP/SL always closes the whole position. Venue is selected with network (testnet default; mainnet signs with REAL funds and also requires CORE_PERPS_ALLOW_MAINNET_WRITES=1).",
      "schema": {
        "type": "object",
        "properties": {
          "market": {
            "type": "string",
            "description": "Single market symbol whose position the TP/SL attaches to. Alias: symbol."
          },
          "symbol": {
            "type": "string",
            "description": "Alias for market."
          },
          "markets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Explicit market list (requires exactly one)."
          },
          "symbols": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Alias for markets."
          },
          "selector": {
            "type": "object",
            "description": "Optional structured selector with mode and symbols/markets."
          },
          "take_profit_price": {
            "type": [
              "string",
              "number"
            ],
            "description": "Take profit trigger price. Omit to leave the take profit unset. Alias: takeProfitPrice."
          },
          "takeProfitPrice": {
            "type": [
              "string",
              "number"
            ],
            "description": "Alias for take_profit_price."
          },
          "take_profit_size": {
            "type": [
              "string",
              "number"
            ],
            "description": "Quantity the take profit covers (partial TP). Omit to cover the whole position. Alias: takeProfitSize."
          },
          "takeProfitSize": {
            "type": [
              "string",
              "number"
            ],
            "description": "Alias for take_profit_size."
          },
          "stop_loss_price": {
            "type": [
              "string",
              "number"
            ],
            "description": "Stop loss trigger price. Omit to leave the stop loss unset. Alias: stopLossPrice."
          },
          "stopLossPrice": {
            "type": [
              "string",
              "number"
            ],
            "description": "Alias for stop_loss_price."
          },
          "stop_loss_size": {
            "type": [
              "string",
              "number"
            ],
            "description": "Quantity the stop loss covers (partial SL). Omit to cover the whole position. Alias: stopLossSize."
          },
          "stopLossSize": {
            "type": [
              "string",
              "number"
            ],
            "description": "Alias for stop_loss_size."
          },
          "network": {
            "type": "string",
            "enum": [
              "testnet",
              "mainnet"
            ],
            "description": "Venue to act on. Defaults to testnet. Mainnet uses REAL funds and additionally requires CORE_PERPS_ALLOW_MAINNET_WRITES=1."
          },
          "account": {
            "type": "string",
            "description": "EVM address to act for; defaults to MM_TEST_ACCOUNT_ADDRESS."
          },
          "timeout_ms": {
            "type": "number"
          },
          "expect_error": {
            "type": "string",
            "description": "Typed controller error code this call must be refused with, e.g. ORDER_TPSL_SIZE_INVALID. The refusal must carry the code as data: a message that merely mentions it does not match. Empty expects the call to succeed."
          },
          "take_profit_offset_pct": {
            "type": [
              "string",
              "number"
            ],
            "description": "Take profit price as a percentage from live mid. Preferred over take_profit_price: it holds across markets and over time, where an absolute price only suits one market at one moment."
          },
          "takeProfitOffsetPct": {
            "type": [
              "string",
              "number"
            ],
            "description": "camelCase alias of take_profit_offset_pct."
          },
          "stop_loss_offset_pct": {
            "type": [
              "string",
              "number"
            ],
            "description": "Stop loss price as a percentage from live mid. Preferred over stop_loss_price for the same reason."
          },
          "stopLossOffsetPct": {
            "type": [
              "string",
              "number"
            ],
            "description": "camelCase alias of stop_loss_offset_pct."
          },
          "take_profit_fraction": {
            "type": [
              "string",
              "number"
            ],
            "description": "Partial take profit size as a fraction of the live position size, in (0, 1]. Preferred over take_profit_size: an absolute size that suits one market can round away or exceed the position on another."
          },
          "takeProfitFraction": {
            "type": [
              "string",
              "number"
            ],
            "description": "camelCase alias of take_profit_fraction."
          },
          "stop_loss_fraction": {
            "type": [
              "string",
              "number"
            ],
            "description": "Partial stop loss size as a fraction of the live position size, in (0, 1]."
          },
          "stopLossFraction": {
            "type": [
              "string",
              "number"
            ],
            "description": "camelCase alias of stop_loss_fraction."
          }
        },
        "additionalProperties": false
      },
      "examples": [
        {
          "action": "metamask.perps.update_position_tpsl",
          "market": "BTC",
          "take_profit_price": "120000",
          "intent": "Attach a whole-position take profit to the open BTC position",
          "next": "done"
        },
        {
          "action": "metamask.perps.update_position_tpsl",
          "market": "BTC",
          "take_profit_price": "120000",
          "take_profit_size": "0.0002",
          "intent": "Attach a partial (quantity-scoped) take profit to the open BTC position",
          "next": "done"
        }
      ],
      "execution_capabilities": [
        "app-mutation",
        "external-mutation"
      ]
    },
    "metamask.perps.edit_order": {
      "description": "core Modify a RESTING Perps open order by driving the headless perps controller editOrder() through the full signing/provider path. HyperLiquid modify rebuilds the order as a plain limit/market order, so a trigger on either side of the edit would be silently dropped: the controller refuses editing a resting trigger order and refuses editing INTO one (ORDER_EDIT_TRIGGER_UNSUPPORTED), and fails closed when the resting order cannot be verified (ORDER_EDIT_ORDER_UNVERIFIABLE). Pair with expect_error to prove those refusals. Venue is selected with network (testnet default; mainnet signs with REAL funds and also requires CORE_PERPS_ALLOW_MAINNET_WRITES=1).",
      "schema": {
        "type": "object",
        "properties": {
          "market": {
            "type": "string",
            "description": "Single market symbol whose position the TP/SL attaches to. Alias: symbol."
          },
          "symbol": {
            "type": "string",
            "description": "Alias for market."
          },
          "markets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Explicit market list (requires exactly one)."
          },
          "symbols": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Alias for markets."
          },
          "selector": {
            "type": "object",
            "description": "Optional structured selector with mode and symbols/markets."
          },
          "account": {
            "type": "string",
            "description": "EVM address to act for; defaults to MM_TEST_ACCOUNT_ADDRESS."
          },
          "timeout_ms": {
            "type": "number"
          },
          "network": {
            "type": "string",
            "enum": [
              "testnet",
              "mainnet"
            ],
            "description": "Venue to act on. Defaults to testnet. Mainnet uses REAL funds and additionally requires CORE_PERPS_ALLOW_MAINNET_WRITES=1."
          },
          "expect_error": {
            "type": "string",
            "description": "Typed controller error code this call must be refused with, e.g. ORDER_TPSL_SIZE_INVALID. The refusal must carry the code as data: a message that merely mentions it does not match. Empty expects the call to succeed."
          },
          "order_id": {
            "type": [
              "string",
              "number"
            ],
            "description": "Exchange order ID of the resting order to edit. Required unless the selection resolves to exactly one open order."
          },
          "orderId": {
            "type": [
              "string",
              "number"
            ],
            "description": "camelCase alias of order_id."
          },
          "size": {
            "type": [
              "string",
              "number"
            ],
            "description": "New order size in contracts. Defaults to the resting order's current size, so a reprice does not have to restate a size that only suits one market."
          },
          "price": {
            "type": [
              "string",
              "number"
            ],
            "description": "New limit price. Required when order_type is limit."
          },
          "order_type": {
            "type": "string",
            "enum": [
              "limit",
              "stop_market",
              "stop_limit",
              "take_profit_market",
              "take_profit_limit"
            ],
            "description": "New placement type. Limit only for a successful edit: a market edit fills rather than rests, so the resting-order verification this action performs could never confirm it. HyperLiquid modify rebuilds the order as a plain order, so a trigger type is refused with ORDER_EDIT_TRIGGER_UNSUPPORTED; trigger types stay in this schema so that refusal can be proven."
          },
          "orderType": {
            "type": "string",
            "enum": [
              "limit",
              "stop_market",
              "stop_limit",
              "take_profit_market",
              "take_profit_limit"
            ],
            "description": "camelCase alias of order_type."
          },
          "trigger_price": {
            "type": [
              "string",
              "number"
            ],
            "description": "Trigger price. Supplying one asks to edit INTO a trigger placement, which is refused with ORDER_EDIT_TRIGGER_UNSUPPORTED; present so that refusal can be proven."
          },
          "triggerPrice": {
            "type": [
              "string",
              "number"
            ],
            "description": "camelCase alias of trigger_price."
          },
          "time_in_force": {
            "type": "string",
            "enum": [
              "",
              "GTC",
              "ALO"
            ],
            "description": "Time in force for a resting plain limit order. IOC is unsupported because a canceled or immediately-filled replacement cannot satisfy this action's resting-order postcondition."
          },
          "timeInForce": {
            "type": "string",
            "enum": [
              "",
              "GTC",
              "ALO"
            ],
            "description": "camelCase alias of time_in_force."
          },
          "reduce_only": {
            "type": "boolean",
            "description": "Whether the edited order may only reduce the position."
          },
          "reduceOnly": {
            "type": "boolean",
            "description": "camelCase alias of reduce_only."
          },
          "side": {
            "type": "string",
            "enum": [
              "long",
              "short"
            ],
            "description": "Required order direction."
          },
          "offset_pct": {
            "type": [
              "string",
              "number"
            ],
            "description": "New limit price as a percentage from live mid, used when no absolute price is given. Mirrors place_order so a recipe can reprice far from mid without hard-coding a per-market number."
          },
          "offsetPct": {
            "type": [
              "string",
              "number"
            ],
            "description": "camelCase alias of offset_pct."
          },
          "notional": {
            "type": [
              "string",
              "number"
            ],
            "description": "USD notional used to derive a size when the resting order cannot be read — the case a refusal proof against an unheld order needs, since editOrder validates size before reporting that the order was unverifiable."
          }
        },
        "additionalProperties": false
      },
      "examples": [
        {
          "action": "metamask.perps.edit_order",
          "market": "BTC",
          "side": "long",
          "size": "0.001",
          "price": "40000",
          "order_type": "limit",
          "intent": "Reprice a resting BTC limit order",
          "next": "done"
        },
        {
          "action": "metamask.perps.edit_order",
          "market": "BTC",
          "side": "short",
          "size": "0.001",
          "price": "45000",
          "order_type": "limit",
          "expect_error": "ORDER_EDIT_TRIGGER_UNSUPPORTED",
          "intent": "Prove a resting trigger order cannot be rebuilt as a plain order",
          "next": "done"
        }
      ],
      "execution_capabilities": [
        "app-mutation",
        "external-mutation"
      ]
    }
  }
}
