{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://limecloud.github.io/agentapp/schemas/app-manifest.schema.json",
  "title": "Agent App Manifest",
  "type": "object",
  "required": [
    "name",
    "description",
    "version",
    "status",
    "appType"
  ],
  "properties": {
    "manifestVersion": {
      "type": "string",
      "enum": [
        "0.3.0",
        "0.4.0",
        "0.5.0",
        "0.6.0",
        "0.7.0",
        "0.8.0",
        "0.9.0",
        "0.10.0"
      ]
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "pattern": "^[a-z0-9][a-z0-9-_.]*$"
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024
    },
    "version": {
      "type": "string",
      "minLength": 1
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "ready",
        "needs-review",
        "deprecated",
        "archived"
      ]
    },
    "appType": {
      "type": "string",
      "enum": [
        "agent-app",
        "workflow-app",
        "domain-app",
        "customer-app",
        "custom"
      ]
    },
    "runtimeTargets": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "local",
          "hybrid",
          "server-assisted"
        ]
      },
      "uniqueItems": true
    },
    "requires": {
      "type": "object",
      "properties": {
        "lime": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "sdk": {
          "type": "string"
        },
        "capabilities": {
          "oneOf": [
            {
              "type": "array",
              "items": {
                "type": "string"
              },
              "uniqueItems": true
            },
            {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          ]
        }
      },
      "additionalProperties": true
    },
    "runtimePackage": {
      "type": "object",
      "properties": {
        "ui": {
          "$ref": "#/$defs/packageRef"
        },
        "worker": {
          "$ref": "#/$defs/packageRef"
        },
        "tools": {
          "$ref": "#/$defs/packageRef"
        },
        "storage": {
          "type": "object",
          "additionalProperties": true
        },
        "lockfile": {
          "type": "string"
        },
        "hash": {
          "type": "string",
          "pattern": "^sha256:[a-fA-F0-9]{64}$"
        }
      },
      "additionalProperties": true
    },
    "entries": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/entry"
      }
    },
    "triggers": {
      "type": "object",
      "description": "v0.5: AI auto-discovery hints. keywords drive semantic match; scenarios are machine-readable identifiers.",
      "properties": {
        "keywords": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "uniqueItems": true,
          "maxItems": 32
        },
        "scenarios": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9_]*$",
            "maxLength": 64
          },
          "uniqueItems": true,
          "maxItems": 32
        }
      },
      "additionalProperties": false
    },
    "quickstart": {
      "type": "object",
      "description": "v0.5: first-launch onboarding hints. entry must match an entry key; sampleWorkflow must match a workflow key.",
      "properties": {
        "entry": {
          "type": "string",
          "minLength": 1
        },
        "sampleWorkflow": {
          "type": "string",
          "minLength": 1
        },
        "setupSteps": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "additionalProperties": false
    },
    "skills": {
      "type": "object",
      "description": "v0.5: bundled and referenced Agent Skills.",
      "properties": {
        "bundled": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "path"
            ],
            "properties": {
              "path": {
                "type": "string",
                "minLength": 1
              },
              "activation": {
                "type": "string",
                "enum": [
                  "auto",
                  "on-demand",
                  "manual"
                ]
              }
            },
            "additionalProperties": false
          }
        },
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              },
              "version": {
                "type": "string"
              },
              "activation": {
                "type": "string",
                "enum": [
                  "auto",
                  "on-demand",
                  "manual"
                ]
              },
              "required": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false
    },
    "capabilities": {
      "oneOf": [
        {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        },
        {
          "type": "object",
          "additionalProperties": true
        }
      ]
    },
    "displayName": {
      "type": "string",
      "description": "v0.5: human-readable app name shown in catalogs and launchers.",
      "minLength": 1,
      "maxLength": 128
    },
    "shortDescription": {
      "type": "string",
      "description": "v0.5: one-line marketing tagline (<= 140 chars) for catalog cards.",
      "minLength": 1,
      "maxLength": 140
    },
    "displayNameI18n": {
      "type": "object",
      "description": "v0.5: locale -> displayName overrides.",
      "additionalProperties": {
        "type": "string",
        "minLength": 1,
        "maxLength": 128
      }
    },
    "shortDescriptionI18n": {
      "type": "object",
      "description": "v0.5: locale -> shortDescription overrides.",
      "additionalProperties": {
        "type": "string",
        "minLength": 1,
        "maxLength": 140
      }
    },
    "keywords": {
      "type": "array",
      "description": "v0.5: catalog search keywords; complementary to triggers.keywords.",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 32
      },
      "uniqueItems": true,
      "maxItems": 32
    },
    "categories": {
      "type": "array",
      "description": "v0.5: top-level catalog categories such as content / support / sales.",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 32
      },
      "uniqueItems": true,
      "maxItems": 8
    },
    "publisher": {
      "type": "object",
      "description": "v0.5: open-platform publisher identity. publisherId is the global unique key.",
      "required": [
        "publisherId",
        "name"
      ],
      "properties": {
        "publisherId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "description": "Globally unique publisher identifier issued by the registry; not user-claimable."
        },
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "displayName": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "verified": {
          "type": "boolean",
          "description": "Set by the registry after identity verification; do not self-declare."
        },
        "verifiedDomain": {
          "type": "string",
          "description": "Domain verified through DNS / .well-known / DID."
        },
        "did": {
          "type": "string",
          "description": "Optional DID (Decentralized Identifier) for the publisher."
        },
        "homepage": {
          "type": "string",
          "format": "uri"
        },
        "email": {
          "type": "string",
          "format": "email"
        },
        "logoUrl": {
          "type": "string",
          "format": "uri"
        },
        "country": {
          "type": "string",
          "minLength": 2,
          "maxLength": 2,
          "description": "ISO 3166-1 alpha-2 country code."
        },
        "kind": {
          "type": "string",
          "enum": [
            "individual",
            "organization",
            "team",
            "platform"
          ]
        }
      },
      "additionalProperties": true
    },
    "author": {
      "oneOf": [
        {
          "type": "string",
          "description": "Shorthand author string (npm style)."
        },
        {
          "type": "object",
          "required": [
            "name"
          ],
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1
            },
            "email": {
              "type": "string",
              "format": "email"
            },
            "url": {
              "type": "string",
              "format": "uri"
            }
          },
          "additionalProperties": true
        }
      ]
    },
    "maintainers": {
      "type": "array",
      "description": "v0.5: people responsible for ongoing maintenance.",
      "items": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "role": {
            "type": "string"
          }
        },
        "additionalProperties": true
      }
    },
    "contributors": {
      "type": "array",
      "description": "v0.5: contributors beyond maintainers.",
      "items": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": true
      }
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "v0.5: ISO 8601 timestamp the app first appeared in any registry."
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "v0.5: ISO 8601 timestamp this manifest was last updated."
    },
    "releasedAt": {
      "type": "string",
      "format": "date-time",
      "description": "v0.5: ISO 8601 timestamp this version became publicly installable."
    },
    "deprecatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "v0.5: ISO 8601 timestamp this version entered deprecation."
    },
    "endOfLifeAt": {
      "type": "string",
      "format": "date-time",
      "description": "v0.5: ISO 8601 timestamp host support ends; readiness blocks after."
    },
    "supportWindow": {
      "type": "object",
      "description": "v0.5: declared support window for this version.",
      "properties": {
        "channel": {
          "type": "string",
          "enum": [
            "stable",
            "lts",
            "preview",
            "experimental"
          ]
        },
        "supportedUntil": {
          "type": "string",
          "format": "date-time"
        },
        "supersededBy": {
          "type": "string",
          "description": "Version string that supersedes this one."
        }
      },
      "additionalProperties": false
    },
    "homepage": {
      "type": "string",
      "format": "uri"
    },
    "repository": {
      "oneOf": [
        {
          "type": "string",
          "format": "uri"
        },
        {
          "type": "object",
          "required": [
            "url"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "git",
                "svn",
                "hg",
                "other"
              ]
            },
            "url": {
              "type": "string",
              "format": "uri"
            },
            "directory": {
              "type": "string"
            }
          },
          "additionalProperties": true
        }
      ]
    },
    "documentation": {
      "type": "string",
      "format": "uri"
    },
    "issues": {
      "type": "string",
      "format": "uri"
    },
    "changelog": {
      "type": "string",
      "description": "URL or relative path to the changelog file."
    },
    "license": {
      "type": "string",
      "description": "SPDX license identifier (e.g. MIT, Apache-2.0, UNLICENSED, proprietary)."
    },
    "licenseUrl": {
      "type": "string",
      "format": "uri"
    },
    "copyright": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256
    },
    "support": {
      "type": "object",
      "description": "v0.5: support channels for users and operators.",
      "properties": {
        "email": {
          "type": "string",
          "format": "email"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "discordUrl": {
          "type": "string",
          "format": "uri"
        },
        "slackUrl": {
          "type": "string",
          "format": "uri"
        },
        "statusPageUrl": {
          "type": "string",
          "format": "uri"
        },
        "discussionsUrl": {
          "type": "string",
          "format": "uri"
        },
        "responseSla": {
          "type": "string",
          "description": "Plain-text SLA description, e.g. 'business-hours, 24h response'."
        }
      },
      "additionalProperties": true
    },
    "distribution": {
      "type": "object",
      "description": "v0.5: distribution and pricing fields reserved for the open platform; billing logic lives outside the standard.",
      "properties": {
        "channel": {
          "type": "string",
          "enum": [
            "stable",
            "preview",
            "beta",
            "alpha",
            "internal"
          ]
        },
        "visibility": {
          "type": "string",
          "enum": [
            "public",
            "unlisted",
            "private",
            "invite-only"
          ]
        },
        "pricing": {
          "type": "string",
          "enum": [
            "free",
            "freemium",
            "paid",
            "contact_sales",
            "custom"
          ],
          "description": "v0.5 reserves enum values; concrete billing lives outside the standard."
        },
        "billingModel": {
          "type": "string",
          "enum": [
            "one_time",
            "subscription",
            "usage_based",
            "tiered",
            "contact_sales",
            "none"
          ]
        },
        "trialDays": {
          "type": "integer",
          "minimum": 0,
          "maximum": 365
        },
        "regions": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2,
            "description": "ISO 3166-1 alpha-2 region codes."
          }
        }
      },
      "additionalProperties": true
    },
    "compliance": {
      "type": "object",
      "description": "v0.5: privacy, residency, and certification metadata for the open platform.",
      "properties": {
        "dataResidency": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "global",
              "cn",
              "eu",
              "us",
              "apac",
              "sg",
              "jp",
              "kr",
              "in"
            ]
          },
          "uniqueItems": true
        },
        "dataRetention": {
          "type": "string",
          "description": "Plain-text retention policy, e.g. '90 days for evidence, 7 days for tasks'."
        },
        "certifications": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "soc2",
              "iso27001",
              "gdpr",
              "hipaa",
              "pci-dss",
              "ccpa",
              "csa-star"
            ]
          },
          "uniqueItems": true
        },
        "privacyPolicyUrl": {
          "type": "string",
          "format": "uri"
        },
        "termsOfServiceUrl": {
          "type": "string",
          "format": "uri"
        },
        "dpaUrl": {
          "type": "string",
          "format": "uri",
          "description": "Data Processing Agreement URL."
        },
        "subprocessorsUrl": {
          "type": "string",
          "format": "uri"
        },
        "exportControl": {
          "type": "string"
        }
      },
      "additionalProperties": true
    },
    "permissions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/permission"
      }
    },
    "ui": {
      "$ref": "#/$defs/ui"
    },
    "storage": {
      "$ref": "#/$defs/storage"
    },
    "services": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/service"
      }
    },
    "workflows": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/workflow"
      }
    },
    "knowledgeTemplates": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/knowledgeTemplate"
      }
    },
    "skillRefs": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/skillRef"
      }
    },
    "toolRefs": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/toolRef"
      }
    },
    "artifactTypes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/artifactType"
      }
    },
    "evals": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/eval"
      }
    },
    "events": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/event"
      }
    },
    "secrets": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/secret"
      }
    },
    "overlayTemplates": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/overlayTemplate"
      }
    },
    "lifecycle": {
      "type": "object",
      "additionalProperties": true
    },
    "agentRuntime": {
      "$ref": "app-runtime.schema.json",
      "description": "v0.6: Agent task runtime control plane shorthand. Detailed configuration should normally live in app.runtime.yaml."
    },
    "requirements": {
      "$ref": "app-requirements.schema.json",
      "description": "v0.7: requirement boundary, MVP scope, non-goals, and acceptance criteria shorthand."
    },
    "boundary": {
      "$ref": "app-boundary.schema.json",
      "description": "v0.7: responsibility boundary across App, Host, Cloud, connectors, external systems, and humans."
    },
    "integrations": {
      "$ref": "app-integrations.schema.json",
      "description": "v0.7: external integration requirements shorthand. Detailed configuration should normally live in app.integrations.yaml."
    },
    "operations": {
      "$ref": "app-operations.schema.json",
      "description": "v0.7: operation side effects, approval, dry-run, and evidence requirements shorthand."
    },
    "install": {
      "$ref": "app-install.schema.json#/properties/install",
      "description": "v0.8: standalone, in-Lime, runtime-backed, and web-host installation modes."
    },
    "presentation": {
      "type": "object",
      "additionalProperties": true
    },
    "compatibility": {
      "type": "object",
      "additionalProperties": true
    },
    "metadata": {
      "type": "object",
      "additionalProperties": true
    }
  },
  "$defs": {
    "packageRef": {
      "type": "object",
      "required": [
        "path"
      ],
      "properties": {
        "path": {
          "type": "string",
          "minLength": 1
        },
        "hash": {
          "type": "string",
          "pattern": "^sha256:[a-fA-F0-9]{64}$"
        },
        "entry": {
          "type": "string"
        },
        "module": {
          "type": "string"
        },
        "format": {
          "type": "string",
          "enum": [
            "esm",
            "cjs",
            "static",
            "json",
            "wasm",
            "other"
          ]
        }
      },
      "additionalProperties": true
    },
    "entry": {
      "type": "object",
      "required": [
        "key",
        "kind",
        "title"
      ],
      "properties": {
        "key": {
          "type": "string",
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_.:-]+$"
        },
        "kind": {
          "type": "string",
          "enum": [
            "page",
            "panel",
            "expert-chat",
            "command",
            "workflow",
            "artifact",
            "background-task",
            "settings"
          ]
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "description": {
          "type": "string"
        },
        "route": {
          "type": "string"
        },
        "panel": {
          "type": "string"
        },
        "command": {
          "type": "string"
        },
        "workflow": {
          "type": "string"
        },
        "persona": {
          "type": "string"
        },
        "service": {
          "type": "string"
        },
        "artifactTypes": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        },
        "requiredCapabilities": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        },
        "permissions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "visibility": {
          "type": "string",
          "enum": [
            "default",
            "hidden",
            "admin",
            "workspace",
            "tenant"
          ]
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "kind": {
                "const": "page"
              }
            },
            "required": [
              "kind"
            ]
          },
          "then": {
            "required": [
              "route"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "kind": {
                "const": "panel"
              }
            },
            "required": [
              "kind"
            ]
          },
          "then": {
            "required": [
              "panel"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "kind": {
                "const": "command"
              }
            },
            "required": [
              "kind"
            ]
          },
          "then": {
            "required": [
              "command"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "kind": {
                "const": "workflow"
              }
            },
            "required": [
              "kind"
            ]
          },
          "then": {
            "required": [
              "workflow"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "kind": {
                "const": "expert-chat"
              }
            },
            "required": [
              "kind"
            ]
          },
          "then": {
            "required": [
              "persona"
            ]
          }
        }
      ],
      "additionalProperties": true
    },
    "permission": {
      "type": "object",
      "required": [
        "key",
        "scope"
      ],
      "properties": {
        "key": {
          "type": "string",
          "minLength": 1
        },
        "scope": {
          "type": "string",
          "enum": [
            "filesystem",
            "network",
            "model",
            "tool",
            "secret",
            "storage",
            "workflow",
            "artifact",
            "tenant",
            "workspace",
            "export"
          ]
        },
        "access": {
          "type": "string",
          "enum": [
            "read",
            "write",
            "execute",
            "read-write",
            "admin"
          ]
        },
        "required": {
          "type": "boolean"
        },
        "reason": {
          "type": "string"
        },
        "domains": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "paths": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": true
    },
    "ui": {
      "type": "object",
      "properties": {
        "routes": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "panels": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "settings": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "artifactViewers": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "additionalProperties": true
    },
    "storage": {
      "type": "object",
      "required": [
        "namespace"
      ],
      "properties": {
        "namespace": {
          "type": "string",
          "minLength": 1
        },
        "schema": {
          "type": "string"
        },
        "migrations": {
          "type": "string"
        },
        "placement": {
          "type": "string",
          "description": "v0.10: preferred storage placement. Local desktop apps should default to local-sqlite; server-postgresql is for cloud, enterprise, or team-shared backends.",
          "enum": [
            "local-sqlite",
            "local-indexeddb",
            "host-managed",
            "server-postgresql",
            "server-managed",
            "external"
          ]
        },
        "isolation": {
          "type": "string",
          "description": "v0.10: logical data boundary exposed by the host.",
          "enum": [
            "per-app-database",
            "per-app-schema",
            "per-app-namespace",
            "per-tenant-schema",
            "dedicated-database"
          ]
        },
        "physicalSharing": {
          "type": "string",
          "description": "v0.10: whether storage may share a physical database engine while keeping app namespaces isolated.",
          "enum": [
            "none",
            "host-managed",
            "shared-engine-isolated-namespace",
            "dedicated"
          ]
        },
        "localDefault": {
          "type": "boolean",
          "description": "v0.10: true when this storage profile is suitable as the default local desktop install profile."
        },
        "database": {
          "type": "object",
          "description": "v0.10: optional database hints. Apps must not receive host core database handles.",
          "properties": {
            "engine": {
              "type": "string",
              "enum": [
                "sqlite",
                "postgresql",
                "indexeddb",
                "host-managed",
                "other"
              ]
            },
            "wal": {
              "type": "boolean",
              "description": "SQLite local profile hint; host decides final pragma policy."
            },
            "schema": {
              "type": "string"
            },
            "migrationOwner": {
              "type": "string",
              "enum": [
                "app",
                "host"
              ]
            }
          },
          "additionalProperties": true
        },
        "retention": {
          "type": "object",
          "additionalProperties": true
        },
        "uninstallPolicy": {
          "type": "string",
          "enum": [
            "retain",
            "delete",
            "export-then-delete",
            "ask"
          ]
        }
      },
      "additionalProperties": true
    },
    "service": {
      "type": "object",
      "required": [
        "key",
        "kind"
      ],
      "properties": {
        "key": {
          "type": "string",
          "minLength": 1
        },
        "kind": {
          "type": "string",
          "enum": [
            "worker",
            "background-task",
            "scheduler",
            "tool-adapter",
            "app-backend",
            "webhook"
          ]
        },
        "language": {
          "type": "string",
          "description": "v0.10: implementation language for app-owned backend services, for example nodejs, python, go, rust, java, or wasm."
        },
        "runtime": {
          "type": "string",
          "description": "v0.10: host-supervised runtime profile for the service."
        },
        "executionPlane": {
          "type": "string",
          "description": "v0.10: where an app-owned backend runs. client-local means supervised by the desktop/client host; cloud-remote means a declared server-assisted backend.",
          "enum": [
            "client-local",
            "cloud-remote"
          ]
        },
        "protocol": {
          "type": "string",
          "description": "v0.10: transport contract between host and app-owned backend service. client-local services use stdio-jsonrpc, local-http, local-socket, or wasm; cloud-remote services use remote-http.",
          "enum": [
            "stdio-jsonrpc",
            "local-http",
            "local-socket",
            "wasm",
            "remote-http"
          ]
        },
        "entry": {
          "type": "string"
        },
        "path": {
          "type": "string"
        },
        "binary": {
          "type": "string"
        },
        "command": {
          "type": "string"
        },
        "endpoint": {
          "type": "string"
        },
        "sandbox": {
          "type": "string"
        },
        "network": {
          "type": "string",
          "enum": [
            "deny-by-default",
            "host-mediated",
            "loopback-only",
            "remote-allowed"
          ]
        },
        "resourceLimits": {
          "type": "object",
          "additionalProperties": true
        },
        "schedule": {
          "type": "string"
        },
        "requiredCapabilities": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "permissions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": true
    },
    "workflow": {
      "type": "object",
      "required": [
        "key"
      ],
      "properties": {
        "key": {
          "type": "string",
          "minLength": 1
        },
        "path": {
          "type": "string"
        },
        "entry": {
          "type": "string"
        },
        "states": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/workflowState"
          }
        },
        "inputs": {
          "type": "object",
          "additionalProperties": true
        },
        "outputs": {
          "type": "object",
          "additionalProperties": true
        },
        "humanReview": {
          "type": "boolean"
        },
        "retryPolicy": {
          "type": "object",
          "additionalProperties": true
        },
        "timeoutMs": {
          "type": "integer",
          "minimum": 1
        },
        "artifactOutputs": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": true
    },
    "workflowState": {
      "type": "object",
      "required": [
        "key",
        "kind"
      ],
      "properties": {
        "key": {
          "type": "string",
          "minLength": 1
        },
        "kind": {
          "type": "string",
          "enum": [
            "start",
            "agent-task",
            "tool-call",
            "human-review",
            "storage-write",
            "artifact-create",
            "branch",
            "wait",
            "end"
          ]
        },
        "next": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        },
        "uses": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": true
    },
    "knowledgeTemplate": {
      "type": "object",
      "required": [
        "key",
        "standard",
        "type"
      ],
      "properties": {
        "key": {
          "type": "string",
          "minLength": 1
        },
        "standard": {
          "type": "string",
          "enum": [
            "agentknowledge"
          ]
        },
        "type": {
          "type": "string",
          "minLength": 1
        },
        "required": {
          "type": "boolean"
        },
        "runtimeMode": {
          "type": "string",
          "enum": [
            "data",
            "retrieval",
            "export"
          ]
        },
        "path": {
          "type": "string"
        }
      },
      "additionalProperties": true
    },
    "skillRef": {
      "type": "object",
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "path": {
          "type": "string"
        },
        "standard": {
          "type": "string",
          "enum": [
            "agentskills"
          ]
        },
        "required": {
          "type": "boolean"
        },
        "activation": {
          "type": "string",
          "enum": [
            "explicit",
            "implicit",
            "entry"
          ]
        }
      },
      "additionalProperties": true
    },
    "toolRef": {
      "type": "object",
      "required": [
        "key",
        "provider"
      ],
      "properties": {
        "key": {
          "type": "string",
          "minLength": 1
        },
        "provider": {
          "type": "string",
          "minLength": 1
        },
        "required": {
          "type": "boolean"
        },
        "permissions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "capability": {
          "type": "string"
        }
      },
      "additionalProperties": true
    },
    "artifactType": {
      "type": "object",
      "required": [
        "key"
      ],
      "properties": {
        "key": {
          "type": "string",
          "minLength": 1
        },
        "standard": {
          "type": "string"
        },
        "schema": {
          "type": "string"
        },
        "viewer": {
          "type": "string"
        },
        "exporters": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "required": {
          "type": "boolean"
        }
      },
      "additionalProperties": true
    },
    "eval": {
      "type": "object",
      "required": [
        "key"
      ],
      "properties": {
        "key": {
          "type": "string",
          "minLength": 1
        },
        "kind": {
          "type": "string",
          "enum": [
            "readiness",
            "quality",
            "regression",
            "safety",
            "human-review"
          ]
        },
        "path": {
          "type": "string"
        },
        "threshold": {
          "type": "number"
        },
        "required": {
          "type": "boolean"
        },
        "evidenceRequired": {
          "type": "boolean"
        }
      },
      "additionalProperties": true
    },
    "event": {
      "type": "object",
      "required": [
        "key",
        "direction"
      ],
      "properties": {
        "key": {
          "type": "string",
          "minLength": 1
        },
        "direction": {
          "type": "string",
          "enum": [
            "publish",
            "subscribe",
            "both"
          ]
        },
        "schema": {
          "type": "string"
        }
      },
      "additionalProperties": true
    },
    "secret": {
      "type": "object",
      "required": [
        "key"
      ],
      "properties": {
        "key": {
          "type": "string",
          "minLength": 1
        },
        "provider": {
          "type": "string"
        },
        "required": {
          "type": "boolean"
        },
        "scope": {
          "type": "string",
          "enum": [
            "workspace",
            "tenant",
            "user",
            "app"
          ]
        }
      },
      "additionalProperties": true
    },
    "overlayTemplate": {
      "type": "object",
      "required": [
        "key",
        "scope"
      ],
      "properties": {
        "key": {
          "type": "string",
          "minLength": 1
        },
        "scope": {
          "type": "string",
          "enum": [
            "tenant",
            "workspace",
            "user",
            "customer"
          ]
        },
        "schema": {
          "type": "string"
        },
        "required": {
          "type": "boolean"
        },
        "description": {
          "type": "string"
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
