{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "WhipWhip whipset (authoring format)",
  "description": "A whipset written by a chat for the WhipWhip browser extension. Paste the JSON into the WhipWhip panel import field. Ids, derived fields, keys and signatures are filled in by the extension — do not write them. Variable tokens are written as <<var.key>>, never with curly braces.",
  "type": "object",
  "required": [
    "format",
    "name",
    "whips"
  ],
  "additionalProperties": false,
  "properties": {
    "format": {
      "const": "whipwhip.authoring/1"
    },
    "name": {
      "type": "string",
      "minLength": 1
    },
    "description": {
      "type": "string"
    },
    "inline_guide": {
      "type": "string",
      "description": "Legacy — accepted so older sets still import, but never shown. Put usage notes in description."
    },
    "tags": {
      "type": "array",
      "description": "Roles: each tag names one conversation the whips can move between.",
      "items": {
        "type": "object",
        "required": [
          "name"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_가-힣-]{2,10}$",
            "not": {
              "const": "main"
            }
          }
        }
      }
    },
    "variables": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "key",
          "label",
          "source",
          "required"
        ],
        "additionalProperties": false,
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_]+$"
          },
          "label": {
            "type": "string",
            "minLength": 1
          },
          "description": {
            "type": "string"
          },
          "source": {
            "enum": [
              "user_input",
              "set_by_action",
              "constant"
            ],
            "description": "user_input: asked from the person. set_by_action: written by a card. constant: fixed defaultValue."
          },
          "valueType": {
            "enum": [
              "string",
              "array",
              "json"
            ],
            "description": "Use \"array\" for variables that list cards change (append_item, upsert_item, patch_item, remove_item) or that derive_index reads."
          },
          "defaultValue": {
            "type": "string"
          },
          "scope": {
            "enum": [
              "set"
            ],
            "description": "Omit for a value kept per workspace (new tab = empty). \"set\" keeps the value for this whipset in every tab (character sheet, style line, a reading chart). Not for constant."
          },
          "required": {
            "type": "boolean"
          }
        }
      }
    },
    "whips": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "label",
          "actions"
        ],
        "additionalProperties": false,
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1
          },
          "description": {
            "type": "string"
          },
          "preflightStyle": {
            "enum": [
              "form",
              "none"
            ],
            "description": "Defaults to \"form\"."
          },
          "scopeTags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Tags whose conversation this whip belongs to."
          },
          "actions": {
            "type": "array",
            "minItems": 1,
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "required": [
                    "card",
                    "config"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "prompt_write",
                      "description": "Type text into the message box, or change what's already there."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "text"
                      ],
                      "properties": {
                        "text": {
                          "type": "string",
                          "description": "Prompt May contain variable tokens written as <<var.key>>."
                        },
                        "mode": {
                          "type": "string",
                          "enum": [
                            "replace",
                            "append",
                            "prepend"
                          ],
                          "description": "Where to add"
                        },
                        "preflight": {
                          "type": "boolean",
                          "description": "Before the run, show a form to fill in this prompt's <<var.key>> variables."
                        },
                        "inputStyle": {
                          "type": "string",
                          "enum": [
                            "form",
                            "inline"
                          ],
                          "description": "Ask as"
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "submit",
                      "description": "Send what's in the message box and wait for the AI's reply. You can turn waiting off."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "skipWait": {
                          "type": "boolean",
                          "description": "Move on right after sending. Use this when the whip doesn't need the reply, e.g. sending the same prompt to several tabs."
                        },
                        "waitTimeoutMs": {
                          "type": [
                            "number",
                            "string"
                          ],
                          "description": "Stop waiting after this long with no progress (ms)"
                        },
                        "continueOnFail": {
                          "type": "boolean",
                          "description": "If sending or waiting fails, keep going with the next action"
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card",
                    "config"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "input_prompt",
                      "description": "Pause the run and ask you to type a value."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "selectedVars"
                      ],
                      "properties": {
                        "title": {
                          "type": "string",
                          "description": "Window title"
                        },
                        "selectedVars": {
                          "type": "array",
                          "minItems": 1,
                          "items": {
                            "type": "object",
                            "required": [
                              "key"
                            ],
                            "additionalProperties": false,
                            "properties": {
                              "key": {
                                "type": "string"
                              },
                              "question": {
                                "type": "string"
                              },
                              "placeholder": {
                                "type": "string"
                              }
                            }
                          },
                          "description": "Variables to ask Keys declared in \"variables\"."
                        },
                        "inputStyle": {
                          "type": "string",
                          "enum": [
                            "form",
                            "inline"
                          ],
                          "description": "Ask as"
                        },
                        "alwaysAsk": {
                          "type": "boolean",
                          "description": "Ask even if the variable already has a value, so you can check a pre-filled or AI-drafted value before it's used."
                        },
                        "requireAnswer": {
                          "type": "boolean",
                          "description": "When on, you can't leave the answer empty. Use it when the action needs a value."
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card",
                    "config"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "ask_and_extract",
                      "description": "Ask the AI something and save the parts you name into variables."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "text",
                        "varsToExtract"
                      ],
                      "properties": {
                        "text": {
                          "type": "string",
                          "description": "Prompt May contain variable tokens written as <<var.key>>."
                        },
                        "preflight": {
                          "type": "boolean",
                          "description": "Before the run, show a form to fill in this prompt's <<var.key>> variables."
                        },
                        "inputStyle": {
                          "type": "string",
                          "enum": [
                            "form",
                            "inline"
                          ],
                          "description": "Ask as"
                        },
                        "varsToExtract": {
                          "type": "array",
                          "minItems": 1,
                          "items": {
                            "type": "object",
                            "required": [
                              "key"
                            ],
                            "additionalProperties": false,
                            "properties": {
                              "key": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string"
                              }
                            }
                          },
                          "description": "Variables to extract Keys declared in \"variables\"."
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card",
                    "config"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "extract_response",
                      "description": "Turn the AI's last answer here into JSON in a variable. It uses a temporary chat that stays in history outside ChatGPT."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "key",
                        "schema"
                      ],
                      "properties": {
                        "key": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9_]+$",
                          "description": "The variable to save the value in. A key declared in \"variables\"."
                        },
                        "schema": {
                          "type": "string",
                          "description": "The JSON shape the AI should return. e.g. {\"title\": \"Title\", \"tags\": [\"tag\"]}"
                        },
                        "promptSuffix": {
                          "type": "string",
                          "description": "Optional extra text appended to the extraction prompt."
                        },
                        "retries": {
                          "type": [
                            "number",
                            "string"
                          ],
                          "description": "How many times to ask again if the reply isn't valid JSON."
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card",
                    "config"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "validate",
                      "description": "Check that the reply has the right format and ask again if it doesn't. It checks format only, not content."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "rule"
                      ],
                      "properties": {
                        "source": {
                          "type": "string",
                          "enum": [
                            "last_assistant",
                            "var"
                          ],
                          "description": "The last reply, or a saved variable. A variable can only be checked, because asking again can't change a past value."
                        },
                        "key": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9_]+$",
                          "description": "Variable Only used when \"source\" is \"var\". A key declared in \"variables\"."
                        },
                        "rule": {
                          "type": "string",
                          "enum": [
                            "json",
                            "regex",
                            "non_empty",
                            "whipset"
                          ],
                          "description": "Valid JSON: the reply is JSON (you can require keys). Matches pattern: the reply matches a regular expression. Not empty: any non-blank reply. WhipWhip whipset JSON: a whipset the AI wrote; if it's wrong, the re-ask lists what to fix."
                        },
                        "pattern": {
                          "type": "string",
                          "description": "Pattern (regular expression) Only used when \"rule\" is \"regex\"."
                        },
                        "requiredKeys": {
                          "type": "string",
                          "description": "Comma-separated top-level keys that must exist. Only used when \"rule\" is \"json\"."
                        },
                        "retries": {
                          "type": [
                            "number",
                            "string"
                          ],
                          "description": "How many times to send a correction prompt before failing. 0 = check only."
                        },
                        "correction": {
                          "type": "string",
                          "description": "Sent when the format does not match. Leave empty for a default message. May contain variable tokens written as <<var.key>>."
                        },
                        "variable": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9_]+$",
                          "description": "Save result to A key declared in \"variables\"."
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card",
                    "config"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "send_to_services",
                      "description": "Send the same text to several AIs and collect the answers. You can also just send and tag, or read the tagged chats."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "servicesVar",
                        "text",
                        "key"
                      ],
                      "properties": {
                        "servicesVar": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9_]+$",
                          "description": "The variable with the list of AIs to send to. Usually filled by Ask to choose with the \"AI services\" source and Allow multiple on. A key declared in \"variables\"."
                        },
                        "text": {
                          "type": "string",
                          "description": "Sent as-is to every AI. You can use variables. May contain variable tokens written as <<var.key>>."
                        },
                        "tagPrefix": {
                          "type": "string",
                          "description": "If set, each AI's chat is tagged name_gpt, name_cla and so on, so you can follow up later. Up to 6 letters (Korean characters count as 2)."
                        },
                        "key": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9_]+$",
                          "description": "Each AI's answer (or why it failed), under its own heading. With Send and tag only, it holds just the reasons for AIs that couldn't be reached. A key declared in \"variables\"."
                        },
                        "mode": {
                          "type": "string",
                          "enum": [
                            "collect",
                            "send",
                            "read"
                          ],
                          "description": "Wait and collect: wait for every answer and save them in one variable. Send and tag only: send and stop; the answers stay in their tabs. Read the tagged chats: send nothing and read the latest answer in each tagged chat."
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card",
                    "config"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "var_save",
                      "description": "Save text from the message box, the AI's reply or the page into a variable."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "valueSource",
                        "key"
                      ],
                      "properties": {
                        "valueSource": {
                          "type": "string",
                          "description": "Where to read the value from. One of: builtin.date_today, builtin.date_iso, builtin.time_now, builtin.timestamp, builtin.day_of_week, builtin.page_url, builtin.page_title, builtin.page_domain, builtin.language, builtin.random_uuid, builtin.selection, composer, var.last.user, var.last.assistant, or \"var.<declared variable key>\"."
                        },
                        "key": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9_]+$",
                          "description": "The variable to save the value in. A key declared in \"variables\"."
                        },
                        "valueFilter": {
                          "type": "string",
                          "enum": [
                            "",
                            "code"
                          ],
                          "description": "What to keep Only used depending on \"valueSource\"."
                        },
                        "refuseIfEmpty": {
                          "type": "boolean",
                          "description": "If nothing was read, stop and say why instead of carrying on with an empty value. Only used depending on \"valueSource\"."
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "var_flush",
                      "description": "Clear variable values in this whipset. The variables stay, and lists, JSON objects and fixed values keep their contents."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {}
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card",
                    "config"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "append_item",
                      "description": "Add an item to a list variable (e.g. a new note to your collected notes)."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "key",
                        "fields"
                      ],
                      "properties": {
                        "key": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9_]+$",
                          "description": "The list variable to change. Its type must be List. A key declared in \"variables\"."
                        },
                        "fields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "name",
                              "value"
                            ],
                            "additionalProperties": false,
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string",
                                "description": "May contain variable tokens written as <<var.key>>."
                              }
                            }
                          },
                          "description": "Fields of the new item (name → value). Values can use <<var.x>>. Quotes and line breaks are handled for you. May contain variable tokens written as <<var.key>>."
                        },
                        "autoId": {
                          "type": "boolean",
                          "description": "Give each new item a numbered id when you don't set one yourself."
                        },
                        "idPrefix": {
                          "type": "string",
                          "description": "Text before the number, e.g. \"memo-\" gives memo-1, memo-2 … Only used when \"autoId\" is \"true\"."
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card",
                    "config"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "upsert_item",
                      "description": "Add an item to a list, or replace the item that has the same id."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "key",
                        "fields"
                      ],
                      "properties": {
                        "key": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9_]+$",
                          "description": "The list variable to change. Its type must be List. A key declared in \"variables\"."
                        },
                        "fields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "name",
                              "value"
                            ],
                            "additionalProperties": false,
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string",
                                "description": "May contain variable tokens written as <<var.key>>."
                              }
                            }
                          },
                          "description": "Fields of the item to add or replace. Include an \"id\" field. An item with the same id gets replaced. May contain variable tokens written as <<var.key>>."
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card",
                    "config"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "patch_item",
                      "description": "Change only some fields of the list item with a given id. Its other fields stay (e.g. set status to done)."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "key",
                        "itemId",
                        "fields"
                      ],
                      "properties": {
                        "key": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9_]+$",
                          "description": "The list variable to change. Its type must be List. A key declared in \"variables\"."
                        },
                        "itemId": {
                          "type": "string",
                          "description": "The id of the item to change. You can use <<var.x>>. May contain variable tokens written as <<var.key>>."
                        },
                        "fields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "name",
                              "value"
                            ],
                            "additionalProperties": false,
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string",
                                "description": "May contain variable tokens written as <<var.key>>."
                              }
                            }
                          },
                          "description": "Only these fields are updated; the item's other fields are kept. Values may use <<var.x>> tokens. May contain variable tokens written as <<var.key>>."
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card",
                    "config"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "remove_item",
                      "description": "Remove the item with a given id from a list."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "key",
                        "itemId"
                      ],
                      "properties": {
                        "key": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9_]+$",
                          "description": "The list variable to change. Its type must be List. A key declared in \"variables\"."
                        },
                        "itemId": {
                          "type": "string",
                          "description": "The \"id\" of the item to remove. Supports <<var.x>> tokens. May contain variable tokens written as <<var.key>>."
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card",
                    "config"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "derive_index",
                      "description": "Turn a list into text with one line per item, or just count the items."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "sourceKey",
                        "key"
                      ],
                      "properties": {
                        "sourceKey": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9_]+$",
                          "description": "The list to summarize. A key declared in \"variables\"."
                        },
                        "key": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9_]+$",
                          "description": "The variable that gets the summary text. A key declared in \"variables\"."
                        },
                        "mode": {
                          "type": "string",
                          "enum": [
                            "join",
                            "count"
                          ],
                          "description": "Summary text (default), or just the number of items left after filtering."
                        },
                        "itemTemplate": {
                          "type": "string",
                          "description": "Written once for each item, one per line. Use <<item.field>>, e.g. <<item.id>> — <<item.title>>. May contain list item tokens written as <<item.field>>. Required when used. Only used depending on \"mode\"."
                        },
                        "filterField": {
                          "type": "string",
                          "description": "Keep only items matching the value below. Leave blank to include all."
                        },
                        "filterOp": {
                          "type": "string",
                          "enum": [
                            "eq",
                            "ne"
                          ],
                          "description": "If an item doesn't have the field, it counts as empty. Only used depending on \"filterField\"."
                        },
                        "filterValue": {
                          "type": "string",
                          "description": "The value the filter field is compared against. Supports <<var.x>> tokens. May contain variable tokens written as <<var.key>>. Only used depending on \"filterField\"."
                        },
                        "sortField": {
                          "type": "string",
                          "description": "Sort by this field. Numbers sort correctly, so memo-2 comes before memo-10. Leave empty to keep the order items were added."
                        },
                        "sortDir": {
                          "type": "string",
                          "enum": [
                            "asc",
                            "desc"
                          ],
                          "description": "Sort direction Only used depending on \"sortField\"."
                        },
                        "limit": {
                          "type": [
                            "number",
                            "string"
                          ],
                          "description": "Keep at most this many items. Leave blank for all."
                        },
                        "limitFrom": {
                          "type": "string",
                          "enum": [
                            "end",
                            "start"
                          ],
                          "description": "Take from Only used depending on \"limit\"."
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "go_to_role",
                      "description": "Move to the conversation with this tag."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "tagName": {
                          "type": "string",
                          "description": "Tag A tag name declared in \"tags\"."
                        },
                        "tagCandidates": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Pick the tags this action can go to. Leave empty to always go to the tag above. It runs only when every picked tag is on a chat. Tag names declared in \"tags\"."
                        },
                        "tagVar": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9_]+$",
                          "description": "Variable that holds the tag to go to (e.g. from Ask to choose). Used only when possible tags are picked. A key declared in \"variables\"."
                        },
                        "closeCurrent": {
                          "type": "string",
                          "enum": [
                            "false",
                            "true"
                          ],
                          "description": "Close the tab you leave"
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "go_to_start",
                      "description": "Go back to the tab where the whip started, and close this one if you want. Useful after a side question."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "closeCurrent": {
                          "type": "string",
                          "enum": [
                            "true",
                            "false"
                          ],
                          "description": "Close the tab you leave"
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "new_chat",
                      "description": "Open a new conversation on the current service."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "isTemp": {
                          "type": "string",
                          "enum": [
                            "false",
                            "true"
                          ],
                          "description": "Temporary chat"
                        },
                        "openMode": {
                          "type": "string",
                          "enum": [
                            "current",
                            "new_tab",
                            "background"
                          ],
                          "description": "Open in"
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card",
                    "config"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "open_service",
                      "description": "Switch to a different AI service (ChatGPT, Gemini, Claude…)."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "service"
                      ],
                      "properties": {
                        "service": {
                          "type": "string",
                          "enum": [
                            "chatgpt",
                            "gemini",
                            "claude",
                            "grok",
                            "perplexity"
                          ],
                          "description": "Service"
                        },
                        "openMode": {
                          "type": "string",
                          "enum": [
                            "current",
                            "new_tab",
                            "background"
                          ],
                          "description": "Open in"
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card",
                    "config"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "open_url",
                      "description": "Open any https:// web address. Use it as the last action, because the whip stops there."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "target"
                      ],
                      "properties": {
                        "target": {
                          "type": "string",
                          "description": "URL"
                        },
                        "openMode": {
                          "type": "string",
                          "enum": [
                            "current",
                            "new_tab",
                            "background"
                          ],
                          "description": "Open in"
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card",
                    "config"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "tag_current_chat",
                      "description": "Tag this chat so other whips can come back to it."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "tagName"
                      ],
                      "properties": {
                        "tagName": {
                          "type": "string",
                          "description": "Tag name A tag name declared in \"tags\"."
                        },
                        "runOnly": {
                          "type": "boolean",
                          "description": "Remove the tag when the run ends. The chat stays in the workspace list."
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card",
                    "config"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "choice_prompt",
                      "description": "Show a list of options and save the pick in a variable."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "key"
                      ],
                      "properties": {
                        "label": {
                          "type": "string",
                          "description": "Question May contain variable tokens written as <<var.key>>."
                        },
                        "optionsSource": {
                          "type": "string",
                          "enum": [
                            "static",
                            "variable",
                            "services"
                          ],
                          "description": "Where to get the choice options from. \"AI services\" fills in ChatGPT, Claude, Gemini, Grok and Perplexity."
                        },
                        "options": {
                          "type": "string",
                          "description": "Each line becomes a button. The chosen line is saved to the variable. Required when used. Only used depending on \"optionsSource\"."
                        },
                        "dynamicOptionsVar": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9_]+$",
                          "description": "The variable that holds the options, one per line. Required when used. Only used when \"optionsSource\" is \"variable\". A key declared in \"variables\"."
                        },
                        "optionLabel": {
                          "type": "string",
                          "description": "What each option shows. Use <<item.field>>, e.g. <<item.id>> — <<item.title>>. May contain list item tokens written as <<item.field>>. Only used when \"optionsSource\" is \"variable\"."
                        },
                        "optionValueField": {
                          "type": "string",
                          "description": "Which item field is saved as the pick (default \"id\"). Use it as the item id in a later Edit list item fields or Remove from list action. Only used when \"optionsSource\" is \"variable\"."
                        },
                        "filterField": {
                          "type": "string",
                          "description": "Offer only items whose field matches the value below. Leave blank to offer all. Applies to list variables only. Only used when \"optionsSource\" is \"variable\"."
                        },
                        "filterOp": {
                          "type": "string",
                          "enum": [
                            "eq",
                            "ne"
                          ],
                          "description": "If an item doesn't have the field, it counts as empty. Only used depending on \"filterField\"."
                        },
                        "filterValue": {
                          "type": "string",
                          "description": "The value the filter field is compared against. Supports <<var.x>> tokens. May contain variable tokens written as <<var.key>>. Only used depending on \"filterField\"."
                        },
                        "multiple": {
                          "type": "boolean",
                          "description": "Show a checklist; on OK the checked values are saved as a list."
                        },
                        "lockCurrentService": {
                          "type": "boolean",
                          "description": "With Allow multiple on, the AI in the tab that ran the whip is marked \"current tab\" and stays checked. Only used when \"optionsSource\" is \"services\" and \"multiple\" is \"true\"."
                        },
                        "warnInConversation": {
                          "type": "boolean",
                          "description": "With Allow multiple on, show a note when this tab already has a conversation, since only this tab's AI sees that context. Only used when \"optionsSource\" is \"services\" and \"multiple\" is \"true\"."
                        },
                        "continueGroup": {
                          "type": "string",
                          "description": "With Allow multiple on, if this tab is in that tag group, add a \"Follow up\" row at the top (on by default) and pre-check those AIs. Use the same group tag name as in Send to several AIs. Only used when \"optionsSource\" is \"services\" and \"multiple\" is \"true\"."
                        },
                        "rememberAs": {
                          "type": "string",
                          "description": "Give a name to remember this pick and pre-check it next run. The same memory is used from any tab or workspace. Only used when \"multiple\" is \"true\"."
                        },
                        "key": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9_]+$",
                          "description": "The variable the chosen option is saved in. A key declared in \"variables\"."
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card",
                    "config"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "show_result_modal",
                      "description": "Show a window with your results, filled in from variables."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "body"
                      ],
                      "properties": {
                        "title": {
                          "type": "string",
                          "description": "Title May contain variable tokens written as <<var.key>>."
                        },
                        "body": {
                          "type": "string",
                          "description": "Body May contain variable tokens written as <<var.key>>."
                        },
                        "copyButton": {
                          "type": "string",
                          "enum": [
                            "none",
                            "copy_body"
                          ],
                          "description": "Copy button"
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "required": [
                    "card",
                    "config"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "card": {
                      "const": "import_whipset",
                      "description": "Add a whipset the AI wrote, from JSON saved in a variable. You review it in a preview before anything is saved."
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "key"
                      ],
                      "properties": {
                        "key": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9_]+$",
                          "description": "Usually the variable saved by an earlier Validate action (whipset rule). A key declared in \"variables\"."
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      }
    }
  }
}
