{
  "openapi": "3.1.1",
  "info": {
    "title": "ax-code",
    "description": "ax-code api",
    "version": "1.0.0"
  },
  "paths": {
    "/global/runtime": {
      "get": {
        "operationId": "global.runtime",
        "summary": "Get managed runtime identity",
        "responses": {
          "200": {
            "description": "Managed runtime identity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "number",
                      "const": 1
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "pid": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "host": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "startedAt": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "id",
                    "directory",
                    "pid",
                    "host",
                    "version",
                    "startedAt"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.global.runtime({\n  ...\n})"
          }
        ]
      }
    },
    "/global/runtime/stop": {
      "post": {
        "operationId": "global.runtimeStop",
        "summary": "Stop an identified managed runtime",
        "responses": {
          "200": {
            "description": "Runtime shutdown accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  }
                },
                "required": [
                  "id"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.global.runtimeStop({\n  ...\n})"
          }
        ]
      }
    },
    "/global/health": {
      "get": {
        "operationId": "global.health",
        "summary": "Get health",
        "description": "Get health information about the ax-code server.",
        "responses": {
          "200": {
            "description": "Health information",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "healthy": {
                      "type": "boolean",
                      "const": true
                    },
                    "version": {
                      "type": "string"
                    },
                    "startup": {
                      "type": "object",
                      "properties": {
                        "startedAt": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "uptimeMs": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "checkedAt": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "startedAt",
                        "uptimeMs",
                        "checkedAt"
                      ]
                    },
                    "readiness": {
                      "type": "object",
                      "properties": {
                        "processAlive": {
                          "type": "boolean",
                          "const": true
                        },
                        "apiReady": {
                          "type": "boolean",
                          "const": true
                        },
                        "providersReady": {
                          "type": "string",
                          "enum": [
                            "ready",
                            "degraded",
                            "unknown"
                          ]
                        },
                        "indexReady": {
                          "type": "string",
                          "enum": [
                            "ready",
                            "degraded",
                            "unknown"
                          ]
                        }
                      },
                      "required": [
                        "processAlive",
                        "apiReady",
                        "providersReady",
                        "indexReady"
                      ]
                    },
                    "runtime": {
                      "type": "object",
                      "properties": {
                        "directory": {
                          "type": "string"
                        },
                        "services": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "state": {
                                "type": "string",
                                "enum": [
                                  "idle",
                                  "starting",
                                  "running",
                                  "stopping",
                                  "stopped",
                                  "failed"
                                ],
                                "description": "Lifecycle state for a runtime service"
                              },
                              "pendingTasks": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "startedAt": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "stoppedAt": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "lastError": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "name",
                              "state",
                              "pendingTasks"
                            ]
                          }
                        },
                        "taskSummary": {
                          "type": "object",
                          "properties": {
                            "queued": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "running": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "completed": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "failed": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "aborted": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "queued",
                            "running",
                            "completed",
                            "failed",
                            "aborted"
                          ]
                        }
                      },
                      "required": [
                        "directory",
                        "services",
                        "taskSummary"
                      ]
                    }
                  },
                  "required": [
                    "healthy",
                    "version",
                    "startup",
                    "readiness",
                    "runtime"
                  ]
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.global.health({\n  ...\n})"
          }
        ]
      }
    },
    "/global/capabilities": {
      "get": {
        "operationId": "global.capabilities",
        "summary": "Get runtime capabilities",
        "description": "Get stable runtime capability metadata for desktop and app integrations. This endpoint describes supported API contracts; use /capability for user-facing commands, skills, agents, and workflows.",
        "responses": {
          "200": {
            "description": "Runtime capability metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "number",
                      "const": 1
                    },
                    "product": {
                      "type": "string",
                      "const": "ax-code"
                    },
                    "version": {
                      "type": "string"
                    },
                    "compatibility": {
                      "type": "object",
                      "properties": {
                        "minDesktopVersion": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "sdkHeadless": {
                          "type": "object",
                          "properties": {
                            "schemaVersion": {
                              "type": "number",
                              "const": 1
                            },
                            "supportsManagedLifecycle": {
                              "type": "boolean",
                              "const": true
                            },
                            "supportsExplicitBinary": {
                              "type": "boolean",
                              "const": true
                            },
                            "supportsExplicitArgs": {
                              "type": "boolean",
                              "const": true
                            },
                            "supportsStructuredDiagnostics": {
                              "type": "boolean",
                              "const": true
                            },
                            "authSchemes": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "const": "basic"
                              }
                            },
                            "defaultTransport": {
                              "type": "string",
                              "const": "http-sse"
                            }
                          },
                          "required": [
                            "schemaVersion",
                            "supportsManagedLifecycle",
                            "supportsExplicitBinary",
                            "supportsExplicitArgs",
                            "supportsStructuredDiagnostics",
                            "authSchemes",
                            "defaultTransport"
                          ]
                        }
                      },
                      "required": [
                        "minDesktopVersion",
                        "sdkHeadless"
                      ]
                    },
                    "endpoints": {
                      "type": "object",
                      "properties": {
                        "health": {
                          "type": "string",
                          "const": "/global/health"
                        },
                        "events": {
                          "type": "string",
                          "const": "/global/event"
                        },
                        "config": {
                          "type": "string",
                          "const": "/global/config"
                        },
                        "capabilityCatalog": {
                          "type": "string",
                          "const": "/capability"
                        },
                        "fileSearch": {
                          "type": "string",
                          "const": "/find/file"
                        },
                        "sessions": {
                          "type": "string",
                          "const": "/session"
                        },
                        "providers": {
                          "type": "string",
                          "const": "/config/providers"
                        },
                        "agents": {
                          "type": "string",
                          "const": "/agent"
                        }
                      },
                      "required": [
                        "health",
                        "events",
                        "config",
                        "capabilityCatalog",
                        "fileSearch",
                        "sessions",
                        "providers",
                        "agents"
                      ]
                    },
                    "features": {
                      "type": "object",
                      "properties": {
                        "sessions": {
                          "type": "boolean",
                          "const": true
                        },
                        "asyncPrompt": {
                          "type": "boolean",
                          "const": true
                        },
                        "globalEvents": {
                          "type": "boolean",
                          "const": true
                        },
                        "fileSearch": {
                          "type": "boolean",
                          "const": true
                        },
                        "skills": {
                          "type": "boolean",
                          "const": true
                        },
                        "plugins": {
                          "type": "boolean",
                          "const": true
                        },
                        "mcp": {
                          "type": "boolean",
                          "const": true
                        },
                        "worktrees": {
                          "type": "boolean",
                          "const": true
                        },
                        "providerManagement": {
                          "type": "boolean",
                          "const": true
                        },
                        "usage": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "sessions",
                        "asyncPrompt",
                        "globalEvents",
                        "fileSearch",
                        "skills",
                        "plugins",
                        "mcp",
                        "worktrees",
                        "providerManagement",
                        "usage"
                      ]
                    },
                    "events": {
                      "type": "object",
                      "properties": {
                        "heartbeat": {
                          "type": "string",
                          "const": "server.heartbeat"
                        },
                        "connected": {
                          "type": "string",
                          "const": "server.connected"
                        },
                        "resyncRequired": {
                          "type": "string",
                          "const": "server.resync_required"
                        },
                        "sessionCreated": {
                          "type": "string",
                          "const": "session.created"
                        },
                        "sessionStatus": {
                          "type": "string",
                          "const": "session.status"
                        },
                        "sessionError": {
                          "type": "string",
                          "const": "session.error"
                        },
                        "permission": {
                          "type": "string",
                          "const": "permission"
                        },
                        "question": {
                          "type": "string",
                          "const": "question"
                        }
                      },
                      "required": [
                        "heartbeat",
                        "connected",
                        "resyncRequired",
                        "sessionCreated",
                        "sessionStatus",
                        "sessionError",
                        "permission",
                        "question"
                      ]
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "product",
                    "version",
                    "compatibility",
                    "endpoints",
                    "features",
                    "events"
                  ]
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.global.capabilities({\n  ...\n})"
          }
        ]
      }
    },
    "/global/event": {
      "get": {
        "operationId": "global.event",
        "summary": "Get global events",
        "description": "Subscribe to global events from the ax-code system using server-sent events.",
        "responses": {
          "200": {
            "description": "Event stream",
            "content": {
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/GlobalEvent"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.global.event({\n  ...\n})"
          }
        ]
      }
    },
    "/global/config": {
      "get": {
        "operationId": "global.config.get",
        "summary": "Get global configuration",
        "description": "Retrieve the current global ax-code configuration settings and preferences.",
        "responses": {
          "200": {
            "description": "Get global config info",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Config"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.global.config.get({\n  ...\n})"
          }
        ]
      },
      "patch": {
        "operationId": "global.config.update",
        "summary": "Update global configuration",
        "description": "Update global ax-code configuration settings and preferences.",
        "responses": {
          "200": {
            "description": "Successfully updated global config",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Config"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Config"
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.global.config.update({\n  ...\n})"
          }
        ]
      }
    },
    "/global/dispose": {
      "post": {
        "operationId": "global.dispose",
        "summary": "Dispose instance",
        "description": "Clean up and dispose all ax-code instances, releasing all resources.",
        "responses": {
          "200": {
            "description": "Global disposed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.global.dispose({\n  ...\n})"
          }
        ]
      }
    },
    "/global/upgrade": {
      "post": {
        "operationId": "global.upgrade",
        "summary": "Upgrade ax-code",
        "description": "Upgrade ax-code to the specified version or latest if not specified.",
        "responses": {
          "200": {
            "description": "Upgrade result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    },
                    "version": {
                      "type": "string"
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "success",
                    "version"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "target": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.global.upgrade({\n  ...\n})"
          }
        ]
      }
    },
    "/auth/{providerID}": {
      "put": {
        "operationId": "auth.set",
        "summary": "Set auth credentials",
        "description": "Set authentication credentials",
        "responses": {
          "200": {
            "description": "Successfully set authentication credentials",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "providerID",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Provider ID"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Auth"
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.auth.set({\n  ...\n})"
          }
        ]
      },
      "delete": {
        "operationId": "auth.remove",
        "summary": "Remove auth credentials",
        "description": "Remove authentication credentials",
        "responses": {
          "200": {
            "description": "Successfully removed authentication credentials",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "providerID",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Provider ID"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.auth.remove({\n  ...\n})"
          }
        ]
      }
    },
    "/project": {
      "get": {
        "operationId": "project.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "List all projects",
        "description": "Get a list of projects that have been opened with ax-code.",
        "responses": {
          "200": {
            "description": "List of projects",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Project"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.project.list({\n  ...\n})"
          }
        ]
      }
    },
    "/project/current": {
      "get": {
        "operationId": "project.current",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get current project",
        "description": "Retrieve the currently active project that ax-code is working with.",
        "responses": {
          "200": {
            "description": "Current project information",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Project"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.project.current({\n  ...\n})"
          }
        ]
      }
    },
    "/project/git/init": {
      "post": {
        "operationId": "project.initGit",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Initialize git repository",
        "description": "Create a git repository for the current project and return the refreshed project info.",
        "responses": {
          "200": {
            "description": "Project information after git initialization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Project"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.project.initGit({\n  ...\n})"
          }
        ]
      }
    },
    "/project/{projectID}": {
      "patch": {
        "operationId": "project.update",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "projectID",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "summary": "Update project",
        "description": "Update project properties such as name, icon, and commands.",
        "responses": {
          "200": {
            "description": "Updated project information",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Project"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "icon": {
                    "type": "object",
                    "properties": {
                      "url": {
                        "type": "string"
                      },
                      "override": {
                        "type": "string"
                      },
                      "color": {
                        "type": "string"
                      }
                    }
                  },
                  "commands": {
                    "type": "object",
                    "properties": {
                      "start": {
                        "description": "Startup script to run when creating a new workspace (worktree)",
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.project.update({\n  ...\n})"
          }
        ]
      }
    },
    "/pty": {
      "get": {
        "operationId": "pty.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "List PTY sessions",
        "description": "Get a list of all active pseudo-terminal (PTY) sessions managed by ax-code.",
        "responses": {
          "200": {
            "description": "List of sessions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Pty"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.pty.list({\n  ...\n})"
          }
        ]
      },
      "post": {
        "operationId": "pty.create",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Create PTY session",
        "description": "Create a new pseudo-terminal (PTY) session for running shell commands and processes.",
        "responses": {
          "200": {
            "description": "Created session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pty"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "command": {
                    "type": "string"
                  },
                  "args": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "cwd": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "env": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.pty.create({\n  ...\n})"
          }
        ]
      }
    },
    "/pty/{ptyID}": {
      "get": {
        "operationId": "pty.get",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "ptyID",
            "schema": {
              "type": "string",
              "pattern": "^pty_.*"
            },
            "required": true
          }
        ],
        "summary": "Get PTY session",
        "description": "Retrieve detailed information about a specific pseudo-terminal (PTY) session.",
        "responses": {
          "200": {
            "description": "Session info",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pty"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.pty.get({\n  ...\n})"
          }
        ]
      },
      "put": {
        "operationId": "pty.update",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "ptyID",
            "schema": {
              "type": "string",
              "pattern": "^pty_.*"
            },
            "required": true
          }
        ],
        "summary": "Update PTY session",
        "description": "Update properties of an existing pseudo-terminal (PTY) session.",
        "responses": {
          "200": {
            "description": "Updated session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pty"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "size": {
                    "type": "object",
                    "properties": {
                      "rows": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 1000
                      },
                      "cols": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 1000
                      }
                    },
                    "required": [
                      "rows",
                      "cols"
                    ]
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.pty.update({\n  ...\n})"
          }
        ]
      },
      "delete": {
        "operationId": "pty.remove",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "ptyID",
            "schema": {
              "type": "string",
              "pattern": "^pty_.*"
            },
            "required": true
          }
        ],
        "summary": "Remove PTY session",
        "description": "Remove and terminate a specific pseudo-terminal (PTY) session.",
        "responses": {
          "200": {
            "description": "Session removed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.pty.remove({\n  ...\n})"
          }
        ]
      }
    },
    "/pty/{ptyID}/connect": {
      "get": {
        "operationId": "pty.connect",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "ptyID",
            "schema": {
              "type": "string",
              "pattern": "^pty_.*"
            },
            "required": true
          }
        ],
        "summary": "Connect to PTY session",
        "description": "Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.",
        "responses": {
          "200": {
            "description": "Connected session",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.pty.connect({\n  ...\n})"
          }
        ]
      }
    },
    "/config": {
      "get": {
        "operationId": "config.get",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get configuration",
        "description": "Retrieve the current ax-code configuration settings and preferences.",
        "responses": {
          "200": {
            "description": "Get config info",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Config"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.config.get({\n  ...\n})"
          }
        ]
      },
      "patch": {
        "operationId": "config.update",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Update configuration",
        "description": "Update ax-code configuration settings and preferences.",
        "responses": {
          "200": {
            "description": "Successfully updated config",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Config"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Config"
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.config.update({\n  ...\n})"
          }
        ]
      }
    },
    "/config/providers": {
      "get": {
        "operationId": "config.providers",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "List config providers",
        "description": "Get a list of all configured AI providers and their default models.",
        "responses": {
          "200": {
            "description": "List of providers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "providers": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Provider"
                      }
                    },
                    "default": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "providers",
                    "default"
                  ]
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.config.providers({\n  ...\n})"
          }
        ]
      }
    },
    "/isolation": {
      "get": {
        "operationId": "isolation.get",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get resolved isolation state",
        "description": "Returns the effective isolation mode after resolving CLI flags, environment variables, and config file settings.",
        "responses": {
          "200": {
            "description": "Resolved isolation state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IsolationState"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.isolation.get({\n  ...\n})"
          }
        ]
      },
      "put": {
        "operationId": "isolation.set",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Set isolation mode",
        "description": "Persist the project isolation mode and return the effective state. An existing CLI or environment override remains authoritative.",
        "responses": {
          "200": {
            "description": "Updated isolation state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IsolationState"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "read-only",
                      "workspace-write",
                      "full-access"
                    ]
                  },
                  "network": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "mode"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.isolation.set({\n  ...\n})"
          }
        ]
      }
    },
    "/autonomous": {
      "get": {
        "operationId": "autonomous.get",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get autonomous mode state",
        "description": "Returns whether autonomous mode is enabled.",
        "responses": {
          "200": {
            "description": "Autonomous mode state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutonomousState"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.autonomous.get({\n  ...\n})"
          }
        ]
      },
      "put": {
        "operationId": "autonomous.set",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Set autonomous mode",
        "description": "Toggle autonomous mode on or off. Persists to ax-code.json.",
        "responses": {
          "200": {
            "description": "Updated autonomous state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutonomousState"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "enabled"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.autonomous.set({\n  ...\n})"
          }
        ]
      }
    },
    "/smart-llm": {
      "get": {
        "operationId": "smartLlm.get",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get smart LLM routing state",
        "description": "Returns whether LLM-based agent routing is enabled.",
        "responses": {
          "200": {
            "description": "Smart LLM routing state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SmartLlmState"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.smartLlm.get({\n  ...\n})"
          }
        ]
      },
      "put": {
        "operationId": "smartLlm.set",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Set smart LLM routing",
        "description": "Toggle LLM-based agent routing on or off. Persists to ax-code.json.",
        "responses": {
          "200": {
            "description": "Updated smart LLM routing state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SmartLlmState"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "enabled"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.smartLlm.set({\n  ...\n})"
          }
        ]
      }
    },
    "/super-long": {
      "get": {
        "operationId": "superLong.get",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get Super-Long mode state",
        "description": "Returns whether Super-Long mode is enabled.",
        "responses": {
          "200": {
            "description": "Super-Long mode state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuperLongState"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.superLong.get({\n  ...\n})"
          }
        ]
      },
      "put": {
        "operationId": "superLong.set",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Set Super-Long mode",
        "description": "Toggle Super-Long mode on or off. Persists to ax-code.json.",
        "responses": {
          "200": {
            "description": "Updated Super-Long state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuperLongState"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "enabled"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.superLong.set({\n  ...\n})"
          }
        ]
      }
    },
    "/super-long/status": {
      "get": {
        "operationId": "superLong.status",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "model",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            }
          }
        ],
        "summary": "Get Super-Long run status",
        "description": "Returns the resolved Super-Long state plus run timing: durable run start, elapsed time, and time remaining before the runtime ceiling. Pass sessionID to include per-session timing.",
        "responses": {
          "200": {
            "description": "Super-Long run status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuperLongStatus"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.superLong.status({\n  ...\n})"
          }
        ]
      }
    },
    "/prompt-history": {
      "get": {
        "operationId": "promptHistory.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 50
            }
          }
        ],
        "summary": "List prompt history",
        "description": "Return prompt recall history scoped to the current project.",
        "responses": {
          "200": {
            "description": "Project-scoped prompt history entries.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "input": {
                        "type": "string"
                      },
                      "mode": {
                        "type": "string",
                        "enum": [
                          "normal",
                          "shell"
                        ]
                      },
                      "parts": {
                        "default": [],
                        "type": "array",
                        "items": {
                          "allOf": [
                            {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "type"
                              ]
                            }
                          ]
                        }
                      }
                    },
                    "required": [
                      "input"
                    ],
                    "additionalProperties": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.promptHistory.list({\n  ...\n})"
          }
        ]
      },
      "post": {
        "operationId": "promptHistory.append",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Append prompt history",
        "description": "Append one prompt recall entry to the current project history.",
        "responses": {
          "200": {
            "description": "Stored prompt history entry.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "input": {
                      "type": "string"
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "normal",
                        "shell"
                      ]
                    },
                    "parts": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "allOf": [
                          {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type"
                            ]
                          }
                        ]
                      }
                    }
                  },
                  "required": [
                    "input"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "type": "string"
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "normal",
                      "shell"
                    ]
                  },
                  "parts": {
                    "default": [],
                    "type": "array",
                    "items": {
                      "allOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ]
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "input"
                ],
                "additionalProperties": {}
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.promptHistory.append({\n  ...\n})"
          }
        ]
      }
    },
    "/task-queue": {
      "get": {
        "operationId": "taskQueue.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "waiting_for_idle",
                "running",
                "blocked_permission",
                "blocked_question",
                "paused",
                "failed",
                "completed",
                "cancelled"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 500
            }
          }
        ],
        "summary": "List task queue items",
        "description": "Return server-owned task queue items scoped to the current project.",
        "responses": {
          "200": {
            "description": "Project-scoped task queue items.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^tsk_.*"
                      },
                      "projectID": {
                        "type": "string"
                      },
                      "directory": {
                        "type": "string"
                      },
                      "sessionID": {
                        "type": "string",
                        "pattern": "^ses_.*"
                      },
                      "kind": {
                        "type": "string",
                        "enum": [
                          "prompt",
                          "command",
                          "shell",
                          "followup",
                          "subagent",
                          "automation"
                        ]
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "queued",
                          "waiting_for_idle",
                          "running",
                          "blocked_permission",
                          "blocked_question",
                          "paused",
                          "failed",
                          "completed",
                          "cancelled"
                        ]
                      },
                      "priority": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "position": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "title": {
                        "type": "string"
                      },
                      "agent": {
                        "type": "string"
                      },
                      "model": {},
                      "sourceMessageID": {
                        "type": "string"
                      },
                      "sourceTaskID": {
                        "type": "string"
                      },
                      "payload": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "error": {
                        "type": "string"
                      },
                      "executionTimeoutMs": {
                        "type": "integer",
                        "minimum": 1000,
                        "maximum": 259200000
                      },
                      "time": {
                        "type": "object",
                        "properties": {
                          "created": {
                            "type": "number"
                          },
                          "updated": {
                            "type": "number"
                          },
                          "started": {
                            "type": "number"
                          },
                          "completed": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "created"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "projectID",
                      "directory",
                      "kind",
                      "status",
                      "priority",
                      "position",
                      "title",
                      "payload",
                      "time"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.taskQueue.list({\n  ...\n})"
          }
        ]
      },
      "post": {
        "operationId": "taskQueue.enqueue",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Enqueue task",
        "description": "Add a durable server-owned task queue item for the current project.",
        "responses": {
          "200": {
            "description": "Created task queue item.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^tsk_.*"
                    },
                    "projectID": {
                      "type": "string"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "sessionID": {
                      "type": "string",
                      "pattern": "^ses_.*"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "prompt",
                        "command",
                        "shell",
                        "followup",
                        "subagent",
                        "automation"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "waiting_for_idle",
                        "running",
                        "blocked_permission",
                        "blocked_question",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "priority": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "position": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "title": {
                      "type": "string"
                    },
                    "agent": {
                      "type": "string"
                    },
                    "model": {},
                    "sourceMessageID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "payload": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "error": {
                      "type": "string"
                    },
                    "executionTimeoutMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 259200000
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "kind",
                    "status",
                    "priority",
                    "position",
                    "title",
                    "payload",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sessionID": {
                    "type": "string",
                    "pattern": "^ses_.*"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "prompt",
                      "command",
                      "shell",
                      "followup",
                      "subagent",
                      "automation"
                    ]
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "agent": {
                    "type": "string"
                  },
                  "model": {},
                  "sourceMessageID": {
                    "type": "string"
                  },
                  "sourceTaskID": {
                    "type": "string"
                  },
                  "payload": {
                    "default": {},
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "priority": {
                    "type": "integer",
                    "minimum": -1000,
                    "maximum": 1000
                  },
                  "executionTimeoutMs": {
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 259200000
                  }
                },
                "required": [
                  "kind",
                  "title"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.taskQueue.enqueue({\n  ...\n})"
          }
        ]
      }
    },
    "/task-queue/{taskID}": {
      "get": {
        "operationId": "taskQueue.get",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "taskID",
            "schema": {
              "type": "string",
              "pattern": "^tsk_.*"
            },
            "required": true
          }
        ],
        "summary": "Get task queue item",
        "description": "Return a single task queue item scoped to the current project.",
        "responses": {
          "200": {
            "description": "Task queue item.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^tsk_.*"
                    },
                    "projectID": {
                      "type": "string"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "sessionID": {
                      "type": "string",
                      "pattern": "^ses_.*"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "prompt",
                        "command",
                        "shell",
                        "followup",
                        "subagent",
                        "automation"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "waiting_for_idle",
                        "running",
                        "blocked_permission",
                        "blocked_question",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "priority": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "position": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "title": {
                      "type": "string"
                    },
                    "agent": {
                      "type": "string"
                    },
                    "model": {},
                    "sourceMessageID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "payload": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "error": {
                      "type": "string"
                    },
                    "executionTimeoutMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 259200000
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "kind",
                    "status",
                    "priority",
                    "position",
                    "title",
                    "payload",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.taskQueue.get({\n  ...\n})"
          }
        ]
      },
      "delete": {
        "operationId": "taskQueue.delete",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "taskID",
            "schema": {
              "type": "string",
              "pattern": "^tsk_.*"
            },
            "required": true
          }
        ],
        "summary": "Remove task queue item",
        "description": "Delete a task queue item from the current project queue.",
        "responses": {
          "200": {
            "description": "Task queue item deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.taskQueue.delete({\n  ...\n})"
          }
        ]
      }
    },
    "/task-queue/{taskID}/status": {
      "post": {
        "operationId": "taskQueue.status",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "taskID",
            "schema": {
              "type": "string",
              "pattern": "^tsk_.*"
            },
            "required": true
          },
          {
            "in": "header",
            "name": "x-ax-code-internal-task-queue-lifecycle",
            "schema": {
              "type": "string",
              "const": "1"
            },
            "required": true
          }
        ],
        "summary": "Update task queue status",
        "description": "Internal lifecycle hook for server-owned queue execution. App clients should use action routes instead.",
        "responses": {
          "200": {
            "description": "Updated task queue item.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^tsk_.*"
                    },
                    "projectID": {
                      "type": "string"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "sessionID": {
                      "type": "string",
                      "pattern": "^ses_.*"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "prompt",
                        "command",
                        "shell",
                        "followup",
                        "subagent",
                        "automation"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "waiting_for_idle",
                        "running",
                        "blocked_permission",
                        "blocked_question",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "priority": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "position": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "title": {
                      "type": "string"
                    },
                    "agent": {
                      "type": "string"
                    },
                    "model": {},
                    "sourceMessageID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "payload": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "error": {
                      "type": "string"
                    },
                    "executionTimeoutMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 259200000
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "kind",
                    "status",
                    "priority",
                    "position",
                    "title",
                    "payload",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "queued",
                      "waiting_for_idle",
                      "running",
                      "blocked_permission",
                      "blocked_question",
                      "paused",
                      "failed",
                      "completed",
                      "cancelled"
                    ]
                  },
                  "error": {
                    "type": "string"
                  }
                },
                "required": [
                  "status"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.taskQueue.status({\n  ...\n})"
          }
        ]
      }
    },
    "/task-queue/{taskID}/edit": {
      "post": {
        "operationId": "taskQueue.edit",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "taskID",
            "schema": {
              "type": "string",
              "pattern": "^tsk_.*"
            },
            "required": true
          }
        ],
        "summary": "Edit queued task",
        "description": "Edit mutable task queue fields before the task is actively running or completed.",
        "responses": {
          "200": {
            "description": "Edited task queue item.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^tsk_.*"
                    },
                    "projectID": {
                      "type": "string"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "sessionID": {
                      "type": "string",
                      "pattern": "^ses_.*"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "prompt",
                        "command",
                        "shell",
                        "followup",
                        "subagent",
                        "automation"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "waiting_for_idle",
                        "running",
                        "blocked_permission",
                        "blocked_question",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "priority": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "position": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "title": {
                      "type": "string"
                    },
                    "agent": {
                      "type": "string"
                    },
                    "model": {},
                    "sourceMessageID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "payload": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "error": {
                      "type": "string"
                    },
                    "executionTimeoutMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 259200000
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "kind",
                    "status",
                    "priority",
                    "position",
                    "title",
                    "payload",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedUpdatedAt": {
                    "type": "number"
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "agent": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "model": {},
                  "payload": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "priority": {
                    "type": "integer",
                    "minimum": -1000,
                    "maximum": 1000
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.taskQueue.edit({\n  ...\n})"
          }
        ]
      }
    },
    "/task-queue/{taskID}/pause": {
      "post": {
        "operationId": "taskQueue.pause",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "taskID",
            "schema": {
              "type": "string",
              "pattern": "^tsk_.*"
            },
            "required": true
          }
        ],
        "summary": "Pause queued task",
        "description": "Mark a task queue item as paused.",
        "responses": {
          "200": {
            "description": "Paused task queue item.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^tsk_.*"
                    },
                    "projectID": {
                      "type": "string"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "sessionID": {
                      "type": "string",
                      "pattern": "^ses_.*"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "prompt",
                        "command",
                        "shell",
                        "followup",
                        "subagent",
                        "automation"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "waiting_for_idle",
                        "running",
                        "blocked_permission",
                        "blocked_question",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "priority": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "position": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "title": {
                      "type": "string"
                    },
                    "agent": {
                      "type": "string"
                    },
                    "model": {},
                    "sourceMessageID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "payload": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "error": {
                      "type": "string"
                    },
                    "executionTimeoutMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 259200000
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "kind",
                    "status",
                    "priority",
                    "position",
                    "title",
                    "payload",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.taskQueue.pause({\n  ...\n})"
          }
        ]
      }
    },
    "/task-queue/{taskID}/resume": {
      "post": {
        "operationId": "taskQueue.resume",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "taskID",
            "schema": {
              "type": "string",
              "pattern": "^tsk_.*"
            },
            "required": true
          }
        ],
        "summary": "Resume paused task",
        "description": "Return a paused task queue item to queued state.",
        "responses": {
          "200": {
            "description": "Resumed task queue item.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^tsk_.*"
                    },
                    "projectID": {
                      "type": "string"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "sessionID": {
                      "type": "string",
                      "pattern": "^ses_.*"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "prompt",
                        "command",
                        "shell",
                        "followup",
                        "subagent",
                        "automation"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "waiting_for_idle",
                        "running",
                        "blocked_permission",
                        "blocked_question",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "priority": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "position": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "title": {
                      "type": "string"
                    },
                    "agent": {
                      "type": "string"
                    },
                    "model": {},
                    "sourceMessageID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "payload": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "error": {
                      "type": "string"
                    },
                    "executionTimeoutMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 259200000
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "kind",
                    "status",
                    "priority",
                    "position",
                    "title",
                    "payload",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.taskQueue.resume({\n  ...\n})"
          }
        ]
      }
    },
    "/task-queue/{taskID}/cancel": {
      "post": {
        "operationId": "taskQueue.cancel",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "taskID",
            "schema": {
              "type": "string",
              "pattern": "^tsk_.*"
            },
            "required": true
          }
        ],
        "summary": "Cancel task",
        "description": "Mark a task queue item as cancelled.",
        "responses": {
          "200": {
            "description": "Cancelled task queue item.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^tsk_.*"
                    },
                    "projectID": {
                      "type": "string"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "sessionID": {
                      "type": "string",
                      "pattern": "^ses_.*"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "prompt",
                        "command",
                        "shell",
                        "followup",
                        "subagent",
                        "automation"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "waiting_for_idle",
                        "running",
                        "blocked_permission",
                        "blocked_question",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "priority": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "position": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "title": {
                      "type": "string"
                    },
                    "agent": {
                      "type": "string"
                    },
                    "model": {},
                    "sourceMessageID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "payload": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "error": {
                      "type": "string"
                    },
                    "executionTimeoutMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 259200000
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "kind",
                    "status",
                    "priority",
                    "position",
                    "title",
                    "payload",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.taskQueue.cancel({\n  ...\n})"
          }
        ]
      }
    },
    "/task-queue/{taskID}/retry": {
      "post": {
        "operationId": "taskQueue.retry",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "taskID",
            "schema": {
              "type": "string",
              "pattern": "^tsk_.*"
            },
            "required": true
          }
        ],
        "summary": "Retry task",
        "description": "Return a failed or cancelled task queue item to queued state.",
        "responses": {
          "200": {
            "description": "Retried task queue item.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^tsk_.*"
                    },
                    "projectID": {
                      "type": "string"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "sessionID": {
                      "type": "string",
                      "pattern": "^ses_.*"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "prompt",
                        "command",
                        "shell",
                        "followup",
                        "subagent",
                        "automation"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "waiting_for_idle",
                        "running",
                        "blocked_permission",
                        "blocked_question",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "priority": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "position": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "title": {
                      "type": "string"
                    },
                    "agent": {
                      "type": "string"
                    },
                    "model": {},
                    "sourceMessageID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "payload": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "error": {
                      "type": "string"
                    },
                    "executionTimeoutMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 259200000
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "kind",
                    "status",
                    "priority",
                    "position",
                    "title",
                    "payload",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.taskQueue.retry({\n  ...\n})"
          }
        ]
      }
    },
    "/task-queue/{taskID}/send-now": {
      "post": {
        "operationId": "taskQueue.send_now",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "taskID",
            "schema": {
              "type": "string",
              "pattern": "^tsk_.*"
            },
            "required": true
          }
        ],
        "summary": "Send task now",
        "description": "Move a task queue item to the front of the queue. Executable prompt, command, shell, or workflow subagent items start immediately when the target session is idle; non-executable items remain queued.",
        "responses": {
          "200": {
            "description": "Prioritized or started task queue item.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^tsk_.*"
                    },
                    "projectID": {
                      "type": "string"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "sessionID": {
                      "type": "string",
                      "pattern": "^ses_.*"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "prompt",
                        "command",
                        "shell",
                        "followup",
                        "subagent",
                        "automation"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "waiting_for_idle",
                        "running",
                        "blocked_permission",
                        "blocked_question",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "priority": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "position": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "title": {
                      "type": "string"
                    },
                    "agent": {
                      "type": "string"
                    },
                    "model": {},
                    "sourceMessageID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "payload": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "error": {
                      "type": "string"
                    },
                    "executionTimeoutMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 259200000
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "kind",
                    "status",
                    "priority",
                    "position",
                    "title",
                    "payload",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.taskQueue.send_now({\n  ...\n})"
          }
        ]
      }
    },
    "/task-queue/{taskID}/steer": {
      "post": {
        "operationId": "taskQueue.steer",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "taskID",
            "schema": {
              "type": "string",
              "pattern": "^tsk_.*"
            },
            "required": true
          }
        ],
        "summary": "Steer follow-up into the running turn",
        "description": "Admit a queued follow-up's text into the session's running generation at its next step boundary and cancel the queue row with a steeredInto audit trail. Text-only follow-ups are steerable; the steered text applies the running turn's agent, model, and tools. Anything else is rejected with 400. When no generation is active the row is left untouched and the response carries reason generation_not_active with a null receipt.",
        "responses": {
          "200": {
            "description": "Steering outcome with the latest task queue item.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskQueueSteerResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.taskQueue.steer({\n  ...\n})"
          }
        ]
      }
    },
    "/task-queue/{taskID}/reorder": {
      "post": {
        "operationId": "taskQueue.reorder",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "taskID",
            "schema": {
              "type": "string",
              "pattern": "^tsk_.*"
            },
            "required": true
          }
        ],
        "summary": "Reorder task",
        "description": "Set the queue position for a task queue item.",
        "responses": {
          "200": {
            "description": "Reordered task queue item.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^tsk_.*"
                    },
                    "projectID": {
                      "type": "string"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "sessionID": {
                      "type": "string",
                      "pattern": "^ses_.*"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "prompt",
                        "command",
                        "shell",
                        "followup",
                        "subagent",
                        "automation"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "waiting_for_idle",
                        "running",
                        "blocked_permission",
                        "blocked_question",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "priority": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "position": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "title": {
                      "type": "string"
                    },
                    "agent": {
                      "type": "string"
                    },
                    "model": {},
                    "sourceMessageID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "payload": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "error": {
                      "type": "string"
                    },
                    "executionTimeoutMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 259200000
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "kind",
                    "status",
                    "priority",
                    "position",
                    "title",
                    "payload",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "position": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "position"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.taskQueue.reorder({\n  ...\n})"
          }
        ]
      }
    },
    "/scheduled-task": {
      "get": {
        "operationId": "scheduledTask.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "paused",
                "disabled"
              ]
            }
          },
          {
            "in": "query",
            "name": "dueBefore",
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 500
            }
          }
        ],
        "summary": "List scheduled tasks",
        "description": "Return project-scoped scheduled automation tasks.",
        "responses": {
          "200": {
            "description": "Project scheduled tasks.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^sch_.*"
                      },
                      "projectID": {
                        "type": "string"
                      },
                      "directory": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string"
                      },
                      "prompt": {
                        "type": "string"
                      },
                      "schedule": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "const": "once"
                              },
                              "runAt": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "type",
                              "runAt"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "const": "daily"
                              },
                              "time": {
                                "type": "string",
                                "pattern": "^\\d{2}:\\d{2}$"
                              },
                              "timezone": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type",
                              "time"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "const": "weekly"
                              },
                              "day": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 6
                              },
                              "time": {
                                "type": "string",
                                "pattern": "^\\d{2}:\\d{2}$"
                              },
                              "timezone": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type",
                              "day",
                              "time"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "const": "cron"
                              },
                              "expression": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "timezone": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type",
                              "expression"
                            ]
                          }
                        ]
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "active",
                          "paused",
                          "disabled"
                        ]
                      },
                      "agent": {
                        "type": "string"
                      },
                      "model": {},
                      "workflowTemplateID": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120,
                        "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                      },
                      "workflowStartOptions": {
                        "type": "object",
                        "properties": {
                          "allowScaleBeyondDefaults": {
                            "type": "boolean"
                          },
                          "allowWriteWorkflows": {
                            "type": "boolean"
                          },
                          "durableChildren": {
                            "type": "boolean"
                          },
                          "enqueueChildren": {
                            "type": "boolean"
                          }
                        }
                      },
                      "lastQueueID": {
                        "type": "string"
                      },
                      "lastWorkflowRunID": {
                        "type": "string"
                      },
                      "error": {
                        "type": "string"
                      },
                      "nextRunAt": {
                        "type": "number"
                      },
                      "lastRunAt": {
                        "type": "number"
                      },
                      "catchUpPolicy": {
                        "type": "string",
                        "enum": [
                          "skip",
                          "run_once"
                        ]
                      },
                      "maxRunDurationMs": {
                        "type": "integer",
                        "minimum": 1000,
                        "maximum": 259200000
                      },
                      "time": {
                        "type": "object",
                        "properties": {
                          "created": {
                            "type": "number"
                          },
                          "updated": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "created"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "projectID",
                      "directory",
                      "title",
                      "prompt",
                      "schedule",
                      "status",
                      "catchUpPolicy",
                      "time"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.scheduledTask.list({\n  ...\n})"
          }
        ]
      },
      "post": {
        "operationId": "scheduledTask.create",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Create scheduled task",
        "description": "Create a project-scoped scheduled automation task.",
        "responses": {
          "200": {
            "description": "Created scheduled task.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^sch_.*"
                    },
                    "projectID": {
                      "type": "string"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "prompt": {
                      "type": "string"
                    },
                    "schedule": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "once"
                            },
                            "runAt": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "type",
                            "runAt"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "daily"
                            },
                            "time": {
                              "type": "string",
                              "pattern": "^\\d{2}:\\d{2}$"
                            },
                            "timezone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "time"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "weekly"
                            },
                            "day": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 6
                            },
                            "time": {
                              "type": "string",
                              "pattern": "^\\d{2}:\\d{2}$"
                            },
                            "timezone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "day",
                            "time"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "cron"
                            },
                            "expression": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "timezone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "expression"
                          ]
                        }
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "paused",
                        "disabled"
                      ]
                    },
                    "agent": {
                      "type": "string"
                    },
                    "model": {},
                    "workflowTemplateID": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120,
                      "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                    },
                    "workflowStartOptions": {
                      "type": "object",
                      "properties": {
                        "allowScaleBeyondDefaults": {
                          "type": "boolean"
                        },
                        "allowWriteWorkflows": {
                          "type": "boolean"
                        },
                        "durableChildren": {
                          "type": "boolean"
                        },
                        "enqueueChildren": {
                          "type": "boolean"
                        }
                      }
                    },
                    "lastQueueID": {
                      "type": "string"
                    },
                    "lastWorkflowRunID": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "nextRunAt": {
                      "type": "number"
                    },
                    "lastRunAt": {
                      "type": "number"
                    },
                    "catchUpPolicy": {
                      "type": "string",
                      "enum": [
                        "skip",
                        "run_once"
                      ]
                    },
                    "maxRunDurationMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 259200000
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "title",
                    "prompt",
                    "schedule",
                    "status",
                    "catchUpPolicy",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 20000
                  },
                  "schedule": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "once"
                          },
                          "runAt": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "type",
                          "runAt"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "daily"
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "time"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "weekly"
                          },
                          "day": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 6
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "day",
                          "time"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "cron"
                          },
                          "expression": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "expression"
                        ]
                      }
                    ]
                  },
                  "agent": {
                    "type": "string"
                  },
                  "model": {},
                  "workflowTemplateID": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                  },
                  "workflowStartOptions": {
                    "type": "object",
                    "properties": {
                      "allowScaleBeyondDefaults": {
                        "type": "boolean"
                      },
                      "allowWriteWorkflows": {
                        "type": "boolean"
                      },
                      "durableChildren": {
                        "type": "boolean"
                      },
                      "enqueueChildren": {
                        "type": "boolean"
                      }
                    }
                  },
                  "catchUpPolicy": {
                    "default": "run_once",
                    "type": "string",
                    "enum": [
                      "skip",
                      "run_once"
                    ]
                  },
                  "maxRunDurationMs": {
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 259200000
                  }
                },
                "required": [
                  "title",
                  "prompt",
                  "schedule"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.scheduledTask.create({\n  ...\n})"
          }
        ]
      }
    },
    "/scheduled-task/{scheduledTaskID}": {
      "get": {
        "operationId": "scheduledTask.get",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "scheduledTaskID",
            "schema": {
              "type": "string",
              "pattern": "^sch_.*"
            },
            "required": true
          }
        ],
        "summary": "Get scheduled task",
        "description": "Return one scheduled automation task.",
        "responses": {
          "200": {
            "description": "Scheduled task.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^sch_.*"
                    },
                    "projectID": {
                      "type": "string"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "prompt": {
                      "type": "string"
                    },
                    "schedule": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "once"
                            },
                            "runAt": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "type",
                            "runAt"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "daily"
                            },
                            "time": {
                              "type": "string",
                              "pattern": "^\\d{2}:\\d{2}$"
                            },
                            "timezone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "time"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "weekly"
                            },
                            "day": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 6
                            },
                            "time": {
                              "type": "string",
                              "pattern": "^\\d{2}:\\d{2}$"
                            },
                            "timezone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "day",
                            "time"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "cron"
                            },
                            "expression": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "timezone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "expression"
                          ]
                        }
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "paused",
                        "disabled"
                      ]
                    },
                    "agent": {
                      "type": "string"
                    },
                    "model": {},
                    "workflowTemplateID": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120,
                      "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                    },
                    "workflowStartOptions": {
                      "type": "object",
                      "properties": {
                        "allowScaleBeyondDefaults": {
                          "type": "boolean"
                        },
                        "allowWriteWorkflows": {
                          "type": "boolean"
                        },
                        "durableChildren": {
                          "type": "boolean"
                        },
                        "enqueueChildren": {
                          "type": "boolean"
                        }
                      }
                    },
                    "lastQueueID": {
                      "type": "string"
                    },
                    "lastWorkflowRunID": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "nextRunAt": {
                      "type": "number"
                    },
                    "lastRunAt": {
                      "type": "number"
                    },
                    "catchUpPolicy": {
                      "type": "string",
                      "enum": [
                        "skip",
                        "run_once"
                      ]
                    },
                    "maxRunDurationMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 259200000
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "title",
                    "prompt",
                    "schedule",
                    "status",
                    "catchUpPolicy",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.scheduledTask.get({\n  ...\n})"
          }
        ]
      },
      "delete": {
        "operationId": "scheduledTask.delete",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "scheduledTaskID",
            "schema": {
              "type": "string",
              "pattern": "^sch_.*"
            },
            "required": true
          }
        ],
        "summary": "Delete scheduled task",
        "description": "Delete a scheduled automation task.",
        "responses": {
          "200": {
            "description": "Scheduled task deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.scheduledTask.delete({\n  ...\n})"
          }
        ]
      }
    },
    "/scheduled-task/{scheduledTaskID}/runs": {
      "get": {
        "operationId": "scheduledTask.list_runs",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "scheduledTaskID",
            "schema": {
              "type": "string",
              "pattern": "^sch_.*"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 500
            }
          }
        ],
        "summary": "List scheduled task runs",
        "description": "Return the bounded run-history for one scheduled task (newest first): fired, completed, failed, timeout, skipped-overlap, and missed-skip occurrences.",
        "responses": {
          "200": {
            "description": "Scheduled task run history.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^str_.*"
                      },
                      "taskID": {
                        "type": "string",
                        "pattern": "^sch_.*"
                      },
                      "projectID": {
                        "type": "string"
                      },
                      "triggerType": {
                        "type": "string",
                        "enum": [
                          "scheduled",
                          "manual"
                        ]
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "running",
                          "completed",
                          "failed",
                          "timeout",
                          "skipped_overlap",
                          "missed_skip"
                        ]
                      },
                      "occurrenceAt": {
                        "type": "number"
                      },
                      "coalescedCount": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 9007199254740991
                      },
                      "queueID": {
                        "type": "string"
                      },
                      "workflowRunID": {
                        "type": "string"
                      },
                      "error": {
                        "type": "string"
                      },
                      "timeStarted": {
                        "type": "number"
                      },
                      "timeCompleted": {
                        "type": "number"
                      },
                      "time": {
                        "type": "object",
                        "properties": {
                          "created": {
                            "type": "number"
                          },
                          "updated": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "created"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "taskID",
                      "projectID",
                      "triggerType",
                      "status",
                      "coalescedCount",
                      "time"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.scheduledTask.list_runs({\n  ...\n})"
          }
        ]
      }
    },
    "/scheduled-task/{scheduledTaskID}/update": {
      "post": {
        "operationId": "scheduledTask.update",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "scheduledTaskID",
            "schema": {
              "type": "string",
              "pattern": "^sch_.*"
            },
            "required": true
          }
        ],
        "summary": "Update scheduled task",
        "description": "Update a scheduled automation task.",
        "responses": {
          "200": {
            "description": "Updated scheduled task.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^sch_.*"
                    },
                    "projectID": {
                      "type": "string"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "prompt": {
                      "type": "string"
                    },
                    "schedule": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "once"
                            },
                            "runAt": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "type",
                            "runAt"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "daily"
                            },
                            "time": {
                              "type": "string",
                              "pattern": "^\\d{2}:\\d{2}$"
                            },
                            "timezone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "time"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "weekly"
                            },
                            "day": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 6
                            },
                            "time": {
                              "type": "string",
                              "pattern": "^\\d{2}:\\d{2}$"
                            },
                            "timezone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "day",
                            "time"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "cron"
                            },
                            "expression": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "timezone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "expression"
                          ]
                        }
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "paused",
                        "disabled"
                      ]
                    },
                    "agent": {
                      "type": "string"
                    },
                    "model": {},
                    "workflowTemplateID": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120,
                      "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                    },
                    "workflowStartOptions": {
                      "type": "object",
                      "properties": {
                        "allowScaleBeyondDefaults": {
                          "type": "boolean"
                        },
                        "allowWriteWorkflows": {
                          "type": "boolean"
                        },
                        "durableChildren": {
                          "type": "boolean"
                        },
                        "enqueueChildren": {
                          "type": "boolean"
                        }
                      }
                    },
                    "lastQueueID": {
                      "type": "string"
                    },
                    "lastWorkflowRunID": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "nextRunAt": {
                      "type": "number"
                    },
                    "lastRunAt": {
                      "type": "number"
                    },
                    "catchUpPolicy": {
                      "type": "string",
                      "enum": [
                        "skip",
                        "run_once"
                      ]
                    },
                    "maxRunDurationMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 259200000
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "title",
                    "prompt",
                    "schedule",
                    "status",
                    "catchUpPolicy",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 20000
                  },
                  "schedule": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "once"
                          },
                          "runAt": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "type",
                          "runAt"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "daily"
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "time"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "weekly"
                          },
                          "day": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 6
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "day",
                          "time"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "cron"
                          },
                          "expression": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "expression"
                        ]
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "paused",
                      "disabled"
                    ]
                  },
                  "agent": {
                    "type": "string"
                  },
                  "model": {},
                  "workflowTemplateID": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                  },
                  "workflowStartOptions": {
                    "type": "object",
                    "properties": {
                      "allowScaleBeyondDefaults": {
                        "type": "boolean"
                      },
                      "allowWriteWorkflows": {
                        "type": "boolean"
                      },
                      "durableChildren": {
                        "type": "boolean"
                      },
                      "enqueueChildren": {
                        "type": "boolean"
                      }
                    }
                  },
                  "catchUpPolicy": {
                    "type": "string",
                    "enum": [
                      "skip",
                      "run_once"
                    ]
                  },
                  "maxRunDurationMs": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1000,
                        "maximum": 259200000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.scheduledTask.update({\n  ...\n})"
          }
        ]
      }
    },
    "/scheduled-task/{scheduledTaskID}/pause": {
      "post": {
        "operationId": "scheduledTask.pause",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "scheduledTaskID",
            "schema": {
              "type": "string",
              "pattern": "^sch_.*"
            },
            "required": true
          }
        ],
        "summary": "Pause scheduled task",
        "description": "Pause a scheduled automation task.",
        "responses": {
          "200": {
            "description": "Paused scheduled task.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^sch_.*"
                    },
                    "projectID": {
                      "type": "string"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "prompt": {
                      "type": "string"
                    },
                    "schedule": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "once"
                            },
                            "runAt": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "type",
                            "runAt"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "daily"
                            },
                            "time": {
                              "type": "string",
                              "pattern": "^\\d{2}:\\d{2}$"
                            },
                            "timezone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "time"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "weekly"
                            },
                            "day": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 6
                            },
                            "time": {
                              "type": "string",
                              "pattern": "^\\d{2}:\\d{2}$"
                            },
                            "timezone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "day",
                            "time"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "cron"
                            },
                            "expression": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "timezone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "expression"
                          ]
                        }
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "paused",
                        "disabled"
                      ]
                    },
                    "agent": {
                      "type": "string"
                    },
                    "model": {},
                    "workflowTemplateID": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120,
                      "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                    },
                    "workflowStartOptions": {
                      "type": "object",
                      "properties": {
                        "allowScaleBeyondDefaults": {
                          "type": "boolean"
                        },
                        "allowWriteWorkflows": {
                          "type": "boolean"
                        },
                        "durableChildren": {
                          "type": "boolean"
                        },
                        "enqueueChildren": {
                          "type": "boolean"
                        }
                      }
                    },
                    "lastQueueID": {
                      "type": "string"
                    },
                    "lastWorkflowRunID": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "nextRunAt": {
                      "type": "number"
                    },
                    "lastRunAt": {
                      "type": "number"
                    },
                    "catchUpPolicy": {
                      "type": "string",
                      "enum": [
                        "skip",
                        "run_once"
                      ]
                    },
                    "maxRunDurationMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 259200000
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "title",
                    "prompt",
                    "schedule",
                    "status",
                    "catchUpPolicy",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.scheduledTask.pause({\n  ...\n})"
          }
        ]
      }
    },
    "/scheduled-task/{scheduledTaskID}/resume": {
      "post": {
        "operationId": "scheduledTask.resume",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "scheduledTaskID",
            "schema": {
              "type": "string",
              "pattern": "^sch_.*"
            },
            "required": true
          }
        ],
        "summary": "Resume scheduled task",
        "description": "Resume a scheduled automation task.",
        "responses": {
          "200": {
            "description": "Resumed scheduled task.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^sch_.*"
                    },
                    "projectID": {
                      "type": "string"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "prompt": {
                      "type": "string"
                    },
                    "schedule": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "once"
                            },
                            "runAt": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "type",
                            "runAt"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "daily"
                            },
                            "time": {
                              "type": "string",
                              "pattern": "^\\d{2}:\\d{2}$"
                            },
                            "timezone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "time"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "weekly"
                            },
                            "day": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 6
                            },
                            "time": {
                              "type": "string",
                              "pattern": "^\\d{2}:\\d{2}$"
                            },
                            "timezone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "day",
                            "time"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "cron"
                            },
                            "expression": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "timezone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "expression"
                          ]
                        }
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "paused",
                        "disabled"
                      ]
                    },
                    "agent": {
                      "type": "string"
                    },
                    "model": {},
                    "workflowTemplateID": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120,
                      "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                    },
                    "workflowStartOptions": {
                      "type": "object",
                      "properties": {
                        "allowScaleBeyondDefaults": {
                          "type": "boolean"
                        },
                        "allowWriteWorkflows": {
                          "type": "boolean"
                        },
                        "durableChildren": {
                          "type": "boolean"
                        },
                        "enqueueChildren": {
                          "type": "boolean"
                        }
                      }
                    },
                    "lastQueueID": {
                      "type": "string"
                    },
                    "lastWorkflowRunID": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "nextRunAt": {
                      "type": "number"
                    },
                    "lastRunAt": {
                      "type": "number"
                    },
                    "catchUpPolicy": {
                      "type": "string",
                      "enum": [
                        "skip",
                        "run_once"
                      ]
                    },
                    "maxRunDurationMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 259200000
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "title",
                    "prompt",
                    "schedule",
                    "status",
                    "catchUpPolicy",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.scheduledTask.resume({\n  ...\n})"
          }
        ]
      }
    },
    "/scheduled-task/{scheduledTaskID}/run-now": {
      "post": {
        "operationId": "scheduledTask.run_now",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "scheduledTaskID",
            "schema": {
              "type": "string",
              "pattern": "^sch_.*"
            },
            "required": true
          }
        ],
        "summary": "Run scheduled task now",
        "description": "Run a scheduled task immediately. Prompt tasks create a server-owned automation queue item; workflow tasks create and start a workflow run.",
        "responses": {
          "200": {
            "description": "Run-now result with the updated scheduled task and either a queue item or workflow run.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "task": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^sch_.*"
                        },
                        "projectID": {
                          "type": "string"
                        },
                        "directory": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "prompt": {
                          "type": "string"
                        },
                        "schedule": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "const": "once"
                                },
                                "runAt": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "type",
                                "runAt"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "const": "daily"
                                },
                                "time": {
                                  "type": "string",
                                  "pattern": "^\\d{2}:\\d{2}$"
                                },
                                "timezone": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "type",
                                "time"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "const": "weekly"
                                },
                                "day": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 6
                                },
                                "time": {
                                  "type": "string",
                                  "pattern": "^\\d{2}:\\d{2}$"
                                },
                                "timezone": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "type",
                                "day",
                                "time"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "const": "cron"
                                },
                                "expression": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "timezone": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "type",
                                "expression"
                              ]
                            }
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "active",
                            "paused",
                            "disabled"
                          ]
                        },
                        "agent": {
                          "type": "string"
                        },
                        "model": {},
                        "workflowTemplateID": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120,
                          "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                        },
                        "workflowStartOptions": {
                          "type": "object",
                          "properties": {
                            "allowScaleBeyondDefaults": {
                              "type": "boolean"
                            },
                            "allowWriteWorkflows": {
                              "type": "boolean"
                            },
                            "durableChildren": {
                              "type": "boolean"
                            },
                            "enqueueChildren": {
                              "type": "boolean"
                            }
                          }
                        },
                        "lastQueueID": {
                          "type": "string"
                        },
                        "lastWorkflowRunID": {
                          "type": "string"
                        },
                        "error": {
                          "type": "string"
                        },
                        "nextRunAt": {
                          "type": "number"
                        },
                        "lastRunAt": {
                          "type": "number"
                        },
                        "catchUpPolicy": {
                          "type": "string",
                          "enum": [
                            "skip",
                            "run_once"
                          ]
                        },
                        "maxRunDurationMs": {
                          "type": "integer",
                          "minimum": 1000,
                          "maximum": 259200000
                        },
                        "time": {
                          "type": "object",
                          "properties": {
                            "created": {
                              "type": "number"
                            },
                            "updated": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "created"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "projectID",
                        "directory",
                        "title",
                        "prompt",
                        "schedule",
                        "status",
                        "catchUpPolicy",
                        "time"
                      ]
                    },
                    "queueItem": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^tsk_.*"
                        },
                        "projectID": {
                          "type": "string"
                        },
                        "directory": {
                          "type": "string"
                        },
                        "sessionID": {
                          "type": "string",
                          "pattern": "^ses_.*"
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "prompt",
                            "command",
                            "shell",
                            "followup",
                            "subagent",
                            "automation"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "queued",
                            "waiting_for_idle",
                            "running",
                            "blocked_permission",
                            "blocked_question",
                            "paused",
                            "failed",
                            "completed",
                            "cancelled"
                          ]
                        },
                        "priority": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "position": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "title": {
                          "type": "string"
                        },
                        "agent": {
                          "type": "string"
                        },
                        "model": {},
                        "sourceMessageID": {
                          "type": "string"
                        },
                        "sourceTaskID": {
                          "type": "string"
                        },
                        "payload": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "error": {
                          "type": "string"
                        },
                        "executionTimeoutMs": {
                          "type": "integer",
                          "minimum": 1000,
                          "maximum": 259200000
                        },
                        "time": {
                          "type": "object",
                          "properties": {
                            "created": {
                              "type": "number"
                            },
                            "updated": {
                              "type": "number"
                            },
                            "started": {
                              "type": "number"
                            },
                            "completed": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "created"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "projectID",
                        "directory",
                        "kind",
                        "status",
                        "priority",
                        "position",
                        "title",
                        "payload",
                        "time"
                      ]
                    },
                    "workflowRun": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "queued",
                            "running",
                            "blocked",
                            "paused",
                            "failed",
                            "completed",
                            "cancelled"
                          ]
                        },
                        "sourceTemplateID": {
                          "type": "string"
                        },
                        "error": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "status"
                      ],
                      "additionalProperties": {}
                    }
                  },
                  "required": [
                    "task"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.scheduledTask.run_now({\n  ...\n})"
          }
        ]
      }
    },
    "/scheduled-task/run-due": {
      "post": {
        "operationId": "scheduledTask.run_due",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "now",
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "summary": "Run due scheduled tasks",
        "description": "Run due active scheduled tasks, creating automation queue items or workflow runs as configured.",
        "responses": {
          "200": {
            "description": "Run-now results.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "task": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^sch_.*"
                          },
                          "projectID": {
                            "type": "string"
                          },
                          "directory": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "prompt": {
                            "type": "string"
                          },
                          "schedule": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "once"
                                  },
                                  "runAt": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "type",
                                  "runAt"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "daily"
                                  },
                                  "time": {
                                    "type": "string",
                                    "pattern": "^\\d{2}:\\d{2}$"
                                  },
                                  "timezone": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type",
                                  "time"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "weekly"
                                  },
                                  "day": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 6
                                  },
                                  "time": {
                                    "type": "string",
                                    "pattern": "^\\d{2}:\\d{2}$"
                                  },
                                  "timezone": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type",
                                  "day",
                                  "time"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "cron"
                                  },
                                  "expression": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "timezone": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type",
                                  "expression"
                                ]
                              }
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "paused",
                              "disabled"
                            ]
                          },
                          "agent": {
                            "type": "string"
                          },
                          "model": {},
                          "workflowTemplateID": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120,
                            "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                          },
                          "workflowStartOptions": {
                            "type": "object",
                            "properties": {
                              "allowScaleBeyondDefaults": {
                                "type": "boolean"
                              },
                              "allowWriteWorkflows": {
                                "type": "boolean"
                              },
                              "durableChildren": {
                                "type": "boolean"
                              },
                              "enqueueChildren": {
                                "type": "boolean"
                              }
                            }
                          },
                          "lastQueueID": {
                            "type": "string"
                          },
                          "lastWorkflowRunID": {
                            "type": "string"
                          },
                          "error": {
                            "type": "string"
                          },
                          "nextRunAt": {
                            "type": "number"
                          },
                          "lastRunAt": {
                            "type": "number"
                          },
                          "catchUpPolicy": {
                            "type": "string",
                            "enum": [
                              "skip",
                              "run_once"
                            ]
                          },
                          "maxRunDurationMs": {
                            "type": "integer",
                            "minimum": 1000,
                            "maximum": 259200000
                          },
                          "time": {
                            "type": "object",
                            "properties": {
                              "created": {
                                "type": "number"
                              },
                              "updated": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "created"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "projectID",
                          "directory",
                          "title",
                          "prompt",
                          "schedule",
                          "status",
                          "catchUpPolicy",
                          "time"
                        ]
                      },
                      "queueItem": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^tsk_.*"
                          },
                          "projectID": {
                            "type": "string"
                          },
                          "directory": {
                            "type": "string"
                          },
                          "sessionID": {
                            "type": "string",
                            "pattern": "^ses_.*"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "prompt",
                              "command",
                              "shell",
                              "followup",
                              "subagent",
                              "automation"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "queued",
                              "waiting_for_idle",
                              "running",
                              "blocked_permission",
                              "blocked_question",
                              "paused",
                              "failed",
                              "completed",
                              "cancelled"
                            ]
                          },
                          "priority": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "position": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "title": {
                            "type": "string"
                          },
                          "agent": {
                            "type": "string"
                          },
                          "model": {},
                          "sourceMessageID": {
                            "type": "string"
                          },
                          "sourceTaskID": {
                            "type": "string"
                          },
                          "payload": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          "error": {
                            "type": "string"
                          },
                          "executionTimeoutMs": {
                            "type": "integer",
                            "minimum": 1000,
                            "maximum": 259200000
                          },
                          "time": {
                            "type": "object",
                            "properties": {
                              "created": {
                                "type": "number"
                              },
                              "updated": {
                                "type": "number"
                              },
                              "started": {
                                "type": "number"
                              },
                              "completed": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "created"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "projectID",
                          "directory",
                          "kind",
                          "status",
                          "priority",
                          "position",
                          "title",
                          "payload",
                          "time"
                        ]
                      },
                      "workflowRun": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "queued",
                              "running",
                              "blocked",
                              "paused",
                              "failed",
                              "completed",
                              "cancelled"
                            ]
                          },
                          "sourceTemplateID": {
                            "type": "string"
                          },
                          "error": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "status"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "task"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.scheduledTask.run_due({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-runs": {
      "get": {
        "operationId": "workflowRun.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "parentSessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "running",
                "blocked",
                "paused",
                "failed",
                "completed",
                "cancelled"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 500
            }
          }
        ],
        "summary": "List workflow runs",
        "description": "Return durable workflow runs scoped to the current project.",
        "responses": {
          "200": {
            "description": "Project-scoped workflow runs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WorkflowRunEventRecord"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowRun.list({\n  ...\n})"
          }
        ]
      },
      "post": {
        "operationId": "workflowRun.create",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Create workflow run",
        "description": "Create a workflow run from a spec snapshot or a built-in workflow template.",
        "responses": {
          "200": {
            "description": "Created workflow run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunEventRecord"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "parentSessionID": {
                    "type": "string",
                    "pattern": "^ses_.*"
                  },
                  "sourceTemplateID": {
                    "type": "string",
                    "minLength": 1
                  },
                  "sourceTaskID": {
                    "type": "string",
                    "minLength": 1
                  },
                  "templateID": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                  },
                  "spec": {
                    "type": "object",
                    "properties": {
                      "schemaVersion": {
                        "type": "number",
                        "const": 1
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80,
                        "pattern": "^[a-z][a-z0-9-]*$"
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "description": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 1000
                      },
                      "tags": {
                        "default": [],
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80,
                          "pattern": "^[a-z][a-z0-9-]*$"
                        }
                      },
                      "trigger": {
                        "default": {
                          "kind": "manual",
                          "source": "prompt"
                        },
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "manual"
                              },
                              "source": {
                                "default": "prompt",
                                "type": "string",
                                "enum": [
                                  "prompt",
                                  "command",
                                  "api"
                                ]
                              }
                            },
                            "required": [
                              "kind"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "scheduled"
                              },
                              "schedule": {
                                "type": "string",
                                "minLength": 1
                              },
                              "timezone": {
                                "type": "string",
                                "minLength": 1
                              },
                              "enabled": {
                                "default": false,
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "kind",
                              "schedule"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "command"
                              },
                              "command": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "kind"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "api"
                              },
                              "route": {
                                "type": "string",
                                "minLength": 1
                              },
                              "enabled": {
                                "default": false,
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "kind"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "webhook"
                              },
                              "event": {
                                "type": "string",
                                "minLength": 1
                              },
                              "enabled": {
                                "default": false,
                                "type": "boolean",
                                "const": false
                              },
                              "securityGate": {
                                "default": "required",
                                "type": "string",
                                "const": "required"
                              }
                            },
                            "required": [
                              "kind",
                              "event"
                            ]
                          }
                        ]
                      },
                      "inputs": {
                        "default": [],
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z][a-z0-9-]*$"
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "description": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            },
                            "type": {
                              "default": "string",
                              "type": "string",
                              "enum": [
                                "string",
                                "number",
                                "boolean",
                                "json",
                                "path",
                                "string-array"
                              ]
                            },
                            "required": {
                              "default": false,
                              "type": "boolean"
                            },
                            "sensitive": {
                              "default": false,
                              "type": "boolean"
                            },
                            "default": {}
                          },
                          "required": [
                            "id"
                          ]
                        }
                      },
                      "routine": {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "default": false,
                            "type": "boolean"
                          },
                          "mode": {
                            "default": "manual",
                            "type": "string",
                            "enum": [
                              "manual",
                              "scheduled",
                              "api",
                              "webhook"
                            ]
                          },
                          "schedule": {
                            "type": "string",
                            "minLength": 1
                          },
                          "timezone": {
                            "type": "string",
                            "minLength": 1
                          },
                          "apiRoute": {
                            "type": "string",
                            "minLength": 1
                          },
                          "webhookEvent": {
                            "type": "string",
                            "minLength": 1
                          },
                          "securityGate": {
                            "default": "local-only",
                            "type": "string",
                            "enum": [
                              "local-only",
                              "required"
                            ]
                          }
                        }
                      },
                      "budget": {
                        "default": {
                          "maxTotalTokens": 100000,
                          "maxInputTokensPerChild": 50000,
                          "maxOutputTokensPerChild": 8000,
                          "maxWallTimeMs": 3600000,
                          "maxConcurrentAgents": 3,
                          "maxTotalAgents": 25,
                          "maxToolCalls": 500,
                          "maxRetries": 1
                        },
                        "type": "object",
                        "properties": {
                          "maxTotalTokens": {
                            "default": 100000,
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "maxInputTokensPerChild": {
                            "default": 50000,
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "maxOutputTokensPerChild": {
                            "default": 8000,
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "maxWallTimeMs": {
                            "default": 3600000,
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "maxConcurrentAgents": {
                            "default": 3,
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 16
                          },
                          "maxTotalAgents": {
                            "default": 25,
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 1000
                          },
                          "maxToolCalls": {
                            "default": 500,
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "maxRetries": {
                            "default": 1,
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 5
                          }
                        }
                      },
                      "pacing": {
                        "default": {
                          "maxRequestsPerMinute": 12,
                          "maxTokensPerMinute": 200000
                        },
                        "type": "object",
                        "properties": {
                          "maxRequestsPerMinute": {
                            "default": 12,
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 120
                          },
                          "maxTokensPerMinute": {
                            "default": 200000,
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 2000000
                          }
                        }
                      },
                      "modelPolicy": {
                        "default": {
                          "effort": "normal",
                          "allowedProviders": [],
                          "routing": []
                        },
                        "type": "object",
                        "properties": {
                          "defaultModel": {
                            "type": "string",
                            "minLength": 1
                          },
                          "cheapModel": {
                            "type": "string",
                            "minLength": 1
                          },
                          "strongModel": {
                            "type": "string",
                            "minLength": 1
                          },
                          "plannerModel": {
                            "type": "string",
                            "minLength": 1
                          },
                          "workerModel": {
                            "type": "string",
                            "minLength": 1
                          },
                          "verifierModel": {
                            "type": "string",
                            "minLength": 1
                          },
                          "synthesizerModel": {
                            "type": "string",
                            "minLength": 1
                          },
                          "effort": {
                            "default": "normal",
                            "type": "string",
                            "enum": [
                              "normal",
                              "deep",
                              "workflow",
                              "max-workflow"
                            ]
                          },
                          "allowedProviders": {
                            "default": [],
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "routing": {
                            "default": [],
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "phaseKind": {
                                  "type": "string",
                                  "enum": [
                                    "fanout",
                                    "sequential",
                                    "synthesis",
                                    "verification",
                                    "noop"
                                  ]
                                },
                                "use": {
                                  "type": "string",
                                  "enum": [
                                    "planner",
                                    "worker",
                                    "verifier",
                                    "synthesizer"
                                  ]
                                }
                              },
                              "required": [
                                "use"
                              ]
                            }
                          }
                        }
                      },
                      "permissions": {
                        "default": {
                          "writePolicy": "read-only",
                          "allowedTools": [],
                          "networkPolicy": "inherit",
                          "escalationPolicy": "ask"
                        },
                        "type": "object",
                        "properties": {
                          "writePolicy": {
                            "default": "read-only",
                            "type": "string",
                            "enum": [
                              "read-only",
                              "serialized",
                              "worktree-required"
                            ]
                          },
                          "allowedTools": {
                            "default": [],
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "networkPolicy": {
                            "default": "inherit",
                            "type": "string",
                            "enum": [
                              "inherit",
                              "disabled",
                              "allowed"
                            ]
                          },
                          "escalationPolicy": {
                            "default": "ask",
                            "type": "string",
                            "enum": [
                              "inherit",
                              "ask",
                              "deny"
                            ]
                          }
                        }
                      },
                      "artifacts": {
                        "default": [],
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z][a-z0-9-]*$"
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "summary",
                                "finding",
                                "patch",
                                "verification",
                                "metric",
                                "log"
                              ]
                            },
                            "retention": {
                              "default": "session",
                              "type": "string",
                              "enum": [
                                "ephemeral",
                                "session",
                                "durable"
                              ]
                            },
                            "exposeToMainContext": {
                              "default": false,
                              "type": "boolean"
                            },
                            "redaction": {
                              "type": "object",
                              "properties": {
                                "status": {
                                  "default": "pending",
                                  "type": "string",
                                  "enum": [
                                    "none",
                                    "redacted",
                                    "pending"
                                  ]
                                },
                                "summary": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 500
                                }
                              }
                            }
                          },
                          "required": [
                            "id",
                            "kind"
                          ]
                        }
                      },
                      "verification": {
                        "default": {
                          "mode": "optional",
                          "commands": [],
                          "requiredArtifactIds": []
                        },
                        "type": "object",
                        "properties": {
                          "mode": {
                            "default": "optional",
                            "type": "string",
                            "enum": [
                              "required",
                              "optional",
                              "deferred",
                              "skipped"
                            ]
                          },
                          "workflow": {
                            "type": "string",
                            "enum": [
                              "review",
                              "debug",
                              "qa"
                            ]
                          },
                          "commands": {
                            "default": [],
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "requiredArtifactIds": {
                            "default": [],
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z][a-z0-9-]*$"
                            }
                          },
                          "reason": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 500
                          }
                        }
                      },
                      "synthesis": {
                        "default": {
                          "outputFormat": "markdown",
                          "exposeToMainContext": true,
                          "requiredArtifactIds": []
                        },
                        "type": "object",
                        "properties": {
                          "agent": {
                            "type": "string",
                            "minLength": 1
                          },
                          "model": {
                            "type": "string",
                            "minLength": 1
                          },
                          "outputFormat": {
                            "default": "markdown",
                            "type": "string",
                            "enum": [
                              "markdown",
                              "json",
                              "table",
                              "findings"
                            ]
                          },
                          "exposeToMainContext": {
                            "default": true,
                            "type": "boolean"
                          },
                          "requiredArtifactIds": {
                            "default": [],
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z][a-z0-9-]*$"
                            }
                          }
                        }
                      },
                      "phases": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z][a-z0-9-]*$"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "fanout",
                                "sequential",
                                "synthesis",
                                "verification",
                                "noop"
                              ]
                            },
                            "prompt": {
                              "type": "string",
                              "minLength": 1
                            },
                            "agent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "inputs": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "outputs": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            },
                            "dependsOn": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            },
                            "maxParallel": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 16
                            },
                            "mergeStrategy": {
                              "default": "all",
                              "type": "string",
                              "enum": [
                                "all",
                                "first-success",
                                "majority",
                                "vote-with-critic",
                                "critic-confirmation",
                                "custom-reducer"
                              ]
                            },
                            "modelPolicy": {
                              "type": "object",
                              "properties": {
                                "defaultModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "cheapModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "strongModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "plannerModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "workerModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "verifierModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "synthesizerModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "effort": {
                                  "default": "normal",
                                  "type": "string",
                                  "enum": [
                                    "normal",
                                    "deep",
                                    "workflow",
                                    "max-workflow"
                                  ]
                                },
                                "allowedProviders": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "routing": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "phaseKind": {
                                        "type": "string",
                                        "enum": [
                                          "fanout",
                                          "sequential",
                                          "synthesis",
                                          "verification",
                                          "noop"
                                        ]
                                      },
                                      "use": {
                                        "type": "string",
                                        "enum": [
                                          "planner",
                                          "worker",
                                          "verifier",
                                          "synthesizer"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "use"
                                    ]
                                  }
                                }
                              }
                            },
                            "budget": {
                              "type": "object",
                              "properties": {
                                "maxTotalTokens": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxInputTokensPerChild": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxOutputTokensPerChild": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxWallTimeMs": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxConcurrentAgents": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 16
                                },
                                "maxTotalAgents": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 1000
                                },
                                "maxToolCalls": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxRetries": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 5
                                }
                              }
                            },
                            "pacing": {
                              "type": "object",
                              "properties": {
                                "maxRequestsPerMinute": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 120
                                },
                                "maxTokensPerMinute": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 2000000
                                }
                              }
                            }
                          },
                          "required": [
                            "id",
                            "name",
                            "kind"
                          ]
                        }
                      }
                    },
                    "required": [
                      "schemaVersion",
                      "id",
                      "name",
                      "description",
                      "phases"
                    ]
                  },
                  "modelPolicy": {
                    "type": "object",
                    "properties": {
                      "defaultModel": {
                        "type": "string",
                        "minLength": 1
                      },
                      "cheapModel": {
                        "type": "string",
                        "minLength": 1
                      },
                      "strongModel": {
                        "type": "string",
                        "minLength": 1
                      },
                      "plannerModel": {
                        "type": "string",
                        "minLength": 1
                      },
                      "workerModel": {
                        "type": "string",
                        "minLength": 1
                      },
                      "verifierModel": {
                        "type": "string",
                        "minLength": 1
                      },
                      "synthesizerModel": {
                        "type": "string",
                        "minLength": 1
                      },
                      "effort": {
                        "default": "normal",
                        "type": "string",
                        "enum": [
                          "normal",
                          "deep",
                          "workflow",
                          "max-workflow"
                        ]
                      },
                      "allowedProviders": {
                        "default": [],
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "routing": {
                        "default": [],
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "phaseKind": {
                              "type": "string",
                              "enum": [
                                "fanout",
                                "sequential",
                                "synthesis",
                                "verification",
                                "noop"
                              ]
                            },
                            "use": {
                              "type": "string",
                              "enum": [
                                "planner",
                                "worker",
                                "verifier",
                                "synthesizer"
                              ]
                            }
                          },
                          "required": [
                            "use"
                          ]
                        }
                      }
                    }
                  },
                  "inputValues": {
                    "default": {},
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowRun.create({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-runs/dashboard": {
      "get": {
        "operationId": "workflowRun.dashboard",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "parentSessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "running",
                "blocked",
                "paused",
                "failed",
                "completed",
                "cancelled"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 500
            }
          },
          {
            "in": "query",
            "name": "now",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "summary": "List workflow dashboard summaries",
        "description": "Return compact workflow run projections for TUI and desktop supervision surfaces.",
        "responses": {
          "200": {
            "description": "Compact workflow dashboard summaries.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "runID": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "queued",
                          "running",
                          "blocked",
                          "paused",
                          "failed",
                          "completed",
                          "cancelled"
                        ]
                      },
                      "name": {
                        "type": "string"
                      },
                      "sourceTemplateID": {
                        "type": "string"
                      },
                      "currentPhaseID": {
                        "type": "string"
                      },
                      "currentPhaseName": {
                        "type": "string"
                      },
                      "currentPhaseStatus": {
                        "type": "string",
                        "enum": [
                          "queued",
                          "running",
                          "blocked",
                          "paused",
                          "failed",
                          "completed",
                          "cancelled"
                        ]
                      },
                      "elapsedMs": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "effort": {
                        "type": "string",
                        "enum": [
                          "normal",
                          "deep",
                          "workflow",
                          "max-workflow"
                        ]
                      },
                      "models": {
                        "type": "object",
                        "properties": {
                          "default": {
                            "type": "string"
                          },
                          "cheap": {
                            "type": "string"
                          },
                          "strong": {
                            "type": "string"
                          },
                          "planner": {
                            "type": "string"
                          },
                          "worker": {
                            "type": "string"
                          },
                          "verifier": {
                            "type": "string"
                          },
                          "synthesizer": {
                            "type": "string"
                          }
                        }
                      },
                      "budgetUsage": {
                        "type": "object",
                        "properties": {
                          "totalTokens": {
                            "default": 0,
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "inputTokens": {
                            "default": 0,
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "outputTokens": {
                            "default": 0,
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "toolCalls": {
                            "default": 0,
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "childAgents": {
                            "default": 0,
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "retries": {
                            "default": 0,
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        }
                      },
                      "budgetLimit": {
                        "type": "object",
                        "properties": {
                          "maxTotalTokens": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "maxInputTokensPerChild": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "maxOutputTokensPerChild": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "maxWallTimeMs": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "maxConcurrentAgents": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "maxTotalAgents": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "maxToolCalls": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "maxRetries": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "maxTotalTokens",
                          "maxInputTokensPerChild",
                          "maxOutputTokensPerChild",
                          "maxWallTimeMs",
                          "maxConcurrentAgents",
                          "maxTotalAgents",
                          "maxToolCalls",
                          "maxRetries"
                        ]
                      },
                      "phaseCounts": {
                        "type": "object",
                        "properties": {
                          "queued": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "running": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "blocked": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "paused": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "failed": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "completed": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "cancelled": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "queued",
                          "running",
                          "blocked",
                          "paused",
                          "failed",
                          "completed",
                          "cancelled"
                        ]
                      },
                      "childCounts": {
                        "type": "object",
                        "properties": {
                          "queued": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "running": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "blockedPermission": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "blockedQuestion": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "paused": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "failed": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "completed": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "cancelled": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "queued",
                          "running",
                          "blockedPermission",
                          "blockedQuestion",
                          "paused",
                          "failed",
                          "completed",
                          "cancelled"
                        ]
                      },
                      "artifactCounts": {
                        "type": "object",
                        "properties": {
                          "summary": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "finding": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "patch": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "verification": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "metric": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "log": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "summary",
                          "finding",
                          "patch",
                          "verification",
                          "metric",
                          "log"
                        ]
                      },
                      "verificationEnvelopeCount": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "evidenceRefCount": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "exposedArtifactCount": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "evaluation": {
                        "type": "object",
                        "properties": {
                          "runID": {
                            "type": "string"
                          },
                          "sourceTemplateID": {
                            "type": "string"
                          },
                          "decision": {
                            "type": "string",
                            "enum": [
                              "promote",
                              "hold",
                              "rollback"
                            ]
                          },
                          "reasons": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "metrics": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "type": "string",
                                "enum": [
                                  "queued",
                                  "running",
                                  "blocked",
                                  "paused",
                                  "failed",
                                  "completed",
                                  "cancelled"
                                ]
                              },
                              "elapsedMs": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "totalTokens": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "inputTokens": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "outputTokens": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "toolCalls": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "childAgents": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "retries": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "verifiedCompletionCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "tokensPerConfirmedFinding": {
                                "anyOf": [
                                  {
                                    "type": "number",
                                    "minimum": 0
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "confirmedFindings": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "likelyFindings": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "rejectedFindings": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "unverifiedFindings": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "falsePositiveFindings": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "artifactCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "exposedArtifactCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "verificationEnvelopeCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "interventionCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "status",
                              "elapsedMs",
                              "totalTokens",
                              "inputTokens",
                              "outputTokens",
                              "toolCalls",
                              "childAgents",
                              "retries",
                              "verifiedCompletionCount",
                              "tokensPerConfirmedFinding",
                              "confirmedFindings",
                              "likelyFindings",
                              "rejectedFindings",
                              "unverifiedFindings",
                              "falsePositiveFindings",
                              "artifactCount",
                              "exposedArtifactCount",
                              "verificationEnvelopeCount",
                              "interventionCount"
                            ]
                          },
                          "budgetStatus": {
                            "type": "string",
                            "enum": [
                              "ok",
                              "warning",
                              "exceeded"
                            ]
                          },
                          "budgetWarnings": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "budgetExceeded": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "verificationSatisfied": {
                            "type": "boolean"
                          },
                          "comparison": {
                            "type": "object",
                            "properties": {
                              "baselineLabel": {
                                "type": "string"
                              },
                              "confirmedFindingsDelta": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "falsePositiveFindingsDelta": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "totalTokensDelta": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "elapsedMsDelta": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "interventionCountDelta": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "baselineLabel",
                              "confirmedFindingsDelta",
                              "falsePositiveFindingsDelta"
                            ]
                          }
                        },
                        "required": [
                          "runID",
                          "decision",
                          "reasons",
                          "metrics",
                          "budgetStatus",
                          "budgetWarnings",
                          "budgetExceeded",
                          "verificationSatisfied"
                        ]
                      },
                      "blockedReason": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "runID",
                      "status",
                      "name",
                      "elapsedMs",
                      "effort",
                      "models",
                      "budgetUsage",
                      "budgetLimit",
                      "phaseCounts",
                      "childCounts",
                      "artifactCounts",
                      "verificationEnvelopeCount",
                      "evidenceRefCount",
                      "exposedArtifactCount",
                      "evaluation"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowRun.dashboard({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-runs/eval-cases": {
      "get": {
        "operationId": "workflowRun.eval_cases",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "List workflow evaluation cases",
        "description": "Return built-in local workflow evaluation cases used for preview promotion gates.",
        "responses": {
          "200": {
            "description": "Workflow evaluation cases.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "enum": [
                          "verified-bug-sweep-seeded"
                        ]
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "description": {
                        "type": "string",
                        "minLength": 1
                      },
                      "fixtureID": {
                        "type": "string",
                        "minLength": 1
                      },
                      "templateID": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120,
                        "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                      },
                      "baseline": {
                        "type": "object",
                        "properties": {
                          "label": {
                            "default": "single-agent",
                            "type": "string",
                            "minLength": 1
                          },
                          "metrics": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "type": "string",
                                "enum": [
                                  "queued",
                                  "running",
                                  "blocked",
                                  "paused",
                                  "failed",
                                  "completed",
                                  "cancelled"
                                ]
                              },
                              "elapsedMs": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "totalTokens": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "inputTokens": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "outputTokens": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "toolCalls": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "childAgents": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "retries": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "verifiedCompletionCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "tokensPerConfirmedFinding": {
                                "anyOf": [
                                  {
                                    "type": "number",
                                    "minimum": 0
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "confirmedFindings": {
                                "default": 0,
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "likelyFindings": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "rejectedFindings": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "unverifiedFindings": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "falsePositiveFindings": {
                                "default": 0,
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "artifactCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "exposedArtifactCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "verificationEnvelopeCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "interventionCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              }
                            }
                          }
                        },
                        "required": [
                          "metrics"
                        ]
                      },
                      "seeds": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z][a-z0-9-]*$"
                            },
                            "file": {
                              "type": "string",
                              "minLength": 1
                            },
                            "line": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "expectedStatus": {
                              "type": "string",
                              "enum": [
                                "confirmed",
                                "likely",
                                "rejected",
                                "unverified"
                              ]
                            },
                            "severity": {
                              "default": "medium",
                              "type": "string",
                              "enum": [
                                "critical",
                                "high",
                                "medium",
                                "low",
                                "info"
                              ]
                            },
                            "summary": {
                              "type": "string",
                              "minLength": 1
                            },
                            "rationale": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "id",
                            "file",
                            "line",
                            "expectedStatus",
                            "summary"
                          ]
                        }
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "description",
                      "fixtureID",
                      "templateID",
                      "baseline",
                      "seeds"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowRun.eval_cases({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-runs/{runID}": {
      "get": {
        "operationId": "workflowRun.get",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "runID",
            "schema": {
              "type": "string",
              "pattern": "^wfr_.*"
            },
            "required": true
          }
        ],
        "summary": "Get workflow run detail",
        "description": "Return a workflow run with phase, child, artifact, and budget state.",
        "responses": {
          "200": {
            "description": "Workflow run detail.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "projectID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "directory": {
                      "type": "string"
                    },
                    "parentSessionID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceTemplateID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "running",
                        "blocked",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "currentPhaseID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "spec": {
                      "type": "object",
                      "properties": {
                        "schemaVersion": {
                          "type": "number",
                          "const": 1
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80,
                          "pattern": "^[a-z][a-z0-9-]*$"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        },
                        "tags": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 80,
                            "pattern": "^[a-z][a-z0-9-]*$"
                          }
                        },
                        "trigger": {
                          "default": {
                            "kind": "manual",
                            "source": "prompt"
                          },
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "manual"
                                },
                                "source": {
                                  "default": "prompt",
                                  "type": "string",
                                  "enum": [
                                    "prompt",
                                    "command",
                                    "api"
                                  ]
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "scheduled"
                                },
                                "schedule": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "timezone": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind",
                                "schedule"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "command"
                                },
                                "command": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "api"
                                },
                                "route": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "webhook"
                                },
                                "event": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean",
                                  "const": false
                                },
                                "securityGate": {
                                  "default": "required",
                                  "type": "string",
                                  "const": "required"
                                }
                              },
                              "required": [
                                "kind",
                                "event"
                              ]
                            }
                          ]
                        },
                        "inputs": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 500
                              },
                              "type": {
                                "default": "string",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "json",
                                  "path",
                                  "string-array"
                                ]
                              },
                              "required": {
                                "default": false,
                                "type": "boolean"
                              },
                              "sensitive": {
                                "default": false,
                                "type": "boolean"
                              },
                              "default": {}
                            },
                            "required": [
                              "id"
                            ]
                          }
                        },
                        "routine": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "default": false,
                              "type": "boolean"
                            },
                            "mode": {
                              "default": "manual",
                              "type": "string",
                              "enum": [
                                "manual",
                                "scheduled",
                                "api",
                                "webhook"
                              ]
                            },
                            "schedule": {
                              "type": "string",
                              "minLength": 1
                            },
                            "timezone": {
                              "type": "string",
                              "minLength": 1
                            },
                            "apiRoute": {
                              "type": "string",
                              "minLength": 1
                            },
                            "webhookEvent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "securityGate": {
                              "default": "local-only",
                              "type": "string",
                              "enum": [
                                "local-only",
                                "required"
                              ]
                            }
                          }
                        },
                        "budget": {
                          "default": {
                            "maxTotalTokens": 100000,
                            "maxInputTokensPerChild": 50000,
                            "maxOutputTokensPerChild": 8000,
                            "maxWallTimeMs": 3600000,
                            "maxConcurrentAgents": 3,
                            "maxTotalAgents": 25,
                            "maxToolCalls": 500,
                            "maxRetries": 1
                          },
                          "type": "object",
                          "properties": {
                            "maxTotalTokens": {
                              "default": 100000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxInputTokensPerChild": {
                              "default": 50000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxOutputTokensPerChild": {
                              "default": 8000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxWallTimeMs": {
                              "default": 3600000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxConcurrentAgents": {
                              "default": 3,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 16
                            },
                            "maxTotalAgents": {
                              "default": 25,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 1000
                            },
                            "maxToolCalls": {
                              "default": 500,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxRetries": {
                              "default": 1,
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 5
                            }
                          }
                        },
                        "pacing": {
                          "default": {
                            "maxRequestsPerMinute": 12,
                            "maxTokensPerMinute": 200000
                          },
                          "type": "object",
                          "properties": {
                            "maxRequestsPerMinute": {
                              "default": 12,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 120
                            },
                            "maxTokensPerMinute": {
                              "default": 200000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 2000000
                            }
                          }
                        },
                        "modelPolicy": {
                          "default": {
                            "effort": "normal",
                            "allowedProviders": [],
                            "routing": []
                          },
                          "type": "object",
                          "properties": {
                            "defaultModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "cheapModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "strongModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "plannerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "workerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "verifierModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "synthesizerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "effort": {
                              "default": "normal",
                              "type": "string",
                              "enum": [
                                "normal",
                                "deep",
                                "workflow",
                                "max-workflow"
                              ]
                            },
                            "allowedProviders": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "routing": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "phaseKind": {
                                    "type": "string",
                                    "enum": [
                                      "fanout",
                                      "sequential",
                                      "synthesis",
                                      "verification",
                                      "noop"
                                    ]
                                  },
                                  "use": {
                                    "type": "string",
                                    "enum": [
                                      "planner",
                                      "worker",
                                      "verifier",
                                      "synthesizer"
                                    ]
                                  }
                                },
                                "required": [
                                  "use"
                                ]
                              }
                            }
                          }
                        },
                        "permissions": {
                          "default": {
                            "writePolicy": "read-only",
                            "allowedTools": [],
                            "networkPolicy": "inherit",
                            "escalationPolicy": "ask"
                          },
                          "type": "object",
                          "properties": {
                            "writePolicy": {
                              "default": "read-only",
                              "type": "string",
                              "enum": [
                                "read-only",
                                "serialized",
                                "worktree-required"
                              ]
                            },
                            "allowedTools": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "networkPolicy": {
                              "default": "inherit",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "disabled",
                                "allowed"
                              ]
                            },
                            "escalationPolicy": {
                              "default": "ask",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "ask",
                                "deny"
                              ]
                            }
                          }
                        },
                        "artifacts": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "summary",
                                  "finding",
                                  "patch",
                                  "verification",
                                  "metric",
                                  "log"
                                ]
                              },
                              "retention": {
                                "default": "session",
                                "type": "string",
                                "enum": [
                                  "ephemeral",
                                  "session",
                                  "durable"
                                ]
                              },
                              "exposeToMainContext": {
                                "default": false,
                                "type": "boolean"
                              },
                              "redaction": {
                                "type": "object",
                                "properties": {
                                  "status": {
                                    "default": "pending",
                                    "type": "string",
                                    "enum": [
                                      "none",
                                      "redacted",
                                      "pending"
                                    ]
                                  },
                                  "summary": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 500
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "kind"
                            ]
                          }
                        },
                        "verification": {
                          "default": {
                            "mode": "optional",
                            "commands": [],
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "mode": {
                              "default": "optional",
                              "type": "string",
                              "enum": [
                                "required",
                                "optional",
                                "deferred",
                                "skipped"
                              ]
                            },
                            "workflow": {
                              "type": "string",
                              "enum": [
                                "review",
                                "debug",
                                "qa"
                              ]
                            },
                            "commands": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            },
                            "reason": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            }
                          }
                        },
                        "synthesis": {
                          "default": {
                            "outputFormat": "markdown",
                            "exposeToMainContext": true,
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "agent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "model": {
                              "type": "string",
                              "minLength": 1
                            },
                            "outputFormat": {
                              "default": "markdown",
                              "type": "string",
                              "enum": [
                                "markdown",
                                "json",
                                "table",
                                "findings"
                              ]
                            },
                            "exposeToMainContext": {
                              "default": true,
                              "type": "boolean"
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            }
                          }
                        },
                        "phases": {
                          "minItems": 1,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "fanout",
                                  "sequential",
                                  "synthesis",
                                  "verification",
                                  "noop"
                                ]
                              },
                              "prompt": {
                                "type": "string",
                                "minLength": 1
                              },
                              "agent": {
                                "type": "string",
                                "minLength": 1
                              },
                              "inputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "outputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "dependsOn": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "maxParallel": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 16
                              },
                              "mergeStrategy": {
                                "default": "all",
                                "type": "string",
                                "enum": [
                                  "all",
                                  "first-success",
                                  "majority",
                                  "vote-with-critic",
                                  "critic-confirmation",
                                  "custom-reducer"
                                ]
                              },
                              "modelPolicy": {
                                "type": "object",
                                "properties": {
                                  "defaultModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "cheapModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "strongModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "plannerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "workerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "verifierModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "synthesizerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effort": {
                                    "default": "normal",
                                    "type": "string",
                                    "enum": [
                                      "normal",
                                      "deep",
                                      "workflow",
                                      "max-workflow"
                                    ]
                                  },
                                  "allowedProviders": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "routing": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "phaseKind": {
                                          "type": "string",
                                          "enum": [
                                            "fanout",
                                            "sequential",
                                            "synthesis",
                                            "verification",
                                            "noop"
                                          ]
                                        },
                                        "use": {
                                          "type": "string",
                                          "enum": [
                                            "planner",
                                            "worker",
                                            "verifier",
                                            "synthesizer"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "use"
                                      ]
                                    }
                                  }
                                }
                              },
                              "budget": {
                                "type": "object",
                                "properties": {
                                  "maxTotalTokens": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxInputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxOutputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxWallTimeMs": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxConcurrentAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 16
                                  },
                                  "maxTotalAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 1000
                                  },
                                  "maxToolCalls": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxRetries": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 5
                                  }
                                }
                              },
                              "pacing": {
                                "type": "object",
                                "properties": {
                                  "maxRequestsPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 120
                                  },
                                  "maxTokensPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 2000000
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "kind"
                            ]
                          }
                        }
                      },
                      "required": [
                        "schemaVersion",
                        "id",
                        "name",
                        "description",
                        "phases"
                      ]
                    },
                    "inputValues": {
                      "default": {},
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "budget": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "budgetUsage": {
                      "type": "object",
                      "properties": {
                        "totalTokens": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "inputTokens": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "outputTokens": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "toolCalls": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "childAgents": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "retries": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      }
                    },
                    "verificationEnvelopeIDs": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "error": {
                      "type": "string"
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created",
                        "updated"
                      ]
                    },
                    "phases": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowPhaseEventRecord"
                      }
                    },
                    "children": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowChildEventRecord"
                      }
                    },
                    "artifacts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowArtifactEventRecord"
                      }
                    },
                    "budgetLedger": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowBudgetLedgerEventEntry"
                      }
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "status",
                    "spec",
                    "budget",
                    "budgetUsage",
                    "verificationEnvelopeIDs",
                    "time",
                    "phases",
                    "children",
                    "artifacts",
                    "budgetLedger"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowRun.get({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-runs/{runID}/artifacts": {
      "get": {
        "operationId": "workflowRun.artifacts",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "runID",
            "schema": {
              "type": "string",
              "pattern": "^wfr_.*"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "artifactID",
            "schema": {
              "type": "string",
              "pattern": "^wfa_.*"
            }
          },
          {
            "in": "query",
            "name": "phaseID",
            "schema": {
              "type": "string",
              "pattern": "^wfp_.*"
            }
          },
          {
            "in": "query",
            "name": "childID",
            "schema": {
              "type": "string",
              "pattern": "^wfc_.*"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "type": "string",
              "enum": [
                "summary",
                "finding",
                "patch",
                "verification",
                "metric",
                "log"
              ]
            }
          },
          {
            "in": "query",
            "name": "includePayload",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "summary": "List workflow run artifacts",
        "description": "Return workflow artifacts for a run, with optional phase, child, kind, and compact filters.",
        "responses": {
          "200": {
            "description": "Workflow run artifacts.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WorkflowArtifactEventRecord"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowRun.artifacts({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-runs/{runID}/eval-summary": {
      "post": {
        "operationId": "workflowRun.eval_summary",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "runID",
            "schema": {
              "type": "string",
              "pattern": "^wfr_.*"
            },
            "required": true
          }
        ],
        "summary": "Evaluate workflow run",
        "description": "Compare a workflow run against optional baseline metrics and return its preview promotion gate.",
        "responses": {
          "200": {
            "description": "Workflow evaluation summary.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "runID": {
                      "type": "string"
                    },
                    "sourceTemplateID": {
                      "type": "string"
                    },
                    "decision": {
                      "type": "string",
                      "enum": [
                        "promote",
                        "hold",
                        "rollback"
                      ]
                    },
                    "reasons": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "metrics": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "queued",
                            "running",
                            "blocked",
                            "paused",
                            "failed",
                            "completed",
                            "cancelled"
                          ]
                        },
                        "elapsedMs": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "totalTokens": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "inputTokens": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "outputTokens": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "toolCalls": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "childAgents": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "retries": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "verifiedCompletionCount": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "tokensPerConfirmedFinding": {
                          "anyOf": [
                            {
                              "type": "number",
                              "minimum": 0
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "confirmedFindings": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "likelyFindings": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "rejectedFindings": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "unverifiedFindings": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "falsePositiveFindings": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "artifactCount": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "exposedArtifactCount": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "verificationEnvelopeCount": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "interventionCount": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "status",
                        "elapsedMs",
                        "totalTokens",
                        "inputTokens",
                        "outputTokens",
                        "toolCalls",
                        "childAgents",
                        "retries",
                        "verifiedCompletionCount",
                        "tokensPerConfirmedFinding",
                        "confirmedFindings",
                        "likelyFindings",
                        "rejectedFindings",
                        "unverifiedFindings",
                        "falsePositiveFindings",
                        "artifactCount",
                        "exposedArtifactCount",
                        "verificationEnvelopeCount",
                        "interventionCount"
                      ]
                    },
                    "budgetStatus": {
                      "type": "string",
                      "enum": [
                        "ok",
                        "warning",
                        "exceeded"
                      ]
                    },
                    "budgetWarnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "budgetExceeded": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "verificationSatisfied": {
                      "type": "boolean"
                    },
                    "comparison": {
                      "type": "object",
                      "properties": {
                        "baselineLabel": {
                          "type": "string"
                        },
                        "confirmedFindingsDelta": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "falsePositiveFindingsDelta": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "totalTokensDelta": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "elapsedMsDelta": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "interventionCountDelta": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "baselineLabel",
                        "confirmedFindingsDelta",
                        "falsePositiveFindingsDelta"
                      ]
                    }
                  },
                  "required": [
                    "runID",
                    "decision",
                    "reasons",
                    "metrics",
                    "budgetStatus",
                    "budgetWarnings",
                    "budgetExceeded",
                    "verificationSatisfied"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "baseline": {
                    "type": "object",
                    "properties": {
                      "label": {
                        "default": "single-agent",
                        "type": "string",
                        "minLength": 1
                      },
                      "metrics": {
                        "type": "object",
                        "properties": {
                          "status": {
                            "type": "string",
                            "enum": [
                              "queued",
                              "running",
                              "blocked",
                              "paused",
                              "failed",
                              "completed",
                              "cancelled"
                            ]
                          },
                          "elapsedMs": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "totalTokens": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "inputTokens": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "outputTokens": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "toolCalls": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "childAgents": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "retries": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "verifiedCompletionCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "tokensPerConfirmedFinding": {
                            "anyOf": [
                              {
                                "type": "number",
                                "minimum": 0
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "confirmedFindings": {
                            "default": 0,
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "likelyFindings": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "rejectedFindings": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "unverifiedFindings": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "falsePositiveFindings": {
                            "default": 0,
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "artifactCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "exposedArtifactCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "verificationEnvelopeCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "interventionCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        }
                      }
                    },
                    "required": [
                      "metrics"
                    ]
                  },
                  "now": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowRun.eval_summary({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-runs/{runID}/eval-case": {
      "post": {
        "operationId": "workflowRun.eval_case",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "runID",
            "schema": {
              "type": "string",
              "pattern": "^wfr_.*"
            },
            "required": true
          }
        ],
        "summary": "Evaluate workflow run against a local case",
        "description": "Compare a workflow run against a seeded local eval case and single-agent baseline.",
        "responses": {
          "200": {
            "description": "Workflow evaluation case result.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "caseID": {
                      "type": "string",
                      "enum": [
                        "verified-bug-sweep-seeded"
                      ]
                    },
                    "templateID": {
                      "type": "string"
                    },
                    "fixtureID": {
                      "type": "string"
                    },
                    "decision": {
                      "type": "string",
                      "enum": [
                        "promote",
                        "hold",
                        "rollback"
                      ]
                    },
                    "reasons": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "missingSeedIDs": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80,
                        "pattern": "^[a-z][a-z0-9-]*$"
                      }
                    },
                    "mismatchedSeedIDs": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80,
                        "pattern": "^[a-z][a-z0-9-]*$"
                      }
                    },
                    "summary": {
                      "type": "object",
                      "properties": {
                        "runID": {
                          "type": "string"
                        },
                        "sourceTemplateID": {
                          "type": "string"
                        },
                        "decision": {
                          "type": "string",
                          "enum": [
                            "promote",
                            "hold",
                            "rollback"
                          ]
                        },
                        "reasons": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "metrics": {
                          "type": "object",
                          "properties": {
                            "status": {
                              "type": "string",
                              "enum": [
                                "queued",
                                "running",
                                "blocked",
                                "paused",
                                "failed",
                                "completed",
                                "cancelled"
                              ]
                            },
                            "elapsedMs": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "totalTokens": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "inputTokens": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "outputTokens": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "toolCalls": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "childAgents": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "retries": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "verifiedCompletionCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "tokensPerConfirmedFinding": {
                              "anyOf": [
                                {
                                  "type": "number",
                                  "minimum": 0
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "confirmedFindings": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "likelyFindings": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "rejectedFindings": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "unverifiedFindings": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "falsePositiveFindings": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "artifactCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "exposedArtifactCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "verificationEnvelopeCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "interventionCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "status",
                            "elapsedMs",
                            "totalTokens",
                            "inputTokens",
                            "outputTokens",
                            "toolCalls",
                            "childAgents",
                            "retries",
                            "verifiedCompletionCount",
                            "tokensPerConfirmedFinding",
                            "confirmedFindings",
                            "likelyFindings",
                            "rejectedFindings",
                            "unverifiedFindings",
                            "falsePositiveFindings",
                            "artifactCount",
                            "exposedArtifactCount",
                            "verificationEnvelopeCount",
                            "interventionCount"
                          ]
                        },
                        "budgetStatus": {
                          "type": "string",
                          "enum": [
                            "ok",
                            "warning",
                            "exceeded"
                          ]
                        },
                        "budgetWarnings": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "budgetExceeded": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "verificationSatisfied": {
                          "type": "boolean"
                        },
                        "comparison": {
                          "type": "object",
                          "properties": {
                            "baselineLabel": {
                              "type": "string"
                            },
                            "confirmedFindingsDelta": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "falsePositiveFindingsDelta": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "totalTokensDelta": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "elapsedMsDelta": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "interventionCountDelta": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "baselineLabel",
                            "confirmedFindingsDelta",
                            "falsePositiveFindingsDelta"
                          ]
                        }
                      },
                      "required": [
                        "runID",
                        "decision",
                        "reasons",
                        "metrics",
                        "budgetStatus",
                        "budgetWarnings",
                        "budgetExceeded",
                        "verificationSatisfied"
                      ]
                    },
                    "metrics": {
                      "type": "object",
                      "properties": {
                        "expectedConfirmedFindings": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "expectedLikelyFindings": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "expectedRejectedFindings": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "expectedUnverifiedFindings": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "observedSeedConfirmedFindings": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "observedSeedLikelyFindings": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "observedSeedRejectedFindings": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "observedSeedUnverifiedFindings": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "missingSeedFindings": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "mismatchedSeedFindings": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "duplicateSeedArtifacts": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "unmatchedFindingArtifacts": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "tokensPerConfirmedFinding": {
                          "anyOf": [
                            {
                              "type": "number",
                              "minimum": 0
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "falsePositiveRejectionRate": {
                          "anyOf": [
                            {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "confirmedFindingRecall": {
                          "anyOf": [
                            {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "completionRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        },
                        "verificationPassRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        },
                        "budgetStopped": {
                          "type": "boolean"
                        },
                        "interventionCount": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "expectedConfirmedFindings",
                        "expectedLikelyFindings",
                        "expectedRejectedFindings",
                        "expectedUnverifiedFindings",
                        "observedSeedConfirmedFindings",
                        "observedSeedLikelyFindings",
                        "observedSeedRejectedFindings",
                        "observedSeedUnverifiedFindings",
                        "missingSeedFindings",
                        "mismatchedSeedFindings",
                        "duplicateSeedArtifacts",
                        "unmatchedFindingArtifacts",
                        "tokensPerConfirmedFinding",
                        "falsePositiveRejectionRate",
                        "confirmedFindingRecall",
                        "completionRate",
                        "verificationPassRate",
                        "budgetStopped",
                        "interventionCount"
                      ]
                    }
                  },
                  "required": [
                    "caseID",
                    "templateID",
                    "fixtureID",
                    "decision",
                    "reasons",
                    "missingSeedIDs",
                    "mismatchedSeedIDs",
                    "summary",
                    "metrics"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "caseID": {
                    "default": "verified-bug-sweep-seeded",
                    "type": "string",
                    "enum": [
                      "verified-bug-sweep-seeded"
                    ]
                  },
                  "now": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowRun.eval_case({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-runs/{runID}/save-template": {
      "post": {
        "operationId": "workflowRun.save_template",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "runID",
            "schema": {
              "type": "string",
              "pattern": "^wfr_.*"
            },
            "required": true
          }
        ],
        "summary": "Save workflow run as template",
        "description": "Save a workflow run spec snapshot as a candidate user-local or project-local template.",
        "responses": {
          "200": {
            "description": "Saved workflow template candidate.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "builtin",
                        "user",
                        "project"
                      ]
                    },
                    "trust": {
                      "type": "string",
                      "enum": [
                        "candidate",
                        "trusted"
                      ]
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "revision": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "specHash": {
                      "type": "string"
                    },
                    "spec": {
                      "type": "object",
                      "properties": {
                        "schemaVersion": {
                          "type": "number",
                          "const": 1
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80,
                          "pattern": "^[a-z][a-z0-9-]*$"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        },
                        "tags": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 80,
                            "pattern": "^[a-z][a-z0-9-]*$"
                          }
                        },
                        "trigger": {
                          "default": {
                            "kind": "manual",
                            "source": "prompt"
                          },
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "manual"
                                },
                                "source": {
                                  "default": "prompt",
                                  "type": "string",
                                  "enum": [
                                    "prompt",
                                    "command",
                                    "api"
                                  ]
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "scheduled"
                                },
                                "schedule": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "timezone": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind",
                                "schedule"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "command"
                                },
                                "command": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "api"
                                },
                                "route": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "webhook"
                                },
                                "event": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean",
                                  "const": false
                                },
                                "securityGate": {
                                  "default": "required",
                                  "type": "string",
                                  "const": "required"
                                }
                              },
                              "required": [
                                "kind",
                                "event"
                              ]
                            }
                          ]
                        },
                        "inputs": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 500
                              },
                              "type": {
                                "default": "string",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "json",
                                  "path",
                                  "string-array"
                                ]
                              },
                              "required": {
                                "default": false,
                                "type": "boolean"
                              },
                              "sensitive": {
                                "default": false,
                                "type": "boolean"
                              },
                              "default": {}
                            },
                            "required": [
                              "id"
                            ]
                          }
                        },
                        "routine": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "default": false,
                              "type": "boolean"
                            },
                            "mode": {
                              "default": "manual",
                              "type": "string",
                              "enum": [
                                "manual",
                                "scheduled",
                                "api",
                                "webhook"
                              ]
                            },
                            "schedule": {
                              "type": "string",
                              "minLength": 1
                            },
                            "timezone": {
                              "type": "string",
                              "minLength": 1
                            },
                            "apiRoute": {
                              "type": "string",
                              "minLength": 1
                            },
                            "webhookEvent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "securityGate": {
                              "default": "local-only",
                              "type": "string",
                              "enum": [
                                "local-only",
                                "required"
                              ]
                            }
                          }
                        },
                        "budget": {
                          "default": {
                            "maxTotalTokens": 100000,
                            "maxInputTokensPerChild": 50000,
                            "maxOutputTokensPerChild": 8000,
                            "maxWallTimeMs": 3600000,
                            "maxConcurrentAgents": 3,
                            "maxTotalAgents": 25,
                            "maxToolCalls": 500,
                            "maxRetries": 1
                          },
                          "type": "object",
                          "properties": {
                            "maxTotalTokens": {
                              "default": 100000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxInputTokensPerChild": {
                              "default": 50000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxOutputTokensPerChild": {
                              "default": 8000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxWallTimeMs": {
                              "default": 3600000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxConcurrentAgents": {
                              "default": 3,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 16
                            },
                            "maxTotalAgents": {
                              "default": 25,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 1000
                            },
                            "maxToolCalls": {
                              "default": 500,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxRetries": {
                              "default": 1,
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 5
                            }
                          }
                        },
                        "pacing": {
                          "default": {
                            "maxRequestsPerMinute": 12,
                            "maxTokensPerMinute": 200000
                          },
                          "type": "object",
                          "properties": {
                            "maxRequestsPerMinute": {
                              "default": 12,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 120
                            },
                            "maxTokensPerMinute": {
                              "default": 200000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 2000000
                            }
                          }
                        },
                        "modelPolicy": {
                          "default": {
                            "effort": "normal",
                            "allowedProviders": [],
                            "routing": []
                          },
                          "type": "object",
                          "properties": {
                            "defaultModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "cheapModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "strongModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "plannerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "workerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "verifierModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "synthesizerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "effort": {
                              "default": "normal",
                              "type": "string",
                              "enum": [
                                "normal",
                                "deep",
                                "workflow",
                                "max-workflow"
                              ]
                            },
                            "allowedProviders": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "routing": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "phaseKind": {
                                    "type": "string",
                                    "enum": [
                                      "fanout",
                                      "sequential",
                                      "synthesis",
                                      "verification",
                                      "noop"
                                    ]
                                  },
                                  "use": {
                                    "type": "string",
                                    "enum": [
                                      "planner",
                                      "worker",
                                      "verifier",
                                      "synthesizer"
                                    ]
                                  }
                                },
                                "required": [
                                  "use"
                                ]
                              }
                            }
                          }
                        },
                        "permissions": {
                          "default": {
                            "writePolicy": "read-only",
                            "allowedTools": [],
                            "networkPolicy": "inherit",
                            "escalationPolicy": "ask"
                          },
                          "type": "object",
                          "properties": {
                            "writePolicy": {
                              "default": "read-only",
                              "type": "string",
                              "enum": [
                                "read-only",
                                "serialized",
                                "worktree-required"
                              ]
                            },
                            "allowedTools": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "networkPolicy": {
                              "default": "inherit",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "disabled",
                                "allowed"
                              ]
                            },
                            "escalationPolicy": {
                              "default": "ask",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "ask",
                                "deny"
                              ]
                            }
                          }
                        },
                        "artifacts": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "summary",
                                  "finding",
                                  "patch",
                                  "verification",
                                  "metric",
                                  "log"
                                ]
                              },
                              "retention": {
                                "default": "session",
                                "type": "string",
                                "enum": [
                                  "ephemeral",
                                  "session",
                                  "durable"
                                ]
                              },
                              "exposeToMainContext": {
                                "default": false,
                                "type": "boolean"
                              },
                              "redaction": {
                                "type": "object",
                                "properties": {
                                  "status": {
                                    "default": "pending",
                                    "type": "string",
                                    "enum": [
                                      "none",
                                      "redacted",
                                      "pending"
                                    ]
                                  },
                                  "summary": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 500
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "kind"
                            ]
                          }
                        },
                        "verification": {
                          "default": {
                            "mode": "optional",
                            "commands": [],
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "mode": {
                              "default": "optional",
                              "type": "string",
                              "enum": [
                                "required",
                                "optional",
                                "deferred",
                                "skipped"
                              ]
                            },
                            "workflow": {
                              "type": "string",
                              "enum": [
                                "review",
                                "debug",
                                "qa"
                              ]
                            },
                            "commands": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            },
                            "reason": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            }
                          }
                        },
                        "synthesis": {
                          "default": {
                            "outputFormat": "markdown",
                            "exposeToMainContext": true,
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "agent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "model": {
                              "type": "string",
                              "minLength": 1
                            },
                            "outputFormat": {
                              "default": "markdown",
                              "type": "string",
                              "enum": [
                                "markdown",
                                "json",
                                "table",
                                "findings"
                              ]
                            },
                            "exposeToMainContext": {
                              "default": true,
                              "type": "boolean"
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            }
                          }
                        },
                        "phases": {
                          "minItems": 1,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "fanout",
                                  "sequential",
                                  "synthesis",
                                  "verification",
                                  "noop"
                                ]
                              },
                              "prompt": {
                                "type": "string",
                                "minLength": 1
                              },
                              "agent": {
                                "type": "string",
                                "minLength": 1
                              },
                              "inputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "outputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "dependsOn": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "maxParallel": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 16
                              },
                              "mergeStrategy": {
                                "default": "all",
                                "type": "string",
                                "enum": [
                                  "all",
                                  "first-success",
                                  "majority",
                                  "vote-with-critic",
                                  "critic-confirmation",
                                  "custom-reducer"
                                ]
                              },
                              "modelPolicy": {
                                "type": "object",
                                "properties": {
                                  "defaultModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "cheapModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "strongModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "plannerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "workerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "verifierModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "synthesizerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effort": {
                                    "default": "normal",
                                    "type": "string",
                                    "enum": [
                                      "normal",
                                      "deep",
                                      "workflow",
                                      "max-workflow"
                                    ]
                                  },
                                  "allowedProviders": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "routing": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "phaseKind": {
                                          "type": "string",
                                          "enum": [
                                            "fanout",
                                            "sequential",
                                            "synthesis",
                                            "verification",
                                            "noop"
                                          ]
                                        },
                                        "use": {
                                          "type": "string",
                                          "enum": [
                                            "planner",
                                            "worker",
                                            "verifier",
                                            "synthesizer"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "use"
                                      ]
                                    }
                                  }
                                }
                              },
                              "budget": {
                                "type": "object",
                                "properties": {
                                  "maxTotalTokens": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxInputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxOutputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxWallTimeMs": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxConcurrentAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 16
                                  },
                                  "maxTotalAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 1000
                                  },
                                  "maxToolCalls": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxRetries": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 5
                                  }
                                }
                              },
                              "pacing": {
                                "type": "object",
                                "properties": {
                                  "maxRequestsPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 120
                                  },
                                  "maxTokensPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 2000000
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "kind"
                            ]
                          }
                        }
                      },
                      "required": [
                        "schemaVersion",
                        "id",
                        "name",
                        "description",
                        "phases"
                      ]
                    },
                    "path": {
                      "type": "string"
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created",
                        "updated"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "source",
                    "trust",
                    "name",
                    "description",
                    "tags",
                    "revision",
                    "specHash",
                    "spec"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "scope": {
                    "type": "string",
                    "enum": [
                      "user",
                      "project"
                    ]
                  }
                },
                "required": [
                  "scope"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowRun.save_template({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-runs/{runID}/start": {
      "post": {
        "operationId": "workflowRun.start",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "runID",
            "schema": {
              "type": "string",
              "pattern": "^wfr_.*"
            },
            "required": true
          }
        ],
        "summary": "Start workflow run",
        "description": "Start or advance a workflow run through the scheduler.",
        "responses": {
          "200": {
            "description": "Started workflow run detail.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "projectID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "directory": {
                      "type": "string"
                    },
                    "parentSessionID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceTemplateID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "running",
                        "blocked",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "currentPhaseID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "spec": {
                      "type": "object",
                      "properties": {
                        "schemaVersion": {
                          "type": "number",
                          "const": 1
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80,
                          "pattern": "^[a-z][a-z0-9-]*$"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        },
                        "tags": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 80,
                            "pattern": "^[a-z][a-z0-9-]*$"
                          }
                        },
                        "trigger": {
                          "default": {
                            "kind": "manual",
                            "source": "prompt"
                          },
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "manual"
                                },
                                "source": {
                                  "default": "prompt",
                                  "type": "string",
                                  "enum": [
                                    "prompt",
                                    "command",
                                    "api"
                                  ]
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "scheduled"
                                },
                                "schedule": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "timezone": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind",
                                "schedule"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "command"
                                },
                                "command": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "api"
                                },
                                "route": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "webhook"
                                },
                                "event": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean",
                                  "const": false
                                },
                                "securityGate": {
                                  "default": "required",
                                  "type": "string",
                                  "const": "required"
                                }
                              },
                              "required": [
                                "kind",
                                "event"
                              ]
                            }
                          ]
                        },
                        "inputs": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 500
                              },
                              "type": {
                                "default": "string",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "json",
                                  "path",
                                  "string-array"
                                ]
                              },
                              "required": {
                                "default": false,
                                "type": "boolean"
                              },
                              "sensitive": {
                                "default": false,
                                "type": "boolean"
                              },
                              "default": {}
                            },
                            "required": [
                              "id"
                            ]
                          }
                        },
                        "routine": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "default": false,
                              "type": "boolean"
                            },
                            "mode": {
                              "default": "manual",
                              "type": "string",
                              "enum": [
                                "manual",
                                "scheduled",
                                "api",
                                "webhook"
                              ]
                            },
                            "schedule": {
                              "type": "string",
                              "minLength": 1
                            },
                            "timezone": {
                              "type": "string",
                              "minLength": 1
                            },
                            "apiRoute": {
                              "type": "string",
                              "minLength": 1
                            },
                            "webhookEvent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "securityGate": {
                              "default": "local-only",
                              "type": "string",
                              "enum": [
                                "local-only",
                                "required"
                              ]
                            }
                          }
                        },
                        "budget": {
                          "default": {
                            "maxTotalTokens": 100000,
                            "maxInputTokensPerChild": 50000,
                            "maxOutputTokensPerChild": 8000,
                            "maxWallTimeMs": 3600000,
                            "maxConcurrentAgents": 3,
                            "maxTotalAgents": 25,
                            "maxToolCalls": 500,
                            "maxRetries": 1
                          },
                          "type": "object",
                          "properties": {
                            "maxTotalTokens": {
                              "default": 100000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxInputTokensPerChild": {
                              "default": 50000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxOutputTokensPerChild": {
                              "default": 8000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxWallTimeMs": {
                              "default": 3600000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxConcurrentAgents": {
                              "default": 3,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 16
                            },
                            "maxTotalAgents": {
                              "default": 25,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 1000
                            },
                            "maxToolCalls": {
                              "default": 500,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxRetries": {
                              "default": 1,
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 5
                            }
                          }
                        },
                        "pacing": {
                          "default": {
                            "maxRequestsPerMinute": 12,
                            "maxTokensPerMinute": 200000
                          },
                          "type": "object",
                          "properties": {
                            "maxRequestsPerMinute": {
                              "default": 12,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 120
                            },
                            "maxTokensPerMinute": {
                              "default": 200000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 2000000
                            }
                          }
                        },
                        "modelPolicy": {
                          "default": {
                            "effort": "normal",
                            "allowedProviders": [],
                            "routing": []
                          },
                          "type": "object",
                          "properties": {
                            "defaultModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "cheapModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "strongModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "plannerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "workerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "verifierModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "synthesizerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "effort": {
                              "default": "normal",
                              "type": "string",
                              "enum": [
                                "normal",
                                "deep",
                                "workflow",
                                "max-workflow"
                              ]
                            },
                            "allowedProviders": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "routing": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "phaseKind": {
                                    "type": "string",
                                    "enum": [
                                      "fanout",
                                      "sequential",
                                      "synthesis",
                                      "verification",
                                      "noop"
                                    ]
                                  },
                                  "use": {
                                    "type": "string",
                                    "enum": [
                                      "planner",
                                      "worker",
                                      "verifier",
                                      "synthesizer"
                                    ]
                                  }
                                },
                                "required": [
                                  "use"
                                ]
                              }
                            }
                          }
                        },
                        "permissions": {
                          "default": {
                            "writePolicy": "read-only",
                            "allowedTools": [],
                            "networkPolicy": "inherit",
                            "escalationPolicy": "ask"
                          },
                          "type": "object",
                          "properties": {
                            "writePolicy": {
                              "default": "read-only",
                              "type": "string",
                              "enum": [
                                "read-only",
                                "serialized",
                                "worktree-required"
                              ]
                            },
                            "allowedTools": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "networkPolicy": {
                              "default": "inherit",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "disabled",
                                "allowed"
                              ]
                            },
                            "escalationPolicy": {
                              "default": "ask",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "ask",
                                "deny"
                              ]
                            }
                          }
                        },
                        "artifacts": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "summary",
                                  "finding",
                                  "patch",
                                  "verification",
                                  "metric",
                                  "log"
                                ]
                              },
                              "retention": {
                                "default": "session",
                                "type": "string",
                                "enum": [
                                  "ephemeral",
                                  "session",
                                  "durable"
                                ]
                              },
                              "exposeToMainContext": {
                                "default": false,
                                "type": "boolean"
                              },
                              "redaction": {
                                "type": "object",
                                "properties": {
                                  "status": {
                                    "default": "pending",
                                    "type": "string",
                                    "enum": [
                                      "none",
                                      "redacted",
                                      "pending"
                                    ]
                                  },
                                  "summary": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 500
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "kind"
                            ]
                          }
                        },
                        "verification": {
                          "default": {
                            "mode": "optional",
                            "commands": [],
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "mode": {
                              "default": "optional",
                              "type": "string",
                              "enum": [
                                "required",
                                "optional",
                                "deferred",
                                "skipped"
                              ]
                            },
                            "workflow": {
                              "type": "string",
                              "enum": [
                                "review",
                                "debug",
                                "qa"
                              ]
                            },
                            "commands": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            },
                            "reason": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            }
                          }
                        },
                        "synthesis": {
                          "default": {
                            "outputFormat": "markdown",
                            "exposeToMainContext": true,
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "agent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "model": {
                              "type": "string",
                              "minLength": 1
                            },
                            "outputFormat": {
                              "default": "markdown",
                              "type": "string",
                              "enum": [
                                "markdown",
                                "json",
                                "table",
                                "findings"
                              ]
                            },
                            "exposeToMainContext": {
                              "default": true,
                              "type": "boolean"
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            }
                          }
                        },
                        "phases": {
                          "minItems": 1,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "fanout",
                                  "sequential",
                                  "synthesis",
                                  "verification",
                                  "noop"
                                ]
                              },
                              "prompt": {
                                "type": "string",
                                "minLength": 1
                              },
                              "agent": {
                                "type": "string",
                                "minLength": 1
                              },
                              "inputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "outputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "dependsOn": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "maxParallel": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 16
                              },
                              "mergeStrategy": {
                                "default": "all",
                                "type": "string",
                                "enum": [
                                  "all",
                                  "first-success",
                                  "majority",
                                  "vote-with-critic",
                                  "critic-confirmation",
                                  "custom-reducer"
                                ]
                              },
                              "modelPolicy": {
                                "type": "object",
                                "properties": {
                                  "defaultModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "cheapModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "strongModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "plannerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "workerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "verifierModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "synthesizerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effort": {
                                    "default": "normal",
                                    "type": "string",
                                    "enum": [
                                      "normal",
                                      "deep",
                                      "workflow",
                                      "max-workflow"
                                    ]
                                  },
                                  "allowedProviders": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "routing": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "phaseKind": {
                                          "type": "string",
                                          "enum": [
                                            "fanout",
                                            "sequential",
                                            "synthesis",
                                            "verification",
                                            "noop"
                                          ]
                                        },
                                        "use": {
                                          "type": "string",
                                          "enum": [
                                            "planner",
                                            "worker",
                                            "verifier",
                                            "synthesizer"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "use"
                                      ]
                                    }
                                  }
                                }
                              },
                              "budget": {
                                "type": "object",
                                "properties": {
                                  "maxTotalTokens": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxInputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxOutputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxWallTimeMs": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxConcurrentAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 16
                                  },
                                  "maxTotalAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 1000
                                  },
                                  "maxToolCalls": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxRetries": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 5
                                  }
                                }
                              },
                              "pacing": {
                                "type": "object",
                                "properties": {
                                  "maxRequestsPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 120
                                  },
                                  "maxTokensPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 2000000
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "kind"
                            ]
                          }
                        }
                      },
                      "required": [
                        "schemaVersion",
                        "id",
                        "name",
                        "description",
                        "phases"
                      ]
                    },
                    "inputValues": {
                      "default": {},
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "budget": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "budgetUsage": {
                      "type": "object",
                      "properties": {
                        "totalTokens": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "inputTokens": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "outputTokens": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "toolCalls": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "childAgents": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "retries": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      }
                    },
                    "verificationEnvelopeIDs": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "error": {
                      "type": "string"
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created",
                        "updated"
                      ]
                    },
                    "phases": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowPhaseEventRecord"
                      }
                    },
                    "children": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowChildEventRecord"
                      }
                    },
                    "artifacts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowArtifactEventRecord"
                      }
                    },
                    "budgetLedger": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowBudgetLedgerEventEntry"
                      }
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "status",
                    "spec",
                    "budget",
                    "budgetUsage",
                    "verificationEnvelopeIDs",
                    "time",
                    "phases",
                    "children",
                    "artifacts",
                    "budgetLedger"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "allowScaleBeyondDefaults": {
                    "type": "boolean"
                  },
                  "allowWriteWorkflows": {
                    "type": "boolean"
                  },
                  "durableChildren": {
                    "type": "boolean"
                  },
                  "enqueueChildren": {
                    "type": "boolean"
                  },
                  "autoStartChildren": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowRun.start({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-runs/{runID}/pause": {
      "post": {
        "operationId": "workflowRun.pause",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "runID",
            "schema": {
              "type": "string",
              "pattern": "^wfr_.*"
            },
            "required": true
          }
        ],
        "summary": "Pause workflow run",
        "description": "Pause queued workflow children where the queue supports pausing.",
        "responses": {
          "200": {
            "description": "Paused workflow run detail.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "projectID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "directory": {
                      "type": "string"
                    },
                    "parentSessionID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceTemplateID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "running",
                        "blocked",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "currentPhaseID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "spec": {
                      "type": "object",
                      "properties": {
                        "schemaVersion": {
                          "type": "number",
                          "const": 1
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80,
                          "pattern": "^[a-z][a-z0-9-]*$"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        },
                        "tags": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 80,
                            "pattern": "^[a-z][a-z0-9-]*$"
                          }
                        },
                        "trigger": {
                          "default": {
                            "kind": "manual",
                            "source": "prompt"
                          },
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "manual"
                                },
                                "source": {
                                  "default": "prompt",
                                  "type": "string",
                                  "enum": [
                                    "prompt",
                                    "command",
                                    "api"
                                  ]
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "scheduled"
                                },
                                "schedule": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "timezone": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind",
                                "schedule"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "command"
                                },
                                "command": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "api"
                                },
                                "route": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "webhook"
                                },
                                "event": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean",
                                  "const": false
                                },
                                "securityGate": {
                                  "default": "required",
                                  "type": "string",
                                  "const": "required"
                                }
                              },
                              "required": [
                                "kind",
                                "event"
                              ]
                            }
                          ]
                        },
                        "inputs": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 500
                              },
                              "type": {
                                "default": "string",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "json",
                                  "path",
                                  "string-array"
                                ]
                              },
                              "required": {
                                "default": false,
                                "type": "boolean"
                              },
                              "sensitive": {
                                "default": false,
                                "type": "boolean"
                              },
                              "default": {}
                            },
                            "required": [
                              "id"
                            ]
                          }
                        },
                        "routine": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "default": false,
                              "type": "boolean"
                            },
                            "mode": {
                              "default": "manual",
                              "type": "string",
                              "enum": [
                                "manual",
                                "scheduled",
                                "api",
                                "webhook"
                              ]
                            },
                            "schedule": {
                              "type": "string",
                              "minLength": 1
                            },
                            "timezone": {
                              "type": "string",
                              "minLength": 1
                            },
                            "apiRoute": {
                              "type": "string",
                              "minLength": 1
                            },
                            "webhookEvent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "securityGate": {
                              "default": "local-only",
                              "type": "string",
                              "enum": [
                                "local-only",
                                "required"
                              ]
                            }
                          }
                        },
                        "budget": {
                          "default": {
                            "maxTotalTokens": 100000,
                            "maxInputTokensPerChild": 50000,
                            "maxOutputTokensPerChild": 8000,
                            "maxWallTimeMs": 3600000,
                            "maxConcurrentAgents": 3,
                            "maxTotalAgents": 25,
                            "maxToolCalls": 500,
                            "maxRetries": 1
                          },
                          "type": "object",
                          "properties": {
                            "maxTotalTokens": {
                              "default": 100000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxInputTokensPerChild": {
                              "default": 50000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxOutputTokensPerChild": {
                              "default": 8000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxWallTimeMs": {
                              "default": 3600000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxConcurrentAgents": {
                              "default": 3,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 16
                            },
                            "maxTotalAgents": {
                              "default": 25,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 1000
                            },
                            "maxToolCalls": {
                              "default": 500,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxRetries": {
                              "default": 1,
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 5
                            }
                          }
                        },
                        "pacing": {
                          "default": {
                            "maxRequestsPerMinute": 12,
                            "maxTokensPerMinute": 200000
                          },
                          "type": "object",
                          "properties": {
                            "maxRequestsPerMinute": {
                              "default": 12,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 120
                            },
                            "maxTokensPerMinute": {
                              "default": 200000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 2000000
                            }
                          }
                        },
                        "modelPolicy": {
                          "default": {
                            "effort": "normal",
                            "allowedProviders": [],
                            "routing": []
                          },
                          "type": "object",
                          "properties": {
                            "defaultModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "cheapModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "strongModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "plannerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "workerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "verifierModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "synthesizerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "effort": {
                              "default": "normal",
                              "type": "string",
                              "enum": [
                                "normal",
                                "deep",
                                "workflow",
                                "max-workflow"
                              ]
                            },
                            "allowedProviders": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "routing": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "phaseKind": {
                                    "type": "string",
                                    "enum": [
                                      "fanout",
                                      "sequential",
                                      "synthesis",
                                      "verification",
                                      "noop"
                                    ]
                                  },
                                  "use": {
                                    "type": "string",
                                    "enum": [
                                      "planner",
                                      "worker",
                                      "verifier",
                                      "synthesizer"
                                    ]
                                  }
                                },
                                "required": [
                                  "use"
                                ]
                              }
                            }
                          }
                        },
                        "permissions": {
                          "default": {
                            "writePolicy": "read-only",
                            "allowedTools": [],
                            "networkPolicy": "inherit",
                            "escalationPolicy": "ask"
                          },
                          "type": "object",
                          "properties": {
                            "writePolicy": {
                              "default": "read-only",
                              "type": "string",
                              "enum": [
                                "read-only",
                                "serialized",
                                "worktree-required"
                              ]
                            },
                            "allowedTools": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "networkPolicy": {
                              "default": "inherit",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "disabled",
                                "allowed"
                              ]
                            },
                            "escalationPolicy": {
                              "default": "ask",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "ask",
                                "deny"
                              ]
                            }
                          }
                        },
                        "artifacts": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "summary",
                                  "finding",
                                  "patch",
                                  "verification",
                                  "metric",
                                  "log"
                                ]
                              },
                              "retention": {
                                "default": "session",
                                "type": "string",
                                "enum": [
                                  "ephemeral",
                                  "session",
                                  "durable"
                                ]
                              },
                              "exposeToMainContext": {
                                "default": false,
                                "type": "boolean"
                              },
                              "redaction": {
                                "type": "object",
                                "properties": {
                                  "status": {
                                    "default": "pending",
                                    "type": "string",
                                    "enum": [
                                      "none",
                                      "redacted",
                                      "pending"
                                    ]
                                  },
                                  "summary": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 500
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "kind"
                            ]
                          }
                        },
                        "verification": {
                          "default": {
                            "mode": "optional",
                            "commands": [],
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "mode": {
                              "default": "optional",
                              "type": "string",
                              "enum": [
                                "required",
                                "optional",
                                "deferred",
                                "skipped"
                              ]
                            },
                            "workflow": {
                              "type": "string",
                              "enum": [
                                "review",
                                "debug",
                                "qa"
                              ]
                            },
                            "commands": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            },
                            "reason": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            }
                          }
                        },
                        "synthesis": {
                          "default": {
                            "outputFormat": "markdown",
                            "exposeToMainContext": true,
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "agent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "model": {
                              "type": "string",
                              "minLength": 1
                            },
                            "outputFormat": {
                              "default": "markdown",
                              "type": "string",
                              "enum": [
                                "markdown",
                                "json",
                                "table",
                                "findings"
                              ]
                            },
                            "exposeToMainContext": {
                              "default": true,
                              "type": "boolean"
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            }
                          }
                        },
                        "phases": {
                          "minItems": 1,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "fanout",
                                  "sequential",
                                  "synthesis",
                                  "verification",
                                  "noop"
                                ]
                              },
                              "prompt": {
                                "type": "string",
                                "minLength": 1
                              },
                              "agent": {
                                "type": "string",
                                "minLength": 1
                              },
                              "inputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "outputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "dependsOn": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "maxParallel": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 16
                              },
                              "mergeStrategy": {
                                "default": "all",
                                "type": "string",
                                "enum": [
                                  "all",
                                  "first-success",
                                  "majority",
                                  "vote-with-critic",
                                  "critic-confirmation",
                                  "custom-reducer"
                                ]
                              },
                              "modelPolicy": {
                                "type": "object",
                                "properties": {
                                  "defaultModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "cheapModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "strongModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "plannerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "workerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "verifierModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "synthesizerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effort": {
                                    "default": "normal",
                                    "type": "string",
                                    "enum": [
                                      "normal",
                                      "deep",
                                      "workflow",
                                      "max-workflow"
                                    ]
                                  },
                                  "allowedProviders": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "routing": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "phaseKind": {
                                          "type": "string",
                                          "enum": [
                                            "fanout",
                                            "sequential",
                                            "synthesis",
                                            "verification",
                                            "noop"
                                          ]
                                        },
                                        "use": {
                                          "type": "string",
                                          "enum": [
                                            "planner",
                                            "worker",
                                            "verifier",
                                            "synthesizer"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "use"
                                      ]
                                    }
                                  }
                                }
                              },
                              "budget": {
                                "type": "object",
                                "properties": {
                                  "maxTotalTokens": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxInputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxOutputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxWallTimeMs": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxConcurrentAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 16
                                  },
                                  "maxTotalAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 1000
                                  },
                                  "maxToolCalls": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxRetries": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 5
                                  }
                                }
                              },
                              "pacing": {
                                "type": "object",
                                "properties": {
                                  "maxRequestsPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 120
                                  },
                                  "maxTokensPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 2000000
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "kind"
                            ]
                          }
                        }
                      },
                      "required": [
                        "schemaVersion",
                        "id",
                        "name",
                        "description",
                        "phases"
                      ]
                    },
                    "inputValues": {
                      "default": {},
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "budget": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "budgetUsage": {
                      "type": "object",
                      "properties": {
                        "totalTokens": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "inputTokens": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "outputTokens": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "toolCalls": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "childAgents": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "retries": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      }
                    },
                    "verificationEnvelopeIDs": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "error": {
                      "type": "string"
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created",
                        "updated"
                      ]
                    },
                    "phases": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowPhaseEventRecord"
                      }
                    },
                    "children": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowChildEventRecord"
                      }
                    },
                    "artifacts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowArtifactEventRecord"
                      }
                    },
                    "budgetLedger": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowBudgetLedgerEventEntry"
                      }
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "status",
                    "spec",
                    "budget",
                    "budgetUsage",
                    "verificationEnvelopeIDs",
                    "time",
                    "phases",
                    "children",
                    "artifacts",
                    "budgetLedger"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowRun.pause({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-runs/{runID}/resume": {
      "post": {
        "operationId": "workflowRun.resume",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "runID",
            "schema": {
              "type": "string",
              "pattern": "^wfr_.*"
            },
            "required": true
          }
        ],
        "summary": "Resume workflow run",
        "description": "Resume paused workflow queue children.",
        "responses": {
          "200": {
            "description": "Resumed workflow run detail.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "projectID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "directory": {
                      "type": "string"
                    },
                    "parentSessionID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceTemplateID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "running",
                        "blocked",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "currentPhaseID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "spec": {
                      "type": "object",
                      "properties": {
                        "schemaVersion": {
                          "type": "number",
                          "const": 1
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80,
                          "pattern": "^[a-z][a-z0-9-]*$"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        },
                        "tags": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 80,
                            "pattern": "^[a-z][a-z0-9-]*$"
                          }
                        },
                        "trigger": {
                          "default": {
                            "kind": "manual",
                            "source": "prompt"
                          },
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "manual"
                                },
                                "source": {
                                  "default": "prompt",
                                  "type": "string",
                                  "enum": [
                                    "prompt",
                                    "command",
                                    "api"
                                  ]
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "scheduled"
                                },
                                "schedule": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "timezone": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind",
                                "schedule"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "command"
                                },
                                "command": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "api"
                                },
                                "route": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "webhook"
                                },
                                "event": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean",
                                  "const": false
                                },
                                "securityGate": {
                                  "default": "required",
                                  "type": "string",
                                  "const": "required"
                                }
                              },
                              "required": [
                                "kind",
                                "event"
                              ]
                            }
                          ]
                        },
                        "inputs": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 500
                              },
                              "type": {
                                "default": "string",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "json",
                                  "path",
                                  "string-array"
                                ]
                              },
                              "required": {
                                "default": false,
                                "type": "boolean"
                              },
                              "sensitive": {
                                "default": false,
                                "type": "boolean"
                              },
                              "default": {}
                            },
                            "required": [
                              "id"
                            ]
                          }
                        },
                        "routine": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "default": false,
                              "type": "boolean"
                            },
                            "mode": {
                              "default": "manual",
                              "type": "string",
                              "enum": [
                                "manual",
                                "scheduled",
                                "api",
                                "webhook"
                              ]
                            },
                            "schedule": {
                              "type": "string",
                              "minLength": 1
                            },
                            "timezone": {
                              "type": "string",
                              "minLength": 1
                            },
                            "apiRoute": {
                              "type": "string",
                              "minLength": 1
                            },
                            "webhookEvent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "securityGate": {
                              "default": "local-only",
                              "type": "string",
                              "enum": [
                                "local-only",
                                "required"
                              ]
                            }
                          }
                        },
                        "budget": {
                          "default": {
                            "maxTotalTokens": 100000,
                            "maxInputTokensPerChild": 50000,
                            "maxOutputTokensPerChild": 8000,
                            "maxWallTimeMs": 3600000,
                            "maxConcurrentAgents": 3,
                            "maxTotalAgents": 25,
                            "maxToolCalls": 500,
                            "maxRetries": 1
                          },
                          "type": "object",
                          "properties": {
                            "maxTotalTokens": {
                              "default": 100000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxInputTokensPerChild": {
                              "default": 50000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxOutputTokensPerChild": {
                              "default": 8000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxWallTimeMs": {
                              "default": 3600000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxConcurrentAgents": {
                              "default": 3,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 16
                            },
                            "maxTotalAgents": {
                              "default": 25,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 1000
                            },
                            "maxToolCalls": {
                              "default": 500,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxRetries": {
                              "default": 1,
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 5
                            }
                          }
                        },
                        "pacing": {
                          "default": {
                            "maxRequestsPerMinute": 12,
                            "maxTokensPerMinute": 200000
                          },
                          "type": "object",
                          "properties": {
                            "maxRequestsPerMinute": {
                              "default": 12,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 120
                            },
                            "maxTokensPerMinute": {
                              "default": 200000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 2000000
                            }
                          }
                        },
                        "modelPolicy": {
                          "default": {
                            "effort": "normal",
                            "allowedProviders": [],
                            "routing": []
                          },
                          "type": "object",
                          "properties": {
                            "defaultModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "cheapModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "strongModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "plannerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "workerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "verifierModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "synthesizerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "effort": {
                              "default": "normal",
                              "type": "string",
                              "enum": [
                                "normal",
                                "deep",
                                "workflow",
                                "max-workflow"
                              ]
                            },
                            "allowedProviders": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "routing": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "phaseKind": {
                                    "type": "string",
                                    "enum": [
                                      "fanout",
                                      "sequential",
                                      "synthesis",
                                      "verification",
                                      "noop"
                                    ]
                                  },
                                  "use": {
                                    "type": "string",
                                    "enum": [
                                      "planner",
                                      "worker",
                                      "verifier",
                                      "synthesizer"
                                    ]
                                  }
                                },
                                "required": [
                                  "use"
                                ]
                              }
                            }
                          }
                        },
                        "permissions": {
                          "default": {
                            "writePolicy": "read-only",
                            "allowedTools": [],
                            "networkPolicy": "inherit",
                            "escalationPolicy": "ask"
                          },
                          "type": "object",
                          "properties": {
                            "writePolicy": {
                              "default": "read-only",
                              "type": "string",
                              "enum": [
                                "read-only",
                                "serialized",
                                "worktree-required"
                              ]
                            },
                            "allowedTools": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "networkPolicy": {
                              "default": "inherit",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "disabled",
                                "allowed"
                              ]
                            },
                            "escalationPolicy": {
                              "default": "ask",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "ask",
                                "deny"
                              ]
                            }
                          }
                        },
                        "artifacts": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "summary",
                                  "finding",
                                  "patch",
                                  "verification",
                                  "metric",
                                  "log"
                                ]
                              },
                              "retention": {
                                "default": "session",
                                "type": "string",
                                "enum": [
                                  "ephemeral",
                                  "session",
                                  "durable"
                                ]
                              },
                              "exposeToMainContext": {
                                "default": false,
                                "type": "boolean"
                              },
                              "redaction": {
                                "type": "object",
                                "properties": {
                                  "status": {
                                    "default": "pending",
                                    "type": "string",
                                    "enum": [
                                      "none",
                                      "redacted",
                                      "pending"
                                    ]
                                  },
                                  "summary": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 500
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "kind"
                            ]
                          }
                        },
                        "verification": {
                          "default": {
                            "mode": "optional",
                            "commands": [],
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "mode": {
                              "default": "optional",
                              "type": "string",
                              "enum": [
                                "required",
                                "optional",
                                "deferred",
                                "skipped"
                              ]
                            },
                            "workflow": {
                              "type": "string",
                              "enum": [
                                "review",
                                "debug",
                                "qa"
                              ]
                            },
                            "commands": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            },
                            "reason": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            }
                          }
                        },
                        "synthesis": {
                          "default": {
                            "outputFormat": "markdown",
                            "exposeToMainContext": true,
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "agent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "model": {
                              "type": "string",
                              "minLength": 1
                            },
                            "outputFormat": {
                              "default": "markdown",
                              "type": "string",
                              "enum": [
                                "markdown",
                                "json",
                                "table",
                                "findings"
                              ]
                            },
                            "exposeToMainContext": {
                              "default": true,
                              "type": "boolean"
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            }
                          }
                        },
                        "phases": {
                          "minItems": 1,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "fanout",
                                  "sequential",
                                  "synthesis",
                                  "verification",
                                  "noop"
                                ]
                              },
                              "prompt": {
                                "type": "string",
                                "minLength": 1
                              },
                              "agent": {
                                "type": "string",
                                "minLength": 1
                              },
                              "inputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "outputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "dependsOn": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "maxParallel": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 16
                              },
                              "mergeStrategy": {
                                "default": "all",
                                "type": "string",
                                "enum": [
                                  "all",
                                  "first-success",
                                  "majority",
                                  "vote-with-critic",
                                  "critic-confirmation",
                                  "custom-reducer"
                                ]
                              },
                              "modelPolicy": {
                                "type": "object",
                                "properties": {
                                  "defaultModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "cheapModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "strongModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "plannerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "workerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "verifierModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "synthesizerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effort": {
                                    "default": "normal",
                                    "type": "string",
                                    "enum": [
                                      "normal",
                                      "deep",
                                      "workflow",
                                      "max-workflow"
                                    ]
                                  },
                                  "allowedProviders": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "routing": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "phaseKind": {
                                          "type": "string",
                                          "enum": [
                                            "fanout",
                                            "sequential",
                                            "synthesis",
                                            "verification",
                                            "noop"
                                          ]
                                        },
                                        "use": {
                                          "type": "string",
                                          "enum": [
                                            "planner",
                                            "worker",
                                            "verifier",
                                            "synthesizer"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "use"
                                      ]
                                    }
                                  }
                                }
                              },
                              "budget": {
                                "type": "object",
                                "properties": {
                                  "maxTotalTokens": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxInputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxOutputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxWallTimeMs": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxConcurrentAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 16
                                  },
                                  "maxTotalAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 1000
                                  },
                                  "maxToolCalls": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxRetries": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 5
                                  }
                                }
                              },
                              "pacing": {
                                "type": "object",
                                "properties": {
                                  "maxRequestsPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 120
                                  },
                                  "maxTokensPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 2000000
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "kind"
                            ]
                          }
                        }
                      },
                      "required": [
                        "schemaVersion",
                        "id",
                        "name",
                        "description",
                        "phases"
                      ]
                    },
                    "inputValues": {
                      "default": {},
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "budget": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "budgetUsage": {
                      "type": "object",
                      "properties": {
                        "totalTokens": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "inputTokens": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "outputTokens": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "toolCalls": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "childAgents": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "retries": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      }
                    },
                    "verificationEnvelopeIDs": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "error": {
                      "type": "string"
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created",
                        "updated"
                      ]
                    },
                    "phases": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowPhaseEventRecord"
                      }
                    },
                    "children": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowChildEventRecord"
                      }
                    },
                    "artifacts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowArtifactEventRecord"
                      }
                    },
                    "budgetLedger": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowBudgetLedgerEventEntry"
                      }
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "status",
                    "spec",
                    "budget",
                    "budgetUsage",
                    "verificationEnvelopeIDs",
                    "time",
                    "phases",
                    "children",
                    "artifacts",
                    "budgetLedger"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowRun.resume({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-runs/{runID}/cancel": {
      "post": {
        "operationId": "workflowRun.cancel",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "runID",
            "schema": {
              "type": "string",
              "pattern": "^wfr_.*"
            },
            "required": true
          }
        ],
        "summary": "Cancel workflow run",
        "description": "Cancel queued workflow children and mark the workflow cancelled.",
        "responses": {
          "200": {
            "description": "Cancelled workflow run detail.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "projectID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "directory": {
                      "type": "string"
                    },
                    "parentSessionID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceTemplateID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "running",
                        "blocked",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "currentPhaseID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "spec": {
                      "type": "object",
                      "properties": {
                        "schemaVersion": {
                          "type": "number",
                          "const": 1
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80,
                          "pattern": "^[a-z][a-z0-9-]*$"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        },
                        "tags": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 80,
                            "pattern": "^[a-z][a-z0-9-]*$"
                          }
                        },
                        "trigger": {
                          "default": {
                            "kind": "manual",
                            "source": "prompt"
                          },
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "manual"
                                },
                                "source": {
                                  "default": "prompt",
                                  "type": "string",
                                  "enum": [
                                    "prompt",
                                    "command",
                                    "api"
                                  ]
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "scheduled"
                                },
                                "schedule": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "timezone": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind",
                                "schedule"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "command"
                                },
                                "command": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "api"
                                },
                                "route": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "webhook"
                                },
                                "event": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean",
                                  "const": false
                                },
                                "securityGate": {
                                  "default": "required",
                                  "type": "string",
                                  "const": "required"
                                }
                              },
                              "required": [
                                "kind",
                                "event"
                              ]
                            }
                          ]
                        },
                        "inputs": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 500
                              },
                              "type": {
                                "default": "string",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "json",
                                  "path",
                                  "string-array"
                                ]
                              },
                              "required": {
                                "default": false,
                                "type": "boolean"
                              },
                              "sensitive": {
                                "default": false,
                                "type": "boolean"
                              },
                              "default": {}
                            },
                            "required": [
                              "id"
                            ]
                          }
                        },
                        "routine": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "default": false,
                              "type": "boolean"
                            },
                            "mode": {
                              "default": "manual",
                              "type": "string",
                              "enum": [
                                "manual",
                                "scheduled",
                                "api",
                                "webhook"
                              ]
                            },
                            "schedule": {
                              "type": "string",
                              "minLength": 1
                            },
                            "timezone": {
                              "type": "string",
                              "minLength": 1
                            },
                            "apiRoute": {
                              "type": "string",
                              "minLength": 1
                            },
                            "webhookEvent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "securityGate": {
                              "default": "local-only",
                              "type": "string",
                              "enum": [
                                "local-only",
                                "required"
                              ]
                            }
                          }
                        },
                        "budget": {
                          "default": {
                            "maxTotalTokens": 100000,
                            "maxInputTokensPerChild": 50000,
                            "maxOutputTokensPerChild": 8000,
                            "maxWallTimeMs": 3600000,
                            "maxConcurrentAgents": 3,
                            "maxTotalAgents": 25,
                            "maxToolCalls": 500,
                            "maxRetries": 1
                          },
                          "type": "object",
                          "properties": {
                            "maxTotalTokens": {
                              "default": 100000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxInputTokensPerChild": {
                              "default": 50000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxOutputTokensPerChild": {
                              "default": 8000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxWallTimeMs": {
                              "default": 3600000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxConcurrentAgents": {
                              "default": 3,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 16
                            },
                            "maxTotalAgents": {
                              "default": 25,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 1000
                            },
                            "maxToolCalls": {
                              "default": 500,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxRetries": {
                              "default": 1,
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 5
                            }
                          }
                        },
                        "pacing": {
                          "default": {
                            "maxRequestsPerMinute": 12,
                            "maxTokensPerMinute": 200000
                          },
                          "type": "object",
                          "properties": {
                            "maxRequestsPerMinute": {
                              "default": 12,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 120
                            },
                            "maxTokensPerMinute": {
                              "default": 200000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 2000000
                            }
                          }
                        },
                        "modelPolicy": {
                          "default": {
                            "effort": "normal",
                            "allowedProviders": [],
                            "routing": []
                          },
                          "type": "object",
                          "properties": {
                            "defaultModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "cheapModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "strongModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "plannerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "workerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "verifierModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "synthesizerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "effort": {
                              "default": "normal",
                              "type": "string",
                              "enum": [
                                "normal",
                                "deep",
                                "workflow",
                                "max-workflow"
                              ]
                            },
                            "allowedProviders": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "routing": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "phaseKind": {
                                    "type": "string",
                                    "enum": [
                                      "fanout",
                                      "sequential",
                                      "synthesis",
                                      "verification",
                                      "noop"
                                    ]
                                  },
                                  "use": {
                                    "type": "string",
                                    "enum": [
                                      "planner",
                                      "worker",
                                      "verifier",
                                      "synthesizer"
                                    ]
                                  }
                                },
                                "required": [
                                  "use"
                                ]
                              }
                            }
                          }
                        },
                        "permissions": {
                          "default": {
                            "writePolicy": "read-only",
                            "allowedTools": [],
                            "networkPolicy": "inherit",
                            "escalationPolicy": "ask"
                          },
                          "type": "object",
                          "properties": {
                            "writePolicy": {
                              "default": "read-only",
                              "type": "string",
                              "enum": [
                                "read-only",
                                "serialized",
                                "worktree-required"
                              ]
                            },
                            "allowedTools": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "networkPolicy": {
                              "default": "inherit",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "disabled",
                                "allowed"
                              ]
                            },
                            "escalationPolicy": {
                              "default": "ask",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "ask",
                                "deny"
                              ]
                            }
                          }
                        },
                        "artifacts": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "summary",
                                  "finding",
                                  "patch",
                                  "verification",
                                  "metric",
                                  "log"
                                ]
                              },
                              "retention": {
                                "default": "session",
                                "type": "string",
                                "enum": [
                                  "ephemeral",
                                  "session",
                                  "durable"
                                ]
                              },
                              "exposeToMainContext": {
                                "default": false,
                                "type": "boolean"
                              },
                              "redaction": {
                                "type": "object",
                                "properties": {
                                  "status": {
                                    "default": "pending",
                                    "type": "string",
                                    "enum": [
                                      "none",
                                      "redacted",
                                      "pending"
                                    ]
                                  },
                                  "summary": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 500
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "kind"
                            ]
                          }
                        },
                        "verification": {
                          "default": {
                            "mode": "optional",
                            "commands": [],
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "mode": {
                              "default": "optional",
                              "type": "string",
                              "enum": [
                                "required",
                                "optional",
                                "deferred",
                                "skipped"
                              ]
                            },
                            "workflow": {
                              "type": "string",
                              "enum": [
                                "review",
                                "debug",
                                "qa"
                              ]
                            },
                            "commands": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            },
                            "reason": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            }
                          }
                        },
                        "synthesis": {
                          "default": {
                            "outputFormat": "markdown",
                            "exposeToMainContext": true,
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "agent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "model": {
                              "type": "string",
                              "minLength": 1
                            },
                            "outputFormat": {
                              "default": "markdown",
                              "type": "string",
                              "enum": [
                                "markdown",
                                "json",
                                "table",
                                "findings"
                              ]
                            },
                            "exposeToMainContext": {
                              "default": true,
                              "type": "boolean"
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            }
                          }
                        },
                        "phases": {
                          "minItems": 1,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "fanout",
                                  "sequential",
                                  "synthesis",
                                  "verification",
                                  "noop"
                                ]
                              },
                              "prompt": {
                                "type": "string",
                                "minLength": 1
                              },
                              "agent": {
                                "type": "string",
                                "minLength": 1
                              },
                              "inputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "outputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "dependsOn": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "maxParallel": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 16
                              },
                              "mergeStrategy": {
                                "default": "all",
                                "type": "string",
                                "enum": [
                                  "all",
                                  "first-success",
                                  "majority",
                                  "vote-with-critic",
                                  "critic-confirmation",
                                  "custom-reducer"
                                ]
                              },
                              "modelPolicy": {
                                "type": "object",
                                "properties": {
                                  "defaultModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "cheapModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "strongModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "plannerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "workerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "verifierModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "synthesizerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effort": {
                                    "default": "normal",
                                    "type": "string",
                                    "enum": [
                                      "normal",
                                      "deep",
                                      "workflow",
                                      "max-workflow"
                                    ]
                                  },
                                  "allowedProviders": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "routing": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "phaseKind": {
                                          "type": "string",
                                          "enum": [
                                            "fanout",
                                            "sequential",
                                            "synthesis",
                                            "verification",
                                            "noop"
                                          ]
                                        },
                                        "use": {
                                          "type": "string",
                                          "enum": [
                                            "planner",
                                            "worker",
                                            "verifier",
                                            "synthesizer"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "use"
                                      ]
                                    }
                                  }
                                }
                              },
                              "budget": {
                                "type": "object",
                                "properties": {
                                  "maxTotalTokens": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxInputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxOutputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxWallTimeMs": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxConcurrentAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 16
                                  },
                                  "maxTotalAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 1000
                                  },
                                  "maxToolCalls": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxRetries": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 5
                                  }
                                }
                              },
                              "pacing": {
                                "type": "object",
                                "properties": {
                                  "maxRequestsPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 120
                                  },
                                  "maxTokensPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 2000000
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "kind"
                            ]
                          }
                        }
                      },
                      "required": [
                        "schemaVersion",
                        "id",
                        "name",
                        "description",
                        "phases"
                      ]
                    },
                    "inputValues": {
                      "default": {},
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "budget": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "budgetUsage": {
                      "type": "object",
                      "properties": {
                        "totalTokens": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "inputTokens": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "outputTokens": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "toolCalls": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "childAgents": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "retries": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      }
                    },
                    "verificationEnvelopeIDs": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "error": {
                      "type": "string"
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created",
                        "updated"
                      ]
                    },
                    "phases": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowPhaseEventRecord"
                      }
                    },
                    "children": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowChildEventRecord"
                      }
                    },
                    "artifacts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowArtifactEventRecord"
                      }
                    },
                    "budgetLedger": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowBudgetLedgerEventEntry"
                      }
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "status",
                    "spec",
                    "budget",
                    "budgetUsage",
                    "verificationEnvelopeIDs",
                    "time",
                    "phases",
                    "children",
                    "artifacts",
                    "budgetLedger"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowRun.cancel({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-runs/{runID}/retry": {
      "post": {
        "operationId": "workflowRun.retry",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "runID",
            "schema": {
              "type": "string",
              "pattern": "^wfr_.*"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "phaseID",
            "schema": {
              "type": "string",
              "pattern": "^wfp_.*"
            }
          }
        ],
        "summary": "Retry workflow run",
        "description": "Retry failed or cancelled workflow queue children.",
        "responses": {
          "200": {
            "description": "Retried workflow run detail.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "projectID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "directory": {
                      "type": "string"
                    },
                    "parentSessionID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "sourceTemplateID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "running",
                        "blocked",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "currentPhaseID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "spec": {
                      "type": "object",
                      "properties": {
                        "schemaVersion": {
                          "type": "number",
                          "const": 1
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80,
                          "pattern": "^[a-z][a-z0-9-]*$"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        },
                        "tags": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 80,
                            "pattern": "^[a-z][a-z0-9-]*$"
                          }
                        },
                        "trigger": {
                          "default": {
                            "kind": "manual",
                            "source": "prompt"
                          },
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "manual"
                                },
                                "source": {
                                  "default": "prompt",
                                  "type": "string",
                                  "enum": [
                                    "prompt",
                                    "command",
                                    "api"
                                  ]
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "scheduled"
                                },
                                "schedule": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "timezone": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind",
                                "schedule"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "command"
                                },
                                "command": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "api"
                                },
                                "route": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "webhook"
                                },
                                "event": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean",
                                  "const": false
                                },
                                "securityGate": {
                                  "default": "required",
                                  "type": "string",
                                  "const": "required"
                                }
                              },
                              "required": [
                                "kind",
                                "event"
                              ]
                            }
                          ]
                        },
                        "inputs": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 500
                              },
                              "type": {
                                "default": "string",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "json",
                                  "path",
                                  "string-array"
                                ]
                              },
                              "required": {
                                "default": false,
                                "type": "boolean"
                              },
                              "sensitive": {
                                "default": false,
                                "type": "boolean"
                              },
                              "default": {}
                            },
                            "required": [
                              "id"
                            ]
                          }
                        },
                        "routine": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "default": false,
                              "type": "boolean"
                            },
                            "mode": {
                              "default": "manual",
                              "type": "string",
                              "enum": [
                                "manual",
                                "scheduled",
                                "api",
                                "webhook"
                              ]
                            },
                            "schedule": {
                              "type": "string",
                              "minLength": 1
                            },
                            "timezone": {
                              "type": "string",
                              "minLength": 1
                            },
                            "apiRoute": {
                              "type": "string",
                              "minLength": 1
                            },
                            "webhookEvent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "securityGate": {
                              "default": "local-only",
                              "type": "string",
                              "enum": [
                                "local-only",
                                "required"
                              ]
                            }
                          }
                        },
                        "budget": {
                          "default": {
                            "maxTotalTokens": 100000,
                            "maxInputTokensPerChild": 50000,
                            "maxOutputTokensPerChild": 8000,
                            "maxWallTimeMs": 3600000,
                            "maxConcurrentAgents": 3,
                            "maxTotalAgents": 25,
                            "maxToolCalls": 500,
                            "maxRetries": 1
                          },
                          "type": "object",
                          "properties": {
                            "maxTotalTokens": {
                              "default": 100000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxInputTokensPerChild": {
                              "default": 50000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxOutputTokensPerChild": {
                              "default": 8000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxWallTimeMs": {
                              "default": 3600000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxConcurrentAgents": {
                              "default": 3,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 16
                            },
                            "maxTotalAgents": {
                              "default": 25,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 1000
                            },
                            "maxToolCalls": {
                              "default": 500,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxRetries": {
                              "default": 1,
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 5
                            }
                          }
                        },
                        "pacing": {
                          "default": {
                            "maxRequestsPerMinute": 12,
                            "maxTokensPerMinute": 200000
                          },
                          "type": "object",
                          "properties": {
                            "maxRequestsPerMinute": {
                              "default": 12,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 120
                            },
                            "maxTokensPerMinute": {
                              "default": 200000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 2000000
                            }
                          }
                        },
                        "modelPolicy": {
                          "default": {
                            "effort": "normal",
                            "allowedProviders": [],
                            "routing": []
                          },
                          "type": "object",
                          "properties": {
                            "defaultModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "cheapModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "strongModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "plannerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "workerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "verifierModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "synthesizerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "effort": {
                              "default": "normal",
                              "type": "string",
                              "enum": [
                                "normal",
                                "deep",
                                "workflow",
                                "max-workflow"
                              ]
                            },
                            "allowedProviders": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "routing": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "phaseKind": {
                                    "type": "string",
                                    "enum": [
                                      "fanout",
                                      "sequential",
                                      "synthesis",
                                      "verification",
                                      "noop"
                                    ]
                                  },
                                  "use": {
                                    "type": "string",
                                    "enum": [
                                      "planner",
                                      "worker",
                                      "verifier",
                                      "synthesizer"
                                    ]
                                  }
                                },
                                "required": [
                                  "use"
                                ]
                              }
                            }
                          }
                        },
                        "permissions": {
                          "default": {
                            "writePolicy": "read-only",
                            "allowedTools": [],
                            "networkPolicy": "inherit",
                            "escalationPolicy": "ask"
                          },
                          "type": "object",
                          "properties": {
                            "writePolicy": {
                              "default": "read-only",
                              "type": "string",
                              "enum": [
                                "read-only",
                                "serialized",
                                "worktree-required"
                              ]
                            },
                            "allowedTools": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "networkPolicy": {
                              "default": "inherit",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "disabled",
                                "allowed"
                              ]
                            },
                            "escalationPolicy": {
                              "default": "ask",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "ask",
                                "deny"
                              ]
                            }
                          }
                        },
                        "artifacts": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "summary",
                                  "finding",
                                  "patch",
                                  "verification",
                                  "metric",
                                  "log"
                                ]
                              },
                              "retention": {
                                "default": "session",
                                "type": "string",
                                "enum": [
                                  "ephemeral",
                                  "session",
                                  "durable"
                                ]
                              },
                              "exposeToMainContext": {
                                "default": false,
                                "type": "boolean"
                              },
                              "redaction": {
                                "type": "object",
                                "properties": {
                                  "status": {
                                    "default": "pending",
                                    "type": "string",
                                    "enum": [
                                      "none",
                                      "redacted",
                                      "pending"
                                    ]
                                  },
                                  "summary": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 500
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "kind"
                            ]
                          }
                        },
                        "verification": {
                          "default": {
                            "mode": "optional",
                            "commands": [],
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "mode": {
                              "default": "optional",
                              "type": "string",
                              "enum": [
                                "required",
                                "optional",
                                "deferred",
                                "skipped"
                              ]
                            },
                            "workflow": {
                              "type": "string",
                              "enum": [
                                "review",
                                "debug",
                                "qa"
                              ]
                            },
                            "commands": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            },
                            "reason": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            }
                          }
                        },
                        "synthesis": {
                          "default": {
                            "outputFormat": "markdown",
                            "exposeToMainContext": true,
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "agent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "model": {
                              "type": "string",
                              "minLength": 1
                            },
                            "outputFormat": {
                              "default": "markdown",
                              "type": "string",
                              "enum": [
                                "markdown",
                                "json",
                                "table",
                                "findings"
                              ]
                            },
                            "exposeToMainContext": {
                              "default": true,
                              "type": "boolean"
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            }
                          }
                        },
                        "phases": {
                          "minItems": 1,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "fanout",
                                  "sequential",
                                  "synthesis",
                                  "verification",
                                  "noop"
                                ]
                              },
                              "prompt": {
                                "type": "string",
                                "minLength": 1
                              },
                              "agent": {
                                "type": "string",
                                "minLength": 1
                              },
                              "inputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "outputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "dependsOn": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "maxParallel": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 16
                              },
                              "mergeStrategy": {
                                "default": "all",
                                "type": "string",
                                "enum": [
                                  "all",
                                  "first-success",
                                  "majority",
                                  "vote-with-critic",
                                  "critic-confirmation",
                                  "custom-reducer"
                                ]
                              },
                              "modelPolicy": {
                                "type": "object",
                                "properties": {
                                  "defaultModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "cheapModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "strongModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "plannerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "workerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "verifierModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "synthesizerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effort": {
                                    "default": "normal",
                                    "type": "string",
                                    "enum": [
                                      "normal",
                                      "deep",
                                      "workflow",
                                      "max-workflow"
                                    ]
                                  },
                                  "allowedProviders": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "routing": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "phaseKind": {
                                          "type": "string",
                                          "enum": [
                                            "fanout",
                                            "sequential",
                                            "synthesis",
                                            "verification",
                                            "noop"
                                          ]
                                        },
                                        "use": {
                                          "type": "string",
                                          "enum": [
                                            "planner",
                                            "worker",
                                            "verifier",
                                            "synthesizer"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "use"
                                      ]
                                    }
                                  }
                                }
                              },
                              "budget": {
                                "type": "object",
                                "properties": {
                                  "maxTotalTokens": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxInputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxOutputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxWallTimeMs": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxConcurrentAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 16
                                  },
                                  "maxTotalAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 1000
                                  },
                                  "maxToolCalls": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxRetries": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 5
                                  }
                                }
                              },
                              "pacing": {
                                "type": "object",
                                "properties": {
                                  "maxRequestsPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 120
                                  },
                                  "maxTokensPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 2000000
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "kind"
                            ]
                          }
                        }
                      },
                      "required": [
                        "schemaVersion",
                        "id",
                        "name",
                        "description",
                        "phases"
                      ]
                    },
                    "inputValues": {
                      "default": {},
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "budget": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "budgetUsage": {
                      "type": "object",
                      "properties": {
                        "totalTokens": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "inputTokens": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "outputTokens": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "toolCalls": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "childAgents": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "retries": {
                          "default": 0,
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      }
                    },
                    "verificationEnvelopeIDs": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "error": {
                      "type": "string"
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created",
                        "updated"
                      ]
                    },
                    "phases": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowPhaseEventRecord"
                      }
                    },
                    "children": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowChildEventRecord"
                      }
                    },
                    "artifacts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowArtifactEventRecord"
                      }
                    },
                    "budgetLedger": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WorkflowBudgetLedgerEventEntry"
                      }
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "status",
                    "spec",
                    "budget",
                    "budgetUsage",
                    "verificationEnvelopeIDs",
                    "time",
                    "phases",
                    "children",
                    "artifacts",
                    "budgetLedger"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowRun.retry({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-templates": {
      "get": {
        "operationId": "workflowTemplate.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "List workflow templates",
        "description": "Return built-in workflow templates available for the current runtime.",
        "responses": {
          "200": {
            "description": "Workflow templates.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "source": {
                        "type": "string",
                        "enum": [
                          "builtin",
                          "user",
                          "project"
                        ]
                      },
                      "trust": {
                        "type": "string",
                        "enum": [
                          "candidate",
                          "trusted"
                        ]
                      },
                      "name": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "tags": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "revision": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "specHash": {
                        "type": "string"
                      },
                      "spec": {
                        "type": "object",
                        "properties": {
                          "schemaVersion": {
                            "type": "number",
                            "const": 1
                          },
                          "id": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 80,
                            "pattern": "^[a-z][a-z0-9-]*$"
                          },
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "description": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000
                          },
                          "tags": {
                            "default": [],
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z][a-z0-9-]*$"
                            }
                          },
                          "trigger": {
                            "default": {
                              "kind": "manual",
                              "source": "prompt"
                            },
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "manual"
                                  },
                                  "source": {
                                    "default": "prompt",
                                    "type": "string",
                                    "enum": [
                                      "prompt",
                                      "command",
                                      "api"
                                    ]
                                  }
                                },
                                "required": [
                                  "kind"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "scheduled"
                                  },
                                  "schedule": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "timezone": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "enabled": {
                                    "default": false,
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "schedule"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "command"
                                  },
                                  "command": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "kind"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "api"
                                  },
                                  "route": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "enabled": {
                                    "default": false,
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "kind"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "webhook"
                                  },
                                  "event": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "enabled": {
                                    "default": false,
                                    "type": "boolean",
                                    "const": false
                                  },
                                  "securityGate": {
                                    "default": "required",
                                    "type": "string",
                                    "const": "required"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "event"
                                ]
                              }
                            ]
                          },
                          "inputs": {
                            "default": [],
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                },
                                "label": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 500
                                },
                                "type": {
                                  "default": "string",
                                  "type": "string",
                                  "enum": [
                                    "string",
                                    "number",
                                    "boolean",
                                    "json",
                                    "path",
                                    "string-array"
                                  ]
                                },
                                "required": {
                                  "default": false,
                                  "type": "boolean"
                                },
                                "sensitive": {
                                  "default": false,
                                  "type": "boolean"
                                },
                                "default": {}
                              },
                              "required": [
                                "id"
                              ]
                            }
                          },
                          "routine": {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "default": false,
                                "type": "boolean"
                              },
                              "mode": {
                                "default": "manual",
                                "type": "string",
                                "enum": [
                                  "manual",
                                  "scheduled",
                                  "api",
                                  "webhook"
                                ]
                              },
                              "schedule": {
                                "type": "string",
                                "minLength": 1
                              },
                              "timezone": {
                                "type": "string",
                                "minLength": 1
                              },
                              "apiRoute": {
                                "type": "string",
                                "minLength": 1
                              },
                              "webhookEvent": {
                                "type": "string",
                                "minLength": 1
                              },
                              "securityGate": {
                                "default": "local-only",
                                "type": "string",
                                "enum": [
                                  "local-only",
                                  "required"
                                ]
                              }
                            }
                          },
                          "budget": {
                            "default": {
                              "maxTotalTokens": 100000,
                              "maxInputTokensPerChild": 50000,
                              "maxOutputTokensPerChild": 8000,
                              "maxWallTimeMs": 3600000,
                              "maxConcurrentAgents": 3,
                              "maxTotalAgents": 25,
                              "maxToolCalls": 500,
                              "maxRetries": 1
                            },
                            "type": "object",
                            "properties": {
                              "maxTotalTokens": {
                                "default": 100000,
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "maxInputTokensPerChild": {
                                "default": 50000,
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "maxOutputTokensPerChild": {
                                "default": 8000,
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "maxWallTimeMs": {
                                "default": 3600000,
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "maxConcurrentAgents": {
                                "default": 3,
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 16
                              },
                              "maxTotalAgents": {
                                "default": 25,
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 1000
                              },
                              "maxToolCalls": {
                                "default": 500,
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "maxRetries": {
                                "default": 1,
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 5
                              }
                            }
                          },
                          "pacing": {
                            "default": {
                              "maxRequestsPerMinute": 12,
                              "maxTokensPerMinute": 200000
                            },
                            "type": "object",
                            "properties": {
                              "maxRequestsPerMinute": {
                                "default": 12,
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 120
                              },
                              "maxTokensPerMinute": {
                                "default": 200000,
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 2000000
                              }
                            }
                          },
                          "modelPolicy": {
                            "default": {
                              "effort": "normal",
                              "allowedProviders": [],
                              "routing": []
                            },
                            "type": "object",
                            "properties": {
                              "defaultModel": {
                                "type": "string",
                                "minLength": 1
                              },
                              "cheapModel": {
                                "type": "string",
                                "minLength": 1
                              },
                              "strongModel": {
                                "type": "string",
                                "minLength": 1
                              },
                              "plannerModel": {
                                "type": "string",
                                "minLength": 1
                              },
                              "workerModel": {
                                "type": "string",
                                "minLength": 1
                              },
                              "verifierModel": {
                                "type": "string",
                                "minLength": 1
                              },
                              "synthesizerModel": {
                                "type": "string",
                                "minLength": 1
                              },
                              "effort": {
                                "default": "normal",
                                "type": "string",
                                "enum": [
                                  "normal",
                                  "deep",
                                  "workflow",
                                  "max-workflow"
                                ]
                              },
                              "allowedProviders": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "routing": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "phaseKind": {
                                      "type": "string",
                                      "enum": [
                                        "fanout",
                                        "sequential",
                                        "synthesis",
                                        "verification",
                                        "noop"
                                      ]
                                    },
                                    "use": {
                                      "type": "string",
                                      "enum": [
                                        "planner",
                                        "worker",
                                        "verifier",
                                        "synthesizer"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "use"
                                  ]
                                }
                              }
                            }
                          },
                          "permissions": {
                            "default": {
                              "writePolicy": "read-only",
                              "allowedTools": [],
                              "networkPolicy": "inherit",
                              "escalationPolicy": "ask"
                            },
                            "type": "object",
                            "properties": {
                              "writePolicy": {
                                "default": "read-only",
                                "type": "string",
                                "enum": [
                                  "read-only",
                                  "serialized",
                                  "worktree-required"
                                ]
                              },
                              "allowedTools": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "networkPolicy": {
                                "default": "inherit",
                                "type": "string",
                                "enum": [
                                  "inherit",
                                  "disabled",
                                  "allowed"
                                ]
                              },
                              "escalationPolicy": {
                                "default": "ask",
                                "type": "string",
                                "enum": [
                                  "inherit",
                                  "ask",
                                  "deny"
                                ]
                              }
                            }
                          },
                          "artifacts": {
                            "default": [],
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "summary",
                                    "finding",
                                    "patch",
                                    "verification",
                                    "metric",
                                    "log"
                                  ]
                                },
                                "retention": {
                                  "default": "session",
                                  "type": "string",
                                  "enum": [
                                    "ephemeral",
                                    "session",
                                    "durable"
                                  ]
                                },
                                "exposeToMainContext": {
                                  "default": false,
                                  "type": "boolean"
                                },
                                "redaction": {
                                  "type": "object",
                                  "properties": {
                                    "status": {
                                      "default": "pending",
                                      "type": "string",
                                      "enum": [
                                        "none",
                                        "redacted",
                                        "pending"
                                      ]
                                    },
                                    "summary": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 500
                                    }
                                  }
                                }
                              },
                              "required": [
                                "id",
                                "kind"
                              ]
                            }
                          },
                          "verification": {
                            "default": {
                              "mode": "optional",
                              "commands": [],
                              "requiredArtifactIds": []
                            },
                            "type": "object",
                            "properties": {
                              "mode": {
                                "default": "optional",
                                "type": "string",
                                "enum": [
                                  "required",
                                  "optional",
                                  "deferred",
                                  "skipped"
                                ]
                              },
                              "workflow": {
                                "type": "string",
                                "enum": [
                                  "review",
                                  "debug",
                                  "qa"
                                ]
                              },
                              "commands": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "requiredArtifactIds": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "reason": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 500
                              }
                            }
                          },
                          "synthesis": {
                            "default": {
                              "outputFormat": "markdown",
                              "exposeToMainContext": true,
                              "requiredArtifactIds": []
                            },
                            "type": "object",
                            "properties": {
                              "agent": {
                                "type": "string",
                                "minLength": 1
                              },
                              "model": {
                                "type": "string",
                                "minLength": 1
                              },
                              "outputFormat": {
                                "default": "markdown",
                                "type": "string",
                                "enum": [
                                  "markdown",
                                  "json",
                                  "table",
                                  "findings"
                                ]
                              },
                              "exposeToMainContext": {
                                "default": true,
                                "type": "boolean"
                              },
                              "requiredArtifactIds": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              }
                            }
                          },
                          "phases": {
                            "minItems": 1,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "fanout",
                                    "sequential",
                                    "synthesis",
                                    "verification",
                                    "noop"
                                  ]
                                },
                                "prompt": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "agent": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "inputs": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "outputs": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 80,
                                    "pattern": "^[a-z][a-z0-9-]*$"
                                  }
                                },
                                "dependsOn": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 80,
                                    "pattern": "^[a-z][a-z0-9-]*$"
                                  }
                                },
                                "maxParallel": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 16
                                },
                                "mergeStrategy": {
                                  "default": "all",
                                  "type": "string",
                                  "enum": [
                                    "all",
                                    "first-success",
                                    "majority",
                                    "vote-with-critic",
                                    "critic-confirmation",
                                    "custom-reducer"
                                  ]
                                },
                                "modelPolicy": {
                                  "type": "object",
                                  "properties": {
                                    "defaultModel": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "cheapModel": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "strongModel": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "plannerModel": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "workerModel": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "verifierModel": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "synthesizerModel": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "effort": {
                                      "default": "normal",
                                      "type": "string",
                                      "enum": [
                                        "normal",
                                        "deep",
                                        "workflow",
                                        "max-workflow"
                                      ]
                                    },
                                    "allowedProviders": {
                                      "default": [],
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "routing": {
                                      "default": [],
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "phaseKind": {
                                            "type": "string",
                                            "enum": [
                                              "fanout",
                                              "sequential",
                                              "synthesis",
                                              "verification",
                                              "noop"
                                            ]
                                          },
                                          "use": {
                                            "type": "string",
                                            "enum": [
                                              "planner",
                                              "worker",
                                              "verifier",
                                              "synthesizer"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "use"
                                        ]
                                      }
                                    }
                                  }
                                },
                                "budget": {
                                  "type": "object",
                                  "properties": {
                                    "maxTotalTokens": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "maxInputTokensPerChild": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "maxOutputTokensPerChild": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "maxWallTimeMs": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "maxConcurrentAgents": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 16
                                    },
                                    "maxTotalAgents": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 1000
                                    },
                                    "maxToolCalls": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "maxRetries": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 5
                                    }
                                  }
                                },
                                "pacing": {
                                  "type": "object",
                                  "properties": {
                                    "maxRequestsPerMinute": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 120
                                    },
                                    "maxTokensPerMinute": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 2000000
                                    }
                                  }
                                }
                              },
                              "required": [
                                "id",
                                "name",
                                "kind"
                              ]
                            }
                          }
                        },
                        "required": [
                          "schemaVersion",
                          "id",
                          "name",
                          "description",
                          "phases"
                        ]
                      },
                      "path": {
                        "type": "string"
                      },
                      "time": {
                        "type": "object",
                        "properties": {
                          "created": {
                            "type": "number"
                          },
                          "updated": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "created",
                          "updated"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "source",
                      "trust",
                      "name",
                      "description",
                      "tags",
                      "revision",
                      "specHash",
                      "spec"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowTemplate.list({\n  ...\n})"
          }
        ]
      },
      "post": {
        "operationId": "workflowTemplate.save",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Save workflow template",
        "description": "Save a user-local or project-local workflow template candidate. Promote after review to trust it.",
        "responses": {
          "200": {
            "description": "Saved workflow template.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "builtin",
                        "user",
                        "project"
                      ]
                    },
                    "trust": {
                      "type": "string",
                      "enum": [
                        "candidate",
                        "trusted"
                      ]
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "revision": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "specHash": {
                      "type": "string"
                    },
                    "spec": {
                      "type": "object",
                      "properties": {
                        "schemaVersion": {
                          "type": "number",
                          "const": 1
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80,
                          "pattern": "^[a-z][a-z0-9-]*$"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        },
                        "tags": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 80,
                            "pattern": "^[a-z][a-z0-9-]*$"
                          }
                        },
                        "trigger": {
                          "default": {
                            "kind": "manual",
                            "source": "prompt"
                          },
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "manual"
                                },
                                "source": {
                                  "default": "prompt",
                                  "type": "string",
                                  "enum": [
                                    "prompt",
                                    "command",
                                    "api"
                                  ]
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "scheduled"
                                },
                                "schedule": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "timezone": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind",
                                "schedule"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "command"
                                },
                                "command": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "api"
                                },
                                "route": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "webhook"
                                },
                                "event": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean",
                                  "const": false
                                },
                                "securityGate": {
                                  "default": "required",
                                  "type": "string",
                                  "const": "required"
                                }
                              },
                              "required": [
                                "kind",
                                "event"
                              ]
                            }
                          ]
                        },
                        "inputs": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 500
                              },
                              "type": {
                                "default": "string",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "json",
                                  "path",
                                  "string-array"
                                ]
                              },
                              "required": {
                                "default": false,
                                "type": "boolean"
                              },
                              "sensitive": {
                                "default": false,
                                "type": "boolean"
                              },
                              "default": {}
                            },
                            "required": [
                              "id"
                            ]
                          }
                        },
                        "routine": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "default": false,
                              "type": "boolean"
                            },
                            "mode": {
                              "default": "manual",
                              "type": "string",
                              "enum": [
                                "manual",
                                "scheduled",
                                "api",
                                "webhook"
                              ]
                            },
                            "schedule": {
                              "type": "string",
                              "minLength": 1
                            },
                            "timezone": {
                              "type": "string",
                              "minLength": 1
                            },
                            "apiRoute": {
                              "type": "string",
                              "minLength": 1
                            },
                            "webhookEvent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "securityGate": {
                              "default": "local-only",
                              "type": "string",
                              "enum": [
                                "local-only",
                                "required"
                              ]
                            }
                          }
                        },
                        "budget": {
                          "default": {
                            "maxTotalTokens": 100000,
                            "maxInputTokensPerChild": 50000,
                            "maxOutputTokensPerChild": 8000,
                            "maxWallTimeMs": 3600000,
                            "maxConcurrentAgents": 3,
                            "maxTotalAgents": 25,
                            "maxToolCalls": 500,
                            "maxRetries": 1
                          },
                          "type": "object",
                          "properties": {
                            "maxTotalTokens": {
                              "default": 100000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxInputTokensPerChild": {
                              "default": 50000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxOutputTokensPerChild": {
                              "default": 8000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxWallTimeMs": {
                              "default": 3600000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxConcurrentAgents": {
                              "default": 3,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 16
                            },
                            "maxTotalAgents": {
                              "default": 25,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 1000
                            },
                            "maxToolCalls": {
                              "default": 500,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxRetries": {
                              "default": 1,
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 5
                            }
                          }
                        },
                        "pacing": {
                          "default": {
                            "maxRequestsPerMinute": 12,
                            "maxTokensPerMinute": 200000
                          },
                          "type": "object",
                          "properties": {
                            "maxRequestsPerMinute": {
                              "default": 12,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 120
                            },
                            "maxTokensPerMinute": {
                              "default": 200000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 2000000
                            }
                          }
                        },
                        "modelPolicy": {
                          "default": {
                            "effort": "normal",
                            "allowedProviders": [],
                            "routing": []
                          },
                          "type": "object",
                          "properties": {
                            "defaultModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "cheapModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "strongModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "plannerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "workerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "verifierModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "synthesizerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "effort": {
                              "default": "normal",
                              "type": "string",
                              "enum": [
                                "normal",
                                "deep",
                                "workflow",
                                "max-workflow"
                              ]
                            },
                            "allowedProviders": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "routing": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "phaseKind": {
                                    "type": "string",
                                    "enum": [
                                      "fanout",
                                      "sequential",
                                      "synthesis",
                                      "verification",
                                      "noop"
                                    ]
                                  },
                                  "use": {
                                    "type": "string",
                                    "enum": [
                                      "planner",
                                      "worker",
                                      "verifier",
                                      "synthesizer"
                                    ]
                                  }
                                },
                                "required": [
                                  "use"
                                ]
                              }
                            }
                          }
                        },
                        "permissions": {
                          "default": {
                            "writePolicy": "read-only",
                            "allowedTools": [],
                            "networkPolicy": "inherit",
                            "escalationPolicy": "ask"
                          },
                          "type": "object",
                          "properties": {
                            "writePolicy": {
                              "default": "read-only",
                              "type": "string",
                              "enum": [
                                "read-only",
                                "serialized",
                                "worktree-required"
                              ]
                            },
                            "allowedTools": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "networkPolicy": {
                              "default": "inherit",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "disabled",
                                "allowed"
                              ]
                            },
                            "escalationPolicy": {
                              "default": "ask",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "ask",
                                "deny"
                              ]
                            }
                          }
                        },
                        "artifacts": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "summary",
                                  "finding",
                                  "patch",
                                  "verification",
                                  "metric",
                                  "log"
                                ]
                              },
                              "retention": {
                                "default": "session",
                                "type": "string",
                                "enum": [
                                  "ephemeral",
                                  "session",
                                  "durable"
                                ]
                              },
                              "exposeToMainContext": {
                                "default": false,
                                "type": "boolean"
                              },
                              "redaction": {
                                "type": "object",
                                "properties": {
                                  "status": {
                                    "default": "pending",
                                    "type": "string",
                                    "enum": [
                                      "none",
                                      "redacted",
                                      "pending"
                                    ]
                                  },
                                  "summary": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 500
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "kind"
                            ]
                          }
                        },
                        "verification": {
                          "default": {
                            "mode": "optional",
                            "commands": [],
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "mode": {
                              "default": "optional",
                              "type": "string",
                              "enum": [
                                "required",
                                "optional",
                                "deferred",
                                "skipped"
                              ]
                            },
                            "workflow": {
                              "type": "string",
                              "enum": [
                                "review",
                                "debug",
                                "qa"
                              ]
                            },
                            "commands": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            },
                            "reason": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            }
                          }
                        },
                        "synthesis": {
                          "default": {
                            "outputFormat": "markdown",
                            "exposeToMainContext": true,
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "agent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "model": {
                              "type": "string",
                              "minLength": 1
                            },
                            "outputFormat": {
                              "default": "markdown",
                              "type": "string",
                              "enum": [
                                "markdown",
                                "json",
                                "table",
                                "findings"
                              ]
                            },
                            "exposeToMainContext": {
                              "default": true,
                              "type": "boolean"
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            }
                          }
                        },
                        "phases": {
                          "minItems": 1,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "fanout",
                                  "sequential",
                                  "synthesis",
                                  "verification",
                                  "noop"
                                ]
                              },
                              "prompt": {
                                "type": "string",
                                "minLength": 1
                              },
                              "agent": {
                                "type": "string",
                                "minLength": 1
                              },
                              "inputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "outputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "dependsOn": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "maxParallel": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 16
                              },
                              "mergeStrategy": {
                                "default": "all",
                                "type": "string",
                                "enum": [
                                  "all",
                                  "first-success",
                                  "majority",
                                  "vote-with-critic",
                                  "critic-confirmation",
                                  "custom-reducer"
                                ]
                              },
                              "modelPolicy": {
                                "type": "object",
                                "properties": {
                                  "defaultModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "cheapModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "strongModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "plannerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "workerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "verifierModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "synthesizerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effort": {
                                    "default": "normal",
                                    "type": "string",
                                    "enum": [
                                      "normal",
                                      "deep",
                                      "workflow",
                                      "max-workflow"
                                    ]
                                  },
                                  "allowedProviders": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "routing": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "phaseKind": {
                                          "type": "string",
                                          "enum": [
                                            "fanout",
                                            "sequential",
                                            "synthesis",
                                            "verification",
                                            "noop"
                                          ]
                                        },
                                        "use": {
                                          "type": "string",
                                          "enum": [
                                            "planner",
                                            "worker",
                                            "verifier",
                                            "synthesizer"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "use"
                                      ]
                                    }
                                  }
                                }
                              },
                              "budget": {
                                "type": "object",
                                "properties": {
                                  "maxTotalTokens": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxInputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxOutputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxWallTimeMs": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxConcurrentAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 16
                                  },
                                  "maxTotalAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 1000
                                  },
                                  "maxToolCalls": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxRetries": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 5
                                  }
                                }
                              },
                              "pacing": {
                                "type": "object",
                                "properties": {
                                  "maxRequestsPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 120
                                  },
                                  "maxTokensPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 2000000
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "kind"
                            ]
                          }
                        }
                      },
                      "required": [
                        "schemaVersion",
                        "id",
                        "name",
                        "description",
                        "phases"
                      ]
                    },
                    "path": {
                      "type": "string"
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created",
                        "updated"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "source",
                    "trust",
                    "name",
                    "description",
                    "tags",
                    "revision",
                    "specHash",
                    "spec"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "scope": {
                    "type": "string",
                    "enum": [
                      "user",
                      "project"
                    ]
                  },
                  "spec": {
                    "type": "object",
                    "properties": {
                      "schemaVersion": {
                        "type": "number",
                        "const": 1
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80,
                        "pattern": "^[a-z][a-z0-9-]*$"
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "description": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 1000
                      },
                      "tags": {
                        "default": [],
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80,
                          "pattern": "^[a-z][a-z0-9-]*$"
                        }
                      },
                      "trigger": {
                        "default": {
                          "kind": "manual",
                          "source": "prompt"
                        },
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "manual"
                              },
                              "source": {
                                "default": "prompt",
                                "type": "string",
                                "enum": [
                                  "prompt",
                                  "command",
                                  "api"
                                ]
                              }
                            },
                            "required": [
                              "kind"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "scheduled"
                              },
                              "schedule": {
                                "type": "string",
                                "minLength": 1
                              },
                              "timezone": {
                                "type": "string",
                                "minLength": 1
                              },
                              "enabled": {
                                "default": false,
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "kind",
                              "schedule"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "command"
                              },
                              "command": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "kind"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "api"
                              },
                              "route": {
                                "type": "string",
                                "minLength": 1
                              },
                              "enabled": {
                                "default": false,
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "kind"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "webhook"
                              },
                              "event": {
                                "type": "string",
                                "minLength": 1
                              },
                              "enabled": {
                                "default": false,
                                "type": "boolean",
                                "const": false
                              },
                              "securityGate": {
                                "default": "required",
                                "type": "string",
                                "const": "required"
                              }
                            },
                            "required": [
                              "kind",
                              "event"
                            ]
                          }
                        ]
                      },
                      "inputs": {
                        "default": [],
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z][a-z0-9-]*$"
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "description": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            },
                            "type": {
                              "default": "string",
                              "type": "string",
                              "enum": [
                                "string",
                                "number",
                                "boolean",
                                "json",
                                "path",
                                "string-array"
                              ]
                            },
                            "required": {
                              "default": false,
                              "type": "boolean"
                            },
                            "sensitive": {
                              "default": false,
                              "type": "boolean"
                            },
                            "default": {}
                          },
                          "required": [
                            "id"
                          ]
                        }
                      },
                      "routine": {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "default": false,
                            "type": "boolean"
                          },
                          "mode": {
                            "default": "manual",
                            "type": "string",
                            "enum": [
                              "manual",
                              "scheduled",
                              "api",
                              "webhook"
                            ]
                          },
                          "schedule": {
                            "type": "string",
                            "minLength": 1
                          },
                          "timezone": {
                            "type": "string",
                            "minLength": 1
                          },
                          "apiRoute": {
                            "type": "string",
                            "minLength": 1
                          },
                          "webhookEvent": {
                            "type": "string",
                            "minLength": 1
                          },
                          "securityGate": {
                            "default": "local-only",
                            "type": "string",
                            "enum": [
                              "local-only",
                              "required"
                            ]
                          }
                        }
                      },
                      "budget": {
                        "default": {
                          "maxTotalTokens": 100000,
                          "maxInputTokensPerChild": 50000,
                          "maxOutputTokensPerChild": 8000,
                          "maxWallTimeMs": 3600000,
                          "maxConcurrentAgents": 3,
                          "maxTotalAgents": 25,
                          "maxToolCalls": 500,
                          "maxRetries": 1
                        },
                        "type": "object",
                        "properties": {
                          "maxTotalTokens": {
                            "default": 100000,
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "maxInputTokensPerChild": {
                            "default": 50000,
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "maxOutputTokensPerChild": {
                            "default": 8000,
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "maxWallTimeMs": {
                            "default": 3600000,
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "maxConcurrentAgents": {
                            "default": 3,
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 16
                          },
                          "maxTotalAgents": {
                            "default": 25,
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 1000
                          },
                          "maxToolCalls": {
                            "default": 500,
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "maxRetries": {
                            "default": 1,
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 5
                          }
                        }
                      },
                      "pacing": {
                        "default": {
                          "maxRequestsPerMinute": 12,
                          "maxTokensPerMinute": 200000
                        },
                        "type": "object",
                        "properties": {
                          "maxRequestsPerMinute": {
                            "default": 12,
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 120
                          },
                          "maxTokensPerMinute": {
                            "default": 200000,
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 2000000
                          }
                        }
                      },
                      "modelPolicy": {
                        "default": {
                          "effort": "normal",
                          "allowedProviders": [],
                          "routing": []
                        },
                        "type": "object",
                        "properties": {
                          "defaultModel": {
                            "type": "string",
                            "minLength": 1
                          },
                          "cheapModel": {
                            "type": "string",
                            "minLength": 1
                          },
                          "strongModel": {
                            "type": "string",
                            "minLength": 1
                          },
                          "plannerModel": {
                            "type": "string",
                            "minLength": 1
                          },
                          "workerModel": {
                            "type": "string",
                            "minLength": 1
                          },
                          "verifierModel": {
                            "type": "string",
                            "minLength": 1
                          },
                          "synthesizerModel": {
                            "type": "string",
                            "minLength": 1
                          },
                          "effort": {
                            "default": "normal",
                            "type": "string",
                            "enum": [
                              "normal",
                              "deep",
                              "workflow",
                              "max-workflow"
                            ]
                          },
                          "allowedProviders": {
                            "default": [],
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "routing": {
                            "default": [],
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "phaseKind": {
                                  "type": "string",
                                  "enum": [
                                    "fanout",
                                    "sequential",
                                    "synthesis",
                                    "verification",
                                    "noop"
                                  ]
                                },
                                "use": {
                                  "type": "string",
                                  "enum": [
                                    "planner",
                                    "worker",
                                    "verifier",
                                    "synthesizer"
                                  ]
                                }
                              },
                              "required": [
                                "use"
                              ]
                            }
                          }
                        }
                      },
                      "permissions": {
                        "default": {
                          "writePolicy": "read-only",
                          "allowedTools": [],
                          "networkPolicy": "inherit",
                          "escalationPolicy": "ask"
                        },
                        "type": "object",
                        "properties": {
                          "writePolicy": {
                            "default": "read-only",
                            "type": "string",
                            "enum": [
                              "read-only",
                              "serialized",
                              "worktree-required"
                            ]
                          },
                          "allowedTools": {
                            "default": [],
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "networkPolicy": {
                            "default": "inherit",
                            "type": "string",
                            "enum": [
                              "inherit",
                              "disabled",
                              "allowed"
                            ]
                          },
                          "escalationPolicy": {
                            "default": "ask",
                            "type": "string",
                            "enum": [
                              "inherit",
                              "ask",
                              "deny"
                            ]
                          }
                        }
                      },
                      "artifacts": {
                        "default": [],
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z][a-z0-9-]*$"
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "summary",
                                "finding",
                                "patch",
                                "verification",
                                "metric",
                                "log"
                              ]
                            },
                            "retention": {
                              "default": "session",
                              "type": "string",
                              "enum": [
                                "ephemeral",
                                "session",
                                "durable"
                              ]
                            },
                            "exposeToMainContext": {
                              "default": false,
                              "type": "boolean"
                            },
                            "redaction": {
                              "type": "object",
                              "properties": {
                                "status": {
                                  "default": "pending",
                                  "type": "string",
                                  "enum": [
                                    "none",
                                    "redacted",
                                    "pending"
                                  ]
                                },
                                "summary": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 500
                                }
                              }
                            }
                          },
                          "required": [
                            "id",
                            "kind"
                          ]
                        }
                      },
                      "verification": {
                        "default": {
                          "mode": "optional",
                          "commands": [],
                          "requiredArtifactIds": []
                        },
                        "type": "object",
                        "properties": {
                          "mode": {
                            "default": "optional",
                            "type": "string",
                            "enum": [
                              "required",
                              "optional",
                              "deferred",
                              "skipped"
                            ]
                          },
                          "workflow": {
                            "type": "string",
                            "enum": [
                              "review",
                              "debug",
                              "qa"
                            ]
                          },
                          "commands": {
                            "default": [],
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "requiredArtifactIds": {
                            "default": [],
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z][a-z0-9-]*$"
                            }
                          },
                          "reason": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 500
                          }
                        }
                      },
                      "synthesis": {
                        "default": {
                          "outputFormat": "markdown",
                          "exposeToMainContext": true,
                          "requiredArtifactIds": []
                        },
                        "type": "object",
                        "properties": {
                          "agent": {
                            "type": "string",
                            "minLength": 1
                          },
                          "model": {
                            "type": "string",
                            "minLength": 1
                          },
                          "outputFormat": {
                            "default": "markdown",
                            "type": "string",
                            "enum": [
                              "markdown",
                              "json",
                              "table",
                              "findings"
                            ]
                          },
                          "exposeToMainContext": {
                            "default": true,
                            "type": "boolean"
                          },
                          "requiredArtifactIds": {
                            "default": [],
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z][a-z0-9-]*$"
                            }
                          }
                        }
                      },
                      "phases": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z][a-z0-9-]*$"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "fanout",
                                "sequential",
                                "synthesis",
                                "verification",
                                "noop"
                              ]
                            },
                            "prompt": {
                              "type": "string",
                              "minLength": 1
                            },
                            "agent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "inputs": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "outputs": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            },
                            "dependsOn": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            },
                            "maxParallel": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 16
                            },
                            "mergeStrategy": {
                              "default": "all",
                              "type": "string",
                              "enum": [
                                "all",
                                "first-success",
                                "majority",
                                "vote-with-critic",
                                "critic-confirmation",
                                "custom-reducer"
                              ]
                            },
                            "modelPolicy": {
                              "type": "object",
                              "properties": {
                                "defaultModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "cheapModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "strongModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "plannerModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "workerModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "verifierModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "synthesizerModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "effort": {
                                  "default": "normal",
                                  "type": "string",
                                  "enum": [
                                    "normal",
                                    "deep",
                                    "workflow",
                                    "max-workflow"
                                  ]
                                },
                                "allowedProviders": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "routing": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "phaseKind": {
                                        "type": "string",
                                        "enum": [
                                          "fanout",
                                          "sequential",
                                          "synthesis",
                                          "verification",
                                          "noop"
                                        ]
                                      },
                                      "use": {
                                        "type": "string",
                                        "enum": [
                                          "planner",
                                          "worker",
                                          "verifier",
                                          "synthesizer"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "use"
                                    ]
                                  }
                                }
                              }
                            },
                            "budget": {
                              "type": "object",
                              "properties": {
                                "maxTotalTokens": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxInputTokensPerChild": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxOutputTokensPerChild": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxWallTimeMs": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxConcurrentAgents": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 16
                                },
                                "maxTotalAgents": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 1000
                                },
                                "maxToolCalls": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxRetries": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 5
                                }
                              }
                            },
                            "pacing": {
                              "type": "object",
                              "properties": {
                                "maxRequestsPerMinute": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 120
                                },
                                "maxTokensPerMinute": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 2000000
                                }
                              }
                            }
                          },
                          "required": [
                            "id",
                            "name",
                            "kind"
                          ]
                        }
                      }
                    },
                    "required": [
                      "schemaVersion",
                      "id",
                      "name",
                      "description",
                      "phases"
                    ]
                  }
                },
                "required": [
                  "scope",
                  "spec"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowTemplate.save({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-templates/{templateID}": {
      "get": {
        "operationId": "workflowTemplate.get",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "templateID",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120,
              "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
            },
            "required": true
          }
        ],
        "summary": "Get workflow template",
        "description": "Return one workflow template by id.",
        "responses": {
          "200": {
            "description": "Workflow template.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "builtin",
                        "user",
                        "project"
                      ]
                    },
                    "trust": {
                      "type": "string",
                      "enum": [
                        "candidate",
                        "trusted"
                      ]
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "revision": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "specHash": {
                      "type": "string"
                    },
                    "spec": {
                      "type": "object",
                      "properties": {
                        "schemaVersion": {
                          "type": "number",
                          "const": 1
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80,
                          "pattern": "^[a-z][a-z0-9-]*$"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        },
                        "tags": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 80,
                            "pattern": "^[a-z][a-z0-9-]*$"
                          }
                        },
                        "trigger": {
                          "default": {
                            "kind": "manual",
                            "source": "prompt"
                          },
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "manual"
                                },
                                "source": {
                                  "default": "prompt",
                                  "type": "string",
                                  "enum": [
                                    "prompt",
                                    "command",
                                    "api"
                                  ]
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "scheduled"
                                },
                                "schedule": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "timezone": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind",
                                "schedule"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "command"
                                },
                                "command": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "api"
                                },
                                "route": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "webhook"
                                },
                                "event": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean",
                                  "const": false
                                },
                                "securityGate": {
                                  "default": "required",
                                  "type": "string",
                                  "const": "required"
                                }
                              },
                              "required": [
                                "kind",
                                "event"
                              ]
                            }
                          ]
                        },
                        "inputs": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 500
                              },
                              "type": {
                                "default": "string",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "json",
                                  "path",
                                  "string-array"
                                ]
                              },
                              "required": {
                                "default": false,
                                "type": "boolean"
                              },
                              "sensitive": {
                                "default": false,
                                "type": "boolean"
                              },
                              "default": {}
                            },
                            "required": [
                              "id"
                            ]
                          }
                        },
                        "routine": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "default": false,
                              "type": "boolean"
                            },
                            "mode": {
                              "default": "manual",
                              "type": "string",
                              "enum": [
                                "manual",
                                "scheduled",
                                "api",
                                "webhook"
                              ]
                            },
                            "schedule": {
                              "type": "string",
                              "minLength": 1
                            },
                            "timezone": {
                              "type": "string",
                              "minLength": 1
                            },
                            "apiRoute": {
                              "type": "string",
                              "minLength": 1
                            },
                            "webhookEvent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "securityGate": {
                              "default": "local-only",
                              "type": "string",
                              "enum": [
                                "local-only",
                                "required"
                              ]
                            }
                          }
                        },
                        "budget": {
                          "default": {
                            "maxTotalTokens": 100000,
                            "maxInputTokensPerChild": 50000,
                            "maxOutputTokensPerChild": 8000,
                            "maxWallTimeMs": 3600000,
                            "maxConcurrentAgents": 3,
                            "maxTotalAgents": 25,
                            "maxToolCalls": 500,
                            "maxRetries": 1
                          },
                          "type": "object",
                          "properties": {
                            "maxTotalTokens": {
                              "default": 100000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxInputTokensPerChild": {
                              "default": 50000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxOutputTokensPerChild": {
                              "default": 8000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxWallTimeMs": {
                              "default": 3600000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxConcurrentAgents": {
                              "default": 3,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 16
                            },
                            "maxTotalAgents": {
                              "default": 25,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 1000
                            },
                            "maxToolCalls": {
                              "default": 500,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxRetries": {
                              "default": 1,
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 5
                            }
                          }
                        },
                        "pacing": {
                          "default": {
                            "maxRequestsPerMinute": 12,
                            "maxTokensPerMinute": 200000
                          },
                          "type": "object",
                          "properties": {
                            "maxRequestsPerMinute": {
                              "default": 12,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 120
                            },
                            "maxTokensPerMinute": {
                              "default": 200000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 2000000
                            }
                          }
                        },
                        "modelPolicy": {
                          "default": {
                            "effort": "normal",
                            "allowedProviders": [],
                            "routing": []
                          },
                          "type": "object",
                          "properties": {
                            "defaultModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "cheapModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "strongModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "plannerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "workerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "verifierModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "synthesizerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "effort": {
                              "default": "normal",
                              "type": "string",
                              "enum": [
                                "normal",
                                "deep",
                                "workflow",
                                "max-workflow"
                              ]
                            },
                            "allowedProviders": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "routing": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "phaseKind": {
                                    "type": "string",
                                    "enum": [
                                      "fanout",
                                      "sequential",
                                      "synthesis",
                                      "verification",
                                      "noop"
                                    ]
                                  },
                                  "use": {
                                    "type": "string",
                                    "enum": [
                                      "planner",
                                      "worker",
                                      "verifier",
                                      "synthesizer"
                                    ]
                                  }
                                },
                                "required": [
                                  "use"
                                ]
                              }
                            }
                          }
                        },
                        "permissions": {
                          "default": {
                            "writePolicy": "read-only",
                            "allowedTools": [],
                            "networkPolicy": "inherit",
                            "escalationPolicy": "ask"
                          },
                          "type": "object",
                          "properties": {
                            "writePolicy": {
                              "default": "read-only",
                              "type": "string",
                              "enum": [
                                "read-only",
                                "serialized",
                                "worktree-required"
                              ]
                            },
                            "allowedTools": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "networkPolicy": {
                              "default": "inherit",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "disabled",
                                "allowed"
                              ]
                            },
                            "escalationPolicy": {
                              "default": "ask",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "ask",
                                "deny"
                              ]
                            }
                          }
                        },
                        "artifacts": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "summary",
                                  "finding",
                                  "patch",
                                  "verification",
                                  "metric",
                                  "log"
                                ]
                              },
                              "retention": {
                                "default": "session",
                                "type": "string",
                                "enum": [
                                  "ephemeral",
                                  "session",
                                  "durable"
                                ]
                              },
                              "exposeToMainContext": {
                                "default": false,
                                "type": "boolean"
                              },
                              "redaction": {
                                "type": "object",
                                "properties": {
                                  "status": {
                                    "default": "pending",
                                    "type": "string",
                                    "enum": [
                                      "none",
                                      "redacted",
                                      "pending"
                                    ]
                                  },
                                  "summary": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 500
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "kind"
                            ]
                          }
                        },
                        "verification": {
                          "default": {
                            "mode": "optional",
                            "commands": [],
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "mode": {
                              "default": "optional",
                              "type": "string",
                              "enum": [
                                "required",
                                "optional",
                                "deferred",
                                "skipped"
                              ]
                            },
                            "workflow": {
                              "type": "string",
                              "enum": [
                                "review",
                                "debug",
                                "qa"
                              ]
                            },
                            "commands": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            },
                            "reason": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            }
                          }
                        },
                        "synthesis": {
                          "default": {
                            "outputFormat": "markdown",
                            "exposeToMainContext": true,
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "agent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "model": {
                              "type": "string",
                              "minLength": 1
                            },
                            "outputFormat": {
                              "default": "markdown",
                              "type": "string",
                              "enum": [
                                "markdown",
                                "json",
                                "table",
                                "findings"
                              ]
                            },
                            "exposeToMainContext": {
                              "default": true,
                              "type": "boolean"
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            }
                          }
                        },
                        "phases": {
                          "minItems": 1,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "fanout",
                                  "sequential",
                                  "synthesis",
                                  "verification",
                                  "noop"
                                ]
                              },
                              "prompt": {
                                "type": "string",
                                "minLength": 1
                              },
                              "agent": {
                                "type": "string",
                                "minLength": 1
                              },
                              "inputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "outputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "dependsOn": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "maxParallel": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 16
                              },
                              "mergeStrategy": {
                                "default": "all",
                                "type": "string",
                                "enum": [
                                  "all",
                                  "first-success",
                                  "majority",
                                  "vote-with-critic",
                                  "critic-confirmation",
                                  "custom-reducer"
                                ]
                              },
                              "modelPolicy": {
                                "type": "object",
                                "properties": {
                                  "defaultModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "cheapModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "strongModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "plannerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "workerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "verifierModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "synthesizerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effort": {
                                    "default": "normal",
                                    "type": "string",
                                    "enum": [
                                      "normal",
                                      "deep",
                                      "workflow",
                                      "max-workflow"
                                    ]
                                  },
                                  "allowedProviders": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "routing": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "phaseKind": {
                                          "type": "string",
                                          "enum": [
                                            "fanout",
                                            "sequential",
                                            "synthesis",
                                            "verification",
                                            "noop"
                                          ]
                                        },
                                        "use": {
                                          "type": "string",
                                          "enum": [
                                            "planner",
                                            "worker",
                                            "verifier",
                                            "synthesizer"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "use"
                                      ]
                                    }
                                  }
                                }
                              },
                              "budget": {
                                "type": "object",
                                "properties": {
                                  "maxTotalTokens": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxInputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxOutputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxWallTimeMs": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxConcurrentAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 16
                                  },
                                  "maxTotalAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 1000
                                  },
                                  "maxToolCalls": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxRetries": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 5
                                  }
                                }
                              },
                              "pacing": {
                                "type": "object",
                                "properties": {
                                  "maxRequestsPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 120
                                  },
                                  "maxTokensPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 2000000
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "kind"
                            ]
                          }
                        }
                      },
                      "required": [
                        "schemaVersion",
                        "id",
                        "name",
                        "description",
                        "phases"
                      ]
                    },
                    "path": {
                      "type": "string"
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created",
                        "updated"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "source",
                    "trust",
                    "name",
                    "description",
                    "tags",
                    "revision",
                    "specHash",
                    "spec"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowTemplate.get({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-templates/{templateID}/promote": {
      "post": {
        "operationId": "workflowTemplate.promote",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "templateID",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120,
              "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
            },
            "required": true
          }
        ],
        "summary": "Promote workflow template",
        "description": "Promote a saved user-local or project-local workflow template candidate to trusted.",
        "responses": {
          "200": {
            "description": "Promoted workflow template.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "builtin",
                        "user",
                        "project"
                      ]
                    },
                    "trust": {
                      "type": "string",
                      "enum": [
                        "candidate",
                        "trusted"
                      ]
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "revision": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "specHash": {
                      "type": "string"
                    },
                    "spec": {
                      "type": "object",
                      "properties": {
                        "schemaVersion": {
                          "type": "number",
                          "const": 1
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80,
                          "pattern": "^[a-z][a-z0-9-]*$"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        },
                        "tags": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 80,
                            "pattern": "^[a-z][a-z0-9-]*$"
                          }
                        },
                        "trigger": {
                          "default": {
                            "kind": "manual",
                            "source": "prompt"
                          },
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "manual"
                                },
                                "source": {
                                  "default": "prompt",
                                  "type": "string",
                                  "enum": [
                                    "prompt",
                                    "command",
                                    "api"
                                  ]
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "scheduled"
                                },
                                "schedule": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "timezone": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind",
                                "schedule"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "command"
                                },
                                "command": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "api"
                                },
                                "route": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "webhook"
                                },
                                "event": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": false,
                                  "type": "boolean",
                                  "const": false
                                },
                                "securityGate": {
                                  "default": "required",
                                  "type": "string",
                                  "const": "required"
                                }
                              },
                              "required": [
                                "kind",
                                "event"
                              ]
                            }
                          ]
                        },
                        "inputs": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 500
                              },
                              "type": {
                                "default": "string",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "json",
                                  "path",
                                  "string-array"
                                ]
                              },
                              "required": {
                                "default": false,
                                "type": "boolean"
                              },
                              "sensitive": {
                                "default": false,
                                "type": "boolean"
                              },
                              "default": {}
                            },
                            "required": [
                              "id"
                            ]
                          }
                        },
                        "routine": {
                          "type": "object",
                          "properties": {
                            "enabled": {
                              "default": false,
                              "type": "boolean"
                            },
                            "mode": {
                              "default": "manual",
                              "type": "string",
                              "enum": [
                                "manual",
                                "scheduled",
                                "api",
                                "webhook"
                              ]
                            },
                            "schedule": {
                              "type": "string",
                              "minLength": 1
                            },
                            "timezone": {
                              "type": "string",
                              "minLength": 1
                            },
                            "apiRoute": {
                              "type": "string",
                              "minLength": 1
                            },
                            "webhookEvent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "securityGate": {
                              "default": "local-only",
                              "type": "string",
                              "enum": [
                                "local-only",
                                "required"
                              ]
                            }
                          }
                        },
                        "budget": {
                          "default": {
                            "maxTotalTokens": 100000,
                            "maxInputTokensPerChild": 50000,
                            "maxOutputTokensPerChild": 8000,
                            "maxWallTimeMs": 3600000,
                            "maxConcurrentAgents": 3,
                            "maxTotalAgents": 25,
                            "maxToolCalls": 500,
                            "maxRetries": 1
                          },
                          "type": "object",
                          "properties": {
                            "maxTotalTokens": {
                              "default": 100000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxInputTokensPerChild": {
                              "default": 50000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxOutputTokensPerChild": {
                              "default": 8000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxWallTimeMs": {
                              "default": 3600000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxConcurrentAgents": {
                              "default": 3,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 16
                            },
                            "maxTotalAgents": {
                              "default": 25,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 1000
                            },
                            "maxToolCalls": {
                              "default": 500,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maxRetries": {
                              "default": 1,
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 5
                            }
                          }
                        },
                        "pacing": {
                          "default": {
                            "maxRequestsPerMinute": 12,
                            "maxTokensPerMinute": 200000
                          },
                          "type": "object",
                          "properties": {
                            "maxRequestsPerMinute": {
                              "default": 12,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 120
                            },
                            "maxTokensPerMinute": {
                              "default": 200000,
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 2000000
                            }
                          }
                        },
                        "modelPolicy": {
                          "default": {
                            "effort": "normal",
                            "allowedProviders": [],
                            "routing": []
                          },
                          "type": "object",
                          "properties": {
                            "defaultModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "cheapModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "strongModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "plannerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "workerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "verifierModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "synthesizerModel": {
                              "type": "string",
                              "minLength": 1
                            },
                            "effort": {
                              "default": "normal",
                              "type": "string",
                              "enum": [
                                "normal",
                                "deep",
                                "workflow",
                                "max-workflow"
                              ]
                            },
                            "allowedProviders": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "routing": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "phaseKind": {
                                    "type": "string",
                                    "enum": [
                                      "fanout",
                                      "sequential",
                                      "synthesis",
                                      "verification",
                                      "noop"
                                    ]
                                  },
                                  "use": {
                                    "type": "string",
                                    "enum": [
                                      "planner",
                                      "worker",
                                      "verifier",
                                      "synthesizer"
                                    ]
                                  }
                                },
                                "required": [
                                  "use"
                                ]
                              }
                            }
                          }
                        },
                        "permissions": {
                          "default": {
                            "writePolicy": "read-only",
                            "allowedTools": [],
                            "networkPolicy": "inherit",
                            "escalationPolicy": "ask"
                          },
                          "type": "object",
                          "properties": {
                            "writePolicy": {
                              "default": "read-only",
                              "type": "string",
                              "enum": [
                                "read-only",
                                "serialized",
                                "worktree-required"
                              ]
                            },
                            "allowedTools": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "networkPolicy": {
                              "default": "inherit",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "disabled",
                                "allowed"
                              ]
                            },
                            "escalationPolicy": {
                              "default": "ask",
                              "type": "string",
                              "enum": [
                                "inherit",
                                "ask",
                                "deny"
                              ]
                            }
                          }
                        },
                        "artifacts": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "summary",
                                  "finding",
                                  "patch",
                                  "verification",
                                  "metric",
                                  "log"
                                ]
                              },
                              "retention": {
                                "default": "session",
                                "type": "string",
                                "enum": [
                                  "ephemeral",
                                  "session",
                                  "durable"
                                ]
                              },
                              "exposeToMainContext": {
                                "default": false,
                                "type": "boolean"
                              },
                              "redaction": {
                                "type": "object",
                                "properties": {
                                  "status": {
                                    "default": "pending",
                                    "type": "string",
                                    "enum": [
                                      "none",
                                      "redacted",
                                      "pending"
                                    ]
                                  },
                                  "summary": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 500
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "kind"
                            ]
                          }
                        },
                        "verification": {
                          "default": {
                            "mode": "optional",
                            "commands": [],
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "mode": {
                              "default": "optional",
                              "type": "string",
                              "enum": [
                                "required",
                                "optional",
                                "deferred",
                                "skipped"
                              ]
                            },
                            "workflow": {
                              "type": "string",
                              "enum": [
                                "review",
                                "debug",
                                "qa"
                              ]
                            },
                            "commands": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            },
                            "reason": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            }
                          }
                        },
                        "synthesis": {
                          "default": {
                            "outputFormat": "markdown",
                            "exposeToMainContext": true,
                            "requiredArtifactIds": []
                          },
                          "type": "object",
                          "properties": {
                            "agent": {
                              "type": "string",
                              "minLength": 1
                            },
                            "model": {
                              "type": "string",
                              "minLength": 1
                            },
                            "outputFormat": {
                              "default": "markdown",
                              "type": "string",
                              "enum": [
                                "markdown",
                                "json",
                                "table",
                                "findings"
                              ]
                            },
                            "exposeToMainContext": {
                              "default": true,
                              "type": "boolean"
                            },
                            "requiredArtifactIds": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            }
                          }
                        },
                        "phases": {
                          "minItems": 1,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "fanout",
                                  "sequential",
                                  "synthesis",
                                  "verification",
                                  "noop"
                                ]
                              },
                              "prompt": {
                                "type": "string",
                                "minLength": 1
                              },
                              "agent": {
                                "type": "string",
                                "minLength": 1
                              },
                              "inputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "outputs": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "dependsOn": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80,
                                  "pattern": "^[a-z][a-z0-9-]*$"
                                }
                              },
                              "maxParallel": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 16
                              },
                              "mergeStrategy": {
                                "default": "all",
                                "type": "string",
                                "enum": [
                                  "all",
                                  "first-success",
                                  "majority",
                                  "vote-with-critic",
                                  "critic-confirmation",
                                  "custom-reducer"
                                ]
                              },
                              "modelPolicy": {
                                "type": "object",
                                "properties": {
                                  "defaultModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "cheapModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "strongModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "plannerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "workerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "verifierModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "synthesizerModel": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "effort": {
                                    "default": "normal",
                                    "type": "string",
                                    "enum": [
                                      "normal",
                                      "deep",
                                      "workflow",
                                      "max-workflow"
                                    ]
                                  },
                                  "allowedProviders": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "routing": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "phaseKind": {
                                          "type": "string",
                                          "enum": [
                                            "fanout",
                                            "sequential",
                                            "synthesis",
                                            "verification",
                                            "noop"
                                          ]
                                        },
                                        "use": {
                                          "type": "string",
                                          "enum": [
                                            "planner",
                                            "worker",
                                            "verifier",
                                            "synthesizer"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "use"
                                      ]
                                    }
                                  }
                                }
                              },
                              "budget": {
                                "type": "object",
                                "properties": {
                                  "maxTotalTokens": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxInputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxOutputTokensPerChild": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxWallTimeMs": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxConcurrentAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 16
                                  },
                                  "maxTotalAgents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 1000
                                  },
                                  "maxToolCalls": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxRetries": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 5
                                  }
                                }
                              },
                              "pacing": {
                                "type": "object",
                                "properties": {
                                  "maxRequestsPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 120
                                  },
                                  "maxTokensPerMinute": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 2000000
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "kind"
                            ]
                          }
                        }
                      },
                      "required": [
                        "schemaVersion",
                        "id",
                        "name",
                        "description",
                        "phases"
                      ]
                    },
                    "path": {
                      "type": "string"
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created",
                        "updated"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "source",
                    "trust",
                    "name",
                    "description",
                    "tags",
                    "revision",
                    "specHash",
                    "spec"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowTemplate.promote({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-routines": {
      "get": {
        "operationId": "workflowRoutine.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "List workflow routines",
        "description": "Return workflow templates that declare local routine trigger metadata.",
        "responses": {
          "200": {
            "description": "Workflow routines.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "route": {
                        "type": "string",
                        "minLength": 1
                      },
                      "templateID": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120,
                        "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                      },
                      "templateName": {
                        "type": "string",
                        "minLength": 1
                      },
                      "source": {
                        "type": "string",
                        "enum": [
                          "builtin",
                          "user",
                          "project"
                        ]
                      },
                      "trust": {
                        "type": "string",
                        "enum": [
                          "candidate",
                          "trusted"
                        ]
                      },
                      "enabled": {
                        "type": "boolean"
                      },
                      "mode": {
                        "type": "string",
                        "enum": [
                          "manual",
                          "scheduled",
                          "api",
                          "webhook"
                        ]
                      },
                      "schedule": {
                        "type": "string",
                        "minLength": 1
                      },
                      "timezone": {
                        "type": "string",
                        "minLength": 1
                      },
                      "webhookEvent": {
                        "type": "string",
                        "minLength": 1
                      },
                      "scheduledTaskID": {
                        "type": "string",
                        "minLength": 1
                      },
                      "scheduledTaskStatus": {
                        "type": "string",
                        "enum": [
                          "active",
                          "paused",
                          "disabled"
                        ]
                      },
                      "nextRunAt": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "lastWorkflowRunID": {
                        "type": "string",
                        "minLength": 1
                      },
                      "securityGate": {
                        "type": "string",
                        "enum": [
                          "local-only",
                          "required"
                        ]
                      }
                    },
                    "required": [
                      "route",
                      "templateID",
                      "templateName",
                      "source",
                      "trust",
                      "enabled",
                      "mode",
                      "securityGate"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowRoutine.list({\n  ...\n})"
          }
        ]
      },
      "post": {
        "operationId": "workflowRoutine.create",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Create workflow routine",
        "description": "Create a user-local or project-local routine trigger from an existing workflow template. API routines can be run directly; scheduled routines are listed as reusable trigger metadata.",
        "responses": {
          "200": {
            "description": "Created workflow routine.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "route": {
                      "type": "string",
                      "minLength": 1
                    },
                    "templateID": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120,
                      "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                    },
                    "templateName": {
                      "type": "string",
                      "minLength": 1
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "builtin",
                        "user",
                        "project"
                      ]
                    },
                    "trust": {
                      "type": "string",
                      "enum": [
                        "candidate",
                        "trusted"
                      ]
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "manual",
                        "scheduled",
                        "api",
                        "webhook"
                      ]
                    },
                    "schedule": {
                      "type": "string",
                      "minLength": 1
                    },
                    "timezone": {
                      "type": "string",
                      "minLength": 1
                    },
                    "webhookEvent": {
                      "type": "string",
                      "minLength": 1
                    },
                    "scheduledTaskID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "scheduledTaskStatus": {
                      "type": "string",
                      "enum": [
                        "active",
                        "paused",
                        "disabled"
                      ]
                    },
                    "nextRunAt": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "lastWorkflowRunID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "securityGate": {
                      "type": "string",
                      "enum": [
                        "local-only",
                        "required"
                      ]
                    }
                  },
                  "required": [
                    "route",
                    "templateID",
                    "templateName",
                    "source",
                    "trust",
                    "enabled",
                    "mode",
                    "securityGate"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "templateID": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                  },
                  "scope": {
                    "type": "string",
                    "enum": [
                      "user",
                      "project"
                    ]
                  },
                  "trust": {
                    "default": "candidate",
                    "type": "string",
                    "enum": [
                      "candidate",
                      "trusted"
                    ]
                  },
                  "mode": {
                    "default": "api",
                    "type": "string",
                    "enum": [
                      "api",
                      "scheduled",
                      "webhook"
                    ]
                  },
                  "route": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160,
                    "pattern": "^workflow\\/[a-z][a-z0-9-/]*$"
                  },
                  "schedule": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "timezone": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "webhookEvent": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "securityGate": {
                    "type": "string",
                    "enum": [
                      "local-only",
                      "required"
                    ]
                  }
                },
                "required": [
                  "templateID",
                  "scope"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowRoutine.create({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-routines/delete": {
      "post": {
        "operationId": "workflowRoutine.delete",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Delete workflow routine",
        "description": "Delete a local workflow routine by route: removes the saved routine trigger template (user or project scope) and any scheduled task linked to it. Built-in routine templates cannot be deleted.",
        "responses": {
          "200": {
            "description": "Deleted workflow routine.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "route": {
                      "type": "string"
                    },
                    "removedTemplates": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "removedScheduledTasks": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "route",
                    "removedTemplates",
                    "removedScheduledTasks"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "route": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160,
                    "pattern": "^workflow\\/[a-z][a-z0-9-/]*$"
                  }
                },
                "required": [
                  "route"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowRoutine.delete({\n  ...\n})"
          }
        ]
      }
    },
    "/workflow-routines/run": {
      "post": {
        "operationId": "workflowRoutine.run",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Run workflow routine",
        "description": "Run a trusted enabled local API workflow routine by route.",
        "responses": {
          "200": {
            "description": "Started workflow routine run.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "routine": {
                      "type": "object",
                      "properties": {
                        "route": {
                          "type": "string",
                          "minLength": 1
                        },
                        "templateID": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120,
                          "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                        },
                        "templateName": {
                          "type": "string",
                          "minLength": 1
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "builtin",
                            "user",
                            "project"
                          ]
                        },
                        "trust": {
                          "type": "string",
                          "enum": [
                            "candidate",
                            "trusted"
                          ]
                        },
                        "enabled": {
                          "type": "boolean"
                        },
                        "mode": {
                          "type": "string",
                          "enum": [
                            "manual",
                            "scheduled",
                            "api",
                            "webhook"
                          ]
                        },
                        "schedule": {
                          "type": "string",
                          "minLength": 1
                        },
                        "timezone": {
                          "type": "string",
                          "minLength": 1
                        },
                        "webhookEvent": {
                          "type": "string",
                          "minLength": 1
                        },
                        "scheduledTaskID": {
                          "type": "string",
                          "minLength": 1
                        },
                        "scheduledTaskStatus": {
                          "type": "string",
                          "enum": [
                            "active",
                            "paused",
                            "disabled"
                          ]
                        },
                        "nextRunAt": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "lastWorkflowRunID": {
                          "type": "string",
                          "minLength": 1
                        },
                        "securityGate": {
                          "type": "string",
                          "enum": [
                            "local-only",
                            "required"
                          ]
                        }
                      },
                      "required": [
                        "route",
                        "templateID",
                        "templateName",
                        "source",
                        "trust",
                        "enabled",
                        "mode",
                        "securityGate"
                      ]
                    },
                    "template": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "builtin",
                            "user",
                            "project"
                          ]
                        },
                        "trust": {
                          "type": "string",
                          "enum": [
                            "candidate",
                            "trusted"
                          ]
                        },
                        "name": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "tags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "revision": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "specHash": {
                          "type": "string"
                        },
                        "spec": {
                          "type": "object",
                          "properties": {
                            "schemaVersion": {
                              "type": "number",
                              "const": 1
                            },
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z][a-z0-9-]*$"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "description": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 1000
                            },
                            "tags": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            },
                            "trigger": {
                              "default": {
                                "kind": "manual",
                                "source": "prompt"
                              },
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "manual"
                                    },
                                    "source": {
                                      "default": "prompt",
                                      "type": "string",
                                      "enum": [
                                        "prompt",
                                        "command",
                                        "api"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "scheduled"
                                    },
                                    "schedule": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "timezone": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "enabled": {
                                      "default": false,
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "schedule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "command"
                                    },
                                    "command": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "api"
                                    },
                                    "route": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "enabled": {
                                      "default": false,
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "webhook"
                                    },
                                    "event": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "enabled": {
                                      "default": false,
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "securityGate": {
                                      "default": "required",
                                      "type": "string",
                                      "const": "required"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "event"
                                  ]
                                }
                              ]
                            },
                            "inputs": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 80,
                                    "pattern": "^[a-z][a-z0-9-]*$"
                                  },
                                  "label": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "description": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 500
                                  },
                                  "type": {
                                    "default": "string",
                                    "type": "string",
                                    "enum": [
                                      "string",
                                      "number",
                                      "boolean",
                                      "json",
                                      "path",
                                      "string-array"
                                    ]
                                  },
                                  "required": {
                                    "default": false,
                                    "type": "boolean"
                                  },
                                  "sensitive": {
                                    "default": false,
                                    "type": "boolean"
                                  },
                                  "default": {}
                                },
                                "required": [
                                  "id"
                                ]
                              }
                            },
                            "routine": {
                              "type": "object",
                              "properties": {
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                },
                                "mode": {
                                  "default": "manual",
                                  "type": "string",
                                  "enum": [
                                    "manual",
                                    "scheduled",
                                    "api",
                                    "webhook"
                                  ]
                                },
                                "schedule": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "timezone": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "apiRoute": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "webhookEvent": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "securityGate": {
                                  "default": "local-only",
                                  "type": "string",
                                  "enum": [
                                    "local-only",
                                    "required"
                                  ]
                                }
                              }
                            },
                            "budget": {
                              "default": {
                                "maxTotalTokens": 100000,
                                "maxInputTokensPerChild": 50000,
                                "maxOutputTokensPerChild": 8000,
                                "maxWallTimeMs": 3600000,
                                "maxConcurrentAgents": 3,
                                "maxTotalAgents": 25,
                                "maxToolCalls": 500,
                                "maxRetries": 1
                              },
                              "type": "object",
                              "properties": {
                                "maxTotalTokens": {
                                  "default": 100000,
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxInputTokensPerChild": {
                                  "default": 50000,
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxOutputTokensPerChild": {
                                  "default": 8000,
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxWallTimeMs": {
                                  "default": 3600000,
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxConcurrentAgents": {
                                  "default": 3,
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 16
                                },
                                "maxTotalAgents": {
                                  "default": 25,
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 1000
                                },
                                "maxToolCalls": {
                                  "default": 500,
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxRetries": {
                                  "default": 1,
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 5
                                }
                              }
                            },
                            "pacing": {
                              "default": {
                                "maxRequestsPerMinute": 12,
                                "maxTokensPerMinute": 200000
                              },
                              "type": "object",
                              "properties": {
                                "maxRequestsPerMinute": {
                                  "default": 12,
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 120
                                },
                                "maxTokensPerMinute": {
                                  "default": 200000,
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 2000000
                                }
                              }
                            },
                            "modelPolicy": {
                              "default": {
                                "effort": "normal",
                                "allowedProviders": [],
                                "routing": []
                              },
                              "type": "object",
                              "properties": {
                                "defaultModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "cheapModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "strongModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "plannerModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "workerModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "verifierModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "synthesizerModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "effort": {
                                  "default": "normal",
                                  "type": "string",
                                  "enum": [
                                    "normal",
                                    "deep",
                                    "workflow",
                                    "max-workflow"
                                  ]
                                },
                                "allowedProviders": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "routing": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "phaseKind": {
                                        "type": "string",
                                        "enum": [
                                          "fanout",
                                          "sequential",
                                          "synthesis",
                                          "verification",
                                          "noop"
                                        ]
                                      },
                                      "use": {
                                        "type": "string",
                                        "enum": [
                                          "planner",
                                          "worker",
                                          "verifier",
                                          "synthesizer"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "use"
                                    ]
                                  }
                                }
                              }
                            },
                            "permissions": {
                              "default": {
                                "writePolicy": "read-only",
                                "allowedTools": [],
                                "networkPolicy": "inherit",
                                "escalationPolicy": "ask"
                              },
                              "type": "object",
                              "properties": {
                                "writePolicy": {
                                  "default": "read-only",
                                  "type": "string",
                                  "enum": [
                                    "read-only",
                                    "serialized",
                                    "worktree-required"
                                  ]
                                },
                                "allowedTools": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "networkPolicy": {
                                  "default": "inherit",
                                  "type": "string",
                                  "enum": [
                                    "inherit",
                                    "disabled",
                                    "allowed"
                                  ]
                                },
                                "escalationPolicy": {
                                  "default": "ask",
                                  "type": "string",
                                  "enum": [
                                    "inherit",
                                    "ask",
                                    "deny"
                                  ]
                                }
                              }
                            },
                            "artifacts": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 80,
                                    "pattern": "^[a-z][a-z0-9-]*$"
                                  },
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "summary",
                                      "finding",
                                      "patch",
                                      "verification",
                                      "metric",
                                      "log"
                                    ]
                                  },
                                  "retention": {
                                    "default": "session",
                                    "type": "string",
                                    "enum": [
                                      "ephemeral",
                                      "session",
                                      "durable"
                                    ]
                                  },
                                  "exposeToMainContext": {
                                    "default": false,
                                    "type": "boolean"
                                  },
                                  "redaction": {
                                    "type": "object",
                                    "properties": {
                                      "status": {
                                        "default": "pending",
                                        "type": "string",
                                        "enum": [
                                          "none",
                                          "redacted",
                                          "pending"
                                        ]
                                      },
                                      "summary": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500
                                      }
                                    }
                                  }
                                },
                                "required": [
                                  "id",
                                  "kind"
                                ]
                              }
                            },
                            "verification": {
                              "default": {
                                "mode": "optional",
                                "commands": [],
                                "requiredArtifactIds": []
                              },
                              "type": "object",
                              "properties": {
                                "mode": {
                                  "default": "optional",
                                  "type": "string",
                                  "enum": [
                                    "required",
                                    "optional",
                                    "deferred",
                                    "skipped"
                                  ]
                                },
                                "workflow": {
                                  "type": "string",
                                  "enum": [
                                    "review",
                                    "debug",
                                    "qa"
                                  ]
                                },
                                "commands": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "requiredArtifactIds": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 80,
                                    "pattern": "^[a-z][a-z0-9-]*$"
                                  }
                                },
                                "reason": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 500
                                }
                              }
                            },
                            "synthesis": {
                              "default": {
                                "outputFormat": "markdown",
                                "exposeToMainContext": true,
                                "requiredArtifactIds": []
                              },
                              "type": "object",
                              "properties": {
                                "agent": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "model": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "outputFormat": {
                                  "default": "markdown",
                                  "type": "string",
                                  "enum": [
                                    "markdown",
                                    "json",
                                    "table",
                                    "findings"
                                  ]
                                },
                                "exposeToMainContext": {
                                  "default": true,
                                  "type": "boolean"
                                },
                                "requiredArtifactIds": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 80,
                                    "pattern": "^[a-z][a-z0-9-]*$"
                                  }
                                }
                              }
                            },
                            "phases": {
                              "minItems": 1,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 80,
                                    "pattern": "^[a-z][a-z0-9-]*$"
                                  },
                                  "name": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "fanout",
                                      "sequential",
                                      "synthesis",
                                      "verification",
                                      "noop"
                                    ]
                                  },
                                  "prompt": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "agent": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "inputs": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "outputs": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 80,
                                      "pattern": "^[a-z][a-z0-9-]*$"
                                    }
                                  },
                                  "dependsOn": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 80,
                                      "pattern": "^[a-z][a-z0-9-]*$"
                                    }
                                  },
                                  "maxParallel": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 16
                                  },
                                  "mergeStrategy": {
                                    "default": "all",
                                    "type": "string",
                                    "enum": [
                                      "all",
                                      "first-success",
                                      "majority",
                                      "vote-with-critic",
                                      "critic-confirmation",
                                      "custom-reducer"
                                    ]
                                  },
                                  "modelPolicy": {
                                    "type": "object",
                                    "properties": {
                                      "defaultModel": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "cheapModel": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "strongModel": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "plannerModel": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "workerModel": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "verifierModel": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "synthesizerModel": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "effort": {
                                        "default": "normal",
                                        "type": "string",
                                        "enum": [
                                          "normal",
                                          "deep",
                                          "workflow",
                                          "max-workflow"
                                        ]
                                      },
                                      "allowedProviders": {
                                        "default": [],
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "routing": {
                                        "default": [],
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "phaseKind": {
                                              "type": "string",
                                              "enum": [
                                                "fanout",
                                                "sequential",
                                                "synthesis",
                                                "verification",
                                                "noop"
                                              ]
                                            },
                                            "use": {
                                              "type": "string",
                                              "enum": [
                                                "planner",
                                                "worker",
                                                "verifier",
                                                "synthesizer"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "use"
                                          ]
                                        }
                                      }
                                    }
                                  },
                                  "budget": {
                                    "type": "object",
                                    "properties": {
                                      "maxTotalTokens": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "maxInputTokensPerChild": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "maxOutputTokensPerChild": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "maxWallTimeMs": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "maxConcurrentAgents": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 16
                                      },
                                      "maxTotalAgents": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 1000
                                      },
                                      "maxToolCalls": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "maxRetries": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 5
                                      }
                                    }
                                  },
                                  "pacing": {
                                    "type": "object",
                                    "properties": {
                                      "maxRequestsPerMinute": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 120
                                      },
                                      "maxTokensPerMinute": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 2000000
                                      }
                                    }
                                  }
                                },
                                "required": [
                                  "id",
                                  "name",
                                  "kind"
                                ]
                              }
                            }
                          },
                          "required": [
                            "schemaVersion",
                            "id",
                            "name",
                            "description",
                            "phases"
                          ]
                        },
                        "path": {
                          "type": "string"
                        },
                        "time": {
                          "type": "object",
                          "properties": {
                            "created": {
                              "type": "number"
                            },
                            "updated": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "created",
                            "updated"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "source",
                        "trust",
                        "name",
                        "description",
                        "tags",
                        "revision",
                        "specHash",
                        "spec"
                      ]
                    },
                    "run": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "projectID": {
                          "type": "string",
                          "minLength": 1
                        },
                        "directory": {
                          "type": "string"
                        },
                        "parentSessionID": {
                          "type": "string",
                          "minLength": 1
                        },
                        "sourceTemplateID": {
                          "type": "string"
                        },
                        "sourceTaskID": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "queued",
                            "running",
                            "blocked",
                            "paused",
                            "failed",
                            "completed",
                            "cancelled"
                          ]
                        },
                        "currentPhaseID": {
                          "type": "string",
                          "minLength": 1
                        },
                        "spec": {
                          "type": "object",
                          "properties": {
                            "schemaVersion": {
                              "type": "number",
                              "const": 1
                            },
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80,
                              "pattern": "^[a-z][a-z0-9-]*$"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "description": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 1000
                            },
                            "tags": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80,
                                "pattern": "^[a-z][a-z0-9-]*$"
                              }
                            },
                            "trigger": {
                              "default": {
                                "kind": "manual",
                                "source": "prompt"
                              },
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "manual"
                                    },
                                    "source": {
                                      "default": "prompt",
                                      "type": "string",
                                      "enum": [
                                        "prompt",
                                        "command",
                                        "api"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "scheduled"
                                    },
                                    "schedule": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "timezone": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "enabled": {
                                      "default": false,
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "schedule"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "command"
                                    },
                                    "command": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "api"
                                    },
                                    "route": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "enabled": {
                                      "default": false,
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "webhook"
                                    },
                                    "event": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "enabled": {
                                      "default": false,
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "securityGate": {
                                      "default": "required",
                                      "type": "string",
                                      "const": "required"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "event"
                                  ]
                                }
                              ]
                            },
                            "inputs": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 80,
                                    "pattern": "^[a-z][a-z0-9-]*$"
                                  },
                                  "label": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "description": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 500
                                  },
                                  "type": {
                                    "default": "string",
                                    "type": "string",
                                    "enum": [
                                      "string",
                                      "number",
                                      "boolean",
                                      "json",
                                      "path",
                                      "string-array"
                                    ]
                                  },
                                  "required": {
                                    "default": false,
                                    "type": "boolean"
                                  },
                                  "sensitive": {
                                    "default": false,
                                    "type": "boolean"
                                  },
                                  "default": {}
                                },
                                "required": [
                                  "id"
                                ]
                              }
                            },
                            "routine": {
                              "type": "object",
                              "properties": {
                                "enabled": {
                                  "default": false,
                                  "type": "boolean"
                                },
                                "mode": {
                                  "default": "manual",
                                  "type": "string",
                                  "enum": [
                                    "manual",
                                    "scheduled",
                                    "api",
                                    "webhook"
                                  ]
                                },
                                "schedule": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "timezone": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "apiRoute": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "webhookEvent": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "securityGate": {
                                  "default": "local-only",
                                  "type": "string",
                                  "enum": [
                                    "local-only",
                                    "required"
                                  ]
                                }
                              }
                            },
                            "budget": {
                              "default": {
                                "maxTotalTokens": 100000,
                                "maxInputTokensPerChild": 50000,
                                "maxOutputTokensPerChild": 8000,
                                "maxWallTimeMs": 3600000,
                                "maxConcurrentAgents": 3,
                                "maxTotalAgents": 25,
                                "maxToolCalls": 500,
                                "maxRetries": 1
                              },
                              "type": "object",
                              "properties": {
                                "maxTotalTokens": {
                                  "default": 100000,
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxInputTokensPerChild": {
                                  "default": 50000,
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxOutputTokensPerChild": {
                                  "default": 8000,
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxWallTimeMs": {
                                  "default": 3600000,
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxConcurrentAgents": {
                                  "default": 3,
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 16
                                },
                                "maxTotalAgents": {
                                  "default": 25,
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 1000
                                },
                                "maxToolCalls": {
                                  "default": 500,
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "maxRetries": {
                                  "default": 1,
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 5
                                }
                              }
                            },
                            "pacing": {
                              "default": {
                                "maxRequestsPerMinute": 12,
                                "maxTokensPerMinute": 200000
                              },
                              "type": "object",
                              "properties": {
                                "maxRequestsPerMinute": {
                                  "default": 12,
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 120
                                },
                                "maxTokensPerMinute": {
                                  "default": 200000,
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 2000000
                                }
                              }
                            },
                            "modelPolicy": {
                              "default": {
                                "effort": "normal",
                                "allowedProviders": [],
                                "routing": []
                              },
                              "type": "object",
                              "properties": {
                                "defaultModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "cheapModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "strongModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "plannerModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "workerModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "verifierModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "synthesizerModel": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "effort": {
                                  "default": "normal",
                                  "type": "string",
                                  "enum": [
                                    "normal",
                                    "deep",
                                    "workflow",
                                    "max-workflow"
                                  ]
                                },
                                "allowedProviders": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "routing": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "phaseKind": {
                                        "type": "string",
                                        "enum": [
                                          "fanout",
                                          "sequential",
                                          "synthesis",
                                          "verification",
                                          "noop"
                                        ]
                                      },
                                      "use": {
                                        "type": "string",
                                        "enum": [
                                          "planner",
                                          "worker",
                                          "verifier",
                                          "synthesizer"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "use"
                                    ]
                                  }
                                }
                              }
                            },
                            "permissions": {
                              "default": {
                                "writePolicy": "read-only",
                                "allowedTools": [],
                                "networkPolicy": "inherit",
                                "escalationPolicy": "ask"
                              },
                              "type": "object",
                              "properties": {
                                "writePolicy": {
                                  "default": "read-only",
                                  "type": "string",
                                  "enum": [
                                    "read-only",
                                    "serialized",
                                    "worktree-required"
                                  ]
                                },
                                "allowedTools": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "networkPolicy": {
                                  "default": "inherit",
                                  "type": "string",
                                  "enum": [
                                    "inherit",
                                    "disabled",
                                    "allowed"
                                  ]
                                },
                                "escalationPolicy": {
                                  "default": "ask",
                                  "type": "string",
                                  "enum": [
                                    "inherit",
                                    "ask",
                                    "deny"
                                  ]
                                }
                              }
                            },
                            "artifacts": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 80,
                                    "pattern": "^[a-z][a-z0-9-]*$"
                                  },
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "summary",
                                      "finding",
                                      "patch",
                                      "verification",
                                      "metric",
                                      "log"
                                    ]
                                  },
                                  "retention": {
                                    "default": "session",
                                    "type": "string",
                                    "enum": [
                                      "ephemeral",
                                      "session",
                                      "durable"
                                    ]
                                  },
                                  "exposeToMainContext": {
                                    "default": false,
                                    "type": "boolean"
                                  },
                                  "redaction": {
                                    "type": "object",
                                    "properties": {
                                      "status": {
                                        "default": "pending",
                                        "type": "string",
                                        "enum": [
                                          "none",
                                          "redacted",
                                          "pending"
                                        ]
                                      },
                                      "summary": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500
                                      }
                                    }
                                  }
                                },
                                "required": [
                                  "id",
                                  "kind"
                                ]
                              }
                            },
                            "verification": {
                              "default": {
                                "mode": "optional",
                                "commands": [],
                                "requiredArtifactIds": []
                              },
                              "type": "object",
                              "properties": {
                                "mode": {
                                  "default": "optional",
                                  "type": "string",
                                  "enum": [
                                    "required",
                                    "optional",
                                    "deferred",
                                    "skipped"
                                  ]
                                },
                                "workflow": {
                                  "type": "string",
                                  "enum": [
                                    "review",
                                    "debug",
                                    "qa"
                                  ]
                                },
                                "commands": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "requiredArtifactIds": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 80,
                                    "pattern": "^[a-z][a-z0-9-]*$"
                                  }
                                },
                                "reason": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 500
                                }
                              }
                            },
                            "synthesis": {
                              "default": {
                                "outputFormat": "markdown",
                                "exposeToMainContext": true,
                                "requiredArtifactIds": []
                              },
                              "type": "object",
                              "properties": {
                                "agent": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "model": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "outputFormat": {
                                  "default": "markdown",
                                  "type": "string",
                                  "enum": [
                                    "markdown",
                                    "json",
                                    "table",
                                    "findings"
                                  ]
                                },
                                "exposeToMainContext": {
                                  "default": true,
                                  "type": "boolean"
                                },
                                "requiredArtifactIds": {
                                  "default": [],
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 80,
                                    "pattern": "^[a-z][a-z0-9-]*$"
                                  }
                                }
                              }
                            },
                            "phases": {
                              "minItems": 1,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 80,
                                    "pattern": "^[a-z][a-z0-9-]*$"
                                  },
                                  "name": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "fanout",
                                      "sequential",
                                      "synthesis",
                                      "verification",
                                      "noop"
                                    ]
                                  },
                                  "prompt": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "agent": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "inputs": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "outputs": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 80,
                                      "pattern": "^[a-z][a-z0-9-]*$"
                                    }
                                  },
                                  "dependsOn": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 80,
                                      "pattern": "^[a-z][a-z0-9-]*$"
                                    }
                                  },
                                  "maxParallel": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 16
                                  },
                                  "mergeStrategy": {
                                    "default": "all",
                                    "type": "string",
                                    "enum": [
                                      "all",
                                      "first-success",
                                      "majority",
                                      "vote-with-critic",
                                      "critic-confirmation",
                                      "custom-reducer"
                                    ]
                                  },
                                  "modelPolicy": {
                                    "type": "object",
                                    "properties": {
                                      "defaultModel": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "cheapModel": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "strongModel": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "plannerModel": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "workerModel": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "verifierModel": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "synthesizerModel": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "effort": {
                                        "default": "normal",
                                        "type": "string",
                                        "enum": [
                                          "normal",
                                          "deep",
                                          "workflow",
                                          "max-workflow"
                                        ]
                                      },
                                      "allowedProviders": {
                                        "default": [],
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      },
                                      "routing": {
                                        "default": [],
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "phaseKind": {
                                              "type": "string",
                                              "enum": [
                                                "fanout",
                                                "sequential",
                                                "synthesis",
                                                "verification",
                                                "noop"
                                              ]
                                            },
                                            "use": {
                                              "type": "string",
                                              "enum": [
                                                "planner",
                                                "worker",
                                                "verifier",
                                                "synthesizer"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "use"
                                          ]
                                        }
                                      }
                                    }
                                  },
                                  "budget": {
                                    "type": "object",
                                    "properties": {
                                      "maxTotalTokens": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "maxInputTokensPerChild": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "maxOutputTokensPerChild": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "maxWallTimeMs": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "maxConcurrentAgents": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 16
                                      },
                                      "maxTotalAgents": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 1000
                                      },
                                      "maxToolCalls": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "maxRetries": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 5
                                      }
                                    }
                                  },
                                  "pacing": {
                                    "type": "object",
                                    "properties": {
                                      "maxRequestsPerMinute": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 120
                                      },
                                      "maxTokensPerMinute": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 2000000
                                      }
                                    }
                                  }
                                },
                                "required": [
                                  "id",
                                  "name",
                                  "kind"
                                ]
                              }
                            }
                          },
                          "required": [
                            "schemaVersion",
                            "id",
                            "name",
                            "description",
                            "phases"
                          ]
                        },
                        "inputValues": {
                          "default": {},
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "budget": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "budgetUsage": {
                          "type": "object",
                          "properties": {
                            "totalTokens": {
                              "default": 0,
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "inputTokens": {
                              "default": 0,
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "outputTokens": {
                              "default": 0,
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "toolCalls": {
                              "default": 0,
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "childAgents": {
                              "default": 0,
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "retries": {
                              "default": 0,
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          }
                        },
                        "verificationEnvelopeIDs": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "error": {
                          "type": "string"
                        },
                        "time": {
                          "type": "object",
                          "properties": {
                            "created": {
                              "type": "number"
                            },
                            "updated": {
                              "type": "number"
                            },
                            "started": {
                              "type": "number"
                            },
                            "completed": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "created",
                            "updated"
                          ]
                        },
                        "phases": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/WorkflowPhaseEventRecord"
                          }
                        },
                        "children": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/WorkflowChildEventRecord"
                          }
                        },
                        "artifacts": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/WorkflowArtifactEventRecord"
                          }
                        },
                        "budgetLedger": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/WorkflowBudgetLedgerEventEntry"
                          }
                        }
                      },
                      "required": [
                        "id",
                        "projectID",
                        "directory",
                        "status",
                        "spec",
                        "budget",
                        "budgetUsage",
                        "verificationEnvelopeIDs",
                        "time",
                        "phases",
                        "children",
                        "artifacts",
                        "budgetLedger"
                      ]
                    }
                  },
                  "required": [
                    "routine",
                    "template",
                    "run"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "route": {
                    "type": "string",
                    "minLength": 1
                  },
                  "parentSessionID": {
                    "type": "string",
                    "pattern": "^ses_.*"
                  },
                  "modelPolicy": {
                    "type": "object",
                    "properties": {
                      "defaultModel": {
                        "type": "string",
                        "minLength": 1
                      },
                      "cheapModel": {
                        "type": "string",
                        "minLength": 1
                      },
                      "strongModel": {
                        "type": "string",
                        "minLength": 1
                      },
                      "plannerModel": {
                        "type": "string",
                        "minLength": 1
                      },
                      "workerModel": {
                        "type": "string",
                        "minLength": 1
                      },
                      "verifierModel": {
                        "type": "string",
                        "minLength": 1
                      },
                      "synthesizerModel": {
                        "type": "string",
                        "minLength": 1
                      },
                      "effort": {
                        "default": "normal",
                        "type": "string",
                        "enum": [
                          "normal",
                          "deep",
                          "workflow",
                          "max-workflow"
                        ]
                      },
                      "allowedProviders": {
                        "default": [],
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "routing": {
                        "default": [],
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "phaseKind": {
                              "type": "string",
                              "enum": [
                                "fanout",
                                "sequential",
                                "synthesis",
                                "verification",
                                "noop"
                              ]
                            },
                            "use": {
                              "type": "string",
                              "enum": [
                                "planner",
                                "worker",
                                "verifier",
                                "synthesizer"
                              ]
                            }
                          },
                          "required": [
                            "use"
                          ]
                        }
                      }
                    }
                  },
                  "inputValues": {
                    "default": {},
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "startOptions": {
                    "type": "object",
                    "properties": {
                      "allowScaleBeyondDefaults": {
                        "type": "boolean"
                      },
                      "allowWriteWorkflows": {
                        "type": "boolean"
                      },
                      "durableChildren": {
                        "type": "boolean"
                      },
                      "enqueueChildren": {
                        "type": "boolean"
                      },
                      "autoStartChildren": {
                        "type": "boolean"
                      }
                    }
                  }
                },
                "required": [
                  "route"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.workflowRoutine.run({\n  ...\n})"
          }
        ]
      }
    },
    "/experimental/wiki-maintenance/enable": {
      "post": {
        "operationId": "wiki.enable",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Enable interactive Wiki maintenance",
        "responses": {
          "200": {
            "description": "Wiki maintenance status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WikiMaintenanceStatus"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agent": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "active": {
                    "type": "boolean"
                  },
                  "sessionID": {
                    "type": "string",
                    "pattern": "^ses_.*"
                  }
                },
                "required": [
                  "agent"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.wiki.enable({\n  ...\n})"
          }
        ]
      }
    },
    "/experimental/wiki-maintenance/refresh": {
      "post": {
        "operationId": "wiki.refresh",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Request Wiki maintenance after foreground work settles",
        "responses": {
          "200": {
            "description": "Wiki maintenance status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WikiMaintenanceStatus"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agent": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "active": {
                    "type": "boolean"
                  },
                  "sessionID": {
                    "type": "string",
                    "pattern": "^ses_.*"
                  }
                },
                "required": [
                  "agent"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.wiki.refresh({\n  ...\n})"
          }
        ]
      }
    },
    "/experimental/wiki-maintenance": {
      "get": {
        "operationId": "wiki.maintenance",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get Wiki maintenance status without starting work",
        "responses": {
          "200": {
            "description": "Wiki maintenance status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WikiMaintenanceStatus"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.wiki.maintenance({\n  ...\n})"
          }
        ]
      }
    },
    "/experimental/wiki-visualization": {
      "get": {
        "operationId": "wiki.visualization",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get Wiki visualization snapshot",
        "description": "Read the configured Wiki manifest in the current runtime project. Returns a bounded page/source/symbol evidence snapshot, reading bounded source prefixes for symbol provenance and inventory without generation or indexing.",
        "responses": {
          "200": {
            "description": "Recorded Wiki evidence snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WikiVisualizationGraph"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.wiki.visualization({\n  ...\n})"
          }
        ]
      }
    },
    "/experimental/fixed-context": {
      "post": {
        "operationId": "experimental.ask",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Ask about fixed files",
        "description": "Answer a standalone question using explicitly selected permitted files and an AX Trust model. No session history or tools are attached.",
        "responses": {
          "200": {
            "description": "Answer and observed cache status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FixedContextOutput"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FixedContextInput"
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.experimental.ask({\n  ...\n})"
          }
        ]
      }
    },
    "/experimental/tool/ids": {
      "get": {
        "operationId": "tool.ids",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "List tool IDs",
        "description": "Get a list of all available tool IDs, including both built-in tools and dynamically registered tools.",
        "responses": {
          "200": {
            "description": "Tool IDs",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolIDs"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.tool.ids({\n  ...\n})"
          }
        ]
      }
    },
    "/experimental/tool": {
      "get": {
        "operationId": "tool.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "provider",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "model",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "summary": "List tools",
        "description": "Get a list of available tools with their JSON schema parameters for a specific provider and model combination.",
        "responses": {
          "200": {
            "description": "Tools",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolList"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.tool.list({\n  ...\n})"
          }
        ]
      }
    },
    "/experimental/worktree": {
      "post": {
        "operationId": "worktree.create",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Create worktree",
        "description": "Create a new git worktree for the current project and run any configured startup scripts.",
        "responses": {
          "200": {
            "description": "Worktree created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Worktree"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorktreeCreateInput"
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.worktree.create({\n  ...\n})"
          }
        ]
      },
      "get": {
        "operationId": "worktree.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "List worktrees",
        "description": "List all sandbox worktrees for the current project, including git branch metadata when available.",
        "responses": {
          "200": {
            "description": "List of sandbox worktrees",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WorktreeListItem"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.worktree.list({\n  ...\n})"
          }
        ]
      },
      "delete": {
        "operationId": "worktree.remove",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Remove worktree",
        "description": "Remove a git worktree and delete its branch.",
        "responses": {
          "200": {
            "description": "Worktree removed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorktreeRemoveInput"
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.worktree.remove({\n  ...\n})"
          }
        ]
      }
    },
    "/experimental/worktree/reset": {
      "post": {
        "operationId": "worktree.reset",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Reset worktree",
        "description": "Reset a worktree branch to the primary default branch.",
        "responses": {
          "200": {
            "description": "Worktree reset",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorktreeResetInput"
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.worktree.reset({\n  ...\n})"
          }
        ]
      }
    },
    "/experimental/session": {
      "get": {
        "operationId": "experimental.session.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            },
            "description": "Filter sessions by project directory"
          },
          {
            "in": "query",
            "name": "roots",
            "schema": {
              "type": "boolean"
            },
            "description": "Only return root sessions (no parentID)"
          },
          {
            "in": "query",
            "name": "start",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "description": "Filter sessions updated on or after this timestamp (milliseconds since epoch)"
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "description": "Return sessions updated before this timestamp (milliseconds since epoch)"
          },
          {
            "in": "query",
            "name": "cursorId",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "description": "Session id tiebreaker for the cursor. Pass the id of the last session of the previous page (x-next-cursor-id) so sessions sharing the cursor timestamp are not skipped."
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string"
            },
            "description": "Filter sessions by title (case-insensitive)"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            },
            "description": "Maximum number of sessions to return"
          },
          {
            "in": "query",
            "name": "archived",
            "schema": {
              "type": "boolean"
            },
            "description": "Include archived sessions (default false)"
          }
        ],
        "summary": "List sessions",
        "description": "Get a list of all ax-code sessions across projects, sorted by most recently updated. Archived sessions are excluded by default.",
        "responses": {
          "200": {
            "description": "List of sessions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/GlobalSession"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.experimental.session.list({\n  ...\n})"
          }
        ]
      }
    },
    "/experimental/resource": {
      "get": {
        "operationId": "experimental.resource.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get MCP resources",
        "description": "Get all available MCP resources from connected servers. Optionally filter by name.",
        "responses": {
          "200": {
            "description": "MCP resources",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "$ref": "#/components/schemas/McpResource"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.experimental.resource.list({\n  ...\n})"
          }
        ]
      }
    },
    "/session": {
      "get": {
        "operationId": "session.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            },
            "description": "Filter sessions by project directory"
          },
          {
            "in": "query",
            "name": "roots",
            "schema": {
              "type": "boolean"
            },
            "description": "Only return root sessions (no parentID)"
          },
          {
            "in": "query",
            "name": "start",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "description": "Filter sessions updated on or after this timestamp (milliseconds since epoch)"
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string"
            },
            "description": "Filter sessions by title (case-insensitive)"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            },
            "description": "Maximum number of sessions to return (1-1000)"
          }
        ],
        "summary": "List sessions",
        "description": "Get a list of all ax-code sessions, sorted by most recently updated.",
        "responses": {
          "200": {
            "description": "List of sessions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Session"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.list({\n  ...\n})"
          }
        ]
      },
      "post": {
        "operationId": "session.create",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Create session",
        "description": "Create a new ax-code session for interacting with AI assistants and managing conversations.",
        "responses": {
          "200": {
            "description": "Successfully created session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^ses_.*"
                  },
                  "parentID": {
                    "type": "string",
                    "pattern": "^ses_.*"
                  },
                  "title": {
                    "type": "string"
                  },
                  "permission": {
                    "$ref": "#/components/schemas/PermissionRuleset"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.create({\n  ...\n})"
          }
        ]
      }
    },
    "/session/status": {
      "get": {
        "operationId": "session.status",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get session status",
        "description": "Retrieve the current status of all sessions, including active, idle, and completed states.",
        "responses": {
          "200": {
            "description": "Get session status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "$ref": "#/components/schemas/SessionStatus"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.status({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}": {
      "get": {
        "operationId": "session.get",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Get session",
        "description": "Retrieve detailed information about a specific ax-code session.",
        "tags": [
          "Session"
        ],
        "responses": {
          "200": {
            "description": "Get session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.get({\n  ...\n})"
          }
        ]
      },
      "delete": {
        "operationId": "session.delete",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Delete session",
        "description": "Delete a session and permanently remove all associated data, including messages and history.",
        "responses": {
          "200": {
            "description": "Successfully deleted session",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.delete({\n  ...\n})"
          }
        ]
      },
      "patch": {
        "operationId": "session.update",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Update session",
        "description": "Update properties of an existing session, such as title or other metadata.",
        "responses": {
          "200": {
            "description": "Successfully updated session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "time": {
                    "type": "object",
                    "properties": {
                      "archived": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    }
                  },
                  "metadata": {
                    "$ref": "#/components/schemas/SessionMetadata"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.update({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/goal": {
      "get": {
        "operationId": "session.goal",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Get session goal",
        "description": "Retrieve the durable goal state associated with a specific ax-code session.",
        "tags": [
          "Session"
        ],
        "responses": {
          "200": {
            "description": "Current session goal, or null when no goal is set.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "sessionID": {
                          "type": "string",
                          "pattern": "^ses_.*"
                        },
                        "objective": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "active",
                            "paused",
                            "complete",
                            "blocked",
                            "budget_limited"
                          ]
                        },
                        "tokenBudget": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "tokensUsed": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "timeUsedSeconds": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "timeBudgetSeconds": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "time": {
                          "type": "object",
                          "properties": {
                            "created": {
                              "type": "number"
                            },
                            "updated": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "created"
                          ]
                        },
                        "remainingTokens": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "remainingTimeSeconds": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "planPath": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "sessionID",
                        "objective",
                        "status",
                        "tokensUsed",
                        "timeUsedSeconds",
                        "time"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.goal({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/children": {
      "get": {
        "operationId": "session.children",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Get session children",
        "tags": [
          "Session"
        ],
        "description": "Retrieve all child sessions that were forked from the specified parent session.",
        "responses": {
          "200": {
            "description": "List of children",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Session"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.children({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/branch/rank": {
      "get": {
        "operationId": "session.branch_rank",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "deep",
            "schema": {
              "type": "boolean"
            },
            "description": "Include replay divergence signals in branch ranking"
          }
        ],
        "summary": "Rank session branches",
        "tags": [
          "Session"
        ],
        "description": "Compare the root session and its forks, then recommend the strongest branch based on risk and decision signals.",
        "responses": {
          "200": {
            "description": "Branch ranking for the session family",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionBranchFamily"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.branch_rank({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/dre": {
      "get": {
        "operationId": "session.dre",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Get session DRE detail",
        "tags": [
          "Session"
        ],
        "description": "Return the session decision summary, explainable risk detail, and execution timeline for DRE-aware clients.",
        "responses": {
          "200": {
            "description": "DRE detail and timeline for the session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionDreSnapshot"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.dre({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/graph": {
      "get": {
        "operationId": "session.graph",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Get session graph snapshot",
        "tags": [
          "Session"
        ],
        "description": "Return the execution graph and structured topology view for a session.",
        "responses": {
          "200": {
            "description": "Execution graph snapshot for the session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionGraphSnapshot"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.graph({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/risk": {
      "get": {
        "operationId": "session.risk",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "quality",
            "schema": {
              "type": "boolean"
            },
            "description": "Include replay readiness for review/debug/qa when replay evidence exists"
          },
          {
            "in": "query",
            "name": "findings",
            "schema": {
              "type": "boolean"
            },
            "description": "Include the validated Finding[] emitted by register_finding tool calls in this session"
          },
          {
            "in": "query",
            "name": "envelopes",
            "schema": {
              "type": "boolean"
            },
            "description": "Include the validated VerificationEnvelope[] emitted by tool calls that record verification runs (e.g. refactor_apply)"
          },
          {
            "in": "query",
            "name": "reviewResults",
            "schema": {
              "type": "boolean"
            },
            "description": "Include the validated ReviewResult[] emitted by review_complete tool calls in this session"
          },
          {
            "in": "query",
            "name": "debug",
            "schema": {
              "type": "boolean"
            },
            "description": "Include the validated DebugCase / DebugEvidence / DebugHypothesis bundles emitted by Phase 3 runtime debug tools"
          },
          {
            "in": "query",
            "name": "hints",
            "schema": {
              "type": "boolean"
            },
            "description": "Include advisory decision-hint readiness derived from recent replay tool evidence"
          }
        ],
        "summary": "Get session risk detail",
        "tags": [
          "Session"
        ],
        "description": "Return the explainable risk assessment, breakdown, and semantic change summary for a session. Optionally include replay readiness and structured assurance artifacts for review/debug/qa workflows.",
        "responses": {
          "200": {
            "description": "Explainable risk detail for the session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionRiskDetail"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.risk({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/diff/semantic": {
      "get": {
        "operationId": "session.semantic_diff",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Get semantic diff summary",
        "tags": [
          "Session"
        ],
        "description": "Return a semantic classification of the recorded file changes for a session.",
        "responses": {
          "200": {
            "description": "Semantic diff summary for the session",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionSemanticDiffSummary"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.semantic_diff({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/compare/{otherSessionID}": {
      "get": {
        "operationId": "session.compare",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "otherSessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "deep",
            "schema": {
              "type": "boolean"
            },
            "description": "Include replay divergence signals in session comparison"
          }
        ],
        "summary": "Compare session executions",
        "tags": [
          "Session"
        ],
        "description": "Compare two sessions by risk, decision score, event flow, and optional replay divergence signals.",
        "responses": {
          "200": {
            "description": "Execution comparison for the two sessions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionCompareResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.compare({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/rollback": {
      "get": {
        "operationId": "session.rollback_points",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "tool",
            "schema": {
              "type": "string"
            },
            "description": "Only return rollback points whose step used this tool"
          }
        ],
        "summary": "List rollback points",
        "tags": [
          "Session"
        ],
        "description": "Return the step-level rollback points available for a session, including tool and token context.",
        "responses": {
          "200": {
            "description": "Rollback points for the session",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SessionRollbackPoint"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.rollback_points({\n  ...\n})"
          }
        ]
      },
      "post": {
        "operationId": "session.rollback",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Apply rollback point",
        "tags": [
          "Session"
        ],
        "description": "Apply a step-level rollback point, including same-directory descendant changes, selected by step index or tool name.",
        "responses": {
          "200": {
            "description": "Updated session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionRollbackApplyInput"
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.rollback({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/move/validate": {
      "post": {
        "operationId": "session.move_validate",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Validate session move target",
        "tags": [
          "Session"
        ],
        "description": "Validate whether a session can move to a target directory without mutating session or project state.",
        "responses": {
          "200": {
            "description": "Session move target validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionMoveValidation"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "targetDirectory": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "targetDirectory"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.move_validate({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/move": {
      "post": {
        "operationId": "session.move",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Move session",
        "tags": [
          "Session"
        ],
        "description": "Move a session to a validated target directory by updating the session's owning directory. This does not move files.",
        "responses": {
          "200": {
            "description": "Updated session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "targetDirectory": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "targetDirectory"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.move({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/rollback/preview": {
      "post": {
        "operationId": "session.rollback_preview",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Preview rollback point",
        "tags": [
          "Session"
        ],
        "description": "Preview root and same-directory descendant file changes covered by a step-level rollback point selected by step index or tool name.",
        "responses": {
          "200": {
            "description": "Rollback preview",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionRollbackPreview"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionRollbackApplyInput"
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.rollback_preview({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/todo": {
      "get": {
        "operationId": "session.todo",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Get session todos",
        "description": "Retrieve the todo list associated with a specific session, showing tasks and action items.",
        "responses": {
          "200": {
            "description": "Todo list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Todo"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.todo({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/init": {
      "post": {
        "operationId": "session.init",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Initialize session",
        "description": "Analyze the current application and create an AGENTS.md file with project-specific agent configurations.",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "modelID": {
                    "type": "string"
                  },
                  "providerID": {
                    "type": "string"
                  },
                  "messageID": {
                    "type": "string",
                    "pattern": "^msg_.*"
                  }
                },
                "required": [
                  "modelID",
                  "providerID",
                  "messageID"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.init({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/fork": {
      "post": {
        "operationId": "session.fork",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Fork session",
        "description": "Create a new session by forking an existing session at a specific message point.",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "messageID": {
                    "type": "string",
                    "pattern": "^msg_.*"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.fork({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/steering": {
      "get": {
        "operationId": "session.steering",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Get active generation and steering receipts",
        "description": "Receipts are process-local and bounded. Applied means durably admitted at a loop boundary, not guaranteed provider completion.",
        "tags": [
          "Session"
        ],
        "responses": {
          "200": {
            "description": "Steering state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SteeringState"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.steering({\n  ...\n})"
          }
        ]
      },
      "post": {
        "operationId": "session.steer",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Steer a specific active generation",
        "description": "Accept a bounded correction for the next loop boundary. Stale generations and hook vetoes return rejected receipts; reused client IDs with different content conflict.",
        "tags": [
          "Session"
        ],
        "responses": {
          "200": {
            "description": "Steering receipt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SteeringReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedGeneration": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "clientID": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9_-]{1,100}$"
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 16000
                  }
                },
                "required": [
                  "expectedGeneration",
                  "clientID",
                  "text"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.steer({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/abort": {
      "post": {
        "operationId": "session.abort",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Abort session",
        "description": "Abort an active session and stop any ongoing AI processing or command execution.",
        "responses": {
          "200": {
            "description": "Aborted session",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.abort({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/diff": {
      "get": {
        "operationId": "session.diff",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "messageID",
            "schema": {
              "type": "string",
              "pattern": "^msg_.*"
            }
          }
        ],
        "summary": "Get message diff",
        "description": "Get the file changes (diff) that resulted from a specific user message in the session.",
        "responses": {
          "200": {
            "description": "Successfully retrieved diff",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/FileDiff"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.diff({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/summarize": {
      "post": {
        "operationId": "session.summarize",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Summarize session",
        "description": "Generate a concise summary of the session using AI compaction to preserve key information.",
        "responses": {
          "200": {
            "description": "Summarized session",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "providerID": {
                    "type": "string"
                  },
                  "modelID": {
                    "type": "string"
                  },
                  "auto": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "providerID",
                  "modelID"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.summarize({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/recap": {
      "post": {
        "operationId": "session.recap",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "scope",
            "schema": {
              "type": "string",
              "enum": [
                "turn",
                "conversation"
              ]
            }
          }
        ],
        "summary": "Recap conversation",
        "description": "Generate a short plain-text recap using the provider's small model. Defaults to the most recent turn; scope=conversation includes up to eight recent turns. Read-only and best-effort: returns null when no recap is available.",
        "responses": {
          "200": {
            "description": "Recap of the requested scope, or null when unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "text": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "text"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.recap({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/message": {
      "get": {
        "operationId": "session.messages",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 500
            },
            "description": "Maximum number of messages to return (0-500)"
          },
          {
            "in": "query",
            "name": "before",
            "schema": {
              "type": "string"
            },
            "description": "Opaque cursor for loading older messages"
          }
        ],
        "summary": "Get session messages",
        "description": "Retrieve all messages in a session, including user prompts and AI responses.",
        "responses": {
          "200": {
            "description": "List of messages",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "info": {
                        "$ref": "#/components/schemas/Message"
                      },
                      "parts": {
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/Part"
                        }
                      }
                    },
                    "required": [
                      "info",
                      "parts"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.messages({\n  ...\n})"
          }
        ]
      },
      "post": {
        "operationId": "session.prompt",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Send message",
        "description": "Create and send a new message to a session, returning the final assistant response.",
        "responses": {
          "200": {
            "description": "Created message",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "info": {
                      "$ref": "#/components/schemas/AssistantMessage"
                    },
                    "parts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Part"
                      }
                    }
                  },
                  "required": [
                    "info",
                    "parts"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "messageID": {
                    "type": "string",
                    "pattern": "^msg_.*"
                  },
                  "model": {
                    "type": "object",
                    "properties": {
                      "providerID": {
                        "type": "string"
                      },
                      "modelID": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "providerID",
                      "modelID"
                    ]
                  },
                  "agent": {
                    "type": "string"
                  },
                  "userSelectedAgent": {
                    "description": "@deprecated Use agentRouting to control automatic specialist routing.",
                    "type": "boolean"
                  },
                  "agentRouting": {
                    "description": "Controls specialist agent auto-routing. Use preserve for synthetic continuation prompts.",
                    "type": "string",
                    "enum": [
                      "auto",
                      "preserve"
                    ]
                  },
                  "noReply": {
                    "type": "boolean"
                  },
                  "tools": {
                    "description": "@deprecated tools and permissions have been merged, you can set permissions on the session itself now",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "boolean"
                    }
                  },
                  "toolsScope": {
                    "type": "string",
                    "enum": [
                      "session",
                      "turn"
                    ]
                  },
                  "isolation": {
                    "type": "object",
                    "properties": {
                      "mode": {
                        "type": "string",
                        "enum": [
                          "read-only",
                          "workspace-write",
                          "full-access"
                        ]
                      },
                      "network": {
                        "type": "boolean"
                      }
                    },
                    "additionalProperties": false
                  },
                  "format": {
                    "$ref": "#/components/schemas/OutputFormat"
                  },
                  "system": {
                    "type": "string"
                  },
                  "variant": {
                    "type": "string"
                  },
                  "requestedDepth": {
                    "type": "string",
                    "enum": [
                      "fast",
                      "standard",
                      "deep",
                      "xdeep"
                    ]
                  },
                  "parts": {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/TextPartInput"
                        },
                        {
                          "$ref": "#/components/schemas/FilePartInput"
                        },
                        {
                          "$ref": "#/components/schemas/AgentPartInput"
                        },
                        {
                          "$ref": "#/components/schemas/SubtaskPartInput"
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "parts"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.prompt({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/message/{messageID}": {
      "get": {
        "operationId": "session.message",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "messageID",
            "schema": {
              "type": "string",
              "pattern": "^msg_.*"
            },
            "required": true
          }
        ],
        "summary": "Get message",
        "description": "Retrieve a specific message from a session by its message ID.",
        "responses": {
          "200": {
            "description": "Message",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "info": {
                      "$ref": "#/components/schemas/Message"
                    },
                    "parts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Part"
                      }
                    }
                  },
                  "required": [
                    "info",
                    "parts"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.message({\n  ...\n})"
          }
        ]
      },
      "delete": {
        "operationId": "session.deleteMessage",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "messageID",
            "schema": {
              "type": "string",
              "pattern": "^msg_.*"
            },
            "required": true
          }
        ],
        "summary": "Delete message",
        "description": "Permanently delete a specific message (and all of its parts) from a session. This does not revert any file changes that may have been made while processing the message.",
        "responses": {
          "200": {
            "description": "Successfully deleted message",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.deleteMessage({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/message/{messageID}/feedback": {
      "patch": {
        "operationId": "session.feedback",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "messageID",
            "schema": {
              "type": "string",
              "pattern": "^msg_.*"
            },
            "required": true
          }
        ],
        "summary": "Set message feedback",
        "description": "Store or clear a local helpful / needs-improvement signal for a completed assistant message.",
        "responses": {
          "200": {
            "description": "Updated assistant message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantMessage"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "up",
                          "down"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "value"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.feedback({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/message/{messageID}/part/{partID}": {
      "delete": {
        "operationId": "part.delete",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "messageID",
            "schema": {
              "type": "string",
              "pattern": "^msg_.*"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "partID",
            "schema": {
              "type": "string",
              "pattern": "^prt_.*"
            },
            "required": true
          }
        ],
        "description": "Delete a part from a message",
        "responses": {
          "200": {
            "description": "Successfully deleted part",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.part.delete({\n  ...\n})"
          }
        ]
      },
      "patch": {
        "operationId": "part.update",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "messageID",
            "schema": {
              "type": "string",
              "pattern": "^msg_.*"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "partID",
            "schema": {
              "type": "string",
              "pattern": "^prt_.*"
            },
            "required": true
          }
        ],
        "description": "Update a part in a message",
        "responses": {
          "200": {
            "description": "Successfully updated part",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Part"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Part"
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.part.update({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/prompt_async": {
      "post": {
        "operationId": "session.prompt_async",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "executionTimeoutMs",
            "schema": {
              "type": "integer",
              "minimum": 1000,
              "maximum": 259200000
            }
          },
          {
            "in": "query",
            "name": "sourceTaskID",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "resumeOnRestart",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "followup",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "summary": "Send async message",
        "description": "Create and send a new message to a session asynchronously, starting the session if needed and returning immediately.",
        "responses": {
          "202": {
            "description": "Prompt accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^tsk_.*"
                    },
                    "projectID": {
                      "type": "string"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "sessionID": {
                      "type": "string",
                      "pattern": "^ses_.*"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "prompt",
                        "command",
                        "shell",
                        "followup",
                        "subagent",
                        "automation"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "waiting_for_idle",
                        "running",
                        "blocked_permission",
                        "blocked_question",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "priority": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "position": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "title": {
                      "type": "string"
                    },
                    "agent": {
                      "type": "string"
                    },
                    "model": {},
                    "sourceMessageID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "payload": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "error": {
                      "type": "string"
                    },
                    "executionTimeoutMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 259200000
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "kind",
                    "status",
                    "priority",
                    "position",
                    "title",
                    "payload",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "messageID": {
                    "type": "string",
                    "pattern": "^msg_.*"
                  },
                  "model": {
                    "type": "object",
                    "properties": {
                      "providerID": {
                        "type": "string"
                      },
                      "modelID": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "providerID",
                      "modelID"
                    ]
                  },
                  "agent": {
                    "type": "string"
                  },
                  "userSelectedAgent": {
                    "description": "@deprecated Use agentRouting to control automatic specialist routing.",
                    "type": "boolean"
                  },
                  "agentRouting": {
                    "description": "Controls specialist agent auto-routing. Use preserve for synthetic continuation prompts.",
                    "type": "string",
                    "enum": [
                      "auto",
                      "preserve"
                    ]
                  },
                  "noReply": {
                    "type": "boolean"
                  },
                  "tools": {
                    "description": "@deprecated tools and permissions have been merged, you can set permissions on the session itself now",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "boolean"
                    }
                  },
                  "toolsScope": {
                    "type": "string",
                    "enum": [
                      "session",
                      "turn"
                    ]
                  },
                  "isolation": {
                    "type": "object",
                    "properties": {
                      "mode": {
                        "type": "string",
                        "enum": [
                          "read-only",
                          "workspace-write",
                          "full-access"
                        ]
                      },
                      "network": {
                        "type": "boolean"
                      }
                    },
                    "additionalProperties": false
                  },
                  "format": {
                    "$ref": "#/components/schemas/OutputFormat"
                  },
                  "system": {
                    "type": "string"
                  },
                  "variant": {
                    "type": "string"
                  },
                  "requestedDepth": {
                    "type": "string",
                    "enum": [
                      "fast",
                      "standard",
                      "deep",
                      "xdeep"
                    ]
                  },
                  "parts": {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/TextPartInput"
                        },
                        {
                          "$ref": "#/components/schemas/FilePartInput"
                        },
                        {
                          "$ref": "#/components/schemas/AgentPartInput"
                        },
                        {
                          "$ref": "#/components/schemas/SubtaskPartInput"
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "parts"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.prompt_async({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/command_async": {
      "post": {
        "operationId": "session.command_async",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "executionTimeoutMs",
            "schema": {
              "type": "integer",
              "minimum": 1000,
              "maximum": 259200000
            }
          },
          {
            "in": "query",
            "name": "sourceTaskID",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "resumeOnRestart",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "followup",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "summary": "Send async command",
        "description": "Queue a command for a session and return immediately after it is accepted.",
        "responses": {
          "202": {
            "description": "Command accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^tsk_.*"
                    },
                    "projectID": {
                      "type": "string"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "sessionID": {
                      "type": "string",
                      "pattern": "^ses_.*"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "prompt",
                        "command",
                        "shell",
                        "followup",
                        "subagent",
                        "automation"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "waiting_for_idle",
                        "running",
                        "blocked_permission",
                        "blocked_question",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "priority": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "position": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "title": {
                      "type": "string"
                    },
                    "agent": {
                      "type": "string"
                    },
                    "model": {},
                    "sourceMessageID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "payload": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "error": {
                      "type": "string"
                    },
                    "executionTimeoutMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 259200000
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "kind",
                    "status",
                    "priority",
                    "position",
                    "title",
                    "payload",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "system": {
                    "type": "string"
                  },
                  "messageID": {
                    "type": "string",
                    "pattern": "^msg_.*"
                  },
                  "agent": {
                    "type": "string"
                  },
                  "model": {
                    "type": "string"
                  },
                  "arguments": {
                    "type": "string"
                  },
                  "command": {
                    "type": "string"
                  },
                  "variant": {
                    "type": "string"
                  },
                  "parts": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/FilePartInput"
                    }
                  }
                },
                "required": [
                  "arguments",
                  "command"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.command_async({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/command": {
      "post": {
        "operationId": "session.command",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Send command",
        "description": "Send a new command to a session for execution by the AI assistant.",
        "responses": {
          "200": {
            "description": "Created message",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "info": {
                      "$ref": "#/components/schemas/AssistantMessage"
                    },
                    "parts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Part"
                      }
                    }
                  },
                  "required": [
                    "info",
                    "parts"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "system": {
                    "type": "string"
                  },
                  "messageID": {
                    "type": "string",
                    "pattern": "^msg_.*"
                  },
                  "agent": {
                    "type": "string"
                  },
                  "model": {
                    "type": "string"
                  },
                  "arguments": {
                    "type": "string"
                  },
                  "command": {
                    "type": "string"
                  },
                  "variant": {
                    "type": "string"
                  },
                  "parts": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/FilePartInput"
                    }
                  }
                },
                "required": [
                  "arguments",
                  "command"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.command({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/shell_async": {
      "post": {
        "operationId": "session.shell_async",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "executionTimeoutMs",
            "schema": {
              "type": "integer",
              "minimum": 1000,
              "maximum": 259200000
            }
          },
          {
            "in": "query",
            "name": "sourceTaskID",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "resumeOnRestart",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "followup",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "summary": "Run async shell command",
        "description": "Queue a shell command for a session and return immediately after it is accepted.",
        "responses": {
          "202": {
            "description": "Shell command accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^tsk_.*"
                    },
                    "projectID": {
                      "type": "string"
                    },
                    "directory": {
                      "type": "string"
                    },
                    "sessionID": {
                      "type": "string",
                      "pattern": "^ses_.*"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "prompt",
                        "command",
                        "shell",
                        "followup",
                        "subagent",
                        "automation"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "waiting_for_idle",
                        "running",
                        "blocked_permission",
                        "blocked_question",
                        "paused",
                        "failed",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "priority": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "position": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "title": {
                      "type": "string"
                    },
                    "agent": {
                      "type": "string"
                    },
                    "model": {},
                    "sourceMessageID": {
                      "type": "string"
                    },
                    "sourceTaskID": {
                      "type": "string"
                    },
                    "payload": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "error": {
                      "type": "string"
                    },
                    "executionTimeoutMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 259200000
                    },
                    "time": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "updated": {
                          "type": "number"
                        },
                        "started": {
                          "type": "number"
                        },
                        "completed": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "created"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "projectID",
                    "directory",
                    "kind",
                    "status",
                    "priority",
                    "position",
                    "title",
                    "payload",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "messageID": {
                    "type": "string",
                    "pattern": "^msg_.*"
                  },
                  "agent": {
                    "type": "string"
                  },
                  "model": {
                    "type": "object",
                    "properties": {
                      "providerID": {
                        "type": "string"
                      },
                      "modelID": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "providerID",
                      "modelID"
                    ]
                  },
                  "command": {
                    "type": "string"
                  }
                },
                "required": [
                  "agent",
                  "command"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.shell_async({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/shell": {
      "post": {
        "operationId": "session.shell",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Run shell command",
        "description": "Execute a shell command within the session context and return the AI's response.",
        "responses": {
          "200": {
            "description": "Created message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantMessage"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "messageID": {
                    "type": "string",
                    "pattern": "^msg_.*"
                  },
                  "agent": {
                    "type": "string"
                  },
                  "model": {
                    "type": "object",
                    "properties": {
                      "providerID": {
                        "type": "string"
                      },
                      "modelID": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "providerID",
                      "modelID"
                    ]
                  },
                  "command": {
                    "type": "string"
                  }
                },
                "required": [
                  "agent",
                  "command"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.shell({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/revert": {
      "post": {
        "operationId": "session.revert",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Revert message",
        "description": "Revert a specific message in a session, undoing its effects and restoring the previous state.",
        "responses": {
          "200": {
            "description": "Updated session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "messageID": {
                    "type": "string",
                    "pattern": "^msg_.*"
                  },
                  "partID": {
                    "type": "string",
                    "pattern": "^prt_.*"
                  }
                },
                "required": [
                  "messageID"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.revert({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/unrevert": {
      "post": {
        "operationId": "session.unrevert",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Restore reverted messages",
        "description": "Restore all previously reverted messages in a session.",
        "responses": {
          "200": {
            "description": "Updated session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.session.unrevert({\n  ...\n})"
          }
        ]
      }
    },
    "/session/{sessionID}/permissions/{permissionID}": {
      "post": {
        "operationId": "permission.respond",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "permissionID",
            "schema": {
              "type": "string",
              "pattern": "^per_.*"
            },
            "required": true
          }
        ],
        "summary": "Respond to permission",
        "deprecated": true,
        "description": "Approve or deny a permission request from the AI assistant.",
        "responses": {
          "200": {
            "description": "Permission processed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "response": {
                    "type": "string",
                    "enum": [
                      "once",
                      "always",
                      "reject"
                    ]
                  }
                },
                "required": [
                  "response"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.permission.respond({\n  ...\n})"
          }
        ]
      }
    },
    "/permission/{requestID}/webmcp-allowlist": {
      "post": {
        "operationId": "permission.saveWebMcpApproval",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "requestID",
            "schema": {
              "type": "string",
              "pattern": "^per_.*"
            },
            "required": true
          }
        ],
        "summary": "Save a WebMCP approval and allow the pending operation",
        "responses": {
          "200": {
            "description": "Approval saved",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.permission.saveWebMcpApproval({\n  ...\n})"
          }
        ]
      }
    },
    "/permission/{requestID}/reply": {
      "post": {
        "operationId": "permission.reply",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "requestID",
            "schema": {
              "type": "string",
              "pattern": "^per_.*"
            },
            "required": true
          }
        ],
        "summary": "Respond to permission request",
        "description": "Approve or deny a permission request from the AI assistant.",
        "responses": {
          "200": {
            "description": "Permission processed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reply": {
                    "type": "string",
                    "enum": [
                      "once",
                      "always",
                      "reject"
                    ]
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "reply"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.permission.reply({\n  ...\n})"
          }
        ]
      }
    },
    "/permission": {
      "get": {
        "operationId": "permission.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "List pending permissions",
        "description": "Get all pending permission requests across all sessions.",
        "responses": {
          "200": {
            "description": "List of pending permissions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PermissionRequest"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.permission.list({\n  ...\n})"
          }
        ]
      }
    },
    "/audit/export/{sessionID}": {
      "get": {
        "operationId": "audit.export",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          }
        ],
        "summary": "Export audit events",
        "description": "Export all audit events for a session as JSON Lines.",
        "responses": {
          "200": {
            "description": "JSON audit export envelope"
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.audit.export({\n  ...\n})"
          }
        ]
      }
    },
    "/audit/export": {
      "get": {
        "operationId": "audit.exportAll",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "in": "query",
            "name": "since",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          {
            "in": "query",
            "name": "risk",
            "schema": {
              "type": "string",
              "enum": [
                "LOW",
                "MEDIUM",
                "HIGH",
                "CRITICAL"
              ]
            },
            "description": "Filter sessions by minimum risk level"
          },
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string"
            },
            "description": "Filter by event type (e.g. tool.call, agent.route)"
          }
        ],
        "summary": "Export all audit events",
        "description": "Export all audit events for the current project, optionally filtered by date.",
        "responses": {
          "200": {
            "description": "JSON audit export envelope"
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.audit.exportAll({\n  ...\n})"
          }
        ]
      }
    },
    "/audit/replay/{sessionID}": {
      "get": {
        "operationId": "audit.replay",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "fromStep",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "summary": "Reconstruct replay",
        "description": "Reconstruct session replay steps from recorded events.",
        "responses": {
          "200": {
            "description": "Reconstructed replay steps"
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.audit.replay({\n  ...\n})"
          }
        ]
      }
    },
    "/graph/{sessionID}/topology": {
      "get": {
        "operationId": "graph.topology",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          }
        ],
        "summary": "Get execution graph topology",
        "description": "Return the structured topology view for a session execution graph.",
        "responses": {
          "200": {
            "description": "Execution graph topology",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionGraphTopologyResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.graph.topology({\n  ...\n})"
          }
        ]
      }
    },
    "/graph/{sessionID}": {
      "get": {
        "operationId": "graph.get",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "format",
            "schema": {
              "default": "json",
              "type": "string",
              "enum": [
                "ascii",
                "json",
                "mermaid",
                "gantt",
                "svggantt",
                "markdown",
                "timeline",
                "topology"
              ]
            }
          }
        ],
        "summary": "Get execution graph",
        "description": "Build and return the execution graph for a session.",
        "responses": {
          "200": {
            "description": "Execution graph",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionGraphResponse"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.graph.get({\n  ...\n})"
          }
        ]
      }
    },
    "/run-report/session/{sessionID}": {
      "get": {
        "operationId": "getRun-reportSession:sessionID",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string",
              "maxLength": 1024
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "quality",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {}
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.getRun-reportSession:sessionID({\n  ...\n})"
          }
        ]
      }
    },
    "/run-report/session/{sessionID}/fingerprint": {
      "get": {
        "operationId": "getRun-reportSession:sessionIDFingerprint",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string",
              "maxLength": 1024
            }
          },
          {
            "in": "path",
            "name": "sessionID",
            "schema": {
              "type": "string",
              "pattern": "^ses_.*"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "quality",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {}
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.getRun-reportSession:sessionIDFingerprint({\n  ...\n})"
          }
        ]
      }
    },
    "/question": {
      "get": {
        "operationId": "question.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "List pending questions",
        "description": "Get all pending question requests across all sessions.",
        "responses": {
          "200": {
            "description": "List of pending questions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/QuestionRequest"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.question.list({\n  ...\n})"
          }
        ]
      }
    },
    "/question/{requestID}/reply": {
      "post": {
        "operationId": "question.reply",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "requestID",
            "schema": {
              "type": "string",
              "pattern": "^que_.*"
            },
            "required": true
          }
        ],
        "summary": "Reply to question request",
        "description": "Provide answers to a question request from the AI assistant.",
        "responses": {
          "200": {
            "description": "Question answered successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "answers": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/QuestionAnswer"
                    },
                    "description": "User answers in order of questions (each answer is an array of selected labels)"
                  }
                },
                "required": [
                  "answers"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.question.reply({\n  ...\n})"
          }
        ]
      }
    },
    "/question/{requestID}/reject": {
      "post": {
        "operationId": "question.reject",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "requestID",
            "schema": {
              "type": "string",
              "pattern": "^que_.*"
            },
            "required": true
          }
        ],
        "summary": "Reject question request",
        "description": "Reject a question request from the AI assistant.",
        "responses": {
          "200": {
            "description": "Question rejected successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.question.reject({\n  ...\n})"
          }
        ]
      }
    },
    "/provider": {
      "get": {
        "operationId": "provider.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "List providers",
        "description": "Get a list of all available AI providers, including both available and connected ones.",
        "responses": {
          "200": {
            "description": "List of providers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "all": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "api": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "env": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "id": {
                            "type": "string"
                          },
                          "npm": {
                            "type": "string"
                          },
                          "options": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          "models": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "family": {
                                  "type": "string"
                                },
                                "release_date": {
                                  "type": "string"
                                },
                                "attachment": {
                                  "type": "boolean"
                                },
                                "reasoning": {
                                  "type": "boolean"
                                },
                                "temperature": {
                                  "default": false,
                                  "type": "boolean"
                                },
                                "tool_call": {
                                  "type": "boolean"
                                },
                                "interleaved": {
                                  "anyOf": [
                                    {
                                      "type": "boolean",
                                      "const": true
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "field": {
                                          "type": "string",
                                          "enum": [
                                            "reasoning_content",
                                            "reasoning_details"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "field"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                },
                                "limit": {
                                  "type": "object",
                                  "properties": {
                                    "context": {
                                      "type": "number"
                                    },
                                    "input": {
                                      "type": "number"
                                    },
                                    "output": {
                                      "type": "number"
                                    }
                                  },
                                  "required": [
                                    "context",
                                    "output"
                                  ]
                                },
                                "modalities": {
                                  "type": "object",
                                  "properties": {
                                    "input": {
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "enum": [
                                          "text",
                                          "audio",
                                          "image",
                                          "video",
                                          "pdf"
                                        ]
                                      }
                                    },
                                    "output": {
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "enum": [
                                          "text",
                                          "audio",
                                          "image",
                                          "video",
                                          "pdf"
                                        ]
                                      }
                                    }
                                  },
                                  "required": [
                                    "input",
                                    "output"
                                  ]
                                },
                                "experimental": {
                                  "anyOf": [
                                    {
                                      "type": "boolean"
                                    },
                                    {
                                      "type": "object",
                                      "propertyNames": {
                                        "type": "string"
                                      },
                                      "additionalProperties": {}
                                    }
                                  ]
                                },
                                "status": {
                                  "type": "string",
                                  "enum": [
                                    "alpha",
                                    "beta",
                                    "deprecated",
                                    "active"
                                  ]
                                },
                                "options": {
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string"
                                  },
                                  "additionalProperties": {}
                                },
                                "headers": {
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string"
                                  },
                                  "additionalProperties": {
                                    "type": "string"
                                  }
                                },
                                "provider": {
                                  "type": "object",
                                  "properties": {
                                    "npm": {
                                      "type": "string"
                                    },
                                    "api": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "variants": {
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string"
                                  },
                                  "additionalProperties": {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {}
                                  }
                                }
                              },
                              "required": [
                                "id",
                                "name",
                                "release_date",
                                "attachment",
                                "reasoning",
                                "tool_call",
                                "limit"
                              ]
                            }
                          }
                        },
                        "required": [
                          "name",
                          "env",
                          "id",
                          "models"
                        ]
                      }
                    },
                    "default": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "connected": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "all",
                    "default",
                    "connected"
                  ]
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.list({\n  ...\n})"
          }
        ]
      }
    },
    "/provider/custom": {
      "get": {
        "operationId": "provider.custom.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "List managed custom API providers",
        "description": "List custom API providers without returning stored API tokens.",
        "responses": {
          "200": {
            "description": "Managed custom API providers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "management": {
                        "type": "string",
                        "enum": [
                          "custom-api",
                          "ax-trust"
                        ]
                      },
                      "providerID": {
                        "type": "string",
                        "pattern": "^[a-z0-9][a-z0-9._-]{0,62}$"
                      },
                      "name": {
                        "type": "string"
                      },
                      "protocol": {
                        "type": "string",
                        "enum": [
                          "openai-compatible",
                          "anthropic-compatible"
                        ]
                      },
                      "baseURL": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2048
                      },
                      "hasApiKey": {
                        "type": "boolean"
                      },
                      "models": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 256
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "contextWindow": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "outputLimit": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "toolCall": {
                              "type": "boolean"
                            },
                            "reasoning": {
                              "type": "boolean"
                            },
                            "attachment": {
                              "type": "boolean"
                            },
                            "temperature": {
                              "type": "boolean"
                            },
                            "websearch": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "id",
                            "contextWindow",
                            "outputLimit",
                            "toolCall",
                            "reasoning",
                            "attachment",
                            "temperature"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "providerID",
                      "name",
                      "protocol",
                      "baseURL",
                      "hasApiKey",
                      "models"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.custom.list({\n  ...\n})"
          }
        ]
      }
    },
    "/provider/custom/{providerID}": {
      "put": {
        "operationId": "provider.custom.update",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "providerID",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9._-]{0,62}$"
            },
            "required": true
          }
        ],
        "summary": "Create or update a managed custom API provider",
        "description": "Persist endpoint and model metadata in global config and store an optional API token in encrypted auth storage.",
        "responses": {
          "200": {
            "description": "Saved custom API provider",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "management": {
                      "type": "string",
                      "enum": [
                        "custom-api",
                        "ax-trust"
                      ]
                    },
                    "providerID": {
                      "type": "string",
                      "pattern": "^[a-z0-9][a-z0-9._-]{0,62}$"
                    },
                    "name": {
                      "type": "string"
                    },
                    "protocol": {
                      "type": "string",
                      "enum": [
                        "openai-compatible",
                        "anthropic-compatible"
                      ]
                    },
                    "baseURL": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2048
                    },
                    "hasApiKey": {
                      "type": "boolean"
                    },
                    "models": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 256
                          },
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "contextWindow": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "outputLimit": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "toolCall": {
                            "type": "boolean"
                          },
                          "reasoning": {
                            "type": "boolean"
                          },
                          "attachment": {
                            "type": "boolean"
                          },
                          "temperature": {
                            "type": "boolean"
                          },
                          "websearch": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "contextWindow",
                          "outputLimit",
                          "toolCall",
                          "reasoning",
                          "attachment",
                          "temperature"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "providerID",
                    "name",
                    "protocol",
                    "baseURL",
                    "hasApiKey",
                    "models"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "management": {
                    "type": "string",
                    "enum": [
                      "custom-api",
                      "ax-trust"
                    ]
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "protocol": {
                    "type": "string",
                    "enum": [
                      "openai-compatible",
                      "anthropic-compatible"
                    ]
                  },
                  "baseURL": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048
                  },
                  "apiKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 16384
                  },
                  "allowInsecureHttp": {
                    "default": false,
                    "type": "boolean"
                  },
                  "models": {
                    "maxItems": 128,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 256
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "contextWindow": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "outputLimit": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "toolCall": {
                          "type": "boolean"
                        },
                        "reasoning": {
                          "type": "boolean"
                        },
                        "attachment": {
                          "type": "boolean"
                        },
                        "temperature": {
                          "type": "boolean"
                        },
                        "websearch": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "id",
                        "contextWindow",
                        "outputLimit",
                        "toolCall",
                        "reasoning",
                        "attachment",
                        "temperature"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "refreshModels": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name",
                  "protocol",
                  "baseURL"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.custom.update({\n  ...\n})"
          }
        ]
      },
      "delete": {
        "operationId": "provider.custom.delete",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "providerID",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9._-]{0,62}$"
            },
            "required": true
          }
        ],
        "summary": "Delete a managed custom API provider",
        "description": "Remove the managed provider metadata and its encrypted API token.",
        "responses": {
          "200": {
            "description": "Whether the provider was removed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.custom.delete({\n  ...\n})"
          }
        ]
      }
    },
    "/provider/private-gpu/connection": {
      "put": {
        "operationId": "provider.privateGpu.connectionUpdate",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Connect a dedicated private GPU endpoint",
        "description": "Validate a dedicated GPU vendor URL and token, persist credentials, and discover model IDs from GET /models.",
        "responses": {
          "200": {
            "description": "Connected private GPU endpoint",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "providerID": {
                      "type": "string"
                    },
                    "baseURL": {
                      "type": "string"
                    },
                    "models": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "providerID",
                    "baseURL",
                    "models"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "providerID": {
                    "type": "string"
                  },
                  "baseURL": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048
                  },
                  "apiKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 16384
                  }
                },
                "required": [
                  "providerID",
                  "baseURL",
                  "apiKey"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.privateGpu.connectionUpdate({\n  ...\n})"
          }
        ]
      }
    },
    "/provider/alibaba-pai/connection": {
      "put": {
        "operationId": "provider.alibabaPai.connectionUpdate",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Connect Alibaba PAI-EAS",
        "description": "Compatibility alias for PUT /provider/private-gpu/connection with providerID=alibaba-pai.",
        "responses": {
          "200": {
            "description": "Connected PAI-EAS endpoint",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "baseURL": {
                      "type": "string"
                    },
                    "models": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "baseURL",
                    "models"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "baseURL": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048
                  },
                  "apiKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 16384
                  }
                },
                "required": [
                  "baseURL",
                  "apiKey"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.alibabaPai.connectionUpdate({\n  ...\n})"
          }
        ]
      }
    },
    "/provider/ax-engine/connection": {
      "get": {
        "operationId": "provider.axEngine.connection",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get AX Engine connection",
        "description": "Inspect whether AX Code manages a local server or attaches to an existing local AX Engine.",
        "responses": {
          "200": {
            "description": "AX Engine connection status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "mode": {
                      "type": "string",
                      "enum": [
                        "managed",
                        "attach"
                      ]
                    },
                    "baseURL": {
                      "type": "string"
                    },
                    "ready": {
                      "type": "boolean"
                    },
                    "models": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "toolcall": {
                      "type": "boolean"
                    },
                    "hasApiKey": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "mode",
                    "baseURL",
                    "ready",
                    "models",
                    "toolcall",
                    "hasApiKey"
                  ]
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.axEngine.connection({\n  ...\n})"
          }
        ]
      },
      "put": {
        "operationId": "provider.axEngine.connectionUpdate",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Configure AX Engine connection",
        "description": "Select managed lifecycle or validate and attach to an existing local AX Engine. Attach credentials are stored in encrypted auth storage. Concurrent connection updates in this server return a retryable 409 conflict.",
        "responses": {
          "200": {
            "description": "Updated AX Engine connection",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "mode": {
                      "type": "string",
                      "enum": [
                        "managed",
                        "attach"
                      ]
                    },
                    "baseURL": {
                      "type": "string"
                    },
                    "ready": {
                      "type": "boolean"
                    },
                    "models": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "toolcall": {
                      "type": "boolean"
                    },
                    "hasApiKey": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "mode",
                    "baseURL",
                    "ready",
                    "models",
                    "toolcall",
                    "hasApiKey"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "mode": {
                        "type": "string",
                        "const": "managed"
                      }
                    },
                    "required": [
                      "mode"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "mode": {
                        "type": "string",
                        "const": "attach"
                      },
                      "baseURL": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2048
                      },
                      "apiKey": {
                        "type": "string",
                        "maxLength": 16384
                      }
                    },
                    "required": [
                      "mode",
                      "baseURL"
                    ]
                  }
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.axEngine.connectionUpdate({\n  ...\n})"
          }
        ]
      }
    },
    "/provider/ax-engine/models": {
      "get": {
        "operationId": "provider.axEngine.models",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "refresh",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "summary": "List ax-engine local models",
        "description": "List supported AX Engine local models with automatic MTP/Direct runtime selection, host readiness, and cache status.",
        "responses": {
          "200": {
            "description": "ax-engine model catalog",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.axEngine.models({\n  ...\n})"
          }
        ]
      }
    },
    "/provider/ax-engine/models/{modelID}/download": {
      "post": {
        "operationId": "provider.axEngine.model.download",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "modelID",
            "required": true
          }
        ],
        "summary": "Download ax-engine local model",
        "description": "Start a server-side download job using the model catalog's preferred Direct or MTP package.",
        "responses": {
          "200": {
            "description": "Download job",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "default": {},
                "type": "object",
                "properties": {
                  "quantization": {
                    "type": "string",
                    "enum": [
                      "mlx6bit",
                      "mlx"
                    ]
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.axEngine.model.download({\n  ...\n})"
          }
        ]
      }
    },
    "/provider/ax-engine/downloads": {
      "get": {
        "operationId": "provider.axEngine.downloads",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "List ax-engine model download jobs",
        "responses": {
          "200": {
            "description": "Download jobs",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.axEngine.downloads({\n  ...\n})"
          }
        ]
      }
    },
    "/provider/ax-engine/downloads/{jobID}/cancel": {
      "post": {
        "operationId": "provider.axEngine.download.cancel",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "jobID",
            "required": true
          }
        ],
        "summary": "Cancel ax-engine model download job",
        "responses": {
          "200": {
            "description": "Cancelled job",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.axEngine.download.cancel({\n  ...\n})"
          }
        ]
      }
    },
    "/provider/ax-engine/models/{modelID}": {
      "delete": {
        "operationId": "provider.axEngine.model.delete",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "modelID",
            "required": true
          }
        ],
        "summary": "Delete ax-engine local model",
        "description": "Delete the server-resolved local copy for a supported AX Engine model.",
        "responses": {
          "200": {
            "description": "Delete result",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "default": {},
                "type": "object",
                "properties": {
                  "quantization": {
                    "type": "string",
                    "enum": [
                      "mlx6bit",
                      "mlx"
                    ]
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.axEngine.model.delete({\n  ...\n})"
          }
        ]
      }
    },
    "/provider/ax-engine/status": {
      "get": {
        "operationId": "provider.axEngine.status",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get ax-engine local provider status",
        "description": "Inspect host eligibility, dependency, model cache, server, and capability state for ax-engine.",
        "responses": {
          "200": {
            "description": "ax-engine status",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.axEngine.status({\n  ...\n})"
          }
        ]
      }
    },
    "/provider/ax-engine/install": {
      "post": {
        "operationId": "provider.axEngine.install",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Install a configured self-contained ax-engine binary",
        "description": "Download and verify the pinned self-contained AX Engine archive. Darwin-arm64 AX Code releases already include this sidecar; this route is the overlay/updater and recovery path.",
        "responses": {
          "200": {
            "description": "Install result",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.axEngine.install({\n  ...\n})"
          }
        ]
      }
    },
    "/provider/ax-engine/prepare": {
      "post": {
        "operationId": "provider.axEngine.prepare",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Prepare ax-engine local provider",
        "description": "Mark an existing MLX model path as prepared or explicitly download one through ax-engine.",
        "responses": {
          "200": {
            "description": "Preparation result",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "modelPath": {
                    "type": "string"
                  },
                  "binaryPath": {
                    "type": "string"
                  },
                  "mtpPolicy": {
                    "type": "string",
                    "enum": [
                      "disabled",
                      "auto",
                      "required"
                    ]
                  },
                  "modelID": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "tiel-coder-35b-axq-mxfp4",
                          "cyber-tiel-coder-35b-axq-mxfp4",
                          "qwen3.8-27b-axq-6bit",
                          "ornith-35b-axq-6bit",
                          "qwen3-coder-next-axq-6bit"
                        ]
                      },
                      {
                        "type": "string",
                        "pattern": "^AutomatosX\\/[a-zA-Z0-9][a-zA-Z0-9._-]{0,95}@[a-f0-9]{40}$"
                      }
                    ]
                  },
                  "quantization": {
                    "type": "string",
                    "enum": [
                      "mlx6bit",
                      "mlx"
                    ]
                  },
                  "download": {
                    "type": "boolean"
                  },
                  "start": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.axEngine.prepare({\n  ...\n})"
          }
        ]
      }
    },
    "/provider/ax-engine/start": {
      "post": {
        "operationId": "provider.axEngine.start",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Start managed ax-engine server",
        "description": "Start ax-engine for an already prepared or explicitly provided MLX model.",
        "responses": {
          "200": {
            "description": "Start result",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "modelPath": {
                    "type": "string"
                  },
                  "binaryPath": {
                    "type": "string"
                  },
                  "mtpPolicy": {
                    "type": "string",
                    "enum": [
                      "disabled",
                      "auto",
                      "required"
                    ]
                  },
                  "modelID": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "tiel-coder-35b-axq-mxfp4",
                          "cyber-tiel-coder-35b-axq-mxfp4",
                          "qwen3.8-27b-axq-6bit",
                          "ornith-35b-axq-6bit",
                          "qwen3-coder-next-axq-6bit"
                        ]
                      },
                      {
                        "type": "string",
                        "pattern": "^AutomatosX\\/[a-zA-Z0-9][a-zA-Z0-9._-]{0,95}@[a-f0-9]{40}$"
                      }
                    ]
                  },
                  "quantization": {
                    "type": "string",
                    "enum": [
                      "mlx6bit",
                      "mlx"
                    ]
                  },
                  "download": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.axEngine.start({\n  ...\n})"
          }
        ]
      }
    },
    "/provider/ax-engine/stop": {
      "post": {
        "operationId": "provider.axEngine.stop",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Stop managed ax-engine server",
        "responses": {
          "200": {
            "description": "Stopped",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.axEngine.stop({\n  ...\n})"
          }
        ]
      }
    },
    "/provider/auth": {
      "get": {
        "operationId": "provider.auth",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get provider auth methods",
        "description": "Retrieve available authentication methods for all AI providers.",
        "responses": {
          "200": {
            "description": "Provider auth methods",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/ProviderAuthMethod"
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.auth({\n  ...\n})"
          }
        ]
      }
    },
    "/provider/{providerID}/oauth/authorize": {
      "post": {
        "operationId": "provider.oauth.authorize",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "providerID",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Provider ID"
          }
        ],
        "summary": "OAuth authorize",
        "description": "Initiate OAuth authorization for a specific AI provider to get an authorization URL.",
        "responses": {
          "200": {
            "description": "Authorization URL and method",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderAuthAuthorization"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "method": {
                    "description": "Auth method index",
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "inputs": {
                    "description": "Prompt inputs",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "method"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.oauth.authorize({\n  ...\n})"
          }
        ]
      }
    },
    "/provider/{providerID}/oauth/callback": {
      "post": {
        "operationId": "provider.oauth.callback",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "providerID",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Provider ID"
          }
        ],
        "summary": "OAuth callback",
        "description": "Handle the OAuth callback from a provider after user authorization.",
        "responses": {
          "200": {
            "description": "OAuth callback processed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "method": {
                    "description": "Auth method index",
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "code": {
                    "description": "OAuth authorization code",
                    "type": "string"
                  }
                },
                "required": [
                  "method"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.provider.oauth.callback({\n  ...\n})"
          }
        ]
      }
    },
    "/find": {
      "get": {
        "operationId": "find.text",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "pattern",
            "schema": {
              "type": "string",
              "maxLength": 1024
            },
            "required": true
          }
        ],
        "summary": "Find text",
        "description": "Search for text patterns across files in the project using ripgrep.",
        "responses": {
          "200": {
            "description": "Matches",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "path": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "text"
                        ]
                      },
                      "lines": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "text"
                        ]
                      },
                      "line_number": {
                        "type": "number"
                      },
                      "absolute_offset": {
                        "type": "number"
                      },
                      "submatches": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "match": {
                              "type": "object",
                              "properties": {
                                "text": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "text"
                              ]
                            },
                            "start": {
                              "type": "number"
                            },
                            "end": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "match",
                            "start",
                            "end"
                          ]
                        }
                      }
                    },
                    "required": [
                      "path",
                      "lines",
                      "line_number",
                      "absolute_offset",
                      "submatches"
                    ]
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.find.text({\n  ...\n})"
          }
        ]
      }
    },
    "/find/file": {
      "get": {
        "operationId": "find.files",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "query",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "dirs",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string",
              "enum": [
                "file",
                "directory"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "summary": "Find files",
        "description": "Search for files or directories by name or pattern in the project directory.",
        "responses": {
          "200": {
            "description": "File paths",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.find.files({\n  ...\n})"
          }
        ]
      }
    },
    "/find/symbol": {
      "get": {
        "operationId": "find.symbols",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "query",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "summary": "Find symbols",
        "description": "Search for workspace symbols like functions, classes, and variables using LSP.",
        "responses": {
          "200": {
            "description": "Symbols",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Symbol"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.find.symbols({\n  ...\n})"
          }
        ]
      }
    },
    "/file": {
      "get": {
        "operationId": "file.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "path",
            "schema": {
              "type": "string",
              "maxLength": 4096
            },
            "required": true
          }
        ],
        "summary": "List files",
        "description": "List files and directories in a specified path.",
        "responses": {
          "200": {
            "description": "Files and directories",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/FileNode"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.file.list({\n  ...\n})"
          }
        ]
      }
    },
    "/file/content": {
      "get": {
        "operationId": "file.read",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "path",
            "schema": {
              "type": "string",
              "maxLength": 4096
            },
            "required": true
          }
        ],
        "summary": "Read file",
        "description": "Read the content of a specified file.",
        "responses": {
          "200": {
            "description": "File content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileContent"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.file.read({\n  ...\n})"
          }
        ]
      }
    },
    "/file/status": {
      "get": {
        "operationId": "file.status",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get file status",
        "description": "Get the git status of all files in the project.",
        "responses": {
          "200": {
            "description": "File status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/File"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.file.status({\n  ...\n})"
          }
        ]
      }
    },
    "/event": {
      "get": {
        "operationId": "event.subscribe",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Subscribe to events",
        "description": "Get events",
        "responses": {
          "200": {
            "description": "Event stream",
            "content": {
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/Event"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.event.subscribe({\n  ...\n})"
          }
        ]
      }
    },
    "/mcp/{name}/webmcp-chrome": {
      "get": {
        "operationId": "mcp.webMcpChrome",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            "required": true
          }
        ],
        "summary": "Check the Chrome a WebMCP bridge would launch",
        "description": "Read-only: runs `--version` on an explicit or well-known Chrome executable and never starts a browser. Advisory only; the launch preflight stays authoritative.",
        "responses": {
          "200": {
            "description": "Chrome availability",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "string",
                          "const": "ready"
                        },
                        "major": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "executable": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "state",
                        "executable"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "string",
                          "const": "outdated"
                        },
                        "major": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "minimum": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "state",
                        "major",
                        "minimum"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "string",
                          "const": "missing"
                        },
                        "minimum": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "state",
                        "minimum"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "string",
                          "const": "unreadable"
                        },
                        "executable": {
                          "type": "string"
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "state",
                        "executable",
                        "reason"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.mcp.webMcpChrome({\n  ...\n})"
          }
        ]
      }
    },
    "/mcp/{name}/webmcp-approvals": {
      "get": {
        "operationId": "mcp.webMcpApprovals",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            "required": true
          }
        ],
        "summary": "List saved WebMCP approvals for this project",
        "responses": {
          "200": {
            "description": "Saved approvals",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebMcpApprovalRecord"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.mcp.webMcpApprovals({\n  ...\n})"
          }
        ]
      },
      "delete": {
        "operationId": "mcp.revokeWebMcpApproval",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "id",
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          }
        ],
        "summary": "Revoke saved WebMCP approvals for this project",
        "responses": {
          "200": {
            "description": "Approvals revoked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.mcp.revokeWebMcpApproval({\n  ...\n})"
          }
        ]
      },
      "post": {
        "operationId": "mcp.grantWebMcpApproval",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            "required": true
          }
        ],
        "summary": "Save a WebMCP approval for this project without a pending request",
        "description": "Explicit user grant for a connected WebMCP bridge. The record binds to the live bridge identity and is rechecked at dispatch like a request-bound save.",
        "responses": {
          "200": {
            "description": "Approval saved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebMcpApprovalRecord"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "scope": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "capability": {
                            "type": "string",
                            "const": "list_pages"
                          }
                        },
                        "required": [
                          "capability"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "capability": {
                            "type": "string",
                            "const": "navigate"
                          },
                          "origin": {
                            "type": "string",
                            "maxLength": 2048
                          }
                        },
                        "required": [
                          "capability",
                          "origin"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "capability": {
                            "type": "string",
                            "const": "read"
                          },
                          "origin": {
                            "type": "string",
                            "maxLength": 2048
                          }
                        },
                        "required": [
                          "capability",
                          "origin"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "capability": {
                            "type": "string",
                            "const": "close"
                          },
                          "origin": {
                            "type": "string",
                            "maxLength": 2048
                          }
                        },
                        "required": [
                          "capability",
                          "origin"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": [
                  "scope"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.mcp.grantWebMcpApproval({\n  ...\n})"
          }
        ]
      }
    },
    "/mcp": {
      "get": {
        "operationId": "mcp.status",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get MCP status",
        "description": "Get the status of all Model Context Protocol (MCP) servers.",
        "responses": {
          "200": {
            "description": "MCP server status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "$ref": "#/components/schemas/MCPStatus"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.mcp.status({\n  ...\n})"
          }
        ]
      },
      "post": {
        "operationId": "mcp.add",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Add MCP server",
        "description": "Dynamically add a new Model Context Protocol (MCP) server to the system.",
        "responses": {
          "200": {
            "description": "MCP server added successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "$ref": "#/components/schemas/MCPStatus"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[a-zA-Z0-9_-]+$"
                  },
                  "config": {
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/McpLocalConfig"
                      },
                      {
                        "$ref": "#/components/schemas/McpRemoteConfig"
                      }
                    ],
                    "description": "MCP server config. Tools surface as permission keys `<server>_<tool>` — use the top-level `permission` map (with wildcards) to allow / deny them, or scope them per agent via `agent.<name>.permission`."
                  }
                },
                "required": [
                  "name",
                  "config"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.mcp.add({\n  ...\n})"
          }
        ]
      }
    },
    "/mcp/resources": {
      "get": {
        "operationId": "mcp.resources.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "List MCP resources",
        "description": "List available MCP resources from connected Model Context Protocol (MCP) servers.",
        "responses": {
          "200": {
            "description": "MCP resources",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "$ref": "#/components/schemas/McpResource"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.mcp.resources.list({\n  ...\n})"
          }
        ]
      }
    },
    "/mcp/{name}/resource": {
      "get": {
        "operationId": "mcp.resource.read",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "uri",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 8192
            },
            "required": true
          }
        ],
        "summary": "Read MCP resource",
        "description": "Read one MCP resource from a connected Model Context Protocol (MCP) server.",
        "responses": {
          "200": {
            "description": "MCP resource contents",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpReadResourceResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.mcp.resource.read({\n  ...\n})"
          }
        ]
      }
    },
    "/mcp/{name}/auth": {
      "post": {
        "operationId": "mcp.auth.start",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            "required": true
          }
        ],
        "summary": "Start MCP OAuth",
        "description": "Start OAuth authentication flow for a Model Context Protocol (MCP) server.",
        "responses": {
          "200": {
            "description": "OAuth flow started",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "authorizationUrl": {
                      "type": "string",
                      "description": "URL to open in browser for authorization"
                    }
                  },
                  "required": [
                    "authorizationUrl"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.mcp.auth.start({\n  ...\n})"
          }
        ]
      },
      "delete": {
        "operationId": "mcp.auth.remove",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            "required": true
          }
        ],
        "summary": "Remove MCP OAuth",
        "description": "Remove OAuth credentials for an MCP server",
        "responses": {
          "200": {
            "description": "OAuth credentials removed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "success"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.mcp.auth.remove({\n  ...\n})"
          }
        ]
      }
    },
    "/mcp/{name}/auth/callback": {
      "post": {
        "operationId": "mcp.auth.callback",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            "required": true
          }
        ],
        "summary": "Complete MCP OAuth",
        "description": "Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code.",
        "responses": {
          "200": {
            "description": "OAuth authentication completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPStatus"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "Authorization code from OAuth callback"
                  }
                },
                "required": [
                  "code"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.mcp.auth.callback({\n  ...\n})"
          }
        ]
      }
    },
    "/mcp/{name}/auth/authenticate": {
      "post": {
        "operationId": "mcp.auth.authenticate",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            "required": true
          }
        ],
        "summary": "Authenticate MCP OAuth",
        "description": "Start OAuth flow and wait for callback (opens browser)",
        "responses": {
          "200": {
            "description": "OAuth authentication completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPStatus"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.mcp.auth.authenticate({\n  ...\n})"
          }
        ]
      }
    },
    "/mcp/{name}/connect": {
      "post": {
        "operationId": "mcp.connect",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            "required": true
          }
        ],
        "description": "Connect an MCP server",
        "responses": {
          "200": {
            "description": "MCP server connected successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.mcp.connect({\n  ...\n})"
          }
        ]
      }
    },
    "/mcp/{name}/disconnect": {
      "post": {
        "operationId": "mcp.disconnect",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            "required": true
          }
        ],
        "description": "Disconnect an MCP server",
        "responses": {
          "200": {
            "description": "MCP server disconnected successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.mcp.disconnect({\n  ...\n})"
          }
        ]
      }
    },
    "/tui/append-prompt": {
      "post": {
        "operationId": "tui.appendPrompt",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Append TUI prompt",
        "description": "Append prompt to the TUI",
        "responses": {
          "200": {
            "description": "Prompt processed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "text"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.tui.appendPrompt({\n  ...\n})"
          }
        ]
      }
    },
    "/tui/open-help": {
      "post": {
        "operationId": "tui.openHelp",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Open help dialog",
        "description": "Open the help dialog in the TUI to display user assistance information.",
        "responses": {
          "200": {
            "description": "Help dialog opened successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.tui.openHelp({\n  ...\n})"
          }
        ]
      }
    },
    "/tui/open-sessions": {
      "post": {
        "operationId": "tui.openSessions",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Open sessions dialog",
        "description": "Open the session dialog",
        "responses": {
          "200": {
            "description": "Session dialog opened successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.tui.openSessions({\n  ...\n})"
          }
        ]
      }
    },
    "/tui/open-themes": {
      "post": {
        "operationId": "tui.openThemes",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Open themes dialog",
        "description": "Open the theme dialog",
        "responses": {
          "200": {
            "description": "Theme dialog opened successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.tui.openThemes({\n  ...\n})"
          }
        ]
      }
    },
    "/tui/open-models": {
      "post": {
        "operationId": "tui.openModels",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Open models dialog",
        "description": "Open the model dialog",
        "responses": {
          "200": {
            "description": "Model dialog opened successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.tui.openModels({\n  ...\n})"
          }
        ]
      }
    },
    "/tui/submit-prompt": {
      "post": {
        "operationId": "tui.submitPrompt",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Submit TUI prompt",
        "description": "Submit the prompt",
        "responses": {
          "200": {
            "description": "Prompt submitted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.tui.submitPrompt({\n  ...\n})"
          }
        ]
      }
    },
    "/tui/clear-prompt": {
      "post": {
        "operationId": "tui.clearPrompt",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Clear TUI prompt",
        "description": "Clear the prompt",
        "responses": {
          "200": {
            "description": "Prompt cleared successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.tui.clearPrompt({\n  ...\n})"
          }
        ]
      }
    },
    "/tui/execute-command": {
      "post": {
        "operationId": "tui.executeCommand",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Execute TUI command",
        "description": "Execute a TUI command (e.g. agent_cycle)",
        "responses": {
          "200": {
            "description": "Command executed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "command": {
                    "type": "string"
                  }
                },
                "required": [
                  "command"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.tui.executeCommand({\n  ...\n})"
          }
        ]
      }
    },
    "/tui/show-toast": {
      "post": {
        "operationId": "tui.showToast",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Show TUI toast",
        "description": "Show a toast notification in the TUI",
        "responses": {
          "200": {
            "description": "Toast notification shown successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "variant": {
                    "type": "string",
                    "enum": [
                      "info",
                      "success",
                      "warning",
                      "error"
                    ]
                  },
                  "duration": {
                    "description": "Duration in milliseconds",
                    "type": "number"
                  }
                },
                "required": [
                  "message",
                  "variant"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.tui.showToast({\n  ...\n})"
          }
        ]
      }
    },
    "/tui/publish": {
      "post": {
        "operationId": "tui.publish",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Publish TUI event",
        "description": "Publish a TUI event",
        "responses": {
          "200": {
            "description": "Event published successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/Event.tui.prompt.append"
                  },
                  {
                    "$ref": "#/components/schemas/Event.tui.command.execute"
                  },
                  {
                    "$ref": "#/components/schemas/Event.tui.toast.show"
                  },
                  {
                    "$ref": "#/components/schemas/Event.tui.session.select"
                  }
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.tui.publish({\n  ...\n})"
          }
        ]
      }
    },
    "/tui/select-session": {
      "post": {
        "operationId": "tui.selectSession",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Select session",
        "description": "Navigate the TUI to display the specified session.",
        "responses": {
          "200": {
            "description": "Session selected successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sessionID": {
                    "description": "Session ID to navigate to",
                    "type": "string",
                    "pattern": "^ses_.*"
                  }
                },
                "required": [
                  "sessionID"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.tui.selectSession({\n  ...\n})"
          }
        ]
      }
    },
    "/instance/dispose": {
      "post": {
        "operationId": "instance.dispose",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Dispose instance",
        "description": "Clean up and dispose the current ax-code instance, releasing all resources.",
        "responses": {
          "200": {
            "description": "Instance disposed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.instance.dispose({\n  ...\n})"
          }
        ]
      }
    },
    "/instance/restart": {
      "post": {
        "operationId": "instance.restart",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Restart instance",
        "description": "Dispose and reinitialize the ax-code instance, reloading all configuration and provider data.",
        "responses": {
          "200": {
            "description": "Instance restarted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.instance.restart({\n  ...\n})"
          }
        ]
      }
    },
    "/path": {
      "get": {
        "operationId": "path.get",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get paths",
        "description": "Retrieve the current working directory and related path information for the ax-code instance.",
        "responses": {
          "200": {
            "description": "Path",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Path"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.path.get({\n  ...\n})"
          }
        ]
      }
    },
    "/vcs": {
      "get": {
        "operationId": "vcs.get",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get VCS info",
        "description": "Retrieve version control system (VCS) information for the current project, such as git branch.",
        "responses": {
          "200": {
            "description": "VCS info",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VcsInfo"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.vcs.get({\n  ...\n})"
          }
        ]
      }
    },
    "/command": {
      "get": {
        "operationId": "command.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "List commands",
        "description": "Get a list of all available commands in the ax-code system.",
        "responses": {
          "200": {
            "description": "List of commands",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Command"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.command.list({\n  ...\n})"
          }
        ]
      }
    },
    "/capability": {
      "get": {
        "operationId": "capability.list",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "List capabilities",
        "description": "Get a unified catalog of reusable commands, skills, agents, and workflow templates.",
        "responses": {
          "200": {
            "description": "List of capabilities",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "instruction",
                          "command",
                          "skill",
                          "agent",
                          "workflow"
                        ]
                      },
                      "name": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "source": {
                        "type": "string"
                      },
                      "sourceTool": {
                        "type": "string"
                      },
                      "scope": {
                        "type": "string"
                      },
                      "location": {
                        "type": "string"
                      },
                      "warnings": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            },
                            "message": {
                              "type": "string"
                            },
                            "severity": {
                              "type": "string",
                              "enum": [
                                "info",
                                "warn",
                                "error"
                              ]
                            }
                          },
                          "required": [
                            "code",
                            "message",
                            "severity"
                          ]
                        }
                      },
                      "metadata": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "kind",
                      "name"
                    ]
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.capability.list({\n  ...\n})"
          }
        ]
      }
    },
    "/log": {
      "post": {
        "operationId": "app.log",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Write log",
        "description": "Write a log entry to the server logs with specified level and metadata.",
        "responses": {
          "200": {
            "description": "Log entry written successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "service": {
                    "type": "string",
                    "maxLength": 64,
                    "pattern": "^[a-zA-Z0-9._-]+$",
                    "description": "Service name for the log entry"
                  },
                  "level": {
                    "type": "string",
                    "enum": [
                      "debug",
                      "info",
                      "error",
                      "warn"
                    ],
                    "description": "Log level"
                  },
                  "message": {
                    "type": "string",
                    "maxLength": 10000,
                    "description": "Log message"
                  },
                  "extra": {
                    "description": "Additional metadata for the log entry",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "service",
                  "level",
                  "message"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.app.log({\n  ...\n})"
          }
        ]
      }
    },
    "/agent": {
      "get": {
        "operationId": "app.agents",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "List agents",
        "description": "Get a list of all available AI agents in the ax-code system.",
        "responses": {
          "200": {
            "description": "List of agents",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Agent"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.app.agents({\n  ...\n})"
          }
        ]
      }
    },
    "/context": {
      "get": {
        "operationId": "app.context",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get project context",
        "description": "Get instruction-file and cached-memory metadata for the current project context.",
        "responses": {
          "200": {
            "description": "Current project context information",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "directory": {
                      "type": "string"
                    },
                    "worktree": {
                      "type": "string"
                    },
                    "files": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "path": {
                            "type": "string"
                          },
                          "exists": {
                            "type": "boolean"
                          },
                          "scope": {
                            "type": "string",
                            "enum": [
                              "project",
                              "global"
                            ]
                          }
                        },
                        "required": [
                          "name",
                          "path",
                          "exists",
                          "scope"
                        ]
                      }
                    },
                    "instructions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "path": {
                            "type": "string"
                          },
                          "exists": {
                            "type": "boolean"
                          },
                          "scope": {
                            "type": "string",
                            "enum": [
                              "project",
                              "global"
                            ]
                          }
                        },
                        "required": [
                          "name",
                          "path",
                          "exists",
                          "scope"
                        ]
                      }
                    },
                    "templates": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string",
                            "enum": [
                              "repo-rules",
                              "dir-rules",
                              "review-checklist",
                              "frontend-style-guide",
                              "release-checklist"
                            ]
                          },
                          "title": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "path": {
                            "type": "string"
                          },
                          "exists": {
                            "type": "boolean"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "instruction",
                              "checklist"
                            ]
                          }
                        },
                        "required": [
                          "key",
                          "title",
                          "description",
                          "path",
                          "exists",
                          "kind"
                        ]
                      }
                    },
                    "checks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "command": {
                            "type": "string"
                          },
                          "cwd": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "root",
                              "directory"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "command",
                          "cwd",
                          "source"
                        ]
                      }
                    },
                    "memory": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "exists": {
                              "type": "boolean"
                            },
                            "totalTokens": {
                              "type": "number"
                            },
                            "lastUpdated": {
                              "type": "string"
                            },
                            "contentHash": {
                              "type": "string"
                            },
                            "sections": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "exists",
                            "totalTokens",
                            "lastUpdated",
                            "contentHash",
                            "sections"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "directory",
                    "worktree",
                    "files",
                    "instructions",
                    "templates",
                    "checks",
                    "memory"
                  ]
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.app.context({\n  ...\n})"
          }
        ]
      }
    },
    "/context/template": {
      "post": {
        "operationId": "app.contextTemplateCreate",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Create project context template",
        "description": "Create a recommended rules or checklist file for the current project context.",
        "responses": {
          "200": {
            "description": "Template file metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "enum": [
                        "repo-rules",
                        "dir-rules",
                        "review-checklist",
                        "frontend-style-guide",
                        "release-checklist"
                      ]
                    },
                    "title": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "path": {
                      "type": "string"
                    },
                    "exists": {
                      "type": "boolean"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "instruction",
                        "checklist"
                      ]
                    }
                  },
                  "required": [
                    "key",
                    "title",
                    "description",
                    "path",
                    "exists",
                    "kind"
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "enum": [
                      "repo-rules",
                      "dir-rules",
                      "review-checklist",
                      "frontend-style-guide",
                      "release-checklist"
                    ]
                  }
                },
                "required": [
                  "key"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.app.contextTemplateCreate({\n  ...\n})"
          }
        ]
      }
    },
    "/context/memory/warmup": {
      "post": {
        "operationId": "app.contextMemoryWarmup",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Refresh project memory",
        "description": "Generate and cache fresh project memory for the current context.",
        "responses": {
          "200": {
            "description": "Refreshed project memory metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "exists": {
                      "type": "boolean"
                    },
                    "totalTokens": {
                      "type": "number"
                    },
                    "lastUpdated": {
                      "type": "string"
                    },
                    "contentHash": {
                      "type": "string"
                    },
                    "sections": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "exists",
                    "totalTokens",
                    "lastUpdated",
                    "contentHash",
                    "sections"
                  ]
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.app.contextMemoryWarmup({\n  ...\n})"
          }
        ]
      }
    },
    "/context/memory": {
      "delete": {
        "operationId": "app.contextMemoryClear",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Clear project memory",
        "description": "Delete cached project memory for the current context.",
        "responses": {
          "200": {
            "description": "Whether cached memory was cleared",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.app.contextMemoryClear({\n  ...\n})"
          }
        ]
      }
    },
    "/skill": {
      "get": {
        "operationId": "app.skills",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "List skills",
        "description": "Get a list of all available skills in the ax-code system.",
        "responses": {
          "200": {
            "description": "List of skills",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "location": {
                        "type": "string"
                      },
                      "content": {
                        "type": "string"
                      },
                      "agent": {
                        "type": "string"
                      },
                      "paths": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "license": {
                        "type": "string"
                      },
                      "compatibility": {
                        "type": "string"
                      },
                      "metadata": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "type": "string"
                        }
                      },
                      "allowedTools": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "argumentHint": {
                        "type": "string"
                      },
                      "standardIssues": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "sourceTool": {
                        "type": "string",
                        "enum": [
                          "ax-code",
                          "agents",
                          "opencode",
                          "claude",
                          "builtin",
                          "config"
                        ]
                      },
                      "scope": {
                        "type": "string",
                        "enum": [
                          "builtin",
                          "project",
                          "user",
                          "config",
                          "compat"
                        ]
                      },
                      "builtin": {
                        "type": "boolean"
                      },
                      "modelInvocable": {
                        "type": "boolean"
                      },
                      "userInvocable": {
                        "type": "boolean"
                      },
                      "invocationIssues": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "name",
                      "description",
                      "location",
                      "content"
                    ]
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.app.skills({\n  ...\n})"
          }
        ]
      },
      "post": {
        "operationId": "skill.create",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Create skill",
        "description": "Create a local Agent Skill skeleton in the current worktree.",
        "responses": {
          "200": {
            "description": "Created skill",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "path"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1
                  },
                  "path": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "description"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.skill.create({\n  ...\n})"
          }
        ]
      }
    },
    "/skill/validate": {
      "get": {
        "operationId": "skill.validate",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Validate skills",
        "description": "Validate discovered skills against the Agent Skills standard.",
        "responses": {
          "200": {
            "description": "Skill validation report",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "valid": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "invalid": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "issues": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "location": {
                            "type": "string"
                          },
                          "issues": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "name",
                          "location",
                          "issues"
                        ]
                      }
                    }
                  },
                  "required": [
                    "total",
                    "valid",
                    "invalid",
                    "issues"
                  ]
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.skill.validate({\n  ...\n})"
          }
        ]
      }
    },
    "/skill/doctor": {
      "get": {
        "operationId": "skill.doctor",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Diagnose skills",
        "description": "Diagnose discovered skills, source breakdown, and compatibility metadata.",
        "responses": {
          "200": {
            "description": "Skill doctor report",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "valid": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "invalid": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "issues": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "location": {
                            "type": "string"
                          },
                          "issues": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "name",
                          "location",
                          "issues"
                        ]
                      }
                    },
                    "sources": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      }
                    }
                  },
                  "required": [
                    "total",
                    "valid",
                    "invalid",
                    "issues",
                    "sources"
                  ]
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.skill.doctor({\n  ...\n})"
          }
        ]
      }
    },
    "/skill/test-trigger": {
      "post": {
        "operationId": "skill.testTrigger",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Test skill triggers",
        "description": "Show which skills would be recommended for the given file paths.",
        "responses": {
          "200": {
            "description": "Skill trigger report",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "files": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "matched": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "location": {
                            "type": "string"
                          },
                          "sourceTool": {
                            "type": "string",
                            "enum": [
                              "ax-code",
                              "agents",
                              "opencode",
                              "claude",
                              "builtin",
                              "config"
                            ]
                          },
                          "scope": {
                            "type": "string",
                            "enum": [
                              "builtin",
                              "project",
                              "user",
                              "config",
                              "compat"
                            ]
                          }
                        },
                        "required": [
                          "name",
                          "description",
                          "location"
                        ]
                      }
                    }
                  },
                  "required": [
                    "files",
                    "matched"
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "files": {
                    "default": [],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.skill.testTrigger({\n  ...\n})"
          }
        ]
      }
    },
    "/lsp": {
      "get": {
        "operationId": "lsp.status",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get LSP status",
        "description": "Get LSP server status",
        "responses": {
          "200": {
            "description": "LSP server status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LSPStatus"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.lsp.status({\n  ...\n})"
          }
        ]
      }
    },
    "/debug-engine/pending-plans": {
      "get": {
        "operationId": "debugEngine.pendingPlans",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "DRE status and pending refactor plans",
        "description": "Return the current project's pending refactor plans plus DRE health information (graph node count, last-indexed timestamp, registered tool count). The TUI footer uses the plans count for its chip; the TUI sidebar uses the graph and tool fields to render the DRE section empty state so users can tell at a glance whether DRE is ready to use. Fields default to zero / null when the experimental DRE flag is off, so callers can poll unconditionally. The `graph` and `toolCount` fields were added in v2.3.6 - older clients ignore unknown fields and continue to work against the original `{ count, plans }` shape.",
        "responses": {
          "200": {
            "description": "DRE status + pending refactor plans",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": {
                      "type": "number"
                    },
                    "plans": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "planId": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "risk": {
                            "type": "string"
                          },
                          "summary": {
                            "type": "string"
                          },
                          "affectedFileCount": {
                            "type": "number"
                          },
                          "affectedSymbolCount": {
                            "type": "number"
                          },
                          "timeCreated": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "planId",
                          "kind",
                          "risk",
                          "summary",
                          "affectedFileCount",
                          "affectedSymbolCount",
                          "timeCreated"
                        ]
                      }
                    },
                    "toolCount": {
                      "type": "number"
                    },
                    "graph": {
                      "type": "object",
                      "properties": {
                        "nodeCount": {
                          "type": "number"
                        },
                        "edgeCount": {
                          "type": "number"
                        },
                        "lastIndexedAt": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "state": {
                          "anyOf": [
                            {
                              "type": "string",
                              "const": "idle"
                            },
                            {
                              "type": "string",
                              "const": "indexing"
                            },
                            {
                              "type": "string",
                              "const": "failed"
                            }
                          ]
                        },
                        "completed": {
                          "type": "number"
                        },
                        "total": {
                          "type": "number"
                        },
                        "error": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "nodeCount",
                        "edgeCount",
                        "lastIndexedAt",
                        "state",
                        "completed",
                        "total",
                        "error"
                      ]
                    }
                  },
                  "required": [
                    "count",
                    "plans",
                    "toolCount",
                    "graph"
                  ]
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.debugEngine.pendingPlans({\n  ...\n})"
          }
        ]
      }
    },
    "/formatter": {
      "get": {
        "operationId": "formatter.status",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get formatter status",
        "description": "Get formatter status",
        "responses": {
          "200": {
            "description": "Formatter status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/FormatterStatus"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.formatter.status({\n  ...\n})"
          }
        ]
      }
    },
    "/debug-engine/correlated-diagnostics": {
      "get": {
        "operationId": "debugEngine.correlatedDiagnostics",
        "parameters": [
          {
            "in": "query",
            "name": "directory",
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get correlated diagnostics for a file",
        "description": "Return DRE cross-file root-cause correlations for a given file. Each entry maps an LSP error to a possible root-cause location in another file, with a confidence level and a symbol chain linking the error back to its origin. Returns an empty array when the DRE flag is off or no correlations are cached.",
        "responses": {
          "200": {
            "description": "Correlated diagnostics",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "file": {
                        "type": "string"
                      },
                      "line": {
                        "type": "number"
                      },
                      "message": {
                        "type": "string"
                      },
                      "severity": {
                        "type": "number"
                      },
                      "rootCauseFile": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "rootCauseSymbol": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "rootCauseChain": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "confidence": {
                        "type": "string",
                        "enum": [
                          "high",
                          "medium",
                          "low"
                        ]
                      },
                      "lspTimestamp": {
                        "type": "number"
                      },
                      "lspServerIDs": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "graphQueryIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "graphIndexedAt": {
                        "type": "number"
                      },
                      "graphCompleteness": {
                        "type": "string",
                        "enum": [
                          "full",
                          "partial",
                          "lsp-only"
                        ]
                      }
                    },
                    "required": [
                      "file",
                      "line",
                      "message",
                      "severity",
                      "rootCauseFile",
                      "rootCauseSymbol",
                      "rootCauseChain",
                      "confidence",
                      "lspTimestamp",
                      "lspServerIDs",
                      "graphQueryIds",
                      "graphIndexedAt",
                      "graphCompleteness"
                    ]
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "js",
            "source": "import { createAxCodeClient } from \"@ax-code/sdk/v2\"\n\nconst client = createAxCodeClient()\nawait client.debugEngine.correlatedDiagnostics({\n  ...\n})"
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "APIError": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "const": "APIError"
          },
          "data": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "statusCode": {
                "type": "number"
              },
              "isRetryable": {
                "type": "boolean"
              },
              "responseHeaders": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              "responseBody": {
                "type": "string"
              },
              "metadata": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            },
            "required": [
              "message",
              "isRetryable"
            ]
          }
        },
        "required": [
          "name",
          "data"
        ]
      },
      "Agent": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "subagent",
              "primary",
              "all"
            ]
          },
          "native": {
            "type": "boolean"
          },
          "hidden": {
            "type": "boolean"
          },
          "tier": {
            "type": "string",
            "enum": [
              "core",
              "specialist",
              "internal",
              "subagent"
            ]
          },
          "topP": {
            "type": "number"
          },
          "temperature": {
            "type": "number"
          },
          "color": {
            "type": "string"
          },
          "permission": {
            "$ref": "#/components/schemas/PermissionRuleset"
          },
          "model": {
            "type": "object",
            "properties": {
              "modelID": {
                "type": "string"
              },
              "providerID": {
                "type": "string"
              }
            },
            "required": [
              "modelID",
              "providerID"
            ]
          },
          "variant": {
            "type": "string"
          },
          "prompt": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "options": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "steps": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "streamIdleTimeoutMs": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "name",
          "mode",
          "permission",
          "options"
        ]
      },
      "AgentConfig": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string"
          },
          "variant": {
            "description": "Default model variant for this agent (applies only when using the agent's configured model).",
            "type": "string"
          },
          "temperature": {
            "type": "number"
          },
          "top_p": {
            "type": "number"
          },
          "prompt": {
            "type": "string"
          },
          "tools": {
            "description": "@deprecated Use 'permission' field instead",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "boolean"
            }
          },
          "disable": {
            "type": "boolean"
          },
          "description": {
            "description": "Description of when to use the agent",
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "subagent",
              "primary",
              "all"
            ]
          },
          "hidden": {
            "description": "Hide this subagent from the @ autocomplete menu (default: false, only applies to mode: subagent)",
            "type": "boolean"
          },
          "tier": {
            "description": "Agent visibility tier: core (always shown in picker), specialist (expandable, accessed via @-mention), internal (hidden)",
            "type": "string",
            "enum": [
              "core",
              "specialist",
              "internal"
            ]
          },
          "options": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "color": {
            "description": "Hex color code (e.g., #FF5733) or theme color (e.g., primary)",
            "anyOf": [
              {
                "type": "string",
                "pattern": "^#[0-9a-fA-F]{6}$"
              },
              {
                "type": "string",
                "enum": [
                  "primary",
                  "secondary",
                  "accent",
                  "success",
                  "warning",
                  "error",
                  "info"
                ]
              }
            ]
          },
          "steps": {
            "description": "Maximum number of agentic iterations before forcing text-only response",
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "maxSteps": {
            "description": "@deprecated Use 'steps' field instead.",
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "permission": {
            "$ref": "#/components/schemas/PermissionConfig"
          }
        },
        "additionalProperties": {}
      },
      "AgentPart": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^prt_.*"
          },
          "sessionID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "messageID": {
            "type": "string",
            "pattern": "^msg_.*"
          },
          "type": {
            "type": "string",
            "const": "agent"
          },
          "name": {
            "type": "string"
          },
          "source": {
            "type": "object",
            "properties": {
              "value": {
                "type": "string"
              },
              "start": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "end": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "value",
              "start",
              "end"
            ]
          }
        },
        "required": [
          "id",
          "sessionID",
          "messageID",
          "type",
          "name"
        ]
      },
      "AgentPartInput": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^prt_.*"
          },
          "type": {
            "type": "string",
            "const": "agent"
          },
          "name": {
            "type": "string"
          },
          "source": {
            "type": "object",
            "properties": {
              "value": {
                "type": "string"
              },
              "start": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "end": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "value",
              "start",
              "end"
            ]
          }
        },
        "required": [
          "type",
          "name"
        ]
      },
      "AppErrorEnvelope": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "minimum": 400,
            "maximum": 599
          },
          "code": {
            "type": "string"
          },
          "logRef": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean"
          },
          "details": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "name",
          "message",
          "status"
        ]
      },
      "AssistantMessage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^msg_.*"
          },
          "sessionID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "role": {
            "type": "string",
            "const": "assistant"
          },
          "execution": {
            "type": "object",
            "properties": {
              "version": {
                "type": "number",
                "const": 1
              },
              "generation": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              }
            },
            "required": [
              "version",
              "generation"
            ],
            "additionalProperties": false
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              },
              "completed": {
                "type": "number"
              }
            },
            "required": [
              "created"
            ]
          },
          "error": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ProviderAuthError"
              },
              {
                "$ref": "#/components/schemas/UnknownError"
              },
              {
                "$ref": "#/components/schemas/MessageOutputLengthError"
              },
              {
                "$ref": "#/components/schemas/MessageOutputLoopError"
              },
              {
                "$ref": "#/components/schemas/MessageAbortedError"
              },
              {
                "$ref": "#/components/schemas/StructuredOutputError"
              },
              {
                "$ref": "#/components/schemas/ContextOverflowError"
              },
              {
                "$ref": "#/components/schemas/RequestTooLargeError"
              },
              {
                "$ref": "#/components/schemas/APIError"
              },
              {
                "$ref": "#/components/schemas/AutonomousLimitExceededError"
              }
            ]
          },
          "parentID": {
            "type": "string",
            "pattern": "^msg_.*"
          },
          "modelID": {
            "type": "string"
          },
          "providerID": {
            "type": "string"
          },
          "mode": {
            "type": "string"
          },
          "agent": {
            "type": "string"
          },
          "path": {
            "type": "object",
            "properties": {
              "cwd": {
                "type": "string"
              },
              "root": {
                "type": "string"
              }
            },
            "required": [
              "cwd",
              "root"
            ]
          },
          "summary": {
            "type": "boolean"
          },
          "tokens": {
            "type": "object",
            "properties": {
              "total": {
                "type": "number"
              },
              "input": {
                "type": "number"
              },
              "output": {
                "type": "number"
              },
              "reasoning": {
                "type": "number"
              },
              "cache": {
                "type": "object",
                "properties": {
                  "read": {
                    "type": "number"
                  },
                  "write": {
                    "type": "number"
                  }
                },
                "required": [
                  "read",
                  "write"
                ]
              }
            },
            "required": [
              "input",
              "output",
              "reasoning",
              "cache"
            ]
          },
          "structured": {},
          "variant": {
            "type": "string"
          },
          "finish": {
            "type": "string"
          },
          "feedback": {
            "type": "string",
            "enum": [
              "up",
              "down"
            ]
          }
        },
        "required": [
          "id",
          "sessionID",
          "role",
          "time",
          "parentID",
          "modelID",
          "providerID",
          "mode",
          "agent",
          "path",
          "tokens"
        ]
      },
      "Auth": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "oauth"
              },
              "refresh": {
                "type": "string"
              },
              "access": {
                "type": "string"
              },
              "expires": {
                "type": "number"
              },
              "accountId": {
                "type": "string"
              },
              "enterpriseUrl": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "refresh",
              "access",
              "expires"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "api"
              },
              "key": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "key"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "wellknown"
              },
              "key": {
                "type": "string"
              },
              "token": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "key",
              "token"
            ]
          }
        ]
      },
      "AutonomousLimitExceededError": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "const": "AutonomousLimitExceededError"
          },
          "data": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "steps",
                  "files",
                  "lines",
                  "blocked_path",
                  "tool_calls"
                ]
              },
              "current": {
                "type": "number"
              },
              "limit": {
                "type": "number"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "current",
              "limit",
              "message"
            ]
          }
        },
        "required": [
          "name",
          "data"
        ]
      },
      "AutonomousState": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "enabled"
        ]
      },
      "Command": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "agent": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "command",
              "file",
              "mcp",
              "skill"
            ]
          },
          "sourceTool": {
            "type": "string",
            "enum": [
              "ax-code",
              "agents",
              "opencode",
              "claude",
              "builtin",
              "config"
            ]
          },
          "scope": {
            "type": "string",
            "enum": [
              "builtin",
              "project",
              "user",
              "config",
              "compat",
              "mcp"
            ]
          },
          "location": {
            "type": "string"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "info",
                    "warn",
                    "error"
                  ]
                }
              },
              "required": [
                "code",
                "message",
                "severity"
              ]
            }
          },
          "workflow": {
            "type": "string"
          },
          "allowShell": {
            "type": "boolean"
          },
          "argumentHint": {
            "type": "string"
          },
          "requiresArguments": {
            "type": "boolean"
          },
          "template": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "string"
              }
            ]
          },
          "subtask": {
            "type": "boolean"
          },
          "hints": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "mcpPrompt": {
            "type": "object",
            "properties": {
              "client": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "client",
              "name"
            ]
          }
        },
        "required": [
          "name",
          "template",
          "hints"
        ]
      },
      "CompactionPart": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^prt_.*"
          },
          "sessionID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "messageID": {
            "type": "string",
            "pattern": "^msg_.*"
          },
          "type": {
            "type": "string",
            "const": "compaction"
          },
          "auto": {
            "type": "boolean"
          },
          "overflow": {
            "type": "boolean"
          },
          "triggerReason": {
            "type": "string",
            "enum": [
              "provider_usage",
              "context_overflow_error",
              "request_too_large",
              "prompt_preflight",
              "manual"
            ]
          }
        },
        "required": [
          "id",
          "sessionID",
          "messageID",
          "type",
          "auto"
        ]
      },
      "Config": {
        "type": "object",
        "properties": {
          "$schema": {
            "description": "JSON schema reference for configuration validation",
            "type": "string"
          },
          "logLevel": {
            "$ref": "#/components/schemas/LogLevel"
          },
          "server": {
            "$ref": "#/components/schemas/ServerConfig"
          },
          "command": {
            "description": "Command configuration, see https://ax-code.app/en/docs/",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "template": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "agent": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "subtask": {
                  "type": "boolean"
                },
                "workflow": {
                  "type": "string"
                },
                "location": {
                  "type": "string"
                },
                "sourceTool": {
                  "type": "string",
                  "enum": [
                    "ax-code",
                    "agents",
                    "opencode",
                    "claude",
                    "builtin",
                    "config"
                  ]
                },
                "scope": {
                  "type": "string",
                  "enum": [
                    "project",
                    "user",
                    "config"
                  ]
                },
                "warnings": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "code": {
                        "type": "string"
                      },
                      "message": {
                        "type": "string"
                      },
                      "severity": {
                        "type": "string",
                        "enum": [
                          "info",
                          "warn",
                          "error"
                        ]
                      }
                    },
                    "required": [
                      "code",
                      "message",
                      "severity"
                    ]
                  }
                },
                "allowShell": {
                  "type": "boolean"
                }
              },
              "required": [
                "template"
              ]
            }
          },
          "skills": {
            "description": "Additional skill folder paths",
            "type": "object",
            "properties": {
              "paths": {
                "description": "Additional paths to skill folders",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "urls": {
                "description": "URLs to fetch skills from (e.g., https://example.com/.well-known/skills/)",
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "watcher": {
            "type": "object",
            "properties": {
              "ignore": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "directoryScope": {
            "description": "Controls the startup guard against launching ax-code in an overly broad directory.",
            "type": "object",
            "properties": {
              "enabled": {
                "description": "Warn before indexing an unusually broad directory (home, Desktop, Downloads, Documents, a filesystem root, or a very large top-level listing). Default: true.",
                "type": "boolean"
              },
              "maxTopLevelEntries": {
                "description": "Top-level entry count above which a directory is treated as broad. Default: 300.",
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "extraDenylist": {
                "description": "Additional absolute paths always treated as broad.",
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "plugin": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "snapshot": {
            "description": "Enable or disable snapshot tracking. When false, filesystem snapshots are not recorded and undoing or reverting will not undo/redo file changes. Defaults to true.",
            "type": "boolean"
          },
          "autoupdate": {
            "description": "Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications",
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "string",
                "const": "notify"
              }
            ]
          },
          "shell": {
            "description": "Default shell to use for terminal and bash tool (e.g. /bin/bash, /usr/bin/zsh). Overrides $SHELL environment variable.",
            "type": "string"
          },
          "language": {
            "description": "UI language (English only)",
            "type": "string",
            "const": "en"
          },
          "disabled_providers": {
            "description": "Disable providers that are loaded automatically",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "enabled_providers": {
            "description": "When set, ONLY these providers will be enabled. All other providers will be ignored",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "model": {
            "type": "string",
            "description": "Model to use in the format of provider/model, eg openai/gpt-5"
          },
          "llm_routing": {
            "description": "Explicit ordered recovery targets. Empty by default; only user-owned config grants targets.",
            "type": "object",
            "properties": {
              "fallback": {
                "maxItems": 8,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "providerID": {
                      "type": "string",
                      "minLength": 1
                    },
                    "modelID": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "providerID",
                    "modelID"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "additionalProperties": false
          },
          "small_model": {
            "type": "string",
            "description": "Explicit auxiliary model in provider/model format. When omitted, auxiliary tasks inherit the selected model."
          },
          "default_agent": {
            "description": "Default agent to use when none is specified. Must be a primary agent. Falls back to 'build' if not set or if the specified agent is invalid.",
            "type": "string"
          },
          "username": {
            "description": "Custom username to display in conversations instead of system username",
            "type": "string"
          },
          "mode": {
            "description": "@deprecated Use `agent` field instead.",
            "type": "object",
            "properties": {
              "build": {
                "$ref": "#/components/schemas/AgentConfig"
              },
              "plan": {
                "$ref": "#/components/schemas/AgentConfig"
              }
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/AgentConfig"
            }
          },
          "agent": {
            "description": "Agent configuration, see https://ax-code.app/en/docs/",
            "type": "object",
            "properties": {
              "plan": {
                "$ref": "#/components/schemas/AgentConfig"
              },
              "build": {
                "$ref": "#/components/schemas/AgentConfig"
              },
              "general": {
                "$ref": "#/components/schemas/AgentConfig"
              },
              "explore": {
                "$ref": "#/components/schemas/AgentConfig"
              },
              "scout": {
                "$ref": "#/components/schemas/AgentConfig"
              },
              "title": {
                "$ref": "#/components/schemas/AgentConfig"
              },
              "summary": {
                "$ref": "#/components/schemas/AgentConfig"
              },
              "compaction": {
                "$ref": "#/components/schemas/AgentConfig"
              }
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/AgentConfig"
            }
          },
          "provider": {
            "description": "Custom provider configurations and model overrides",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/ProviderConfig"
            }
          },
          "mcp": {
            "description": "MCP (Model Context Protocol) server configurations",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/McpLocalConfig"
                    },
                    {
                      "$ref": "#/components/schemas/McpRemoteConfig"
                    }
                  ],
                  "description": "MCP server config. Tools surface as permission keys `<server>_<tool>` — use the top-level `permission` map (with wildcards) to allow / deny them, or scope them per agent via `agent.<name>.permission`."
                },
                {
                  "type": "object",
                  "properties": {
                    "enabled": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "enabled"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "formatter": {
            "anyOf": [
              {
                "type": "boolean",
                "const": false
              },
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "disabled": {
                      "type": "boolean"
                    },
                    "command": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "environment": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "extensions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            ]
          },
          "lsp": {
            "anyOf": [
              {
                "type": "boolean",
                "const": false
              },
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "disabled": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "disabled"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "command": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "extensions": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "languageId": {
                          "type": "string"
                        },
                        "disabled": {
                          "type": "boolean"
                        },
                        "semantic": {
                          "type": "boolean"
                        },
                        "priority": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "concurrency": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "capabilities": {
                          "type": "object",
                          "properties": {
                            "hover": {
                              "type": "boolean"
                            },
                            "definition": {
                              "type": "boolean"
                            },
                            "references": {
                              "type": "boolean"
                            },
                            "implementation": {
                              "type": "boolean"
                            },
                            "documentSymbol": {
                              "type": "boolean"
                            },
                            "workspaceSymbol": {
                              "type": "boolean"
                            },
                            "callHierarchy": {
                              "type": "boolean"
                            }
                          }
                        },
                        "env": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string"
                          }
                        },
                        "initialization": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        }
                      }
                    }
                  ]
                }
              }
            ]
          },
          "instructions": {
            "description": "Additional instruction files or patterns to include",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "layout": {
            "$ref": "#/components/schemas/LayoutConfig"
          },
          "permission": {
            "$ref": "#/components/schemas/PermissionConfig"
          },
          "autonomous": {
            "description": "Enable autonomous mode (default: true)",
            "type": "boolean"
          },
          "autonomy": {
            "description": "Autonomous workload budgets and stall breakers. Prefer this over scattering limits across session and experimental keys. See /limits.",
            "type": "object",
            "properties": {
              "profile": {
                "description": "Named workload profile that seeds budget defaults: quick (tight), standard (shipped defaults), long (multi-file batches), goal (goal-scale headroom), custom (no profile seeds). Explicit autonomy.budget / session.* fields always win over the profile.",
                "type": "string",
                "enum": [
                  "quick",
                  "standard",
                  "long",
                  "goal",
                  "custom"
                ]
              },
              "budget": {
                "description": "First-class autonomy budgets. Takes precedence over session.* and experimental.autonomous_caps when set.",
                "type": "object",
                "properties": {
                  "model_turns": {
                    "type": "object",
                    "properties": {
                      "per_segment": {
                        "description": "Outer-loop steps per auto-continuation segment (alias: session.max_steps; default 500)",
                        "type": "integer",
                        "minimum": 10,
                        "maximum": 9007199254740991
                      },
                      "total": {
                        "description": "Cumulative outer-loop steps across continuations, goals, and Super-Long (alias: session.max_total_steps)",
                        "type": "integer",
                        "minimum": 10,
                        "maximum": 9007199254740991
                      }
                    }
                  },
                  "continuations": {
                    "description": "Auto-continuations after a per-segment step limit (alias: session.max_continuations; default 3)",
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "todo_retries": {
                    "description": "Auto-continuations while todos remain pending (alias: session.max_todo_retries; default 10)",
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "tool_calls": {
                    "type": "object",
                    "properties": {
                      "per_segment": {
                        "description": "Blast-radius tool-call ceiling per continuation (alias: experimental.autonomous_caps.steps; default 500)",
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "rate": {
                        "type": "object",
                        "properties": {
                          "count": {
                            "description": "Max tool calls in a rolling window (default 30). Protects against parallel tool floods.",
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "window_seconds": {
                            "description": "Rolling window length in seconds for the tool-call rate limit (default 10)",
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        }
                      },
                      "per_tool": {
                        "description": "Per-tool call-count caps (alias: experimental.autonomous_caps.perTool). 0 or negative disables.",
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      }
                    }
                  },
                  "changes": {
                    "type": "object",
                    "properties": {
                      "files_total": {
                        "description": "Max distinct files changed in an autonomous run (alias: experimental.autonomous_caps.files)",
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "lines_total": {
                        "description": "Max instrumented line-change total (alias: experimental.autonomous_caps.lines)",
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "lines_exempt_paths": {
                        "description": "Glob patterns whose writes count toward the file cap but not the line cap — lockfiles and generated snapshots by default (alias: experimental.autonomous_caps.linesExemptPaths)",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "blocked_paths": {
                        "description": "Glob patterns that refuse writes (alias: experimental.autonomous_caps.blockedPaths)",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              "stall": {
                "description": "Stall / loop breakers that are independent of workload step ceilings",
                "type": "object",
                "properties": {
                  "tool_only_turns": {
                    "description": "Hard stop after this many consecutive tool-only model finishes (default 35)",
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "tool_only_nudge": {
                    "description": "First synthesis checkpoint during a tool-only streak (default 15)",
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "tool_only_final_nudge": {
                    "description": "Final warning checkpoint before the hard stop (default max-5)",
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "failed_mutation_attempts": {
                    "description": "Segment-cumulative cap on failed mutating tool attempts (edit/write/multiedit/apply_patch/todowrite that errored). Reset by a successful mutation or a text finish. Bounds fail -> read -> fail loops that evade the consecutive all-error ladder (default 30).",
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "max_consecutive_errors": {
                    "description": "Hard stop after this many consecutive provider/tool errors in the outer loop (default 3). Raise to tolerate flaky providers; lower for stricter failure handling.",
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                }
              }
            }
          },
          "super_long": {
            "description": "Enable Super-Long supervised long-run mode (default: on for models with a 64k+ context window, thinking, and prompt caching — e.g. Qwen 3.7 Max/Plus; off otherwise)",
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "object",
                "properties": {
                  "enabled": {
                    "description": "Enable Super-Long supervised long-run mode",
                    "type": "boolean"
                  },
                  "duration_hours": {
                    "description": "Runtime ceiling for a Super-Long run in hours (default and hard maximum: 72)",
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "maximum": 72
                  },
                  "pacing_grace_minutes": {
                    "description": "Minutes from run start before provider request pacing engages (default 120). The grace window keeps the productive early phase of an agentic run unthrottled; 0 paces from the first request.",
                    "type": "number",
                    "minimum": 0,
                    "maximum": 4320
                  }
                }
              }
            ]
          },
          "isolation": {
            "$ref": "#/components/schemas/IsolationConfig"
          },
          "webmcp": {
            "$ref": "#/components/schemas/WebMcpRequirementConfig"
          },
          "tools": {
            "description": "@deprecated Use 'permission' field instead",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "boolean"
            }
          },
          "session": {
            "description": "Session lifecycle management",
            "type": "object",
            "properties": {
              "ttl_days": {
                "description": "Auto-prune sessions older than this many days (default: 30)",
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "auto_prune": {
                "description": "Automatically prune expired sessions on startup (default: true)",
                "type": "boolean"
              },
              "max_steps": {
                "description": "Maximum agentic steps per session turn before stopping (default: 500)",
                "type": "integer",
                "minimum": 10,
                "maximum": 9007199254740991
              },
              "max_continuations": {
                "description": "In autonomous mode, how many times to auto-continue after hitting step limit (default: 3, 0 to disable)",
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "max_total_steps": {
                "description": "Hard ceiling on cumulative steps across ALL auto-continuations, including active goals and Super-Long runs (default: max_steps × (max_continuations + 1); active-goal and Super-Long runs default: max_steps × 40). When the ceiling ends an active-goal run, the goal is paused and resumable with /goal resume",
                "type": "integer",
                "minimum": 10,
                "maximum": 9007199254740991
              },
              "max_todo_retries": {
                "description": "In autonomous mode, how many times to auto-continue when todos remain pending after the model stops (default: 10, 0 to disable)",
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            }
          },
          "routing": {
            "description": "Specialist agent auto-routing and message-complexity routing settings",
            "type": "object",
            "properties": {
              "disable": {
                "description": "Disable automatic specialist agent routing based on message keywords. Default: false.",
                "type": "boolean"
              },
              "mode": {
                "description": "@deprecated Routing mode is no longer used. Field accepted for backwards compatibility but ignored.",
                "type": "string",
                "enum": [
                  "off",
                  "delegate",
                  "switch"
                ]
              },
              "auto_switch": {
                "description": "@deprecated Use routing.disable instead. Field accepted for backwards compatibility but ignored.",
                "type": "boolean"
              },
              "llm": {
                "description": "Enable LLM-based message-complexity classification so simple queries use a small/fast model. Default: false unless the AX_CODE_SMART_LLM flag is set.",
                "type": "boolean"
              }
            }
          },
          "compaction": {
            "type": "object",
            "properties": {
              "auto": {
                "description": "Enable automatic compaction when context is full (default: true)",
                "type": "boolean"
              },
              "prune": {
                "description": "Enable pruning of old tool outputs (default: true)",
                "type": "boolean"
              },
              "reserved": {
                "description": "Token buffer for compaction. Leaves enough window to avoid overflow during compaction.",
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            }
          },
          "browser": {
            "description": "Browser integration settings",
            "type": "object",
            "properties": {
              "interceptOpen": {
                "description": "Intercept browser-open commands (open/xdg-open/start) targeting local HTML files or localhost URLs to prevent unexpected focus-steals during HTML development. Defaults to true.",
                "type": "boolean"
              },
              "cdpUrl": {
                "description": "Attach to a running Chrome/Edge via CDP (e.g. http://localhost:9222, started with --remote-debugging-port) instead of launching a headless browser. browser_* tools then observe and act in the real browser.",
                "type": "string"
              }
            }
          },
          "computer": {
            "description": "Computer-use (desktop control) integration. Disabled unless provider is set.",
            "type": "object",
            "properties": {
              "provider": {
                "description": "Computer-use backend, served by the ax-computer server (canonical AX Computer protocol): \"axnative\" (macOS) or \"cua\" (cross-platform) select the server backend; \"external\" treats computer.command as a complete canonical-protocol MCP server. All values require a resolvable server command (computer.command, AX_COMPUTER_COMMAND, or ax-computer on PATH). Unset = computer tools unavailable.",
                "type": "string",
                "enum": [
                  "cua",
                  "axnative",
                  "external"
                ]
              },
              "command": {
                "description": "Computer-use server command. Precedence: this config > AX_COMPUTER_COMMAND env > ax-computer on PATH. For aliases this is the ax-computer server; for \"external\" it is the full canonical-protocol server command.",
                "type": "string"
              },
              "args": {
                "description": "Server command arguments (default: [\"mcp\", \"--backend\", <provider>] for aliases, [] for external)",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "overrides": {
                "description": "Per-app provider overrides: map an application name (as observed by computer_snapshot) to \"cua\", \"axnative\", or \"external\". Observations and element acts against a matching app route to the named provider; everything else uses `provider`. Element ids are only valid against the provider that issued them — crossing providers requires a fresh observation.",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string",
                  "enum": [
                    "cua",
                    "axnative",
                    "external"
                  ]
                }
              },
              "grounder": {
                "description": "Grounder fallback for natural-language computer_action targets. Optional; unset = describe targets unavailable.",
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Vision model used to resolve natural-language action targets to screenshot coordinates (e.g. a UI-TARS endpoint), as \"provider/model\""
                  }
                },
                "required": [
                  "model"
                ]
              }
            }
          },
          "ops": {
            "description": "Cloud Operations mode settings (see docs/guides/cloud-operations.md)",
            "type": "object",
            "properties": {
              "strict": {
                "description": "Cloud-operations strict mode (default: false). When true, destructive-classified bash commands are denied outright — the interactive bash_destructive ask is replaced by a hard deny — and the model is directed to the sanctioned ops workflow (ops_plan -> ops_diff -> ops_approve -> ops_apply with an approved plan token). Set in trusted config only; untrusted project config cannot enable it.",
                "type": "boolean"
              }
            }
          },
          "attachment": {
            "description": "File attachment settings",
            "type": "object",
            "properties": {
              "image": {
                "type": "object",
                "properties": {
                  "auto_resize": {
                    "description": "Automatically resize images that exceed limits before sending to the model (default: true)",
                    "type": "boolean"
                  },
                  "max_width": {
                    "description": "Maximum image width in pixels (default: 2000)",
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "max_height": {
                    "description": "Maximum image height in pixels (default: 2000)",
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "max_base64_bytes": {
                    "description": "Maximum image size in base64 bytes (default: 5242880 = 5MiB)",
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                }
              }
            }
          },
          "experimental": {
            "type": "object",
            "properties": {
              "disable_paste_summary": {
                "type": "boolean"
              },
              "batch_tool": {
                "description": "Enable the batch tool",
                "type": "boolean"
              },
              "context_recovery": {
                "description": "Enable bounded current-session evidence recovery after compaction",
                "type": "boolean"
              },
              "mcp_tool_discovery": {
                "description": "Discover MCP tool schemas on demand while keeping built-in tools eager",
                "type": "boolean"
              },
              "tail_reminders": {
                "description": "Project changing task reminders after stable request history for cache experiments",
                "type": "boolean"
              },
              "read_only_recipes": {
                "description": "Enable bounded declarative read-only tool recipes",
                "type": "boolean"
              },
              "context_tools": {
                "description": "Enable experimental context-introspection tools (context_status)",
                "type": "boolean"
              },
              "openTelemetry": {
                "description": "Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag)",
                "type": "boolean"
              },
              "primary_tools": {
                "description": "Tools that should only be available to primary agents.",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "continue_loop_on_deny": {
                "description": "Continue the agent loop when a tool call is denied",
                "type": "boolean"
              },
              "mcp_timeout": {
                "description": "Timeout in milliseconds for model context protocol (MCP) requests",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "autonomous_escalate_low_confidence": {
                "description": "When autonomous mode auto-answers a clarification question with low confidence, escalate to the user instead of guessing. Default: true.",
                "type": "boolean"
              },
              "autonomous_strict_permission": {
                "description": "When autonomous mode encounters a permission whose risk class is unknown, prompt instead of auto-approving. Default: true. Set false only to preserve legacy compatibility.",
                "type": "boolean"
              },
              "permission_idle_once": {
                "description": "ADR-138: narrow exception to the interactive-only permission contract. Only fires while running unattended (autonomous) with the sandbox off (full-access). Each session's oldest pending ask gets 15 seconds; queued asks get a fresh countdown when promoted. Live mode changes cancel ineligible countdowns. The ask carries autoOnceAt so clients can render the countdown; any human reply cancels the deadline.",
                "type": "object",
                "properties": {
                  "enabled": {
                    "description": "Idle 'Allow once': auto-reply once after a countdown for allowlisted interactive permissions. Default: true; the autonomous + full-access posture is the opt-in. Set false to disable.",
                    "type": "boolean"
                  },
                  "timeout_ms": {
                    "description": "Deprecated: retained for config compatibility. Allow Once countdowns are fixed at 15000 ms.",
                    "type": "integer",
                    "minimum": 5000,
                    "maximum": 300000
                  },
                  "permissions": {
                    "description": "Permissions that may auto-reply once. Default: every pending permission, including requireInteractive. Requires autonomous mode with full-access; WebMCP additionally requires its corresponding bridge to be connected.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "autonomous_caps": {
                "description": "Override the default autonomous-mode blast-radius caps. Any field omitted falls back to the constant default.",
                "type": "object",
                "properties": {
                  "steps": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "files": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "lines": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "blockedPaths": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "linesExemptPaths": {
                    "description": "Glob patterns whose writes count toward the file cap but not the line cap.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "perTool": {
                    "description": "Per-tool call-count caps. 0 or negative disables the cap for that tool. Tools not listed are unrestricted at the per-tool layer.",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  }
                }
              },
              "planner_architect_model": {
                "description": "Provider/model id used for plan generation and replanning when set; defaults to the executor model.",
                "type": "string"
              }
            }
          },
          "quality": {
            "type": "object",
            "properties": {
              "critic_enabled": {
                "description": "Run the autonomous-mode diff critic at every phase boundary. Default: false.",
                "type": "boolean"
              }
            }
          },
          "modes": {
            "description": "Execution modes: local, cloud, hybrid placement, multi-provider council, and arena ensemble (ADR-049).",
            "type": "object",
            "properties": {
              "default": {
                "description": "Default execution mode. When unset: hybrid if local AX Engine is available, else cloud. Arena/council are typically invoked via tools rather than as the global default.",
                "type": "string",
                "enum": [
                  "local",
                  "cloud",
                  "hybrid",
                  "arena",
                  "council"
                ]
              },
              "hybrid": {
                "description": "Hybrid local/cloud placement policy",
                "type": "object",
                "properties": {
                  "preferLocalWhenAvailable": {
                    "description": "Prefer local placement when AX Engine (or configured local) is available. Default: true.",
                    "type": "boolean"
                  },
                  "escalateOnHighComplexity": {
                    "description": "Route high-complexity work to cloud when hybrid is active. Default: true.",
                    "type": "boolean"
                  },
                  "localProviderID": {
                    "description": "Provider id treated as local for hybrid placement. Default: ax-engine.",
                    "type": "string"
                  }
                }
              },
              "council": {
                "description": "Multi-provider council (advisory review / design) settings",
                "type": "object",
                "properties": {
                  "enabled": {
                    "description": "Allow the council multi-provider advisory tool. Default: true.",
                    "type": "boolean"
                  },
                  "maxMembers": {
                    "description": "Maximum council members per invocation (default: 3, hard max: 6).",
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "timeoutMs": {
                    "description": "Per-member timeout in ms for council fan-out (default: 180000; reasoning models receive reasoningTimeoutScale times this budget).",
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "reasoningTimeoutScale": {
                    "description": "Timeout multiplier applied to members whose model declares reasoning capability (default: 3). Raise when slow reasoning members (e.g. DeepSeek V4 Pro on large contexts) time out.",
                    "type": "number",
                    "minimum": 1,
                    "maximum": 10
                  },
                  "memberTimeoutMs": {
                    "description": "Absolute per-member timeout overrides in ms, keyed by \"providerID\" or \"providerID/modelID\". Takes precedence over timeoutMs and reasoningTimeoutScale for matching members.",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "debateRounds": {
                    "description": "Optional multi-round anonymous debate rounds (default: 0; Phase 3+).",
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "chairman": {
                    "description": "Append one blinded chairman synthesis call after aggregation (default: false). Deterministic tiering remains the primary output; the chairman receives anonymized findings only.",
                    "type": "boolean"
                  },
                  "adaptive": {
                    "description": "Adaptive fan-out (default: false): start council with two members and expand one at a time up to maxMembers while coverage is below quorum or dissent is material. Expansion triggers are harness-tunable constants.",
                    "type": "boolean"
                  }
                }
              },
              "arena": {
                "description": "Arena best-of-N implementation comparison settings",
                "type": "object",
                "properties": {
                  "enabled": {
                    "description": "Enable arena multi-contestant mode tools. Default: false; opt in per project.",
                    "type": "boolean"
                  },
                  "maxContestants": {
                    "description": "Maximum arena contestants (default: 3, hard max: 5).",
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "timeoutMs": {
                    "description": "Per-member timeout in ms for arena fan-out (falls back to council timeout, then 60000).",
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "reasoningTimeoutScale": {
                    "description": "Timeout multiplier applied to contestants whose model declares reasoning capability (falls back to modes.council.reasoningTimeoutScale, then 3).",
                    "type": "number",
                    "minimum": 1,
                    "maximum": 10
                  },
                  "memberTimeoutMs": {
                    "description": "Absolute per-contestant timeout overrides in ms, keyed by \"providerID\" or \"providerID/modelID\" (falls back to modes.council.memberTimeoutMs). Exact model keys win over provider-wide keys.",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "judge": {
                    "description": "Run one blinded rubric judge call to rank plan-mode proposals (default: true). The judge scores requirement coverage, feasibility, verification plan, and risk evidence; self-assessed risk remains display-only.",
                    "type": "boolean"
                  },
                  "strategy": {
                    "description": "Ranking strategy for arena candidates. verify_first is the recommended default (never pure popularity).",
                    "type": "string",
                    "enum": [
                      "verify_first",
                      "diversity",
                      "hybrid_score"
                    ]
                  }
                }
              },
              "budget": {
                "description": "Ensemble cost budget controls",
                "type": "object",
                "properties": {
                  "maxEstimatedUsd": {
                    "description": "Maximum estimated USD for an ensemble fan-out (fail-closed when exceeded).",
                    "type": "number",
                    "minimum": 0
                  },
                  "estimatedUsdPerMember": {
                    "description": "Rough USD cost per council/arena member call used with maxEstimatedUsd to cap fan-out size.",
                    "type": "number",
                    "minimum": 0
                  }
                }
              },
              "ensembleLedger": {
                "description": "Append per-generation records to the local ensemble call ledger (default: true). Local JSONL with SHA-256 prompt hashes only — no prompt bodies, no egress; operational debug data, not AX Telemetry.",
                "type": "boolean"
              }
            }
          },
          "wiki": {
            "description": "Native source-backed AX Wiki. Complements structural ax-code index; does not replace code_intelligence.",
            "type": "object",
            "properties": {
              "auto": {
                "description": "Maintain Wiki in the background after interactive project idle. Default: true; false disables automatic maintenance.",
                "type": "boolean"
              },
              "enabled": {
                "description": "When true (default), inject <repo_wiki> system protocol if the wiki directory exists. Set false to suppress.",
                "type": "boolean"
              },
              "dir": {
                "description": "AX Wiki directory relative to project root. Default: .ax-wiki.",
                "type": "string"
              },
              "model": {
                "description": "Model used for wiki compilation as provider/model. Defaults to the AX Code model.",
                "type": "string"
              },
              "autoInjectAgents": {
                "description": "Allow wiki ensure-agents / init --wiki to rewrite AX-WIKI marker blocks. Default: true.",
                "type": "boolean"
              },
              "touchClaudeMd": {
                "description": "When ensuring markers, also update CLAUDE.md if it already exists. Default: true.",
                "type": "boolean"
              },
              "include": {
                "description": "Optional source glob allowlist for AX Wiki discovery.",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "exclude": {
                "description": "Additional source globs excluded from AX Wiki discovery.",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "maxPages": {
                "description": "Maximum generated page count. Default: 12.",
                "type": "integer",
                "minimum": 3,
                "maximum": 40
              },
              "generationConcurrency": {
                "description": "Maximum simultaneous Wiki page calls. Default: 2 for cloud models, 1 for local and CLI models.",
                "type": "integer",
                "minimum": 1,
                "maximum": 2
              },
              "maxSourcesPerPage": {
                "description": "Maximum evidence files selected per page.",
                "type": "integer",
                "minimum": 1,
                "maximum": 200
              },
              "maxSourceBytes": {
                "description": "Maximum bytes read from one source file.",
                "type": "integer",
                "minimum": 1024,
                "maximum": 9007199254740991
              },
              "maxPageSourceBytes": {
                "description": "Maximum combined source evidence bytes per page.",
                "type": "integer",
                "minimum": 4096,
                "maximum": 9007199254740991
              },
              "instructions": {
                "description": "Additional maintainer instructions applied during wiki compilation.",
                "type": "string"
              },
              "pages": {
                "description": "Optional explicit wiki page plan; must include quickstart.md.",
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "purpose": {
                      "type": "string"
                    },
                    "selectors": {
                      "minItems": 1,
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "path",
                    "title",
                    "purpose",
                    "selectors"
                  ]
                }
              }
            }
          },
          "image_generation": {
            "description": "Image generation provider configuration",
            "type": "object",
            "properties": {
              "provider": {
                "description": "Image generation provider. Defaults to openai if OPENAI_API_KEY is set.",
                "type": "string",
                "enum": [
                  "openai",
                  "stability",
                  "custom"
                ]
              },
              "options": {
                "type": "object",
                "properties": {
                  "apiKey": {
                    "description": "API key for the image generation provider.",
                    "type": "string"
                  },
                  "baseURL": {
                    "description": "Custom base URL for the provider API.",
                    "type": "string"
                  },
                  "model": {
                    "description": "Model to use (e.g. gpt-image-2, stable-diffusion-xl).",
                    "type": "string"
                  }
                },
                "additionalProperties": {}
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "ContextOverflowError": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "const": "ContextOverflowError"
          },
          "data": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "responseBody": {
                "type": "string"
              }
            },
            "required": [
              "message"
            ]
          }
        },
        "required": [
          "name",
          "data"
        ]
      },
      "Event": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/Event.installation.updated"
          },
          {
            "$ref": "#/components/schemas/Event.installation.update-available"
          },
          {
            "$ref": "#/components/schemas/Event.project.updated"
          },
          {
            "$ref": "#/components/schemas/Event.server.instance.disposed"
          },
          {
            "$ref": "#/components/schemas/Event.server.connected"
          },
          {
            "$ref": "#/components/schemas/Event.server.heartbeat"
          },
          {
            "$ref": "#/components/schemas/Event.server.serialization_error"
          },
          {
            "$ref": "#/components/schemas/Event.server.resync_required"
          },
          {
            "$ref": "#/components/schemas/Event.global.disposed"
          },
          {
            "$ref": "#/components/schemas/Event.file.watcher.updated"
          },
          {
            "$ref": "#/components/schemas/Event.lsp.updated"
          },
          {
            "$ref": "#/components/schemas/Event.lsp.client.diagnostics"
          },
          {
            "$ref": "#/components/schemas/Event.session.goal"
          },
          {
            "$ref": "#/components/schemas/Event.notification.toast.show"
          },
          {
            "$ref": "#/components/schemas/Event.notification.monitor.line"
          },
          {
            "$ref": "#/components/schemas/Event.notification.monitor.exit"
          },
          {
            "$ref": "#/components/schemas/Event.message.updated"
          },
          {
            "$ref": "#/components/schemas/Event.message.removed"
          },
          {
            "$ref": "#/components/schemas/Event.message.part.updated"
          },
          {
            "$ref": "#/components/schemas/Event.message.part.delta"
          },
          {
            "$ref": "#/components/schemas/Event.message.part.removed"
          },
          {
            "$ref": "#/components/schemas/Event.task.queue.created"
          },
          {
            "$ref": "#/components/schemas/Event.task.queue.updated"
          },
          {
            "$ref": "#/components/schemas/Event.task.queue.deleted"
          },
          {
            "$ref": "#/components/schemas/Event.mcp.tools.changed"
          },
          {
            "$ref": "#/components/schemas/Event.mcp.browser.open.failed"
          },
          {
            "$ref": "#/components/schemas/Event.permission.asked"
          },
          {
            "$ref": "#/components/schemas/Event.permission.replied"
          },
          {
            "$ref": "#/components/schemas/Event.command.executed"
          },
          {
            "$ref": "#/components/schemas/Event.todo.updated"
          },
          {
            "$ref": "#/components/schemas/Event.session.status"
          },
          {
            "$ref": "#/components/schemas/Event.session.idle"
          },
          {
            "$ref": "#/components/schemas/Event.question.asked"
          },
          {
            "$ref": "#/components/schemas/Event.question.replied"
          },
          {
            "$ref": "#/components/schemas/Event.question.rejected"
          },
          {
            "$ref": "#/components/schemas/Event.session.compacted"
          },
          {
            "$ref": "#/components/schemas/Event.file.edited"
          },
          {
            "$ref": "#/components/schemas/Event.debug-engine.correlated-diagnostics"
          },
          {
            "$ref": "#/components/schemas/Event.vcs.branch.updated"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.run.created"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.run.updated"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.run.started"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.run.blocked"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.run.paused"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.run.resumed"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.run.completed"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.run.failed"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.run.cancelled"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.phase.updated"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.phase.started"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.phase.completed"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.phase.failed"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.child.created"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.child.updated"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.child.started"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.child.completed"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.child.failed"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.child.cancelled"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.artifact.written"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.budget.appended"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.budget.warning"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.budget.exceeded"
          },
          {
            "$ref": "#/components/schemas/Event.workflow.verification.attached"
          },
          {
            "$ref": "#/components/schemas/Event.scheduled.task.created"
          },
          {
            "$ref": "#/components/schemas/Event.scheduled.task.updated"
          },
          {
            "$ref": "#/components/schemas/Event.scheduled.task.deleted"
          },
          {
            "$ref": "#/components/schemas/Event.scheduled.task.fired"
          },
          {
            "$ref": "#/components/schemas/Event.scheduled.task.succeeded"
          },
          {
            "$ref": "#/components/schemas/Event.scheduled.task.failed"
          },
          {
            "$ref": "#/components/schemas/Event.scheduled.task.skipped"
          },
          {
            "$ref": "#/components/schemas/Event.scheduled.task.failed_persistently"
          },
          {
            "$ref": "#/components/schemas/Event.worktree.ready"
          },
          {
            "$ref": "#/components/schemas/Event.worktree.failed"
          },
          {
            "$ref": "#/components/schemas/Event.code.index.progress"
          },
          {
            "$ref": "#/components/schemas/Event.code.index.state"
          },
          {
            "$ref": "#/components/schemas/Event.session.created"
          },
          {
            "$ref": "#/components/schemas/Event.session.updated"
          },
          {
            "$ref": "#/components/schemas/Event.session.deleted"
          },
          {
            "$ref": "#/components/schemas/Event.session.diff"
          },
          {
            "$ref": "#/components/schemas/Event.session.error"
          },
          {
            "$ref": "#/components/schemas/Event.provider.updated"
          },
          {
            "$ref": "#/components/schemas/Event.tui.prompt.append"
          },
          {
            "$ref": "#/components/schemas/Event.tui.command.execute"
          },
          {
            "$ref": "#/components/schemas/Event.tui.toast.show"
          },
          {
            "$ref": "#/components/schemas/Event.tui.session.select"
          },
          {
            "$ref": "#/components/schemas/Event.pty.created"
          },
          {
            "$ref": "#/components/schemas/Event.pty.updated"
          },
          {
            "$ref": "#/components/schemas/Event.pty.exited"
          },
          {
            "$ref": "#/components/schemas/Event.pty.deleted"
          }
        ]
      },
      "Event.code.index.progress": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "code.index.progress"
          },
          "properties": {
            "type": "object",
            "properties": {
              "projectID": {
                "type": "string"
              },
              "completed": {
                "type": "number"
              },
              "total": {
                "type": "number"
              }
            },
            "required": [
              "projectID",
              "completed",
              "total"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.code.index.state": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "code.index.state"
          },
          "properties": {
            "type": "object",
            "properties": {
              "projectID": {
                "type": "string"
              },
              "state": {
                "anyOf": [
                  {
                    "type": "string",
                    "const": "idle"
                  },
                  {
                    "type": "string",
                    "const": "indexing"
                  },
                  {
                    "type": "string",
                    "const": "failed"
                  }
                ]
              },
              "error": {
                "type": "string"
              }
            },
            "required": [
              "projectID",
              "state"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.command.executed": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "command.executed"
          },
          "properties": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "sessionID": {
                "type": "string",
                "pattern": "^ses_.*"
              },
              "arguments": {
                "type": "string"
              },
              "messageID": {
                "type": "string",
                "pattern": "^msg_.*"
              },
              "source": {
                "type": "string",
                "enum": [
                  "command",
                  "file",
                  "mcp",
                  "skill"
                ]
              },
              "sourceTool": {
                "type": "string"
              },
              "workflow": {
                "type": "string"
              },
              "workflowRunID": {
                "type": "string"
              },
              "warnings": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "severity": {
                      "type": "string",
                      "enum": [
                        "info",
                        "warn",
                        "error"
                      ]
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "severity"
                  ]
                }
              }
            },
            "required": [
              "name",
              "sessionID",
              "arguments",
              "messageID"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.debug-engine.correlated-diagnostics": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "debug-engine.correlated-diagnostics"
          },
          "properties": {
            "type": "object",
            "properties": {
              "file": {
                "type": "string"
              },
              "correlations": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "file": {
                      "type": "string"
                    },
                    "line": {
                      "type": "number"
                    },
                    "message": {
                      "type": "string"
                    },
                    "severity": {
                      "type": "number"
                    },
                    "rootCauseFile": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "rootCauseSymbol": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "rootCauseChain": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "confidence": {
                      "type": "string",
                      "enum": [
                        "high",
                        "medium",
                        "low"
                      ]
                    },
                    "lspTimestamp": {
                      "type": "number"
                    },
                    "lspServerIDs": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "graphQueryIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "graphIndexedAt": {
                      "type": "number"
                    },
                    "graphCompleteness": {
                      "type": "string",
                      "enum": [
                        "full",
                        "partial",
                        "lsp-only"
                      ]
                    }
                  },
                  "required": [
                    "file",
                    "line",
                    "message",
                    "severity",
                    "rootCauseFile",
                    "rootCauseSymbol",
                    "rootCauseChain",
                    "confidence",
                    "lspTimestamp",
                    "lspServerIDs",
                    "graphQueryIds",
                    "graphIndexedAt",
                    "graphCompleteness"
                  ]
                }
              }
            },
            "required": [
              "file",
              "correlations"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.file.edited": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "file.edited"
          },
          "properties": {
            "type": "object",
            "properties": {
              "file": {
                "type": "string"
              }
            },
            "required": [
              "file"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.file.watcher.updated": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "file.watcher.updated"
          },
          "properties": {
            "type": "object",
            "properties": {
              "file": {
                "type": "string"
              },
              "event": {
                "anyOf": [
                  {
                    "type": "string",
                    "const": "add"
                  },
                  {
                    "type": "string",
                    "const": "change"
                  },
                  {
                    "type": "string",
                    "const": "unlink"
                  }
                ]
              }
            },
            "required": [
              "file",
              "event"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.global.disposed": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "global.disposed"
          },
          "properties": {
            "type": "object",
            "properties": {}
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.installation.update-available": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "installation.update-available"
          },
          "properties": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string"
              }
            },
            "required": [
              "version"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.installation.updated": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "installation.updated"
          },
          "properties": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string"
              },
              "warnings": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "version"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.lsp.client.diagnostics": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "lsp.client.diagnostics"
          },
          "properties": {
            "type": "object",
            "properties": {
              "serverID": {
                "type": "string"
              },
              "path": {
                "type": "string"
              }
            },
            "required": [
              "serverID",
              "path"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.lsp.updated": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "lsp.updated"
          },
          "properties": {
            "type": "object",
            "properties": {}
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.mcp.browser.open.failed": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "mcp.browser.open.failed"
          },
          "properties": {
            "type": "object",
            "properties": {
              "mcpName": {
                "type": "string"
              },
              "url": {
                "type": "string"
              }
            },
            "required": [
              "mcpName",
              "url"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.mcp.tools.changed": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "mcp.tools.changed"
          },
          "properties": {
            "type": "object",
            "properties": {
              "server": {
                "type": "string"
              }
            },
            "required": [
              "server"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.message.part.delta": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "message.part.delta"
          },
          "properties": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "pattern": "^ses_.*"
              },
              "messageID": {
                "type": "string",
                "pattern": "^msg_.*"
              },
              "partID": {
                "type": "string",
                "pattern": "^prt_.*"
              },
              "field": {
                "type": "string"
              },
              "delta": {
                "type": "string"
              },
              "offset": {
                "type": "number"
              }
            },
            "required": [
              "sessionID",
              "messageID",
              "partID",
              "field",
              "delta"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.message.part.removed": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "message.part.removed"
          },
          "properties": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "pattern": "^ses_.*"
              },
              "messageID": {
                "type": "string",
                "pattern": "^msg_.*"
              },
              "partID": {
                "type": "string",
                "pattern": "^prt_.*"
              }
            },
            "required": [
              "sessionID",
              "messageID",
              "partID"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.message.part.updated": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "message.part.updated"
          },
          "properties": {
            "type": "object",
            "properties": {
              "part": {
                "$ref": "#/components/schemas/Part"
              }
            },
            "required": [
              "part"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.message.removed": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "message.removed"
          },
          "properties": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "pattern": "^ses_.*"
              },
              "messageID": {
                "type": "string",
                "pattern": "^msg_.*"
              }
            },
            "required": [
              "sessionID",
              "messageID"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.message.updated": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "message.updated"
          },
          "properties": {
            "type": "object",
            "properties": {
              "info": {
                "$ref": "#/components/schemas/Message"
              }
            },
            "required": [
              "info"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.notification.monitor.exit": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "notification.monitor.exit"
          },
          "properties": {
            "type": "object",
            "properties": {
              "monitorID": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "exitCode": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "monitorID",
              "description",
              "exitCode"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.notification.monitor.line": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "notification.monitor.line"
          },
          "properties": {
            "type": "object",
            "properties": {
              "monitorID": {
                "type": "string"
              },
              "line": {
                "type": "string"
              },
              "description": {
                "type": "string"
              }
            },
            "required": [
              "monitorID",
              "line",
              "description"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.notification.toast.show": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "notification.toast.show"
          },
          "properties": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "variant": {
                "type": "string",
                "enum": [
                  "info",
                  "success",
                  "warning",
                  "error"
                ]
              },
              "duration": {
                "description": "Duration in milliseconds",
                "type": "number"
              }
            },
            "required": [
              "message",
              "variant"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.permission.asked": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "permission.asked"
          },
          "properties": {
            "$ref": "#/components/schemas/PermissionRequest"
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.permission.replied": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "permission.replied"
          },
          "properties": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "pattern": "^ses_.*"
              },
              "requestID": {
                "type": "string",
                "pattern": "^per_.*"
              },
              "reply": {
                "type": "string",
                "enum": [
                  "once",
                  "always",
                  "reject"
                ]
              }
            },
            "required": [
              "sessionID",
              "requestID",
              "reply"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.project.updated": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "project.updated"
          },
          "properties": {
            "$ref": "#/components/schemas/Project"
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.provider.updated": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "provider.updated"
          },
          "properties": {
            "type": "object",
            "properties": {}
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.pty.created": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "pty.created"
          },
          "properties": {
            "type": "object",
            "properties": {
              "info": {
                "$ref": "#/components/schemas/Pty"
              }
            },
            "required": [
              "info"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.pty.deleted": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "pty.deleted"
          },
          "properties": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^pty_.*"
              }
            },
            "required": [
              "id"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.pty.exited": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "pty.exited"
          },
          "properties": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^pty_.*"
              },
              "exitCode": {
                "type": "number"
              },
              "signal": {
                "type": "number"
              }
            },
            "required": [
              "id",
              "exitCode"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.pty.updated": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "pty.updated"
          },
          "properties": {
            "type": "object",
            "properties": {
              "info": {
                "$ref": "#/components/schemas/Pty"
              }
            },
            "required": [
              "info"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.question.asked": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "question.asked"
          },
          "properties": {
            "$ref": "#/components/schemas/QuestionRequest"
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.question.rejected": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "question.rejected"
          },
          "properties": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "pattern": "^ses_.*"
              },
              "requestID": {
                "type": "string",
                "pattern": "^que_.*"
              }
            },
            "required": [
              "sessionID",
              "requestID"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.question.replied": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "question.replied"
          },
          "properties": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "pattern": "^ses_.*"
              },
              "requestID": {
                "type": "string",
                "pattern": "^que_.*"
              },
              "answers": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/QuestionAnswer"
                }
              }
            },
            "required": [
              "sessionID",
              "requestID",
              "answers"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.scheduled.task.created": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "scheduled.task.created"
          },
          "properties": {
            "type": "object",
            "properties": {
              "task": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^sch_.*"
                  },
                  "projectID": {
                    "type": "string"
                  },
                  "directory": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "schedule": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "once"
                          },
                          "runAt": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "type",
                          "runAt"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "daily"
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "time"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "weekly"
                          },
                          "day": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 6
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "day",
                          "time"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "cron"
                          },
                          "expression": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "expression"
                        ]
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "paused",
                      "disabled"
                    ]
                  },
                  "agent": {
                    "type": "string"
                  },
                  "model": {},
                  "workflowTemplateID": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                  },
                  "workflowStartOptions": {
                    "type": "object",
                    "properties": {
                      "allowScaleBeyondDefaults": {
                        "type": "boolean"
                      },
                      "allowWriteWorkflows": {
                        "type": "boolean"
                      },
                      "durableChildren": {
                        "type": "boolean"
                      },
                      "enqueueChildren": {
                        "type": "boolean"
                      }
                    }
                  },
                  "lastQueueID": {
                    "type": "string"
                  },
                  "lastWorkflowRunID": {
                    "type": "string"
                  },
                  "error": {
                    "type": "string"
                  },
                  "nextRunAt": {
                    "type": "number"
                  },
                  "lastRunAt": {
                    "type": "number"
                  },
                  "catchUpPolicy": {
                    "type": "string",
                    "enum": [
                      "skip",
                      "run_once"
                    ]
                  },
                  "maxRunDurationMs": {
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 259200000
                  },
                  "time": {
                    "type": "object",
                    "properties": {
                      "created": {
                        "type": "number"
                      },
                      "updated": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "created"
                    ]
                  }
                },
                "required": [
                  "id",
                  "projectID",
                  "directory",
                  "title",
                  "prompt",
                  "schedule",
                  "status",
                  "catchUpPolicy",
                  "time"
                ]
              }
            },
            "required": [
              "task"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.scheduled.task.deleted": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "scheduled.task.deleted"
          },
          "properties": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^sch_.*"
              },
              "projectID": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "projectID"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.scheduled.task.failed": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "scheduled.task.failed"
          },
          "properties": {
            "type": "object",
            "properties": {
              "task": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^sch_.*"
                  },
                  "projectID": {
                    "type": "string"
                  },
                  "directory": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "schedule": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "once"
                          },
                          "runAt": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "type",
                          "runAt"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "daily"
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "time"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "weekly"
                          },
                          "day": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 6
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "day",
                          "time"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "cron"
                          },
                          "expression": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "expression"
                        ]
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "paused",
                      "disabled"
                    ]
                  },
                  "agent": {
                    "type": "string"
                  },
                  "model": {},
                  "workflowTemplateID": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                  },
                  "workflowStartOptions": {
                    "type": "object",
                    "properties": {
                      "allowScaleBeyondDefaults": {
                        "type": "boolean"
                      },
                      "allowWriteWorkflows": {
                        "type": "boolean"
                      },
                      "durableChildren": {
                        "type": "boolean"
                      },
                      "enqueueChildren": {
                        "type": "boolean"
                      }
                    }
                  },
                  "lastQueueID": {
                    "type": "string"
                  },
                  "lastWorkflowRunID": {
                    "type": "string"
                  },
                  "error": {
                    "type": "string"
                  },
                  "nextRunAt": {
                    "type": "number"
                  },
                  "lastRunAt": {
                    "type": "number"
                  },
                  "catchUpPolicy": {
                    "type": "string",
                    "enum": [
                      "skip",
                      "run_once"
                    ]
                  },
                  "maxRunDurationMs": {
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 259200000
                  },
                  "time": {
                    "type": "object",
                    "properties": {
                      "created": {
                        "type": "number"
                      },
                      "updated": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "created"
                    ]
                  }
                },
                "required": [
                  "id",
                  "projectID",
                  "directory",
                  "title",
                  "prompt",
                  "schedule",
                  "status",
                  "catchUpPolicy",
                  "time"
                ]
              },
              "run": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^str_.*"
                  },
                  "taskID": {
                    "type": "string",
                    "pattern": "^sch_.*"
                  },
                  "projectID": {
                    "type": "string"
                  },
                  "triggerType": {
                    "type": "string",
                    "enum": [
                      "scheduled",
                      "manual"
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "running",
                      "completed",
                      "failed",
                      "timeout",
                      "skipped_overlap",
                      "missed_skip"
                    ]
                  },
                  "occurrenceAt": {
                    "type": "number"
                  },
                  "coalescedCount": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "queueID": {
                    "type": "string"
                  },
                  "workflowRunID": {
                    "type": "string"
                  },
                  "error": {
                    "type": "string"
                  },
                  "timeStarted": {
                    "type": "number"
                  },
                  "timeCompleted": {
                    "type": "number"
                  },
                  "time": {
                    "type": "object",
                    "properties": {
                      "created": {
                        "type": "number"
                      },
                      "updated": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "created"
                    ]
                  }
                },
                "required": [
                  "id",
                  "taskID",
                  "projectID",
                  "triggerType",
                  "status",
                  "coalescedCount",
                  "time"
                ]
              }
            },
            "required": [
              "task",
              "run"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.scheduled.task.failed_persistently": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "scheduled.task.failed_persistently"
          },
          "properties": {
            "type": "object",
            "properties": {
              "task": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^sch_.*"
                  },
                  "projectID": {
                    "type": "string"
                  },
                  "directory": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "schedule": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "once"
                          },
                          "runAt": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "type",
                          "runAt"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "daily"
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "time"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "weekly"
                          },
                          "day": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 6
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "day",
                          "time"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "cron"
                          },
                          "expression": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "expression"
                        ]
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "paused",
                      "disabled"
                    ]
                  },
                  "agent": {
                    "type": "string"
                  },
                  "model": {},
                  "workflowTemplateID": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                  },
                  "workflowStartOptions": {
                    "type": "object",
                    "properties": {
                      "allowScaleBeyondDefaults": {
                        "type": "boolean"
                      },
                      "allowWriteWorkflows": {
                        "type": "boolean"
                      },
                      "durableChildren": {
                        "type": "boolean"
                      },
                      "enqueueChildren": {
                        "type": "boolean"
                      }
                    }
                  },
                  "lastQueueID": {
                    "type": "string"
                  },
                  "lastWorkflowRunID": {
                    "type": "string"
                  },
                  "error": {
                    "type": "string"
                  },
                  "nextRunAt": {
                    "type": "number"
                  },
                  "lastRunAt": {
                    "type": "number"
                  },
                  "catchUpPolicy": {
                    "type": "string",
                    "enum": [
                      "skip",
                      "run_once"
                    ]
                  },
                  "maxRunDurationMs": {
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 259200000
                  },
                  "time": {
                    "type": "object",
                    "properties": {
                      "created": {
                        "type": "number"
                      },
                      "updated": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "created"
                    ]
                  }
                },
                "required": [
                  "id",
                  "projectID",
                  "directory",
                  "title",
                  "prompt",
                  "schedule",
                  "status",
                  "catchUpPolicy",
                  "time"
                ]
              }
            },
            "required": [
              "task"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.scheduled.task.fired": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "scheduled.task.fired"
          },
          "properties": {
            "type": "object",
            "properties": {
              "task": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^sch_.*"
                  },
                  "projectID": {
                    "type": "string"
                  },
                  "directory": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "schedule": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "once"
                          },
                          "runAt": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "type",
                          "runAt"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "daily"
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "time"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "weekly"
                          },
                          "day": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 6
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "day",
                          "time"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "cron"
                          },
                          "expression": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "expression"
                        ]
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "paused",
                      "disabled"
                    ]
                  },
                  "agent": {
                    "type": "string"
                  },
                  "model": {},
                  "workflowTemplateID": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                  },
                  "workflowStartOptions": {
                    "type": "object",
                    "properties": {
                      "allowScaleBeyondDefaults": {
                        "type": "boolean"
                      },
                      "allowWriteWorkflows": {
                        "type": "boolean"
                      },
                      "durableChildren": {
                        "type": "boolean"
                      },
                      "enqueueChildren": {
                        "type": "boolean"
                      }
                    }
                  },
                  "lastQueueID": {
                    "type": "string"
                  },
                  "lastWorkflowRunID": {
                    "type": "string"
                  },
                  "error": {
                    "type": "string"
                  },
                  "nextRunAt": {
                    "type": "number"
                  },
                  "lastRunAt": {
                    "type": "number"
                  },
                  "catchUpPolicy": {
                    "type": "string",
                    "enum": [
                      "skip",
                      "run_once"
                    ]
                  },
                  "maxRunDurationMs": {
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 259200000
                  },
                  "time": {
                    "type": "object",
                    "properties": {
                      "created": {
                        "type": "number"
                      },
                      "updated": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "created"
                    ]
                  }
                },
                "required": [
                  "id",
                  "projectID",
                  "directory",
                  "title",
                  "prompt",
                  "schedule",
                  "status",
                  "catchUpPolicy",
                  "time"
                ]
              },
              "run": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^str_.*"
                  },
                  "taskID": {
                    "type": "string",
                    "pattern": "^sch_.*"
                  },
                  "projectID": {
                    "type": "string"
                  },
                  "triggerType": {
                    "type": "string",
                    "enum": [
                      "scheduled",
                      "manual"
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "running",
                      "completed",
                      "failed",
                      "timeout",
                      "skipped_overlap",
                      "missed_skip"
                    ]
                  },
                  "occurrenceAt": {
                    "type": "number"
                  },
                  "coalescedCount": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "queueID": {
                    "type": "string"
                  },
                  "workflowRunID": {
                    "type": "string"
                  },
                  "error": {
                    "type": "string"
                  },
                  "timeStarted": {
                    "type": "number"
                  },
                  "timeCompleted": {
                    "type": "number"
                  },
                  "time": {
                    "type": "object",
                    "properties": {
                      "created": {
                        "type": "number"
                      },
                      "updated": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "created"
                    ]
                  }
                },
                "required": [
                  "id",
                  "taskID",
                  "projectID",
                  "triggerType",
                  "status",
                  "coalescedCount",
                  "time"
                ]
              }
            },
            "required": [
              "task",
              "run"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.scheduled.task.skipped": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "scheduled.task.skipped"
          },
          "properties": {
            "type": "object",
            "properties": {
              "task": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^sch_.*"
                  },
                  "projectID": {
                    "type": "string"
                  },
                  "directory": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "schedule": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "once"
                          },
                          "runAt": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "type",
                          "runAt"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "daily"
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "time"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "weekly"
                          },
                          "day": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 6
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "day",
                          "time"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "cron"
                          },
                          "expression": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "expression"
                        ]
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "paused",
                      "disabled"
                    ]
                  },
                  "agent": {
                    "type": "string"
                  },
                  "model": {},
                  "workflowTemplateID": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                  },
                  "workflowStartOptions": {
                    "type": "object",
                    "properties": {
                      "allowScaleBeyondDefaults": {
                        "type": "boolean"
                      },
                      "allowWriteWorkflows": {
                        "type": "boolean"
                      },
                      "durableChildren": {
                        "type": "boolean"
                      },
                      "enqueueChildren": {
                        "type": "boolean"
                      }
                    }
                  },
                  "lastQueueID": {
                    "type": "string"
                  },
                  "lastWorkflowRunID": {
                    "type": "string"
                  },
                  "error": {
                    "type": "string"
                  },
                  "nextRunAt": {
                    "type": "number"
                  },
                  "lastRunAt": {
                    "type": "number"
                  },
                  "catchUpPolicy": {
                    "type": "string",
                    "enum": [
                      "skip",
                      "run_once"
                    ]
                  },
                  "maxRunDurationMs": {
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 259200000
                  },
                  "time": {
                    "type": "object",
                    "properties": {
                      "created": {
                        "type": "number"
                      },
                      "updated": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "created"
                    ]
                  }
                },
                "required": [
                  "id",
                  "projectID",
                  "directory",
                  "title",
                  "prompt",
                  "schedule",
                  "status",
                  "catchUpPolicy",
                  "time"
                ]
              },
              "run": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^str_.*"
                  },
                  "taskID": {
                    "type": "string",
                    "pattern": "^sch_.*"
                  },
                  "projectID": {
                    "type": "string"
                  },
                  "triggerType": {
                    "type": "string",
                    "enum": [
                      "scheduled",
                      "manual"
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "running",
                      "completed",
                      "failed",
                      "timeout",
                      "skipped_overlap",
                      "missed_skip"
                    ]
                  },
                  "occurrenceAt": {
                    "type": "number"
                  },
                  "coalescedCount": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "queueID": {
                    "type": "string"
                  },
                  "workflowRunID": {
                    "type": "string"
                  },
                  "error": {
                    "type": "string"
                  },
                  "timeStarted": {
                    "type": "number"
                  },
                  "timeCompleted": {
                    "type": "number"
                  },
                  "time": {
                    "type": "object",
                    "properties": {
                      "created": {
                        "type": "number"
                      },
                      "updated": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "created"
                    ]
                  }
                },
                "required": [
                  "id",
                  "taskID",
                  "projectID",
                  "triggerType",
                  "status",
                  "coalescedCount",
                  "time"
                ]
              }
            },
            "required": [
              "task",
              "run"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.scheduled.task.succeeded": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "scheduled.task.succeeded"
          },
          "properties": {
            "type": "object",
            "properties": {
              "task": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^sch_.*"
                  },
                  "projectID": {
                    "type": "string"
                  },
                  "directory": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "schedule": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "once"
                          },
                          "runAt": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "type",
                          "runAt"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "daily"
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "time"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "weekly"
                          },
                          "day": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 6
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "day",
                          "time"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "cron"
                          },
                          "expression": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "expression"
                        ]
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "paused",
                      "disabled"
                    ]
                  },
                  "agent": {
                    "type": "string"
                  },
                  "model": {},
                  "workflowTemplateID": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                  },
                  "workflowStartOptions": {
                    "type": "object",
                    "properties": {
                      "allowScaleBeyondDefaults": {
                        "type": "boolean"
                      },
                      "allowWriteWorkflows": {
                        "type": "boolean"
                      },
                      "durableChildren": {
                        "type": "boolean"
                      },
                      "enqueueChildren": {
                        "type": "boolean"
                      }
                    }
                  },
                  "lastQueueID": {
                    "type": "string"
                  },
                  "lastWorkflowRunID": {
                    "type": "string"
                  },
                  "error": {
                    "type": "string"
                  },
                  "nextRunAt": {
                    "type": "number"
                  },
                  "lastRunAt": {
                    "type": "number"
                  },
                  "catchUpPolicy": {
                    "type": "string",
                    "enum": [
                      "skip",
                      "run_once"
                    ]
                  },
                  "maxRunDurationMs": {
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 259200000
                  },
                  "time": {
                    "type": "object",
                    "properties": {
                      "created": {
                        "type": "number"
                      },
                      "updated": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "created"
                    ]
                  }
                },
                "required": [
                  "id",
                  "projectID",
                  "directory",
                  "title",
                  "prompt",
                  "schedule",
                  "status",
                  "catchUpPolicy",
                  "time"
                ]
              },
              "run": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^str_.*"
                  },
                  "taskID": {
                    "type": "string",
                    "pattern": "^sch_.*"
                  },
                  "projectID": {
                    "type": "string"
                  },
                  "triggerType": {
                    "type": "string",
                    "enum": [
                      "scheduled",
                      "manual"
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "running",
                      "completed",
                      "failed",
                      "timeout",
                      "skipped_overlap",
                      "missed_skip"
                    ]
                  },
                  "occurrenceAt": {
                    "type": "number"
                  },
                  "coalescedCount": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "queueID": {
                    "type": "string"
                  },
                  "workflowRunID": {
                    "type": "string"
                  },
                  "error": {
                    "type": "string"
                  },
                  "timeStarted": {
                    "type": "number"
                  },
                  "timeCompleted": {
                    "type": "number"
                  },
                  "time": {
                    "type": "object",
                    "properties": {
                      "created": {
                        "type": "number"
                      },
                      "updated": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "created"
                    ]
                  }
                },
                "required": [
                  "id",
                  "taskID",
                  "projectID",
                  "triggerType",
                  "status",
                  "coalescedCount",
                  "time"
                ]
              }
            },
            "required": [
              "task",
              "run"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.scheduled.task.updated": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "scheduled.task.updated"
          },
          "properties": {
            "type": "object",
            "properties": {
              "task": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^sch_.*"
                  },
                  "projectID": {
                    "type": "string"
                  },
                  "directory": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "schedule": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "once"
                          },
                          "runAt": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "type",
                          "runAt"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "daily"
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "time"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "weekly"
                          },
                          "day": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 6
                          },
                          "time": {
                            "type": "string",
                            "pattern": "^\\d{2}:\\d{2}$"
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "day",
                          "time"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "cron"
                          },
                          "expression": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "timezone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "expression"
                        ]
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "paused",
                      "disabled"
                    ]
                  },
                  "agent": {
                    "type": "string"
                  },
                  "model": {},
                  "workflowTemplateID": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^(builtin|user|project):[a-z][a-z0-9-]*$"
                  },
                  "workflowStartOptions": {
                    "type": "object",
                    "properties": {
                      "allowScaleBeyondDefaults": {
                        "type": "boolean"
                      },
                      "allowWriteWorkflows": {
                        "type": "boolean"
                      },
                      "durableChildren": {
                        "type": "boolean"
                      },
                      "enqueueChildren": {
                        "type": "boolean"
                      }
                    }
                  },
                  "lastQueueID": {
                    "type": "string"
                  },
                  "lastWorkflowRunID": {
                    "type": "string"
                  },
                  "error": {
                    "type": "string"
                  },
                  "nextRunAt": {
                    "type": "number"
                  },
                  "lastRunAt": {
                    "type": "number"
                  },
                  "catchUpPolicy": {
                    "type": "string",
                    "enum": [
                      "skip",
                      "run_once"
                    ]
                  },
                  "maxRunDurationMs": {
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 259200000
                  },
                  "time": {
                    "type": "object",
                    "properties": {
                      "created": {
                        "type": "number"
                      },
                      "updated": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "created"
                    ]
                  }
                },
                "required": [
                  "id",
                  "projectID",
                  "directory",
                  "title",
                  "prompt",
                  "schedule",
                  "status",
                  "catchUpPolicy",
                  "time"
                ]
              }
            },
            "required": [
              "task"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.server.connected": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "server.connected"
          },
          "properties": {
            "type": "object",
            "properties": {}
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.server.heartbeat": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "server.heartbeat"
          },
          "properties": {
            "type": "object",
            "properties": {}
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.server.instance.disposed": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "server.instance.disposed"
          },
          "properties": {
            "type": "object",
            "properties": {
              "directory": {
                "type": "string"
              }
            },
            "required": [
              "directory"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.server.resync_required": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "server.resync_required"
          },
          "properties": {
            "type": "object",
            "properties": {
              "reason": {
                "type": "string",
                "enum": [
                  "invalid_cursor",
                  "server_restarted",
                  "cursor_expired",
                  "cursor_ahead",
                  "buffer_overflow"
                ]
              },
              "cursor": {
                "type": "string"
              }
            },
            "required": [
              "reason",
              "cursor"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.server.serialization_error": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "server.serialization_error"
          },
          "properties": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string"
              }
            },
            "required": [
              "error"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.session.compacted": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "session.compacted"
          },
          "properties": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "pattern": "^ses_.*"
              }
            },
            "required": [
              "sessionID"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.session.created": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "session.created"
          },
          "properties": {
            "type": "object",
            "properties": {
              "info": {
                "$ref": "#/components/schemas/Session"
              }
            },
            "required": [
              "info"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.session.deleted": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "session.deleted"
          },
          "properties": {
            "type": "object",
            "properties": {
              "info": {
                "$ref": "#/components/schemas/Session"
              }
            },
            "required": [
              "info"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.session.diff": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "session.diff"
          },
          "properties": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "pattern": "^ses_.*"
              },
              "diff": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/FileDiff"
                }
              }
            },
            "required": [
              "sessionID",
              "diff"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.session.error": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "session.error"
          },
          "properties": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "pattern": "^ses_.*"
              },
              "error": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ProviderAuthError"
                  },
                  {
                    "$ref": "#/components/schemas/UnknownError"
                  },
                  {
                    "$ref": "#/components/schemas/MessageOutputLengthError"
                  },
                  {
                    "$ref": "#/components/schemas/MessageOutputLoopError"
                  },
                  {
                    "$ref": "#/components/schemas/MessageAbortedError"
                  },
                  {
                    "$ref": "#/components/schemas/StructuredOutputError"
                  },
                  {
                    "$ref": "#/components/schemas/ContextOverflowError"
                  },
                  {
                    "$ref": "#/components/schemas/RequestTooLargeError"
                  },
                  {
                    "$ref": "#/components/schemas/APIError"
                  },
                  {
                    "$ref": "#/components/schemas/AutonomousLimitExceededError"
                  }
                ]
              },
              "code": {
                "$ref": "#/components/schemas/SessionStopCode"
              }
            }
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.session.goal": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "session.goal"
          },
          "properties": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "pattern": "^ses_.*"
              },
              "goal": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "sessionID": {
                        "type": "string",
                        "pattern": "^ses_.*"
                      },
                      "objective": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "active",
                          "paused",
                          "complete",
                          "blocked",
                          "budget_limited"
                        ]
                      },
                      "tokenBudget": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "tokensUsed": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "timeUsedSeconds": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "timeBudgetSeconds": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "time": {
                        "type": "object",
                        "properties": {
                          "created": {
                            "type": "number"
                          },
                          "updated": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "created"
                        ]
                      },
                      "remainingTokens": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "remainingTimeSeconds": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "planPath": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "sessionID",
                      "objective",
                      "status",
                      "tokensUsed",
                      "timeUsedSeconds",
                      "time"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "sessionID",
              "goal"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.session.idle": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "session.idle"
          },
          "properties": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "pattern": "^ses_.*"
              }
            },
            "required": [
              "sessionID"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.session.status": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "session.status"
          },
          "properties": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "pattern": "^ses_.*"
              },
              "status": {
                "$ref": "#/components/schemas/SessionStatus"
              }
            },
            "required": [
              "sessionID",
              "status"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.session.updated": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "session.updated"
          },
          "properties": {
            "type": "object",
            "properties": {
              "info": {
                "$ref": "#/components/schemas/Session"
              }
            },
            "required": [
              "info"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.task.queue.created": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "task.queue.created"
          },
          "properties": {
            "type": "object",
            "properties": {
              "item": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^tsk_.*"
                  },
                  "projectID": {
                    "type": "string"
                  },
                  "directory": {
                    "type": "string"
                  },
                  "sessionID": {
                    "type": "string",
                    "pattern": "^ses_.*"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "prompt",
                      "command",
                      "shell",
                      "followup",
                      "subagent",
                      "automation"
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "queued",
                      "waiting_for_idle",
                      "running",
                      "blocked_permission",
                      "blocked_question",
                      "paused",
                      "failed",
                      "completed",
                      "cancelled"
                    ]
                  },
                  "priority": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "position": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "title": {
                    "type": "string"
                  },
                  "agent": {
                    "type": "string"
                  },
                  "model": {},
                  "sourceMessageID": {
                    "type": "string"
                  },
                  "sourceTaskID": {
                    "type": "string"
                  },
                  "payload": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "error": {
                    "type": "string"
                  },
                  "executionTimeoutMs": {
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 259200000
                  },
                  "time": {
                    "type": "object",
                    "properties": {
                      "created": {
                        "type": "number"
                      },
                      "updated": {
                        "type": "number"
                      },
                      "started": {
                        "type": "number"
                      },
                      "completed": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "created"
                    ]
                  }
                },
                "required": [
                  "id",
                  "projectID",
                  "directory",
                  "kind",
                  "status",
                  "priority",
                  "position",
                  "title",
                  "payload",
                  "time"
                ]
              }
            },
            "required": [
              "item"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.task.queue.deleted": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "task.queue.deleted"
          },
          "properties": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^tsk_.*"
              },
              "projectID": {
                "type": "string"
              },
              "sessionID": {
                "type": "string",
                "pattern": "^ses_.*"
              }
            },
            "required": [
              "id",
              "projectID"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.task.queue.updated": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "task.queue.updated"
          },
          "properties": {
            "type": "object",
            "properties": {
              "item": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^tsk_.*"
                  },
                  "projectID": {
                    "type": "string"
                  },
                  "directory": {
                    "type": "string"
                  },
                  "sessionID": {
                    "type": "string",
                    "pattern": "^ses_.*"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "prompt",
                      "command",
                      "shell",
                      "followup",
                      "subagent",
                      "automation"
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "queued",
                      "waiting_for_idle",
                      "running",
                      "blocked_permission",
                      "blocked_question",
                      "paused",
                      "failed",
                      "completed",
                      "cancelled"
                    ]
                  },
                  "priority": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "position": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "title": {
                    "type": "string"
                  },
                  "agent": {
                    "type": "string"
                  },
                  "model": {},
                  "sourceMessageID": {
                    "type": "string"
                  },
                  "sourceTaskID": {
                    "type": "string"
                  },
                  "payload": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "error": {
                    "type": "string"
                  },
                  "executionTimeoutMs": {
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 259200000
                  },
                  "time": {
                    "type": "object",
                    "properties": {
                      "created": {
                        "type": "number"
                      },
                      "updated": {
                        "type": "number"
                      },
                      "started": {
                        "type": "number"
                      },
                      "completed": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "created"
                    ]
                  }
                },
                "required": [
                  "id",
                  "projectID",
                  "directory",
                  "kind",
                  "status",
                  "priority",
                  "position",
                  "title",
                  "payload",
                  "time"
                ]
              }
            },
            "required": [
              "item"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.todo.updated": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "todo.updated"
          },
          "properties": {
            "type": "object",
            "properties": {
              "sessionID": {
                "type": "string",
                "pattern": "^ses_.*"
              },
              "todos": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Todo"
                }
              }
            },
            "required": [
              "sessionID",
              "todos"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.tui.command.execute": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "tui.command.execute"
          },
          "properties": {
            "type": "object",
            "properties": {
              "command": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "session.list",
                      "session.new",
                      "session.interrupt",
                      "session.compact",
                      "session.page.up",
                      "session.page.down",
                      "session.line.up",
                      "session.line.down",
                      "session.half.page.up",
                      "session.half.page.down",
                      "session.first",
                      "session.last",
                      "prompt.clear",
                      "prompt.submit",
                      "agent.cycle"
                    ]
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            },
            "required": [
              "command"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.tui.prompt.append": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "tui.prompt.append"
          },
          "properties": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string"
              }
            },
            "required": [
              "text"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.tui.session.select": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "tui.session.select"
          },
          "properties": {
            "type": "object",
            "properties": {
              "sessionID": {
                "description": "Session ID to navigate to",
                "type": "string",
                "pattern": "^ses_.*"
              }
            },
            "required": [
              "sessionID"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.tui.toast.show": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "tui.toast.show"
          },
          "properties": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "variant": {
                "type": "string",
                "enum": [
                  "info",
                  "success",
                  "warning",
                  "error"
                ]
              },
              "duration": {
                "description": "Duration in milliseconds",
                "type": "number"
              }
            },
            "required": [
              "message",
              "variant"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.vcs.branch.updated": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "vcs.branch.updated"
          },
          "properties": {
            "type": "object",
            "properties": {
              "branch": {
                "type": "string"
              }
            }
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.artifact.written": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.artifact.written"
          },
          "properties": {
            "type": "object",
            "properties": {
              "artifact": {
                "$ref": "#/components/schemas/WorkflowArtifactCompactEventRecord"
              }
            },
            "required": [
              "artifact"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.budget.appended": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.budget.appended"
          },
          "properties": {
            "type": "object",
            "properties": {
              "entry": {
                "$ref": "#/components/schemas/WorkflowBudgetLedgerEventEntry"
              }
            },
            "required": [
              "entry"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.budget.exceeded": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.budget.exceeded"
          },
          "properties": {
            "type": "object",
            "properties": {
              "entry": {
                "$ref": "#/components/schemas/WorkflowBudgetLedgerEventEntry"
              },
              "exceeded": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "entry",
              "exceeded"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.budget.warning": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.budget.warning"
          },
          "properties": {
            "type": "object",
            "properties": {
              "entry": {
                "$ref": "#/components/schemas/WorkflowBudgetLedgerEventEntry"
              },
              "warnings": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "entry",
              "warnings"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.child.cancelled": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.child.cancelled"
          },
          "properties": {
            "type": "object",
            "properties": {
              "child": {
                "$ref": "#/components/schemas/WorkflowChildEventRecord"
              }
            },
            "required": [
              "child"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.child.completed": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.child.completed"
          },
          "properties": {
            "type": "object",
            "properties": {
              "child": {
                "$ref": "#/components/schemas/WorkflowChildEventRecord"
              }
            },
            "required": [
              "child"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.child.created": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.child.created"
          },
          "properties": {
            "type": "object",
            "properties": {
              "child": {
                "$ref": "#/components/schemas/WorkflowChildEventRecord"
              }
            },
            "required": [
              "child"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.child.failed": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.child.failed"
          },
          "properties": {
            "type": "object",
            "properties": {
              "child": {
                "$ref": "#/components/schemas/WorkflowChildEventRecord"
              }
            },
            "required": [
              "child"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.child.started": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.child.started"
          },
          "properties": {
            "type": "object",
            "properties": {
              "child": {
                "$ref": "#/components/schemas/WorkflowChildEventRecord"
              }
            },
            "required": [
              "child"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.child.updated": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.child.updated"
          },
          "properties": {
            "type": "object",
            "properties": {
              "child": {
                "$ref": "#/components/schemas/WorkflowChildEventRecord"
              }
            },
            "required": [
              "child"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.phase.completed": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.phase.completed"
          },
          "properties": {
            "type": "object",
            "properties": {
              "phase": {
                "$ref": "#/components/schemas/WorkflowPhaseEventRecord"
              }
            },
            "required": [
              "phase"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.phase.failed": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.phase.failed"
          },
          "properties": {
            "type": "object",
            "properties": {
              "phase": {
                "$ref": "#/components/schemas/WorkflowPhaseEventRecord"
              }
            },
            "required": [
              "phase"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.phase.started": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.phase.started"
          },
          "properties": {
            "type": "object",
            "properties": {
              "phase": {
                "$ref": "#/components/schemas/WorkflowPhaseEventRecord"
              }
            },
            "required": [
              "phase"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.phase.updated": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.phase.updated"
          },
          "properties": {
            "type": "object",
            "properties": {
              "phase": {
                "$ref": "#/components/schemas/WorkflowPhaseEventRecord"
              }
            },
            "required": [
              "phase"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.run.blocked": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.run.blocked"
          },
          "properties": {
            "type": "object",
            "properties": {
              "run": {
                "$ref": "#/components/schemas/WorkflowRunEventRecord"
              }
            },
            "required": [
              "run"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.run.cancelled": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.run.cancelled"
          },
          "properties": {
            "type": "object",
            "properties": {
              "run": {
                "$ref": "#/components/schemas/WorkflowRunEventRecord"
              }
            },
            "required": [
              "run"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.run.completed": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.run.completed"
          },
          "properties": {
            "type": "object",
            "properties": {
              "run": {
                "$ref": "#/components/schemas/WorkflowRunEventRecord"
              }
            },
            "required": [
              "run"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.run.created": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.run.created"
          },
          "properties": {
            "type": "object",
            "properties": {
              "run": {
                "$ref": "#/components/schemas/WorkflowRunEventRecord"
              }
            },
            "required": [
              "run"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.run.failed": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.run.failed"
          },
          "properties": {
            "type": "object",
            "properties": {
              "run": {
                "$ref": "#/components/schemas/WorkflowRunEventRecord"
              }
            },
            "required": [
              "run"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.run.paused": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.run.paused"
          },
          "properties": {
            "type": "object",
            "properties": {
              "run": {
                "$ref": "#/components/schemas/WorkflowRunEventRecord"
              }
            },
            "required": [
              "run"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.run.resumed": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.run.resumed"
          },
          "properties": {
            "type": "object",
            "properties": {
              "run": {
                "$ref": "#/components/schemas/WorkflowRunEventRecord"
              }
            },
            "required": [
              "run"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.run.started": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.run.started"
          },
          "properties": {
            "type": "object",
            "properties": {
              "run": {
                "$ref": "#/components/schemas/WorkflowRunEventRecord"
              }
            },
            "required": [
              "run"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.run.updated": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.run.updated"
          },
          "properties": {
            "type": "object",
            "properties": {
              "run": {
                "$ref": "#/components/schemas/WorkflowRunEventRecord"
              }
            },
            "required": [
              "run"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.workflow.verification.attached": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "workflow.verification.attached"
          },
          "properties": {
            "type": "object",
            "properties": {
              "verification": {
                "$ref": "#/components/schemas/WorkflowVerificationAttachedEventRecord"
              }
            },
            "required": [
              "verification"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.worktree.failed": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "worktree.failed"
          },
          "properties": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              }
            },
            "required": [
              "message"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "Event.worktree.ready": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "worktree.ready"
          },
          "properties": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "branch": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "branch"
            ]
          }
        },
        "required": [
          "type",
          "properties"
        ]
      },
      "ExecutionGraph": {
        "type": "object",
        "properties": {
          "sessionID": {
            "type": "string"
          },
          "nodes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExecutionGraphNode"
            }
          },
          "edges": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExecutionGraphEdge"
            }
          },
          "metadata": {
            "$ref": "#/components/schemas/ExecutionGraphMetadata"
          }
        },
        "required": [
          "sessionID",
          "nodes",
          "edges",
          "metadata"
        ]
      },
      "ExecutionGraphEdge": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "sequence",
              "call_result",
              "step_contains"
            ]
          }
        },
        "required": [
          "from",
          "to",
          "type"
        ]
      },
      "ExecutionGraphMetadata": {
        "type": "object",
        "properties": {
          "duration": {
            "type": "number"
          },
          "tokens": {
            "$ref": "#/components/schemas/ExecutionGraphTokens"
          },
          "risk": {
            "$ref": "#/components/schemas/ExecutionGraphRisk"
          },
          "agents": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "steps": {
            "type": "number"
          },
          "errors": {
            "type": "number"
          }
        },
        "required": [
          "duration",
          "tokens",
          "risk",
          "agents",
          "tools",
          "steps",
          "errors"
        ]
      },
      "ExecutionGraphNode": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "session",
              "step",
              "tool_call",
              "tool_result",
              "agent_route",
              "llm",
              "error"
            ]
          },
          "label": {
            "type": "string"
          },
          "timestamp": {
            "type": "number"
          },
          "duration": {
            "type": "number"
          },
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "error",
              "pending"
            ]
          },
          "stepIndex": {
            "type": "number"
          },
          "callID": {
            "type": "string"
          },
          "tool": {
            "type": "string"
          },
          "agent": {
            "type": "string"
          },
          "confidence": {
            "type": "number"
          },
          "tokens": {
            "$ref": "#/components/schemas/ExecutionGraphTokens"
          }
        },
        "required": [
          "id",
          "type",
          "label",
          "timestamp"
        ]
      },
      "ExecutionGraphResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/ExecutionGraph"
          }
        },
        "required": [
          "data"
        ]
      },
      "ExecutionGraphRisk": {
        "type": "object",
        "properties": {
          "level": {
            "type": "string",
            "enum": [
              "LOW",
              "MEDIUM",
              "HIGH",
              "CRITICAL"
            ]
          },
          "score": {
            "type": "number"
          },
          "summary": {
            "type": "string"
          }
        },
        "required": [
          "level",
          "score",
          "summary"
        ]
      },
      "ExecutionGraphTokens": {
        "type": "object",
        "properties": {
          "input": {
            "type": "number"
          },
          "output": {
            "type": "number"
          }
        },
        "required": [
          "input",
          "output"
        ]
      },
      "ExecutionGraphTopologyHeading": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "const": "heading"
          },
          "text": {
            "type": "string"
          }
        },
        "required": [
          "kind",
          "text"
        ]
      },
      "ExecutionGraphTopologyLine": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ExecutionGraphTopologyHeading"
          },
          {
            "$ref": "#/components/schemas/ExecutionGraphTopologyPath"
          },
          {
            "$ref": "#/components/schemas/ExecutionGraphTopologyStep"
          },
          {
            "$ref": "#/components/schemas/ExecutionGraphTopologyPair"
          }
        ]
      },
      "ExecutionGraphTopologyPair": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "const": "pair"
          },
          "text": {
            "type": "string"
          },
          "call": {
            "type": "string"
          },
          "result": {
            "type": "string"
          }
        },
        "required": [
          "kind",
          "text",
          "call",
          "result"
        ]
      },
      "ExecutionGraphTopologyPath": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "const": "path"
          },
          "text": {
            "type": "string"
          },
          "nodes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "kind",
          "text",
          "nodes"
        ]
      },
      "ExecutionGraphTopologyResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExecutionGraphTopologyLine"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "ExecutionGraphTopologyStep": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "const": "step"
          },
          "text": {
            "type": "string"
          },
          "stepIndex": {
            "type": "number"
          },
          "nodes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "kind",
          "text",
          "stepIndex",
          "nodes"
        ]
      },
      "File": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "added": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "removed": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "status": {
            "type": "string",
            "enum": [
              "added",
              "deleted",
              "modified"
            ]
          }
        },
        "required": [
          "path",
          "added",
          "removed",
          "status"
        ]
      },
      "FileContent": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "text",
              "binary"
            ]
          },
          "content": {
            "type": "string"
          },
          "diff": {
            "type": "string"
          },
          "patch": {
            "type": "object",
            "properties": {
              "oldFileName": {
                "type": "string"
              },
              "newFileName": {
                "type": "string"
              },
              "oldHeader": {
                "type": "string"
              },
              "newHeader": {
                "type": "string"
              },
              "hunks": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "oldStart": {
                      "type": "number"
                    },
                    "oldLines": {
                      "type": "number"
                    },
                    "newStart": {
                      "type": "number"
                    },
                    "newLines": {
                      "type": "number"
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "oldStart",
                    "oldLines",
                    "newStart",
                    "newLines",
                    "lines"
                  ]
                }
              },
              "index": {
                "type": "string"
              }
            },
            "required": [
              "oldFileName",
              "newFileName",
              "hunks"
            ]
          },
          "encoding": {
            "type": "string",
            "const": "base64"
          },
          "mimeType": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "content"
        ]
      },
      "FileDiff": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string"
          },
          "before": {
            "type": "string"
          },
          "after": {
            "type": "string"
          },
          "additions": {
            "type": "number"
          },
          "deletions": {
            "type": "number"
          },
          "status": {
            "type": "string",
            "enum": [
              "added",
              "deleted",
              "modified"
            ]
          }
        },
        "required": [
          "file",
          "before",
          "after",
          "additions",
          "deletions"
        ]
      },
      "FileNode": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "absolute": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "file",
              "directory"
            ]
          },
          "ignored": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "path",
          "absolute",
          "type",
          "ignored"
        ]
      },
      "FilePart": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^prt_.*"
          },
          "sessionID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "messageID": {
            "type": "string",
            "pattern": "^msg_.*"
          },
          "type": {
            "type": "string",
            "const": "file"
          },
          "mime": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "source": {
            "$ref": "#/components/schemas/FilePartSource"
          }
        },
        "required": [
          "id",
          "sessionID",
          "messageID",
          "type",
          "mime",
          "url"
        ]
      },
      "FilePartInput": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^prt_.*"
          },
          "type": {
            "type": "string",
            "const": "file"
          },
          "mime": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "source": {
            "$ref": "#/components/schemas/FilePartSource"
          }
        },
        "required": [
          "type",
          "mime",
          "url"
        ]
      },
      "FilePartSource": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/FileSource"
          },
          {
            "$ref": "#/components/schemas/SymbolSource"
          },
          {
            "$ref": "#/components/schemas/ResourceSource"
          }
        ]
      },
      "FilePartSourceText": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string"
          },
          "start": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "end": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "value",
          "start",
          "end"
        ]
      },
      "FileSource": {
        "type": "object",
        "properties": {
          "text": {
            "$ref": "#/components/schemas/FilePartSourceText"
          },
          "type": {
            "type": "string",
            "const": "file"
          },
          "path": {
            "type": "string"
          }
        },
        "required": [
          "text",
          "type",
          "path"
        ]
      },
      "FixedContextInput": {
        "type": "object",
        "properties": {
          "files": {
            "minItems": 1,
            "maxItems": 14,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          },
          "question": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "providerID": {
            "type": "string"
          },
          "modelID": {
            "type": "string"
          },
          "maxTokens": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4096
          }
        },
        "required": [
          "files",
          "question",
          "providerID",
          "modelID"
        ],
        "additionalProperties": false
      },
      "FixedContextOutput": {
        "type": "object",
        "properties": {
          "answer": {
            "type": "string"
          },
          "cache": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "HIT",
                  "EXACT_HIT",
                  "MISS",
                  "BYPASS",
                  "UNREPORTED"
                ]
              },
              "score": {
                "type": "number"
              }
            },
            "required": [
              "status"
            ]
          },
          "contextDigest": {
            "type": "string"
          },
          "providerID": {
            "type": "string"
          },
          "modelID": {
            "type": "string"
          },
          "requestID": {
            "type": "string"
          },
          "usage": {}
        },
        "required": [
          "answer",
          "cache",
          "contextDigest",
          "providerID",
          "modelID"
        ]
      },
      "FormatterStatus": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "extensions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "extensions",
          "enabled"
        ]
      },
      "GlobalEvent": {
        "type": "object",
        "properties": {
          "directory": {
            "type": "string"
          },
          "payload": {
            "$ref": "#/components/schemas/Event"
          }
        },
        "required": [
          "directory",
          "payload"
        ]
      },
      "GlobalSession": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "slug": {
            "type": "string"
          },
          "projectID": {
            "type": "string"
          },
          "directory": {
            "type": "string"
          },
          "parentID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "summary": {
            "type": "object",
            "properties": {
              "additions": {
                "type": "number"
              },
              "deletions": {
                "type": "number"
              },
              "files": {
                "type": "number"
              },
              "diffs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/FileDiff"
                }
              }
            },
            "required": [
              "additions",
              "deletions",
              "files"
            ]
          },
          "share": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              }
            },
            "required": [
              "url"
            ]
          },
          "title": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              },
              "updated": {
                "type": "number"
              },
              "compacting": {
                "type": "number"
              },
              "archived": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "created",
              "updated"
            ]
          },
          "permission": {
            "$ref": "#/components/schemas/PermissionRuleset"
          },
          "revert": {
            "type": "object",
            "properties": {
              "messageID": {
                "type": "string",
                "pattern": "^msg_.*"
              },
              "partID": {
                "type": "string",
                "pattern": "^prt_.*"
              },
              "snapshot": {
                "type": "string"
              },
              "diff": {
                "type": "string"
              }
            },
            "required": [
              "messageID"
            ]
          },
          "lastRecap": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string",
                "minLength": 1,
                "maxLength": 400
              },
              "time": {
                "type": "number"
              },
              "scope": {
                "type": "string",
                "enum": [
                  "turn",
                  "conversation"
                ]
              }
            },
            "required": [
              "text",
              "time",
              "scope"
            ]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "project": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ProjectSummary"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "slug",
          "projectID",
          "directory",
          "title",
          "version",
          "time",
          "project"
        ]
      },
      "IsolationBackend": {
        "description": "Isolation enforcement backend: app (portable tool checks, default), os (kernel sandbox for bash when available), auto (prefer os with app fallback)",
        "type": "string",
        "enum": [
          "app",
          "os",
          "auto"
        ]
      },
      "IsolationConfig": {
        "description": "Execution isolation configuration",
        "type": "object",
        "properties": {
          "mode": {
            "$ref": "#/components/schemas/IsolationMode"
          },
          "network": {
            "description": "Allow network access from tools. Defaults to enabled in full-access and disabled in read-only and workspace-write modes",
            "type": "boolean"
          },
          "protected": {
            "description": "Additional paths relative to workspace root that are protected from writes. .git and .ax-code are always protected",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "backend": {
            "$ref": "#/components/schemas/IsolationBackend"
          }
        },
        "additionalProperties": false
      },
      "IsolationMode": {
        "description": "Isolation mode: read-only blocks all mutations, workspace-write allows writes inside workspace only, full-access disables isolation. Defaults to full-access (sandbox off)",
        "type": "string",
        "enum": [
          "read-only",
          "workspace-write",
          "full-access"
        ]
      },
      "IsolationState": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "read-only",
              "workspace-write",
              "full-access"
            ]
          },
          "network": {
            "type": "boolean"
          }
        },
        "required": [
          "mode",
          "network"
        ]
      },
      "JSONSchema": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {}
      },
      "LSPStatus": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "root": {
            "type": "string"
          },
          "status": {
            "anyOf": [
              {
                "type": "string",
                "const": "connected"
              },
              {
                "type": "string",
                "const": "error"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "root",
          "status"
        ]
      },
      "LayoutConfig": {
        "description": "@deprecated Always uses stretch layout.",
        "type": "string",
        "enum": [
          "auto",
          "stretch"
        ]
      },
      "LogLevel": {
        "description": "Log level",
        "type": "string",
        "enum": [
          "DEBUG",
          "INFO",
          "WARN",
          "ERROR"
        ]
      },
      "MCPStatus": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/MCPStatusConnected"
          },
          {
            "$ref": "#/components/schemas/MCPStatusDisabled"
          },
          {
            "$ref": "#/components/schemas/MCPStatusFailed"
          },
          {
            "$ref": "#/components/schemas/MCPStatusNeedsAuth"
          },
          {
            "$ref": "#/components/schemas/MCPStatusNeedsClientRegistration"
          },
          {
            "$ref": "#/components/schemas/MCPStatusNeedsTrust"
          },
          {
            "$ref": "#/components/schemas/MCPStatusBlocked"
          }
        ]
      },
      "MCPStatusBlocked": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "const": "blocked"
          },
          "reason": {
            "type": "string",
            "enum": [
              "managed_policy",
              "managed_origins",
              "persistent_profile",
              "vendored"
            ]
          },
          "error": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "reason",
          "error"
        ]
      },
      "MCPStatusConnected": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "const": "connected"
          }
        },
        "required": [
          "status"
        ]
      },
      "MCPStatusDisabled": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "const": "disabled"
          }
        },
        "required": [
          "status"
        ]
      },
      "MCPStatusFailed": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "const": "failed"
          },
          "error": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "error"
        ]
      },
      "MCPStatusNeedsAuth": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "const": "needs_auth"
          }
        },
        "required": [
          "status"
        ]
      },
      "MCPStatusNeedsClientRegistration": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "const": "needs_client_registration"
          },
          "error": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "error"
        ]
      },
      "MCPStatusNeedsTrust": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "const": "needs_trust"
          },
          "fingerprint": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "wellknown",
                  "global",
                  "custom",
                  "project",
                  "config_directory",
                  "inline",
                  "account",
                  "managed",
                  "runtime",
                  "unknown"
                ]
              },
              "path": {
                "type": "string"
              },
              "url": {
                "type": "string"
              }
            },
            "required": [
              "kind"
            ]
          }
        },
        "required": [
          "status",
          "fingerprint",
          "source"
        ]
      },
      "McpLocalConfig": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "local",
            "description": "Type of MCP server connection"
          },
          "command": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Command and arguments to run the MCP server"
          },
          "environment": {
            "description": "Environment variables to set when running the MCP server",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "enabled": {
            "description": "Enable or disable the MCP server on startup",
            "type": "boolean"
          },
          "timeout": {
            "description": "Timeout in ms for MCP server requests. Defaults to 30000 (30 seconds) if not specified.",
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "webmcp": {
            "$ref": "#/components/schemas/WebMcpProfileConfig"
          }
        },
        "required": [
          "type",
          "command"
        ],
        "additionalProperties": false
      },
      "McpOAuthConfig": {
        "type": "object",
        "properties": {
          "clientId": {
            "description": "OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted.",
            "type": "string"
          },
          "clientSecret": {
            "description": "OAuth client secret (if required by the authorization server)",
            "type": "string"
          },
          "scope": {
            "description": "OAuth scopes to request during authorization",
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "McpReadResourceResult": {
        "type": "object",
        "properties": {
          "contents": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "uri": {
                      "type": "string"
                    },
                    "mimeType": {
                      "type": "string"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "text"
                  ],
                  "additionalProperties": {}
                },
                {
                  "type": "object",
                  "properties": {
                    "uri": {
                      "type": "string"
                    },
                    "mimeType": {
                      "type": "string"
                    },
                    "blob": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "blob"
                  ],
                  "additionalProperties": {}
                }
              ]
            }
          }
        },
        "required": [
          "contents"
        ],
        "additionalProperties": {}
      },
      "McpRemoteConfig": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "remote",
            "description": "Type of MCP server connection"
          },
          "url": {
            "type": "string",
            "description": "URL of the remote MCP server"
          },
          "allowLoopback": {
            "description": "Opt in to localhost, 127.0.0.1, or [::1] HTTP(S) MCP on the configured origin only. Defaults to false; project entries still require trust.",
            "type": "boolean"
          },
          "enabled": {
            "description": "Enable or disable the MCP server on startup",
            "type": "boolean"
          },
          "headers": {
            "description": "Headers to send with the request",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "oauth": {
            "description": "OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection.",
            "anyOf": [
              {
                "$ref": "#/components/schemas/McpOAuthConfig"
              },
              {
                "type": "boolean",
                "const": false
              }
            ]
          },
          "timeout": {
            "description": "Timeout in ms for MCP server requests. Defaults to 30000 (30 seconds) if not specified.",
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "type",
          "url"
        ],
        "additionalProperties": false
      },
      "McpResource": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "uri": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "mimeType": {
            "type": "string"
          },
          "client": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "uri",
          "client"
        ]
      },
      "Message": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/UserMessage"
          },
          {
            "$ref": "#/components/schemas/AssistantMessage"
          }
        ]
      },
      "MessageAbortedError": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "const": "MessageAbortedError"
          },
          "data": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "metadata": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            },
            "required": [
              "message"
            ]
          }
        },
        "required": [
          "name",
          "data"
        ]
      },
      "MessageOutputLengthError": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "const": "MessageOutputLengthError"
          },
          "data": {
            "type": "object",
            "properties": {}
          }
        },
        "required": [
          "name",
          "data"
        ]
      },
      "MessageOutputLoopError": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "const": "MessageOutputLoopError"
          },
          "data": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "metadata": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            },
            "required": [
              "message"
            ]
          }
        },
        "required": [
          "name",
          "data"
        ]
      },
      "Model": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "providerID": {
            "type": "string"
          },
          "api": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "npm": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "url",
              "npm"
            ]
          },
          "name": {
            "type": "string"
          },
          "family": {
            "type": "string"
          },
          "capabilities": {
            "type": "object",
            "properties": {
              "temperature": {
                "type": "boolean"
              },
              "reasoning": {
                "type": "boolean"
              },
              "attachment": {
                "type": "boolean"
              },
              "toolcall": {
                "type": "boolean"
              },
              "input": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "boolean"
                  },
                  "audio": {
                    "type": "boolean"
                  },
                  "image": {
                    "type": "boolean"
                  },
                  "video": {
                    "type": "boolean"
                  },
                  "pdf": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "text",
                  "audio",
                  "image",
                  "video",
                  "pdf"
                ]
              },
              "output": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "boolean"
                  },
                  "audio": {
                    "type": "boolean"
                  },
                  "image": {
                    "type": "boolean"
                  },
                  "video": {
                    "type": "boolean"
                  },
                  "pdf": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "text",
                  "audio",
                  "image",
                  "video",
                  "pdf"
                ]
              },
              "interleaved": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "field": {
                        "type": "string",
                        "enum": [
                          "reasoning_content",
                          "reasoning_details"
                        ]
                      }
                    },
                    "required": [
                      "field"
                    ]
                  }
                ]
              },
              "websearch": {
                "type": "boolean"
              }
            },
            "required": [
              "temperature",
              "reasoning",
              "attachment",
              "toolcall",
              "input",
              "output",
              "interleaved"
            ]
          },
          "limit": {
            "type": "object",
            "properties": {
              "context": {
                "type": "number"
              },
              "input": {
                "type": "number"
              },
              "output": {
                "type": "number"
              }
            },
            "required": [
              "context",
              "output"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "alpha",
              "beta",
              "deprecated",
              "active"
            ]
          },
          "options": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "headers": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "release_date": {
            "type": "string"
          },
          "variants": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            }
          }
        },
        "required": [
          "id",
          "providerID",
          "api",
          "name",
          "capabilities",
          "limit",
          "status",
          "options",
          "headers",
          "release_date"
        ]
      },
      "OutputFormat": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/OutputFormatText"
          },
          {
            "$ref": "#/components/schemas/OutputFormatJsonSchema"
          }
        ]
      },
      "OutputFormatJsonSchema": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "json_schema"
          },
          "schema": {
            "$ref": "#/components/schemas/JSONSchema"
          },
          "retryCount": {
            "default": 2,
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "type",
          "schema"
        ]
      },
      "OutputFormatText": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "text"
          }
        },
        "required": [
          "type"
        ]
      },
      "Part": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/TextPart"
          },
          {
            "$ref": "#/components/schemas/SubtaskPart"
          },
          {
            "$ref": "#/components/schemas/ReasoningPart"
          },
          {
            "$ref": "#/components/schemas/FilePart"
          },
          {
            "$ref": "#/components/schemas/ToolPart"
          },
          {
            "$ref": "#/components/schemas/StepStartPart"
          },
          {
            "$ref": "#/components/schemas/StepFinishPart"
          },
          {
            "$ref": "#/components/schemas/SnapshotPart"
          },
          {
            "$ref": "#/components/schemas/PatchPart"
          },
          {
            "$ref": "#/components/schemas/AgentPart"
          },
          {
            "$ref": "#/components/schemas/RetryPart"
          },
          {
            "$ref": "#/components/schemas/CompactionPart"
          }
        ]
      },
      "PatchPart": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^prt_.*"
          },
          "sessionID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "messageID": {
            "type": "string",
            "pattern": "^msg_.*"
          },
          "type": {
            "type": "string",
            "const": "patch"
          },
          "hash": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "externalFiles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "id",
          "sessionID",
          "messageID",
          "type",
          "hash",
          "files"
        ]
      },
      "Path": {
        "type": "object",
        "properties": {
          "home": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "config": {
            "type": "string"
          },
          "worktree": {
            "type": "string"
          },
          "directory": {
            "type": "string"
          }
        },
        "required": [
          "home",
          "state",
          "config",
          "worktree",
          "directory"
        ]
      },
      "PermissionAction": {
        "type": "string",
        "enum": [
          "allow",
          "deny",
          "ask"
        ]
      },
      "PermissionActionConfig": {
        "type": "string",
        "enum": [
          "ask",
          "allow",
          "deny"
        ]
      },
      "PermissionConfig": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "__originalKeys": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "read": {
                "$ref": "#/components/schemas/PermissionRuleConfig"
              },
              "edit": {
                "$ref": "#/components/schemas/PermissionRuleConfig"
              },
              "glob": {
                "$ref": "#/components/schemas/PermissionRuleConfig"
              },
              "grep": {
                "$ref": "#/components/schemas/PermissionRuleConfig"
              },
              "list": {
                "$ref": "#/components/schemas/PermissionRuleConfig"
              },
              "bash": {
                "$ref": "#/components/schemas/PermissionRuleConfig"
              },
              "task": {
                "$ref": "#/components/schemas/PermissionRuleConfig"
              },
              "external_directory": {
                "$ref": "#/components/schemas/PermissionRuleConfig"
              },
              "todowrite": {
                "$ref": "#/components/schemas/PermissionActionConfig"
              },
              "todoread": {
                "$ref": "#/components/schemas/PermissionActionConfig"
              },
              "question": {
                "$ref": "#/components/schemas/PermissionActionConfig"
              },
              "webfetch": {
                "$ref": "#/components/schemas/PermissionActionConfig"
              },
              "websearch": {
                "$ref": "#/components/schemas/PermissionActionConfig"
              },
              "codesearch": {
                "$ref": "#/components/schemas/PermissionActionConfig"
              },
              "lsp": {
                "$ref": "#/components/schemas/PermissionRuleConfig"
              },
              "doom_loop": {
                "$ref": "#/components/schemas/PermissionActionConfig"
              },
              "skill": {
                "$ref": "#/components/schemas/PermissionRuleConfig"
              }
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/PermissionRuleConfig"
            }
          },
          {
            "$ref": "#/components/schemas/PermissionActionConfig"
          }
        ]
      },
      "PermissionObjectConfig": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {
          "$ref": "#/components/schemas/PermissionActionConfig"
        }
      },
      "PermissionRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^per_.*"
          },
          "sessionID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "permission": {
            "type": "string"
          },
          "patterns": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "always": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "webmcpAllowlist": {
            "$ref": "#/components/schemas/WebMcpApprovalSummary"
          },
          "autoOnceAt": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "tool": {
            "type": "object",
            "properties": {
              "messageID": {
                "type": "string",
                "pattern": "^msg_.*"
              },
              "callID": {
                "type": "string"
              }
            },
            "required": [
              "messageID",
              "callID"
            ]
          }
        },
        "required": [
          "id",
          "sessionID",
          "permission",
          "patterns",
          "metadata",
          "always"
        ]
      },
      "PermissionRule": {
        "type": "object",
        "properties": {
          "permission": {
            "type": "string"
          },
          "pattern": {
            "type": "string"
          },
          "action": {
            "$ref": "#/components/schemas/PermissionAction"
          }
        },
        "required": [
          "permission",
          "pattern",
          "action"
        ]
      },
      "PermissionRuleConfig": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/PermissionActionConfig"
          },
          {
            "$ref": "#/components/schemas/PermissionObjectConfig"
          }
        ]
      },
      "PermissionRuleset": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/PermissionRule"
        }
      },
      "Project": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "worktree": {
            "type": "string"
          },
          "vcs": {
            "type": "string",
            "const": "git"
          },
          "name": {
            "type": "string"
          },
          "icon": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              },
              "override": {
                "type": "string"
              },
              "color": {
                "type": "string"
              }
            }
          },
          "commands": {
            "type": "object",
            "properties": {
              "start": {
                "description": "Startup script to run when creating a new workspace (worktree)",
                "type": "string"
              }
            }
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              },
              "updated": {
                "type": "number"
              },
              "initialized": {
                "type": "number"
              }
            },
            "required": [
              "created",
              "updated"
            ]
          },
          "sandboxes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "id",
          "worktree",
          "time",
          "sandboxes"
        ]
      },
      "ProjectSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "worktree": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "worktree"
        ]
      },
      "Provider": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "env",
              "config",
              "custom",
              "api"
            ]
          },
          "env": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "key": {
            "type": "string"
          },
          "options": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "models": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/Model"
            }
          }
        },
        "required": [
          "id",
          "name",
          "source",
          "env",
          "options",
          "models"
        ]
      },
      "ProviderAuthAuthorization": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          },
          "method": {
            "anyOf": [
              {
                "type": "string",
                "const": "auto"
              },
              {
                "type": "string",
                "const": "code"
              }
            ]
          },
          "instructions": {
            "type": "string"
          }
        },
        "required": [
          "url",
          "method",
          "instructions"
        ]
      },
      "ProviderAuthError": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "const": "ProviderAuthError"
          },
          "data": {
            "type": "object",
            "properties": {
              "providerID": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "providerID",
              "message"
            ]
          }
        },
        "required": [
          "name",
          "data"
        ]
      },
      "ProviderAuthMethod": {
        "type": "object",
        "properties": {
          "type": {
            "anyOf": [
              {
                "type": "string",
                "const": "oauth"
              },
              {
                "type": "string",
                "const": "api"
              }
            ]
          },
          "label": {
            "type": "string"
          },
          "prompts": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "text"
                    },
                    "key": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "placeholder": {
                      "type": "string"
                    },
                    "when": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string"
                        },
                        "op": {
                          "anyOf": [
                            {
                              "type": "string",
                              "const": "eq"
                            },
                            {
                              "type": "string",
                              "const": "neq"
                            }
                          ]
                        },
                        "value": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "key",
                        "op",
                        "value"
                      ]
                    }
                  },
                  "required": [
                    "type",
                    "key",
                    "message"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "select"
                    },
                    "key": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "options": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "label": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          },
                          "hint": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "label",
                          "value"
                        ]
                      }
                    },
                    "when": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string"
                        },
                        "op": {
                          "anyOf": [
                            {
                              "type": "string",
                              "const": "eq"
                            },
                            {
                              "type": "string",
                              "const": "neq"
                            }
                          ]
                        },
                        "value": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "key",
                        "op",
                        "value"
                      ]
                    }
                  },
                  "required": [
                    "type",
                    "key",
                    "message",
                    "options"
                  ]
                }
              ]
            }
          }
        },
        "required": [
          "type",
          "label"
        ]
      },
      "ProviderConfig": {
        "type": "object",
        "properties": {
          "api": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "env": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "id": {
            "type": "string"
          },
          "npm": {
            "type": "string"
          },
          "options": {
            "type": "object",
            "properties": {
              "apiKey": {
                "type": "string"
              },
              "baseURL": {
                "type": "string"
              },
              "enterpriseUrl": {
                "description": "GitHub Enterprise URL for copilot authentication",
                "type": "string"
              },
              "setCacheKey": {
                "description": "Enable promptCacheKey for this provider (default false)",
                "type": "boolean"
              },
              "axTrust": {
                "description": "Send X-AX-Prompt-Cache-Key for AX Trust session affinity. AX Trust connections send it by default; set false to disable. Other providers send it only when true.",
                "type": "boolean"
              },
              "timeout": {
                "anyOf": [
                  {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991,
                    "description": "Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout."
                  },
                  {
                    "type": "boolean",
                    "const": false,
                    "description": "Disable timeout for this provider entirely."
                  }
                ]
              },
              "chunkTimeout": {
                "description": "Timeout in milliseconds between streamed SSE chunks for this provider. If no chunk arrives within this window, the request is aborted.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "toolProfile": {
                "description": "Tool surface: \"coding\" focuses on coding, delegation and verification; \"full\" exposes every enabled tool (cloud default). AX Engine defaults to the smaller \"core\" profile.",
                "type": "string",
                "enum": [
                  "core",
                  "coding",
                  "full"
                ]
              }
            },
            "additionalProperties": {}
          },
          "models": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "family": {
                  "type": "string"
                },
                "release_date": {
                  "type": "string"
                },
                "attachment": {
                  "type": "boolean"
                },
                "reasoning": {
                  "type": "boolean"
                },
                "temperature": {
                  "default": false,
                  "type": "boolean"
                },
                "tool_call": {
                  "type": "boolean"
                },
                "interleaved": {
                  "anyOf": [
                    {
                      "type": "boolean",
                      "const": true
                    },
                    {
                      "type": "object",
                      "properties": {
                        "field": {
                          "type": "string",
                          "enum": [
                            "reasoning_content",
                            "reasoning_details"
                          ]
                        }
                      },
                      "required": [
                        "field"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "limit": {
                  "type": "object",
                  "properties": {
                    "context": {
                      "type": "number"
                    },
                    "input": {
                      "type": "number"
                    },
                    "output": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "context",
                    "output"
                  ]
                },
                "modalities": {
                  "type": "object",
                  "properties": {
                    "input": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "text",
                          "audio",
                          "image",
                          "video",
                          "pdf"
                        ]
                      }
                    },
                    "output": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "text",
                          "audio",
                          "image",
                          "video",
                          "pdf"
                        ]
                      }
                    }
                  },
                  "required": [
                    "input",
                    "output"
                  ]
                },
                "experimental": {
                  "anyOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "alpha",
                    "beta",
                    "deprecated",
                    "active"
                  ]
                },
                "options": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                },
                "headers": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string"
                  }
                },
                "provider": {
                  "type": "object",
                  "properties": {
                    "npm": {
                      "type": "string"
                    },
                    "api": {
                      "type": "string"
                    }
                  }
                },
                "variants": {
                  "description": "Variant-specific configuration",
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "disabled": {
                        "description": "Disable this variant for the model",
                        "type": "boolean"
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "websearch": {
                  "type": "boolean"
                }
              }
            }
          },
          "management": {
            "type": "string",
            "enum": [
              "custom-api",
              "ax-trust"
            ]
          },
          "whitelist": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "blacklist": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": false
      },
      "Pty": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^pty_.*"
          },
          "title": {
            "type": "string"
          },
          "command": {
            "type": "string"
          },
          "args": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "cwd": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "exited"
            ]
          },
          "pid": {
            "type": "number"
          }
        },
        "required": [
          "id",
          "title",
          "command",
          "args",
          "cwd",
          "status",
          "pid"
        ]
      },
      "QuestionAnswer": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "QuestionInfo": {
        "type": "object",
        "properties": {
          "question": {
            "type": "string",
            "description": "Complete question"
          },
          "header": {
            "type": "string",
            "description": "Very short label (max 30 chars)"
          },
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuestionOption"
            },
            "description": "Available choices"
          },
          "multiple": {
            "description": "Allow selecting multiple choices",
            "type": "boolean"
          },
          "custom": {
            "description": "Allow typing a custom answer (default: true)",
            "type": "boolean"
          }
        },
        "required": [
          "question",
          "header",
          "options"
        ]
      },
      "QuestionOption": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "description": "Display text (1-5 words, concise)"
          },
          "description": {
            "type": "string",
            "description": "Explanation of choice"
          }
        },
        "required": [
          "label",
          "description"
        ]
      },
      "QuestionRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^que_.*"
          },
          "sessionID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "questions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuestionInfo"
            },
            "description": "Questions to ask"
          },
          "tool": {
            "type": "object",
            "properties": {
              "messageID": {
                "type": "string",
                "pattern": "^msg_.*"
              },
              "callID": {
                "type": "string"
              }
            },
            "required": [
              "messageID",
              "callID"
            ]
          }
        },
        "required": [
          "id",
          "sessionID",
          "questions"
        ]
      },
      "Range": {
        "type": "object",
        "properties": {
          "start": {
            "type": "object",
            "properties": {
              "line": {
                "type": "number"
              },
              "character": {
                "type": "number"
              }
            },
            "required": [
              "line",
              "character"
            ]
          },
          "end": {
            "type": "object",
            "properties": {
              "line": {
                "type": "number"
              },
              "character": {
                "type": "number"
              }
            },
            "required": [
              "line",
              "character"
            ]
          }
        },
        "required": [
          "start",
          "end"
        ]
      },
      "ReasoningPart": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^prt_.*"
          },
          "sessionID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "messageID": {
            "type": "string",
            "pattern": "^msg_.*"
          },
          "type": {
            "type": "string",
            "const": "reasoning"
          },
          "text": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "time": {
            "type": "object",
            "properties": {
              "start": {
                "type": "number"
              },
              "end": {
                "type": "number"
              }
            },
            "required": [
              "start"
            ]
          }
        },
        "required": [
          "id",
          "sessionID",
          "messageID",
          "type",
          "text",
          "time"
        ]
      },
      "RequestTooLargeError": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "const": "RequestTooLargeError"
          },
          "data": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "responseBody": {
                "type": "string"
              }
            },
            "required": [
              "message"
            ]
          }
        },
        "required": [
          "name",
          "data"
        ]
      },
      "ResourceSource": {
        "type": "object",
        "properties": {
          "text": {
            "$ref": "#/components/schemas/FilePartSourceText"
          },
          "type": {
            "type": "string",
            "const": "resource"
          },
          "clientName": {
            "type": "string"
          },
          "uri": {
            "type": "string"
          }
        },
        "required": [
          "text",
          "type",
          "clientName",
          "uri"
        ]
      },
      "RetryPart": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^prt_.*"
          },
          "sessionID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "messageID": {
            "type": "string",
            "pattern": "^msg_.*"
          },
          "type": {
            "type": "string",
            "const": "retry"
          },
          "attempt": {
            "type": "number"
          },
          "error": {
            "$ref": "#/components/schemas/APIError"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              }
            },
            "required": [
              "created"
            ]
          }
        },
        "required": [
          "id",
          "sessionID",
          "messageID",
          "type",
          "attempt",
          "error",
          "time"
        ]
      },
      "ServerConfig": {
        "description": "Server configuration for ax-code serve and web commands",
        "type": "object",
        "properties": {
          "port": {
            "description": "Port to listen on",
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 65535
          },
          "hostname": {
            "description": "Loopback hostname to listen on; network binds are disabled",
            "type": "string"
          },
          "mdns": {
            "description": "Deprecated; mDNS discovery is disabled",
            "type": "boolean"
          },
          "mdnsDomain": {
            "description": "Deprecated; mDNS discovery is disabled",
            "type": "string"
          },
          "cors": {
            "description": "Additional loopback origins to allow for CORS",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": false
      },
      "Session": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "slug": {
            "type": "string"
          },
          "projectID": {
            "type": "string"
          },
          "directory": {
            "type": "string"
          },
          "parentID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "summary": {
            "type": "object",
            "properties": {
              "additions": {
                "type": "number"
              },
              "deletions": {
                "type": "number"
              },
              "files": {
                "type": "number"
              },
              "diffs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/FileDiff"
                }
              }
            },
            "required": [
              "additions",
              "deletions",
              "files"
            ]
          },
          "share": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              }
            },
            "required": [
              "url"
            ]
          },
          "title": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              },
              "updated": {
                "type": "number"
              },
              "compacting": {
                "type": "number"
              },
              "archived": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "created",
              "updated"
            ]
          },
          "permission": {
            "$ref": "#/components/schemas/PermissionRuleset"
          },
          "revert": {
            "type": "object",
            "properties": {
              "messageID": {
                "type": "string",
                "pattern": "^msg_.*"
              },
              "partID": {
                "type": "string",
                "pattern": "^prt_.*"
              },
              "snapshot": {
                "type": "string"
              },
              "diff": {
                "type": "string"
              }
            },
            "required": [
              "messageID"
            ]
          },
          "lastRecap": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string",
                "minLength": 1,
                "maxLength": 400
              },
              "time": {
                "type": "number"
              },
              "scope": {
                "type": "string",
                "enum": [
                  "turn",
                  "conversation"
                ]
              }
            },
            "required": [
              "text",
              "time",
              "scope"
            ]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "id",
          "slug",
          "projectID",
          "directory",
          "title",
          "version",
          "time"
        ]
      },
      "SessionBranchFamily": {
        "type": "object",
        "properties": {
          "currentID": {
            "type": "string"
          },
          "recommendedID": {
            "type": "string"
          },
          "confidence": {
            "type": "number"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionBranchItem"
            }
          },
          "root": {
            "$ref": "#/components/schemas/Session"
          },
          "current": {
            "$ref": "#/components/schemas/Session"
          },
          "recommended": {
            "$ref": "#/components/schemas/SessionBranchItem"
          }
        },
        "required": [
          "currentID",
          "recommendedID",
          "confidence",
          "reasons",
          "items",
          "root",
          "current",
          "recommended"
        ]
      },
      "SessionBranchItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "risk": {
            "$ref": "#/components/schemas/SessionBranchRisk"
          },
          "view": {
            "$ref": "#/components/schemas/SessionBranchView"
          },
          "decision": {
            "$ref": "#/components/schemas/SessionBranchScorecard"
          },
          "headline": {
            "type": "string"
          },
          "semantic": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SessionSemanticDiffSummary"
              },
              {
                "type": "null"
              }
            ]
          },
          "current": {
            "type": "boolean"
          },
          "recommended": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "title",
          "risk",
          "view",
          "decision",
          "headline",
          "semantic",
          "current",
          "recommended"
        ]
      },
      "SessionBranchRisk": {
        "type": "object",
        "properties": {
          "level": {
            "type": "string",
            "enum": [
              "LOW",
              "MEDIUM",
              "HIGH",
              "CRITICAL"
            ]
          },
          "score": {
            "type": "number"
          },
          "confidence": {
            "type": "number"
          },
          "readiness": {
            "type": "string",
            "enum": [
              "ready",
              "needs_validation",
              "needs_review",
              "blocked"
            ]
          },
          "signals": {
            "type": "object",
            "properties": {
              "filesChanged": {
                "type": "number"
              },
              "linesChanged": {
                "type": "number"
              },
              "testCoverage": {
                "type": "number"
              },
              "apiEndpointsAffected": {
                "type": "number"
              },
              "crossModule": {
                "type": "boolean"
              },
              "securityRelated": {
                "type": "boolean"
              },
              "validationPassed": {
                "type": "boolean"
              },
              "validationState": {
                "type": "string",
                "enum": [
                  "not_run",
                  "passed",
                  "failed",
                  "partial"
                ]
              },
              "validationCount": {
                "type": "number"
              },
              "validationFailures": {
                "type": "number"
              },
              "validationCommands": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "toolFailures": {
                "type": "number"
              },
              "totalTools": {
                "type": "number"
              },
              "diffState": {
                "type": "string",
                "enum": [
                  "recorded",
                  "derived",
                  "missing"
                ]
              },
              "semanticRisk": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "low",
                      "medium",
                      "high"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "primaryChange": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/SessionSemanticDiffKind"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "filesChanged",
              "linesChanged",
              "testCoverage",
              "apiEndpointsAffected",
              "crossModule",
              "securityRelated",
              "validationState",
              "validationCount",
              "validationFailures",
              "validationCommands",
              "toolFailures",
              "totalTools",
              "diffState",
              "semanticRisk",
              "primaryChange"
            ]
          },
          "summary": {
            "type": "string"
          },
          "breakdown": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "files",
                    "lines",
                    "tests",
                    "api",
                    "module",
                    "security",
                    "validation",
                    "tools",
                    "semantic"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "points": {
                  "type": "number"
                },
                "detail": {
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "label",
                "points",
                "detail"
              ]
            }
          },
          "evidence": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "unknowns": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "mitigations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "level",
          "score",
          "confidence",
          "readiness",
          "signals",
          "summary",
          "breakdown",
          "evidence",
          "unknowns",
          "mitigations"
        ]
      },
      "SessionBranchScorecard": {
        "type": "object",
        "properties": {
          "total": {
            "type": "number"
          },
          "breakdown": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "enum": [
                    "correctness",
                    "safety",
                    "simplicity",
                    "validation"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "value": {
                  "type": "number"
                },
                "detail": {
                  "type": "string"
                }
              },
              "required": [
                "key",
                "label",
                "value",
                "detail"
              ]
            }
          }
        },
        "required": [
          "total",
          "breakdown"
        ]
      },
      "SessionBranchView": {
        "type": "object",
        "properties": {
          "tools": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "routes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "from": {
                  "type": "string"
                },
                "to": {
                  "type": "string"
                },
                "confidence": {
                  "type": "number"
                }
              },
              "required": [
                "from",
                "to",
                "confidence"
              ]
            }
          },
          "counts": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "number"
            }
          },
          "plan": {
            "type": "string"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "tools",
          "routes",
          "counts",
          "plan",
          "notes"
        ]
      },
      "SessionCompareAdvisory": {
        "type": "object",
        "properties": {
          "winner": {
            "type": "string",
            "enum": [
              "A",
              "B",
              "tie"
            ]
          },
          "confidence": {
            "type": "number"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "winner",
          "confidence",
          "reasons"
        ]
      },
      "SessionCompareAnalysis": {
        "type": "object",
        "properties": {
          "tools": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "routes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "from": {
                  "type": "string"
                },
                "to": {
                  "type": "string"
                },
                "confidence": {
                  "type": "number"
                }
              },
              "required": [
                "from",
                "to",
                "confidence"
              ]
            }
          },
          "counts": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "number"
            }
          },
          "plan": {
            "type": "string"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "decision": {
            "$ref": "#/components/schemas/SessionBranchScorecard"
          },
          "headline": {
            "type": "string"
          }
        },
        "required": [
          "tools",
          "routes",
          "counts",
          "plan",
          "notes",
          "decision",
          "headline"
        ]
      },
      "SessionCompareDecision": {
        "type": "object",
        "properties": {
          "winner": {
            "type": "string",
            "enum": [
              "A",
              "B",
              "tie"
            ]
          },
          "confidence": {
            "type": "number"
          },
          "recommendation": {
            "type": "string"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "differences": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "session1": {
            "$ref": "#/components/schemas/SessionCompareDecisionSession"
          },
          "session2": {
            "$ref": "#/components/schemas/SessionCompareDecisionSession"
          }
        },
        "required": [
          "winner",
          "confidence",
          "recommendation",
          "reasons",
          "differences",
          "session1",
          "session2"
        ]
      },
      "SessionCompareDecisionSession": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "plan": {
            "type": "string"
          },
          "headline": {
            "type": "string"
          },
          "change": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "validation": {
            "type": "string"
          }
        },
        "required": [
          "title",
          "plan",
          "headline",
          "change",
          "validation"
        ]
      },
      "SessionCompareDifferences": {
        "type": "object",
        "properties": {
          "toolChainDiffers": {
            "type": "boolean"
          },
          "routeDiffers": {
            "type": "boolean"
          },
          "eventCountDelta": {
            "type": "number"
          }
        },
        "required": [
          "toolChainDiffers",
          "routeDiffers",
          "eventCountDelta"
        ]
      },
      "SessionCompareReplay": {
        "type": "object",
        "properties": {
          "stepsCompared": {
            "type": "number"
          },
          "divergences": {
            "type": "number"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "stepsCompared",
          "divergences",
          "reasons"
        ]
      },
      "SessionCompareResult": {
        "type": "object",
        "properties": {
          "session1": {
            "$ref": "#/components/schemas/SessionCompareSummary"
          },
          "session2": {
            "$ref": "#/components/schemas/SessionCompareSummary"
          },
          "differences": {
            "$ref": "#/components/schemas/SessionCompareDifferences"
          },
          "advisory": {
            "$ref": "#/components/schemas/SessionCompareAdvisory"
          },
          "decision": {
            "$ref": "#/components/schemas/SessionCompareDecision"
          },
          "analysis": {
            "type": "object",
            "properties": {
              "session1": {
                "$ref": "#/components/schemas/SessionCompareAnalysis"
              },
              "session2": {
                "$ref": "#/components/schemas/SessionCompareAnalysis"
              }
            },
            "required": [
              "session1",
              "session2"
            ]
          },
          "replay": {
            "type": "object",
            "properties": {
              "session1": {
                "$ref": "#/components/schemas/SessionCompareReplay"
              },
              "session2": {
                "$ref": "#/components/schemas/SessionCompareReplay"
              }
            },
            "required": [
              "session1",
              "session2"
            ]
          }
        },
        "required": [
          "session1",
          "session2",
          "differences",
          "advisory",
          "decision",
          "analysis"
        ]
      },
      "SessionCompareSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "risk": {
            "$ref": "#/components/schemas/SessionBranchRisk"
          },
          "decision": {
            "$ref": "#/components/schemas/SessionBranchScorecard"
          },
          "events": {
            "type": "number"
          },
          "plan": {
            "type": "string"
          },
          "headline": {
            "type": "string"
          },
          "semantic": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SessionSemanticDiffSummary"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "title",
          "risk",
          "decision",
          "events",
          "plan",
          "headline",
          "semantic"
        ]
      },
      "SessionDreDetail": {
        "type": "object",
        "properties": {
          "level": {
            "type": "string",
            "enum": [
              "LOW",
              "MEDIUM",
              "HIGH",
              "CRITICAL"
            ]
          },
          "score": {
            "type": "number"
          },
          "confidence": {
            "type": "number"
          },
          "readiness": {
            "type": "string",
            "enum": [
              "ready",
              "needs_validation",
              "needs_review",
              "blocked"
            ]
          },
          "summary": {
            "type": "string"
          },
          "stats": {
            "type": "string"
          },
          "decision": {
            "type": "string"
          },
          "plan": {
            "type": "string"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "drivers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "scorecard": {
            "$ref": "#/components/schemas/SessionBranchScorecard"
          },
          "breakdown": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "files",
                    "lines",
                    "tests",
                    "api",
                    "module",
                    "security",
                    "validation",
                    "tools",
                    "semantic"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "points": {
                  "type": "number"
                },
                "detail": {
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "label",
                "points",
                "detail"
              ]
            }
          },
          "evidence": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "unknowns": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "mitigations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "duration": {
            "type": "number"
          },
          "tokens": {
            "type": "object",
            "properties": {
              "input": {
                "type": "number"
              },
              "output": {
                "type": "number"
              }
            },
            "required": [
              "input",
              "output"
            ]
          },
          "routes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "from": {
                  "type": "string"
                },
                "to": {
                  "type": "string"
                },
                "confidence": {
                  "type": "number"
                }
              },
              "required": [
                "from",
                "to",
                "confidence"
              ]
            }
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "counts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string"
                },
                "count": {
                  "type": "number"
                }
              },
              "required": [
                "type",
                "count"
              ]
            }
          },
          "semantic": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SessionSemanticDiffSummary"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "level",
          "score",
          "confidence",
          "readiness",
          "summary",
          "stats",
          "decision",
          "plan",
          "notes",
          "drivers",
          "scorecard",
          "breakdown",
          "evidence",
          "unknowns",
          "mitigations",
          "duration",
          "tokens",
          "routes",
          "tools",
          "counts",
          "semantic"
        ]
      },
      "SessionDreSnapshot": {
        "type": "object",
        "properties": {
          "detail": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SessionDreDetail"
              },
              {
                "type": "null"
              }
            ]
          },
          "timeline": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionDreTimelineLine"
            }
          }
        },
        "required": [
          "detail",
          "timeline"
        ]
      },
      "SessionDreTimelineLine": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "heading",
              "meta",
              "step",
              "route",
              "tool",
              "llm",
              "error"
            ]
          },
          "text": {
            "type": "string"
          }
        },
        "required": [
          "kind",
          "text"
        ]
      },
      "SessionGraphSnapshot": {
        "type": "object",
        "properties": {
          "graph": {
            "$ref": "#/components/schemas/ExecutionGraph"
          },
          "topology": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExecutionGraphTopologyLine"
            }
          }
        },
        "required": [
          "graph",
          "topology"
        ]
      },
      "SessionMetadata": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {}
      },
      "SessionMoveValidation": {
        "type": "object",
        "properties": {
          "sessionID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "valid": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "enum": [
              "ok",
              "target_missing",
              "target_not_directory",
              "outside_current_project",
              "same_directory"
            ]
          },
          "current": {
            "type": "object",
            "properties": {
              "directory": {
                "type": "string"
              },
              "projectID": {
                "type": "string"
              },
              "worktree": {
                "type": "string"
              }
            },
            "required": [
              "directory",
              "projectID",
              "worktree"
            ]
          },
          "target": {
            "type": "object",
            "properties": {
              "directory": {
                "type": "string"
              },
              "exists": {
                "type": "boolean"
              },
              "isDirectory": {
                "type": "boolean"
              },
              "sameDirectory": {
                "type": "boolean"
              },
              "withinCurrentProject": {
                "type": "boolean"
              },
              "git": {
                "type": "object",
                "properties": {
                  "worktree": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "branch": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "dirty": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "worktree",
                  "branch",
                  "dirty"
                ]
              }
            },
            "required": [
              "directory",
              "exists",
              "isDirectory",
              "sameDirectory",
              "withinCurrentProject",
              "git"
            ]
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "sessionID",
          "valid",
          "reason",
          "current",
          "target",
          "warnings"
        ]
      },
      "SessionRiskDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "assessment": {
            "$ref": "#/components/schemas/SessionBranchRisk"
          },
          "drivers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "semantic": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SessionSemanticDiffSummary"
              },
              {
                "type": "null"
              }
            ]
          },
          "quality": {
            "type": "object",
            "properties": {
              "review": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "schemaVersion": {
                        "type": "number",
                        "const": 1
                      },
                      "kind": {
                        "type": "string",
                        "const": "ax-code-quality-replay-readiness-summary"
                      },
                      "workflow": {
                        "type": "string",
                        "enum": [
                          "review",
                          "debug",
                          "qa"
                        ]
                      },
                      "sessionID": {
                        "type": "string"
                      },
                      "projectID": {
                        "type": "string"
                      },
                      "exportedAt": {
                        "type": "string"
                      },
                      "totalItems": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "anchorItems": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "evidenceItems": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "toolSummaryCount": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "labeledItems": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "resolvedLabeledItems": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "unresolvedLabeledItems": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "missingLabels": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "readyForBenchmark": {
                        "type": "boolean"
                      },
                      "overallStatus": {
                        "type": "string",
                        "enum": [
                          "pass",
                          "warn",
                          "fail"
                        ]
                      },
                      "nextAction": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "gates": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "pass",
                                "warn",
                                "fail"
                              ]
                            },
                            "detail": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "name",
                            "status",
                            "detail"
                          ]
                        }
                      }
                    },
                    "required": [
                      "schemaVersion",
                      "kind",
                      "workflow",
                      "sessionID",
                      "projectID",
                      "exportedAt",
                      "totalItems",
                      "anchorItems",
                      "evidenceItems",
                      "toolSummaryCount",
                      "labeledItems",
                      "resolvedLabeledItems",
                      "unresolvedLabeledItems",
                      "missingLabels",
                      "readyForBenchmark",
                      "overallStatus",
                      "nextAction",
                      "gates"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "debug": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "schemaVersion": {
                        "type": "number",
                        "const": 1
                      },
                      "kind": {
                        "type": "string",
                        "const": "ax-code-quality-replay-readiness-summary"
                      },
                      "workflow": {
                        "type": "string",
                        "enum": [
                          "review",
                          "debug",
                          "qa"
                        ]
                      },
                      "sessionID": {
                        "type": "string"
                      },
                      "projectID": {
                        "type": "string"
                      },
                      "exportedAt": {
                        "type": "string"
                      },
                      "totalItems": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "anchorItems": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "evidenceItems": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "toolSummaryCount": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "labeledItems": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "resolvedLabeledItems": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "unresolvedLabeledItems": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "missingLabels": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "readyForBenchmark": {
                        "type": "boolean"
                      },
                      "overallStatus": {
                        "type": "string",
                        "enum": [
                          "pass",
                          "warn",
                          "fail"
                        ]
                      },
                      "nextAction": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "gates": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "pass",
                                "warn",
                                "fail"
                              ]
                            },
                            "detail": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "name",
                            "status",
                            "detail"
                          ]
                        }
                      }
                    },
                    "required": [
                      "schemaVersion",
                      "kind",
                      "workflow",
                      "sessionID",
                      "projectID",
                      "exportedAt",
                      "totalItems",
                      "anchorItems",
                      "evidenceItems",
                      "toolSummaryCount",
                      "labeledItems",
                      "resolvedLabeledItems",
                      "unresolvedLabeledItems",
                      "missingLabels",
                      "readyForBenchmark",
                      "overallStatus",
                      "nextAction",
                      "gates"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "qa": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "schemaVersion": {
                        "type": "number",
                        "const": 1
                      },
                      "kind": {
                        "type": "string",
                        "const": "ax-code-quality-replay-readiness-summary"
                      },
                      "workflow": {
                        "type": "string",
                        "enum": [
                          "review",
                          "debug",
                          "qa"
                        ]
                      },
                      "sessionID": {
                        "type": "string"
                      },
                      "projectID": {
                        "type": "string"
                      },
                      "exportedAt": {
                        "type": "string"
                      },
                      "totalItems": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "anchorItems": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "evidenceItems": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "toolSummaryCount": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "labeledItems": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "resolvedLabeledItems": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "unresolvedLabeledItems": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "missingLabels": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "readyForBenchmark": {
                        "type": "boolean"
                      },
                      "overallStatus": {
                        "type": "string",
                        "enum": [
                          "pass",
                          "warn",
                          "fail"
                        ]
                      },
                      "nextAction": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "gates": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "pass",
                                "warn",
                                "fail"
                              ]
                            },
                            "detail": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "name",
                            "status",
                            "detail"
                          ]
                        }
                      }
                    },
                    "required": [
                      "schemaVersion",
                      "kind",
                      "workflow",
                      "sessionID",
                      "projectID",
                      "exportedAt",
                      "totalItems",
                      "anchorItems",
                      "evidenceItems",
                      "toolSummaryCount",
                      "labeledItems",
                      "resolvedLabeledItems",
                      "unresolvedLabeledItems",
                      "missingLabels",
                      "readyForBenchmark",
                      "overallStatus",
                      "nextAction",
                      "gates"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "review",
              "debug",
              "qa"
            ]
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "schemaVersion": {
                  "type": "number",
                  "const": 1
                },
                "findingId": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{16}$"
                },
                "workflow": {
                  "type": "string",
                  "enum": [
                    "review",
                    "debug",
                    "qa"
                  ]
                },
                "category": {
                  "type": "string",
                  "enum": [
                    "bug",
                    "security",
                    "regression_risk",
                    "behavior_change",
                    "missing_verification",
                    "migration_safety"
                  ]
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "CRITICAL",
                    "HIGH",
                    "MEDIUM",
                    "LOW",
                    "INFO"
                  ]
                },
                "confidence": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                },
                "summary": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "file": {
                  "type": "string",
                  "minLength": 1
                },
                "anchor": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "line"
                        },
                        "line": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 9007199254740991
                        },
                        "endLine": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "kind",
                        "line"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "symbol"
                        },
                        "symbolId": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "kind",
                        "symbolId"
                      ]
                    }
                  ]
                },
                "rationale": {
                  "type": "string",
                  "minLength": 1
                },
                "evidence": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "evidenceRefs": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "verification",
                          "log",
                          "graph",
                          "diff"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "kind",
                      "id"
                    ]
                  }
                },
                "suggestedNextAction": {
                  "type": "string",
                  "minLength": 1
                },
                "ruleId": {
                  "type": "string",
                  "pattern": "^(axcode|policy|user):[a-z0-9][a-z0-9-]*$"
                },
                "source": {
                  "type": "object",
                  "properties": {
                    "tool": {
                      "type": "string",
                      "minLength": 1
                    },
                    "version": {
                      "type": "string",
                      "minLength": 1
                    },
                    "runId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "tool",
                    "version",
                    "runId"
                  ]
                }
              },
              "required": [
                "schemaVersion",
                "findingId",
                "workflow",
                "category",
                "severity",
                "summary",
                "file",
                "anchor",
                "rationale",
                "evidence",
                "suggestedNextAction",
                "source"
              ]
            }
          },
          "envelopes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "schemaVersion": {
                  "type": "number",
                  "const": 1
                },
                "workflow": {
                  "type": "string",
                  "enum": [
                    "review",
                    "debug",
                    "qa"
                  ]
                },
                "scope": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "file",
                        "package",
                        "workspace",
                        "custom"
                      ]
                    },
                    "paths": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "kind"
                  ]
                },
                "command": {
                  "type": "object",
                  "properties": {
                    "runner": {
                      "type": "string",
                      "minLength": 1
                    },
                    "argv": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "cwd": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "runner",
                    "argv",
                    "cwd"
                  ]
                },
                "result": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "typecheck",
                        "lint",
                        "test",
                        "custom"
                      ]
                    },
                    "passed": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "passed",
                        "failed",
                        "skipped",
                        "timeout",
                        "error",
                        "unavailable"
                      ]
                    },
                    "issues": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "file": {
                            "type": "string",
                            "minLength": 1
                          },
                          "line": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "column": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "severity": {
                            "type": "string",
                            "enum": [
                              "error",
                              "warning"
                            ]
                          },
                          "message": {
                            "type": "string",
                            "minLength": 1
                          },
                          "code": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "file",
                          "severity",
                          "message"
                        ]
                      }
                    },
                    "duration": {
                      "type": "number",
                      "minimum": 0
                    },
                    "output": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "name",
                    "type",
                    "passed",
                    "status",
                    "issues",
                    "duration"
                  ]
                },
                "structuredFailures": {
                  "type": "array",
                  "items": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "typecheck"
                          },
                          "file": {
                            "type": "string",
                            "minLength": 1
                          },
                          "line": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "column": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "code": {
                            "type": "string",
                            "minLength": 1
                          },
                          "message": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "kind",
                          "file",
                          "line",
                          "code",
                          "message"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "lint"
                          },
                          "file": {
                            "type": "string",
                            "minLength": 1
                          },
                          "line": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "rule": {
                            "type": "string",
                            "minLength": 1
                          },
                          "severity": {
                            "type": "string",
                            "enum": [
                              "error",
                              "warning"
                            ]
                          },
                          "message": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "kind",
                          "file",
                          "line",
                          "rule",
                          "severity",
                          "message"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "test"
                          },
                          "testName": {
                            "type": "string",
                            "minLength": 1
                          },
                          "framework": {
                            "type": "string",
                            "minLength": 1
                          },
                          "file": {
                            "type": "string"
                          },
                          "assertion": {
                            "type": "string"
                          },
                          "stack": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "kind",
                          "testName",
                          "framework"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "custom"
                          },
                          "message": {
                            "type": "string",
                            "minLength": 1
                          },
                          "details": {}
                        },
                        "required": [
                          "kind",
                          "message"
                        ]
                      }
                    ]
                  }
                },
                "artifactRefs": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "finding",
                          "log",
                          "diff",
                          "snapshot"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "kind",
                      "id"
                    ]
                  }
                },
                "source": {
                  "type": "object",
                  "properties": {
                    "tool": {
                      "type": "string",
                      "minLength": 1
                    },
                    "version": {
                      "type": "string",
                      "minLength": 1
                    },
                    "runId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "tool",
                    "version",
                    "runId"
                  ]
                },
                "sourceState": {
                  "type": "object",
                  "properties": {
                    "available": {
                      "type": "boolean"
                    },
                    "commit": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "dirtyDigest": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "available",
                    "commit",
                    "dirtyDigest"
                  ]
                },
                "graph": {
                  "type": "object",
                  "properties": {
                    "revision": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "lastCommitSha": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "indexedAt": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "revision",
                    "lastCommitSha",
                    "indexedAt"
                  ]
                },
                "environment": {
                  "type": "object",
                  "properties": {
                    "configDigest": {
                      "type": "string"
                    },
                    "toolVersions": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "commandSelectionRationale": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "configDigest",
                    "toolVersions"
                  ]
                },
                "execution": {
                  "type": "object",
                  "properties": {
                    "startedAt": {
                      "type": "string"
                    },
                    "endedAt": {
                      "type": "string"
                    },
                    "exitCode": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "signal": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "timedOut": {
                      "type": "boolean"
                    },
                    "outputHashes": {
                      "type": "object",
                      "properties": {
                        "stdout": {
                          "type": "string"
                        },
                        "stderr": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "stdout",
                        "stderr"
                      ]
                    },
                    "outputTruncated": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "startedAt",
                    "endedAt",
                    "exitCode",
                    "signal",
                    "timedOut",
                    "outputTruncated"
                  ]
                }
              },
              "required": [
                "schemaVersion",
                "workflow",
                "scope",
                "command",
                "result",
                "structuredFailures",
                "artifactRefs",
                "source"
              ]
            }
          },
          "reviewResults": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "schemaVersion": {
                  "type": "number",
                  "const": 1
                },
                "reviewId": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{16}$"
                },
                "workflow": {
                  "type": "string",
                  "const": "review"
                },
                "decision": {
                  "type": "string",
                  "enum": [
                    "approve",
                    "request_changes",
                    "needs_verification"
                  ]
                },
                "recommendedDecision": {
                  "type": "string",
                  "enum": [
                    "approve",
                    "request_changes",
                    "needs_verification"
                  ]
                },
                "summary": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1000
                },
                "findingIds": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{16}$"
                  }
                },
                "verificationEnvelopeIds": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{16}$"
                  }
                },
                "counts": {
                  "type": "object",
                  "properties": {
                    "CRITICAL": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "HIGH": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "MEDIUM": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "LOW": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "INFO": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "CRITICAL",
                    "HIGH",
                    "MEDIUM",
                    "LOW",
                    "INFO",
                    "total"
                  ]
                },
                "blockingFindingIds": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{16}$"
                  }
                },
                "missingVerification": {
                  "type": "boolean"
                },
                "verificationPolicyFailed": {
                  "type": "boolean"
                },
                "overrideReason": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1000
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                },
                "source": {
                  "type": "object",
                  "properties": {
                    "tool": {
                      "type": "string",
                      "minLength": 1
                    },
                    "version": {
                      "type": "string",
                      "minLength": 1
                    },
                    "runId": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "tool",
                    "version",
                    "runId"
                  ]
                }
              },
              "required": [
                "schemaVersion",
                "reviewId",
                "workflow",
                "decision",
                "recommendedDecision",
                "summary",
                "findingIds",
                "verificationEnvelopeIds",
                "counts",
                "blockingFindingIds",
                "missingVerification",
                "createdAt",
                "source"
              ]
            }
          },
          "debug": {
            "type": "object",
            "properties": {
              "cases": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "number",
                      "const": 1
                    },
                    "caseId": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{16}$"
                    },
                    "problem": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "open",
                        "investigating",
                        "resolved",
                        "unresolved"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                    },
                    "source": {
                      "type": "object",
                      "properties": {
                        "tool": {
                          "type": "string",
                          "minLength": 1
                        },
                        "version": {
                          "type": "string",
                          "minLength": 1
                        },
                        "runId": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "tool",
                        "version",
                        "runId"
                      ]
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "caseId",
                    "problem",
                    "status",
                    "createdAt",
                    "source"
                  ]
                }
              },
              "evidence": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "number",
                      "const": 1
                    },
                    "evidenceId": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{16}$"
                    },
                    "caseId": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{16}$"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "log_capture",
                        "instrumentation_result",
                        "stack_trace",
                        "graph_query"
                      ]
                    },
                    "capturedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                    },
                    "content": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200000
                    },
                    "planId": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{16}$"
                    },
                    "source": {
                      "type": "object",
                      "properties": {
                        "tool": {
                          "type": "string",
                          "minLength": 1
                        },
                        "version": {
                          "type": "string",
                          "minLength": 1
                        },
                        "runId": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "tool",
                        "version",
                        "runId"
                      ]
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "evidenceId",
                    "caseId",
                    "kind",
                    "capturedAt",
                    "content",
                    "source"
                  ]
                }
              },
              "instrumentationPlans": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "number",
                      "const": 1
                    },
                    "planId": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{16}$"
                    },
                    "caseId": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{16}$"
                    },
                    "purpose": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500
                    },
                    "targets": {
                      "minItems": 1,
                      "maxItems": 20,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "file": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 500
                          },
                          "anchor": {
                            "type": "object",
                            "properties": {
                              "line": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 9007199254740991
                              },
                              "symbol": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              }
                            }
                          },
                          "probe": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 500
                          },
                          "removeInstruction": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 500
                          }
                        },
                        "required": [
                          "file",
                          "probe",
                          "removeInstruction"
                        ]
                      }
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "planned",
                        "applied",
                        "removed"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                    },
                    "source": {
                      "type": "object",
                      "properties": {
                        "tool": {
                          "type": "string",
                          "minLength": 1
                        },
                        "version": {
                          "type": "string",
                          "minLength": 1
                        },
                        "runId": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "tool",
                        "version",
                        "runId"
                      ]
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "planId",
                    "caseId",
                    "purpose",
                    "targets",
                    "status",
                    "createdAt",
                    "source"
                  ]
                }
              },
              "hypotheses": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "number",
                      "const": 1
                    },
                    "hypothesisId": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{16}$"
                    },
                    "caseId": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{16}$"
                    },
                    "claim": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500
                    },
                    "confidence": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 0.95
                    },
                    "staticAnalysis": {
                      "type": "object",
                      "properties": {
                        "sourceCallId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "chainLength": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "chainConfidence": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 0.95
                        }
                      },
                      "required": [
                        "sourceCallId",
                        "chainLength",
                        "chainConfidence"
                      ]
                    },
                    "evidenceRefs": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{16}$"
                      }
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "refuted",
                        "confirmed",
                        "unresolved"
                      ]
                    },
                    "source": {
                      "type": "object",
                      "properties": {
                        "tool": {
                          "type": "string",
                          "minLength": 1
                        },
                        "version": {
                          "type": "string",
                          "minLength": 1
                        },
                        "runId": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "tool",
                        "version",
                        "runId"
                      ]
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "hypothesisId",
                    "caseId",
                    "claim",
                    "confidence",
                    "status",
                    "source"
                  ]
                }
              },
              "rollups": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "number",
                      "const": 1
                    },
                    "caseId": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{16}$"
                    },
                    "problem": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "open",
                        "investigating",
                        "resolved",
                        "unresolved"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                    },
                    "source": {
                      "type": "object",
                      "properties": {
                        "tool": {
                          "type": "string",
                          "minLength": 1
                        },
                        "version": {
                          "type": "string",
                          "minLength": 1
                        },
                        "runId": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "tool",
                        "version",
                        "runId"
                      ]
                    },
                    "effectiveStatus": {
                      "type": "string",
                      "enum": [
                        "open",
                        "investigating",
                        "resolved",
                        "unresolved"
                      ]
                    },
                    "planSummary": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "applied": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "removed": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "total",
                        "applied",
                        "removed"
                      ]
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "caseId",
                    "problem",
                    "status",
                    "createdAt",
                    "source",
                    "effectiveStatus"
                  ]
                }
              }
            },
            "required": [
              "cases",
              "evidence",
              "instrumentationPlans",
              "hypotheses",
              "rollups"
            ]
          },
          "decisionHints": {
            "type": "object",
            "properties": {
              "source": {
                "type": "string",
                "enum": [
                  "replay",
                  "messages",
                  "none"
                ]
              },
              "readiness": {
                "type": "string",
                "enum": [
                  "clear",
                  "needs_validation",
                  "blocked"
                ]
              },
              "actionCount": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "hintCount": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "hints": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "category": {
                      "type": "string",
                      "enum": [
                        "missing_verification",
                        "failed_validation",
                        "missing_review_completion"
                      ]
                    },
                    "confidence": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1
                    },
                    "title": {
                      "type": "string"
                    },
                    "body": {
                      "type": "string"
                    },
                    "evidence": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "id",
                    "category",
                    "confidence",
                    "title",
                    "body",
                    "evidence"
                  ]
                }
              }
            },
            "required": [
              "source",
              "readiness",
              "actionCount",
              "hintCount",
              "hints"
            ]
          }
        },
        "required": [
          "id",
          "title",
          "assessment",
          "drivers",
          "semantic"
        ]
      },
      "SessionRollbackApplyInput": {
        "type": "object",
        "properties": {
          "step": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "tool": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "SessionRollbackPoint": {
        "type": "object",
        "properties": {
          "step": {
            "type": "number"
          },
          "messageID": {
            "type": "string",
            "pattern": "^msg_.*"
          },
          "partID": {
            "type": "string",
            "pattern": "^prt_.*"
          },
          "duration": {
            "type": "number"
          },
          "tokens": {
            "type": "object",
            "properties": {
              "input": {
                "type": "number"
              },
              "output": {
                "type": "number"
              }
            },
            "required": [
              "input",
              "output"
            ]
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "kinds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "step",
          "messageID",
          "partID",
          "tools",
          "kinds"
        ]
      },
      "SessionRollbackPreview": {
        "type": "object",
        "properties": {
          "point": {
            "$ref": "#/components/schemas/SessionRollbackPoint"
          },
          "diffs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FileDiff"
            }
          },
          "summary": {
            "type": "object",
            "properties": {
              "files": {
                "type": "number"
              },
              "additions": {
                "type": "number"
              },
              "deletions": {
                "type": "number"
              }
            },
            "required": [
              "files",
              "additions",
              "deletions"
            ]
          },
          "descendants": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sessionID": {
                  "type": "string",
                  "pattern": "^ses_.*"
                },
                "files": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "sessionID",
                "files"
              ]
            }
          }
        },
        "required": [
          "point",
          "diffs",
          "summary",
          "descendants"
        ]
      },
      "SessionSemanticDiffChange": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string"
          },
          "status": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "added",
                  "deleted",
                  "modified"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "kind": {
            "$ref": "#/components/schemas/SessionSemanticDiffKind"
          },
          "risk": {
            "$ref": "#/components/schemas/SessionSemanticDiffRisk"
          },
          "summary": {
            "type": "string"
          },
          "additions": {
            "type": "number"
          },
          "deletions": {
            "type": "number"
          },
          "signals": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "file",
          "kind",
          "risk",
          "summary",
          "additions",
          "deletions",
          "signals"
        ]
      },
      "SessionSemanticDiffCount": {
        "type": "object",
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/SessionSemanticDiffKind"
          },
          "count": {
            "type": "number"
          }
        },
        "required": [
          "kind",
          "count"
        ]
      },
      "SessionSemanticDiffKind": {
        "type": "string",
        "enum": [
          "bug_fix",
          "refactor",
          "optimization",
          "test",
          "documentation",
          "configuration",
          "dependency",
          "rewrite"
        ]
      },
      "SessionSemanticDiffRisk": {
        "type": "string",
        "enum": [
          "low",
          "medium",
          "high"
        ]
      },
      "SessionSemanticDiffSummary": {
        "type": "object",
        "properties": {
          "headline": {
            "type": "string"
          },
          "risk": {
            "$ref": "#/components/schemas/SessionSemanticDiffRisk"
          },
          "primary": {
            "$ref": "#/components/schemas/SessionSemanticDiffKind"
          },
          "files": {
            "type": "number"
          },
          "additions": {
            "type": "number"
          },
          "deletions": {
            "type": "number"
          },
          "counts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionSemanticDiffCount"
            }
          },
          "signals": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionSemanticDiffChange"
            }
          }
        },
        "required": [
          "headline",
          "risk",
          "primary",
          "files",
          "additions",
          "deletions",
          "counts",
          "signals",
          "changes"
        ]
      },
      "SessionStatus": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "idle"
              }
            },
            "required": [
              "type"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "retry"
              },
              "attempt": {
                "type": "number"
              },
              "message": {
                "type": "string"
              },
              "next": {
                "type": "number"
              }
            },
            "required": [
              "type",
              "attempt",
              "message",
              "next"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "busy"
              },
              "step": {
                "type": "number"
              },
              "maxSteps": {
                "type": "number"
              },
              "segmentModelTurns": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "segmentModelTurnLimit": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "totalModelTurns": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "totalModelTurnLimit": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "continuations": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "continuationLimit": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "startedAt": {
                "type": "number"
              },
              "lastActivityAt": {
                "type": "number"
              },
              "activeTool": {
                "type": "string"
              },
              "toolCallID": {
                "type": "string"
              },
              "waitState": {
                "type": "string",
                "enum": [
                  "llm",
                  "tool"
                ]
              }
            },
            "required": [
              "type"
            ]
          }
        ]
      },
      "SessionStopCode": {
        "type": "string",
        "enum": [
          "MODEL_TURN_SEGMENT_LIMIT",
          "MODEL_TURN_TOTAL_LIMIT",
          "AGENT_MODEL_TURN_LIMIT",
          "AGGREGATE_TOOL_CALL_LIMIT",
          "FILE_CHANGE_LIMIT",
          "LINE_CHANGE_LIMIT"
        ]
      },
      "SmartLlmState": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "enabled"
        ]
      },
      "SnapshotPart": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^prt_.*"
          },
          "sessionID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "messageID": {
            "type": "string",
            "pattern": "^msg_.*"
          },
          "type": {
            "type": "string",
            "const": "snapshot"
          },
          "snapshot": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "sessionID",
          "messageID",
          "type",
          "snapshot"
        ]
      },
      "SteeringReceipt": {
        "type": "object",
        "properties": {
          "sessionID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "generation": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "clientID": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "accepted",
              "applied",
              "rejected"
            ]
          },
          "messageID": {
            "type": "string",
            "pattern": "^msg_.*"
          },
          "reason": {
            "type": "string"
          }
        },
        "required": [
          "sessionID",
          "generation",
          "clientID",
          "status"
        ]
      },
      "SteeringState": {
        "type": "object",
        "properties": {
          "generation": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "receipts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SteeringReceipt"
            }
          },
          "retention": {
            "type": "string",
            "const": "process-local; at most 256 receipts per session"
          }
        },
        "required": [
          "generation",
          "receipts",
          "retention"
        ]
      },
      "StepFinishPart": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^prt_.*"
          },
          "sessionID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "messageID": {
            "type": "string",
            "pattern": "^msg_.*"
          },
          "type": {
            "type": "string",
            "const": "step-finish"
          },
          "reason": {
            "type": "string"
          },
          "snapshot": {
            "type": "string"
          },
          "tokens": {
            "type": "object",
            "properties": {
              "total": {
                "type": "number"
              },
              "input": {
                "type": "number"
              },
              "output": {
                "type": "number"
              },
              "reasoning": {
                "type": "number"
              },
              "cache": {
                "type": "object",
                "properties": {
                  "read": {
                    "type": "number"
                  },
                  "write": {
                    "type": "number"
                  }
                },
                "required": [
                  "read",
                  "write"
                ]
              }
            },
            "required": [
              "input",
              "output",
              "reasoning",
              "cache"
            ]
          }
        },
        "required": [
          "id",
          "sessionID",
          "messageID",
          "type",
          "reason",
          "tokens"
        ]
      },
      "StepStartPart": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^prt_.*"
          },
          "sessionID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "messageID": {
            "type": "string",
            "pattern": "^msg_.*"
          },
          "type": {
            "type": "string",
            "const": "step-start"
          },
          "snapshot": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "sessionID",
          "messageID",
          "type"
        ]
      },
      "StructuredOutputError": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "const": "StructuredOutputError"
          },
          "data": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "retries": {
                "type": "number"
              },
              "metadata": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            },
            "required": [
              "message",
              "retries"
            ]
          }
        },
        "required": [
          "name",
          "data"
        ]
      },
      "SubtaskPart": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^prt_.*"
          },
          "sessionID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "messageID": {
            "type": "string",
            "pattern": "^msg_.*"
          },
          "type": {
            "type": "string",
            "const": "subtask"
          },
          "prompt": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "agent": {
            "type": "string"
          },
          "model": {
            "type": "object",
            "properties": {
              "providerID": {
                "type": "string"
              },
              "modelID": {
                "type": "string"
              }
            },
            "required": [
              "providerID",
              "modelID"
            ]
          },
          "command": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "sessionID",
          "messageID",
          "type",
          "prompt",
          "description",
          "agent"
        ]
      },
      "SubtaskPartInput": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^prt_.*"
          },
          "type": {
            "type": "string",
            "const": "subtask"
          },
          "prompt": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "agent": {
            "type": "string"
          },
          "model": {
            "type": "object",
            "properties": {
              "providerID": {
                "type": "string"
              },
              "modelID": {
                "type": "string"
              }
            },
            "required": [
              "providerID",
              "modelID"
            ]
          },
          "command": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "prompt",
          "description",
          "agent"
        ]
      },
      "SuperLongState": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "enabled"
        ]
      },
      "SuperLongStatus": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "enum": [
              "scoped",
              "session-override",
              "env",
              "config",
              "model-default"
            ]
          },
          "durationMs": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "startedAt": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "elapsedMs": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "remainingMs": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "enabled",
          "source",
          "durationMs",
          "startedAt",
          "elapsedMs",
          "remainingMs"
        ]
      },
      "Symbol": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "number"
          },
          "location": {
            "type": "object",
            "properties": {
              "uri": {
                "type": "string"
              },
              "range": {
                "$ref": "#/components/schemas/Range"
              }
            },
            "required": [
              "uri",
              "range"
            ]
          }
        },
        "required": [
          "name",
          "kind",
          "location"
        ]
      },
      "SymbolSource": {
        "type": "object",
        "properties": {
          "text": {
            "$ref": "#/components/schemas/FilePartSourceText"
          },
          "type": {
            "type": "string",
            "const": "symbol"
          },
          "path": {
            "type": "string"
          },
          "range": {
            "$ref": "#/components/schemas/Range"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "text",
          "type",
          "path",
          "range",
          "name",
          "kind"
        ]
      },
      "TaskQueueSteerResult": {
        "type": "object",
        "properties": {
          "item": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^tsk_.*"
              },
              "projectID": {
                "type": "string"
              },
              "directory": {
                "type": "string"
              },
              "sessionID": {
                "type": "string",
                "pattern": "^ses_.*"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "prompt",
                  "command",
                  "shell",
                  "followup",
                  "subagent",
                  "automation"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "queued",
                  "waiting_for_idle",
                  "running",
                  "blocked_permission",
                  "blocked_question",
                  "paused",
                  "failed",
                  "completed",
                  "cancelled"
                ]
              },
              "priority": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "position": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "title": {
                "type": "string"
              },
              "agent": {
                "type": "string"
              },
              "model": {},
              "sourceMessageID": {
                "type": "string"
              },
              "sourceTaskID": {
                "type": "string"
              },
              "payload": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              "error": {
                "type": "string"
              },
              "executionTimeoutMs": {
                "type": "integer",
                "minimum": 1000,
                "maximum": 259200000
              },
              "time": {
                "type": "object",
                "properties": {
                  "created": {
                    "type": "number"
                  },
                  "updated": {
                    "type": "number"
                  },
                  "started": {
                    "type": "number"
                  },
                  "completed": {
                    "type": "number"
                  }
                },
                "required": [
                  "created"
                ]
              }
            },
            "required": [
              "id",
              "projectID",
              "directory",
              "kind",
              "status",
              "priority",
              "position",
              "title",
              "payload",
              "time"
            ]
          },
          "receipt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SteeringReceipt"
              },
              {
                "type": "null"
              }
            ]
          },
          "reason": {
            "type": "string"
          }
        },
        "required": [
          "item",
          "receipt"
        ]
      },
      "TextPart": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^prt_.*"
          },
          "sessionID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "messageID": {
            "type": "string",
            "pattern": "^msg_.*"
          },
          "type": {
            "type": "string",
            "const": "text"
          },
          "text": {
            "type": "string"
          },
          "synthetic": {
            "type": "boolean"
          },
          "ignored": {
            "type": "boolean"
          },
          "time": {
            "type": "object",
            "properties": {
              "start": {
                "type": "number"
              },
              "end": {
                "type": "number"
              }
            },
            "required": [
              "start"
            ]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "id",
          "sessionID",
          "messageID",
          "type",
          "text"
        ]
      },
      "TextPartInput": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^prt_.*"
          },
          "type": {
            "type": "string",
            "const": "text"
          },
          "text": {
            "type": "string"
          },
          "synthetic": {
            "type": "boolean"
          },
          "ignored": {
            "type": "boolean"
          },
          "time": {
            "type": "object",
            "properties": {
              "start": {
                "type": "number"
              },
              "end": {
                "type": "number"
              }
            },
            "required": [
              "start"
            ]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "type",
          "text"
        ]
      },
      "Todo": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string",
            "description": "Brief description of the task"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "in_progress",
              "completed",
              "cancelled"
            ]
          },
          "priority": {
            "type": "string",
            "enum": [
              "high",
              "medium",
              "low"
            ]
          }
        },
        "required": [
          "content",
          "status",
          "priority"
        ]
      },
      "ToolIDs": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "ToolList": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/ToolListItem"
        }
      },
      "ToolListItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "parameters": {}
        },
        "required": [
          "id",
          "description",
          "parameters"
        ]
      },
      "ToolPart": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^prt_.*"
          },
          "sessionID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "messageID": {
            "type": "string",
            "pattern": "^msg_.*"
          },
          "type": {
            "type": "string",
            "const": "tool"
          },
          "callID": {
            "type": "string"
          },
          "parentCallID": {
            "type": "string"
          },
          "tool": {
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/ToolState"
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "id",
          "sessionID",
          "messageID",
          "type",
          "callID",
          "tool",
          "state"
        ]
      },
      "ToolState": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ToolStatePending"
          },
          {
            "$ref": "#/components/schemas/ToolStateRunning"
          },
          {
            "$ref": "#/components/schemas/ToolStateCompleted"
          },
          {
            "$ref": "#/components/schemas/ToolStateError"
          }
        ]
      },
      "ToolStateCompleted": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "const": "completed"
          },
          "input": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "output": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "time": {
            "type": "object",
            "properties": {
              "start": {
                "type": "number"
              },
              "end": {
                "type": "number"
              },
              "compacted": {
                "type": "number"
              }
            },
            "required": [
              "start",
              "end"
            ]
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FilePart"
            }
          }
        },
        "required": [
          "status",
          "input",
          "output",
          "title",
          "metadata",
          "time"
        ]
      },
      "ToolStateError": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "const": "error"
          },
          "input": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "error": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "time": {
            "type": "object",
            "properties": {
              "start": {
                "type": "number"
              },
              "end": {
                "type": "number"
              }
            },
            "required": [
              "start",
              "end"
            ]
          }
        },
        "required": [
          "status",
          "input",
          "error",
          "time"
        ]
      },
      "ToolStatePending": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "const": "pending"
          },
          "input": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "raw": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "input",
          "raw"
        ]
      },
      "ToolStateRunning": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "const": "running"
          },
          "input": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "title": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "time": {
            "type": "object",
            "properties": {
              "start": {
                "type": "number"
              }
            },
            "required": [
              "start"
            ]
          }
        },
        "required": [
          "status",
          "input",
          "time"
        ]
      },
      "UnknownError": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "const": "UnknownError"
          },
          "data": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "metadata": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            },
            "required": [
              "message"
            ]
          }
        },
        "required": [
          "name",
          "data"
        ]
      },
      "UserMessage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^msg_.*"
          },
          "sessionID": {
            "type": "string",
            "pattern": "^ses_.*"
          },
          "role": {
            "type": "string",
            "const": "user"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              }
            },
            "required": [
              "created"
            ]
          },
          "format": {
            "$ref": "#/components/schemas/OutputFormat"
          },
          "summary": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "body": {
                "type": "string"
              },
              "diffs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/FileDiff"
                }
              }
            },
            "required": [
              "diffs"
            ]
          },
          "agent": {
            "type": "string"
          },
          "model": {
            "type": "object",
            "properties": {
              "providerID": {
                "type": "string"
              },
              "modelID": {
                "type": "string"
              }
            },
            "required": [
              "providerID",
              "modelID"
            ]
          },
          "modelOrigin": {
            "type": "string",
            "enum": [
              "request",
              "agent",
              "complexity",
              "hybrid",
              "session-or-config",
              "fallback"
            ]
          },
          "system": {
            "type": "string"
          },
          "tools": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "boolean"
            }
          },
          "isolation": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "read-only",
                  "workspace-write",
                  "full-access"
                ]
              },
              "network": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          },
          "variant": {
            "type": "string"
          },
          "requestedDepth": {
            "type": "string",
            "enum": [
              "fast",
              "standard",
              "deep",
              "xdeep"
            ]
          }
        },
        "required": [
          "id",
          "sessionID",
          "role",
          "time",
          "agent",
          "model"
        ]
      },
      "VcsInfo": {
        "type": "object",
        "properties": {
          "branch": {
            "type": "string"
          }
        },
        "required": [
          "branch"
        ]
      },
      "WebMcpApprovalRecord": {
        "type": "object",
        "properties": {
          "server": {
            "type": "string"
          },
          "project": {
            "type": "string"
          },
          "scope": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "capability": {
                    "type": "string",
                    "const": "list_pages"
                  }
                },
                "required": [
                  "capability"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "capability": {
                    "type": "string",
                    "const": "navigate"
                  },
                  "origin": {
                    "type": "string",
                    "maxLength": 2048
                  }
                },
                "required": [
                  "capability",
                  "origin"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "capability": {
                    "type": "string",
                    "const": "read"
                  },
                  "origin": {
                    "type": "string",
                    "maxLength": 2048
                  }
                },
                "required": [
                  "capability",
                  "origin"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "capability": {
                    "type": "string",
                    "const": "close"
                  },
                  "origin": {
                    "type": "string",
                    "maxLength": 2048
                  }
                },
                "required": [
                  "capability",
                  "origin"
                ],
                "additionalProperties": false
              }
            ]
          },
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "fingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "revision": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "policyVersion": {
            "type": "number",
            "const": 1
          },
          "createdAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "server",
          "project",
          "scope",
          "id",
          "fingerprint",
          "revision",
          "policyVersion",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "WebMcpApprovalSummary": {
        "type": "object",
        "properties": {
          "server": {
            "type": "string"
          },
          "project": {
            "type": "string"
          },
          "scope": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "capability": {
                    "type": "string",
                    "const": "list_pages"
                  }
                },
                "required": [
                  "capability"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "capability": {
                    "type": "string",
                    "const": "navigate"
                  },
                  "origin": {
                    "type": "string",
                    "maxLength": 2048
                  }
                },
                "required": [
                  "capability",
                  "origin"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "capability": {
                    "type": "string",
                    "const": "read"
                  },
                  "origin": {
                    "type": "string",
                    "maxLength": 2048
                  }
                },
                "required": [
                  "capability",
                  "origin"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "capability": {
                    "type": "string",
                    "const": "close"
                  },
                  "origin": {
                    "type": "string",
                    "maxLength": 2048
                  }
                },
                "required": [
                  "capability",
                  "origin"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "required": [
          "server",
          "project",
          "scope"
        ],
        "additionalProperties": false
      },
      "WebMcpProfileConfig": {
        "description": "Experimental pinned WebMCP bridge policy; requires explicit enablement and interactive approval for every call",
        "type": "object",
        "properties": {
          "allowedOrigins": {
            "maxItems": 8,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 240
            },
            "description": "Exact permitted origins; no wildcards, credentials, paths, queries or fragments. Empty (the product default) navigates any http(s) origin; a non-empty list narrows navigation to exactly those origins."
          },
          "headless": {
            "description": "Use an isolated headless Chrome instead of a visible window",
            "type": "boolean"
          },
          "persistentProfile": {
            "description": "Use a persistent AX-owned browser profile so authenticated WebMCP tools work. Requires the managed allowPersistentProfile requirement and forces a visible window.",
            "type": "boolean"
          },
          "vendored": {
            "description": "Launch a vendored, integrity-pinned bridge install instead of npx. Requires the managed allowVendored requirement.",
            "type": "boolean"
          },
          "read": {
            "description": "Enable the T1 read tier: page snapshot, screenshot and console tools for granted origins. Default off. A managed allowRead: false forces it off.",
            "type": "boolean"
          },
          "interact": {
            "description": "Enable the T2 interact tier: click, hover, wait_for, fill, fill_form, press_key and handle_dialog for granted origins, each confirmed interactively. Default off. A managed allowInteract: false forces it off.",
            "type": "boolean"
          },
          "executablePath": {
            "description": "Optional explicit Chrome 150+ executable; never attaches to an existing browser session",
            "type": "string",
            "maxLength": 4096
          }
        },
        "required": [
          "allowedOrigins"
        ],
        "additionalProperties": false
      },
      "WebMcpRequirementConfig": {
        "description": "Enterprise WebMCP requirement for the experimental chrome-devtools bridge. Managed config only — ignored from project, user, remote and inline config so a repository cannot set or loosen it. allow: false blocks the bridge; allowedOrigins narrows the exact origins admitted. A managed allow never enables the bridge and never bypasses the per-call interactive webmcp approval.",
        "type": "object",
        "properties": {
          "allow": {
            "description": "Managed allow/deny for the experimental WebMCP bridge. false blocks the bridge entirely.",
            "type": "boolean"
          },
          "allowedOrigins": {
            "description": "Managed narrowing list. When set, only these exact origins stay usable: an unrestricted profile narrows to this list; a configured profile is intersected with it and an empty intersection fails closed.",
            "minItems": 1,
            "maxItems": 8,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 240
            }
          },
          "allowPersistentProfile": {
            "description": "Managed opt-in for a persistent AX-owned browser profile. Default off; never the user's main profile.",
            "type": "boolean"
          },
          "allowVendored": {
            "description": "Managed opt-in for a vendored, integrity-pinned bridge install instead of npx. Default off.",
            "type": "boolean"
          },
          "allowRead": {
            "description": "Managed gate for the T1 read tier. Default off. false forces the read tools off even when the profile sets read: true; it can only restrict, never enable.",
            "type": "boolean"
          },
          "allowInteract": {
            "description": "Managed gate for the T2 interact tier. false forces the interact tools off even when the profile sets interact: true; it can only restrict, never enable.",
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "WikiMaintenanceStatus": {
        "type": "object",
        "properties": {
          "phase": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "ready",
              "disabled",
              "failed"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "idle",
              "busy",
              "permissions",
              "disabled",
              "non_git",
              "building",
              "complete",
              "failed"
            ]
          },
          "completed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "phase",
          "reason",
          "completed",
          "total",
          "revision"
        ]
      },
      "WikiVisualizationGraph": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "number",
            "const": 1
          },
          "snapshot": {
            "type": "string",
            "maxLength": 128
          },
          "scope": {
            "type": "string",
            "const": "wiki-manifest"
          },
          "codeRelationships": {
            "type": "string",
            "const": "unavailable"
          },
          "nodes": {
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "maxLength": 1100
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "page",
                    "source",
                    "symbol"
                  ]
                },
                "label": {
                  "type": "string",
                  "maxLength": 1024
                },
                "path": {
                  "type": "string",
                  "maxLength": 1024
                },
                "freshness": {
                  "type": "string",
                  "enum": [
                    "fresh",
                    "stale",
                    "unknown"
                  ]
                },
                "recordedReferences": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 50000
                },
                "observedHash": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "summary": {
                  "type": "string",
                  "maxLength": 2048
                },
                "symbols": {
                  "maxItems": 32,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "maxLength": 256
                      },
                      "provenance": {
                        "type": "string",
                        "enum": [
                          "verified",
                          "inferred",
                          "unavailable"
                        ]
                      }
                    },
                    "required": [
                      "name",
                      "provenance"
                    ]
                  }
                },
                "detail": {
                  "type": "string",
                  "maxLength": 512
                },
                "qualified": {
                  "type": "string",
                  "maxLength": 1024
                }
              },
              "required": [
                "id",
                "kind",
                "label",
                "path",
                "freshness",
                "recordedReferences",
                "summary",
                "symbols",
                "detail",
                "qualified"
              ]
            }
          },
          "edges": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "from": {
                  "type": "string",
                  "maxLength": 1100
                },
                "to": {
                  "type": "string",
                  "maxLength": 1100
                },
                "kind": {
                  "anyOf": [
                    {
                      "type": "string",
                      "const": "references-source"
                    },
                    {
                      "type": "string",
                      "const": "contains"
                    },
                    {
                      "type": "string",
                      "const": "uses"
                    }
                  ]
                },
                "freshness": {
                  "type": "string",
                  "enum": [
                    "fresh",
                    "stale",
                    "unknown"
                  ]
                },
                "recordedHash": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                }
              },
              "required": [
                "from",
                "to",
                "kind",
                "freshness"
              ]
            }
          },
          "omitted": {
            "type": "object",
            "properties": {
              "nodes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "edges": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "nodes",
              "edges"
            ]
          }
        },
        "required": [
          "schemaVersion",
          "snapshot",
          "scope",
          "codeRelationships",
          "nodes",
          "edges",
          "omitted"
        ]
      },
      "WorkflowArtifactCompactEventRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "runID": {
            "type": "string",
            "minLength": 1
          },
          "phaseID": {
            "type": "string",
            "minLength": 1
          },
          "childID": {
            "type": "string",
            "minLength": 1
          },
          "specArtifactID": {
            "type": "string",
            "minLength": 1
          },
          "kind": {
            "type": "string",
            "enum": [
              "summary",
              "finding",
              "patch",
              "verification",
              "metric",
              "log"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "ephemeral",
              "session",
              "durable"
            ]
          },
          "exposeToMainContext": {
            "type": "boolean"
          },
          "summary": {
            "type": "string"
          },
          "redaction": {
            "type": "object",
            "properties": {
              "status": {
                "default": "pending",
                "type": "string",
                "enum": [
                  "none",
                  "redacted",
                  "pending"
                ]
              },
              "summary": {
                "type": "string"
              }
            }
          },
          "evidenceRefs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "artifact",
                    "verification",
                    "finding",
                    "debug-evidence"
                  ]
                },
                "id": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "id"
              ]
            }
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              },
              "updated": {
                "type": "number"
              }
            },
            "required": [
              "created",
              "updated"
            ]
          }
        },
        "required": [
          "id",
          "runID",
          "kind",
          "retention",
          "exposeToMainContext",
          "evidenceRefs",
          "time"
        ]
      },
      "WorkflowArtifactEventRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "runID": {
            "type": "string",
            "minLength": 1
          },
          "phaseID": {
            "type": "string",
            "minLength": 1
          },
          "childID": {
            "type": "string",
            "minLength": 1
          },
          "specArtifactID": {
            "type": "string",
            "minLength": 1
          },
          "kind": {
            "type": "string",
            "enum": [
              "summary",
              "finding",
              "patch",
              "verification",
              "metric",
              "log"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "ephemeral",
              "session",
              "durable"
            ]
          },
          "exposeToMainContext": {
            "type": "boolean"
          },
          "summary": {
            "type": "string"
          },
          "payload": {},
          "redaction": {
            "type": "object",
            "properties": {
              "status": {
                "default": "pending",
                "type": "string",
                "enum": [
                  "none",
                  "redacted",
                  "pending"
                ]
              },
              "summary": {
                "type": "string"
              }
            }
          },
          "evidenceRefs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "artifact",
                    "verification",
                    "finding",
                    "debug-evidence"
                  ]
                },
                "id": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "id"
              ]
            }
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              },
              "updated": {
                "type": "number"
              }
            },
            "required": [
              "created",
              "updated"
            ]
          }
        },
        "required": [
          "id",
          "runID",
          "kind",
          "retention",
          "exposeToMainContext",
          "evidenceRefs",
          "time"
        ]
      },
      "WorkflowBudgetLedgerEventEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "runID": {
            "type": "string",
            "minLength": 1
          },
          "phaseID": {
            "type": "string",
            "minLength": 1
          },
          "childID": {
            "type": "string",
            "minLength": 1
          },
          "kind": {
            "type": "string",
            "enum": [
              "reserve",
              "consume",
              "warn",
              "exceeded",
              "correction"
            ]
          },
          "usageDelta": {
            "type": "object",
            "properties": {
              "totalTokens": {
                "default": 0,
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "inputTokens": {
                "default": 0,
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "outputTokens": {
                "default": 0,
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "toolCalls": {
                "default": 0,
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "childAgents": {
                "default": 0,
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "retries": {
                "default": 0,
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            }
          },
          "message": {
            "type": "string"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              },
              "updated": {
                "type": "number"
              }
            },
            "required": [
              "created",
              "updated"
            ]
          }
        },
        "required": [
          "id",
          "runID",
          "kind",
          "usageDelta",
          "time"
        ]
      },
      "WorkflowChildEventRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "runID": {
            "type": "string",
            "minLength": 1
          },
          "phaseID": {
            "type": "string",
            "minLength": 1
          },
          "taskQueueID": {
            "type": "string",
            "minLength": 1
          },
          "sessionID": {
            "type": "string",
            "minLength": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "blocked_permission",
              "blocked_question",
              "paused",
              "failed",
              "completed",
              "cancelled"
            ]
          },
          "agent": {
            "type": "string"
          },
          "model": {},
          "budgetSlice": {},
          "artifactIDs": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "evidenceRefs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "artifact",
                    "verification",
                    "finding",
                    "debug-evidence"
                  ]
                },
                "id": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "id"
              ]
            }
          },
          "outputSummary": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              },
              "updated": {
                "type": "number"
              },
              "started": {
                "type": "number"
              },
              "completed": {
                "type": "number"
              }
            },
            "required": [
              "created",
              "updated"
            ]
          }
        },
        "required": [
          "id",
          "runID",
          "phaseID",
          "status",
          "artifactIDs",
          "evidenceRefs",
          "time"
        ]
      },
      "WorkflowPhaseEventRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "runID": {
            "type": "string",
            "minLength": 1
          },
          "specPhaseID": {
            "type": "string",
            "minLength": 1
          },
          "position": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "kind": {
            "type": "string",
            "enum": [
              "fanout",
              "sequential",
              "synthesis",
              "verification",
              "noop"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "blocked",
              "paused",
              "failed",
              "completed",
              "cancelled"
            ]
          },
          "agent": {
            "type": "string"
          },
          "modelPolicy": {},
          "budget": {},
          "outputs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              },
              "updated": {
                "type": "number"
              },
              "started": {
                "type": "number"
              },
              "completed": {
                "type": "number"
              }
            },
            "required": [
              "created",
              "updated"
            ]
          }
        },
        "required": [
          "id",
          "runID",
          "specPhaseID",
          "position",
          "name",
          "kind",
          "status",
          "outputs",
          "time"
        ]
      },
      "WorkflowRunEventRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "projectID": {
            "type": "string",
            "minLength": 1
          },
          "directory": {
            "type": "string"
          },
          "parentSessionID": {
            "type": "string",
            "minLength": 1
          },
          "sourceTemplateID": {
            "type": "string"
          },
          "sourceTaskID": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "blocked",
              "paused",
              "failed",
              "completed",
              "cancelled"
            ]
          },
          "currentPhaseID": {
            "type": "string",
            "minLength": 1
          },
          "spec": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "number",
                "const": 1
              },
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80,
                "pattern": "^[a-z][a-z0-9-]*$"
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "description": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1000
              },
              "tags": {
                "default": [],
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80,
                  "pattern": "^[a-z][a-z0-9-]*$"
                }
              },
              "trigger": {
                "default": {
                  "kind": "manual",
                  "source": "prompt"
                },
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "manual"
                      },
                      "source": {
                        "default": "prompt",
                        "type": "string",
                        "enum": [
                          "prompt",
                          "command",
                          "api"
                        ]
                      }
                    },
                    "required": [
                      "kind"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "scheduled"
                      },
                      "schedule": {
                        "type": "string",
                        "minLength": 1
                      },
                      "timezone": {
                        "type": "string",
                        "minLength": 1
                      },
                      "enabled": {
                        "default": false,
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "kind",
                      "schedule"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "command"
                      },
                      "command": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "kind"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "api"
                      },
                      "route": {
                        "type": "string",
                        "minLength": 1
                      },
                      "enabled": {
                        "default": false,
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "kind"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "webhook"
                      },
                      "event": {
                        "type": "string",
                        "minLength": 1
                      },
                      "enabled": {
                        "default": false,
                        "type": "boolean",
                        "const": false
                      },
                      "securityGate": {
                        "default": "required",
                        "type": "string",
                        "const": "required"
                      }
                    },
                    "required": [
                      "kind",
                      "event"
                    ]
                  }
                ]
              },
              "inputs": {
                "default": [],
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "pattern": "^[a-z][a-z0-9-]*$"
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "description": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500
                    },
                    "type": {
                      "default": "string",
                      "type": "string",
                      "enum": [
                        "string",
                        "number",
                        "boolean",
                        "json",
                        "path",
                        "string-array"
                      ]
                    },
                    "required": {
                      "default": false,
                      "type": "boolean"
                    },
                    "sensitive": {
                      "default": false,
                      "type": "boolean"
                    },
                    "default": {}
                  },
                  "required": [
                    "id"
                  ]
                }
              },
              "routine": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "default": false,
                    "type": "boolean"
                  },
                  "mode": {
                    "default": "manual",
                    "type": "string",
                    "enum": [
                      "manual",
                      "scheduled",
                      "api",
                      "webhook"
                    ]
                  },
                  "schedule": {
                    "type": "string",
                    "minLength": 1
                  },
                  "timezone": {
                    "type": "string",
                    "minLength": 1
                  },
                  "apiRoute": {
                    "type": "string",
                    "minLength": 1
                  },
                  "webhookEvent": {
                    "type": "string",
                    "minLength": 1
                  },
                  "securityGate": {
                    "default": "local-only",
                    "type": "string",
                    "enum": [
                      "local-only",
                      "required"
                    ]
                  }
                }
              },
              "budget": {
                "default": {
                  "maxTotalTokens": 100000,
                  "maxInputTokensPerChild": 50000,
                  "maxOutputTokensPerChild": 8000,
                  "maxWallTimeMs": 3600000,
                  "maxConcurrentAgents": 3,
                  "maxTotalAgents": 25,
                  "maxToolCalls": 500,
                  "maxRetries": 1
                },
                "type": "object",
                "properties": {
                  "maxTotalTokens": {
                    "default": 100000,
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "maxInputTokensPerChild": {
                    "default": 50000,
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "maxOutputTokensPerChild": {
                    "default": 8000,
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "maxWallTimeMs": {
                    "default": 3600000,
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "maxConcurrentAgents": {
                    "default": 3,
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 16
                  },
                  "maxTotalAgents": {
                    "default": 25,
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 1000
                  },
                  "maxToolCalls": {
                    "default": 500,
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "maxRetries": {
                    "default": 1,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 5
                  }
                }
              },
              "pacing": {
                "default": {
                  "maxRequestsPerMinute": 12,
                  "maxTokensPerMinute": 200000
                },
                "type": "object",
                "properties": {
                  "maxRequestsPerMinute": {
                    "default": 12,
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 120
                  },
                  "maxTokensPerMinute": {
                    "default": 200000,
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 2000000
                  }
                }
              },
              "modelPolicy": {
                "default": {
                  "effort": "normal",
                  "allowedProviders": [],
                  "routing": []
                },
                "type": "object",
                "properties": {
                  "defaultModel": {
                    "type": "string",
                    "minLength": 1
                  },
                  "cheapModel": {
                    "type": "string",
                    "minLength": 1
                  },
                  "strongModel": {
                    "type": "string",
                    "minLength": 1
                  },
                  "plannerModel": {
                    "type": "string",
                    "minLength": 1
                  },
                  "workerModel": {
                    "type": "string",
                    "minLength": 1
                  },
                  "verifierModel": {
                    "type": "string",
                    "minLength": 1
                  },
                  "synthesizerModel": {
                    "type": "string",
                    "minLength": 1
                  },
                  "effort": {
                    "default": "normal",
                    "type": "string",
                    "enum": [
                      "normal",
                      "deep",
                      "workflow",
                      "max-workflow"
                    ]
                  },
                  "allowedProviders": {
                    "default": [],
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "routing": {
                    "default": [],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "phaseKind": {
                          "type": "string",
                          "enum": [
                            "fanout",
                            "sequential",
                            "synthesis",
                            "verification",
                            "noop"
                          ]
                        },
                        "use": {
                          "type": "string",
                          "enum": [
                            "planner",
                            "worker",
                            "verifier",
                            "synthesizer"
                          ]
                        }
                      },
                      "required": [
                        "use"
                      ]
                    }
                  }
                }
              },
              "permissions": {
                "default": {
                  "writePolicy": "read-only",
                  "allowedTools": [],
                  "networkPolicy": "inherit",
                  "escalationPolicy": "ask"
                },
                "type": "object",
                "properties": {
                  "writePolicy": {
                    "default": "read-only",
                    "type": "string",
                    "enum": [
                      "read-only",
                      "serialized",
                      "worktree-required"
                    ]
                  },
                  "allowedTools": {
                    "default": [],
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "networkPolicy": {
                    "default": "inherit",
                    "type": "string",
                    "enum": [
                      "inherit",
                      "disabled",
                      "allowed"
                    ]
                  },
                  "escalationPolicy": {
                    "default": "ask",
                    "type": "string",
                    "enum": [
                      "inherit",
                      "ask",
                      "deny"
                    ]
                  }
                }
              },
              "artifacts": {
                "default": [],
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "pattern": "^[a-z][a-z0-9-]*$"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "summary",
                        "finding",
                        "patch",
                        "verification",
                        "metric",
                        "log"
                      ]
                    },
                    "retention": {
                      "default": "session",
                      "type": "string",
                      "enum": [
                        "ephemeral",
                        "session",
                        "durable"
                      ]
                    },
                    "exposeToMainContext": {
                      "default": false,
                      "type": "boolean"
                    },
                    "redaction": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "default": "pending",
                          "type": "string",
                          "enum": [
                            "none",
                            "redacted",
                            "pending"
                          ]
                        },
                        "summary": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        }
                      }
                    }
                  },
                  "required": [
                    "id",
                    "kind"
                  ]
                }
              },
              "verification": {
                "default": {
                  "mode": "optional",
                  "commands": [],
                  "requiredArtifactIds": []
                },
                "type": "object",
                "properties": {
                  "mode": {
                    "default": "optional",
                    "type": "string",
                    "enum": [
                      "required",
                      "optional",
                      "deferred",
                      "skipped"
                    ]
                  },
                  "workflow": {
                    "type": "string",
                    "enum": [
                      "review",
                      "debug",
                      "qa"
                    ]
                  },
                  "commands": {
                    "default": [],
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "requiredArtifactIds": {
                    "default": [],
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "pattern": "^[a-z][a-z0-9-]*$"
                    }
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                }
              },
              "synthesis": {
                "default": {
                  "outputFormat": "markdown",
                  "exposeToMainContext": true,
                  "requiredArtifactIds": []
                },
                "type": "object",
                "properties": {
                  "agent": {
                    "type": "string",
                    "minLength": 1
                  },
                  "model": {
                    "type": "string",
                    "minLength": 1
                  },
                  "outputFormat": {
                    "default": "markdown",
                    "type": "string",
                    "enum": [
                      "markdown",
                      "json",
                      "table",
                      "findings"
                    ]
                  },
                  "exposeToMainContext": {
                    "default": true,
                    "type": "boolean"
                  },
                  "requiredArtifactIds": {
                    "default": [],
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "pattern": "^[a-z][a-z0-9-]*$"
                    }
                  }
                }
              },
              "phases": {
                "minItems": 1,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "pattern": "^[a-z][a-z0-9-]*$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "fanout",
                        "sequential",
                        "synthesis",
                        "verification",
                        "noop"
                      ]
                    },
                    "prompt": {
                      "type": "string",
                      "minLength": 1
                    },
                    "agent": {
                      "type": "string",
                      "minLength": 1
                    },
                    "inputs": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "outputs": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80,
                        "pattern": "^[a-z][a-z0-9-]*$"
                      }
                    },
                    "dependsOn": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80,
                        "pattern": "^[a-z][a-z0-9-]*$"
                      }
                    },
                    "maxParallel": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 16
                    },
                    "mergeStrategy": {
                      "default": "all",
                      "type": "string",
                      "enum": [
                        "all",
                        "first-success",
                        "majority",
                        "vote-with-critic",
                        "critic-confirmation",
                        "custom-reducer"
                      ]
                    },
                    "modelPolicy": {
                      "type": "object",
                      "properties": {
                        "defaultModel": {
                          "type": "string",
                          "minLength": 1
                        },
                        "cheapModel": {
                          "type": "string",
                          "minLength": 1
                        },
                        "strongModel": {
                          "type": "string",
                          "minLength": 1
                        },
                        "plannerModel": {
                          "type": "string",
                          "minLength": 1
                        },
                        "workerModel": {
                          "type": "string",
                          "minLength": 1
                        },
                        "verifierModel": {
                          "type": "string",
                          "minLength": 1
                        },
                        "synthesizerModel": {
                          "type": "string",
                          "minLength": 1
                        },
                        "effort": {
                          "default": "normal",
                          "type": "string",
                          "enum": [
                            "normal",
                            "deep",
                            "workflow",
                            "max-workflow"
                          ]
                        },
                        "allowedProviders": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "routing": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "phaseKind": {
                                "type": "string",
                                "enum": [
                                  "fanout",
                                  "sequential",
                                  "synthesis",
                                  "verification",
                                  "noop"
                                ]
                              },
                              "use": {
                                "type": "string",
                                "enum": [
                                  "planner",
                                  "worker",
                                  "verifier",
                                  "synthesizer"
                                ]
                              }
                            },
                            "required": [
                              "use"
                            ]
                          }
                        }
                      }
                    },
                    "budget": {
                      "type": "object",
                      "properties": {
                        "maxTotalTokens": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "maxInputTokensPerChild": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "maxOutputTokensPerChild": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "maxWallTimeMs": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "maxConcurrentAgents": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 16
                        },
                        "maxTotalAgents": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 1000
                        },
                        "maxToolCalls": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "maxRetries": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 5
                        }
                      }
                    },
                    "pacing": {
                      "type": "object",
                      "properties": {
                        "maxRequestsPerMinute": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 120
                        },
                        "maxTokensPerMinute": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 2000000
                        }
                      }
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "kind"
                  ]
                }
              }
            },
            "required": [
              "schemaVersion",
              "id",
              "name",
              "description",
              "phases"
            ]
          },
          "inputValues": {
            "default": {},
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "budget": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "budgetUsage": {
            "type": "object",
            "properties": {
              "totalTokens": {
                "default": 0,
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "inputTokens": {
                "default": 0,
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "outputTokens": {
                "default": 0,
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "toolCalls": {
                "default": 0,
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "childAgents": {
                "default": 0,
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "retries": {
                "default": 0,
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            }
          },
          "verificationEnvelopeIDs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string"
          },
          "time": {
            "type": "object",
            "properties": {
              "created": {
                "type": "number"
              },
              "updated": {
                "type": "number"
              },
              "started": {
                "type": "number"
              },
              "completed": {
                "type": "number"
              }
            },
            "required": [
              "created",
              "updated"
            ]
          }
        },
        "required": [
          "id",
          "projectID",
          "directory",
          "status",
          "spec",
          "budget",
          "budgetUsage",
          "verificationEnvelopeIDs",
          "time"
        ]
      },
      "WorkflowVerificationAttachedEventRecord": {
        "type": "object",
        "properties": {
          "runID": {
            "type": "string",
            "minLength": 1
          },
          "envelopeIDs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "run": {
            "$ref": "#/components/schemas/WorkflowRunEventRecord"
          }
        },
        "required": [
          "runID",
          "envelopeIDs",
          "run"
        ]
      },
      "Worktree": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "branch": {
            "type": "string"
          },
          "directory": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "branch",
          "directory"
        ]
      },
      "WorktreeCreateInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "startCommand": {
            "description": "Additional startup script to run after the project's start command",
            "type": "string"
          }
        }
      },
      "WorktreeListItem": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "directory": {
            "type": "string"
          },
          "branch": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "directory"
        ]
      },
      "WorktreeRemoveInput": {
        "type": "object",
        "properties": {
          "directory": {
            "type": "string"
          }
        },
        "required": [
          "directory"
        ]
      },
      "WorktreeResetInput": {
        "type": "object",
        "properties": {
          "directory": {
            "type": "string"
          }
        },
        "required": [
          "directory"
        ]
      }
    }
  }
}
