{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:shiin:schema:action-request:v1",
  "title": "Shiin action request",
  "type": "object",
  "required": [
    "schema",
    "id",
    "session",
    "agent",
    "action_type",
    "effects",
    "policy_snapshot",
    "host",
    "workspace"
  ],
  "properties": {
    "schema": {
      "type": "string",
      "const": "shiin.action-request/v1-draft.1"
    },
    "id": {
      "$ref": "urn:shiin:schema:common:v1#/$defs/uuid_v4"
    },
    "session": {
      "type": "string",
      "minLength": 1
    },
    "agent": {
      "$ref": "urn:shiin:schema:common:v1#/$defs/agent_identity"
    },
    "action_type": {
      "type": "string",
      "minLength": 1
    },
    "effects": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "urn:shiin:schema:common:v1#/$defs/effect"
      }
    },
    "task": {
      "type": [
        "string",
        "null"
      ]
    },
    "policy_snapshot": {
      "$ref": "urn:shiin:schema:common:v1#/$defs/sha256"
    },
    "host": {
      "type": "object",
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "tool": {
          "type": "string"
        },
        "payload": {
          "type": [
            "object",
            "null"
          ]
        }
      },
      "additionalProperties": false
    },
    "workspace": {
      "type": "object",
      "description": "The project the agent is working in. Workspace-relative policy globs resolve against its root.",
      "required": [
        "root"
      ],
      "properties": {
        "root": {
          "type": "string",
          "minLength": 1,
          "description": "Absolute, canonical path of the workspace root."
        },
        "vcs": {
          "type": "string",
          "description": "Version control system in use, when known."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
