{
  "openapi": "3.2.0",
  "info": {
    "title": "Nylorun Runtime API",
    "version": "0.32.0-beta",
    "x-nylorun-protocol": {
      "min": 16,
      "max": 18,
      "features": [
        "studio-principal",
        "artifacts",
        "management-api",
        "resource-server",
        "model-inputs",
        "flat-manifest",
        "harness-boundary",
        "agents",
        "session-queue",
        "usage-by-kind",
        "tenant-fixture-model",
        "transcript-events",
        "subject-headers",
        "ag-ui-endpoint",
        "a2a-endpoint",
        "sandbox-pods",
        "trusted-issuers",
        "session-reads",
        "calls-export",
        "credential-coverage",
        "tool-calls",
        "environment-setup",
        "environment-disk-versions",
        "tool-policy",
        "traces",
        "artifact-reads",
        "gateway-credentials",
        "agent-folders"
      ]
    },
    "description": "For developers: agent manifests, Agents, sessions (with AG-UI and A2A) and artifacts, through `@nylorun/agents`. Every Tenant serves it on its one URL, beside the Management API (`/openapi/management.json`). Every request sends `Nylorun-Protocol`. Who may call each operation is its `security` and its `x-nylorun-credentials` and `x-nylorun-scopes` (the subject scopes that reach it) fields: an application key (servers) or a trusted issuer's token (browsers and apps)."
  },
  "servers": [
    {
      "url": "{origin}",
      "description": "A Runtime: a local Tenant (`nylorun start`), or where yours runs",
      "variables": {
        "origin": {
          "default": "http://localhost:8787"
        }
      }
    }
  ],
  "components": {
    "securitySchemes": {
      "applicationKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "An application key of the Tenant (`PUT /v1/tenant/keys/{keyId}`), or Studio's key, derived from the admin key. With `Nylorun-Subject` and `Nylorun-Scopes`, it acts for that person, narrowed to those scopes. Never accepted from a browser (`Origin`)."
      },
      "managementKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "A management key of the Tenant (role `management`): it reaches the Management API (`/v1/tenant/*`) and `/v1/me`, as itself, never for a subject. Issued only on the Tenant's machine (`nylorun-operate keys put <id> --role management`) or from `NYLORUN_MANAGEMENT_KEY_FILE`. Never accepted from a browser (`Origin`)."
      },
      "issuerToken": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "A JWT from a trusted issuer of the Host's identity file (Host feature `trusted-issuers`): one person, with the issuer's scopes, agents and sandbox grants, until it expires. Accepted from servers and browsers alike; CORS is the operator's proxy's."
      }
    },
    "schemas": {
      "AgUiRunAgentInput": {
        "type": "object",
        "properties": {
          "threadId": {
            "type": "string"
          },
          "runId": {
            "type": "string"
          },
          "protocolVersion": {
            "type": "string"
          },
          "parentRunId": {
            "type": "string"
          },
          "state": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          },
          "messages": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "subagentRunId": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string",
                      "const": "developer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "encryptedValue": {
                      "type": "string"
                    },
                    "metadata": {},
                    "content": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "role",
                    "content"
                  ],
                  "additionalProperties": {}
                },
                {
                  "type": "object",
                  "properties": {
                    "subagentRunId": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string",
                      "const": "system"
                    },
                    "name": {
                      "type": "string"
                    },
                    "encryptedValue": {
                      "type": "string"
                    },
                    "metadata": {},
                    "content": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "role",
                    "content"
                  ],
                  "additionalProperties": {}
                },
                {
                  "type": "object",
                  "properties": {
                    "subagentRunId": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string",
                      "const": "assistant"
                    },
                    "name": {
                      "type": "string"
                    },
                    "encryptedValue": {
                      "type": "string"
                    },
                    "metadata": {},
                    "content": {
                      "type": "string"
                    },
                    "toolCalls": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "const": "function"
                          },
                          "function": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "arguments": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "name",
                              "arguments"
                            ],
                            "additionalProperties": {}
                          },
                          "encryptedValue": {
                            "type": "string"
                          },
                          "metadata": {}
                        },
                        "required": [
                          "id",
                          "type",
                          "function"
                        ],
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "id",
                    "role"
                  ],
                  "additionalProperties": {}
                },
                {
                  "type": "object",
                  "properties": {
                    "subagentRunId": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string",
                      "const": "user"
                    },
                    "name": {
                      "type": "string"
                    },
                    "encryptedValue": {
                      "type": "string"
                    },
                    "metadata": {},
                    "content": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "text"
                                  },
                                  "id": {
                                    "type": "string"
                                  },
                                  "text": {
                                    "type": "string"
                                  },
                                  "metadata": {}
                                },
                                "required": [
                                  "type",
                                  "text"
                                ],
                                "additionalProperties": {}
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "image"
                                  },
                                  "id": {
                                    "type": "string"
                                  },
                                  "source": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "data"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value",
                                          "mimeType"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "url"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "file"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "provider": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value"
                                        ],
                                        "additionalProperties": {}
                                      }
                                    ]
                                  },
                                  "metadata": {}
                                },
                                "required": [
                                  "type",
                                  "source"
                                ],
                                "additionalProperties": {}
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "audio"
                                  },
                                  "id": {
                                    "type": "string"
                                  },
                                  "source": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "data"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value",
                                          "mimeType"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "url"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "file"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "provider": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value"
                                        ],
                                        "additionalProperties": {}
                                      }
                                    ]
                                  },
                                  "metadata": {}
                                },
                                "required": [
                                  "type",
                                  "source"
                                ],
                                "additionalProperties": {}
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "video"
                                  },
                                  "id": {
                                    "type": "string"
                                  },
                                  "source": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "data"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value",
                                          "mimeType"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "url"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "file"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "provider": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value"
                                        ],
                                        "additionalProperties": {}
                                      }
                                    ]
                                  },
                                  "metadata": {}
                                },
                                "required": [
                                  "type",
                                  "source"
                                ],
                                "additionalProperties": {}
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "document"
                                  },
                                  "id": {
                                    "type": "string"
                                  },
                                  "source": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "data"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value",
                                          "mimeType"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "url"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "file"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "provider": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value"
                                        ],
                                        "additionalProperties": {}
                                      }
                                    ]
                                  },
                                  "metadata": {}
                                },
                                "required": [
                                  "type",
                                  "source"
                                ],
                                "additionalProperties": {}
                              }
                            ]
                          }
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "role",
                    "content"
                  ],
                  "additionalProperties": {}
                },
                {
                  "type": "object",
                  "properties": {
                    "subagentRunId": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string",
                      "const": "tool"
                    },
                    "content": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "text"
                                  },
                                  "id": {
                                    "type": "string"
                                  },
                                  "text": {
                                    "type": "string"
                                  },
                                  "metadata": {}
                                },
                                "required": [
                                  "type",
                                  "text"
                                ],
                                "additionalProperties": {}
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "image"
                                  },
                                  "id": {
                                    "type": "string"
                                  },
                                  "source": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "data"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value",
                                          "mimeType"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "url"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "file"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "provider": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value"
                                        ],
                                        "additionalProperties": {}
                                      }
                                    ]
                                  },
                                  "metadata": {}
                                },
                                "required": [
                                  "type",
                                  "source"
                                ],
                                "additionalProperties": {}
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "audio"
                                  },
                                  "id": {
                                    "type": "string"
                                  },
                                  "source": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "data"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value",
                                          "mimeType"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "url"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "file"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "provider": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value"
                                        ],
                                        "additionalProperties": {}
                                      }
                                    ]
                                  },
                                  "metadata": {}
                                },
                                "required": [
                                  "type",
                                  "source"
                                ],
                                "additionalProperties": {}
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "video"
                                  },
                                  "id": {
                                    "type": "string"
                                  },
                                  "source": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "data"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value",
                                          "mimeType"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "url"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "file"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "provider": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value"
                                        ],
                                        "additionalProperties": {}
                                      }
                                    ]
                                  },
                                  "metadata": {}
                                },
                                "required": [
                                  "type",
                                  "source"
                                ],
                                "additionalProperties": {}
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "document"
                                  },
                                  "id": {
                                    "type": "string"
                                  },
                                  "source": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "data"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value",
                                          "mimeType"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "url"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "file"
                                          },
                                          "value": {
                                            "type": "string"
                                          },
                                          "provider": {
                                            "type": "string"
                                          },
                                          "mimeType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "value"
                                        ],
                                        "additionalProperties": {}
                                      }
                                    ]
                                  },
                                  "metadata": {}
                                },
                                "required": [
                                  "type",
                                  "source"
                                ],
                                "additionalProperties": {}
                              }
                            ]
                          }
                        }
                      ]
                    },
                    "toolCallId": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "encryptedValue": {
                      "type": "string"
                    },
                    "metadata": {}
                  },
                  "required": [
                    "id",
                    "role",
                    "content",
                    "toolCallId"
                  ],
                  "additionalProperties": {}
                },
                {
                  "type": "object",
                  "properties": {
                    "subagentRunId": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string",
                      "const": "activity"
                    },
                    "activityType": {
                      "type": "string"
                    },
                    "content": {},
                    "metadata": {}
                  },
                  "required": [
                    "id",
                    "role",
                    "activityType",
                    "content"
                  ],
                  "additionalProperties": {}
                },
                {
                  "type": "object",
                  "properties": {
                    "subagentRunId": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string",
                      "const": "reasoning"
                    },
                    "content": {
                      "type": "string"
                    },
                    "encryptedValue": {
                      "type": "string"
                    },
                    "metadata": {}
                  },
                  "required": [
                    "id",
                    "role",
                    "content"
                  ],
                  "additionalProperties": {}
                }
              ]
            }
          },
          "tools": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "parameters": {},
                "metadata": {}
              },
              "required": [
                "name",
                "description"
              ],
              "additionalProperties": {}
            }
          },
          "context": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "description": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              },
              "required": [
                "description",
                "value"
              ],
              "additionalProperties": {}
            }
          },
          "forwardedProps": {},
          "resume": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "interruptId": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "resolved",
                    "cancelled"
                  ]
                },
                "payload": {},
                "metadata": {}
              },
              "required": [
                "interruptId",
                "status"
              ],
              "additionalProperties": {}
            }
          }
        },
        "required": [
          "threadId",
          "runId",
          "messages"
        ],
        "additionalProperties": {}
      },
      "AgUiEvent": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "TEXT_MESSAGE_START"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "messageId": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "enum": [
                  "developer",
                  "system",
                  "assistant",
                  "user"
                ]
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "messageId"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "TEXT_MESSAGE_CONTENT"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "messageId": {
                "type": "string"
              },
              "delta": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "messageId",
              "delta"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "TEXT_MESSAGE_END"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "messageId": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "messageId"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "TEXT_MESSAGE_CHUNK"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "messageId": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "enum": [
                  "developer",
                  "system",
                  "assistant",
                  "user"
                ]
              },
              "delta": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "TOOL_CALL_START"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "toolCallId": {
                "type": "string"
              },
              "toolCallName": {
                "type": "string"
              },
              "parentMessageId": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "toolCallId",
              "toolCallName"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "TOOL_CALL_ARGS"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "toolCallId": {
                "type": "string"
              },
              "delta": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "toolCallId",
              "delta"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "TOOL_CALL_END"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "toolCallId": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "toolCallId"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "TOOL_CALL_CHUNK"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "toolCallId": {
                "type": "string"
              },
              "toolCallName": {
                "type": "string"
              },
              "parentMessageId": {
                "type": "string"
              },
              "delta": {
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "TOOL_CALL_RESULT"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "messageId": {
                "type": "string"
              },
              "toolCallId": {
                "type": "string"
              },
              "content": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "text"
                            },
                            "id": {
                              "type": "string"
                            },
                            "text": {
                              "type": "string"
                            },
                            "metadata": {}
                          },
                          "required": [
                            "type",
                            "text"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "image"
                            },
                            "id": {
                              "type": "string"
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "data"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value",
                                    "mimeType"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "url"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "file"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "provider": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                }
                              ]
                            },
                            "metadata": {}
                          },
                          "required": [
                            "type",
                            "source"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "audio"
                            },
                            "id": {
                              "type": "string"
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "data"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value",
                                    "mimeType"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "url"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "file"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "provider": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                }
                              ]
                            },
                            "metadata": {}
                          },
                          "required": [
                            "type",
                            "source"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "video"
                            },
                            "id": {
                              "type": "string"
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "data"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value",
                                    "mimeType"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "url"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "file"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "provider": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                }
                              ]
                            },
                            "metadata": {}
                          },
                          "required": [
                            "type",
                            "source"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "document"
                            },
                            "id": {
                              "type": "string"
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "data"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value",
                                    "mimeType"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "url"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "file"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "provider": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                }
                              ]
                            },
                            "metadata": {}
                          },
                          "required": [
                            "type",
                            "source"
                          ],
                          "additionalProperties": {}
                        }
                      ]
                    }
                  }
                ]
              },
              "role": {
                "type": "string",
                "const": "tool"
              }
            },
            "required": [
              "type",
              "messageId",
              "toolCallId",
              "content"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "STATE_SNAPSHOT"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "snapshot": {}
            },
            "required": [
              "type",
              "snapshot"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "STATE_DELTA"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "delta": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "op": {
                          "type": "string",
                          "const": "add"
                        },
                        "path": {
                          "type": "string",
                          "pattern": "^(\\/([^/~]|~[01])*)*$"
                        },
                        "value": {}
                      },
                      "required": [
                        "op",
                        "path",
                        "value"
                      ],
                      "additionalProperties": {},
                      "specOpen": true
                    },
                    {
                      "type": "object",
                      "properties": {
                        "op": {
                          "type": "string",
                          "const": "remove"
                        },
                        "path": {
                          "type": "string",
                          "pattern": "^(\\/([^/~]|~[01])*)*$"
                        }
                      },
                      "required": [
                        "op",
                        "path"
                      ],
                      "additionalProperties": {},
                      "specOpen": true
                    },
                    {
                      "type": "object",
                      "properties": {
                        "op": {
                          "type": "string",
                          "const": "replace"
                        },
                        "path": {
                          "type": "string",
                          "pattern": "^(\\/([^/~]|~[01])*)*$"
                        },
                        "value": {}
                      },
                      "required": [
                        "op",
                        "path",
                        "value"
                      ],
                      "additionalProperties": {},
                      "specOpen": true
                    },
                    {
                      "type": "object",
                      "properties": {
                        "op": {
                          "type": "string",
                          "const": "move"
                        },
                        "from": {
                          "type": "string",
                          "pattern": "^(\\/([^/~]|~[01])*)*$"
                        },
                        "path": {
                          "type": "string",
                          "pattern": "^(\\/([^/~]|~[01])*)*$"
                        }
                      },
                      "required": [
                        "op",
                        "from",
                        "path"
                      ],
                      "additionalProperties": {},
                      "specOpen": true
                    },
                    {
                      "type": "object",
                      "properties": {
                        "op": {
                          "type": "string",
                          "const": "copy"
                        },
                        "from": {
                          "type": "string",
                          "pattern": "^(\\/([^/~]|~[01])*)*$"
                        },
                        "path": {
                          "type": "string",
                          "pattern": "^(\\/([^/~]|~[01])*)*$"
                        }
                      },
                      "required": [
                        "op",
                        "from",
                        "path"
                      ],
                      "additionalProperties": {},
                      "specOpen": true
                    },
                    {
                      "type": "object",
                      "properties": {
                        "op": {
                          "type": "string",
                          "const": "test"
                        },
                        "path": {
                          "type": "string",
                          "pattern": "^(\\/([^/~]|~[01])*)*$"
                        },
                        "value": {}
                      },
                      "required": [
                        "op",
                        "path",
                        "value"
                      ],
                      "additionalProperties": {},
                      "specOpen": true
                    }
                  ]
                }
              }
            },
            "required": [
              "type",
              "delta"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "MESSAGES_SNAPSHOT"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "messages": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "subagentRunId": {
                          "type": "string"
                        },
                        "id": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string",
                          "const": "developer"
                        },
                        "name": {
                          "type": "string"
                        },
                        "encryptedValue": {
                          "type": "string"
                        },
                        "metadata": {},
                        "content": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "role",
                        "content"
                      ],
                      "additionalProperties": {}
                    },
                    {
                      "type": "object",
                      "properties": {
                        "subagentRunId": {
                          "type": "string"
                        },
                        "id": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string",
                          "const": "system"
                        },
                        "name": {
                          "type": "string"
                        },
                        "encryptedValue": {
                          "type": "string"
                        },
                        "metadata": {},
                        "content": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "role",
                        "content"
                      ],
                      "additionalProperties": {}
                    },
                    {
                      "type": "object",
                      "properties": {
                        "subagentRunId": {
                          "type": "string"
                        },
                        "id": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string",
                          "const": "assistant"
                        },
                        "name": {
                          "type": "string"
                        },
                        "encryptedValue": {
                          "type": "string"
                        },
                        "metadata": {},
                        "content": {
                          "type": "string"
                        },
                        "toolCalls": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string",
                                "const": "function"
                              },
                              "function": {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "arguments": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "name",
                                  "arguments"
                                ],
                                "additionalProperties": {}
                              },
                              "encryptedValue": {
                                "type": "string"
                              },
                              "metadata": {}
                            },
                            "required": [
                              "id",
                              "type",
                              "function"
                            ],
                            "additionalProperties": {}
                          }
                        }
                      },
                      "required": [
                        "id",
                        "role"
                      ],
                      "additionalProperties": {}
                    },
                    {
                      "type": "object",
                      "properties": {
                        "subagentRunId": {
                          "type": "string"
                        },
                        "id": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string",
                          "const": "user"
                        },
                        "name": {
                          "type": "string"
                        },
                        "encryptedValue": {
                          "type": "string"
                        },
                        "metadata": {},
                        "content": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "array",
                              "items": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "text"
                                      },
                                      "id": {
                                        "type": "string"
                                      },
                                      "text": {
                                        "type": "string"
                                      },
                                      "metadata": {}
                                    },
                                    "required": [
                                      "type",
                                      "text"
                                    ],
                                    "additionalProperties": {}
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "image"
                                      },
                                      "id": {
                                        "type": "string"
                                      },
                                      "source": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "data"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value",
                                              "mimeType"
                                            ],
                                            "additionalProperties": {}
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "url"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value"
                                            ],
                                            "additionalProperties": {}
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "file"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "provider": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value"
                                            ],
                                            "additionalProperties": {}
                                          }
                                        ]
                                      },
                                      "metadata": {}
                                    },
                                    "required": [
                                      "type",
                                      "source"
                                    ],
                                    "additionalProperties": {}
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "audio"
                                      },
                                      "id": {
                                        "type": "string"
                                      },
                                      "source": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "data"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value",
                                              "mimeType"
                                            ],
                                            "additionalProperties": {}
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "url"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value"
                                            ],
                                            "additionalProperties": {}
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "file"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "provider": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value"
                                            ],
                                            "additionalProperties": {}
                                          }
                                        ]
                                      },
                                      "metadata": {}
                                    },
                                    "required": [
                                      "type",
                                      "source"
                                    ],
                                    "additionalProperties": {}
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "video"
                                      },
                                      "id": {
                                        "type": "string"
                                      },
                                      "source": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "data"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value",
                                              "mimeType"
                                            ],
                                            "additionalProperties": {}
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "url"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value"
                                            ],
                                            "additionalProperties": {}
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "file"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "provider": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value"
                                            ],
                                            "additionalProperties": {}
                                          }
                                        ]
                                      },
                                      "metadata": {}
                                    },
                                    "required": [
                                      "type",
                                      "source"
                                    ],
                                    "additionalProperties": {}
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "document"
                                      },
                                      "id": {
                                        "type": "string"
                                      },
                                      "source": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "data"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value",
                                              "mimeType"
                                            ],
                                            "additionalProperties": {}
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "url"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value"
                                            ],
                                            "additionalProperties": {}
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "file"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "provider": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value"
                                            ],
                                            "additionalProperties": {}
                                          }
                                        ]
                                      },
                                      "metadata": {}
                                    },
                                    "required": [
                                      "type",
                                      "source"
                                    ],
                                    "additionalProperties": {}
                                  }
                                ]
                              }
                            }
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "role",
                        "content"
                      ],
                      "additionalProperties": {}
                    },
                    {
                      "type": "object",
                      "properties": {
                        "subagentRunId": {
                          "type": "string"
                        },
                        "id": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string",
                          "const": "tool"
                        },
                        "content": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "array",
                              "items": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "text"
                                      },
                                      "id": {
                                        "type": "string"
                                      },
                                      "text": {
                                        "type": "string"
                                      },
                                      "metadata": {}
                                    },
                                    "required": [
                                      "type",
                                      "text"
                                    ],
                                    "additionalProperties": {}
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "image"
                                      },
                                      "id": {
                                        "type": "string"
                                      },
                                      "source": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "data"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value",
                                              "mimeType"
                                            ],
                                            "additionalProperties": {}
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "url"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value"
                                            ],
                                            "additionalProperties": {}
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "file"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "provider": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value"
                                            ],
                                            "additionalProperties": {}
                                          }
                                        ]
                                      },
                                      "metadata": {}
                                    },
                                    "required": [
                                      "type",
                                      "source"
                                    ],
                                    "additionalProperties": {}
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "audio"
                                      },
                                      "id": {
                                        "type": "string"
                                      },
                                      "source": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "data"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value",
                                              "mimeType"
                                            ],
                                            "additionalProperties": {}
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "url"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value"
                                            ],
                                            "additionalProperties": {}
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "file"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "provider": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value"
                                            ],
                                            "additionalProperties": {}
                                          }
                                        ]
                                      },
                                      "metadata": {}
                                    },
                                    "required": [
                                      "type",
                                      "source"
                                    ],
                                    "additionalProperties": {}
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "video"
                                      },
                                      "id": {
                                        "type": "string"
                                      },
                                      "source": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "data"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value",
                                              "mimeType"
                                            ],
                                            "additionalProperties": {}
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "url"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value"
                                            ],
                                            "additionalProperties": {}
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "file"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "provider": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value"
                                            ],
                                            "additionalProperties": {}
                                          }
                                        ]
                                      },
                                      "metadata": {}
                                    },
                                    "required": [
                                      "type",
                                      "source"
                                    ],
                                    "additionalProperties": {}
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "document"
                                      },
                                      "id": {
                                        "type": "string"
                                      },
                                      "source": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "data"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value",
                                              "mimeType"
                                            ],
                                            "additionalProperties": {}
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "url"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value"
                                            ],
                                            "additionalProperties": {}
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "file"
                                              },
                                              "value": {
                                                "type": "string"
                                              },
                                              "provider": {
                                                "type": "string"
                                              },
                                              "mimeType": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "value"
                                            ],
                                            "additionalProperties": {}
                                          }
                                        ]
                                      },
                                      "metadata": {}
                                    },
                                    "required": [
                                      "type",
                                      "source"
                                    ],
                                    "additionalProperties": {}
                                  }
                                ]
                              }
                            }
                          ]
                        },
                        "toolCallId": {
                          "type": "string"
                        },
                        "error": {
                          "type": "string"
                        },
                        "encryptedValue": {
                          "type": "string"
                        },
                        "metadata": {}
                      },
                      "required": [
                        "id",
                        "role",
                        "content",
                        "toolCallId"
                      ],
                      "additionalProperties": {}
                    },
                    {
                      "type": "object",
                      "properties": {
                        "subagentRunId": {
                          "type": "string"
                        },
                        "id": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string",
                          "const": "activity"
                        },
                        "activityType": {
                          "type": "string"
                        },
                        "content": {},
                        "metadata": {}
                      },
                      "required": [
                        "id",
                        "role",
                        "activityType",
                        "content"
                      ],
                      "additionalProperties": {}
                    },
                    {
                      "type": "object",
                      "properties": {
                        "subagentRunId": {
                          "type": "string"
                        },
                        "id": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string",
                          "const": "reasoning"
                        },
                        "content": {
                          "type": "string"
                        },
                        "encryptedValue": {
                          "type": "string"
                        },
                        "metadata": {}
                      },
                      "required": [
                        "id",
                        "role",
                        "content"
                      ],
                      "additionalProperties": {}
                    }
                  ]
                }
              }
            },
            "required": [
              "type",
              "messages"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "ACTIVITY_SNAPSHOT"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "messageId": {
                "type": "string"
              },
              "activityType": {
                "type": "string"
              },
              "content": {},
              "replace": {
                "type": "boolean"
              }
            },
            "required": [
              "type",
              "messageId",
              "activityType",
              "content"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "ACTIVITY_DELTA"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "messageId": {
                "type": "string"
              },
              "activityType": {
                "type": "string"
              },
              "patch": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "op": {
                          "type": "string",
                          "const": "add"
                        },
                        "path": {
                          "type": "string",
                          "pattern": "^(\\/([^/~]|~[01])*)*$"
                        },
                        "value": {}
                      },
                      "required": [
                        "op",
                        "path",
                        "value"
                      ],
                      "additionalProperties": {},
                      "specOpen": true
                    },
                    {
                      "type": "object",
                      "properties": {
                        "op": {
                          "type": "string",
                          "const": "remove"
                        },
                        "path": {
                          "type": "string",
                          "pattern": "^(\\/([^/~]|~[01])*)*$"
                        }
                      },
                      "required": [
                        "op",
                        "path"
                      ],
                      "additionalProperties": {},
                      "specOpen": true
                    },
                    {
                      "type": "object",
                      "properties": {
                        "op": {
                          "type": "string",
                          "const": "replace"
                        },
                        "path": {
                          "type": "string",
                          "pattern": "^(\\/([^/~]|~[01])*)*$"
                        },
                        "value": {}
                      },
                      "required": [
                        "op",
                        "path",
                        "value"
                      ],
                      "additionalProperties": {},
                      "specOpen": true
                    },
                    {
                      "type": "object",
                      "properties": {
                        "op": {
                          "type": "string",
                          "const": "move"
                        },
                        "from": {
                          "type": "string",
                          "pattern": "^(\\/([^/~]|~[01])*)*$"
                        },
                        "path": {
                          "type": "string",
                          "pattern": "^(\\/([^/~]|~[01])*)*$"
                        }
                      },
                      "required": [
                        "op",
                        "from",
                        "path"
                      ],
                      "additionalProperties": {},
                      "specOpen": true
                    },
                    {
                      "type": "object",
                      "properties": {
                        "op": {
                          "type": "string",
                          "const": "copy"
                        },
                        "from": {
                          "type": "string",
                          "pattern": "^(\\/([^/~]|~[01])*)*$"
                        },
                        "path": {
                          "type": "string",
                          "pattern": "^(\\/([^/~]|~[01])*)*$"
                        }
                      },
                      "required": [
                        "op",
                        "from",
                        "path"
                      ],
                      "additionalProperties": {},
                      "specOpen": true
                    },
                    {
                      "type": "object",
                      "properties": {
                        "op": {
                          "type": "string",
                          "const": "test"
                        },
                        "path": {
                          "type": "string",
                          "pattern": "^(\\/([^/~]|~[01])*)*$"
                        },
                        "value": {}
                      },
                      "required": [
                        "op",
                        "path",
                        "value"
                      ],
                      "additionalProperties": {},
                      "specOpen": true
                    }
                  ]
                }
              }
            },
            "required": [
              "type",
              "messageId",
              "activityType",
              "patch"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "RAW"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "event": {},
              "source": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "event"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "CUSTOM"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "value": {}
            },
            "required": [
              "type",
              "name",
              "value"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "RUN_STARTED"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "threadId": {
                "type": "string"
              },
              "runId": {
                "type": "string"
              },
              "protocolVersion": {
                "type": "string"
              },
              "parentRunId": {
                "type": "string"
              },
              "input": {
                "type": "object",
                "properties": {
                  "threadId": {
                    "type": "string"
                  },
                  "runId": {
                    "type": "string"
                  },
                  "protocolVersion": {
                    "type": "string"
                  },
                  "parentRunId": {
                    "type": "string"
                  },
                  "state": {
                    "anyOf": [
                      {},
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "subagentRunId": {
                              "type": "string"
                            },
                            "id": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string",
                              "const": "developer"
                            },
                            "name": {
                              "type": "string"
                            },
                            "encryptedValue": {
                              "type": "string"
                            },
                            "metadata": {},
                            "content": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "role",
                            "content"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "subagentRunId": {
                              "type": "string"
                            },
                            "id": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string",
                              "const": "system"
                            },
                            "name": {
                              "type": "string"
                            },
                            "encryptedValue": {
                              "type": "string"
                            },
                            "metadata": {},
                            "content": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "role",
                            "content"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "subagentRunId": {
                              "type": "string"
                            },
                            "id": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string",
                              "const": "assistant"
                            },
                            "name": {
                              "type": "string"
                            },
                            "encryptedValue": {
                              "type": "string"
                            },
                            "metadata": {},
                            "content": {
                              "type": "string"
                            },
                            "toolCalls": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "string",
                                    "const": "function"
                                  },
                                  "function": {
                                    "type": "object",
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "arguments": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "name",
                                      "arguments"
                                    ],
                                    "additionalProperties": {}
                                  },
                                  "encryptedValue": {
                                    "type": "string"
                                  },
                                  "metadata": {}
                                },
                                "required": [
                                  "id",
                                  "type",
                                  "function"
                                ],
                                "additionalProperties": {}
                              }
                            }
                          },
                          "required": [
                            "id",
                            "role"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "subagentRunId": {
                              "type": "string"
                            },
                            "id": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string",
                              "const": "user"
                            },
                            "name": {
                              "type": "string"
                            },
                            "encryptedValue": {
                              "type": "string"
                            },
                            "metadata": {},
                            "content": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "array",
                                  "items": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "text"
                                          },
                                          "id": {
                                            "type": "string"
                                          },
                                          "text": {
                                            "type": "string"
                                          },
                                          "metadata": {}
                                        },
                                        "required": [
                                          "type",
                                          "text"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "image"
                                          },
                                          "id": {
                                            "type": "string"
                                          },
                                          "source": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "data"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value",
                                                  "mimeType"
                                                ],
                                                "additionalProperties": {}
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "url"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value"
                                                ],
                                                "additionalProperties": {}
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "file"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "provider": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value"
                                                ],
                                                "additionalProperties": {}
                                              }
                                            ]
                                          },
                                          "metadata": {}
                                        },
                                        "required": [
                                          "type",
                                          "source"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "audio"
                                          },
                                          "id": {
                                            "type": "string"
                                          },
                                          "source": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "data"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value",
                                                  "mimeType"
                                                ],
                                                "additionalProperties": {}
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "url"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value"
                                                ],
                                                "additionalProperties": {}
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "file"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "provider": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value"
                                                ],
                                                "additionalProperties": {}
                                              }
                                            ]
                                          },
                                          "metadata": {}
                                        },
                                        "required": [
                                          "type",
                                          "source"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "video"
                                          },
                                          "id": {
                                            "type": "string"
                                          },
                                          "source": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "data"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value",
                                                  "mimeType"
                                                ],
                                                "additionalProperties": {}
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "url"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value"
                                                ],
                                                "additionalProperties": {}
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "file"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "provider": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value"
                                                ],
                                                "additionalProperties": {}
                                              }
                                            ]
                                          },
                                          "metadata": {}
                                        },
                                        "required": [
                                          "type",
                                          "source"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "document"
                                          },
                                          "id": {
                                            "type": "string"
                                          },
                                          "source": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "data"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value",
                                                  "mimeType"
                                                ],
                                                "additionalProperties": {}
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "url"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value"
                                                ],
                                                "additionalProperties": {}
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "file"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "provider": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value"
                                                ],
                                                "additionalProperties": {}
                                              }
                                            ]
                                          },
                                          "metadata": {}
                                        },
                                        "required": [
                                          "type",
                                          "source"
                                        ],
                                        "additionalProperties": {}
                                      }
                                    ]
                                  }
                                }
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "role",
                            "content"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "subagentRunId": {
                              "type": "string"
                            },
                            "id": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string",
                              "const": "tool"
                            },
                            "content": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "array",
                                  "items": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "text"
                                          },
                                          "id": {
                                            "type": "string"
                                          },
                                          "text": {
                                            "type": "string"
                                          },
                                          "metadata": {}
                                        },
                                        "required": [
                                          "type",
                                          "text"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "image"
                                          },
                                          "id": {
                                            "type": "string"
                                          },
                                          "source": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "data"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value",
                                                  "mimeType"
                                                ],
                                                "additionalProperties": {}
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "url"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value"
                                                ],
                                                "additionalProperties": {}
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "file"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "provider": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value"
                                                ],
                                                "additionalProperties": {}
                                              }
                                            ]
                                          },
                                          "metadata": {}
                                        },
                                        "required": [
                                          "type",
                                          "source"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "audio"
                                          },
                                          "id": {
                                            "type": "string"
                                          },
                                          "source": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "data"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value",
                                                  "mimeType"
                                                ],
                                                "additionalProperties": {}
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "url"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value"
                                                ],
                                                "additionalProperties": {}
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "file"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "provider": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value"
                                                ],
                                                "additionalProperties": {}
                                              }
                                            ]
                                          },
                                          "metadata": {}
                                        },
                                        "required": [
                                          "type",
                                          "source"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "video"
                                          },
                                          "id": {
                                            "type": "string"
                                          },
                                          "source": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "data"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value",
                                                  "mimeType"
                                                ],
                                                "additionalProperties": {}
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "url"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value"
                                                ],
                                                "additionalProperties": {}
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "file"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "provider": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value"
                                                ],
                                                "additionalProperties": {}
                                              }
                                            ]
                                          },
                                          "metadata": {}
                                        },
                                        "required": [
                                          "type",
                                          "source"
                                        ],
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "document"
                                          },
                                          "id": {
                                            "type": "string"
                                          },
                                          "source": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "data"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value",
                                                  "mimeType"
                                                ],
                                                "additionalProperties": {}
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "url"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value"
                                                ],
                                                "additionalProperties": {}
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "file"
                                                  },
                                                  "value": {
                                                    "type": "string"
                                                  },
                                                  "provider": {
                                                    "type": "string"
                                                  },
                                                  "mimeType": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "value"
                                                ],
                                                "additionalProperties": {}
                                              }
                                            ]
                                          },
                                          "metadata": {}
                                        },
                                        "required": [
                                          "type",
                                          "source"
                                        ],
                                        "additionalProperties": {}
                                      }
                                    ]
                                  }
                                }
                              ]
                            },
                            "toolCallId": {
                              "type": "string"
                            },
                            "error": {
                              "type": "string"
                            },
                            "encryptedValue": {
                              "type": "string"
                            },
                            "metadata": {}
                          },
                          "required": [
                            "id",
                            "role",
                            "content",
                            "toolCallId"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "subagentRunId": {
                              "type": "string"
                            },
                            "id": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string",
                              "const": "activity"
                            },
                            "activityType": {
                              "type": "string"
                            },
                            "content": {},
                            "metadata": {}
                          },
                          "required": [
                            "id",
                            "role",
                            "activityType",
                            "content"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "subagentRunId": {
                              "type": "string"
                            },
                            "id": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string",
                              "const": "reasoning"
                            },
                            "content": {
                              "type": "string"
                            },
                            "encryptedValue": {
                              "type": "string"
                            },
                            "metadata": {}
                          },
                          "required": [
                            "id",
                            "role",
                            "content"
                          ],
                          "additionalProperties": {}
                        }
                      ]
                    }
                  },
                  "tools": {
                    "default": [],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "parameters": {},
                        "metadata": {}
                      },
                      "required": [
                        "name",
                        "description"
                      ],
                      "additionalProperties": {}
                    }
                  },
                  "context": {
                    "default": [],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "description": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "description",
                        "value"
                      ],
                      "additionalProperties": {}
                    }
                  },
                  "forwardedProps": {},
                  "resume": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "interruptId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "resolved",
                            "cancelled"
                          ]
                        },
                        "payload": {},
                        "metadata": {}
                      },
                      "required": [
                        "interruptId",
                        "status"
                      ],
                      "additionalProperties": {}
                    }
                  }
                },
                "required": [
                  "threadId",
                  "runId",
                  "messages"
                ],
                "additionalProperties": {}
              }
            },
            "required": [
              "type",
              "threadId",
              "runId"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "RUN_FINISHED"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "threadId": {
                "type": "string"
              },
              "runId": {
                "type": "string"
              },
              "result": {},
              "outcome": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "success"
                      },
                      "pendingToolCallIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "type"
                    ],
                    "additionalProperties": {}
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "interrupt"
                      },
                      "interrupts": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "subagentRunId": {
                              "type": "string"
                            },
                            "id": {
                              "type": "string"
                            },
                            "reason": {
                              "type": "string"
                            },
                            "message": {
                              "type": "string"
                            },
                            "toolCallId": {
                              "type": "string"
                            },
                            "responseSchema": {},
                            "expiresAt": {
                              "type": "string"
                            },
                            "metadata": {}
                          },
                          "required": [
                            "id",
                            "reason"
                          ],
                          "additionalProperties": {}
                        }
                      }
                    },
                    "required": [
                      "type",
                      "interrupts"
                    ],
                    "additionalProperties": {}
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "cancelled"
                      }
                    },
                    "required": [
                      "type"
                    ],
                    "additionalProperties": {}
                  }
                ]
              },
              "usage": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "provider": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "inputTokens": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "outputTokens": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "totalTokens": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "reasoningTokens": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "cachedInputTokens": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "cacheWriteInputTokens": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "additionalProperties": {}
                }
              }
            },
            "required": [
              "type",
              "threadId",
              "runId"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "RUN_ERROR"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "message": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "usage": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "provider": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "inputTokens": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "outputTokens": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "totalTokens": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "reasoningTokens": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "cachedInputTokens": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "cacheWriteInputTokens": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "additionalProperties": {}
                }
              }
            },
            "required": [
              "type",
              "message"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "STEP_STARTED"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "stepName": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "stepName"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "STEP_FINISHED"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "stepName": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "stepName"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "REASONING_START"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "messageId": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "messageId"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "REASONING_MESSAGE_START"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "messageId": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "const": "reasoning"
              }
            },
            "required": [
              "type",
              "messageId",
              "role"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "REASONING_MESSAGE_CONTENT"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "messageId": {
                "type": "string"
              },
              "delta": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "messageId",
              "delta"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "REASONING_MESSAGE_END"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "messageId": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "messageId"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "REASONING_MESSAGE_CHUNK"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "messageId": {
                "type": "string"
              },
              "delta": {
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "REASONING_END"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "messageId": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "messageId"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "REASONING_ENCRYPTED_VALUE"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "subtype": {
                "type": "string",
                "enum": [
                  "tool-call",
                  "message"
                ]
              },
              "entityId": {
                "type": "string"
              },
              "encryptedValue": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "subtype",
              "entityId",
              "encryptedValue"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "SUBAGENT_STARTED"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "parentSubagentRunId": {
                "type": "string"
              },
              "parentToolCallId": {
                "type": "string"
              },
              "parentMessageId": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "subagentRunId",
              "name"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "SUBAGENT_FINISHED"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "result": {},
              "outcome": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "success"
                      }
                    },
                    "required": [
                      "type"
                    ],
                    "additionalProperties": {}
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "suspended"
                      },
                      "interruptIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "type"
                    ],
                    "additionalProperties": {}
                  }
                ]
              }
            },
            "required": [
              "type",
              "subagentRunId"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "SUBAGENT_ERROR"
              },
              "timestamp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "rawEvent": {},
              "metadata": {},
              "subagentRunId": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "code": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "subagentRunId",
              "message"
            ],
            "additionalProperties": {}
          }
        ]
      },
      "AgUiMessage": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "subagentRunId": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "const": "developer"
              },
              "name": {
                "type": "string"
              },
              "encryptedValue": {
                "type": "string"
              },
              "metadata": {},
              "content": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "role",
              "content"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "subagentRunId": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "const": "system"
              },
              "name": {
                "type": "string"
              },
              "encryptedValue": {
                "type": "string"
              },
              "metadata": {},
              "content": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "role",
              "content"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "subagentRunId": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "const": "assistant"
              },
              "name": {
                "type": "string"
              },
              "encryptedValue": {
                "type": "string"
              },
              "metadata": {},
              "content": {
                "type": "string"
              },
              "toolCalls": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "const": "function"
                    },
                    "function": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "arguments": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "name",
                        "arguments"
                      ],
                      "additionalProperties": {}
                    },
                    "encryptedValue": {
                      "type": "string"
                    },
                    "metadata": {}
                  },
                  "required": [
                    "id",
                    "type",
                    "function"
                  ],
                  "additionalProperties": {}
                }
              }
            },
            "required": [
              "id",
              "role"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "subagentRunId": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "const": "user"
              },
              "name": {
                "type": "string"
              },
              "encryptedValue": {
                "type": "string"
              },
              "metadata": {},
              "content": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "text"
                            },
                            "id": {
                              "type": "string"
                            },
                            "text": {
                              "type": "string"
                            },
                            "metadata": {}
                          },
                          "required": [
                            "type",
                            "text"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "image"
                            },
                            "id": {
                              "type": "string"
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "data"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value",
                                    "mimeType"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "url"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "file"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "provider": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                }
                              ]
                            },
                            "metadata": {}
                          },
                          "required": [
                            "type",
                            "source"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "audio"
                            },
                            "id": {
                              "type": "string"
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "data"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value",
                                    "mimeType"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "url"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "file"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "provider": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                }
                              ]
                            },
                            "metadata": {}
                          },
                          "required": [
                            "type",
                            "source"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "video"
                            },
                            "id": {
                              "type": "string"
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "data"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value",
                                    "mimeType"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "url"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "file"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "provider": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                }
                              ]
                            },
                            "metadata": {}
                          },
                          "required": [
                            "type",
                            "source"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "document"
                            },
                            "id": {
                              "type": "string"
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "data"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value",
                                    "mimeType"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "url"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "file"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "provider": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                }
                              ]
                            },
                            "metadata": {}
                          },
                          "required": [
                            "type",
                            "source"
                          ],
                          "additionalProperties": {}
                        }
                      ]
                    }
                  }
                ]
              }
            },
            "required": [
              "id",
              "role",
              "content"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "subagentRunId": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "const": "tool"
              },
              "content": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "text"
                            },
                            "id": {
                              "type": "string"
                            },
                            "text": {
                              "type": "string"
                            },
                            "metadata": {}
                          },
                          "required": [
                            "type",
                            "text"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "image"
                            },
                            "id": {
                              "type": "string"
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "data"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value",
                                    "mimeType"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "url"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "file"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "provider": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                }
                              ]
                            },
                            "metadata": {}
                          },
                          "required": [
                            "type",
                            "source"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "audio"
                            },
                            "id": {
                              "type": "string"
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "data"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value",
                                    "mimeType"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "url"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "file"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "provider": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                }
                              ]
                            },
                            "metadata": {}
                          },
                          "required": [
                            "type",
                            "source"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "video"
                            },
                            "id": {
                              "type": "string"
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "data"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value",
                                    "mimeType"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "url"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "file"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "provider": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                }
                              ]
                            },
                            "metadata": {}
                          },
                          "required": [
                            "type",
                            "source"
                          ],
                          "additionalProperties": {}
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "document"
                            },
                            "id": {
                              "type": "string"
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "data"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value",
                                    "mimeType"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "url"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "file"
                                    },
                                    "value": {
                                      "type": "string"
                                    },
                                    "provider": {
                                      "type": "string"
                                    },
                                    "mimeType": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "value"
                                  ],
                                  "additionalProperties": {}
                                }
                              ]
                            },
                            "metadata": {}
                          },
                          "required": [
                            "type",
                            "source"
                          ],
                          "additionalProperties": {}
                        }
                      ]
                    }
                  }
                ]
              },
              "toolCallId": {
                "type": "string"
              },
              "error": {
                "type": "string"
              },
              "encryptedValue": {
                "type": "string"
              },
              "metadata": {}
            },
            "required": [
              "id",
              "role",
              "content",
              "toolCallId"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "subagentRunId": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "const": "activity"
              },
              "activityType": {
                "type": "string"
              },
              "content": {},
              "metadata": {}
            },
            "required": [
              "id",
              "role",
              "activityType",
              "content"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "subagentRunId": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "const": "reasoning"
              },
              "content": {
                "type": "string"
              },
              "encryptedValue": {
                "type": "string"
              },
              "metadata": {}
            },
            "required": [
              "id",
              "role",
              "content"
            ],
            "additionalProperties": {}
          }
        ]
      },
      "Health": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok"
            ]
          },
          "service": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "protocol": {
            "type": "object",
            "properties": {
              "min": {
                "type": "integer"
              },
              "max": {
                "type": "integer"
              },
              "features": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "min",
              "max",
              "features"
            ],
            "additionalProperties": false
          },
          "coreVersion": {
            "type": "string"
          },
          "hostId": {
            "type": "string"
          },
          "pid": {
            "type": "integer"
          }
        },
        "required": [
          "status",
          "service",
          "version",
          "protocol",
          "coreVersion",
          "hostId",
          "pid"
        ],
        "additionalProperties": false
      },
      "Ready": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "not_ready"
            ]
          },
          "service": {
            "type": "string"
          },
          "checks": {
            "type": "object",
            "additionalProperties": {
              "type": "boolean"
            }
          },
          "harness": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "remote",
                  "in-process"
                ]
              },
              "connected": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "mode",
              "connected"
            ]
          }
        },
        "required": [
          "status",
          "service",
          "checks"
        ]
      },
      "ProtectedResourceMetadata": {
        "type": "object",
        "properties": {
          "resource": {
            "type": "string",
            "description": "The Runtime API: `NYLORUN_PUBLIC_URL`, else the origin the request reached"
          },
          "authorization_servers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The identity file's issuers, in its order: a client usually signs in at the first"
          },
          "scopes_supported": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The scopes the issuers' tokens may carry, `studio` aside"
          },
          "bearer_methods_supported": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "header"
              ]
            }
          },
          "resource_name": {
            "type": "string"
          }
        },
        "required": [
          "resource",
          "authorization_servers",
          "scopes_supported",
          "bearer_methods_supported",
          "resource_name"
        ]
      },
      "AcceptedResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "accepted"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "requestId": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "turnId",
          "cursor",
          "requestId"
        ]
      },
      "QueuedResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "queued"
            ]
          },
          "queuedMessageId": {
            "type": "string"
          },
          "position": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "requestId": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "queuedMessageId",
          "position",
          "cursor",
          "requestId"
        ]
      },
      "Rejected": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "rejected"
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "not_found",
              "credential_required",
              "credential_invalid",
              "protocol_unsupported",
              "host_rejected",
              "origin_rejected",
              "unsupported_media_type",
              "connection_missing",
              "incompatible_host",
              "subject_invalid",
              "scope_required",
              "key_role_mismatch",
              "token_expired",
              "limit_exceeded",
              "request_rejected",
              "invalid_request",
              "subject_required",
              "agent_not_granted",
              "session_busy",
              "queue_full",
              "trigger_expired",
              "trigger_paused",
              "memory_conflict",
              "agent_busy",
              "agent_unavailable",
              "placement_refused",
              "agent_lost",
              "agent_owner_mismatch",
              "harness_mismatch",
              "session_closed",
              "issuer_unavailable",
              "definition_files_missing",
              "credential_rejected",
              "mcp_preview_failed",
              "credential_conflict",
              "agent_fixed_field",
              "secret_not_in_manifest",
              "manifest_inconsistent",
              "manifest_not_found",
              "manifest_in_use",
              "manifest_changed",
              "folder_invalid",
              "internal_error"
            ]
          },
          "message": {
            "type": "string"
          },
          "details": {},
          "activeTurnId": {
            "type": "string"
          },
          "requestId": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "code",
          "message"
        ]
      },
      "ProtocolRejected": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "rejected"
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "protocol_unsupported"
            ]
          },
          "protocol": {
            "type": "object",
            "properties": {
              "min": {
                "type": "integer"
              },
              "max": {
                "type": "integer"
              },
              "features": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "min",
              "max",
              "features"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "status",
          "code",
          "protocol"
        ],
        "additionalProperties": false
      },
      "SessionCommand": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "requestId": {
                "type": "string",
                "minLength": 1
              },
              "idempotencyKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "type": {
                "type": "string",
                "enum": [
                  "message"
                ]
              },
              "manifest": {
                "type": "object",
                "properties": {
                  "manifestSchemaVersion": {
                    "type": "number",
                    "enum": [
                      7
                    ]
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "description": {
                    "type": "string"
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "outputSchema": {
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "instructions": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "tools": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9_-]{1,64}$"
                        },
                        "description": {
                          "type": "string"
                        },
                        "inputSchema": {
                          "type": "object",
                          "additionalProperties": {}
                        },
                        "outputSchema": {
                          "type": "object",
                          "additionalProperties": {}
                        },
                        "agent": {
                          "$ref": "#/components/schemas/ToolAgentManifest"
                        },
                        "http": {
                          "type": "object",
                          "properties": {
                            "url": {
                              "type": "string"
                            },
                            "method": {
                              "type": "string",
                              "enum": [
                                "GET",
                                "POST",
                                "PUT",
                                "PATCH",
                                "DELETE"
                              ]
                            },
                            "credential": {
                              "type": "string",
                              "minLength": 1
                            },
                            "timeoutMs": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 2147483647
                            }
                          },
                          "required": [
                            "url"
                          ],
                          "additionalProperties": false
                        },
                        "approval": {
                          "type": "string",
                          "enum": [
                            "never",
                            "always"
                          ]
                        },
                        "fn": {
                          "description": "Reserved for a later kind of tool; refused for now."
                        },
                        "command": {
                          "description": "Reserved for a later kind of tool; refused for now."
                        }
                      },
                      "required": [
                        "name",
                        "inputSchema"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "skills": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1
                        },
                        "files": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        },
                        "plugin": {
                          "$ref": "#/components/schemas/PluginLabel"
                        }
                      },
                      "required": [
                        "name",
                        "description",
                        "files"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "mcpServers": {
                    "type": "object",
                    "additionalProperties": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9_-]{1,64}$"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "streamable-http"
                              ]
                            },
                            "url": {
                              "type": "string",
                              "minLength": 1
                            },
                            "headers": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "string"
                              }
                            },
                            "approval": {
                              "type": "string",
                              "enum": [
                                "never",
                                "always"
                              ]
                            },
                            "deferred": {
                              "type": "boolean"
                            },
                            "tools": {
                              "type": "object",
                              "additionalProperties": {
                                "$ref": "#/components/schemas/McpToolSettings"
                              }
                            },
                            "plugin": {
                              "$ref": "#/components/schemas/PluginLabel"
                            }
                          },
                          "required": [
                            "name",
                            "type",
                            "url"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9_-]{1,64}$"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "sse"
                              ]
                            },
                            "url": {
                              "type": "string",
                              "minLength": 1
                            },
                            "headers": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "string"
                              }
                            },
                            "approval": {
                              "type": "string",
                              "enum": [
                                "never",
                                "always"
                              ]
                            },
                            "deferred": {
                              "type": "boolean"
                            },
                            "tools": {
                              "type": "object",
                              "additionalProperties": {
                                "$ref": "#/components/schemas/McpToolSettings"
                              }
                            },
                            "plugin": {
                              "$ref": "#/components/schemas/PluginLabel"
                            }
                          },
                          "required": [
                            "name",
                            "type",
                            "url"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "requires": {
                    "type": "object",
                    "properties": {
                      "sandbox": {
                        "type": "string",
                        "enum": [
                          "none",
                          "any",
                          "pod"
                        ]
                      },
                      "secrets": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                        }
                      }
                    },
                    "additionalProperties": false
                  },
                  "functions": {
                    "description": "Reserved: Functions are not available yet"
                  }
                },
                "required": [
                  "manifestSchemaVersion",
                  "id"
                ],
                "additionalProperties": false
              },
              "delivery": {
                "type": "string",
                "enum": [
                  "queue",
                  "reject"
                ]
              },
              "content": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "requestId",
              "idempotencyKey",
              "type",
              "content"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "requestId": {
                "type": "string",
                "minLength": 1
              },
              "idempotencyKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "type": {
                "type": "string",
                "enum": [
                  "message"
                ]
              },
              "manifest": {
                "type": "object",
                "properties": {
                  "manifestSchemaVersion": {
                    "type": "number",
                    "enum": [
                      7
                    ]
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "description": {
                    "type": "string"
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "outputSchema": {
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "instructions": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "tools": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9_-]{1,64}$"
                        },
                        "description": {
                          "type": "string"
                        },
                        "inputSchema": {
                          "type": "object",
                          "additionalProperties": {}
                        },
                        "outputSchema": {
                          "type": "object",
                          "additionalProperties": {}
                        },
                        "agent": {
                          "$ref": "#/components/schemas/ToolAgentManifest"
                        },
                        "http": {
                          "type": "object",
                          "properties": {
                            "url": {
                              "type": "string"
                            },
                            "method": {
                              "type": "string",
                              "enum": [
                                "GET",
                                "POST",
                                "PUT",
                                "PATCH",
                                "DELETE"
                              ]
                            },
                            "credential": {
                              "type": "string",
                              "minLength": 1
                            },
                            "timeoutMs": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 2147483647
                            }
                          },
                          "required": [
                            "url"
                          ],
                          "additionalProperties": false
                        },
                        "approval": {
                          "type": "string",
                          "enum": [
                            "never",
                            "always"
                          ]
                        },
                        "fn": {
                          "description": "Reserved for a later kind of tool; refused for now."
                        },
                        "command": {
                          "description": "Reserved for a later kind of tool; refused for now."
                        }
                      },
                      "required": [
                        "name",
                        "inputSchema"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "skills": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1
                        },
                        "files": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        },
                        "plugin": {
                          "$ref": "#/components/schemas/PluginLabel"
                        }
                      },
                      "required": [
                        "name",
                        "description",
                        "files"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "mcpServers": {
                    "type": "object",
                    "additionalProperties": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9_-]{1,64}$"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "streamable-http"
                              ]
                            },
                            "url": {
                              "type": "string",
                              "minLength": 1
                            },
                            "headers": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "string"
                              }
                            },
                            "approval": {
                              "type": "string",
                              "enum": [
                                "never",
                                "always"
                              ]
                            },
                            "deferred": {
                              "type": "boolean"
                            },
                            "tools": {
                              "type": "object",
                              "additionalProperties": {
                                "$ref": "#/components/schemas/McpToolSettings"
                              }
                            },
                            "plugin": {
                              "$ref": "#/components/schemas/PluginLabel"
                            }
                          },
                          "required": [
                            "name",
                            "type",
                            "url"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9_-]{1,64}$"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "sse"
                              ]
                            },
                            "url": {
                              "type": "string",
                              "minLength": 1
                            },
                            "headers": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "string"
                              }
                            },
                            "approval": {
                              "type": "string",
                              "enum": [
                                "never",
                                "always"
                              ]
                            },
                            "deferred": {
                              "type": "boolean"
                            },
                            "tools": {
                              "type": "object",
                              "additionalProperties": {
                                "$ref": "#/components/schemas/McpToolSettings"
                              }
                            },
                            "plugin": {
                              "$ref": "#/components/schemas/PluginLabel"
                            }
                          },
                          "required": [
                            "name",
                            "type",
                            "url"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "requires": {
                    "type": "object",
                    "properties": {
                      "sandbox": {
                        "type": "string",
                        "enum": [
                          "none",
                          "any",
                          "pod"
                        ]
                      },
                      "secrets": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                        }
                      }
                    },
                    "additionalProperties": false
                  },
                  "functions": {
                    "description": "Reserved: Functions are not available yet"
                  }
                },
                "required": [
                  "manifestSchemaVersion",
                  "id"
                ],
                "additionalProperties": false
              },
              "delivery": {
                "type": "string",
                "enum": [
                  "queue",
                  "reject"
                ]
              },
              "data": {
                "$ref": "#/components/schemas/JsonValue"
              }
            },
            "required": [
              "requestId",
              "idempotencyKey",
              "type",
              "data"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "requestId": {
                "type": "string",
                "minLength": 1
              },
              "idempotencyKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "type": {
                "type": "string",
                "enum": [
                  "message"
                ]
              },
              "manifest": {
                "type": "object",
                "properties": {
                  "manifestSchemaVersion": {
                    "type": "number",
                    "enum": [
                      7
                    ]
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "description": {
                    "type": "string"
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "outputSchema": {
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "instructions": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "tools": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9_-]{1,64}$"
                        },
                        "description": {
                          "type": "string"
                        },
                        "inputSchema": {
                          "type": "object",
                          "additionalProperties": {}
                        },
                        "outputSchema": {
                          "type": "object",
                          "additionalProperties": {}
                        },
                        "agent": {
                          "$ref": "#/components/schemas/ToolAgentManifest"
                        },
                        "http": {
                          "type": "object",
                          "properties": {
                            "url": {
                              "type": "string"
                            },
                            "method": {
                              "type": "string",
                              "enum": [
                                "GET",
                                "POST",
                                "PUT",
                                "PATCH",
                                "DELETE"
                              ]
                            },
                            "credential": {
                              "type": "string",
                              "minLength": 1
                            },
                            "timeoutMs": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 2147483647
                            }
                          },
                          "required": [
                            "url"
                          ],
                          "additionalProperties": false
                        },
                        "approval": {
                          "type": "string",
                          "enum": [
                            "never",
                            "always"
                          ]
                        },
                        "fn": {
                          "description": "Reserved for a later kind of tool; refused for now."
                        },
                        "command": {
                          "description": "Reserved for a later kind of tool; refused for now."
                        }
                      },
                      "required": [
                        "name",
                        "inputSchema"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "skills": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1
                        },
                        "files": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        },
                        "plugin": {
                          "$ref": "#/components/schemas/PluginLabel"
                        }
                      },
                      "required": [
                        "name",
                        "description",
                        "files"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "mcpServers": {
                    "type": "object",
                    "additionalProperties": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9_-]{1,64}$"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "streamable-http"
                              ]
                            },
                            "url": {
                              "type": "string",
                              "minLength": 1
                            },
                            "headers": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "string"
                              }
                            },
                            "approval": {
                              "type": "string",
                              "enum": [
                                "never",
                                "always"
                              ]
                            },
                            "deferred": {
                              "type": "boolean"
                            },
                            "tools": {
                              "type": "object",
                              "additionalProperties": {
                                "$ref": "#/components/schemas/McpToolSettings"
                              }
                            },
                            "plugin": {
                              "$ref": "#/components/schemas/PluginLabel"
                            }
                          },
                          "required": [
                            "name",
                            "type",
                            "url"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9_-]{1,64}$"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "sse"
                              ]
                            },
                            "url": {
                              "type": "string",
                              "minLength": 1
                            },
                            "headers": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "string"
                              }
                            },
                            "approval": {
                              "type": "string",
                              "enum": [
                                "never",
                                "always"
                              ]
                            },
                            "deferred": {
                              "type": "boolean"
                            },
                            "tools": {
                              "type": "object",
                              "additionalProperties": {
                                "$ref": "#/components/schemas/McpToolSettings"
                              }
                            },
                            "plugin": {
                              "$ref": "#/components/schemas/PluginLabel"
                            }
                          },
                          "required": [
                            "name",
                            "type",
                            "url"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "requires": {
                    "type": "object",
                    "properties": {
                      "sandbox": {
                        "type": "string",
                        "enum": [
                          "none",
                          "any",
                          "pod"
                        ]
                      },
                      "secrets": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                        }
                      }
                    },
                    "additionalProperties": false
                  },
                  "functions": {
                    "description": "Reserved: Functions are not available yet"
                  }
                },
                "required": [
                  "manifestSchemaVersion",
                  "id"
                ],
                "additionalProperties": false
              },
              "delivery": {
                "type": "string",
                "enum": [
                  "queue",
                  "reject"
                ]
              },
              "parts": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "text"
                          ]
                        },
                        "text": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "type",
                        "text"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "file"
                          ]
                        },
                        "artifactId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "version": {
                          "type": "integer",
                          "exclusiveMinimum": 0
                        }
                      },
                      "required": [
                        "type",
                        "artifactId"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "minItems": 1
              }
            },
            "required": [
              "requestId",
              "idempotencyKey",
              "type",
              "parts"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "requestId": {
                "type": "string",
                "minLength": 1
              },
              "idempotencyKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "type": {
                "type": "string",
                "enum": [
                  "approve"
                ]
              },
              "interactionId": {
                "type": "string",
                "minLength": 1
              },
              "approved": {
                "type": "boolean"
              }
            },
            "required": [
              "requestId",
              "idempotencyKey",
              "type",
              "interactionId",
              "approved"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "requestId": {
                "type": "string",
                "minLength": 1
              },
              "idempotencyKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "type": {
                "type": "string",
                "enum": [
                  "respond"
                ]
              },
              "interactionId": {
                "type": "string",
                "minLength": 1
              },
              "value": {}
            },
            "required": [
              "requestId",
              "idempotencyKey",
              "type",
              "interactionId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "requestId": {
                "type": "string",
                "minLength": 1
              },
              "idempotencyKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "type": {
                "type": "string",
                "enum": [
                  "cancel"
                ]
              },
              "reason": {
                "type": "string"
              }
            },
            "required": [
              "requestId",
              "idempotencyKey",
              "type"
            ],
            "additionalProperties": false
          }
        ]
      },
      "ToolAgentManifest": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/WorkflowManifest"
          },
          {
            "type": "object",
            "properties": {
              "manifestSchemaVersion": {
                "type": "number",
                "enum": [
                  7
                ]
              },
              "id": {
                "type": "string",
                "minLength": 1
              },
              "name": {
                "type": "string",
                "minLength": 1
              },
              "description": {
                "type": "string"
              },
              "metadata": {
                "type": "object",
                "additionalProperties": {}
              },
              "outputSchema": {
                "type": "object",
                "additionalProperties": {}
              },
              "instructions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "tools": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "description": {
                      "type": "string"
                    },
                    "inputSchema": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "outputSchema": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "agent": {
                      "$ref": "#/components/schemas/ToolAgentManifest"
                    },
                    "http": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string"
                        },
                        "method": {
                          "type": "string",
                          "enum": [
                            "GET",
                            "POST",
                            "PUT",
                            "PATCH",
                            "DELETE"
                          ]
                        },
                        "credential": {
                          "type": "string",
                          "minLength": 1
                        },
                        "timeoutMs": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 2147483647
                        }
                      },
                      "required": [
                        "url"
                      ],
                      "additionalProperties": false
                    },
                    "approval": {
                      "type": "string",
                      "enum": [
                        "never",
                        "always"
                      ]
                    },
                    "fn": {
                      "description": "Reserved for a later kind of tool; refused for now."
                    },
                    "command": {
                      "description": "Reserved for a later kind of tool; refused for now."
                    }
                  },
                  "required": [
                    "name",
                    "inputSchema"
                  ],
                  "additionalProperties": false
                }
              },
              "skills": {
                "type": "object",
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "description": {
                      "type": "string",
                      "minLength": 1
                    },
                    "files": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "plugin": {
                      "$ref": "#/components/schemas/PluginLabel"
                    }
                  },
                  "required": [
                    "name",
                    "description",
                    "files"
                  ],
                  "additionalProperties": false
                }
              },
              "mcpServers": {
                "type": "object",
                "additionalProperties": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9_-]{1,64}$"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "streamable-http"
                          ]
                        },
                        "url": {
                          "type": "string",
                          "minLength": 1
                        },
                        "headers": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        },
                        "approval": {
                          "type": "string",
                          "enum": [
                            "never",
                            "always"
                          ]
                        },
                        "deferred": {
                          "type": "boolean"
                        },
                        "tools": {
                          "type": "object",
                          "additionalProperties": {
                            "$ref": "#/components/schemas/McpToolSettings"
                          }
                        },
                        "plugin": {
                          "$ref": "#/components/schemas/PluginLabel"
                        }
                      },
                      "required": [
                        "name",
                        "type",
                        "url"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9_-]{1,64}$"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "sse"
                          ]
                        },
                        "url": {
                          "type": "string",
                          "minLength": 1
                        },
                        "headers": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        },
                        "approval": {
                          "type": "string",
                          "enum": [
                            "never",
                            "always"
                          ]
                        },
                        "deferred": {
                          "type": "boolean"
                        },
                        "tools": {
                          "type": "object",
                          "additionalProperties": {
                            "$ref": "#/components/schemas/McpToolSettings"
                          }
                        },
                        "plugin": {
                          "$ref": "#/components/schemas/PluginLabel"
                        }
                      },
                      "required": [
                        "name",
                        "type",
                        "url"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "requires": {
                "type": "object",
                "properties": {
                  "sandbox": {
                    "type": "string",
                    "enum": [
                      "none",
                      "any",
                      "pod"
                    ]
                  },
                  "secrets": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                    }
                  }
                },
                "additionalProperties": false
              },
              "functions": {
                "description": "Reserved: Functions are not available yet"
              }
            },
            "required": [
              "manifestSchemaVersion",
              "id"
            ],
            "additionalProperties": false
          }
        ]
      },
      "WorkflowManifest": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "workflow"
            ]
          },
          "workflowSchemaVersion": {
            "type": "number",
            "enum": [
              3
            ]
          },
          "id": {
            "type": "string",
            "minLength": 1
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "description": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {}
          },
          "inputSchema": {
            "type": "object",
            "additionalProperties": {}
          },
          "outputSchema": {
            "type": "object",
            "additionalProperties": {}
          },
          "sandbox": {
            "type": "object",
            "properties": {
              "image": {
                "type": "string",
                "minLength": 1
              },
              "network": {
                "type": "object",
                "properties": {
                  "preset": {
                    "type": "string",
                    "enum": [
                      "none",
                      "dev",
                      "open"
                    ]
                  },
                  "allow": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "additionalProperties": false
              },
              "resources": {
                "type": "object",
                "properties": {
                  "cpus": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "memory": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              },
              "idle": {
                "type": "string"
              }
            },
            "additionalProperties": false
          },
          "root": {
            "$ref": "#/components/schemas/WorkflowNode"
          },
          "agents": {
            "type": "object",
            "additionalProperties": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/WorkflowManifest"
                },
                {
                  "type": "object",
                  "properties": {
                    "manifestSchemaVersion": {
                      "type": "number",
                      "enum": [
                        7
                      ]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "description": {
                      "type": "string"
                    },
                    "metadata": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "outputSchema": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "instructions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "tools": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{1,64}$"
                          },
                          "description": {
                            "type": "string"
                          },
                          "inputSchema": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "outputSchema": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "agent": {
                            "$ref": "#/components/schemas/ToolAgentManifest"
                          },
                          "http": {
                            "type": "object",
                            "properties": {
                              "url": {
                                "type": "string"
                              },
                              "method": {
                                "type": "string",
                                "enum": [
                                  "GET",
                                  "POST",
                                  "PUT",
                                  "PATCH",
                                  "DELETE"
                                ]
                              },
                              "credential": {
                                "type": "string",
                                "minLength": 1
                              },
                              "timeoutMs": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 2147483647
                              }
                            },
                            "required": [
                              "url"
                            ],
                            "additionalProperties": false
                          },
                          "approval": {
                            "type": "string",
                            "enum": [
                              "never",
                              "always"
                            ]
                          },
                          "fn": {
                            "description": "Reserved for a later kind of tool; refused for now."
                          },
                          "command": {
                            "description": "Reserved for a later kind of tool; refused for now."
                          }
                        },
                        "required": [
                          "name",
                          "inputSchema"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "skills": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1
                          },
                          "description": {
                            "type": "string",
                            "minLength": 1
                          },
                          "files": {
                            "type": "object",
                            "additionalProperties": {
                              "type": "string"
                            }
                          },
                          "plugin": {
                            "$ref": "#/components/schemas/PluginLabel"
                          }
                        },
                        "required": [
                          "name",
                          "description",
                          "files"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "mcpServers": {
                      "type": "object",
                      "additionalProperties": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9_-]{1,64}$"
                              },
                              "type": {
                                "type": "string",
                                "enum": [
                                  "streamable-http"
                                ]
                              },
                              "url": {
                                "type": "string",
                                "minLength": 1
                              },
                              "headers": {
                                "type": "object",
                                "additionalProperties": {
                                  "type": "string"
                                }
                              },
                              "approval": {
                                "type": "string",
                                "enum": [
                                  "never",
                                  "always"
                                ]
                              },
                              "deferred": {
                                "type": "boolean"
                              },
                              "tools": {
                                "type": "object",
                                "additionalProperties": {
                                  "$ref": "#/components/schemas/McpToolSettings"
                                }
                              },
                              "plugin": {
                                "$ref": "#/components/schemas/PluginLabel"
                              }
                            },
                            "required": [
                              "name",
                              "type",
                              "url"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9_-]{1,64}$"
                              },
                              "type": {
                                "type": "string",
                                "enum": [
                                  "sse"
                                ]
                              },
                              "url": {
                                "type": "string",
                                "minLength": 1
                              },
                              "headers": {
                                "type": "object",
                                "additionalProperties": {
                                  "type": "string"
                                }
                              },
                              "approval": {
                                "type": "string",
                                "enum": [
                                  "never",
                                  "always"
                                ]
                              },
                              "deferred": {
                                "type": "boolean"
                              },
                              "tools": {
                                "type": "object",
                                "additionalProperties": {
                                  "$ref": "#/components/schemas/McpToolSettings"
                                }
                              },
                              "plugin": {
                                "$ref": "#/components/schemas/PluginLabel"
                              }
                            },
                            "required": [
                              "name",
                              "type",
                              "url"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "requires": {
                      "type": "object",
                      "properties": {
                        "sandbox": {
                          "type": "string",
                          "enum": [
                            "none",
                            "any",
                            "pod"
                          ]
                        },
                        "secrets": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                          }
                        }
                      },
                      "additionalProperties": false
                    },
                    "functions": {
                      "description": "Reserved: Functions are not available yet"
                    }
                  },
                  "required": [
                    "manifestSchemaVersion",
                    "id"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          }
        },
        "required": [
          "kind",
          "workflowSchemaVersion",
          "id",
          "root",
          "agents"
        ],
        "additionalProperties": false
      },
      "WorkflowNode": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "agent": {
                "type": "string",
                "minLength": 1
              },
              "id": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "agent"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tool": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "description": {
                    "type": "string"
                  },
                  "inputSchema": {
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "outputSchema": {
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "http": {
                    "type": "object",
                    "properties": {
                      "url": {
                        "type": "string"
                      },
                      "method": {
                        "type": "string",
                        "enum": [
                          "GET",
                          "POST",
                          "PUT",
                          "PATCH",
                          "DELETE"
                        ]
                      },
                      "credential": {
                        "type": "string",
                        "minLength": 1
                      },
                      "timeoutMs": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 2147483647
                      }
                    },
                    "required": [
                      "url"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              },
              "id": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "tool"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "chain": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/WorkflowNode"
                },
                "minItems": 1
              },
              "id": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "chain"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "switch": {
                "type": "object",
                "properties": {
                  "cases": {
                    "type": "object",
                    "additionalProperties": {
                      "$ref": "#/components/schemas/WorkflowNode"
                    }
                  },
                  "default": {
                    "$ref": "#/components/schemas/WorkflowNode"
                  }
                },
                "required": [
                  "cases"
                ],
                "additionalProperties": false
              },
              "id": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "switch"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "parallel": {
                "type": "object",
                "additionalProperties": {
                  "$ref": "#/components/schemas/WorkflowNode"
                }
              },
              "id": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "parallel"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "map": {
                "type": "object",
                "properties": {
                  "each": {
                    "$ref": "#/components/schemas/WorkflowNode"
                  }
                },
                "required": [
                  "each"
                ],
                "additionalProperties": false
              },
              "id": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "map"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "loop": {
                "type": "object",
                "properties": {
                  "run": {
                    "$ref": "#/components/schemas/WorkflowNode"
                  },
                  "verify": {
                    "$ref": "#/components/schemas/WorkflowLoopVerify"
                  },
                  "max": {
                    "type": "integer",
                    "exclusiveMinimum": 0
                  }
                },
                "required": [
                  "run",
                  "verify",
                  "max"
                ],
                "additionalProperties": false
              },
              "id": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "loop"
            ],
            "additionalProperties": false
          }
        ]
      },
      "WorkflowLoopVerify": {
        "type": "object",
        "properties": {
          "agent": {
            "type": "string",
            "minLength": 1
          },
          "http": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              },
              "method": {
                "type": "string",
                "enum": [
                  "GET",
                  "POST",
                  "PUT",
                  "PATCH",
                  "DELETE"
                ]
              },
              "credential": {
                "type": "string",
                "minLength": 1
              },
              "timeoutMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 2147483647
              }
            },
            "required": [
              "url"
            ],
            "additionalProperties": false
          },
          "fn": {
            "description": "Reserved for a later kind of verifier; refused for now."
          },
          "command": {
            "description": "Reserved for a later kind of verifier; refused for now."
          },
          "id": {
            "type": "string",
            "minLength": 1
          }
        },
        "additionalProperties": false
      },
      "PluginLabel": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "version": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false
      },
      "McpToolSettings": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "approval": {
            "type": "string",
            "enum": [
              "never",
              "always"
            ]
          },
          "deferred": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "JsonValue": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          },
          {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/JsonValue"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          {
            "type": "object",
            "additionalProperties": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/JsonValue"
                },
                {
                  "type": "null"
                }
              ]
            }
          }
        ]
      },
      "ListSessionsResponse": {
        "type": "object",
        "properties": {
          "sessions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "agentId": {
                  "type": "string"
                },
                "ownerUserId": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "idle",
                    "runnable",
                    "running",
                    "waiting",
                    "paused",
                    "uncertain",
                    "completed",
                    "failed",
                    "cancelled"
                  ]
                },
                "activeTurnId": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "agentId",
                "ownerUserId",
                "status",
                "activeTurnId"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "sessions"
        ],
        "additionalProperties": false
      },
      "SessionPage": {
        "type": "object",
        "properties": {
          "sessions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionListItem"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "sessions",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "SessionListItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "agentId": {
            "type": "string"
          },
          "ownerUserId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "idle",
              "runnable",
              "running",
              "waiting",
              "paused",
              "uncertain",
              "completed",
              "failed",
              "cancelled"
            ]
          },
          "activeTurnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastTurnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastEventAt": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "agentId",
          "ownerUserId",
          "status",
          "activeTurnId",
          "lastTurnId",
          "createdAt",
          "lastEventAt"
        ],
        "additionalProperties": false
      },
      "SessionView": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "agentId": {
            "type": "string"
          },
          "ownerUserId": {
            "type": "string"
          },
          "manifest": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "version": {
                "type": "integer",
                "exclusiveMinimum": 0
              }
            },
            "required": [
              "name",
              "version"
            ],
            "additionalProperties": false
          },
          "manifestHash": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "idle",
              "runnable",
              "running",
              "waiting",
              "paused",
              "uncertain",
              "completed",
              "failed",
              "cancelled"
            ]
          },
          "activeTurnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "queuedMessages": {
            "type": "integer",
            "minimum": 0
          },
          "harness": {
            "type": "string"
          },
          "closedReason": {
            "type": "string"
          },
          "mcpSnapshot": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {}
          },
          "mcpDiagnostics": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            }
          },
          "waits": {},
          "error": {
            "type": "string"
          },
          "uncertainEffects": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "effectId": {
                  "type": "string"
                },
                "turnId": {
                  "type": "string"
                },
                "kind": {
                  "type": "string"
                },
                "error": {}
              },
              "required": [
                "effectId",
                "turnId",
                "kind"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "agentId",
          "ownerUserId",
          "manifest",
          "manifestHash",
          "status",
          "activeTurnId",
          "queuedMessages",
          "harness",
          "mcpSnapshot",
          "mcpDiagnostics",
          "uncertainEffects"
        ],
        "additionalProperties": false
      },
      "PutSessionRequest": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "minLength": 1
          },
          "agent": {
            "type": "string",
            "description": "An Agent id, such as `triage` or `users/alice/triage`"
          },
          "ownerUserId": {
            "type": "string",
            "minLength": 1
          },
          "info": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "required": [
          "requestId",
          "agent",
          "ownerUserId"
        ],
        "additionalProperties": false
      },
      "SessionItemsResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionEvent"
            }
          },
          "cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "cursor"
        ]
      },
      "SessionEvent": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/CommandMessageEvent"
          },
          {
            "$ref": "#/components/schemas/CommandApproveEvent"
          },
          {
            "$ref": "#/components/schemas/CommandRespondEvent"
          },
          {
            "$ref": "#/components/schemas/TurnCompletedEvent"
          },
          {
            "$ref": "#/components/schemas/TurnPausedEvent"
          },
          {
            "$ref": "#/components/schemas/TurnFailedEvent"
          },
          {
            "$ref": "#/components/schemas/TurnCancelledEvent"
          },
          {
            "$ref": "#/components/schemas/MessageQueuedEvent"
          },
          {
            "$ref": "#/components/schemas/QueueTakenEvent"
          },
          {
            "$ref": "#/components/schemas/WakeBookedEvent"
          },
          {
            "$ref": "#/components/schemas/WakeCancelledEvent"
          },
          {
            "$ref": "#/components/schemas/MemoryUpdatedEvent"
          },
          {
            "$ref": "#/components/schemas/MessageAssistantEvent"
          },
          {
            "$ref": "#/components/schemas/ModelFailedEvent"
          },
          {
            "$ref": "#/components/schemas/ContextCompactedEvent"
          },
          {
            "$ref": "#/components/schemas/ToolCompletedEvent"
          },
          {
            "$ref": "#/components/schemas/EffectUncertainEvent"
          },
          {
            "$ref": "#/components/schemas/DelegationStartedEvent"
          },
          {
            "$ref": "#/components/schemas/DelegationCompletedEvent"
          },
          {
            "$ref": "#/components/schemas/McpDiscoveredEvent"
          },
          {
            "$ref": "#/components/schemas/EnvironmentStateEvent"
          },
          {
            "$ref": "#/components/schemas/EnvironmentExecEvent"
          },
          {
            "$ref": "#/components/schemas/AgentAttachedEvent"
          },
          {
            "$ref": "#/components/schemas/NodeStartedEvent"
          },
          {
            "$ref": "#/components/schemas/NodeCompletedEvent"
          },
          {
            "$ref": "#/components/schemas/NodeAgentEvent"
          },
          {
            "$ref": "#/components/schemas/LoopIterationEvent"
          },
          {
            "$ref": "#/components/schemas/LoopVerifiedEvent"
          },
          {
            "$ref": "#/components/schemas/ArtifactCreatedEvent"
          },
          {
            "$ref": "#/components/schemas/ArtifactVersionCreatedEvent"
          },
          {
            "$ref": "#/components/schemas/ArtifactDeletedEvent"
          },
          {
            "$ref": "#/components/schemas/ArtifactExportSkippedEvent"
          },
          {
            "$ref": "#/components/schemas/ArtifactExportFailedEvent"
          },
          {
            "$ref": "#/components/schemas/TranscriptUpdatedEvent"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "command.message": "#/components/schemas/CommandMessageEvent",
            "command.approve": "#/components/schemas/CommandApproveEvent",
            "command.respond": "#/components/schemas/CommandRespondEvent",
            "turn.completed": "#/components/schemas/TurnCompletedEvent",
            "turn.paused": "#/components/schemas/TurnPausedEvent",
            "turn.failed": "#/components/schemas/TurnFailedEvent",
            "turn.cancelled": "#/components/schemas/TurnCancelledEvent",
            "message.queued": "#/components/schemas/MessageQueuedEvent",
            "queue.taken": "#/components/schemas/QueueTakenEvent",
            "wake.booked": "#/components/schemas/WakeBookedEvent",
            "wake.cancelled": "#/components/schemas/WakeCancelledEvent",
            "memory.updated": "#/components/schemas/MemoryUpdatedEvent",
            "message.assistant": "#/components/schemas/MessageAssistantEvent",
            "model.failed": "#/components/schemas/ModelFailedEvent",
            "context.compacted": "#/components/schemas/ContextCompactedEvent",
            "tool.completed": "#/components/schemas/ToolCompletedEvent",
            "effect.uncertain": "#/components/schemas/EffectUncertainEvent",
            "delegation.started": "#/components/schemas/DelegationStartedEvent",
            "delegation.completed": "#/components/schemas/DelegationCompletedEvent",
            "mcp.discovered": "#/components/schemas/McpDiscoveredEvent",
            "environment.state": "#/components/schemas/EnvironmentStateEvent",
            "environment.exec": "#/components/schemas/EnvironmentExecEvent",
            "agent.attached": "#/components/schemas/AgentAttachedEvent",
            "node.started": "#/components/schemas/NodeStartedEvent",
            "node.completed": "#/components/schemas/NodeCompletedEvent",
            "node.agent": "#/components/schemas/NodeAgentEvent",
            "loop.iteration": "#/components/schemas/LoopIterationEvent",
            "loop.verified": "#/components/schemas/LoopVerifiedEvent",
            "artifact.created": "#/components/schemas/ArtifactCreatedEvent",
            "artifact.version.created": "#/components/schemas/ArtifactVersionCreatedEvent",
            "artifact.deleted": "#/components/schemas/ArtifactDeletedEvent",
            "artifact.export.skipped": "#/components/schemas/ArtifactExportSkippedEvent",
            "artifact.export.failed": "#/components/schemas/ArtifactExportFailedEvent",
            "transcript.updated": "#/components/schemas/TranscriptUpdatedEvent"
          }
        }
      },
      "CommandMessageEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "command.message"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "requestId": {
                "type": "string",
                "minLength": 1
              },
              "idempotencyKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "type": {
                "type": "string",
                "enum": [
                  "message"
                ]
              },
              "content": {
                "type": "string"
              },
              "data": {
                "$ref": "#/components/schemas/JsonValue"
              },
              "parts": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "text"
                          ]
                        },
                        "text": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "type",
                        "text"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "file"
                          ]
                        },
                        "artifactId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "version": {
                          "type": "integer",
                          "exclusiveMinimum": 0
                        }
                      },
                      "required": [
                        "type",
                        "artifactId"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "manifest": {},
              "delivery": {
                "type": "string",
                "enum": [
                  "queue",
                  "reject"
                ]
              },
              "queuedMessageId": {
                "type": "string"
              },
              "cause": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "trigger",
                      "self"
                    ]
                  },
                  "triggerId": {
                    "type": "string"
                  },
                  "runId": {
                    "type": "string"
                  }
                },
                "required": [
                  "kind",
                  "triggerId",
                  "runId"
                ],
                "additionalProperties": false
              },
              "trace": {
                "type": "object",
                "properties": {
                  "traceparent": {
                    "type": "string"
                  },
                  "tracestate": {
                    "type": "string"
                  }
                },
                "required": [
                  "traceparent"
                ],
                "additionalProperties": {}
              }
            },
            "required": [
              "requestId",
              "idempotencyKey",
              "type"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "CommandApproveEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "command.approve"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "requestId": {
                "type": "string",
                "minLength": 1
              },
              "idempotencyKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "type": {
                "type": "string",
                "enum": [
                  "approve"
                ]
              },
              "interactionId": {
                "type": "string",
                "minLength": 1
              },
              "approved": {
                "type": "boolean"
              }
            },
            "required": [
              "requestId",
              "idempotencyKey",
              "type",
              "interactionId",
              "approved"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "CommandRespondEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "command.respond"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "requestId": {
                "type": "string",
                "minLength": 1
              },
              "idempotencyKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "type": {
                "type": "string",
                "enum": [
                  "respond"
                ]
              },
              "interactionId": {
                "type": "string",
                "minLength": 1
              },
              "value": {}
            },
            "required": [
              "requestId",
              "idempotencyKey",
              "type",
              "interactionId"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "TurnCompletedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "turn.completed"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "output": {},
              "durationMs": {
                "type": "integer",
                "minimum": 0
              },
              "pausedMs": {
                "type": "integer",
                "minimum": 0
              },
              "agentId": {
                "type": "string"
              },
              "manifest": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "version": {
                    "type": "integer"
                  }
                },
                "required": [
                  "name",
                  "version"
                ],
                "additionalProperties": {}
              },
              "totals": {
                "type": "object",
                "properties": {
                  "steps": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "tokens": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "costUsd": {
                    "type": "number",
                    "minimum": 0
                  }
                },
                "required": [
                  "steps",
                  "tokens",
                  "costUsd"
                ],
                "additionalProperties": {}
              }
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "TurnPausedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "turn.paused"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "interactions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "invocationId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "callId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "interaction": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "kind": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "kind"
                      ],
                      "additionalProperties": {}
                    },
                    "status": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "invocationId",
                    "interaction"
                  ],
                  "additionalProperties": {}
                }
              }
            },
            "required": [
              "interactions"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "TurnFailedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "turn.failed"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "additionalProperties": {}
              },
              "message": {
                "type": "string"
              },
              "durationMs": {
                "type": "integer",
                "minimum": 0
              },
              "pausedMs": {
                "type": "integer",
                "minimum": 0
              },
              "agentId": {
                "type": "string"
              },
              "manifest": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "version": {
                    "type": "integer"
                  }
                },
                "required": [
                  "name",
                  "version"
                ],
                "additionalProperties": {}
              },
              "totals": {
                "type": "object",
                "properties": {
                  "steps": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "tokens": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "costUsd": {
                    "type": "number",
                    "minimum": 0
                  }
                },
                "required": [
                  "steps",
                  "tokens",
                  "costUsd"
                ],
                "additionalProperties": {}
              }
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "TurnCancelledEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "turn.cancelled"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "reason": {
                "type": "string"
              },
              "durationMs": {
                "type": "integer",
                "minimum": 0
              },
              "pausedMs": {
                "type": "integer",
                "minimum": 0
              },
              "agentId": {
                "type": "string"
              },
              "manifest": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "version": {
                    "type": "integer"
                  }
                },
                "required": [
                  "name",
                  "version"
                ],
                "additionalProperties": {}
              },
              "totals": {
                "type": "object",
                "properties": {
                  "steps": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "tokens": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "costUsd": {
                    "type": "number",
                    "minimum": 0
                  }
                },
                "required": [
                  "steps",
                  "tokens",
                  "costUsd"
                ],
                "additionalProperties": {}
              }
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "MessageQueuedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "message.queued"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "queuedMessageId": {
                "type": "string"
              },
              "position": {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              "requestId": {
                "type": "string"
              }
            },
            "required": [
              "queuedMessageId",
              "position",
              "requestId"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "QueueTakenEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "queue.taken"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "turnId": {
                "type": "string"
              },
              "queuedMessageIds": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "minItems": 1
              }
            },
            "required": [
              "turnId",
              "queuedMessageIds"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "WakeBookedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "wake.booked"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "at": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "effectId": {
                "type": "string"
              },
              "replaced": {
                "type": "boolean"
              }
            },
            "required": [
              "at",
              "note",
              "effectId",
              "replaced"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "WakeCancelledEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "wake.cancelled"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "effectId": {
                "type": "string"
              }
            },
            "required": [
              "effectId"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "MemoryUpdatedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "memory.updated"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "effectId": {
                "type": "string"
              },
              "changes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "type": "string"
                    },
                    "operation": {
                      "type": "string",
                      "enum": [
                        "create",
                        "str_replace",
                        "insert",
                        "delete",
                        "rename"
                      ]
                    },
                    "version": {
                      "type": "integer",
                      "exclusiveMinimum": 0
                    }
                  },
                  "required": [
                    "path",
                    "operation",
                    "version"
                  ],
                  "additionalProperties": false
                },
                "minItems": 1
              }
            },
            "required": [
              "effectId",
              "changes"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "MessageAssistantEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "message.assistant"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "invocationId": {
                "type": "string",
                "minLength": 1
              },
              "text": {
                "type": "string"
              },
              "model": {
                "type": "object",
                "properties": {
                  "provider": {
                    "type": "string"
                  },
                  "model": {
                    "type": "string"
                  }
                },
                "required": [
                  "provider",
                  "model"
                ],
                "additionalProperties": {}
              },
              "finishReason": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "additionalProperties": {
                  "type": "number"
                }
              },
              "toolCalls": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "callId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "input": {}
                  },
                  "required": [
                    "callId",
                    "name"
                  ],
                  "additionalProperties": {}
                }
              },
              "effectId": {
                "type": "string",
                "minLength": 1
              },
              "durationMs": {
                "type": "integer",
                "minimum": 0
              },
              "gate": {
                "type": "object",
                "properties": {
                  "startedAt": {
                    "type": "string"
                  },
                  "endedAt": {
                    "type": "string"
                  }
                },
                "required": [
                  "startedAt",
                  "endedAt"
                ],
                "additionalProperties": {}
              },
              "firstTokenMs": {
                "type": "integer",
                "minimum": 0
              },
              "meteredUsage": {
                "type": "object",
                "properties": {
                  "inputTokens": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "outputTokens": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "totalTokens": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "cachedTokens": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "costUsd": {
                    "type": "number",
                    "minimum": 0
                  }
                },
                "required": [
                  "inputTokens",
                  "outputTokens",
                  "totalTokens"
                ],
                "additionalProperties": {}
              },
              "agent": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "path": {
                    "type": "string",
                    "minLength": 1
                  },
                  "delegationId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "id",
                  "path"
                ],
                "additionalProperties": {}
              }
            },
            "required": [
              "invocationId",
              "text",
              "toolCalls"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "ModelFailedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "model.failed"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "invocationId": {
                "type": "string",
                "minLength": 1
              },
              "code": {
                "type": "string",
                "minLength": 1
              },
              "message": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean"
              },
              "effectId": {
                "type": "string",
                "minLength": 1
              },
              "durationMs": {
                "type": "integer",
                "minimum": 0
              },
              "gate": {
                "type": "object",
                "properties": {
                  "startedAt": {
                    "type": "string"
                  },
                  "endedAt": {
                    "type": "string"
                  }
                },
                "required": [
                  "startedAt",
                  "endedAt"
                ],
                "additionalProperties": {}
              },
              "firstTokenMs": {
                "type": "integer",
                "minimum": 0
              },
              "meteredUsage": {
                "type": "object",
                "properties": {
                  "inputTokens": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "outputTokens": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "totalTokens": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "cachedTokens": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "costUsd": {
                    "type": "number",
                    "minimum": 0
                  }
                },
                "required": [
                  "inputTokens",
                  "outputTokens",
                  "totalTokens"
                ],
                "additionalProperties": {}
              },
              "agent": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "path": {
                    "type": "string",
                    "minLength": 1
                  },
                  "delegationId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "id",
                  "path"
                ],
                "additionalProperties": {}
              }
            },
            "required": [
              "code",
              "message",
              "retryable"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "ContextCompactedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "context.compacted"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "invocationId": {
                "type": "string",
                "minLength": 1
              },
              "trigger": {
                "type": "string",
                "enum": [
                  "threshold",
                  "overflow"
                ]
              },
              "tokensBefore": {
                "type": "integer",
                "minimum": 0
              },
              "tokensAfter": {
                "type": "integer",
                "minimum": 0
              },
              "effectId": {
                "type": "string",
                "minLength": 1
              },
              "durationMs": {
                "type": "integer",
                "minimum": 0
              },
              "gate": {
                "type": "object",
                "properties": {
                  "startedAt": {
                    "type": "string"
                  },
                  "endedAt": {
                    "type": "string"
                  }
                },
                "required": [
                  "startedAt",
                  "endedAt"
                ],
                "additionalProperties": {}
              },
              "firstTokenMs": {
                "type": "integer",
                "minimum": 0
              },
              "meteredUsage": {
                "type": "object",
                "properties": {
                  "inputTokens": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "outputTokens": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "totalTokens": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "cachedTokens": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "costUsd": {
                    "type": "number",
                    "minimum": 0
                  }
                },
                "required": [
                  "inputTokens",
                  "outputTokens",
                  "totalTokens"
                ],
                "additionalProperties": {}
              },
              "agent": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "path": {
                    "type": "string",
                    "minLength": 1
                  },
                  "delegationId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "id",
                  "path"
                ],
                "additionalProperties": {}
              }
            },
            "required": [
              "trigger",
              "tokensBefore",
              "tokensAfter"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "ToolCompletedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "tool.completed"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "callId": {
                "type": "string",
                "minLength": 1
              },
              "invocationId": {
                "type": "string",
                "minLength": 1
              },
              "effectId": {
                "type": "string",
                "minLength": 1
              },
              "toolName": {
                "type": "string",
                "minLength": 1
              },
              "status": {
                "type": "string",
                "enum": [
                  "completed",
                  "failed",
                  "cancelled"
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "mcp",
                  "http",
                  "sandbox",
                  "harness",
                  "runtime"
                ]
              },
              "server": {
                "type": "string",
                "minLength": 1
              },
              "tool": {
                "type": "string",
                "minLength": 1
              },
              "skill": {
                "type": "string",
                "minLength": 1
              },
              "plugin": {
                "$ref": "#/components/schemas/PluginLabel"
              },
              "attempts": {
                "type": "integer",
                "minimum": 0
              },
              "durationMs": {
                "type": "integer",
                "minimum": 0
              },
              "gate": {
                "type": "object",
                "properties": {
                  "startedAt": {
                    "type": "string"
                  },
                  "endedAt": {
                    "type": "string"
                  }
                },
                "required": [
                  "startedAt",
                  "endedAt"
                ],
                "additionalProperties": {}
              },
              "policy": {
                "type": "object",
                "properties": {
                  "decision": {
                    "type": "string",
                    "enum": [
                      "ask",
                      "deny"
                    ]
                  },
                  "reason": {
                    "type": "string"
                  },
                  "approvedBy": {
                    "type": "string"
                  }
                },
                "required": [
                  "decision",
                  "reason"
                ],
                "additionalProperties": {}
              },
              "output": {},
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "server": {
                    "type": "string"
                  },
                  "gateway": {
                    "type": "string"
                  },
                  "retryable": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "additionalProperties": {}
              },
              "redacted": {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              "agent": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "path": {
                    "type": "string",
                    "minLength": 1
                  },
                  "delegationId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "id",
                  "path"
                ],
                "additionalProperties": {}
              }
            },
            "required": [
              "callId",
              "invocationId",
              "toolName"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "EffectUncertainEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "effect.uncertain"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "effectId": {
                "type": "string",
                "minLength": 1
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "effectId"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "DelegationStartedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "delegation.started"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "agent": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "path": {
                    "type": "string",
                    "minLength": 1
                  },
                  "delegationId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "id",
                  "path"
                ],
                "additionalProperties": {}
              },
              "callId": {
                "type": "string"
              }
            },
            "required": [
              "agent"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "DelegationCompletedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "delegation.completed"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "agent": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "path": {
                    "type": "string",
                    "minLength": 1
                  },
                  "delegationId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "id",
                  "path"
                ],
                "additionalProperties": {}
              },
              "callId": {
                "type": "string"
              }
            },
            "required": [
              "agent"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "McpDiscoveredEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "mcp.discovered"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "servers": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "agentId": {
                      "type": "string"
                    },
                    "serverName": {
                      "type": "string"
                    },
                    "plugin": {
                      "$ref": "#/components/schemas/PluginLabel"
                    },
                    "outcome": {
                      "type": "string",
                      "enum": [
                        "connected",
                        "refused",
                        "failed"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "tools": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "disabled": {
                      "type": "integer",
                      "exclusiveMinimum": 0
                    },
                    "unknownTools": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "credentialIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "serverName",
                    "outcome",
                    "message",
                    "tools"
                  ],
                  "additionalProperties": {}
                }
              }
            },
            "required": [
              "servers"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "EnvironmentStateEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "environment.state"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "creating",
                  "running",
                  "stopped"
                ]
              },
              "backend": {
                "type": "string"
              },
              "isolation": {
                "type": "string"
              },
              "image": {
                "type": "string"
              },
              "network": {},
              "reattach": {
                "type": "boolean"
              },
              "lost": {
                "type": "boolean"
              },
              "note": {
                "type": "string"
              },
              "error": {
                "type": "string"
              }
            },
            "required": [
              "state",
              "backend"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "EnvironmentExecEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "environment.exec"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "tool": {
                "type": "string"
              },
              "command": {
                "type": "string"
              },
              "outcome": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "durationMs": {
                "type": "number",
                "minimum": 0
              }
            },
            "required": [
              "tool",
              "outcome",
              "durationMs"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "AgentAttachedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "agent.attached"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "agentId": {
                "type": "string"
              }
            },
            "required": [
              "agentId"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "NodeStartedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "node.started"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string"
              },
              "kind": {
                "type": "string"
              },
              "key": {
                "type": "string"
              },
              "iterations": {
                "type": "string"
              }
            },
            "required": [
              "path",
              "kind",
              "key"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "NodeCompletedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "node.completed"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string"
              },
              "kind": {
                "type": "string"
              },
              "key": {
                "type": "string"
              },
              "iterations": {
                "type": "string"
              },
              "effectId": {
                "type": "string",
                "minLength": 1
              },
              "status": {
                "type": "string",
                "enum": [
                  "completed",
                  "failed",
                  "cancelled"
                ]
              },
              "durationMs": {
                "type": "integer",
                "minimum": 0
              },
              "gate": {
                "type": "object",
                "properties": {
                  "startedAt": {
                    "type": "string"
                  },
                  "endedAt": {
                    "type": "string"
                  }
                },
                "required": [
                  "startedAt",
                  "endedAt"
                ],
                "additionalProperties": {}
              }
            },
            "required": [
              "path",
              "kind",
              "key",
              "effectId",
              "status"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "NodeAgentEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "node.agent"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string"
              },
              "iterations": {
                "type": "string"
              },
              "sessionId": {
                "type": "string"
              },
              "turnId": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "path",
              "sessionId"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "LoopIterationEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "loop.iteration"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string"
              },
              "n": {
                "type": "integer"
              },
              "sessionId": {
                "type": "string"
              },
              "turnId": {
                "type": "string"
              },
              "manifestHash": {
                "type": "string"
              }
            },
            "required": [
              "path",
              "n"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "LoopVerifiedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "loop.verified"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string"
              },
              "n": {
                "type": "integer"
              },
              "pass": {
                "type": "boolean"
              },
              "feedback": {
                "type": "string"
              },
              "data": {}
            },
            "required": [
              "path",
              "n",
              "pass"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "ArtifactCreatedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "artifact.created"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "artifactId": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "file",
                  "folder"
                ]
              },
              "name": {
                "type": "string"
              },
              "contentType": {
                "type": "string"
              },
              "version": {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              "size": {
                "type": "integer",
                "minimum": 0
              },
              "sha256": {
                "type": "string"
              },
              "source": {
                "type": "string",
                "enum": [
                  "upload",
                  "engine",
                  "export",
                  "snapshot"
                ]
              },
              "callId": {
                "type": "string"
              },
              "fileCount": {
                "type": "integer",
                "minimum": 0
              },
              "claimed": {
                "type": "boolean"
              }
            },
            "required": [
              "artifactId",
              "kind",
              "name",
              "contentType",
              "version",
              "size",
              "sha256",
              "source"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "ArtifactVersionCreatedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "artifact.version.created"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "artifactId": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "file",
                  "folder"
                ]
              },
              "name": {
                "type": "string"
              },
              "contentType": {
                "type": "string"
              },
              "version": {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              "size": {
                "type": "integer",
                "minimum": 0
              },
              "sha256": {
                "type": "string"
              },
              "source": {
                "type": "string",
                "enum": [
                  "upload",
                  "engine",
                  "export",
                  "snapshot"
                ]
              },
              "callId": {
                "type": "string"
              },
              "fileCount": {
                "type": "integer",
                "minimum": 0
              },
              "claimed": {
                "type": "boolean"
              }
            },
            "required": [
              "artifactId",
              "kind",
              "name",
              "contentType",
              "version",
              "size",
              "sha256",
              "source"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "ArtifactDeletedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "artifact.deleted"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "artifactId": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "artifactId",
              "name"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "ArtifactExportSkippedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "artifact.export.skipped"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "reason": {
                "type": "string",
                "enum": [
                  "too_many_files",
                  "file_too_large",
                  "too_large",
                  "tenant_total",
                  "environment_total"
                ]
              },
              "message": {
                "type": "string"
              },
              "limit": {
                "type": "integer",
                "minimum": 0
              },
              "path": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "reason",
              "message"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "ArtifactExportFailedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "artifact.export.failed"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "message"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "TranscriptUpdatedEvent": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "nylorun.event/2"
            ]
          },
          "eventId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1
          },
          "sessionId": {
            "type": "string"
          },
          "runId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "incarnation": {
            "type": "integer",
            "minimum": 0
          },
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "seq": {
            "type": "integer",
            "minimum": 0
          },
          "cursor": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "client",
                  "core",
                  "model-gate",
                  "tool-gate",
                  "egress-gate",
                  "sandboxes",
                  "edge",
                  "init",
                  "controller",
                  "loop",
                  "supervisor",
                  "harness",
                  "evidence",
                  "operator",
                  "human",
                  "api"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ]
          },
          "evidence": {
            "type": "string",
            "enum": [
              "observed",
              "measured",
              "attested",
              "claimed",
              "asserted"
            ]
          },
          "principal": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "application",
                  "subject",
                  "flow-host",
                  "core",
                  "trigger"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "trace": {
            "type": "object",
            "properties": {
              "traceId": {
                "type": "string"
              },
              "spanId": {
                "type": "string"
              },
              "parentSpanId": {
                "type": "string"
              }
            },
            "required": [
              "traceId",
              "spanId"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal",
              "restricted"
            ]
          },
          "retention": {
            "type": "string",
            "enum": [
              "full",
              "metadata"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "transcript.updated"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "keep": {
                "type": "integer",
                "minimum": 0
              },
              "entries": {
                "type": "array",
                "items": {}
              },
              "length": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "keep",
              "entries",
              "length"
            ],
            "additionalProperties": {}
          }
        },
        "required": [
          "schema",
          "eventId",
          "tenantId",
          "sessionId",
          "runId",
          "turnId",
          "incarnation",
          "epoch",
          "seq",
          "cursor",
          "time",
          "schemaVersion",
          "source",
          "evidence",
          "visibility",
          "retention",
          "type",
          "payload"
        ]
      },
      "HistoryPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionEvent"
            }
          },
          "cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "tail": {
            "type": "boolean"
          }
        },
        "required": [
          "items",
          "cursor",
          "tail"
        ]
      },
      "StreamClosedFrame": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "token_expired"
            ]
          }
        },
        "required": [
          "reason"
        ],
        "additionalProperties": false
      },
      "SandboxToolOutcome": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "completed"
                ]
              },
              "output": {}
            },
            "required": [
              "kind"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "failed"
                ]
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        ]
      },
      "DefinitionFileView": {
        "type": "object",
        "properties": {
          "sha256": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "size": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "sha256",
          "size"
        ],
        "additionalProperties": false
      },
      "ListAgentsResponse": {
        "type": "object",
        "properties": {
          "agents": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "manifest": {
                  "type": "string"
                },
                "resolvedVersion": {
                  "type": "integer",
                  "exclusiveMinimum": 0
                },
                "manifestHash": {
                  "type": "string"
                },
                "tracking": {
                  "type": "string",
                  "enum": [
                    "tracking",
                    "pinned"
                  ]
                },
                "targetVersion": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "exclusiveMinimum": 0
                },
                "waitingFor": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "secrets",
                    "start",
                    null
                  ]
                },
                "failedVersion": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "exclusiveMinimum": 0
                },
                "startCheck": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "from": {
                      "type": "integer",
                      "exclusiveMinimum": 0
                    },
                    "startedAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "from",
                    "startedAt"
                  ],
                  "additionalProperties": false
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "virtual",
                    "pod",
                    "none"
                  ]
                },
                "harness": {
                  "type": "string"
                },
                "owner": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "labels": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                },
                "state": {
                  "type": "string",
                  "description": "working, sleeping, input_required, failing or paused; an open set"
                },
                "attention": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "state": {
                        "type": "string",
                        "enum": [
                          "paused",
                          "failing",
                          "input_required",
                          "working",
                          "sleeping"
                        ]
                      },
                      "sessionId": {
                        "type": "string"
                      },
                      "reason": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "state",
                      "reason"
                    ],
                    "additionalProperties": false
                  }
                },
                "desired": {
                  "type": "string",
                  "enum": [
                    "on",
                    "off"
                  ]
                },
                "nextWakeAt": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "compute": {
                  "type": "object",
                  "properties": {
                    "state": {
                      "type": "string",
                      "description": "ready, creating, running or stopped; an open set"
                    },
                    "pod": {
                      "type": "object",
                      "properties": {
                        "desired": {
                          "type": "string",
                          "enum": [
                            "running",
                            "suspended",
                            "deleted"
                          ]
                        },
                        "observed": {
                          "type": "string",
                          "enum": [
                            "creating",
                            "running",
                            "suspended",
                            "lost",
                            "failed",
                            "deleting"
                          ]
                        },
                        "volumeGeneration": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "hostEpoch": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "reason": {
                          "type": "string"
                        },
                        "imageDigest": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "desired",
                        "observed",
                        "volumeGeneration",
                        "hostEpoch"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "state"
                  ],
                  "additionalProperties": false
                },
                "runtime": {
                  "type": "object",
                  "properties": {
                    "image": {
                      "type": "string"
                    },
                    "resources": {
                      "type": "object",
                      "properties": {
                        "cpus": {
                          "type": "integer"
                        },
                        "memory": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "cpus",
                        "memory"
                      ],
                      "additionalProperties": false
                    },
                    "storage": {
                      "type": "string"
                    },
                    "network": {
                      "type": "object",
                      "properties": {
                        "allowedHosts": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "allowedHosts"
                      ],
                      "additionalProperties": false
                    },
                    "harness": {
                      "type": "string"
                    },
                    "lifecycle": {
                      "type": "object",
                      "properties": {
                        "idle": {
                          "type": "string"
                        },
                        "deleteAfter": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": false
                    },
                    "setup": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "command": {
                            "type": "string",
                            "minLength": 1
                          },
                          "cwd": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1024
                          },
                          "timeout": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "command"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "files": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "artifactId": {
                                "type": "string"
                              },
                              "version": {
                                "type": "integer",
                                "exclusiveMinimum": 0
                              },
                              "path": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1024
                              }
                            },
                            "required": [
                              "artifactId",
                              "version",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "path": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1024
                              },
                              "files": {
                                "type": "object",
                                "additionalProperties": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": [
                              "path",
                              "files"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "artifacts": {
                          "type": "object",
                          "properties": {
                            "fileBytes": {
                              "type": "integer",
                              "exclusiveMinimum": 0
                            },
                            "totalBytes": {
                              "type": "integer",
                              "exclusiveMinimum": 0
                            }
                          },
                          "additionalProperties": false
                        },
                        "skills": {
                          "type": "object",
                          "properties": {
                            "totalBytes": {
                              "type": "integer",
                              "exclusiveMinimum": 0
                            }
                          },
                          "additionalProperties": false
                        },
                        "disk": {
                          "type": "object",
                          "properties": {
                            "versionBytes": {
                              "type": "integer",
                              "exclusiveMinimum": 0
                            },
                            "versionEntries": {
                              "type": "integer",
                              "exclusiveMinimum": 0
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "additionalProperties": false
                    },
                    "secrets": {
                      "type": "object",
                      "additionalProperties": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "environment_secret"
                                ]
                              },
                              "allowedHosts": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "minItems": 1
                              },
                              "inject": {
                                "type": "object",
                                "properties": {
                                  "header": {
                                    "type": "string",
                                    "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                                  },
                                  "format": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "header",
                                  "format"
                                ],
                                "additionalProperties": false
                              },
                              "required": {
                                "type": "boolean"
                              },
                              "description": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type",
                              "allowedHosts"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "environment_variable"
                                ]
                              },
                              "required": {
                                "type": "boolean"
                              },
                              "description": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "bearer"
                                ]
                              },
                              "url": {
                                "type": "string",
                                "minLength": 1
                              },
                              "via": {
                                "type": "string"
                              },
                              "identity": {
                                "type": "object",
                                "properties": {
                                  "header": {
                                    "type": "string",
                                    "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                                  }
                                },
                                "required": [
                                  "header"
                                ],
                                "additionalProperties": false
                              },
                              "required": {
                                "type": "boolean"
                              },
                              "description": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type",
                              "url"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "headers"
                                ]
                              },
                              "url": {
                                "type": "string",
                                "minLength": 1
                              },
                              "via": {
                                "type": "string"
                              },
                              "identity": {
                                "type": "object",
                                "properties": {
                                  "header": {
                                    "type": "string",
                                    "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                                  }
                                },
                                "required": [
                                  "header"
                                ],
                                "additionalProperties": false
                              },
                              "required": {
                                "type": "boolean"
                              },
                              "description": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type",
                              "url"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    }
                  },
                  "required": [
                    "harness",
                    "lifecycle"
                  ],
                  "additionalProperties": false
                },
                "limits": {
                  "type": "object",
                  "properties": {
                    "artifacts": {
                      "type": "object",
                      "properties": {
                        "fileBytes": {
                          "type": "integer"
                        },
                        "totalBytes": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "fileBytes",
                        "totalBytes"
                      ],
                      "additionalProperties": false
                    },
                    "skills": {
                      "type": "object",
                      "properties": {
                        "totalBytes": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "totalBytes"
                      ],
                      "additionalProperties": false
                    },
                    "disk": {
                      "type": "object",
                      "properties": {
                        "versionBytes": {
                          "type": "integer"
                        },
                        "versionEntries": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "versionBytes",
                        "versionEntries"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "artifacts",
                    "skills",
                    "disk"
                  ],
                  "additionalProperties": false
                },
                "sessions": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "ownerUserId": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string"
                      },
                      "activeTurnId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "ownerUserId",
                      "status",
                      "activeTurnId"
                    ],
                    "additionalProperties": false
                  }
                },
                "slots": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "type": {
                        "type": "string"
                      },
                      "required": {
                        "type": "boolean"
                      },
                      "set": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "name",
                      "type",
                      "required",
                      "set"
                    ],
                    "additionalProperties": false
                  }
                },
                "disk": {
                  "type": "object",
                  "properties": {
                    "latestVersion": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "exclusiveMinimum": 0
                    },
                    "operation": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "snapshot",
                            "restore",
                            "seed"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "exclusiveMinimum": 0
                        },
                        "startedAt": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "startedAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "latestVersion",
                    "operation"
                  ],
                  "additionalProperties": false
                },
                "forkedFrom": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "agent": {
                      "type": "string"
                    },
                    "disk": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "exclusiveMinimum": 0
                    }
                  },
                  "required": [
                    "agent",
                    "disk"
                  ],
                  "additionalProperties": false
                },
                "lastUsedAt": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string"
                },
                "updatedAt": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "manifest",
                "resolvedVersion",
                "manifestHash",
                "tracking",
                "targetVersion",
                "waitingFor",
                "failedVersion",
                "startCheck",
                "kind",
                "harness",
                "owner",
                "labels",
                "state",
                "attention",
                "desired",
                "nextWakeAt",
                "compute",
                "runtime",
                "limits",
                "sessions",
                "slots",
                "forkedFrom",
                "lastUsedAt",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "agents"
        ],
        "additionalProperties": false
      },
      "AgentPage": {
        "type": "object",
        "properties": {
          "agents": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "manifest": {
                  "type": "string"
                },
                "resolvedVersion": {
                  "type": "integer",
                  "exclusiveMinimum": 0
                },
                "manifestHash": {
                  "type": "string"
                },
                "tracking": {
                  "type": "string",
                  "enum": [
                    "tracking",
                    "pinned"
                  ]
                },
                "targetVersion": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "exclusiveMinimum": 0
                },
                "waitingFor": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "secrets",
                    "start",
                    null
                  ]
                },
                "failedVersion": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "exclusiveMinimum": 0
                },
                "startCheck": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "from": {
                      "type": "integer",
                      "exclusiveMinimum": 0
                    },
                    "startedAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "from",
                    "startedAt"
                  ],
                  "additionalProperties": false
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "virtual",
                    "pod",
                    "none"
                  ]
                },
                "harness": {
                  "type": "string"
                },
                "owner": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "labels": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                },
                "state": {
                  "type": "string",
                  "description": "working, sleeping, input_required, failing or paused; an open set"
                },
                "attention": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "state": {
                        "type": "string",
                        "enum": [
                          "paused",
                          "failing",
                          "input_required",
                          "working",
                          "sleeping"
                        ]
                      },
                      "sessionId": {
                        "type": "string"
                      },
                      "reason": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "state",
                      "reason"
                    ],
                    "additionalProperties": false
                  }
                },
                "desired": {
                  "type": "string",
                  "enum": [
                    "on",
                    "off"
                  ]
                },
                "nextWakeAt": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "compute": {
                  "type": "object",
                  "properties": {
                    "state": {
                      "type": "string",
                      "description": "ready, creating, running or stopped; an open set"
                    },
                    "pod": {
                      "type": "object",
                      "properties": {
                        "desired": {
                          "type": "string",
                          "enum": [
                            "running",
                            "suspended",
                            "deleted"
                          ]
                        },
                        "observed": {
                          "type": "string",
                          "enum": [
                            "creating",
                            "running",
                            "suspended",
                            "lost",
                            "failed",
                            "deleting"
                          ]
                        },
                        "volumeGeneration": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "hostEpoch": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "reason": {
                          "type": "string"
                        },
                        "imageDigest": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "desired",
                        "observed",
                        "volumeGeneration",
                        "hostEpoch"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "state"
                  ],
                  "additionalProperties": false
                },
                "runtime": {
                  "type": "object",
                  "properties": {
                    "image": {
                      "type": "string"
                    },
                    "resources": {
                      "type": "object",
                      "properties": {
                        "cpus": {
                          "type": "integer"
                        },
                        "memory": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "cpus",
                        "memory"
                      ],
                      "additionalProperties": false
                    },
                    "storage": {
                      "type": "string"
                    },
                    "network": {
                      "type": "object",
                      "properties": {
                        "allowedHosts": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "allowedHosts"
                      ],
                      "additionalProperties": false
                    },
                    "harness": {
                      "type": "string"
                    },
                    "lifecycle": {
                      "type": "object",
                      "properties": {
                        "idle": {
                          "type": "string"
                        },
                        "deleteAfter": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": false
                    },
                    "setup": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "command": {
                            "type": "string",
                            "minLength": 1
                          },
                          "cwd": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1024
                          },
                          "timeout": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "command"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "files": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "artifactId": {
                                "type": "string"
                              },
                              "version": {
                                "type": "integer",
                                "exclusiveMinimum": 0
                              },
                              "path": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1024
                              }
                            },
                            "required": [
                              "artifactId",
                              "version",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "path": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1024
                              },
                              "files": {
                                "type": "object",
                                "additionalProperties": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": [
                              "path",
                              "files"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "artifacts": {
                          "type": "object",
                          "properties": {
                            "fileBytes": {
                              "type": "integer",
                              "exclusiveMinimum": 0
                            },
                            "totalBytes": {
                              "type": "integer",
                              "exclusiveMinimum": 0
                            }
                          },
                          "additionalProperties": false
                        },
                        "skills": {
                          "type": "object",
                          "properties": {
                            "totalBytes": {
                              "type": "integer",
                              "exclusiveMinimum": 0
                            }
                          },
                          "additionalProperties": false
                        },
                        "disk": {
                          "type": "object",
                          "properties": {
                            "versionBytes": {
                              "type": "integer",
                              "exclusiveMinimum": 0
                            },
                            "versionEntries": {
                              "type": "integer",
                              "exclusiveMinimum": 0
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "additionalProperties": false
                    },
                    "secrets": {
                      "type": "object",
                      "additionalProperties": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "environment_secret"
                                ]
                              },
                              "allowedHosts": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "minItems": 1
                              },
                              "inject": {
                                "type": "object",
                                "properties": {
                                  "header": {
                                    "type": "string",
                                    "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                                  },
                                  "format": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "header",
                                  "format"
                                ],
                                "additionalProperties": false
                              },
                              "required": {
                                "type": "boolean"
                              },
                              "description": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type",
                              "allowedHosts"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "environment_variable"
                                ]
                              },
                              "required": {
                                "type": "boolean"
                              },
                              "description": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "bearer"
                                ]
                              },
                              "url": {
                                "type": "string",
                                "minLength": 1
                              },
                              "via": {
                                "type": "string"
                              },
                              "identity": {
                                "type": "object",
                                "properties": {
                                  "header": {
                                    "type": "string",
                                    "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                                  }
                                },
                                "required": [
                                  "header"
                                ],
                                "additionalProperties": false
                              },
                              "required": {
                                "type": "boolean"
                              },
                              "description": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type",
                              "url"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "headers"
                                ]
                              },
                              "url": {
                                "type": "string",
                                "minLength": 1
                              },
                              "via": {
                                "type": "string"
                              },
                              "identity": {
                                "type": "object",
                                "properties": {
                                  "header": {
                                    "type": "string",
                                    "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                                  }
                                },
                                "required": [
                                  "header"
                                ],
                                "additionalProperties": false
                              },
                              "required": {
                                "type": "boolean"
                              },
                              "description": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type",
                              "url"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    }
                  },
                  "required": [
                    "harness",
                    "lifecycle"
                  ],
                  "additionalProperties": false
                },
                "limits": {
                  "type": "object",
                  "properties": {
                    "artifacts": {
                      "type": "object",
                      "properties": {
                        "fileBytes": {
                          "type": "integer"
                        },
                        "totalBytes": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "fileBytes",
                        "totalBytes"
                      ],
                      "additionalProperties": false
                    },
                    "skills": {
                      "type": "object",
                      "properties": {
                        "totalBytes": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "totalBytes"
                      ],
                      "additionalProperties": false
                    },
                    "disk": {
                      "type": "object",
                      "properties": {
                        "versionBytes": {
                          "type": "integer"
                        },
                        "versionEntries": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "versionBytes",
                        "versionEntries"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "artifacts",
                    "skills",
                    "disk"
                  ],
                  "additionalProperties": false
                },
                "sessions": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "ownerUserId": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string"
                      },
                      "activeTurnId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "ownerUserId",
                      "status",
                      "activeTurnId"
                    ],
                    "additionalProperties": false
                  }
                },
                "slots": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "type": {
                        "type": "string"
                      },
                      "required": {
                        "type": "boolean"
                      },
                      "set": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "name",
                      "type",
                      "required",
                      "set"
                    ],
                    "additionalProperties": false
                  }
                },
                "disk": {
                  "type": "object",
                  "properties": {
                    "latestVersion": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "exclusiveMinimum": 0
                    },
                    "operation": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "snapshot",
                            "restore",
                            "seed"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "exclusiveMinimum": 0
                        },
                        "startedAt": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "startedAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "latestVersion",
                    "operation"
                  ],
                  "additionalProperties": false
                },
                "forkedFrom": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "agent": {
                      "type": "string"
                    },
                    "disk": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "exclusiveMinimum": 0
                    }
                  },
                  "required": [
                    "agent",
                    "disk"
                  ],
                  "additionalProperties": false
                },
                "lastUsedAt": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string"
                },
                "updatedAt": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "manifest",
                "resolvedVersion",
                "manifestHash",
                "tracking",
                "targetVersion",
                "waitingFor",
                "failedVersion",
                "startCheck",
                "kind",
                "harness",
                "owner",
                "labels",
                "state",
                "attention",
                "desired",
                "nextWakeAt",
                "compute",
                "runtime",
                "limits",
                "sessions",
                "slots",
                "forkedFrom",
                "lastUsedAt",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "environments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentView"
            }
          }
        },
        "required": [
          "agents",
          "nextCursor",
          "environments"
        ],
        "additionalProperties": false
      },
      "AgentView": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "manifest": {
            "type": "string"
          },
          "resolvedVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "manifestHash": {
            "type": "string"
          },
          "tracking": {
            "type": "string",
            "enum": [
              "tracking",
              "pinned"
            ]
          },
          "targetVersion": {
            "type": [
              "integer",
              "null"
            ],
            "exclusiveMinimum": 0
          },
          "waitingFor": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "secrets",
              "start",
              null
            ]
          },
          "failedVersion": {
            "type": [
              "integer",
              "null"
            ],
            "exclusiveMinimum": 0
          },
          "startCheck": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "from": {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              "startedAt": {
                "type": "string"
              }
            },
            "required": [
              "from",
              "startedAt"
            ],
            "additionalProperties": false
          },
          "kind": {
            "type": "string",
            "enum": [
              "virtual",
              "pod",
              "none"
            ]
          },
          "harness": {
            "type": "string"
          },
          "owner": {
            "type": [
              "string",
              "null"
            ]
          },
          "labels": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "state": {
            "type": "string",
            "description": "working, sleeping, input_required, failing or paused; an open set"
          },
          "attention": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "state": {
                  "type": "string",
                  "enum": [
                    "paused",
                    "failing",
                    "input_required",
                    "working",
                    "sleeping"
                  ]
                },
                "sessionId": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                }
              },
              "required": [
                "state",
                "reason"
              ],
              "additionalProperties": false
            }
          },
          "desired": {
            "type": "string",
            "enum": [
              "on",
              "off"
            ]
          },
          "nextWakeAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "compute": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "description": "ready, creating, running or stopped; an open set"
              },
              "pod": {
                "type": "object",
                "properties": {
                  "desired": {
                    "type": "string",
                    "enum": [
                      "running",
                      "suspended",
                      "deleted"
                    ]
                  },
                  "observed": {
                    "type": "string",
                    "enum": [
                      "creating",
                      "running",
                      "suspended",
                      "lost",
                      "failed",
                      "deleting"
                    ]
                  },
                  "volumeGeneration": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "hostEpoch": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "reason": {
                    "type": "string"
                  },
                  "imageDigest": {
                    "type": "string"
                  }
                },
                "required": [
                  "desired",
                  "observed",
                  "volumeGeneration",
                  "hostEpoch"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "state"
            ],
            "additionalProperties": false
          },
          "runtime": {
            "type": "object",
            "properties": {
              "image": {
                "type": "string"
              },
              "resources": {
                "type": "object",
                "properties": {
                  "cpus": {
                    "type": "integer"
                  },
                  "memory": {
                    "type": "string"
                  }
                },
                "required": [
                  "cpus",
                  "memory"
                ],
                "additionalProperties": false
              },
              "storage": {
                "type": "string"
              },
              "network": {
                "type": "object",
                "properties": {
                  "allowedHosts": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "allowedHosts"
                ],
                "additionalProperties": false
              },
              "harness": {
                "type": "string"
              },
              "lifecycle": {
                "type": "object",
                "properties": {
                  "idle": {
                    "type": "string"
                  },
                  "deleteAfter": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              },
              "setup": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "command": {
                      "type": "string",
                      "minLength": 1
                    },
                    "cwd": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1024
                    },
                    "timeout": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "command"
                  ],
                  "additionalProperties": false
                }
              },
              "files": {
                "type": "array",
                "items": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "artifactId": {
                          "type": "string"
                        },
                        "version": {
                          "type": "integer",
                          "exclusiveMinimum": 0
                        },
                        "path": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1024
                        }
                      },
                      "required": [
                        "artifactId",
                        "version",
                        "path"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "path": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1024
                        },
                        "files": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "path",
                        "files"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "limits": {
                "type": "object",
                "properties": {
                  "artifacts": {
                    "type": "object",
                    "properties": {
                      "fileBytes": {
                        "type": "integer",
                        "exclusiveMinimum": 0
                      },
                      "totalBytes": {
                        "type": "integer",
                        "exclusiveMinimum": 0
                      }
                    },
                    "additionalProperties": false
                  },
                  "skills": {
                    "type": "object",
                    "properties": {
                      "totalBytes": {
                        "type": "integer",
                        "exclusiveMinimum": 0
                      }
                    },
                    "additionalProperties": false
                  },
                  "disk": {
                    "type": "object",
                    "properties": {
                      "versionBytes": {
                        "type": "integer",
                        "exclusiveMinimum": 0
                      },
                      "versionEntries": {
                        "type": "integer",
                        "exclusiveMinimum": 0
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false
              },
              "secrets": {
                "type": "object",
                "additionalProperties": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "environment_secret"
                          ]
                        },
                        "allowedHosts": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "minItems": 1
                        },
                        "inject": {
                          "type": "object",
                          "properties": {
                            "header": {
                              "type": "string",
                              "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                            },
                            "format": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "header",
                            "format"
                          ],
                          "additionalProperties": false
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "description": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "type",
                        "allowedHosts"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "environment_variable"
                          ]
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "description": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "bearer"
                          ]
                        },
                        "url": {
                          "type": "string",
                          "minLength": 1
                        },
                        "via": {
                          "type": "string"
                        },
                        "identity": {
                          "type": "object",
                          "properties": {
                            "header": {
                              "type": "string",
                              "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                            }
                          },
                          "required": [
                            "header"
                          ],
                          "additionalProperties": false
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "description": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "type",
                        "url"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "headers"
                          ]
                        },
                        "url": {
                          "type": "string",
                          "minLength": 1
                        },
                        "via": {
                          "type": "string"
                        },
                        "identity": {
                          "type": "object",
                          "properties": {
                            "header": {
                              "type": "string",
                              "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                            }
                          },
                          "required": [
                            "header"
                          ],
                          "additionalProperties": false
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "description": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "type",
                        "url"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            },
            "required": [
              "harness",
              "lifecycle"
            ],
            "additionalProperties": false
          },
          "limits": {
            "type": "object",
            "properties": {
              "artifacts": {
                "type": "object",
                "properties": {
                  "fileBytes": {
                    "type": "integer"
                  },
                  "totalBytes": {
                    "type": "integer"
                  }
                },
                "required": [
                  "fileBytes",
                  "totalBytes"
                ],
                "additionalProperties": false
              },
              "skills": {
                "type": "object",
                "properties": {
                  "totalBytes": {
                    "type": "integer"
                  }
                },
                "required": [
                  "totalBytes"
                ],
                "additionalProperties": false
              },
              "disk": {
                "type": "object",
                "properties": {
                  "versionBytes": {
                    "type": "integer"
                  },
                  "versionEntries": {
                    "type": "integer"
                  }
                },
                "required": [
                  "versionBytes",
                  "versionEntries"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "artifacts",
              "skills",
              "disk"
            ],
            "additionalProperties": false
          },
          "sessions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "ownerUserId": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "activeTurnId": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "ownerUserId",
                "status",
                "activeTurnId"
              ],
              "additionalProperties": false
            }
          },
          "slots": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "required": {
                  "type": "boolean"
                },
                "set": {
                  "type": "boolean"
                }
              },
              "required": [
                "name",
                "type",
                "required",
                "set"
              ],
              "additionalProperties": false
            }
          },
          "disk": {
            "type": "object",
            "properties": {
              "latestVersion": {
                "type": [
                  "integer",
                  "null"
                ],
                "exclusiveMinimum": 0
              },
              "operation": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "snapshot",
                      "restore",
                      "seed"
                    ]
                  },
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0
                  },
                  "startedAt": {
                    "type": "string"
                  }
                },
                "required": [
                  "kind",
                  "startedAt"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "latestVersion",
              "operation"
            ],
            "additionalProperties": false
          },
          "forkedFrom": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "agent": {
                "type": "string"
              },
              "disk": {
                "type": [
                  "integer",
                  "null"
                ],
                "exclusiveMinimum": 0
              }
            },
            "required": [
              "agent",
              "disk"
            ],
            "additionalProperties": false
          },
          "lastUsedAt": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "manifest",
          "resolvedVersion",
          "manifestHash",
          "tracking",
          "targetVersion",
          "waitingFor",
          "failedVersion",
          "startCheck",
          "kind",
          "harness",
          "owner",
          "labels",
          "state",
          "attention",
          "desired",
          "nextWakeAt",
          "compute",
          "runtime",
          "limits",
          "sessions",
          "slots",
          "forkedFrom",
          "lastUsedAt",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "PutAgentDryRunResponse": {
        "type": "object",
        "properties": {
          "dryRun": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "plan": {
            "type": "object",
            "properties": {
              "agent": {
                "type": "string"
              },
              "manifest": {
                "type": "string"
              },
              "from": {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              "to": {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              "tracking": {
                "type": "string",
                "enum": [
                  "tracking",
                  "pinned"
                ]
              },
              "applies": {
                "type": "string",
                "enum": [
                  "none",
                  "now",
                  "next_start",
                  "secrets",
                  "refused"
                ]
              },
              "changes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "section": {
                      "type": "string",
                      "enum": [
                        "manifest",
                        "harness",
                        "runtime"
                      ]
                    },
                    "path": {
                      "type": "string"
                    },
                    "op": {
                      "type": "string",
                      "enum": [
                        "add",
                        "remove",
                        "replace"
                      ]
                    },
                    "from": {},
                    "to": {}
                  },
                  "required": [
                    "section",
                    "path",
                    "op"
                  ],
                  "additionalProperties": false
                }
              },
              "missingSecrets": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "dormantSecrets": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "refusals": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "field": {
                      "type": "string"
                    },
                    "from": {},
                    "to": {}
                  },
                  "required": [
                    "field"
                  ],
                  "additionalProperties": false
                }
              },
              "sessions": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "agent",
              "manifest",
              "from",
              "to",
              "tracking",
              "applies",
              "changes",
              "missingSecrets",
              "dormantSecrets",
              "refusals",
              "sessions"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "dryRun",
          "plan"
        ],
        "additionalProperties": false
      },
      "PutAgentRequest": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "minLength": 1
          },
          "manifest": {
            "type": "string",
            "description": "`name` (tracking) or `name@n` (pinned)"
          },
          "owner": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1
          },
          "labels": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "pattern": "^[\\x20-\\x7e]*$"
            }
          },
          "from": {
            "type": "object",
            "properties": {
              "agent": {
                "type": "string",
                "description": "An Agent id, such as `triage` or `users/alice/triage`"
              },
              "version": {
                "anyOf": [
                  {
                    "type": "integer",
                    "exclusiveMinimum": 0
                  },
                  {
                    "type": "string",
                    "enum": [
                      "latest"
                    ]
                  }
                ]
              }
            },
            "required": [
              "agent",
              "version"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "manifest"
        ],
        "additionalProperties": false
      },
      "ListAgentEventsResponse": {
        "type": "object",
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "nylorun.agent-event/1"
                  ]
                },
                "eventId": {
                  "type": "string"
                },
                "tenantId": {
                  "type": "string"
                },
                "agentId": {
                  "type": "string"
                },
                "seq": {
                  "type": "integer",
                  "minimum": 0
                },
                "time": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "agent.created",
                    "agent.attached",
                    "agent.detached",
                    "agent.deleted",
                    "agent.running",
                    "agent.suspended",
                    "agent.relaunched",
                    "agent.lost",
                    "agent.reset",
                    "agent.failed",
                    "agent.forked",
                    "agent.outdated",
                    "agent.version_changed",
                    "agent.start_failed",
                    "agent.egress",
                    "agent.run",
                    "agent.trigger_paused",
                    "agent.trigger_resumed",
                    "agent.trigger_secret_rotated",
                    "agent.memory_updated"
                  ]
                },
                "payload": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "required": [
                "schema",
                "eventId",
                "tenantId",
                "agentId",
                "seq",
                "time",
                "type",
                "payload"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "events"
        ],
        "additionalProperties": false
      },
      "DeleteAgentResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "deleted"
        ],
        "additionalProperties": false
      },
      "RestartAgentRequest": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "minLength": 1
          },
          "retry": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "AgentSnapshot": {
        "type": "object",
        "properties": {
          "agentId": {
            "type": "string"
          },
          "artifactId": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "format": {
            "type": "string"
          },
          "files": {
            "type": "integer",
            "minimum": 0
          },
          "bytes": {
            "type": "integer",
            "minimum": 0
          },
          "storedBytes": {
            "type": "integer",
            "minimum": 0
          },
          "durationMs": {
            "type": "integer",
            "minimum": 0
          },
          "unchanged": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": [
          "agentId",
          "artifactId",
          "version",
          "format",
          "files",
          "bytes",
          "storedBytes",
          "durationMs",
          "unchanged",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "AgentRestore": {
        "type": "object",
        "properties": {
          "agentId": {
            "type": "string"
          },
          "restored": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "status": {
            "type": "string",
            "enum": [
              "done",
              "pending"
            ]
          },
          "volumeGeneration": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "agentId",
          "restored",
          "status"
        ],
        "additionalProperties": false
      },
      "RestoreAgentRequest": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "minLength": 1
          },
          "version": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              {
                "type": "string",
                "enum": [
                  "latest"
                ]
              }
            ]
          }
        },
        "required": [
          "version"
        ],
        "additionalProperties": false
      },
      "ForkAgentResponse": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "dryRun": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "plan": {
                "type": "object",
                "properties": {
                  "source": {
                    "type": "string"
                  },
                  "id": {
                    "type": "string"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "virtual",
                      "pod",
                      "none"
                    ]
                  },
                  "manifest": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "version": {
                        "type": "integer",
                        "exclusiveMinimum": 0
                      }
                    },
                    "required": [
                      "name",
                      "version"
                    ],
                    "additionalProperties": false
                  },
                  "disk": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "exclusiveMinimum": 0
                      },
                      {
                        "type": "string",
                        "enum": [
                          "latest"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "setup": {
                    "type": "boolean"
                  },
                  "secrets": {
                    "type": "object",
                    "properties": {
                      "copied": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "dropped": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "missing": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "copied",
                      "dropped",
                      "missing"
                    ],
                    "additionalProperties": false
                  },
                  "changes": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "path": {
                          "type": "string"
                        },
                        "from": {},
                        "to": {}
                      },
                      "required": [
                        "path"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "sessions": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "memories": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "required": [
                  "source",
                  "id",
                  "kind",
                  "manifest",
                  "disk",
                  "setup",
                  "secrets",
                  "changes",
                  "sessions",
                  "memories"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "dryRun",
              "plan"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "agent": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "manifest": {
                    "type": "string"
                  },
                  "resolvedVersion": {
                    "type": "integer",
                    "exclusiveMinimum": 0
                  },
                  "manifestHash": {
                    "type": "string"
                  },
                  "tracking": {
                    "type": "string",
                    "enum": [
                      "tracking",
                      "pinned"
                    ]
                  },
                  "targetVersion": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "exclusiveMinimum": 0
                  },
                  "waitingFor": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "secrets",
                      "start",
                      null
                    ]
                  },
                  "failedVersion": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "exclusiveMinimum": 0
                  },
                  "startCheck": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "from": {
                        "type": "integer",
                        "exclusiveMinimum": 0
                      },
                      "startedAt": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "from",
                      "startedAt"
                    ],
                    "additionalProperties": false
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "virtual",
                      "pod",
                      "none"
                    ]
                  },
                  "harness": {
                    "type": "string"
                  },
                  "owner": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "labels": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string"
                    }
                  },
                  "state": {
                    "type": "string",
                    "description": "working, sleeping, input_required, failing or paused; an open set"
                  },
                  "attention": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "string",
                          "enum": [
                            "paused",
                            "failing",
                            "input_required",
                            "working",
                            "sleeping"
                          ]
                        },
                        "sessionId": {
                          "type": "string"
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "state",
                        "reason"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "desired": {
                    "type": "string",
                    "enum": [
                      "on",
                      "off"
                    ]
                  },
                  "nextWakeAt": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "compute": {
                    "type": "object",
                    "properties": {
                      "state": {
                        "type": "string",
                        "description": "ready, creating, running or stopped; an open set"
                      },
                      "pod": {
                        "type": "object",
                        "properties": {
                          "desired": {
                            "type": "string",
                            "enum": [
                              "running",
                              "suspended",
                              "deleted"
                            ]
                          },
                          "observed": {
                            "type": "string",
                            "enum": [
                              "creating",
                              "running",
                              "suspended",
                              "lost",
                              "failed",
                              "deleting"
                            ]
                          },
                          "volumeGeneration": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "hostEpoch": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "reason": {
                            "type": "string"
                          },
                          "imageDigest": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "desired",
                          "observed",
                          "volumeGeneration",
                          "hostEpoch"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "state"
                    ],
                    "additionalProperties": false
                  },
                  "runtime": {
                    "type": "object",
                    "properties": {
                      "image": {
                        "type": "string"
                      },
                      "resources": {
                        "type": "object",
                        "properties": {
                          "cpus": {
                            "type": "integer"
                          },
                          "memory": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "cpus",
                          "memory"
                        ],
                        "additionalProperties": false
                      },
                      "storage": {
                        "type": "string"
                      },
                      "network": {
                        "type": "object",
                        "properties": {
                          "allowedHosts": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "allowedHosts"
                        ],
                        "additionalProperties": false
                      },
                      "harness": {
                        "type": "string"
                      },
                      "lifecycle": {
                        "type": "object",
                        "properties": {
                          "idle": {
                            "type": "string"
                          },
                          "deleteAfter": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": false
                      },
                      "setup": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "command": {
                              "type": "string",
                              "minLength": 1
                            },
                            "cwd": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 1024
                            },
                            "timeout": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "command"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "files": {
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "artifactId": {
                                  "type": "string"
                                },
                                "version": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0
                                },
                                "path": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 1024
                                }
                              },
                              "required": [
                                "artifactId",
                                "version",
                                "path"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "path": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 1024
                                },
                                "files": {
                                  "type": "object",
                                  "additionalProperties": {
                                    "type": "string"
                                  }
                                }
                              },
                              "required": [
                                "path",
                                "files"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "limits": {
                        "type": "object",
                        "properties": {
                          "artifacts": {
                            "type": "object",
                            "properties": {
                              "fileBytes": {
                                "type": "integer",
                                "exclusiveMinimum": 0
                              },
                              "totalBytes": {
                                "type": "integer",
                                "exclusiveMinimum": 0
                              }
                            },
                            "additionalProperties": false
                          },
                          "skills": {
                            "type": "object",
                            "properties": {
                              "totalBytes": {
                                "type": "integer",
                                "exclusiveMinimum": 0
                              }
                            },
                            "additionalProperties": false
                          },
                          "disk": {
                            "type": "object",
                            "properties": {
                              "versionBytes": {
                                "type": "integer",
                                "exclusiveMinimum": 0
                              },
                              "versionEntries": {
                                "type": "integer",
                                "exclusiveMinimum": 0
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "additionalProperties": false
                      },
                      "secrets": {
                        "type": "object",
                        "additionalProperties": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "environment_secret"
                                  ]
                                },
                                "allowedHosts": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  },
                                  "minItems": 1
                                },
                                "inject": {
                                  "type": "object",
                                  "properties": {
                                    "header": {
                                      "type": "string",
                                      "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                                    },
                                    "format": {
                                      "type": "string",
                                      "minLength": 1
                                    }
                                  },
                                  "required": [
                                    "header",
                                    "format"
                                  ],
                                  "additionalProperties": false
                                },
                                "required": {
                                  "type": "boolean"
                                },
                                "description": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "type",
                                "allowedHosts"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "environment_variable"
                                  ]
                                },
                                "required": {
                                  "type": "boolean"
                                },
                                "description": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "type"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "bearer"
                                  ]
                                },
                                "url": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "via": {
                                  "type": "string"
                                },
                                "identity": {
                                  "type": "object",
                                  "properties": {
                                    "header": {
                                      "type": "string",
                                      "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                                    }
                                  },
                                  "required": [
                                    "header"
                                  ],
                                  "additionalProperties": false
                                },
                                "required": {
                                  "type": "boolean"
                                },
                                "description": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "type",
                                "url"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "headers"
                                  ]
                                },
                                "url": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "via": {
                                  "type": "string"
                                },
                                "identity": {
                                  "type": "object",
                                  "properties": {
                                    "header": {
                                      "type": "string",
                                      "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                                    }
                                  },
                                  "required": [
                                    "header"
                                  ],
                                  "additionalProperties": false
                                },
                                "required": {
                                  "type": "boolean"
                                },
                                "description": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "type",
                                "url"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      }
                    },
                    "required": [
                      "harness",
                      "lifecycle"
                    ],
                    "additionalProperties": false
                  },
                  "limits": {
                    "type": "object",
                    "properties": {
                      "artifacts": {
                        "type": "object",
                        "properties": {
                          "fileBytes": {
                            "type": "integer"
                          },
                          "totalBytes": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "fileBytes",
                          "totalBytes"
                        ],
                        "additionalProperties": false
                      },
                      "skills": {
                        "type": "object",
                        "properties": {
                          "totalBytes": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "totalBytes"
                        ],
                        "additionalProperties": false
                      },
                      "disk": {
                        "type": "object",
                        "properties": {
                          "versionBytes": {
                            "type": "integer"
                          },
                          "versionEntries": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "versionBytes",
                          "versionEntries"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "artifacts",
                      "skills",
                      "disk"
                    ],
                    "additionalProperties": false
                  },
                  "sessions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "ownerUserId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "activeTurnId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "ownerUserId",
                        "status",
                        "activeTurnId"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "slots": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "set": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "name",
                        "type",
                        "required",
                        "set"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "disk": {
                    "type": "object",
                    "properties": {
                      "latestVersion": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "exclusiveMinimum": 0
                      },
                      "operation": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "snapshot",
                              "restore",
                              "seed"
                            ]
                          },
                          "version": {
                            "type": "integer",
                            "exclusiveMinimum": 0
                          },
                          "startedAt": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "kind",
                          "startedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "latestVersion",
                      "operation"
                    ],
                    "additionalProperties": false
                  },
                  "forkedFrom": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "agent": {
                        "type": "string"
                      },
                      "disk": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "exclusiveMinimum": 0
                      }
                    },
                    "required": [
                      "agent",
                      "disk"
                    ],
                    "additionalProperties": false
                  },
                  "lastUsedAt": {
                    "type": "string"
                  },
                  "createdAt": {
                    "type": "string"
                  },
                  "updatedAt": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "manifest",
                  "resolvedVersion",
                  "manifestHash",
                  "tracking",
                  "targetVersion",
                  "waitingFor",
                  "failedVersion",
                  "startCheck",
                  "kind",
                  "harness",
                  "owner",
                  "labels",
                  "state",
                  "attention",
                  "desired",
                  "nextWakeAt",
                  "compute",
                  "runtime",
                  "limits",
                  "sessions",
                  "slots",
                  "forkedFrom",
                  "lastUsedAt",
                  "createdAt",
                  "updatedAt"
                ],
                "additionalProperties": false
              },
              "plan": {
                "type": "object",
                "properties": {
                  "source": {
                    "type": "string"
                  },
                  "id": {
                    "type": "string"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "virtual",
                      "pod",
                      "none"
                    ]
                  },
                  "manifest": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "version": {
                        "type": "integer",
                        "exclusiveMinimum": 0
                      }
                    },
                    "required": [
                      "name",
                      "version"
                    ],
                    "additionalProperties": false
                  },
                  "disk": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "exclusiveMinimum": 0
                      },
                      {
                        "type": "string",
                        "enum": [
                          "latest"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "setup": {
                    "type": "boolean"
                  },
                  "secrets": {
                    "type": "object",
                    "properties": {
                      "copied": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "dropped": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "missing": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "copied",
                      "dropped",
                      "missing"
                    ],
                    "additionalProperties": false
                  },
                  "changes": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "path": {
                          "type": "string"
                        },
                        "from": {},
                        "to": {}
                      },
                      "required": [
                        "path"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "sessions": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "memories": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "required": [
                  "source",
                  "id",
                  "kind",
                  "manifest",
                  "disk",
                  "setup",
                  "secrets",
                  "changes",
                  "sessions",
                  "memories"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "agent",
              "plan"
            ],
            "additionalProperties": false
          }
        ]
      },
      "ForkAgentRequest": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "minLength": 1
          },
          "id": {
            "type": "string",
            "description": "An Agent id, such as `triage` or `users/alice/triage`"
          },
          "manifest": {
            "type": "string",
            "description": "`name` (tracking) or `name@n` (pinned)"
          },
          "disk": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "latest"
                ]
              },
              {
                "type": "string",
                "enum": [
                  "empty"
                ]
              },
              {
                "type": "integer",
                "exclusiveMinimum": 0
              }
            ]
          },
          "secrets": {
            "type": "string",
            "enum": [
              "copy",
              "none"
            ]
          },
          "labels": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "pattern": "^[\\x20-\\x7e]*$"
            }
          },
          "owner": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1
          },
          "dryRun": {
            "type": "boolean"
          }
        },
        "required": [
          "id"
        ],
        "additionalProperties": false
      },
      "AgentDiskVersions": {
        "type": "object",
        "properties": {
          "agentId": {
            "type": "string"
          },
          "artifactId": {
            "type": [
              "string",
              "null"
            ]
          },
          "latest": {
            "type": [
              "integer",
              "null"
            ],
            "exclusiveMinimum": 0
          },
          "versions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "version": {
                  "type": "integer",
                  "exclusiveMinimum": 0
                },
                "bytes": {
                  "type": "integer",
                  "minimum": 0
                },
                "createdAt": {
                  "type": "string"
                }
              },
              "required": [
                "version",
                "bytes",
                "createdAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "agentId",
          "artifactId",
          "latest",
          "versions"
        ],
        "additionalProperties": false
      },
      "ListAgentSecretsResponse": {
        "type": "object",
        "properties": {
          "secrets": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "bearer",
                    "headers",
                    "workload",
                    "environment_secret",
                    "environment_variable"
                  ]
                },
                "binding": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "allowedHosts": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "inject": {
                      "type": "object",
                      "properties": {
                        "header": {
                          "type": "string",
                          "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                        },
                        "format": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "header",
                        "format"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                },
                "headerNames": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "via": {
                  "type": "string"
                },
                "toolPrefix": {
                  "type": "string"
                },
                "identity": {
                  "type": "object",
                  "properties": {
                    "header": {
                      "type": "string",
                      "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                    }
                  },
                  "required": [
                    "header"
                  ],
                  "additionalProperties": false
                },
                "createdAt": {
                  "type": "string"
                },
                "rotatedAt": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "type",
                "binding",
                "createdAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "secrets"
        ],
        "additionalProperties": false
      },
      "AgentSecretView": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "bearer",
              "headers",
              "workload",
              "environment_secret",
              "environment_variable"
            ]
          },
          "binding": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              },
              "allowedHosts": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "inject": {
                "type": "object",
                "properties": {
                  "header": {
                    "type": "string",
                    "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                  },
                  "format": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "header",
                  "format"
                ],
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          },
          "headerNames": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "via": {
            "type": "string"
          },
          "toolPrefix": {
            "type": "string"
          },
          "identity": {
            "type": "object",
            "properties": {
              "header": {
                "type": "string",
                "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
              }
            },
            "required": [
              "header"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string"
          },
          "rotatedAt": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "type",
          "binding",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "PutAgentSecretValueRequest": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "minLength": 1
          },
          "value": {
            "type": "string",
            "minLength": 1
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "minLength": 1
            }
          },
          "toolPrefix": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[\\x21-\\x7e]+$"
          }
        },
        "additionalProperties": false
      },
      "DeletedResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "additionalProperties": false
      },
      "TriggerList": {
        "type": "object",
        "properties": {
          "triggers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "schedule",
                    "at",
                    "webhook",
                    "wake"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "active",
                    "paused",
                    "completed"
                  ]
                },
                "pausedReason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "schedule": {
                  "type": "string"
                },
                "timezone": {
                  "type": "string"
                },
                "at": {
                  "type": "string"
                },
                "session": {
                  "type": "string"
                },
                "nextRunAt": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "lastRunAt": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "webhookUrl": {
                  "type": "string"
                },
                "secretSet": {
                  "type": "boolean"
                }
              },
              "required": [
                "id",
                "kind",
                "status",
                "pausedReason",
                "session",
                "nextRunAt",
                "lastRunAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "triggers"
        ],
        "additionalProperties": false
      },
      "RunTriggerResponse": {
        "type": "object",
        "properties": {
          "run": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "triggerId": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "schedule",
                  "at",
                  "webhook",
                  "wake"
                ]
              },
              "dueAt": {
                "type": "string"
              },
              "firedAt": {
                "type": "string"
              },
              "late": {
                "type": "boolean"
              },
              "status": {
                "type": "string",
                "enum": [
                  "started",
                  "queued",
                  "skipped",
                  "failed"
                ]
              },
              "reason": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sessionId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "turnId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "queuedMessageId": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "triggerId",
              "kind",
              "dueAt",
              "firedAt",
              "late",
              "status",
              "reason",
              "sessionId",
              "turnId",
              "queuedMessageId"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "run"
        ],
        "additionalProperties": false
      },
      "TriggerRunPage": {
        "type": "object",
        "properties": {
          "runs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "triggerId": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "schedule",
                    "at",
                    "webhook",
                    "wake"
                  ]
                },
                "dueAt": {
                  "type": "string"
                },
                "firedAt": {
                  "type": "string"
                },
                "late": {
                  "type": "boolean"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "started",
                    "queued",
                    "skipped",
                    "failed"
                  ]
                },
                "reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "sessionId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "turnId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "queuedMessageId": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "triggerId",
                "kind",
                "dueAt",
                "firedAt",
                "late",
                "status",
                "reason",
                "sessionId",
                "turnId",
                "queuedMessageId"
              ],
              "additionalProperties": false
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "runs",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "MemoryList": {
        "type": "object",
        "properties": {
          "memories": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "bytes": {
                  "type": "integer",
                  "minimum": 0
                },
                "contentSha256": {
                  "type": "string"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "version": {
                  "type": "integer",
                  "exclusiveMinimum": 0
                },
                "updatedAt": {
                  "type": "string"
                }
              },
              "required": [
                "path",
                "bytes",
                "contentSha256",
                "description",
                "version",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "memories",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "Memory": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "bytes": {
            "type": "integer",
            "minimum": 0
          },
          "contentSha256": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "updatedAt": {
            "type": "string"
          },
          "content": {
            "type": "string"
          }
        },
        "required": [
          "path",
          "bytes",
          "contentSha256",
          "description",
          "version",
          "updatedAt",
          "content"
        ],
        "additionalProperties": false
      },
      "PutMemoryRequest": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string"
          },
          "contentSha256": {
            "type": "string"
          }
        },
        "required": [
          "content"
        ],
        "additionalProperties": false
      },
      "MemoryVersionPage": {
        "type": "object",
        "properties": {
          "versions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "fromPath": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "operation": {
                  "type": "string",
                  "enum": [
                    "create",
                    "str_replace",
                    "insert",
                    "delete",
                    "rename"
                  ]
                },
                "bytes": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "minimum": 0
                },
                "contentSha256": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "actor": {
                  "type": "string"
                },
                "sessionId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "turnId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "triggerRunId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "path",
                "fromPath",
                "operation",
                "bytes",
                "contentSha256",
                "actor",
                "sessionId",
                "turnId",
                "triggerRunId",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "versions",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "MemoryVersionDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "fromPath": {
            "type": [
              "string",
              "null"
            ]
          },
          "operation": {
            "type": "string",
            "enum": [
              "create",
              "str_replace",
              "insert",
              "delete",
              "rename"
            ]
          },
          "bytes": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "contentSha256": {
            "type": [
              "string",
              "null"
            ]
          },
          "actor": {
            "type": "string"
          },
          "sessionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "triggerRunId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "content": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "path",
          "fromPath",
          "operation",
          "bytes",
          "contentSha256",
          "actor",
          "sessionId",
          "turnId",
          "triggerRunId",
          "createdAt",
          "content"
        ],
        "additionalProperties": false
      },
      "WebhookSecretResponse": {
        "type": "object",
        "properties": {
          "triggerId": {
            "type": "string"
          },
          "webhookUrl": {
            "type": "string"
          },
          "secret": {
            "type": "string"
          }
        },
        "required": [
          "triggerId",
          "webhookUrl",
          "secret"
        ],
        "additionalProperties": false
      },
      "WebhookAcceptedResponse": {
        "type": "object",
        "properties": {
          "runId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "started",
              "queued",
              "skipped",
              "failed"
            ]
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "runId",
          "status",
          "reason"
        ],
        "additionalProperties": false
      },
      "ListAgentManifestsResponse": {
        "type": "object",
        "properties": {
          "manifests": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "version": {
                  "type": "integer",
                  "exclusiveMinimum": 0
                },
                "hash": {
                  "type": "string"
                },
                "manifest": {
                  "$ref": "#/components/schemas/AgentManifestV8"
                },
                "savedBy": {
                  "type": "object",
                  "properties": {
                    "actor": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "actor"
                  ],
                  "additionalProperties": false
                },
                "createdAt": {
                  "type": "string"
                },
                "agents": {
                  "type": "integer",
                  "minimum": 0
                },
                "source": {
                  "type": "object",
                  "properties": {
                    "compiler": {
                      "type": "string"
                    },
                    "files": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "bytes": {
                      "type": "integer",
                      "minimum": 0
                    }
                  },
                  "required": [
                    "compiler",
                    "files",
                    "bytes"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "name",
                "version",
                "hash",
                "manifest",
                "savedBy",
                "createdAt",
                "agents"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "manifests"
        ],
        "additionalProperties": false
      },
      "AgentManifestV8": {
        "type": "object",
        "properties": {
          "manifestSchemaVersion": {
            "type": "number",
            "enum": [
              8
            ]
          },
          "name": {
            "type": "string",
            "description": "An agent manifest's name, such as `triage`"
          },
          "description": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {}
          },
          "harness": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WorkflowHarnessSection"
              },
              {
                "$ref": "#/components/schemas/AgentHarnessSection"
              }
            ]
          },
          "runtime": {
            "$ref": "#/components/schemas/RuntimeSection"
          }
        },
        "required": [
          "manifestSchemaVersion",
          "name",
          "harness"
        ],
        "additionalProperties": false
      },
      "WorkflowHarnessSection": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "workflow"
            ]
          },
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{1,62}$",
            "description": "The harness that runs the loop: `nylorun` (ours, the default) or a custom harness's id"
          },
          "inputSchema": {
            "type": "object",
            "additionalProperties": {}
          },
          "outputSchema": {
            "type": "object",
            "additionalProperties": {}
          },
          "root": {
            "$ref": "#/components/schemas/WorkflowNode"
          },
          "agents": {
            "type": "object",
            "additionalProperties": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/WorkflowManifest"
                },
                {
                  "type": "object",
                  "properties": {
                    "manifestSchemaVersion": {
                      "type": "number",
                      "enum": [
                        7
                      ]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "description": {
                      "type": "string"
                    },
                    "metadata": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "outputSchema": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "instructions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "tools": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{1,64}$"
                          },
                          "description": {
                            "type": "string"
                          },
                          "inputSchema": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "outputSchema": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "agent": {
                            "$ref": "#/components/schemas/ToolAgentManifest"
                          },
                          "http": {
                            "type": "object",
                            "properties": {
                              "url": {
                                "type": "string"
                              },
                              "method": {
                                "type": "string",
                                "enum": [
                                  "GET",
                                  "POST",
                                  "PUT",
                                  "PATCH",
                                  "DELETE"
                                ]
                              },
                              "credential": {
                                "type": "string",
                                "minLength": 1
                              },
                              "timeoutMs": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 2147483647
                              }
                            },
                            "required": [
                              "url"
                            ],
                            "additionalProperties": false
                          },
                          "approval": {
                            "type": "string",
                            "enum": [
                              "never",
                              "always"
                            ]
                          },
                          "fn": {
                            "description": "Reserved for a later kind of tool; refused for now."
                          },
                          "command": {
                            "description": "Reserved for a later kind of tool; refused for now."
                          }
                        },
                        "required": [
                          "name",
                          "inputSchema"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "skills": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1
                          },
                          "description": {
                            "type": "string",
                            "minLength": 1
                          },
                          "files": {
                            "type": "object",
                            "additionalProperties": {
                              "type": "string"
                            }
                          },
                          "plugin": {
                            "$ref": "#/components/schemas/PluginLabel"
                          }
                        },
                        "required": [
                          "name",
                          "description",
                          "files"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "mcpServers": {
                      "type": "object",
                      "additionalProperties": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9_-]{1,64}$"
                              },
                              "type": {
                                "type": "string",
                                "enum": [
                                  "streamable-http"
                                ]
                              },
                              "url": {
                                "type": "string",
                                "minLength": 1
                              },
                              "headers": {
                                "type": "object",
                                "additionalProperties": {
                                  "type": "string"
                                }
                              },
                              "approval": {
                                "type": "string",
                                "enum": [
                                  "never",
                                  "always"
                                ]
                              },
                              "deferred": {
                                "type": "boolean"
                              },
                              "tools": {
                                "type": "object",
                                "additionalProperties": {
                                  "$ref": "#/components/schemas/McpToolSettings"
                                }
                              },
                              "plugin": {
                                "$ref": "#/components/schemas/PluginLabel"
                              }
                            },
                            "required": [
                              "name",
                              "type",
                              "url"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9_-]{1,64}$"
                              },
                              "type": {
                                "type": "string",
                                "enum": [
                                  "sse"
                                ]
                              },
                              "url": {
                                "type": "string",
                                "minLength": 1
                              },
                              "headers": {
                                "type": "object",
                                "additionalProperties": {
                                  "type": "string"
                                }
                              },
                              "approval": {
                                "type": "string",
                                "enum": [
                                  "never",
                                  "always"
                                ]
                              },
                              "deferred": {
                                "type": "boolean"
                              },
                              "tools": {
                                "type": "object",
                                "additionalProperties": {
                                  "$ref": "#/components/schemas/McpToolSettings"
                                }
                              },
                              "plugin": {
                                "$ref": "#/components/schemas/PluginLabel"
                              }
                            },
                            "required": [
                              "name",
                              "type",
                              "url"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "requires": {
                      "type": "object",
                      "properties": {
                        "sandbox": {
                          "type": "string",
                          "enum": [
                            "none",
                            "any",
                            "pod"
                          ]
                        },
                        "secrets": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                          }
                        }
                      },
                      "additionalProperties": false
                    },
                    "functions": {
                      "description": "Reserved: Functions are not available yet"
                    }
                  },
                  "required": [
                    "manifestSchemaVersion",
                    "id"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "plugins": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PluginLabel"
            }
          },
          "loop": {
            "type": "object",
            "additionalProperties": {},
            "description": "The harness's own settings, passed to it in turn.start; the Runtime never reads them"
          }
        },
        "required": [
          "kind",
          "root",
          "agents"
        ],
        "additionalProperties": false
      },
      "AgentHarnessSection": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{1,62}$",
            "description": "The harness that runs the loop: `nylorun` (ours, the default) or a custom harness's id"
          },
          "instructions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9_-]{1,64}$"
                },
                "description": {
                  "type": "string"
                },
                "inputSchema": {
                  "type": "object",
                  "additionalProperties": {}
                },
                "outputSchema": {
                  "type": "object",
                  "additionalProperties": {}
                },
                "agent": {
                  "$ref": "#/components/schemas/ToolAgentManifest"
                },
                "http": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "method": {
                      "type": "string",
                      "enum": [
                        "GET",
                        "POST",
                        "PUT",
                        "PATCH",
                        "DELETE"
                      ]
                    },
                    "credential": {
                      "type": "string",
                      "minLength": 1
                    },
                    "timeoutMs": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 2147483647
                    }
                  },
                  "required": [
                    "url"
                  ],
                  "additionalProperties": false
                },
                "approval": {
                  "type": "string",
                  "enum": [
                    "never",
                    "always"
                  ]
                },
                "fn": {
                  "description": "Reserved for a later kind of tool; refused for now."
                },
                "command": {
                  "description": "Reserved for a later kind of tool; refused for now."
                }
              },
              "required": [
                "name",
                "inputSchema"
              ],
              "additionalProperties": false
            }
          },
          "skills": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "description": {
                  "type": "string",
                  "minLength": 1
                },
                "files": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                },
                "plugin": {
                  "$ref": "#/components/schemas/PluginLabel"
                },
                "secrets": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                  }
                }
              },
              "required": [
                "name",
                "description",
                "files"
              ],
              "additionalProperties": false
            }
          },
          "mcpServers": {
            "type": "object",
            "additionalProperties": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "streamable-http"
                      ]
                    },
                    "name": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "url": {
                      "type": "string",
                      "minLength": 1
                    },
                    "headers": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "credential": {
                      "type": "string",
                      "minLength": 1
                    },
                    "deferred": {
                      "type": "boolean"
                    },
                    "tools": {
                      "type": "object",
                      "additionalProperties": {
                        "$ref": "#/components/schemas/McpToolSettings"
                      }
                    },
                    "plugin": {
                      "$ref": "#/components/schemas/PluginLabel"
                    }
                  },
                  "required": [
                    "type",
                    "name",
                    "url"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "sse"
                      ]
                    },
                    "name": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "url": {
                      "type": "string",
                      "minLength": 1
                    },
                    "headers": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "credential": {
                      "type": "string",
                      "minLength": 1
                    },
                    "deferred": {
                      "type": "boolean"
                    },
                    "tools": {
                      "type": "object",
                      "additionalProperties": {
                        "$ref": "#/components/schemas/McpToolSettings"
                      }
                    },
                    "plugin": {
                      "$ref": "#/components/schemas/PluginLabel"
                    }
                  },
                  "required": [
                    "type",
                    "name",
                    "url"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "plugins": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PluginLabel"
            }
          },
          "outputSchema": {
            "type": "object",
            "additionalProperties": {}
          },
          "loop": {
            "type": "object",
            "additionalProperties": {},
            "description": "The harness's own settings, passed to it in turn.start; the Runtime never reads them"
          },
          "memory": {
            "type": "object",
            "properties": {
              "access": {
                "type": "string",
                "enum": [
                  "read_write",
                  "read_only"
                ],
                "description": "`read_write` (the default) or `read_only`"
              },
              "instructions": {
                "type": "string",
                "maxLength": 4096,
                "description": "What this agent should remember, after the engine's own memory rules"
              }
            },
            "additionalProperties": false,
            "description": "The Agent's memory: Markdown files under /memories it keeps across sessions"
          },
          "functions": {
            "description": "Reserved: Functions are not available yet"
          }
        },
        "additionalProperties": false
      },
      "RuntimeSection": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "virtual",
              "pod",
              "none"
            ]
          },
          "image": {
            "type": "string",
            "minLength": 1
          },
          "resources": {
            "type": "object",
            "properties": {
              "cpus": {
                "type": "integer",
                "minimum": 1
              },
              "memory": {
                "type": "string"
              }
            },
            "additionalProperties": false
          },
          "storage": {
            "type": "string"
          },
          "network": {
            "type": "object",
            "properties": {
              "allowedHosts": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "additionalProperties": false
          },
          "lifecycle": {
            "type": "object",
            "properties": {
              "idle": {
                "type": "string"
              },
              "deleteAfter": {
                "type": "string"
              }
            },
            "additionalProperties": false
          },
          "setup": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "command": {
                  "type": "string",
                  "minLength": 1
                },
                "cwd": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1024
                },
                "timeout": {
                  "type": "string"
                }
              },
              "required": [
                "command"
              ],
              "additionalProperties": false
            }
          },
          "files": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "artifactId": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer",
                      "exclusiveMinimum": 0
                    },
                    "path": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1024
                    }
                  },
                  "required": [
                    "artifactId",
                    "version",
                    "path"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "path": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1024
                    },
                    "files": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "path",
                    "files"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "limits": {
            "type": "object",
            "properties": {
              "artifacts": {
                "type": "object",
                "properties": {
                  "fileBytes": {
                    "type": "integer",
                    "exclusiveMinimum": 0
                  },
                  "totalBytes": {
                    "type": "integer",
                    "exclusiveMinimum": 0
                  }
                },
                "additionalProperties": false
              },
              "skills": {
                "type": "object",
                "properties": {
                  "totalBytes": {
                    "type": "integer",
                    "exclusiveMinimum": 0
                  }
                },
                "additionalProperties": false
              },
              "disk": {
                "type": "object",
                "properties": {
                  "versionBytes": {
                    "type": "integer",
                    "exclusiveMinimum": 0
                  },
                  "versionEntries": {
                    "type": "integer",
                    "exclusiveMinimum": 0
                  }
                },
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          },
          "secrets": {
            "type": "object",
            "additionalProperties": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "environment_secret"
                      ]
                    },
                    "allowedHosts": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "minItems": 1
                    },
                    "inject": {
                      "type": "object",
                      "properties": {
                        "header": {
                          "type": "string",
                          "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                        },
                        "format": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "header",
                        "format"
                      ],
                      "additionalProperties": false
                    },
                    "required": {
                      "type": "boolean"
                    },
                    "description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "allowedHosts"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "environment_variable"
                      ]
                    },
                    "required": {
                      "type": "boolean"
                    },
                    "description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "bearer"
                      ]
                    },
                    "url": {
                      "type": "string",
                      "minLength": 1
                    },
                    "via": {
                      "type": "string"
                    },
                    "identity": {
                      "type": "object",
                      "properties": {
                        "header": {
                          "type": "string",
                          "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                        }
                      },
                      "required": [
                        "header"
                      ],
                      "additionalProperties": false
                    },
                    "required": {
                      "type": "boolean"
                    },
                    "description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "url"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "headers"
                      ]
                    },
                    "url": {
                      "type": "string",
                      "minLength": 1
                    },
                    "via": {
                      "type": "string"
                    },
                    "identity": {
                      "type": "object",
                      "properties": {
                        "header": {
                          "type": "string",
                          "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                        }
                      },
                      "required": [
                        "header"
                      ],
                      "additionalProperties": false
                    },
                    "required": {
                      "type": "boolean"
                    },
                    "description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "url"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "triggers": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/Trigger"
            },
            "description": "What starts the Agent's turns with no client connected, by trigger id"
          },
          "selfWake": {
            "type": "boolean",
            "description": "Offer the agent schedule_wake: it books its session's next turn itself"
          }
        },
        "required": [
          "kind"
        ],
        "additionalProperties": false
      },
      "Trigger": {
        "type": "object",
        "properties": {
          "schedule": {
            "type": "string",
            "pattern": "^\\S+(\\s+\\S+){4}$"
          },
          "timezone": {
            "type": "string",
            "minLength": 1
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "webhook": {
            "type": "string",
            "enum": [
              "standard-webhooks"
            ]
          },
          "session": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "prompt": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "session",
          "prompt"
        ],
        "additionalProperties": false
      },
      "SaveAgentManifestResponse": {
        "type": "object",
        "properties": {
          "manifest": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "version": {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              "hash": {
                "type": "string"
              },
              "manifest": {
                "$ref": "#/components/schemas/AgentManifestV8"
              },
              "savedBy": {
                "type": "object",
                "properties": {
                  "actor": {
                    "type": "string"
                  }
                },
                "required": [
                  "actor"
                ],
                "additionalProperties": false
              },
              "createdAt": {
                "type": "string"
              },
              "agents": {
                "type": "integer",
                "minimum": 0
              },
              "source": {
                "type": "object",
                "properties": {
                  "compiler": {
                    "type": "string"
                  },
                  "files": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "bytes": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "required": [
                  "compiler",
                  "files",
                  "bytes"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "name",
              "version",
              "hash",
              "manifest",
              "savedBy",
              "createdAt",
              "agents"
            ],
            "additionalProperties": false
          },
          "unchanged": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "message"
              ],
              "additionalProperties": false
            }
          },
          "diagnostics": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentFolderDiagnostic"
            }
          }
        },
        "required": [
          "manifest",
          "unchanged",
          "warnings"
        ],
        "additionalProperties": false
      },
      "AgentFolderDiagnostic": {
        "type": "object",
        "properties": {
          "severity": {
            "type": "string",
            "enum": [
              "error",
              "warning",
              "info",
              "note"
            ]
          },
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "file": {
            "type": "string"
          },
          "line": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "column": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "pointer": {
            "type": "string"
          },
          "fix": {
            "$ref": "#/components/schemas/AgentFolderFix"
          }
        },
        "required": [
          "severity",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "AgentFolderFix": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "rename_key"
                ]
              },
              "file": {
                "type": "string"
              },
              "line": {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              "column": {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              "from": {
                "type": "string"
              },
              "to": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "file",
              "line",
              "column",
              "from",
              "to"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "crlf"
                ]
              },
              "file": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "file"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "move_skill_secrets"
                ]
              },
              "file": {
                "type": "string"
              },
              "skill": {
                "type": "string"
              },
              "secrets": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "kind",
              "file",
              "skill",
              "secrets"
            ],
            "additionalProperties": false
          }
        ]
      },
      "AgentManifestPlan": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "from": {
            "type": [
              "integer",
              "null"
            ],
            "exclusiveMinimum": 0
          },
          "to": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "unchanged": {
            "type": "boolean"
          },
          "changes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "section": {
                  "type": "string",
                  "enum": [
                    "manifest",
                    "harness",
                    "runtime"
                  ]
                },
                "path": {
                  "type": "string"
                },
                "op": {
                  "type": "string",
                  "enum": [
                    "add",
                    "remove",
                    "replace"
                  ]
                },
                "from": {},
                "to": {}
              },
              "required": [
                "section",
                "path",
                "op"
              ],
              "additionalProperties": false
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "message"
              ],
              "additionalProperties": false
            }
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "behind": {
            "type": "integer",
            "minimum": 0
          },
          "moves": {
            "type": "object",
            "properties": {
              "now": {
                "type": "integer",
                "minimum": 0
              },
              "nextStart": {
                "type": "integer",
                "minimum": 0
              },
              "secrets": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "now",
              "nextStart",
              "secrets"
            ],
            "additionalProperties": false
          },
          "manifest": {
            "$ref": "#/components/schemas/AgentManifestV8"
          },
          "diagnostics": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentFolderDiagnostic"
            }
          },
          "compiler": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "from",
          "to",
          "unchanged",
          "changes",
          "warnings",
          "errors",
          "behind",
          "moves"
        ],
        "additionalProperties": false
      },
      "PutAgentManifestRequest": {
        "type": "object",
        "properties": {
          "manifestSchemaVersion": {
            "type": "number",
            "enum": [
              8
            ]
          },
          "name": {
            "type": "string",
            "description": "An agent manifest's name, such as `triage`"
          },
          "description": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {}
          },
          "harness": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WorkflowHarnessSection"
              },
              {
                "$ref": "#/components/schemas/AgentHarnessSection"
              }
            ]
          },
          "runtime": {
            "$ref": "#/components/schemas/RuntimeSection"
          },
          "requestId": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "manifestSchemaVersion",
          "name",
          "harness"
        ],
        "additionalProperties": false
      },
      "PutAgentFolderRequest": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "minLength": 1
          },
          "format": {
            "type": "string",
            "enum": [
              "nylorun.folder.v2"
            ]
          },
          "entries": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1024
                },
                "size": {
                  "type": "integer",
                  "minimum": 0
                },
                "sha256": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                },
                "contentType": {
                  "type": "string"
                },
                "mode": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 4095
                }
              },
              "required": [
                "path",
                "size",
                "sha256"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "format",
          "entries"
        ],
        "additionalProperties": false
      },
      "AgentManifestView": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "hash": {
            "type": "string"
          },
          "manifest": {
            "$ref": "#/components/schemas/AgentManifestV8"
          },
          "savedBy": {
            "type": "object",
            "properties": {
              "actor": {
                "type": "string"
              }
            },
            "required": [
              "actor"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string"
          },
          "agents": {
            "type": "integer",
            "minimum": 0
          },
          "source": {
            "type": "object",
            "properties": {
              "compiler": {
                "type": "string"
              },
              "files": {
                "type": "integer",
                "minimum": 0
              },
              "bytes": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "compiler",
              "files",
              "bytes"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "name",
          "version",
          "hash",
          "manifest",
          "savedBy",
          "createdAt",
          "agents"
        ],
        "additionalProperties": false
      },
      "AgentManifestVersions": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "latest": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "versions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "version": {
                  "type": "integer",
                  "exclusiveMinimum": 0
                },
                "hash": {
                  "type": "string"
                },
                "savedBy": {
                  "type": "object",
                  "properties": {
                    "actor": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "actor"
                  ],
                  "additionalProperties": false
                },
                "createdAt": {
                  "type": "string"
                },
                "agents": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "required": [
                "version",
                "hash",
                "savedBy",
                "createdAt",
                "agents"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "name",
          "latest",
          "versions"
        ],
        "additionalProperties": false
      },
      "AgentManifestSource": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "compiler": {
            "type": "string"
          },
          "files": {
            "type": "integer",
            "minimum": 0
          },
          "bytes": {
            "type": "integer",
            "minimum": 0
          },
          "entries": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "size": {
                  "type": "integer",
                  "minimum": 0
                },
                "sha256": {
                  "type": "string"
                }
              },
              "required": [
                "path",
                "size",
                "sha256"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "name",
          "version",
          "compiler",
          "files",
          "bytes",
          "entries"
        ],
        "additionalProperties": false
      },
      "AgentManifestSourceDiff": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "from": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "to": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "added": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "size": {
                  "type": "integer",
                  "minimum": 0
                },
                "sha256": {
                  "type": "string"
                }
              },
              "required": [
                "path",
                "size",
                "sha256"
              ],
              "additionalProperties": false
            }
          },
          "removed": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "size": {
                  "type": "integer",
                  "minimum": 0
                },
                "sha256": {
                  "type": "string"
                }
              },
              "required": [
                "path",
                "size",
                "sha256"
              ],
              "additionalProperties": false
            }
          },
          "changed": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "from": {
                  "type": "object",
                  "properties": {
                    "size": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "sha256": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "size",
                    "sha256"
                  ],
                  "additionalProperties": false
                },
                "to": {
                  "type": "object",
                  "properties": {
                    "size": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "sha256": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "size",
                    "sha256"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "path",
                "from",
                "to"
              ],
              "additionalProperties": false
            }
          },
          "unchanged": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "name",
          "from",
          "to",
          "added",
          "removed",
          "changed",
          "unchanged"
        ],
        "additionalProperties": false
      },
      "DeleteAgentManifestResponse": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "deleted"
        ],
        "additionalProperties": false
      },
      "UploadArtifactResponse": {
        "type": "object",
        "properties": {
          "artifact": {
            "type": "object",
            "properties": {
              "artifactId": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "file",
                  "folder"
                ]
              },
              "name": {
                "type": "string"
              },
              "contentType": {
                "type": "string",
                "description": "The latest version's media type"
              },
              "sessionId": {
                "type": "string"
              },
              "agentId": {
                "type": "string"
              },
              "latestVersion": {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              "labels": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "createdAt": {
                "type": "string"
              },
              "updatedAt": {
                "type": "string"
              },
              "versions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "integer",
                      "exclusiveMinimum": 0
                    },
                    "size": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "sha256": {
                      "type": "string",
                      "description": "SHA-256 of the bytes (a folder: of its manifest), lowercase hex"
                    },
                    "contentType": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "upload",
                        "engine",
                        "export",
                        "snapshot"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "version",
                    "size",
                    "sha256",
                    "contentType",
                    "source",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "artifactId",
              "kind",
              "name",
              "contentType",
              "latestVersion",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "version": {
            "type": "object",
            "properties": {
              "version": {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              "size": {
                "type": "integer",
                "minimum": 0
              },
              "sha256": {
                "type": "string",
                "description": "SHA-256 of the bytes (a folder: of its manifest), lowercase hex"
              },
              "contentType": {
                "type": "string"
              },
              "source": {
                "type": "string",
                "enum": [
                  "upload",
                  "engine",
                  "export",
                  "snapshot"
                ]
              },
              "createdAt": {
                "type": "string"
              }
            },
            "required": [
              "version",
              "size",
              "sha256",
              "contentType",
              "source",
              "createdAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "artifact",
          "version"
        ],
        "additionalProperties": false
      },
      "ListArtifactsResponse": {
        "type": "object",
        "properties": {
          "artifacts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "artifactId": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "file",
                    "folder"
                  ]
                },
                "name": {
                  "type": "string"
                },
                "contentType": {
                  "type": "string",
                  "description": "The latest version's media type"
                },
                "sessionId": {
                  "type": "string"
                },
                "agentId": {
                  "type": "string"
                },
                "latestVersion": {
                  "type": "integer",
                  "exclusiveMinimum": 0
                },
                "labels": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                },
                "createdAt": {
                  "type": "string"
                },
                "updatedAt": {
                  "type": "string"
                },
                "versions": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "version": {
                        "type": "integer",
                        "exclusiveMinimum": 0
                      },
                      "size": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "sha256": {
                        "type": "string",
                        "description": "SHA-256 of the bytes (a folder: of its manifest), lowercase hex"
                      },
                      "contentType": {
                        "type": "string"
                      },
                      "source": {
                        "type": "string",
                        "enum": [
                          "upload",
                          "engine",
                          "export",
                          "snapshot"
                        ]
                      },
                      "createdAt": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "version",
                      "size",
                      "sha256",
                      "contentType",
                      "source",
                      "createdAt"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "artifactId",
                "kind",
                "name",
                "contentType",
                "latestVersion",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "artifacts"
        ],
        "additionalProperties": false
      },
      "ArtifactPage": {
        "type": "object",
        "properties": {
          "artifacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ArtifactListItem"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "artifacts",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "ArtifactListItem": {
        "type": "object",
        "properties": {
          "artifactId": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "file",
              "folder"
            ]
          },
          "name": {
            "type": "string"
          },
          "contentType": {
            "type": "string",
            "description": "The latest version's media type"
          },
          "sessionId": {
            "type": "string"
          },
          "agentId": {
            "type": "string"
          },
          "latestVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "labels": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "artifactId",
          "kind",
          "name",
          "contentType",
          "latestVersion",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "ArtifactView": {
        "type": "object",
        "properties": {
          "artifactId": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "file",
              "folder"
            ]
          },
          "name": {
            "type": "string"
          },
          "contentType": {
            "type": "string",
            "description": "The latest version's media type"
          },
          "sessionId": {
            "type": "string"
          },
          "agentId": {
            "type": "string"
          },
          "latestVersion": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "labels": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "versions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "version": {
                  "type": "integer",
                  "exclusiveMinimum": 0
                },
                "size": {
                  "type": "integer",
                  "minimum": 0
                },
                "sha256": {
                  "type": "string",
                  "description": "SHA-256 of the bytes (a folder: of its manifest), lowercase hex"
                },
                "contentType": {
                  "type": "string"
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "upload",
                    "engine",
                    "export",
                    "snapshot"
                  ]
                },
                "createdAt": {
                  "type": "string"
                }
              },
              "required": [
                "version",
                "size",
                "sha256",
                "contentType",
                "source",
                "createdAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "artifactId",
          "kind",
          "name",
          "contentType",
          "latestVersion",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "ArtifactTree": {
        "type": "object",
        "properties": {
          "artifactId": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "entries": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1024
                },
                "size": {
                  "type": "integer",
                  "minimum": 0
                },
                "sha256": {
                  "type": "string",
                  "description": "SHA-256 of the file's bytes, lowercase hex"
                },
                "contentType": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "link",
                    "dir"
                  ]
                },
                "mode": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 4095
                },
                "mtimeMs": {
                  "type": "number",
                  "minimum": 0
                },
                "target": {
                  "type": "string",
                  "maxLength": 4096
                }
              },
              "required": [
                "path",
                "size",
                "sha256",
                "contentType"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "artifactId",
          "version",
          "entries"
        ],
        "additionalProperties": false
      },
      "ArtifactDiff": {
        "type": "object",
        "properties": {
          "artifactId": {
            "type": "string"
          },
          "from": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "to": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "added": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1024
                },
                "size": {
                  "type": "integer",
                  "minimum": 0
                },
                "sha256": {
                  "type": "string",
                  "description": "SHA-256 of the file's bytes, lowercase hex"
                },
                "contentType": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "link",
                    "dir"
                  ]
                },
                "mode": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 4095
                },
                "mtimeMs": {
                  "type": "number",
                  "minimum": 0
                },
                "target": {
                  "type": "string",
                  "maxLength": 4096
                }
              },
              "required": [
                "path",
                "size",
                "sha256",
                "contentType"
              ],
              "additionalProperties": false
            }
          },
          "removed": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1024
                },
                "size": {
                  "type": "integer",
                  "minimum": 0
                },
                "sha256": {
                  "type": "string",
                  "description": "SHA-256 of the file's bytes, lowercase hex"
                },
                "contentType": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "link",
                    "dir"
                  ]
                },
                "mode": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 4095
                },
                "mtimeMs": {
                  "type": "number",
                  "minimum": 0
                },
                "target": {
                  "type": "string",
                  "maxLength": 4096
                }
              },
              "required": [
                "path",
                "size",
                "sha256",
                "contentType"
              ],
              "additionalProperties": false
            }
          },
          "changed": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "from": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1024
                    },
                    "size": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "sha256": {
                      "type": "string",
                      "description": "SHA-256 of the file's bytes, lowercase hex"
                    },
                    "contentType": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "link",
                        "dir"
                      ]
                    },
                    "mode": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 4095
                    },
                    "mtimeMs": {
                      "type": "number",
                      "minimum": 0
                    },
                    "target": {
                      "type": "string",
                      "maxLength": 4096
                    }
                  },
                  "required": [
                    "path",
                    "size",
                    "sha256",
                    "contentType"
                  ],
                  "additionalProperties": false
                },
                "to": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1024
                    },
                    "size": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "sha256": {
                      "type": "string",
                      "description": "SHA-256 of the file's bytes, lowercase hex"
                    },
                    "contentType": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "link",
                        "dir"
                      ]
                    },
                    "mode": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 4095
                    },
                    "mtimeMs": {
                      "type": "number",
                      "minimum": 0
                    },
                    "target": {
                      "type": "string",
                      "maxLength": 4096
                    }
                  },
                  "required": [
                    "path",
                    "size",
                    "sha256",
                    "contentType"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "path",
                "from",
                "to"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "artifactId",
          "to",
          "added",
          "removed",
          "changed"
        ],
        "additionalProperties": false
      },
      "ArtifactLink": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "artifactId": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "file": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string"
          }
        },
        "required": [
          "path",
          "artifactId",
          "version",
          "expiresAt"
        ],
        "additionalProperties": false
      },
      "CreateArtifactLinkRequest": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "minLength": 1
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "expiresIn": {
            "type": "integer",
            "minimum": 1
          },
          "file": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          }
        },
        "additionalProperties": false
      },
      "DeleteArtifactResponse": {
        "type": "object",
        "properties": {
          "artifactId": {
            "type": "string"
          },
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "artifactId",
          "deleted"
        ],
        "additionalProperties": false
      },
      "Jwks": {
        "type": "object",
        "properties": {
          "keys": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kty": {
                  "type": "string",
                  "enum": [
                    "EC"
                  ]
                },
                "crv": {
                  "type": "string",
                  "enum": [
                    "P-256"
                  ]
                },
                "x": {
                  "type": "string"
                },
                "y": {
                  "type": "string"
                },
                "kid": {
                  "type": "string"
                },
                "alg": {
                  "type": "string",
                  "enum": [
                    "ES256"
                  ]
                },
                "use": {
                  "type": "string",
                  "enum": [
                    "sig"
                  ]
                }
              },
              "required": [
                "kty",
                "crv",
                "x",
                "y",
                "kid",
                "alg",
                "use"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "keys"
        ],
        "additionalProperties": false
      },
      "MeResponse": {
        "type": "object",
        "properties": {
          "subject": {
            "type": "string",
            "description": "The person the request acts for; absent for an application key alone"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "agents:read",
                "agents:write",
                "sessions:own",
                "agent-manifests:write",
                "studio"
              ]
            }
          },
          "agents": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "*"
                ]
              },
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              }
            ]
          },
          "via": {
            "type": "string",
            "description": "How the caller authenticated: `application:<principalId>`, `management:<principalId>`, `subject` or `issuer:<name>`"
          }
        },
        "required": [
          "scopes",
          "agents",
          "via"
        ],
        "additionalProperties": false
      },
      "A2aAgentCard": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "skills": {
            "type": "array",
            "items": {}
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": {},
        "description": "The agent's A2A card, without interfaces"
      },
      "A2aJsonRpcResponse": {
        "type": "object",
        "properties": {
          "jsonrpc": {
            "type": "string",
            "enum": [
              "2.0"
            ]
          },
          "id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "result": {},
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "integer"
              },
              "message": {
                "type": "string"
              },
              "data": {}
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "jsonrpc",
          "id"
        ],
        "additionalProperties": {}
      },
      "A2aJsonRpcRequest": {
        "type": "object",
        "properties": {
          "jsonrpc": {
            "type": "string",
            "enum": [
              "2.0"
            ]
          },
          "id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "method": {
            "type": "string",
            "description": "`SendMessage`, `GetTask` or `CancelTask`; others answer their A2A error"
          },
          "params": {}
        },
        "required": [
          "jsonrpc",
          "method"
        ],
        "additionalProperties": {}
      },
      "SessionManifestView": {
        "type": "object",
        "properties": {
          "sessionId": {
            "type": "string"
          },
          "agentId": {
            "type": "string"
          },
          "definition": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "version": {
                "type": "integer",
                "exclusiveMinimum": 0
              }
            },
            "required": [
              "name",
              "version"
            ],
            "additionalProperties": false
          },
          "manifestHash": {
            "type": "string"
          },
          "manifest": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "required": [
          "sessionId",
          "agentId",
          "definition",
          "manifestHash",
          "manifest"
        ],
        "additionalProperties": false
      },
      "SessionUsageTotals": {
        "type": "object",
        "properties": {
          "sessionId": {
            "type": "string"
          },
          "turnId": {
            "type": [
              "string",
              "null"
            ]
          },
          "asOf": {
            "type": "string"
          },
          "inputTokens": {
            "type": "integer",
            "minimum": 0
          },
          "outputTokens": {
            "type": "integer",
            "minimum": 0
          },
          "totalTokens": {
            "type": "integer",
            "minimum": 0
          },
          "cachedTokens": {
            "type": "integer",
            "minimum": 0
          },
          "cacheWriteTokens": {
            "type": "integer",
            "minimum": 0
          },
          "reasoningTokens": {
            "type": "integer",
            "minimum": 0
          },
          "costUsd": {
            "type": "number",
            "minimum": 0
          },
          "calls": {
            "type": "integer",
            "minimum": 0
          },
          "duplicates": {
            "type": "integer",
            "minimum": 0
          },
          "unpricedCalls": {
            "type": "integer",
            "minimum": 0
          },
          "unreportedCalls": {
            "type": "integer",
            "minimum": 0
          },
          "unknownQualityCalls": {
            "type": "integer",
            "minimum": 0
          },
          "costSplit": {
            "type": "object",
            "properties": {
              "input": {
                "type": "number",
                "minimum": 0
              },
              "cacheRead": {
                "type": "number",
                "minimum": 0
              },
              "cacheWrite": {
                "type": "number",
                "minimum": 0
              },
              "output": {
                "type": "number",
                "minimum": 0
              }
            },
            "required": [
              "input",
              "cacheRead",
              "cacheWrite",
              "output"
            ],
            "additionalProperties": false
          },
          "splitCalls": {
            "type": "integer",
            "minimum": 0
          },
          "modelTimeMs": {
            "type": "integer",
            "minimum": 0
          },
          "timedCalls": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "sessionId",
          "turnId",
          "asOf",
          "inputTokens",
          "outputTokens",
          "totalTokens",
          "cachedTokens",
          "cacheWriteTokens",
          "reasoningTokens",
          "costUsd",
          "calls",
          "duplicates",
          "unpricedCalls",
          "unreportedCalls",
          "unknownQualityCalls",
          "costSplit",
          "splitCalls",
          "modelTimeMs",
          "timedCalls"
        ],
        "additionalProperties": false
      },
      "ModelCallsPage": {
        "type": "object",
        "properties": {
          "calls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModelCall"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "asOf": {
            "type": "string"
          }
        },
        "required": [
          "calls",
          "nextCursor",
          "asOf"
        ],
        "additionalProperties": false
      },
      "ModelCall": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "effectId": {
            "type": "string"
          },
          "sessionId": {
            "type": "string"
          },
          "turnId": {
            "type": "string"
          },
          "manifestName": {
            "type": "string"
          },
          "provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "at": {
            "type": "string"
          },
          "startedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "endedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "completed",
              "failed"
            ]
          },
          "usage": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "inputTokens": {
                "type": "integer",
                "minimum": 0
              },
              "outputTokens": {
                "type": "integer",
                "minimum": 0
              },
              "totalTokens": {
                "type": "integer",
                "minimum": 0
              },
              "cachedTokens": {
                "type": "integer",
                "minimum": 0
              },
              "cacheWriteTokens": {
                "type": "integer",
                "minimum": 0
              },
              "reasoningTokens": {
                "type": "integer",
                "minimum": 0
              },
              "costUsd": {
                "type": "number",
                "minimum": 0
              },
              "duplicate": {
                "type": "boolean"
              },
              "tokensReported": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "costKnown": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "costSplit": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "input": {
                    "type": "number",
                    "minimum": 0
                  },
                  "cacheRead": {
                    "type": "number",
                    "minimum": 0
                  },
                  "cacheWrite": {
                    "type": "number",
                    "minimum": 0
                  },
                  "output": {
                    "type": "number",
                    "minimum": 0
                  }
                },
                "required": [
                  "input",
                  "cacheRead",
                  "cacheWrite",
                  "output"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "inputTokens",
              "outputTokens",
              "totalTokens",
              "cachedTokens",
              "cacheWriteTokens",
              "reasoningTokens",
              "costUsd",
              "duplicate",
              "tokensReported",
              "costKnown",
              "costSplit"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "effectId",
          "sessionId",
          "turnId",
          "manifestName",
          "provider",
          "model",
          "at",
          "startedAt",
          "endedAt",
          "outcome",
          "usage"
        ],
        "additionalProperties": false
      },
      "ToolCallsPage": {
        "type": "object",
        "properties": {
          "calls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ToolCall"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "asOf": {
            "type": "string"
          }
        },
        "required": [
          "calls",
          "nextCursor",
          "asOf"
        ],
        "additionalProperties": false
      },
      "ToolCall": {
        "type": "object",
        "properties": {
          "effectId": {
            "type": "string"
          },
          "turnId": {
            "type": "string"
          },
          "callId": {
            "type": [
              "string",
              "null"
            ]
          },
          "toolName": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "mcp",
              "http",
              "sandbox",
              "harness",
              "runtime",
              null
            ]
          },
          "server": {
            "type": [
              "string",
              "null"
            ]
          },
          "tool": {
            "type": [
              "string",
              "null"
            ]
          },
          "skill": {
            "type": [
              "string",
              "null"
            ]
          },
          "plugin": {
            "allOf": [
              {
                "$ref": "#/components/schemas/PluginLabel"
              },
              {
                "type": [
                  "object",
                  "null"
                ]
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "invoking",
              "held",
              "completed",
              "failed",
              "cancelled",
              "uncertain"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "input": {},
          "error": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          },
          "startedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "settledAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "durationMs": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          }
        },
        "required": [
          "effectId",
          "turnId",
          "callId",
          "toolName",
          "kind",
          "server",
          "tool",
          "skill",
          "plugin",
          "status",
          "attempts",
          "error",
          "startedAt",
          "settledAt",
          "durationMs"
        ],
        "additionalProperties": false
      },
      "TurnTrace": {
        "type": "object",
        "properties": {
          "resourceSpans": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "resource": {
                  "type": "object",
                  "properties": {
                    "attributes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "value": {
                            "type": "object",
                            "additionalProperties": {}
                          }
                        },
                        "required": [
                          "key",
                          "value"
                        ],
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "attributes"
                  ],
                  "additionalProperties": {}
                },
                "scopeSpans": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "scope": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "version": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "name"
                        ],
                        "additionalProperties": {}
                      },
                      "spans": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "traceId": {
                              "type": "string"
                            },
                            "spanId": {
                              "type": "string"
                            },
                            "parentSpanId": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "kind": {
                              "type": "integer"
                            },
                            "startTimeUnixNano": {
                              "type": "string"
                            },
                            "endTimeUnixNano": {
                              "type": "string"
                            },
                            "attributes": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "key": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "type": "object",
                                    "additionalProperties": {}
                                  }
                                },
                                "required": [
                                  "key",
                                  "value"
                                ],
                                "additionalProperties": {}
                              }
                            },
                            "status": {
                              "type": "object",
                              "properties": {
                                "code": {
                                  "type": "integer"
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "code"
                              ],
                              "additionalProperties": {}
                            }
                          },
                          "required": [
                            "traceId",
                            "spanId",
                            "name",
                            "kind",
                            "startTimeUnixNano",
                            "endTimeUnixNano",
                            "attributes",
                            "status"
                          ],
                          "additionalProperties": {}
                        }
                      }
                    },
                    "required": [
                      "scope",
                      "spans"
                    ],
                    "additionalProperties": {}
                  }
                }
              },
              "required": [
                "resource",
                "scopeSpans"
              ],
              "additionalProperties": {}
            }
          }
        },
        "required": [
          "resourceSpans"
        ],
        "additionalProperties": {}
      }
    },
    "parameters": {}
  },
  "paths": {
    "/v1/agent-manifests/{name}": {
      "put": {
        "tags": [
          "Agent manifests"
        ],
        "summary": "Save an agent manifest",
        "description": "Saves the manifest as its next version, or answers the latest unchanged when nothing differs. Every Agent that tracks the manifest moves to the new version: at once, at its pod's next start for a runtime change a pod applies only when it starts, or once a required secret the version adds is set; a pinned one stays, and so does one whose kind, harness or storage the version changes (`agents_behind`). The Runtime checks the harness and runtime sections against each other: a custom harness needs a pod with an image, every credential the harness names is a declared slot of the right type, and the runtime's kind gives the loop the sandbox it needs; every gap is named in one `422 manifest_inconsistent` (`details.gaps`). `If-Match: <version>` refuses the save with `412 manifest_changed` when the latest version is no longer the one you read (`0` for a manifest that does not exist yet). With `?dryRun=true` the answer is the plan: the changes by section, every reason a save would be refused (`errors`, the gaps first), warnings, the Agents it would move (`moves`) and how many stay on older versions (`behind`); nothing is saved. Clients compose the authoring files and drop their `$schema` before they send one document. With `Content-Type: application/vnd.nylorun.folder+json` the body is an agent folder by hash instead (feature `agent-folders`): every file uploaded first with `PUT /v1/files/sha256:<hex>`, the Runtime compiles it with `@nylorun/core/folder`, a folder that does not compile is `422 folder_invalid` (`details.diagnostics`, each with its file, line and column), and the version keeps the folder as its source; the plan adds the compiled `manifest`, the compiler's `diagnostics` and `compiler`.",
        "security": [
          {
            "applicationKey": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject"
        ],
        "x-nylorun-scopes": [
          "agent-manifests:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The agent manifest's name, such as `triage`"
            },
            "required": true,
            "description": "The agent manifest's name, such as `triage`",
            "name": "name",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "`true`: answer the plan and save nothing"
            },
            "required": false,
            "description": "`true`: answer the plan and save nothing",
            "name": "dryRun",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutAgentManifestRequest"
              }
            },
            "application/vnd.nylorun.folder+json": {
              "schema": {
                "$ref": "#/components/schemas/PutAgentFolderRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The version saved, or the plan with dryRun",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SaveAgentManifestResponse"
                    },
                    {
                      "$ref": "#/components/schemas/AgentManifestPlan"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The manifest breaks the Tenant's limits, has a tool that runs code, or names files the Runtime does not hold (`definition_files_missing`)"
          },
          "401": {
            "description": "No credential (`credential_required`), or one the Tenant does not accept (`credential_invalid`), with a `WWW-Authenticate: Bearer` challenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "412": {
            "description": "If-Match named a version that is no longer the latest (`manifest_changed`)"
          },
          "413": {
            "description": "A skill's files hold more than the manifest's skill limit together (`limit_exceeded`)"
          },
          "422": {
            "description": "The harness and runtime sections do not fit (`manifest_inconsistent`, `details.gaps`), or an agent folder does not compile (`folder_invalid`, `details.diagnostics`)"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Agent manifests"
        ],
        "summary": "Get an agent manifest",
        "description": "Its latest version.",
        "security": [
          {
            "applicationKey": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject"
        ],
        "x-nylorun-scopes": [
          "agents:read",
          "agents:write",
          "agent-manifests:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The agent manifest's name, such as `triage`"
            },
            "required": true,
            "description": "The agent manifest's name, such as `triage`",
            "name": "name",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The latest version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentManifestView"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), or one the Tenant does not accept (`credential_invalid`), with a `WWW-Authenticate: Bearer` challenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Agent manifests"
        ],
        "summary": "Delete an agent manifest",
        "description": "Deletes every version. Refused while any Agent was made from one (`409 manifest_in_use`).",
        "security": [
          {
            "applicationKey": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject"
        ],
        "x-nylorun-scopes": [
          "agent-manifests:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The agent manifest's name, such as `triage`"
            },
            "required": true,
            "description": "The agent manifest's name, such as `triage`",
            "name": "name",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted, or there was none",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteAgentManifestResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), or one the Tenant does not accept (`credential_invalid`), with a `WWW-Authenticate: Bearer` challenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "409": {
            "description": "An Agent was made from one of its versions (`manifest_in_use`)"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agent-manifests": {
      "get": {
        "tags": [
          "Agent manifests"
        ],
        "summary": "List agent manifests",
        "description": "Each manifest's latest version, by name, with how many Agents were made from it.",
        "security": [
          {
            "applicationKey": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject"
        ],
        "x-nylorun-scopes": [
          "agents:read",
          "agents:write",
          "agent-manifests:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The manifests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAgentManifestsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), or one the Tenant does not accept (`credential_invalid`), with a `WWW-Authenticate: Bearer` challenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agent-manifests/{name}/versions": {
      "get": {
        "tags": [
          "Agent manifests"
        ],
        "summary": "List an agent manifest's versions",
        "description": "Every version, newest first, with who saved it and how many Agents were made from it.",
        "security": [
          {
            "applicationKey": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject"
        ],
        "x-nylorun-scopes": [
          "agents:read",
          "agents:write",
          "agent-manifests:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The agent manifest's name, such as `triage`"
            },
            "required": true,
            "description": "The agent manifest's name, such as `triage`",
            "name": "name",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The versions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentManifestVersions"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), or one the Tenant does not accept (`credential_invalid`), with a `WWW-Authenticate: Bearer` challenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agent-manifests/{name}/versions/{version}": {
      "get": {
        "tags": [
          "Agent manifests"
        ],
        "summary": "Get one version of an agent manifest",
        "security": [
          {
            "applicationKey": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject"
        ],
        "x-nylorun-scopes": [
          "agents:read",
          "agents:write",
          "agent-manifests:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The agent manifest's name, such as `triage`"
            },
            "required": true,
            "description": "The agent manifest's name, such as `triage`",
            "name": "name",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The version number"
            },
            "required": true,
            "description": "The version number",
            "name": "version",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentManifestView"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), or one the Tenant does not accept (`credential_invalid`), with a `WWW-Authenticate: Bearer` challenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agent-manifests/{name}/versions/{version}/source": {
      "get": {
        "tags": [
          "Agent manifests"
        ],
        "summary": "Get the folder a version was compiled from",
        "description": "The agent folder the version was saved from (feature `agent-folders`): its compiler, size and every file, sorted by path. A version saved as JSON has none (`404`).",
        "security": [
          {
            "applicationKey": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject"
        ],
        "x-nylorun-scopes": [
          "agents:read",
          "agents:write",
          "agent-manifests:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The agent manifest's name, such as `triage`"
            },
            "required": true,
            "description": "The agent manifest's name, such as `triage`",
            "name": "name",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The version number"
            },
            "required": true,
            "description": "The version number",
            "name": "version",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The folder",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentManifestSource"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), or one the Tenant does not accept (`credential_invalid`), with a `WWW-Authenticate: Bearer` challenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agent-manifests/{name}/versions/{version}/source/files/{path}": {
      "get": {
        "tags": [
          "Agent manifests"
        ],
        "summary": "Download one file of a version's folder",
        "description": "Streams the file at `path` (its path in the folder, with `/` percent-encoded as `%2F`) as it was saved.",
        "security": [
          {
            "applicationKey": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject"
        ],
        "x-nylorun-scopes": [
          "agents:read",
          "agents:write",
          "agent-manifests:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The agent manifest's name, such as `triage`"
            },
            "required": true,
            "description": "The agent manifest's name, such as `triage`",
            "name": "name",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The version number"
            },
            "required": true,
            "description": "The version number",
            "name": "version",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The file's path in the folder, percent-encoded"
            },
            "required": true,
            "description": "The file's path in the folder, percent-encoded",
            "name": "path",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The file's bytes",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), or one the Tenant does not accept (`credential_invalid`), with a `WWW-Authenticate: Bearer` challenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agent-manifests/{name}/source/diff": {
      "get": {
        "tags": [
          "Agent manifests"
        ],
        "summary": "Compare two versions' folders",
        "description": "The files added, removed and changed from version `from`'s source to version `to`'s, by path, a file changed when its SHA-256 differs (feature `agent-folders`). Each list is sorted by path. A version saved as JSON has no source (`404`).",
        "security": [
          {
            "applicationKey": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject"
        ],
        "x-nylorun-scopes": [
          "agents:read",
          "agents:write",
          "agent-manifests:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The agent manifest's name, such as `triage`"
            },
            "required": true,
            "description": "The agent manifest's name, such as `triage`",
            "name": "name",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The version to compare from"
            },
            "required": true,
            "description": "The version to compare from",
            "name": "from",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The version to compare to"
            },
            "required": true,
            "description": "The version to compare to",
            "name": "to",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "What changed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentManifestSourceDiff"
                }
              }
            }
          },
          "400": {
            "description": "`from` or `to` is not a version number"
          },
          "401": {
            "description": "No credential (`credential_required`), or one the Tenant does not accept (`credential_invalid`), with a `WWW-Authenticate: Bearer` challenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "No such version, or one was saved as JSON and has no source"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/files/{file}": {
      "put": {
        "tags": [
          "Definition files"
        ],
        "summary": "Upload a definition file",
        "description": "Streams the body, at most the Tenant's skill limit (`/v1/tenant/skills`, default 2 GiB: one file may be as large as a whole skill), to the SHA-256 the path names; a body with another hash stores nothing (`400`). A file the Tenant holds already is kept as it is (`200`).",
        "security": [
          {
            "applicationKey": []
          }
        ],
        "x-nylorun-credentials": [
          "application"
        ],
        "x-nylorun-scopes": "never",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "`sha256:` and the SHA-256 of the file's bytes, 64 lowercase hex digits"
            },
            "required": true,
            "description": "`sha256:` and the SHA-256 of the file's bytes, 64 lowercase hex digits",
            "name": "file",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The file's bytes",
          "content": {
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The Tenant held the file already",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefinitionFileView"
                }
              }
            }
          },
          "201": {
            "description": "The file, stored",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefinitionFileView"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), or one the Tenant does not accept (`credential_invalid`), with a `WWW-Authenticate: Bearer` challenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "413": {
            "description": "Larger than the Tenant's skill limit (`limit_exceeded`)"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      },
      "head": {
        "tags": [
          "Definition files"
        ],
        "summary": "Whether the Runtime holds a definition file",
        "description": "`200` when the Tenant holds the file, `404` when it does not: upload it.",
        "security": [
          {
            "applicationKey": []
          }
        ],
        "x-nylorun-credentials": [
          "application"
        ],
        "x-nylorun-scopes": "never",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "`sha256:` and the SHA-256 of the file's bytes, 64 lowercase hex digits"
            },
            "required": true,
            "description": "`sha256:` and the SHA-256 of the file's bytes, 64 lowercase hex digits",
            "name": "file",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The Tenant holds the file"
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), or one the Tenant does not accept (`credential_invalid`), with a `WWW-Authenticate: Bearer` challenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}": {
      "put": {
        "tags": [
          "Agents"
        ],
        "summary": "Create, find or move an Agent",
        "description": "Creates the Agent, its vault and its compute from a saved agent manifest, within the Tenant's limits, or answers the one with this id, so get-or-create is one call. `manifest: \"name\"` records that it tracks the manifest (its latest version, and each version saved later) and `\"name@n\"` that it is pinned; the version it runs is `resolvedVersion`. On an existing one, labels replace, `owner` sets or (with `null`) clears the owner guard, and `manifest` moves it with its id, disk, vault and sessions: a harness-only change applies at once (each session's next turn runs it), a runtime change of a pod at its next start (`targetVersion`, `waitingFor: start`), and a version that adds a required secret once a value is set (`waitingFor: secrets`). Its manifest's name, kind, harness and storage are fixed (`409 agent_fixed_field`): fork it to change them. `?dryRun=true` answers the move's plan and changes nothing. Creating an Agent opens no session. Kind `pod` needs sandbox pods (`nylorun local sandbox enable`) and is created at once.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`"
            },
            "required": true,
            "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "`true`: the plan of moving the existing Agent, with nothing changed"
            },
            "required": false,
            "description": "`true`: the plan of moving the existing Agent, with nothing changed",
            "name": "dryRun",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutAgentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The Agent, or with `dryRun` the plan of its move",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/AgentView"
                    },
                    {
                      "$ref": "#/components/schemas/PutAgentDryRunResponse"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "No agent manifest has this name or version (`manifest_not_found`), or a dry run names no Agent"
          },
          "409": {
            "description": "A move would change its manifest's name, its kind, harness or storage (`agent_fixed_field`), the Tenant holds as many Agents as it allows (`limit_exceeded`), kind pod without sandbox pods (`agent_unavailable`), or it is being deleted (`agent_busy`)"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "Get an Agent",
        "description": "Its manifest version, what its environment runs, labels, owner guard, derived state with the sessions behind it (`attention`), compute, secret slots, disk, and its sessions (acting for a person, only theirs).",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own",
          "agents:read",
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`"
            },
            "required": true,
            "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The Agent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentView"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Agents"
        ],
        "summary": "Delete an Agent",
        "description": "Deletes the Agent, its vault with every secret, and its disk. Its sessions keep its id; their next turn is refused (`agent_unavailable`) until an Agent with this id exists again.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`"
            },
            "required": true,
            "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted, or there was none",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteAgentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "409": {
            "description": "One of its sessions has a turn running (`agent_busy`)"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents": {
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "List Agents",
        "description": "Every Agent with all the labels asked for, in `state`, made from `manifest` and `outdated` (moving to another version) when given, by id. A token caller sees only the Agents its grants reach, and a caller acting for a person only that person's sessions on each. `limit` opts into pages.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own",
          "agents:read",
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "description": "A page holds at most the Tenant's Runtime limit `pageItems` (default 200); a larger limit gets that many"
            },
            "required": false,
            "description": "A page holds at most the Tenant's Runtime limit `pageItems` (default 200); a larger limit gets that many",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "cursor",
            "in": "query"
          },
          {
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ],
              "description": "`key=value`; repeat it to require several labels"
            },
            "required": false,
            "description": "`key=value`; repeat it to require several labels",
            "name": "label",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Only Agents in this state (`input_required`, …)"
            },
            "required": false,
            "description": "Only Agents in this state (`input_required`, …)",
            "name": "state",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Only Agents made from this agent manifest"
            },
            "required": false,
            "description": "Only Agents made from this agent manifest",
            "name": "manifest",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "`true`: only Agents moving to another version of their manifest (waiting for secrets or a start); `false`: only the others"
            },
            "required": false,
            "description": "`true`: only Agents moving to another version of their manifest (waiting for secrets or a start); `false`: only the others",
            "name": "outdated",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The Agents; limit opts into pagination",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/ListAgentsResponse"
                    },
                    {
                      "$ref": "#/components/schemas/AgentPage"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/events": {
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "Read an Agent's events",
        "description": "`agent.created`, `.attached`, `.detached`, `.deleted`, a pod's `.running`, `.suspended`, `.relaunched`, `.lost`, `.reset` and `.failed`, `.forked`, a move's `.outdated`, `.version_changed` and `.start_failed`, and `agent.egress` for every connection its sandbox opens through egress-gate, naming the turns that were running, in order, numbered from 0, at most the Tenant's Runtime limit `environmentEventItems` (default 1000) per call: `from` reads on.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own",
          "agents:read",
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`"
            },
            "required": true,
            "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The first `seq` to return"
            },
            "required": false,
            "description": "The first `seq` to return",
            "name": "from",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Only these event types, comma-separated (`agent.egress`)"
            },
            "required": false,
            "description": "Only these event types, comma-separated (`agent.egress`)",
            "name": "types",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Only events recorded at or after this ISO time"
            },
            "required": false,
            "description": "Only events recorded at or after this ISO time",
            "name": "since",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Only events recorded before this ISO time"
            },
            "required": false,
            "description": "Only events recorded before this ISO time",
            "name": "until",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The events",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAgentEventsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/stop": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Stop a pod Agent",
        "description": "Suspends the pod: its volume is kept, and the next turn of one of its sessions starts it again. Refused during a turn (`agent_busy`).",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`"
            },
            "required": true,
            "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The Agent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentView"
                }
              }
            }
          },
          "400": {
            "description": "The Agent is not of kind pod"
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "409": {
            "description": "A turn holds it (`agent_busy`), or no sandbox pods (`agent_unavailable`)"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/reset": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Reset a pod Agent",
        "description": "A new pod on a new, empty volume with the recipe applied; the old pod and volume are deleted. The way out of `agent_lost`. Refused during a turn (`agent_busy`).",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`"
            },
            "required": true,
            "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The Agent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentView"
                }
              }
            }
          },
          "400": {
            "description": "The Agent is not of kind pod"
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "409": {
            "description": "A turn holds it (`agent_busy`), or no sandbox pods (`agent_unavailable`)"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/restart": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Restart an Agent on its pending version",
        "description": "Applies a version the Agent waits to apply: a running pod stops, so the next turn starts it on the version, on the same volume; a stopped or failed one is asked to run at once. `retry: true` first moves it to the version that failed to start (`failedVersion`) again. Kinds `virtual` and `none` apply a version at once, so there is nothing to wait for. Refused during a turn (`agent_busy`). The body is optional.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`"
            },
            "required": true,
            "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RestartAgentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The Agent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentView"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "409": {
            "description": "A turn holds it (`agent_busy`), its pod was lost (`agent_lost`), or no sandbox pods (`agent_unavailable`)"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/secrets": {
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "List an Agent's secrets",
        "description": "Each secret's name, type and binding (its URL, or its hosts and header). Never a value.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own",
          "agents:read",
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`"
            },
            "required": true,
            "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAgentSecretsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/secrets/{name}": {
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "Get an Agent's secret",
        "description": "Its name, type and binding. Never its value.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own",
          "agents:read",
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`"
            },
            "required": true,
            "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The secret's name: the variable for `environment_secret` and `environment_variable`, a label for `bearer` and `headers`"
            },
            "required": true,
            "description": "The secret's name: the variable for `environment_secret` and `environment_variable`, a label for `bearer` and `headers`",
            "name": "name",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The secret",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentSecretView"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Agents"
        ],
        "summary": "Write an Agent's secret",
        "description": "Creates or replaces one credential of the Agent's vault: an `environment_secret` (the variable `name` reads the sentinel `nylorun_managed` in the sandbox, and egress-gate sets the value as a header on requests to `allowedHosts`), an `environment_variable` (a plain variable), or a `bearer` token or `headers` map for the MCP servers and HTTP tools at `url`. The same name and type re-seals the value and binding; another type replaces it. A rotated value is used from the next request. A second credential for a host or a URL is `409 credential_conflict`. When the Agent's manifest declares secret slots (while it moves to another version, that version's), send only the value (`{ value }`, or `{ headers }` for a `headers` slot): the type and binding come from the slot, and a name it does not declare is `409 secret_not_in_manifest`.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`"
            },
            "required": true,
            "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The secret's name: the variable for `environment_secret` and `environment_variable`, a label for `bearer` and `headers`"
            },
            "required": true,
            "description": "The secret's name: the variable for `environment_secret` and `environment_variable`, a label for `bearer` and `headers`",
            "name": "name",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "requestId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "environment_secret"
                        ]
                      },
                      "value": {
                        "type": "string",
                        "minLength": 1
                      },
                      "allowedHosts": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "minItems": 1
                      },
                      "inject": {
                        "type": "object",
                        "properties": {
                          "header": {
                            "type": "string",
                            "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                          },
                          "format": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "header",
                          "format"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "type",
                      "value",
                      "allowedHosts"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "requestId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "environment_variable"
                        ]
                      },
                      "value": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "type",
                      "value"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "requestId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "bearer"
                        ]
                      },
                      "url": {
                        "type": "string",
                        "minLength": 1
                      },
                      "value": {
                        "type": "string",
                        "minLength": 1
                      },
                      "via": {
                        "type": "string"
                      },
                      "identity": {
                        "type": "object",
                        "properties": {
                          "header": {
                            "type": "string",
                            "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                          }
                        },
                        "required": [
                          "header"
                        ],
                        "additionalProperties": false
                      },
                      "toolPrefix": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "pattern": "^[\\x21-\\x7e]+$"
                      }
                    },
                    "required": [
                      "type",
                      "url",
                      "value"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "requestId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "headers"
                        ]
                      },
                      "url": {
                        "type": "string",
                        "minLength": 1
                      },
                      "headers": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "via": {
                        "type": "string"
                      },
                      "identity": {
                        "type": "object",
                        "properties": {
                          "header": {
                            "type": "string",
                            "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                          }
                        },
                        "required": [
                          "header"
                        ],
                        "additionalProperties": false
                      },
                      "toolPrefix": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "pattern": "^[\\x21-\\x7e]+$"
                      }
                    },
                    "required": [
                      "type",
                      "url",
                      "headers"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "requestId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "workload"
                        ]
                      },
                      "url": {
                        "type": "string",
                        "minLength": 1
                      },
                      "via": {
                        "type": "string"
                      },
                      "identity": {
                        "type": "object",
                        "properties": {
                          "header": {
                            "type": "string",
                            "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
                          }
                        },
                        "required": [
                          "header"
                        ],
                        "additionalProperties": false
                      },
                      "toolPrefix": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "pattern": "^[\\x21-\\x7e]+$"
                      }
                    },
                    "required": [
                      "type",
                      "url",
                      "via"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "$ref": "#/components/schemas/PutAgentSecretValueRequest"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The secret, without its value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentSecretView"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "409": {
            "description": "Another credential is bound to one of its hosts or to its URL (`credential_conflict`)"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Agents"
        ],
        "summary": "Delete an Agent's secret",
        "description": "The next request that would have used it gets none.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`"
            },
            "required": true,
            "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The secret's name: the variable for `environment_secret` and `environment_variable`, a label for `bearer` and `headers`"
            },
            "required": true,
            "description": "The secret's name: the variable for `environment_secret` and `environment_variable`, a label for `bearer` and `headers`",
            "name": "name",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/snapshot": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Snapshot an Agent's disk",
        "description": "Between turns, a new version of the Agent's disk (`/workspace`, and a pod's `/harness` but the engine's own files): files with their modes and modification times, links and empty directories, as a version of the folder artifact the Agent owns. Unchanged files are stored once; an unchanged disk makes no version (`unchanged`). A stopped pod is started first. Refused during a turn or another copy (`agent_busy`).",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`"
            },
            "required": true,
            "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "201": {
            "description": "The version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentSnapshot"
                }
              }
            }
          },
          "400": {
            "description": "The Agent is of kind none"
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "409": {
            "description": "A turn or another copy holds the disk (`agent_busy`), or the pod could not start (`agent_unavailable`)"
          },
          "413": {
            "description": "Past the entries, bytes or Tenant total a version may hold (`limit_exceeded`)"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/restore": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Restore a version of an Agent's disk",
        "description": "Puts disk version `version` (or `latest`) back. A virtual Agent's workspace is rewritten at once (`done`); a pod gets a new volume seeded from the version before any turn (`pending`, with `disk.operation` in the view until it ends). The Agent keeps its id, vault and sessions. Refused during a turn or another copy (`agent_busy`).",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`"
            },
            "required": true,
            "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RestoreAgentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Restored, or being restored",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRestore"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "No such Agent, or no such version"
          },
          "409": {
            "description": "A turn or another copy holds the disk (`agent_busy`)"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/fork": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Fork an Agent",
        "description": "Copies the Agent into a new one, which is how an Agent changes what is fixed for its life: a new Agent `id`, made from `manifest` (default the source's manifest name, tracking, at its latest version), its disk started from a version of this one's (`disk`: `latest`, the default, takes a snapshot first; a version number; or `empty`) and its secrets copied inside the Runtime (`secrets`: `copy`, the default, copies those the new manifest declares; `none`). On a fork onto other setup the new manifest's setup runs on the copied disk before its first turn. This Agent keeps what it runs, its disk and its sessions. `dryRun` answers the plan and makes nothing. To move an Agent to another version of the same manifest, with the same kind, harness and storage, `PUT` it instead.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`"
            },
            "required": true,
            "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ForkAgentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The plan (`dryRun`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ForkAgentResponse"
                }
              }
            }
          },
          "201": {
            "description": "The new Agent, and the plan it ran",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ForkAgentResponse"
                }
              }
            }
          },
          "400": {
            "description": "The manifest does not resolve against the Tenant's limits"
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "No such Agent, manifest version (`manifest_not_found`) or disk version"
          },
          "409": {
            "description": "The id exists, or a turn or another copy holds the source's disk (`agent_busy`)"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/versions": {
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "List an Agent's disk versions",
        "description": "Newest first. Read a version's tree, files, diff and zip through `/v1/artifacts/{artifactId}/versions/{version}/…`.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own",
          "agents:read",
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`"
            },
            "required": true,
            "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The versions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentDiskVersions"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/versions/{version}": {
      "delete": {
        "tags": [
          "Agents"
        ],
        "summary": "Delete an Agent's disk version",
        "description": "Deletes the version, and the stored files no other version names. Refused while a seed reads it.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`"
            },
            "required": true,
            "description": "The Agent id, percent-encoded: `users%2Falice%2Ftriage` for `users/alice/triage`",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "version",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted, or there was none",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "agentId": {
                      "type": "string"
                    },
                    "version": {
                      "type": "number"
                    },
                    "deleted": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "agentId",
                    "version",
                    "deleted"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "409": {
            "description": "A new volume is being seeded from it (`agent_busy`)"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/triggers": {
      "get": {
        "tags": [
          "Triggers"
        ],
        "summary": "List an Agent's triggers",
        "description": "Each trigger its manifest declares, with what the Agent holds of it: its status (`active`, `paused` with a reason, `completed` for an `at` that ran), when it runs next and last ran.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own",
          "agents:read",
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded"
            },
            "required": true,
            "description": "The Agent id, percent-encoded",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The triggers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TriggerList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/triggers/{triggerId}/pause": {
      "post": {
        "tags": [
          "Triggers"
        ],
        "summary": "Pause a trigger",
        "description": "It stops firing until it is resumed; a run already started or queued goes on.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded"
            },
            "required": true,
            "description": "The Agent id, percent-encoded",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The trigger's id in the manifest's `runtime.triggers`"
            },
            "required": true,
            "description": "The trigger's id in the manifest's `runtime.triggers`",
            "name": "triggerId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The Agent's triggers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TriggerList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "409": {
            "description": "An `at` whose time has passed (`trigger_expired`)"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/triggers/{triggerId}/resume": {
      "post": {
        "tags": [
          "Triggers"
        ],
        "summary": "Resume a trigger",
        "description": "It fires again from its next time after now; missed times are not run. An `at` whose time has passed is refused (`trigger_expired`).",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded"
            },
            "required": true,
            "description": "The Agent id, percent-encoded",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The trigger's id in the manifest's `runtime.triggers`"
            },
            "required": true,
            "description": "The trigger's id in the manifest's `runtime.triggers`",
            "name": "triggerId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The Agent's triggers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TriggerList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "409": {
            "description": "An `at` whose time has passed (`trigger_expired`)"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/triggers/{triggerId}/run": {
      "post": {
        "tags": [
          "Triggers"
        ],
        "summary": "Run a trigger now",
        "description": "Runs it once now, paused or not, as if it had fired: a turn on its session, or a queued message when a turn runs there. A retried request with the same `Idempotency-Key` answers the same run.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded"
            },
            "required": true,
            "description": "The Agent id, percent-encoded",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The trigger's id in the manifest's `runtime.triggers`"
            },
            "required": true,
            "description": "The trigger's id in the manifest's `runtime.triggers`",
            "name": "triggerId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "required": true,
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The run",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunTriggerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/runs": {
      "get": {
        "tags": [
          "Triggers"
        ],
        "summary": "List an Agent's runs",
        "description": "Each time one of its triggers fired or was run by hand, newest first: when it was due, whether it was late, and what came of it (`started`, `queued`, `skipped` or `failed`, with a reason), with the session and turn.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own",
          "agents:read",
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded"
            },
            "required": true,
            "description": "The Agent id, percent-encoded",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "description": "A page holds at most the Tenant's Runtime limit `pageItems` (default 200); a larger limit gets that many"
            },
            "required": false,
            "description": "A page holds at most the Tenant's Runtime limit `pageItems` (default 200); a larger limit gets that many",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "cursor",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Only this trigger's runs"
            },
            "required": false,
            "description": "Only this trigger's runs",
            "name": "triggerId",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of runs",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TriggerRunPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/triggers/{triggerId}/secret": {
      "post": {
        "tags": [
          "Triggers"
        ],
        "summary": "Make a webhook trigger's signing secret",
        "description": "A new Standard Webhooks secret (`whsec_…`) for a webhook trigger, shown this once; the one before stops working at once. Give it to the sender with the trigger's `webhookUrl`.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded"
            },
            "required": true,
            "description": "The Agent id, percent-encoded",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The trigger's id in the manifest's `runtime.triggers`"
            },
            "required": true,
            "description": "The trigger's id in the manifest's `runtime.triggers`",
            "name": "triggerId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The secret, this once",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSecretResponse"
                }
              }
            }
          },
          "400": {
            "description": "Not a webhook trigger"
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{endpointId}": {
      "post": {
        "tags": [
          "Triggers"
        ],
        "summary": "Deliver to a webhook trigger",
        "description": "A sender's delivery, signed with Standard Webhooks (`webhook-id`, `webhook-timestamp` within 5 minutes by default, `webhook-signature`): no credential (an `Authorization` header is ignored) and no `Nylorun-Protocol`. The body, any media type, at most the Runtime limit `webhookBodyBytes`, is read as bytes and verified before anything else. It runs the trigger once per `webhook-id`: a retry answers the first run. The body reaches the model as data under the trigger's prompt. Other senders (GitHub, Stripe, Slack) are relayed by an app.",
        "security": [],
        "x-nylorun-credentials": [],
        "x-nylorun-scopes": "any",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The trigger's endpoint id, `wh_…`"
            },
            "required": true,
            "description": "The trigger's endpoint id, `wh_…`",
            "name": "endpointId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The delivery's id; a retry sends the same"
            },
            "required": true,
            "description": "The delivery's id; a retry sends the same",
            "name": "webhook-id",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "Seconds since the epoch"
            },
            "required": true,
            "description": "Seconds since the epoch",
            "name": "webhook-timestamp",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "`v1,<base64>`, space-separated"
            },
            "required": true,
            "description": "`v1,<base64>`, space-separated",
            "name": "webhook-signature",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The payload, of any media type",
          "content": {
            "*/*": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The run it made: started, queued, skipped or failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookAcceptedResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "Unsigned, not signed with the endpoint's secret, or a timestamp out of tolerance"
          },
          "404": {
            "description": "No endpoint has this id"
          },
          "409": {
            "description": "The trigger is paused (`trigger_paused`)"
          },
          "413": {
            "description": "Over `webhookBodyBytes`"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/memories": {
      "get": {
        "tags": [
          "Memory"
        ],
        "summary": "List an Agent's memories",
        "description": "Its memories by path, each with its size, `content_sha256`, frontmatter `description` and version. `pathPrefix` keeps one folder's (`conventions` for `/memories/conventions/…`).",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own",
          "agents:read",
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded"
            },
            "required": true,
            "description": "The Agent id, percent-encoded",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "description": "A page holds at most the Tenant's Runtime limit `pageItems` (default 200); a larger limit gets that many"
            },
            "required": false,
            "description": "A page holds at most the Tenant's Runtime limit `pageItems` (default 200); a larger limit gets that many",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "cursor",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Only the memories in this folder, relative to `/memories`"
            },
            "required": false,
            "description": "Only the memories in this folder, relative to `/memories`",
            "name": "pathPrefix",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of memories",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemoryList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/memories/{path}": {
      "get": {
        "tags": [
          "Memory"
        ],
        "summary": "Read a memory",
        "description": "The memory's content, with its size, `content_sha256`, description and version.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own",
          "agents:read",
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded"
            },
            "required": true,
            "description": "The Agent id, percent-encoded",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The memory's path under `/memories`, percent-encoded: `conventions%2Frelease.md` is `/memories/conventions/release.md`"
            },
            "required": true,
            "description": "The memory's path under `/memories`, percent-encoded: `conventions%2Frelease.md` is `/memories/conventions/release.md`",
            "name": "path",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The memory",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Memory"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "No memory has this path"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Memory"
        ],
        "summary": "Write a memory",
        "description": "Creates the memory or replaces its content, as the `memory` tool's `create` does, and records a version with the caller as its actor. This is how an app seeds an Agent's memory. With `contentSha256` the write applies only while the memory still has that content (`\"\"`: only while no memory has the path); otherwise `409 memory_conflict` with the current memory. The path ends in `.md`; the Runtime limits `memoryBytes` (`413`) and `memoriesPerAgent` (`409 limit_exceeded`) hold.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded"
            },
            "required": true,
            "description": "The Agent id, percent-encoded",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The memory's path under `/memories`, percent-encoded: `conventions%2Frelease.md` is `/memories/conventions/release.md`"
            },
            "required": true,
            "description": "The memory's path under `/memories`, percent-encoded: `conventions%2Frelease.md` is `/memories/conventions/release.md`",
            "name": "path",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutMemoryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The memory as written",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Memory"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "409": {
            "description": "The `contentSha256` precondition no longer holds, or a folder has this path (`memory_conflict`)"
          },
          "413": {
            "description": "Larger than the Runtime limit `memoryBytes`"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Memory"
        ],
        "summary": "Delete a memory or a folder",
        "description": "Deletes the memory, or every memory in the folder the path names, each with a version that records the delete. Versions stay with the Agent.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded"
            },
            "required": true,
            "description": "The Agent id, percent-encoded",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The memory's path under `/memories`, percent-encoded: `conventions%2Frelease.md` is `/memories/conventions/release.md`"
            },
            "required": true,
            "description": "The memory's path under `/memories`, percent-encoded: `conventions%2Frelease.md` is `/memories/conventions/release.md`",
            "name": "path",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "What was deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "integer",
                      "minimum": 0
                    }
                  },
                  "required": [
                    "path",
                    "deleted"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "No memory or folder has this path"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/memory_versions": {
      "get": {
        "tags": [
          "Memory"
        ],
        "summary": "List an Agent's memory versions",
        "description": "Every change to its memories, newest first: the operation, the path (a rename's names its old one), and who made it: `agent:<manifest>@<version>` with the session, turn and trigger run of a turn's write, or the API caller. `path` keeps one memory's.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own",
          "agents:read",
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded"
            },
            "required": true,
            "description": "The Agent id, percent-encoded",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "description": "A page holds at most the Tenant's Runtime limit `pageItems` (default 200); a larger limit gets that many"
            },
            "required": false,
            "description": "A page holds at most the Tenant's Runtime limit `pageItems` (default 200); a larger limit gets that many",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "cursor",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Only this memory's versions, relative to `/memories`"
            },
            "required": false,
            "description": "Only this memory's versions, relative to `/memories`",
            "name": "path",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of versions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemoryVersionPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agentId}/memory_versions/{versionId}": {
      "get": {
        "tags": [
          "Memory"
        ],
        "summary": "Read a memory version",
        "description": "One version with the content it left (`null` for a delete). To roll a memory back, write this content again.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own",
          "agents:read",
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Agent id, percent-encoded"
            },
            "required": true,
            "description": "The Agent id, percent-encoded",
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The version's id (`mv_…`)"
            },
            "required": true,
            "description": "The version's id (`mv_…`)",
            "name": "versionId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemoryVersionDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "No such version"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessions/{sessionId}": {
      "put": {
        "tags": [
          "Sessions API"
        ],
        "summary": "Open a session",
        "description": "Creates the session on an Agent, or answers the one already opened with the same Agent, owner and info. Its Agent (its sandbox and vault) is fixed for its life, and it pins the manifest version the Agent runs. No session is special: an app that keeps one conversation going reuses its id.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "sessionId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutSessionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionView"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "409": {
            "description": "A session with this id was opened with other parameters"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Sessions API"
        ],
        "summary": "Get a session",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "sessionId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionView"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessions": {
      "get": {
        "tags": [
          "Sessions API"
        ],
        "summary": "List sessions",
        "description": "Acting for a person, only theirs.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "description": "A page holds at most the Tenant's Runtime limit `pageItems` (default 200); a larger limit gets that many"
            },
            "required": false,
            "description": "A page holds at most the Tenant's Runtime limit `pageItems` (default 200); a larger limit gets that many",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "cursor",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "agentId",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "idle",
                "runnable",
                "running",
                "waiting",
                "paused",
                "uncertain",
                "completed",
                "failed",
                "cancelled"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "manifest",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "ownerUserId",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The sessions; limit opts into pagination",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/ListSessionsResponse"
                    },
                    {
                      "$ref": "#/components/schemas/SessionPage"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessions/{sessionId}/commands": {
      "post": {
        "tags": [
          "Sessions API"
        ],
        "summary": "Send a command to a session",
        "description": "A message starts a turn, or waits in the session's queue while a turn runs or waits (protocol 17; `delivery: \"reject\"` is refused with `409 session_busy` instead); the others answer what the session waits on, or cancel. Idempotent on the command's `idempotencyKey`.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "sessionId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "W3C trace context: the turn this request starts joins the caller's trace (feature `traces`). A malformed value is ignored"
            },
            "required": false,
            "description": "W3C trace context: the turn this request starts joins the caller's trace (feature `traces`). A malformed value is ignored",
            "name": "traceparent",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "W3C trace context, kept with `traceparent`"
            },
            "required": false,
            "description": "W3C trace context, kept with `traceparent`",
            "name": "tracestate",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The command, accepted; a message may be queued",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/AcceptedResponse"
                    },
                    {
                      "$ref": "#/components/schemas/QueuedResponse"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "409": {
            "description": "A turn is running (`session_busy`), or the session does not wait on this"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "429": {
            "description": "The session's queue is full (`queue_full`)"
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessions/{sessionId}/events": {
      "get": {
        "tags": [
          "Sessions API"
        ],
        "summary": "Follow a session's events",
        "description": "Server-sent events, each with its type as `event` and its cursor as `id`, from the cursor on. Events are on the `nylorun.event/2` envelope, typed by `SessionEvent`; a client ignores a type it does not know. A trusted issuer's token's stream ends with `event: nylorun.closed` when the token expires. A `: keepalive` comment every 15 seconds.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "sessionId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Continue after this event's cursor; `Last-Event-ID` works too"
            },
            "required": false,
            "description": "Continue after this event's cursor; `Last-Event-ID` works too",
            "name": "cursor",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The session's events",
            "content": {
              "text/event-stream": {
                "itemSchema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/CommandMessageEvent"
                    },
                    {
                      "$ref": "#/components/schemas/CommandApproveEvent"
                    },
                    {
                      "$ref": "#/components/schemas/CommandRespondEvent"
                    },
                    {
                      "$ref": "#/components/schemas/TurnCompletedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/TurnPausedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/TurnFailedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/TurnCancelledEvent"
                    },
                    {
                      "$ref": "#/components/schemas/MessageQueuedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/QueueTakenEvent"
                    },
                    {
                      "$ref": "#/components/schemas/WakeBookedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/WakeCancelledEvent"
                    },
                    {
                      "$ref": "#/components/schemas/MemoryUpdatedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/MessageAssistantEvent"
                    },
                    {
                      "$ref": "#/components/schemas/ModelFailedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/ContextCompactedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/ToolCompletedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/EffectUncertainEvent"
                    },
                    {
                      "$ref": "#/components/schemas/DelegationStartedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/DelegationCompletedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/McpDiscoveredEvent"
                    },
                    {
                      "$ref": "#/components/schemas/EnvironmentStateEvent"
                    },
                    {
                      "$ref": "#/components/schemas/EnvironmentExecEvent"
                    },
                    {
                      "$ref": "#/components/schemas/AgentAttachedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/NodeStartedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/NodeCompletedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/NodeAgentEvent"
                    },
                    {
                      "$ref": "#/components/schemas/LoopIterationEvent"
                    },
                    {
                      "$ref": "#/components/schemas/LoopVerifiedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/ArtifactCreatedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/ArtifactVersionCreatedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/ArtifactDeletedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/ArtifactExportSkippedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/ArtifactExportFailedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/TranscriptUpdatedEvent"
                    },
                    {
                      "$ref": "#/components/schemas/StreamClosedFrame"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessions/{sessionId}/items": {
      "get": {
        "tags": [
          "Sessions API"
        ],
        "summary": "Read a session's history",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "sessionId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Continue after this event's cursor; `Last-Event-ID` works too"
            },
            "required": false,
            "description": "Continue after this event's cursor; `Last-Event-ID` works too",
            "name": "cursor",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "description": "A page holds at most the Tenant's Runtime limit `pageItems` (default 200); a larger limit gets that many"
            },
            "required": false,
            "description": "A page holds at most the Tenant's Runtime limit `pageItems` (default 200); a larger limit gets that many",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Only the events of this agent (the root agent, or one it uses as a tool)"
            },
            "required": false,
            "description": "Only the events of this agent (the root agent, or one it uses as a tool)",
            "name": "agent",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "Events up to now; limit returns a bounded page and tail",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SessionItemsResponse"
                    },
                    {
                      "$ref": "#/components/schemas/HistoryPage"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessions/{sessionId}/manifest": {
      "get": {
        "tags": [
          "Sessions API"
        ],
        "summary": "Read the session's pinned manifest",
        "security": [
          {
            "applicationKey": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject"
        ],
        "x-nylorun-scopes": [
          "agents:read",
          "agents:write"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "sessionId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The pinned public manifest",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionManifestView"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), or one the Tenant does not accept (`credential_invalid`), with a `WWW-Authenticate: Bearer` challenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessions/{sessionId}/usage": {
      "get": {
        "tags": [
          "Sessions API"
        ],
        "summary": "Read a session's recorded model usage",
        "security": [
          {
            "applicationKey": []
          }
        ],
        "x-nylorun-credentials": [
          "application"
        ],
        "x-nylorun-scopes": "never",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "sessionId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "turnId",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "Recorded usage, including duplicate billed calls",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionUsageTotals"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), or one the Tenant does not accept (`credential_invalid`), with a `WWW-Authenticate: Bearer` challenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessions/{sessionId}/calls/model": {
      "get": {
        "tags": [
          "Sessions API"
        ],
        "summary": "Page a session's model calls",
        "security": [
          {
            "applicationKey": []
          }
        ],
        "x-nylorun-credentials": [
          "application"
        ],
        "x-nylorun-scopes": "never",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "sessionId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "turnId",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "description": "A page holds at most the Tenant's Runtime limit `pageItems` (default 200); a larger limit gets that many. Default 50, or that limit when it is lower"
            },
            "required": false,
            "description": "A page holds at most the Tenant's Runtime limit `pageItems` (default 200); a larger limit gets that many. Default 50, or that limit when it is lower",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "cursor",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "Recorded usage, including duplicate billed calls",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelCallsPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), or one the Tenant does not accept (`credential_invalid`), with a `WWW-Authenticate: Bearer` challenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessions/{sessionId}/calls/tool": {
      "get": {
        "tags": [
          "Sessions API"
        ],
        "summary": "Page a session's tool calls",
        "security": [
          {
            "applicationKey": []
          }
        ],
        "x-nylorun-credentials": [
          "application"
        ],
        "x-nylorun-scopes": "never",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "sessionId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "turnId",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "description": "A page holds at most the Tenant's Runtime limit `pageItems` (default 200); a larger limit gets that many. Default 50, or that limit when it is lower"
            },
            "required": false,
            "description": "A page holds at most the Tenant's Runtime limit `pageItems` (default 200); a larger limit gets that many. Default 50, or that limit when it is lower",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "cursor",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "Each tool call in the order it was first sent, with its status and sends",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolCallsPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), or one the Tenant does not accept (`credential_invalid`), with a `WWW-Authenticate: Bearer` challenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessions/{sessionId}/turns/{turnId}/trace": {
      "get": {
        "tags": [
          "Sessions API"
        ],
        "summary": "Read a turn's trace",
        "description": "The turn's spans as OTLP/HTTP JSON (`resourceSpans`), as the Runtime posts them to an OTLP collector: a root span for the turn, a span for each model, tool and egress crossing, ids derived so every read agrees. Post it to a collector's `/v1/traces` to backfill. A turn still running has no root span yet; a turn the session never had has no spans.",
        "security": [
          {
            "applicationKey": []
          }
        ],
        "x-nylorun-credentials": [
          "application"
        ],
        "x-nylorun-scopes": "never",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "sessionId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "turnId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The turn's spans",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TurnTrace"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), or one the Tenant does not accept (`credential_invalid`), with a `WWW-Authenticate: Bearer` challenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessions/{sessionId}/sandbox/{tool}": {
      "post": {
        "tags": [
          "Sessions API"
        ],
        "summary": "Run a sandbox tool in a session",
        "description": "For an app's own tools; not while a turn is running.",
        "security": [
          {
            "applicationKey": []
          }
        ],
        "x-nylorun-credentials": [
          "application"
        ],
        "x-nylorun-scopes": "never",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "sessionId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "bash",
                "read",
                "write",
                "edit",
                "grep",
                "glob"
              ]
            },
            "required": true,
            "name": "tool",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": {},
                "description": "The tool's input"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The tool's output, or why it failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SandboxToolOutcome"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), or one the Tenant does not accept (`credential_invalid`), with a `WWW-Authenticate: Bearer` challenge",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "409": {
            "description": "A turn is running"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/ag-ui/agents/{agentId}": {
      "post": {
        "tags": [
          "AG-UI"
        ],
        "summary": "Run an agent",
        "description": "For a person, named by a trusted issuer's token or by `Nylorun-Subject`. The thread is one session per person, agent and thread, created on its first run with `forwardedProps.nylorun.session`. The trailing user message starts a turn (its id is the idempotency key); its media parts are files: bytes sent inline (`data`, at most 20 MiB each) are stored as artifacts of the session, a `file` source with provider `nylorun` names an artifact, and a URL is refused. `resume` answers interrupts. A busy session is a `RUN_ERROR` in the stream; any file type is accepted, and the agent's harness decides how its model sees it.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "W3C trace context: the turn this request starts joins the caller's trace (feature `traces`). A malformed value is ignored"
            },
            "required": false,
            "description": "W3C trace context: the turn this request starts joins the caller's trace (feature `traces`). A malformed value is ignored",
            "name": "traceparent",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "W3C trace context, kept with `traceparent`"
            },
            "required": false,
            "description": "W3C trace context, kept with `traceparent`",
            "name": "tracestate",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgUiRunAgentInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The run's events, from RUN_STARTED to its end",
            "content": {
              "text/event-stream": {
                "itemSchema": {
                  "$ref": "#/components/schemas/AgUiEvent"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/ag-ui/agents/{agentId}/threads/{threadId}/events": {
      "get": {
        "tags": [
          "AG-UI"
        ],
        "summary": "Reattach to a run",
        "description": "The rest of a run after a dropped connection, from `Last-Event-ID` or `cursor`.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "threadId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "cursor",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The run to report events as"
            },
            "required": false,
            "description": "The run to report events as",
            "name": "runId",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The run's remaining events",
            "content": {
              "text/event-stream": {
                "itemSchema": {
                  "$ref": "#/components/schemas/AgUiEvent"
                }
              }
            }
          },
          "204": {
            "description": "Nothing to send: no run is going, and none ended after the cursor"
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/ag-ui/agents/{agentId}/threads/{threadId}/messages": {
      "get": {
        "tags": [
          "AG-UI"
        ],
        "summary": "Get a thread's messages",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "threadId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The thread's messages; none before its first run",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AgUiMessage"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/ag-ui/agents/{agentId}/threads/{threadId}/cancel": {
      "post": {
        "tags": [
          "AG-UI"
        ],
        "summary": "Cancel a thread's running turn",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "threadId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "204": {
            "description": "Cancelled"
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/a2a/agents/{agentId}/card": {
      "get": {
        "tags": [
          "A2A"
        ],
        "summary": "Get an agent's A2A card",
        "externalDocs": {
          "description": "The A2A specification",
          "url": "https://a2a-protocol.org/latest/specification/"
        },
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "agents:read",
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The card",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/A2aAgentCard"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/a2a/agents/{agentId}": {
      "post": {
        "tags": [
          "A2A"
        ],
        "summary": "Call an agent over A2A",
        "description": "A2A 1.0 JSON-RPC, for a subject: `SendMessage` (blocking up to the Runtime limit `a2aWaitMs`, 5 minutes by default, or `returnImmediately`), `GetTask` and `CancelTask`. A message is text, one data part, or text and `raw` files (at most the Runtime limit `inlineFileBytes` each, 20 MiB by default, stored as artifacts of the context's session); a file `url` is `ContentTypeNotSupportedError`. A context is one session per subject, agent and `contextId`; a task is one turn. JSON-RPC errors are answered with 200; limits, scopes and unavailable streams stay HTTP errors.",
        "externalDocs": {
          "description": "The A2A specification",
          "url": "https://a2a-protocol.org/latest/specification/"
        },
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "agentId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Or the `A2A-Version` header: `1.0`"
            },
            "required": false,
            "description": "Or the `A2A-Version` header: `1.0`",
            "name": "A2A-Version",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "W3C trace context: the turn this request starts joins the caller's trace (feature `traces`). A malformed value is ignored"
            },
            "required": false,
            "description": "W3C trace context: the turn this request starts joins the caller's trace (feature `traces`). A malformed value is ignored",
            "name": "traceparent",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "W3C trace context, kept with `traceparent`"
            },
            "required": false,
            "description": "W3C trace context, kept with `traceparent`",
            "name": "tracestate",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/A2aJsonRpcRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The JSON-RPC answer: a result, or an A2A error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/A2aJsonRpcResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/artifacts": {
      "post": {
        "tags": [
          "Artifacts"
        ],
        "summary": "Upload a file as a new artifact",
        "description": "Streams the body to the Object store in one request, up to the Tenant's per-file limit and within its total; a body past either stores nothing (`413 limit_exceeded`). Its `Content-Type` is the file's media type (default: from the name). Acting for a person, the artifact belongs to one of their sessions. A session's artifact appears in its history as `artifact.created`.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The file's name, e.g. `brief.pdf`"
            },
            "required": true,
            "description": "The file's name, e.g. `brief.pdf`",
            "name": "name",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The session it belongs to"
            },
            "required": false,
            "description": "The session it belongs to",
            "name": "sessionId",
            "in": "query"
          },
          {
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ],
              "description": "`key=value`; repeat it for several labels"
            },
            "required": false,
            "description": "`key=value`; repeat it for several labels",
            "name": "label",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The file's bytes; `Content-Type` is its media type",
          "content": {
            "*/*": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The artifact and its first version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadArtifactResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "413": {
            "description": "Larger than the per-file limit, or past the Tenant's total (`limit_exceeded`)"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Artifacts"
        ],
        "summary": "List artifacts",
        "description": "Without limit, the existing metadata list, oldest first. Explicit limit (1–200) opts into metadata pages ordered by creation time and artifact ID descending, with an opaque nextCursor bound to the Tenant and filters. sessionId selects only that session's artifacts, excluding Tenant-owned artifacts. Paged reads support kind and repeated label=key=value equality filters. An application key as itself sees all artifacts, including Tenant-owned; a caller acting for a person sees only their sessions' artifacts of allowed agents. Authorization is checked on every page. Newer inserts appear on a fresh traversal, not in pages already passed.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "description": "A page holds at most the Tenant's Runtime limit `pageItems` (default 200); a larger limit gets that many"
            },
            "required": false,
            "description": "A page holds at most the Tenant's Runtime limit `pageItems` (default 200); a larger limit gets that many",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "cursor",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Only artifacts belonging to this session; excludes Tenant-owned artifacts"
            },
            "required": false,
            "description": "Only artifacts belonging to this session; excludes Tenant-owned artifacts",
            "name": "sessionId",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "file",
                "folder"
              ]
            },
            "required": false,
            "name": "kind",
            "in": "query"
          },
          {
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ],
              "description": "`key=value`; repeat it for several labels"
            },
            "required": false,
            "description": "`key=value`; repeat it for several labels",
            "name": "label",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The artifacts; explicit limit opts into pagination",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/ListArtifactsResponse"
                    },
                    {
                      "$ref": "#/components/schemas/ArtifactPage"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/artifacts/{artifactId}": {
      "get": {
        "tags": [
          "Artifacts"
        ],
        "summary": "Get an artifact",
        "description": "Its metadata and every version, oldest first.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "artifactId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The artifact",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArtifactView"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Artifacts"
        ],
        "summary": "Delete an artifact",
        "description": "Deletes every version and its bytes; its links stop working. A session's artifact gets `artifact.deleted` in its history. An Agent's disk versions are deleted through `/v1/agents/{agentId}/versions/{version}` (`409` here).",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "artifactId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteArtifactResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "409": {
            "description": "The artifact holds an Agent's disk versions"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/artifacts/{artifactId}/versions": {
      "post": {
        "tags": [
          "Artifacts"
        ],
        "summary": "Upload a new version of an artifact",
        "description": "Streams the body as the artifact's next version, with the same limits as a new artifact. A session's artifact gets `artifact.version.created` in its history.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "artifactId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The file's bytes; `Content-Type` is its media type",
          "content": {
            "*/*": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The artifact and the version the upload created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadArtifactResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "413": {
            "description": "Larger than the per-file limit, or past the Tenant's total (`limit_exceeded`)"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/artifacts/{artifactId}/versions/{version}/content": {
      "get": {
        "tags": [
          "Artifacts"
        ],
        "summary": "Download a version of an artifact",
        "description": "Streams the bytes through the Runtime. One `Range: bytes=…` gives `206` with `Content-Range`; several ranges give the whole file. A folder is a `400`: read its tree, its files or its zip.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "artifactId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "A version number, or `latest`"
            },
            "required": true,
            "description": "A version number, or `latest`",
            "name": "version",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The file",
            "headers": {
              "Accept-Ranges": {
                "schema": {
                  "type": "string",
                  "description": "`bytes`"
                },
                "required": true,
                "description": "`bytes`"
              },
              "Content-Range": {
                "schema": {
                  "type": "string",
                  "description": "The bytes sent, on a `206`: `bytes <start>-<end>/<size>`"
                },
                "required": false,
                "description": "The bytes sent, on a `206`: `bytes <start>-<end>/<size>`"
              },
              "ETag": {
                "schema": {
                  "type": "string",
                  "description": "The version's SHA-256, quoted"
                },
                "required": true,
                "description": "The version's SHA-256, quoted"
              }
            },
            "content": {
              "*/*": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "206": {
            "description": "The bytes the `Range` header asked for",
            "headers": {
              "Accept-Ranges": {
                "schema": {
                  "type": "string",
                  "description": "`bytes`"
                },
                "required": true,
                "description": "`bytes`"
              },
              "Content-Range": {
                "schema": {
                  "type": "string",
                  "description": "The bytes sent, on a `206`: `bytes <start>-<end>/<size>`"
                },
                "required": false,
                "description": "The bytes sent, on a `206`: `bytes <start>-<end>/<size>`"
              },
              "ETag": {
                "schema": {
                  "type": "string",
                  "description": "The version's SHA-256, quoted"
                },
                "required": true,
                "description": "The version's SHA-256, quoted"
              }
            },
            "content": {
              "*/*": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "416": {
            "description": "The `Range` starts past the end of the file"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/artifacts/{artifactId}/versions/{version}/tree": {
      "get": {
        "tags": [
          "Artifacts"
        ],
        "summary": "List a folder version's files",
        "description": "The folder version's manifest: every file's path, size, SHA-256 and media type, sorted by path. A file artifact is a `400`.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "artifactId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "A version number, or `latest`"
            },
            "required": true,
            "description": "A version number, or `latest`",
            "name": "version",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The files",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArtifactTree"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/artifacts/{artifactId}/versions/{version}/files/{path}": {
      "get": {
        "tags": [
          "Artifacts"
        ],
        "summary": "Download one file of a folder version",
        "description": "Streams the file at `path` (its path in the folder, with `/` percent-encoded as `%2F`) through the Runtime, with Range as for a file artifact.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "artifactId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "A version number, or `latest`"
            },
            "required": true,
            "description": "A version number, or `latest`",
            "name": "version",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The file's path in the folder, percent-encoded"
            },
            "required": true,
            "description": "The file's path in the folder, percent-encoded",
            "name": "path",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The file",
            "headers": {
              "Accept-Ranges": {
                "schema": {
                  "type": "string",
                  "description": "`bytes`"
                },
                "required": true,
                "description": "`bytes`"
              },
              "Content-Range": {
                "schema": {
                  "type": "string",
                  "description": "The bytes sent, on a `206`: `bytes <start>-<end>/<size>`"
                },
                "required": false,
                "description": "The bytes sent, on a `206`: `bytes <start>-<end>/<size>`"
              },
              "ETag": {
                "schema": {
                  "type": "string",
                  "description": "The version's SHA-256, quoted"
                },
                "required": true,
                "description": "The version's SHA-256, quoted"
              }
            },
            "content": {
              "*/*": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "206": {
            "description": "The bytes the `Range` header asked for",
            "headers": {
              "Accept-Ranges": {
                "schema": {
                  "type": "string",
                  "description": "`bytes`"
                },
                "required": true,
                "description": "`bytes`"
              },
              "Content-Range": {
                "schema": {
                  "type": "string",
                  "description": "The bytes sent, on a `206`: `bytes <start>-<end>/<size>`"
                },
                "required": false,
                "description": "The bytes sent, on a `206`: `bytes <start>-<end>/<size>`"
              },
              "ETag": {
                "schema": {
                  "type": "string",
                  "description": "The version's SHA-256, quoted"
                },
                "required": true,
                "description": "The version's SHA-256, quoted"
              }
            },
            "content": {
              "*/*": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "416": {
            "description": "The `Range` starts past the end of the file"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/artifacts/{artifactId}/versions/{version}/diff": {
      "get": {
        "tags": [
          "Artifacts"
        ],
        "summary": "Compare two folder versions",
        "description": "The files added, removed and changed from version `from` (default: the one before) to this one. Version 1 without `from` lists every file as added.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "artifactId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "A version number, or `latest`"
            },
            "required": true,
            "description": "A version number, or `latest`",
            "name": "version",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The version to compare against"
            },
            "required": false,
            "description": "The version to compare against",
            "name": "from",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "What changed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArtifactDiff"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/artifacts/{artifactId}/versions/{version}/zip": {
      "get": {
        "tags": [
          "Artifacts"
        ],
        "summary": "Download a folder version as a zip",
        "description": "Streams the folder's files as one zip archive (deflated, UTF-8 names), read from the Object store as it goes. A file artifact is a `400`.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "artifactId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "A version number, or `latest`"
            },
            "required": true,
            "description": "A version number, or `latest`",
            "name": "version",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The zip archive",
            "content": {
              "application/zip": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/artifacts/{artifactId}/links": {
      "post": {
        "tags": [
          "Artifacts"
        ],
        "summary": "Mint a capability link",
        "description": "A short-lived path that downloads one version, with Range, with no other credential: for `<img>` tags, UIs and sharing. Signed by the Runtime with the Tenant's signing key; at most 15 minutes; it opens nothing once the artifact is deleted. A folder's link opens its zip, or with `file` that one file.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": [
          "sessions:own"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "artifactId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateArtifactLinkRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArtifactLink"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/v1/artifact-links/{token}": {
      "get": {
        "tags": [
          "Artifacts"
        ],
        "summary": "Open a capability link",
        "description": "Downloads the version the link names, with Range, until it expires (`401 token_expired`): a file, a folder's file, or a folder's zip. Needs no credential and no `Nylorun-Protocol`.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "issuerToken": []
          },
          {}
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "token"
        ],
        "x-nylorun-scopes": "any",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "token",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": false,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The file",
            "headers": {
              "Accept-Ranges": {
                "schema": {
                  "type": "string",
                  "description": "`bytes`"
                },
                "required": true,
                "description": "`bytes`"
              },
              "Content-Range": {
                "schema": {
                  "type": "string",
                  "description": "The bytes sent, on a `206`: `bytes <start>-<end>/<size>`"
                },
                "required": false,
                "description": "The bytes sent, on a `206`: `bytes <start>-<end>/<size>`"
              },
              "ETag": {
                "schema": {
                  "type": "string",
                  "description": "The version's SHA-256, quoted"
                },
                "required": true,
                "description": "The version's SHA-256, quoted"
              }
            },
            "content": {
              "*/*": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "206": {
            "description": "The bytes the `Range` header asked for",
            "headers": {
              "Accept-Ranges": {
                "schema": {
                  "type": "string",
                  "description": "`bytes`"
                },
                "required": true,
                "description": "`bytes`"
              },
              "Content-Range": {
                "schema": {
                  "type": "string",
                  "description": "The bytes sent, on a `206`: `bytes <start>-<end>/<size>`"
                },
                "required": false,
                "description": "The bytes sent, on a `206`: `bytes <start>-<end>/<size>`"
              },
              "ETag": {
                "schema": {
                  "type": "string",
                  "description": "The version's SHA-256, quoted"
                },
                "required": true,
                "description": "The version's SHA-256, quoted"
              }
            },
            "content": {
              "*/*": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential or subject scope (`scope_required`; a token also gets `WWW-Authenticate: Bearer error=\"insufficient_scope\"` and the scope), a key of the other API (`key_role_mismatch`), or an application key from a browser (`origin_rejected`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "416": {
            "description": "The `Range` starts past the end of the file"
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "tags": [
          "Service"
        ],
        "summary": "Check the Runtime",
        "description": "The protocol range and features a client checks first. Refuses an `Origin`.",
        "responses": {
          "200": {
            "description": "The Runtime is up",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          }
        }
      }
    },
    "/ready": {
      "get": {
        "tags": [
          "Service"
        ],
        "summary": "Check the Runtime is ready",
        "description": "The listener, the Tenant (open), Postgres, Restate and S2, and the open Tenant's harnesses.",
        "responses": {
          "200": {
            "description": "Ready",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ready"
                }
              }
            }
          },
          "503": {
            "description": "Not ready: `checks` says what is not"
          }
        }
      }
    },
    "/v1/me": {
      "get": {
        "tags": [
          "Service"
        ],
        "summary": "Get who the caller is",
        "description": "The subject, scopes and Agent grants of the credential that sends it: an application key (alone or acting for a subject), a management key (`via: management:<principalId>`, no scopes, no agents), or a trusted issuer's token (`via: issuer:<name>`).",
        "security": [
          {
            "applicationKey": []
          },
          {
            "managementKey": []
          },
          {
            "issuerToken": []
          }
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "management",
          "token"
        ],
        "x-nylorun-scopes": "any",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The caller",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential, a key of the other API (`key_role_mismatch`), a key from a browser (`origin_rejected`) or a management key acting for a subject",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/oauth-protected-resource": {
      "get": {
        "tags": [
          "Service"
        ],
        "summary": "Get the protected resource metadata",
        "description": "OAuth 2.0 Protected Resource Metadata (RFC 9728): the identity providers whose access tokens the Runtime API accepts (the identity file's trusted issuers) and their scopes. Nylorun is never the authorization server: a client signs in at one of `authorization_servers` and presents its token as `Authorization: Bearer`. A `401` from the Runtime API names this document in `WWW-Authenticate` (`resource_metadata`). Needs no key or `Nylorun-Protocol`, and accepts an `Origin`.",
        "responses": {
          "200": {
            "description": "The metadata",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtectedResourceMetadata"
                }
              }
            }
          },
          "404": {
            "description": "The Runtime trusts no identity provider (no identity file)"
          }
        }
      }
    },
    "/v1/access/jwks": {
      "get": {
        "tags": [
          "Service"
        ],
        "summary": "Get the public keys the Runtime's tokens are signed with",
        "description": "A JSON Web Key Set, to verify a token the Runtime signed without calling it. No credential is needed.",
        "security": [
          {
            "applicationKey": []
          },
          {
            "managementKey": []
          },
          {
            "issuerToken": []
          },
          {}
        ],
        "x-nylorun-credentials": [
          "application",
          "subject",
          "management",
          "token"
        ],
        "x-nylorun-scopes": "any",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The protocol version, `18`"
            },
            "required": true,
            "description": "The protocol version, `18`",
            "name": "Nylorun-Protocol",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The person an application key acts for"
            },
            "required": false,
            "description": "The person an application key acts for",
            "name": "Nylorun-Subject",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "description": "The subject's space-separated scopes; required with a subject"
            },
            "required": false,
            "description": "The subject's space-separated scopes; required with a subject",
            "name": "Nylorun-Scopes",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "The public keys",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Jwks"
                }
              }
            }
          },
          "400": {
            "description": "Invalid headers, path, body or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "401": {
            "description": "No credential (`credential_required`), one the Tenant does not accept (`credential_invalid`), a token that expired (`token_expired`), or a token whose issuer's keys cannot be fetched now (`issuer_unavailable`). `WWW-Authenticate: Bearer` names the protected resource metadata (`resource_metadata`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "403": {
            "description": "Not allowed for this credential, a key of the other API (`key_role_mismatch`), a key from a browser (`origin_rejected`) or a management key acting for a subject",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "404": {
            "description": "Not found (`not_found`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          },
          "426": {
            "description": "`Nylorun-Protocol` missing or unsupported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolRejected"
                }
              }
            }
          },
          "503": {
            "description": "The Tenant's storage or streams are unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rejected"
                }
              }
            }
          }
        }
      }
    },
    "/openapi/runtime.json": {
      "get": {
        "tags": [
          "Service"
        ],
        "summary": "Get the Runtime API's document",
        "description": "This document. `/openapi.json` is the same.",
        "responses": {
          "200": {
            "description": "The Runtime API's OpenAPI document"
          }
        }
      }
    }
  },
  "webhooks": {},
  "tags": [
    {
      "name": "Agent manifests",
      "description": "Named, versioned agent manifests (protocol 16): one document with what runs inside an agent's loop (`harness`) and what the Runtime provides around it (`runtime`), checked against each other when it is saved. Save one with a plan first (`?dryRun=true`) and `If-Match`; an Agent runs one version at a time, and a save moves every Agent that tracks the manifest to the new version, while a pinned one stays. `client.agentManifests` in `@nylorun/agents`, and `nylorun apply`."
    },
    {
      "name": "Definition files",
      "description": "The files an agent manifest names by the SHA-256 of their bytes (each skill's folder, a runtime section's input files): upload each once before saving the manifest, which is refused while it names one the Runtime does not hold (`definition_files_missing`) or a skill whose files hold more than its skill limit together (`limit_exceeded`; `/v1/tenant/skills`, default 2 GiB). No file and no count of files has a limit of its own. `client.agentManifests.save` in `@nylorun/agents` does both."
    },
    {
      "name": "Agents",
      "description": "The live instances of agent manifests: an Agent has a stable id, its manifest version, one sandbox (a virtual workspace, a pod with its own volume, or none), one vault of secrets for its shell, MCP servers and HTTP tools, its disk versions, and its sessions. Its `state` says whether it is working, sleeping, needs a person (`input_required`), is failing or paused. Create or find one from a saved manifest, watch its lifecycle, stop, reset, fork or delete it, and write its secrets. In `@nylorun/agents`."
    },
    {
      "name": "Triggers",
      "description": "What starts an Agent's turns with no client connected: the schedules, one-shot times and webhook endpoints its manifest's `runtime.triggers` declare. Each trigger's status is the Agent's: pause and resume it, run it now, make a webhook trigger's signing secret, and read its runs (`started`, `queued`, `skipped` or `failed`, with a reason). In `@nylorun/agents` and `nylorun agents triggers`."
    },
    {
      "name": "Memory",
      "description": "An Agent's memories: Markdown files under `/memories` it keeps across sessions, wakes and upgrades, shaped like Anthropic's memory stores. List and read them, write one whole (with a `content_sha256` precondition), delete one or a folder, and read the version every change leaves, with who made it. In `@nylorun/agents` and `nylorun agents memories`."
    },
    {
      "name": "Sessions API",
      "description": "A conversation with an Agent: open a session on it, send commands, follow its events, read its history. No session is special: an app that keeps one conversation going reuses its id. In `@nylorun/agents`."
    },
    {
      "name": "AG-UI",
      "description": "The same sessions through AG-UI: a thread is one session per person, Agent and thread, and each run is a turn."
    },
    {
      "name": "A2A",
      "description": "The same sessions through Agent2Agent: a context is one session per subject, Agent and `contextId`, and a task is one turn; every caller's session runs on the Agent's disk and vault, so an app that serves several audiences makes an Agent for each. The card is how an A2A client finds the Agent."
    },
    {
      "name": "Artifacts",
      "description": "Files and folders agents and people produce, versioned, with short-lived capability links to share them. In `@nylorun/agents`."
    },
    {
      "name": "Service",
      "description": "Check a Runtime is up and speaks your protocol, ask who your credential is, find the identity providers it takes tokens from, and read the public keys of the tokens it signs. `/health`, `/ready`, the protected resource metadata, the JWKS and the documents need no key."
    }
  ],
  "x-tagGroups": [
    {
      "name": "Agents",
      "tags": [
        "Agent manifests",
        "Definition files",
        "Agents",
        "Triggers",
        "Memory"
      ]
    },
    {
      "name": "Sessions",
      "tags": [
        "Sessions API",
        "AG-UI",
        "A2A"
      ]
    },
    {
      "name": "Artifacts",
      "tags": [
        "Artifacts"
      ]
    },
    {
      "name": "Service",
      "tags": [
        "Service"
      ]
    }
  ]
}
