{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$ref": "#/definitions/SetupAgentsWorkflowExecuteResult",
  "definitions": {
    "SetupAgentsWorkflowExecuteResult": {
      "type": "object",
      "properties": {
        "storyId": {
          "type": "string"
        },
        "runtime": {
          "type": "string"
        },
        "phases": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "phase": {
                "$ref": "#/definitions/WorkflowPhase"
              },
              "status": {
                "type": "string",
                "enum": ["done", "failed", "skipped", "delegated"]
              },
              "exitCode": {
                "type": "number"
              }
            },
            "required": ["phase", "status"],
            "additionalProperties": false
          }
        },
        "dryRun": {
          "type": "boolean"
        },
        "cwd": {
          "type": "string"
        },
        "background": {
          "type": "boolean",
          "description": "GH-746: true when the phase was dispatched via the bridge instead of running inline (the default inside a chat session; see --foreground)."
        },
        "delegatedSessionId": {
          "type": "string",
          "description": "The spawn session id returned by the bridge for the delegated phase, when background is true."
        }
      },
      "required": ["storyId", "runtime", "phases", "dryRun", "cwd"],
      "additionalProperties": false
    },
    "WorkflowPhase": {
      "type": "string",
      "enum": ["pm", "ba", "architect", "ux", "developer", "security-review", "qa", "document-review", "release"]
    }
  }
}
