{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "contract": {
      "type": "string",
      "const": "AgentSessionContinuationResult"
    },
    "idempotencyKey": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256
    },
    "threadId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256
    },
    "lineage": {
      "type": "object",
      "properties": {
        "forkedFromThreadId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "forkedFromMessageId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "sourceRunId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        }
      },
      "required": [
        "forkedFromThreadId",
        "forkedFromMessageId",
        "sourceRunId"
      ],
      "additionalProperties": false
    },
    "inheritance": {
      "type": "object",
      "properties": {
        "messages": {
          "type": "string",
          "enum": [
            "through-source-message",
            "exclude"
          ]
        },
        "attachments": {
          "type": "string",
          "enum": [
            "inherit",
            "exclude"
          ]
        },
        "summaries": {
          "type": "string",
          "enum": [
            "inherit",
            "exclude"
          ]
        },
        "toolResults": {
          "type": "string",
          "enum": [
            "inherit",
            "exclude"
          ]
        },
        "codeChanges": {
          "type": "string",
          "enum": [
            "inherit",
            "exclude"
          ]
        }
      },
      "required": [
        "messages",
        "attachments",
        "summaries",
        "toolResults",
        "codeChanges"
      ],
      "additionalProperties": false
    },
    "unavailableResources": {
      "default": [],
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "messageId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "kind": {
            "type": "string",
            "enum": [
              "attachment",
              "tool-result",
              "code-change"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "excluded",
              "unavailable",
              "unsupported"
            ]
          }
        },
        "required": [
          "messageId",
          "kind",
          "reason"
        ],
        "additionalProperties": false
      }
    },
    "duplicate": {
      "type": "boolean"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
    }
  },
  "required": [
    "contract",
    "idempotencyKey",
    "threadId",
    "lineage",
    "inheritance",
    "unavailableResources",
    "duplicate",
    "createdAt"
  ],
  "additionalProperties": false,
  "$id": "https://schemas.infmonkeys.com/contracts/agent-session-continuation-result.schema.json",
  "title": "agent-session-continuation-result"
}
