{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pipelinexlab.com/contracts/pxflow-direct.v1.schema.json",
  "title": "PipelineXLab PXFLOW direct document v1",
  "description": "Normative closed schema for the .pxflow direct document. The human authority is Report_Doc/docs/specification/serialization-and-files.md.",
  "$comment": "RFC-001 owns this document shape and member order. RFC-002 owns semantic keys and sha256 content-digest references, RFC-003 owns TypeDescriptor kinds and bounds, and RFC-005 owns package release references; this schema consumes those accepted contracts without changing them.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "flowKey",
    "label",
    "description",
    "inputs",
    "results",
    "nodes",
    "groups",
    "externalSubflows",
    "presentation",
    "dependencies",
    "authoring"
  ],
  "properties": {
    "schemaVersion": {
      "const": 1
    },
    "flowKey": {
      "$ref": "#/$defs/semanticKey"
    },
    "label": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "typeDefinitions": {
      "$ref": "#/$defs/typeDefinitions"
    },
    "inputs": {
      "type": "array",
      "maxItems": 100000,
      "items": {
        "$ref": "#/$defs/inputPort"
      }
    },
    "results": {
      "type": "array",
      "maxItems": 100000,
      "items": {
        "$ref": "#/$defs/resultPort"
      }
    },
    "nodes": {
      "type": "array",
      "maxItems": 100000,
      "items": {
        "$ref": "#/$defs/node"
      }
    },
    "groups": {
      "type": "array",
      "maxItems": 100000,
      "items": {
        "$ref": "#/$defs/group"
      }
    },
    "externalSubflows": {
      "type": "array",
      "maxItems": 100000,
      "items": {
        "$ref": "#/$defs/externalSubflow"
      }
    },
    "presentation": {
      "$ref": "#/$defs/presentation"
    },
    "dependencies": {
      "type": "array",
      "maxItems": 100000,
      "items": {
        "$ref": "#/$defs/packageReleaseRef"
      }
    },
    "authoring": {
      "$ref": "#/$defs/authoring"
    }
  },
  "$defs": {
    "semanticKey": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$"
    },
    "semanticVersion": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
    },
    "contentDigest": {
      "type": "string",
      "pattern": "^sha256:[0-9a-f]{64}$"
    },
    "unitCode": {
      "type": "string",
      "minLength": 1,
      "enum": [
        "1",
        "%",
        "[ppm]",
        "mm",
        "cm",
        "m",
        "km",
        "[in_i]",
        "[ft_i]",
        "mg",
        "g",
        "kg",
        "t",
        "ms",
        "s",
        "min",
        "h",
        "rad",
        "deg",
        "N",
        "kN",
        "MN",
        "Pa",
        "kPa",
        "MPa",
        "GPa",
        "N/mm2",
        "N.m",
        "kN.m",
        "kg/m3",
        "m/s2",
        "K"
      ]
    },
    "simpleTypeDescriptor": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind"
      ],
      "properties": {
        "kind": {
          "allOf": [
            {
              "$ref": "./type-diagnostic-profile.v1.schema.json#/$defs/typeKind"
            },
            {
              "not": {
                "enum": [
                  "enum",
                  "record",
                  "list",
                  "table"
                ]
              }
            }
          ]
        }
      }
    },
    "enumTypeDescriptor": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "values"
      ],
      "properties": {
        "kind": {
          "const": "enum"
        },
        "values": {
          "type": "array",
          "maxItems": 100000,
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/semanticKey"
          }
        }
      }
    },
    "recordTypeDescriptor": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "recordKey"
      ],
      "properties": {
        "kind": {
          "const": "record"
        },
        "recordKey": {
          "$ref": "#/$defs/semanticKey"
        }
      }
    },
    "listTypeDescriptor": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "items"
      ],
      "properties": {
        "kind": {
          "const": "list"
        },
        "items": {
          "$ref": "#/$defs/typeDescriptor"
        }
      }
    },
    "tableTypeDescriptor": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "row"
      ],
      "properties": {
        "kind": {
          "const": "table"
        },
        "row": {
          "$ref": "#/$defs/typeDescriptor"
        }
      }
    },
    "typeDescriptor": {
      "$comment": "The kind closure and descriptor-member contract are imported from accepted RFC-003 and checked against type-diagnostic-profile.v1.json.",
      "oneOf": [
        {
          "$ref": "#/$defs/simpleTypeDescriptor"
        },
        {
          "$ref": "#/$defs/enumTypeDescriptor"
        },
        {
          "$ref": "#/$defs/recordTypeDescriptor"
        },
        {
          "$ref": "#/$defs/listTypeDescriptor"
        },
        {
          "$ref": "#/$defs/tableTypeDescriptor"
        }
      ]
    },
    "recordField": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "fieldKey",
        "type",
        "required",
        "nullable"
      ],
      "properties": {
        "fieldKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "type": {
          "$ref": "#/$defs/typeDescriptor"
        },
        "required": {
          "type": "boolean"
        },
        "nullable": {
          "type": "boolean"
        }
      }
    },
    "recordDefinition": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "recordKey",
        "fields"
      ],
      "properties": {
        "recordKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "fields": {
          "type": "array",
          "maxItems": 512,
          "items": {
            "$ref": "#/$defs/recordField"
          }
        },
        "rowKeyField": {
          "$ref": "#/$defs/semanticKey"
        }
      }
    },
    "typeDefinitions": {
      "$comment": "The optional top-level closure is stored inside the immutable Flow revision. When present, every recordKey reachable from the Flow interface resolves here; omission preserves legacy V1 documents and leaves record Run validation at the object boundary.",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "records"
      ],
      "properties": {
        "records": {
          "type": "array",
          "maxItems": 100000,
          "items": {
            "$ref": "#/$defs/recordDefinition"
          }
        }
      }
    },
    "flowInputConstraints": {
      "$comment": "Closed Flow-input constraint grammar v1. The only approved predicate kind is allowedValues. Later predicate kinds may be added as optional members under version 1 only with schema, core and contract-lock updates; arbitrary expressions and code are never members.",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "version",
        "allowedValues"
      ],
      "properties": {
        "version": {
          "const": 1
        },
        "allowedValues": {
          "type": "array",
          "minItems": 1,
          "maxItems": 100000,
          "uniqueItems": true,
          "items": {}
        }
      }
    },
    "inputPort": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "portKey",
        "type",
        "description"
      ],
      "properties": {
        "portKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "type": {
          "$ref": "#/$defs/typeDescriptor"
        },
        "description": {
          "type": "string"
        },
        "unit": {
          "$ref": "#/$defs/unitCode"
        },
        "required": {
          "type": "boolean",
          "default": true,
          "$comment": "Omission means true so every previously stored InputPort retains its required-input meaning."
        },
        "constraints": {
          "$ref": "#/$defs/flowInputConstraints"
        }
      }
    },
    "resultPort": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "portKey",
        "type",
        "description",
        "source"
      ],
      "properties": {
        "portKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "type": {
          "$ref": "#/$defs/typeDescriptor"
        },
        "description": {
          "type": "string"
        },
        "unit": {
          "$ref": "#/$defs/unitCode"
        },
        "source": {
          "$ref": "#/$defs/resultBinding"
        }
      }
    },
    "flowInputBinding": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "portKey"
      ],
      "properties": {
        "kind": {
          "const": "flowInput"
        },
        "portKey": {
          "$ref": "#/$defs/semanticKey"
        }
      }
    },
    "nodeResultBinding": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "nodeKey",
        "portKey"
      ],
      "properties": {
        "kind": {
          "const": "nodeResult"
        },
        "nodeKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "portKey": {
          "$ref": "#/$defs/semanticKey"
        }
      }
    },
    "subflowResultBinding": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "subflowKey",
        "portKey"
      ],
      "properties": {
        "kind": {
          "const": "subflowResult"
        },
        "subflowKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "portKey": {
          "$ref": "#/$defs/semanticKey"
        }
      }
    },
    "inputBinding": {
      "oneOf": [
        {
          "$ref": "#/$defs/flowInputBinding"
        },
        {
          "$ref": "#/$defs/nodeResultBinding"
        },
        {
          "$ref": "#/$defs/subflowResultBinding"
        }
      ]
    },
    "resultBinding": {
      "oneOf": [
        {
          "$ref": "#/$defs/nodeResultBinding"
        },
        {
          "$ref": "#/$defs/subflowResultBinding"
        }
      ]
    },
    "inputBindings": {
      "type": "object",
      "additionalProperties": false,
      "patternProperties": {
        "^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$": {
          "$ref": "#/$defs/inputBinding"
        }
      }
    },
    "settingArray": {
      "type": "array",
      "maxItems": 100000,
      "items": {
        "$ref": "#/$defs/settingValue"
      }
    },
    "settingObject": {
      "type": "object",
      "additionalProperties": false,
      "patternProperties": {
        "^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$": {
          "$ref": "#/$defs/settingValue"
        }
      }
    },
    "settingValue": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "boolean"
        },
        {
          "type": "number"
        },
        {
          "type": "string"
        },
        {
          "$ref": "#/$defs/settingArray"
        },
        {
          "$ref": "#/$defs/settingObject"
        }
      ]
    },
    "componentRef": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "publisher",
        "packageKey",
        "packageVersion",
        "packageDigest",
        "releaseByteDigest",
        "componentKey",
        "componentContractVersion"
      ],
      "properties": {
        "publisher": {
          "$ref": "#/$defs/semanticKey"
        },
        "packageKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "packageVersion": {
          "$ref": "#/$defs/semanticVersion"
        },
        "packageDigest": {
          "$ref": "#/$defs/contentDigest"
        },
        "releaseByteDigest": {
          "$ref": "#/$defs/contentDigest"
        },
        "componentKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "componentContractVersion": {
          "type": "integer",
          "minimum": 1,
          "maximum": 9007199254740991
        }
      }
    },
    "signedComponentResourceRef": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "path",
        "digest"
      ],
      "properties": {
        "path": {
          "type": "string",
          "pattern": "^content/"
        },
        "digest": {
          "$ref": "#/$defs/contentDigest"
        }
      }
    },
    "componentPortContractSnapshot": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "portKey",
        "type",
        "description"
      ],
      "properties": {
        "portKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "type": {
          "$ref": "#/$defs/typeDescriptor"
        },
        "description": {
          "type": "string"
        },
        "unit": {
          "$ref": "#/$defs/unitCode"
        }
      }
    },
    "componentSettingContractSnapshot": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "settingKey",
        "documentSchemaVersion",
        "jsonSchema"
      ],
      "properties": {
        "settingKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "documentSchemaVersion": {
          "const": 1
        },
        "jsonSchema": {}
      }
    },
    "paperElementContributionSnapshot": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "elementType",
        "elementVersion",
        "title",
        "description",
        "inputSchema",
        "editorRenderer",
        "readOnlyRenderer",
        "printRenderer",
        "commandSchema",
        "manual"
      ],
      "properties": {
        "elementType": {
          "$ref": "#/$defs/semanticKey"
        },
        "elementVersion": {
          "$ref": "#/$defs/semanticVersion"
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "inputSchema": {},
        "editorRenderer": {
          "$ref": "#/$defs/signedComponentResourceRef"
        },
        "readOnlyRenderer": {
          "$ref": "#/$defs/signedComponentResourceRef"
        },
        "printRenderer": {
          "$ref": "#/$defs/signedComponentResourceRef"
        },
        "commandSchema": {
          "$ref": "#/$defs/signedComponentResourceRef"
        },
        "manual": {
          "$ref": "#/$defs/signedComponentResourceRef"
        }
      }
    },
    "componentPresentationContractSnapshot": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "nodeDescriptor",
        "editorAsset",
        "readOnlyRenderer",
        "printRenderer",
        "documentCodec",
        "templateContribution",
        "manual",
        "elementContributions"
      ],
      "properties": {
        "nodeDescriptor": {
          "$ref": "#/$defs/signedComponentResourceRef"
        },
        "editorAsset": {
          "$ref": "#/$defs/signedComponentResourceRef"
        },
        "readOnlyRenderer": {
          "$ref": "#/$defs/signedComponentResourceRef"
        },
        "printRenderer": {
          "$ref": "#/$defs/signedComponentResourceRef"
        },
        "documentCodec": {
          "$ref": "#/$defs/signedComponentResourceRef"
        },
        "templateContribution": {
          "$ref": "#/$defs/signedComponentResourceRef"
        },
        "manual": {
          "$ref": "#/$defs/signedComponentResourceRef"
        },
        "elementContributions": {
          "type": "array",
          "maxItems": 512,
          "items": {
            "$ref": "#/$defs/paperElementContributionSnapshot"
          }
        }
      }
    },
    "resolvedComponentContractSnapshot": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schemaVersion",
        "componentRef",
        "inputPorts",
        "resultPorts",
        "settingContract",
        "presentationContract"
      ],
      "properties": {
        "schemaVersion": {
          "const": 1
        },
        "componentRef": {
          "$ref": "#/$defs/componentRef"
        },
        "inputPorts": {
          "type": "array",
          "maxItems": 512,
          "items": {
            "$ref": "#/$defs/componentPortContractSnapshot"
          }
        },
        "resultPorts": {
          "type": "array",
          "maxItems": 512,
          "items": {
            "$ref": "#/$defs/componentPortContractSnapshot"
          }
        },
        "settingContract": {
          "$ref": "#/$defs/componentSettingContractSnapshot"
        },
        "presentationContract": {
          "$ref": "#/$defs/componentPresentationContractSnapshot"
        }
      }
    },
    "engineeringPaperDocumentElement": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "elementKey",
        "elementType",
        "elementVersion",
        "revision",
        "payload"
      ],
      "properties": {
        "elementKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "elementType": {
          "$ref": "#/$defs/semanticKey"
        },
        "elementVersion": {
          "$ref": "#/$defs/semanticVersion"
        },
        "revision": {
          "type": "integer",
          "minimum": 1
        },
        "parentKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "payload": {}
      }
    },
    "engineeringPaperDocument": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schemaVersion",
        "templateRef",
        "generation",
        "elements"
      ],
      "properties": {
        "schemaVersion": {
          "const": 1
        },
        "templateRef": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "templateKey",
            "templateVersion"
          ],
          "properties": {
            "templateKey": {
              "$ref": "#/$defs/semanticKey"
            },
            "templateVersion": {
              "$ref": "#/$defs/semanticVersion"
            }
          }
        },
        "generation": {
          "type": "integer",
          "minimum": 1
        },
        "elements": {
          "type": "array",
          "maxItems": 10000,
          "items": {
            "$ref": "#/$defs/engineeringPaperDocumentElement"
          }
        }
      }
    },
    "engineeringPaperNodeSetting": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "contractSnapshot",
        "document"
      ],
      "properties": {
        "contractSnapshot": {
          "$ref": "#/$defs/resolvedComponentContractSnapshot"
        },
        "document": {
          "$ref": "#/$defs/engineeringPaperDocument"
        }
      }
    },
    "functionTarget": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "publisher",
        "packageKey",
        "packageVersion",
        "packageDigest",
        "releaseByteDigest",
        "descriptorDigest",
        "functionKey",
        "functionVersion"
      ],
      "properties": {
        "kind": {
          "const": "function"
        },
        "publisher": {
          "$ref": "#/$defs/semanticKey"
        },
        "packageKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "packageVersion": {
          "$ref": "#/$defs/semanticVersion"
        },
        "packageDigest": {
          "$ref": "#/$defs/contentDigest"
        },
        "releaseByteDigest": {
          "$ref": "#/$defs/contentDigest"
        },
        "descriptorDigest": {
          "$ref": "#/$defs/contentDigest"
        },
        "functionKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "functionVersion": {
          "$ref": "#/$defs/semanticVersion"
        }
      }
    },
    "projectFunctionTarget": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "functionKey",
        "versionRef"
      ],
      "properties": {
        "kind": {
          "const": "projectFunction"
        },
        "functionKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "versionRef": {
          "$ref": "#/$defs/contentDigest"
        }
      }
    },
    "componentTarget": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "publisher",
        "packageKey",
        "packageVersion",
        "packageDigest",
        "releaseByteDigest",
        "componentKey",
        "componentContractVersion"
      ],
      "properties": {
        "kind": {
          "const": "component"
        },
        "publisher": {
          "$ref": "#/$defs/semanticKey"
        },
        "packageKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "packageVersion": {
          "$ref": "#/$defs/semanticVersion"
        },
        "packageDigest": {
          "$ref": "#/$defs/contentDigest"
        },
        "releaseByteDigest": {
          "$ref": "#/$defs/contentDigest"
        },
        "componentKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "componentContractVersion": {
          "type": "integer",
          "minimum": 1,
          "maximum": 9007199254740991
        }
      }
    },
    "nodeTarget": {
      "oneOf": [
        {
          "$ref": "#/$defs/functionTarget"
        },
        {
          "$ref": "#/$defs/projectFunctionTarget"
        },
        {
          "$ref": "#/$defs/componentTarget"
        }
      ]
    },
    "functionNode": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "nodeKey",
        "target",
        "inputBindings"
      ],
      "properties": {
        "nodeKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "target": {
          "oneOf": [
            {
              "$ref": "#/$defs/functionTarget"
            },
            {
              "$ref": "#/$defs/projectFunctionTarget"
            }
          ]
        },
        "inputBindings": {
          "$ref": "#/$defs/inputBindings"
        }
      }
    },
    "componentNode": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "nodeKey",
        "target",
        "inputBindings"
      ],
      "properties": {
        "nodeKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "target": {
          "$ref": "#/$defs/componentTarget"
        },
        "inputBindings": {
          "$ref": "#/$defs/inputBindings"
        },
        "settings": {
          "oneOf": [
            {
              "$ref": "#/$defs/settingObject"
            },
            {
              "$ref": "#/$defs/engineeringPaperNodeSetting"
            }
          ]
        }
      }
    },
    "node": {
      "oneOf": [
        {
          "$ref": "#/$defs/functionNode"
        },
        {
          "$ref": "#/$defs/componentNode"
        }
      ]
    },
    "group": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "groupKey",
        "label",
        "members"
      ],
      "properties": {
        "groupKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "label": {
          "type": "string"
        },
        "members": {
          "type": "array",
          "maxItems": 100000,
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/semanticKey"
          }
        }
      }
    },
    "dependencyScope": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "publisher",
        "packageKey",
        "packageVersion",
        "packageDigest"
      ],
      "properties": {
        "kind": {
          "const": "dependency"
        },
        "publisher": {
          "$ref": "#/$defs/semanticKey"
        },
        "packageKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "packageVersion": {
          "$ref": "#/$defs/semanticVersion"
        },
        "packageDigest": {
          "$ref": "#/$defs/contentDigest"
        }
      }
    },
    "projectFlowScope": {
      "$comment": "One Flow saved in the same Project as the Flow importing it. It carries no members of its own: the target already pins the exact flowKey and revisionRef, and the Project is the one the Run is scoped to, so restating the workspace and project keys here would put a second copy of the Run's own scope inside every Subflow, and two copies can disagree.",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind"
      ],
      "properties": {
        "kind": {
          "const": "project"
        }
      }
    },
    "externalFlowScope": {
      "$comment": "Where an imported Flow comes from. Until 2026-09-01 the only arm was `dependency`: reusing a Flow written a moment earlier in the same Project meant publishing it as a package and installing it into your own Project, so the commonest composition was the hardest one to express. Each arm carries its own `kind` constant, so the union needs no tag above them.",
      "oneOf": [
        {
          "$ref": "#/$defs/projectFlowScope"
        },
        {
          "$ref": "#/$defs/dependencyScope"
        }
      ]
    },
    "externalFlowTarget": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "scope",
        "flowKey",
        "revisionRef",
        "semanticDigest"
      ],
      "properties": {
        "kind": {
          "const": "flow"
        },
        "scope": {
          "$ref": "#/$defs/externalFlowScope"
        },
        "flowKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "revisionRef": {
          "$ref": "#/$defs/contentDigest"
        },
        "semanticDigest": {
          "$ref": "#/$defs/contentDigest"
        }
      }
    },
    "externalSubflow": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "subflowKey",
        "target",
        "inputBindings"
      ],
      "properties": {
        "subflowKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "label": {
          "type": "string"
        },
        "target": {
          "$ref": "#/$defs/externalFlowTarget"
        },
        "inputBindings": {
          "$ref": "#/$defs/inputBindings"
        }
      }
    },
    "nodePosition": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "x",
        "y"
      ],
      "properties": {
        "x": {
          "type": "number"
        },
        "y": {
          "type": "number"
        }
      }
    },
    "nodePositions": {
      "type": "object",
      "additionalProperties": false,
      "patternProperties": {
        "^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$": {
          "$ref": "#/$defs/nodePosition"
        }
      }
    },
    "presentation": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "nodes": {
          "$ref": "#/$defs/nodePositions"
        }
      }
    },
    "packageReleaseRef": {
      "$comment": "Exact package release reference governed by accepted RFC-005.",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "publisher",
        "packageKey",
        "packageVersion",
        "packageDigest",
        "releaseByteDigest"
      ],
      "properties": {
        "publisher": {
          "$ref": "#/$defs/semanticKey"
        },
        "packageKey": {
          "$ref": "#/$defs/semanticKey"
        },
        "packageVersion": {
          "$ref": "#/$defs/semanticVersion"
        },
        "packageDigest": {
          "$ref": "#/$defs/contentDigest"
        },
        "releaseByteDigest": {
          "$ref": "#/$defs/contentDigest"
        }
      }
    },
    "authoring": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "mode": {
          "enum": [
            "sdkLinked",
            "pxflowNative",
            "readOnly"
          ]
        }
      }
    }
  }
}
