#  Copyright (c) 2026 Cisco Systems, Inc. and its affiliates
#  SPDX-License-Identifier: Apache-2.0
$schema: "https://json-schema.org/draft-07/schema#"
$id: "mas/v1/prompt_bundle"
title: "PromptBundle Manifest"
description: >
  Schema for kind: PromptBundle manifests (apiVersion: mas/v1).
  A PromptBundle is the ConfigMap of the MAS framework: a named collection of
  prompt entries (system prompts, few-shot examples, application intents).
  Agents reference entries via: bundle://<bundle-name>/<entry-key>
type: object
required:
  - apiVersion
  - kind
  - metadata
  - spec
additionalProperties: false
properties:

  apiVersion:
    type: string
    const: "mas/v1"

  kind:
    type: string
    const: "PromptBundle"

  metadata:
    type: object
    required: [name]
    additionalProperties: false
    properties:
      name:
        type: string
        description: "Bundle name — used in bundle:// references."
      description:
        type: string
        default: ""
      version:
        type: string
        pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+.*$"
        default: "0.1.0"
      tags:
        type: array
        items:
          type: string
        default: []

  spec:
    type: object
    required: [entries]
    additionalProperties: false
    properties:

      entries:
        type: object
        description: >
          Flat dict of named entries.  Each key becomes the second segment of
          the bundle:// ref: bundle://<bundle-name>/<key>.
        additionalProperties:
          type: object
          required: [type]
          additionalProperties: false
          properties:
            type:
              type: string
              enum: [system, few-shot, intent]
              description: >
                system   — system prompt text (injected as first system message).
                few-shot — list of input/output examples (items required).
                intent   — application-level intent text (used by kind: App).
            text:
              type: string
              description: >
                Prompt text — required for type: system and type: intent.
                Supports Jinja2 templating.
            items:
              type: array
              description: "Few-shot pairs — required for type: few-shot."
              items:
                type: object
                additionalProperties: false
                properties:
                  prompt:
                    type: string
                  response:
                    type: string
                  tags:
                    type: array
                    items:
                      type: string
                    default: []
            tags:
              type: array
              items:
                type: string
              default: []
