{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "contract": {
      "type": "string",
      "const": "ActionProgramDefinition"
    },
    "schemaVersion": {
      "type": "number",
      "const": 1
    },
    "programId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256
    },
    "ownerRepo": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256
    },
    "tenantScope": {
      "type": "object",
      "properties": {
        "tenantRef": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "ownerRepo": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          "required": [
            "kind",
            "id",
            "ownerRepo"
          ],
          "additionalProperties": false
        },
        "dataSpaceRef": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "ownerRepo": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          "required": [
            "kind",
            "id",
            "ownerRepo"
          ],
          "additionalProperties": false
        },
        "teamRef": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "ownerRepo": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          "required": [
            "kind",
            "id",
            "ownerRepo"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "tenantRef",
        "dataSpaceRef"
      ],
      "additionalProperties": false
    },
    "supportedSurface": {
      "type": "string",
      "const": "studio"
    },
    "inputSchemaRevisionRef": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "ownerRepo": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "visibility": {
          "type": "string",
          "enum": [
            "tenant",
            "global",
            "public"
          ]
        },
        "tenantScope": {
          "type": "object",
          "properties": {
            "tenantRef": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "ownerRepo": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                }
              },
              "required": [
                "kind",
                "id",
                "ownerRepo"
              ],
              "additionalProperties": false
            },
            "dataSpaceRef": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "ownerRepo": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                }
              },
              "required": [
                "kind",
                "id",
                "ownerRepo"
              ],
              "additionalProperties": false
            },
            "teamRef": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "ownerRepo": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                }
              },
              "required": [
                "kind",
                "id",
                "ownerRepo"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "tenantRef",
            "dataSpaceRef"
          ],
          "additionalProperties": false
        },
        "revision": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "schemaVersion": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "contentHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      },
      "required": [
        "kind",
        "id",
        "ownerRepo",
        "visibility",
        "revision",
        "schemaVersion",
        "contentHash"
      ],
      "additionalProperties": false
    },
    "resultSchemaRevisionRef": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "ownerRepo": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "visibility": {
          "type": "string",
          "enum": [
            "tenant",
            "global",
            "public"
          ]
        },
        "tenantScope": {
          "type": "object",
          "properties": {
            "tenantRef": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "ownerRepo": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                }
              },
              "required": [
                "kind",
                "id",
                "ownerRepo"
              ],
              "additionalProperties": false
            },
            "dataSpaceRef": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "ownerRepo": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                }
              },
              "required": [
                "kind",
                "id",
                "ownerRepo"
              ],
              "additionalProperties": false
            },
            "teamRef": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "ownerRepo": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                }
              },
              "required": [
                "kind",
                "id",
                "ownerRepo"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "tenantRef",
            "dataSpaceRef"
          ],
          "additionalProperties": false
        },
        "revision": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "schemaVersion": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "contentHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      },
      "required": [
        "kind",
        "id",
        "ownerRepo",
        "visibility",
        "revision",
        "schemaVersion",
        "contentHash"
      ],
      "additionalProperties": false
    },
    "entry": {
      "type": "string",
      "const": "main"
    },
    "abi": {
      "type": "string",
      "const": "monkeys.action-program/2"
    },
    "compiler": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "target": {
      "type": "string",
      "const": "browser-worker-es2020"
    },
    "sourceHash": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "compiledHash": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "sourceMapHash": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "dependencies": {
      "maxItems": 128,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "query",
              "command"
            ]
          },
          "revisionRef": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "ownerRepo": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "visibility": {
                "type": "string",
                "enum": [
                  "tenant",
                  "global",
                  "public"
                ]
              },
              "tenantScope": {
                "type": "object",
                "properties": {
                  "tenantRef": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "ownerRepo": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      }
                    },
                    "required": [
                      "kind",
                      "id",
                      "ownerRepo"
                    ],
                    "additionalProperties": false
                  },
                  "dataSpaceRef": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "ownerRepo": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      }
                    },
                    "required": [
                      "kind",
                      "id",
                      "ownerRepo"
                    ],
                    "additionalProperties": false
                  },
                  "teamRef": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "ownerRepo": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      }
                    },
                    "required": [
                      "kind",
                      "id",
                      "ownerRepo"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "tenantRef",
                  "dataSpaceRef"
                ],
                "additionalProperties": false
              },
              "revision": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "schemaVersion": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "contentHash": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            },
            "required": [
              "kind",
              "id",
              "ownerRepo",
              "visibility",
              "revision",
              "schemaVersion",
              "contentHash"
            ],
            "additionalProperties": false
          },
          "inputSchemaRevisionRef": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "ownerRepo": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "visibility": {
                "type": "string",
                "enum": [
                  "tenant",
                  "global",
                  "public"
                ]
              },
              "tenantScope": {
                "type": "object",
                "properties": {
                  "tenantRef": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "ownerRepo": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      }
                    },
                    "required": [
                      "kind",
                      "id",
                      "ownerRepo"
                    ],
                    "additionalProperties": false
                  },
                  "dataSpaceRef": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "ownerRepo": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      }
                    },
                    "required": [
                      "kind",
                      "id",
                      "ownerRepo"
                    ],
                    "additionalProperties": false
                  },
                  "teamRef": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "ownerRepo": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      }
                    },
                    "required": [
                      "kind",
                      "id",
                      "ownerRepo"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "tenantRef",
                  "dataSpaceRef"
                ],
                "additionalProperties": false
              },
              "revision": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "schemaVersion": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "contentHash": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            },
            "required": [
              "kind",
              "id",
              "ownerRepo",
              "visibility",
              "revision",
              "schemaVersion",
              "contentHash"
            ],
            "additionalProperties": false
          },
          "resultSchemaRevisionRef": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "ownerRepo": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "visibility": {
                "type": "string",
                "enum": [
                  "tenant",
                  "global",
                  "public"
                ]
              },
              "tenantScope": {
                "type": "object",
                "properties": {
                  "tenantRef": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "ownerRepo": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      }
                    },
                    "required": [
                      "kind",
                      "id",
                      "ownerRepo"
                    ],
                    "additionalProperties": false
                  },
                  "dataSpaceRef": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "ownerRepo": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      }
                    },
                    "required": [
                      "kind",
                      "id",
                      "ownerRepo"
                    ],
                    "additionalProperties": false
                  },
                  "teamRef": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "ownerRepo": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      }
                    },
                    "required": [
                      "kind",
                      "id",
                      "ownerRepo"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "tenantRef",
                  "dataSpaceRef"
                ],
                "additionalProperties": false
              },
              "revision": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "schemaVersion": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "contentHash": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            },
            "required": [
              "kind",
              "id",
              "ownerRepo",
              "visibility",
              "revision",
              "schemaVersion",
              "contentHash"
            ],
            "additionalProperties": false
          },
          "download": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "native"
                  }
                },
                "required": [
                  "kind"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "text-artifact"
                  },
                  "fileNamePath": {
                    "minItems": 1,
                    "maxItems": 16,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 256
                    }
                  },
                  "mimeTypePath": {
                    "minItems": 1,
                    "maxItems": 16,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 256
                    }
                  },
                  "contentPath": {
                    "minItems": 1,
                    "maxItems": 16,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 256
                    }
                  },
                  "maxBytes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1048576
                  }
                },
                "required": [
                  "kind",
                  "fileNamePath",
                  "mimeTypePath",
                  "contentPath",
                  "maxBytes"
                ],
                "additionalProperties": false
              }
            ]
          },
          "dynamicInputKeys": {
            "maxItems": 128,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          }
        },
        "required": [
          "kind",
          "revisionRef",
          "inputSchemaRevisionRef",
          "resultSchemaRevisionRef",
          "dynamicInputKeys"
        ],
        "additionalProperties": false
      }
    },
    "effects": {
      "maxItems": 6,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "form",
          "toast",
          "refresh",
          "download",
          "state.get",
          "state.set"
        ]
      }
    },
    "refreshAliases": {
      "maxItems": 128,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256
      }
    },
    "stateAliases": {
      "maxItems": 128,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "alias": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "schemaRevisionRef": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "ownerRepo": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "visibility": {
                "type": "string",
                "enum": [
                  "tenant",
                  "global",
                  "public"
                ]
              },
              "tenantScope": {
                "type": "object",
                "properties": {
                  "tenantRef": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "ownerRepo": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      }
                    },
                    "required": [
                      "kind",
                      "id",
                      "ownerRepo"
                    ],
                    "additionalProperties": false
                  },
                  "dataSpaceRef": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "ownerRepo": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      }
                    },
                    "required": [
                      "kind",
                      "id",
                      "ownerRepo"
                    ],
                    "additionalProperties": false
                  },
                  "teamRef": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "ownerRepo": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      }
                    },
                    "required": [
                      "kind",
                      "id",
                      "ownerRepo"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "tenantRef",
                  "dataSpaceRef"
                ],
                "additionalProperties": false
              },
              "revision": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "schemaVersion": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "contentHash": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            },
            "required": [
              "kind",
              "id",
              "ownerRepo",
              "visibility",
              "revision",
              "schemaVersion",
              "contentHash"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "alias",
          "schemaRevisionRef"
        ],
        "additionalProperties": false
      }
    },
    "budgets": {
      "type": "object",
      "properties": {
        "rpcMs": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 30000
        },
        "concurrentCalls": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 4
        },
        "calls": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 128
        },
        "messageBytes": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 1048576
        },
        "activeMs": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 120000
        },
        "formMs": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 300000
        },
        "wallMs": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 600000
        }
      },
      "required": [
        "rpcMs",
        "concurrentCalls",
        "calls",
        "messageBytes",
        "activeMs",
        "formMs",
        "wallMs"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "contract",
    "schemaVersion",
    "programId",
    "ownerRepo",
    "tenantScope",
    "supportedSurface",
    "inputSchemaRevisionRef",
    "resultSchemaRevisionRef",
    "entry",
    "abi",
    "compiler",
    "target",
    "sourceHash",
    "compiledHash",
    "sourceMapHash",
    "dependencies",
    "effects",
    "refreshAliases",
    "stateAliases",
    "budgets"
  ],
  "additionalProperties": false,
  "$id": "https://schemas.infmonkeys.com/contracts/action-program-definition.schema.json",
  "title": "action-program-definition"
}
