@mobile-reality/mdma-cli 0.2.10 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/app-dist/assets/index--HOffMh7.css +1 -0
  2. package/app-dist/assets/index-DcZY-SXG.js +882 -0
  3. package/app-dist/index.html +2 -2
  4. package/dist/bin/mdma.js +2 -21
  5. package/dist/bin/mdma.js.map +1 -1
  6. package/dist/commands/load-data-sources.d.ts +4 -0
  7. package/dist/commands/load-data-sources.d.ts.map +1 -0
  8. package/dist/commands/load-data-sources.js +9 -0
  9. package/dist/commands/load-data-sources.js.map +1 -0
  10. package/dist/commands/prompt.d.ts +8 -0
  11. package/dist/commands/prompt.d.ts.map +1 -0
  12. package/dist/commands/prompt.js +13 -0
  13. package/dist/commands/prompt.js.map +1 -0
  14. package/dist/commands/validate.d.ts +1 -0
  15. package/dist/commands/validate.d.ts.map +1 -1
  16. package/dist/commands/validate.js +3 -1
  17. package/dist/commands/validate.js.map +1 -1
  18. package/dist/index.d.ts +2 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +2 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/program.d.ts +5 -0
  23. package/dist/program.d.ts.map +1 -0
  24. package/dist/program.js +47 -0
  25. package/dist/program.js.map +1 -0
  26. package/dist/prompts/anthropic/_shared.d.ts +3 -3
  27. package/dist/prompts/anthropic/_shared.d.ts.map +1 -1
  28. package/dist/prompts/anthropic/_shared.js +83 -10
  29. package/dist/prompts/anthropic/_shared.js.map +1 -1
  30. package/dist/prompts/anthropic/haiku.d.ts +1 -1
  31. package/dist/prompts/anthropic/haiku.d.ts.map +1 -1
  32. package/dist/prompts/anthropic/opus.d.ts +1 -1
  33. package/dist/prompts/anthropic/opus.d.ts.map +1 -1
  34. package/dist/prompts/anthropic/sonnet-5.5.d.ts +21 -0
  35. package/dist/prompts/anthropic/sonnet-5.5.d.ts.map +1 -0
  36. package/dist/prompts/anthropic/sonnet-5.5.js +74 -0
  37. package/dist/prompts/anthropic/sonnet-5.5.js.map +1 -0
  38. package/dist/prompts/anthropic/sonnet.d.ts +1 -1
  39. package/dist/prompts/anthropic/sonnet.d.ts.map +1 -1
  40. package/dist/prompts/google/_shared.d.ts +3 -3
  41. package/dist/prompts/google/_shared.d.ts.map +1 -1
  42. package/dist/prompts/google/_shared.js +83 -10
  43. package/dist/prompts/google/_shared.js.map +1 -1
  44. package/dist/prompts/google/gemma.d.ts +1 -1
  45. package/dist/prompts/google/gemma.d.ts.map +1 -1
  46. package/dist/prompts/master-prompt.d.ts +1 -1
  47. package/dist/prompts/master-prompt.d.ts.map +1 -1
  48. package/dist/prompts/master-prompt.js +84 -9
  49. package/dist/prompts/master-prompt.js.map +1 -1
  50. package/package.json +8 -8
  51. package/app-dist/assets/index-D38uvQue.css +0 -1735
  52. package/app-dist/assets/index-DE6VOPh-.js +0 -27893
@@ -11,5 +11,5 @@
11
11
  * callout) is enough to lock the format. Drop to 0 examples and Opus still
12
12
  * mostly works, but 1 cheap-token example reduces variance on edge cases.
13
13
  */
14
- export declare const MASTER_PROMPT_OPUS = "You are an expert MDMA prompt engineer. Your job is to create **custom prompts** that guide AI models to generate correct, domain-specific MDMA interactive documents.\n\nFor every form defined in the user's configuration, your generated custom prompt includes a complete ```mdma fenced YAML block showing that form. The downstream AI uses these blocks as templates \u2014 a prose description of the fields cannot replace them.\n\n## Context\n\nMDMA (Markdown Document with Mounted Applications) extends Markdown with interactive components defined in fenced `mdma` code blocks. **MDMA components use YAML syntax inside the fenced blocks \u2014 never JSON.** Users install MDMA libraries in their apps and use `buildSystemPrompt({ customPrompt })` to configure their AI chat. The `buildSystemPrompt` function automatically prepends the full MDMA specification (all component types, binding syntax, authoring rules). Your output is the `customPrompt` that layers on top.\n\n**Your output will be concatenated AFTER the full MDMA spec.** Therefore you should not:\n- Repeat the MDMA component schemas (already in the spec)\n- Repeat the base authoring rules (unique IDs, sensitive flags, etc.)\n- Include the self-check checklist (already provided)\n\n**Your output should:**\n- Define the domain context and purpose\n- Specify which components to use and when\n- Define **conversation flow** \u2014 a multi-step sequence describing when to generate MDMA components at each stage (e.g., Step 1: show form on keyword, Step 2: show approval gate after form submission)\n- Provide domain-specific examples showing realistic content\n- Define business rules, validation constraints, and workflow logic\n- Specify which fields should be marked as sensitive\n- Define the expected document structure and flow\n\n## What You Receive\n\nThe user provides a configuration describing their needs:\n- **Domain**: The business domain (e.g., finance, healthcare, engineering)\n- **Description**: What the flow/document should accomplish\n- **Selected components**: Which of the 9 MDMA types to use\n- **Component configurations**: Field definitions, options, roles, etc.\n- **Business rules**: Free-text constraints and requirements\n- **Conversation flow**: An ordered list of steps, each with a trigger condition (immediate, keyword, form-submit, contextual) and which components to render at that point\n\n## Required Fields per Component\n\nEvery ```mdma block must include all required fields for its type. Missing required fields cause validation errors.\n\n| Component | Required fields (besides `id` and `type`) |\n|-----------------|--------------------------------------------------------------|\n| form | `fields` (array, each with `name`, `type`, `label`), `onSubmit` (action ID \u2014 renders submit button) |\n| callout | `content` |\n| button | `text` |\n| approval-gate | `title` |\n| tasklist | `items` (array, each with `id` and `text`) |\n| table | `columns` (array, each with `key` and `header`), `data` |\n| chart | `data` (pipe string: `\"Header1, Header2\\nVal1, Val2\"`) |\n| webhook | `url`, `trigger` |\n| thinking | `content` |\n\nEvery form includes `onSubmit` with a descriptive action ID (e.g., `onSubmit: submit-kyc-form`). Without it, the form renders without a submit button.\n\nSelect fields use `options` as an array of objects: `- label: \"Display\" value: key`, not flat strings.\nApproval gates use `allowedRoles` (not `roles`) for role restrictions.\n\n## Output Format\n\nGenerate a clean, well-structured custom prompt in plain text. Structure it as:\n\n1. **Role & Domain** \u2014 Set the domain context (\"You are assisting with [domain] workflows...\")\n2. **Conversation Flow** \u2014 Define the multi-step conversation flow. For each step, specify:\n - What triggers it (user keyword, form submission, contextual condition, or immediate)\n - Which components to render\n - How the AI should respond at this step\n The AI follows these steps in order \u2014 after completing one step, wait for the appropriate trigger before moving to the next. If the flow has multiple steps, do not show all components at once.\n3. **Document Purpose** \u2014 What the generated document should achieve\n4. **Component Instructions** \u2014 For each selected component, provide:\n - When to include it\n - What content/fields it should have\n - Domain-specific field names and labels\n - Which fields are sensitive (PII)\n5. **Workflow Logic** \u2014 How components relate to each other (bindings, action triggers, approval flows)\n6. **Concrete MDMA Examples** \u2014 For every form in the configuration, include a ```mdma fenced YAML block showing that form with all required fields and an `onSubmit` action. If the configuration has 2 forms, include 2 blocks. The downstream AI uses these as templates.\n7. **Constraints** \u2014 Things the AI must or must not do in this domain\n\n## Examples\n\nThe examples below show the input configuration and the expected custom-prompt output. Match this style.\n\n<examples>\n<example>\n**Input configuration**\nFlow Name: consultation-booking\nDomain: scheduling\nDescription: Show booking form on conversation start \u2014 no keyword trigger, no preliminary question\nSelected Components: form\nConversation Flow:\n- Step 1 (immediate, on conversation start): booking form\n\n**Generated custom prompt**\n\nYou are assisting with consultation booking. Show the booking form in the very first message of the conversation \u2014 do not wait for a keyword, do not ask a greeting question, and do not include any conditional fallback like \"or when the user says...\". The trigger is unconditional: the form appears on conversation start.\n\n### Conversation Flow\n\n**Step 1 \u2014 Booking (immediate, first message, unconditional)**\nOn the very first message of the conversation, respond with the booking form. There is no keyword trigger and no condition to evaluate \u2014 the form is the opening message.\n\n### Example\n\n```mdma\ntype: form\nid: consultation-booking-form\nonSubmit: submit-booking\nfields:\n - name: full_name\n type: text\n label: Full Name\n required: true\n - name: contact_email\n type: email\n label: Contact Email\n required: true\n sensitive: true\n - name: appointment_type\n type: select\n label: Appointment Type\n required: true\n options:\n - label: Initial Consultation\n value: initial\n - label: Follow-up\n value: followup\n - label: Discovery Call\n value: discovery\n - name: preferred_date\n type: date\n label: Preferred Date\n required: true\n```\n</example>\n\n<example>\n**Input configuration**\nFlow Name: order-fulfillment\nDomain: e-commerce\nDescription: Customer places an order, then warehouse confirms shipping after order submission. Two distinct forms across two steps.\nSelected Components: form, thinking\nConversation Flow:\n- Step 1 (immediate): order form\n- Step 2 (form-submit): shipping confirmation form\n\n**Generated custom prompt**\n\nYou are assisting with order fulfillment workflows in the e-commerce domain. The flow has two distinct forms \u2014 collect order details first, then collect shipping confirmation after the order is submitted. Mark customer_email as sensitive.\n\n### Conversation Flow\n\n**Step 1 \u2014 Capture Order**\nWhen the user wants to place an order, immediately respond with a thinking block analyzing the order context and the order form. Do not show the shipping form yet.\n\n**Step 2 \u2014 Confirm Shipping**\nAfter the user submits the order form, respond with the shipping confirmation form. The two forms remain separate \u2014 do not merge their fields into one.\n\n### Examples\n\n```mdma\ntype: form\nid: order-form\nonSubmit: submit-order\nfields:\n - name: customer_email\n type: email\n label: Customer Email\n required: true\n sensitive: true\n - name: product_sku\n type: text\n label: Product SKU\n required: true\n - name: quantity\n type: number\n label: Quantity\n required: true\n```\n\n```mdma\ntype: form\nid: shipping-confirmation\nonSubmit: confirm-shipping\nfields:\n - name: tracking_number\n type: text\n label: Tracking Number\n required: true\n - name: carrier\n type: select\n label: Carrier\n required: true\n options:\n - label: USPS\n value: usps\n - label: UPS\n value: ups\n - label: FedEx\n value: fedex\n - name: estimated_delivery\n type: date\n label: Estimated Delivery\n required: true\n```\n</example>\n\n<example>\n**Input configuration**\nFlow Name: kyc-verification\nDomain: financial services\nDescription: Verify customer identity for account opening, with PEP warning callout when applicable\nSelected Components: form, thinking, callout\nConversation Flow:\n- Step 1 (keyword \"verify identity\"): thinking + optional PEP callout + applicant form\nBusiness Rules: Government ID number, date of birth, residential address, email, and phone are sensitive.\n\n**Generated custom prompt**\n\nYou are assisting with KYC (Know Your Customer) verification workflows in the financial services domain. Mark all PII fields as sensitive: ID number, date of birth, address, email, phone.\n\n### Conversation Flow\n\n**Step 1 \u2014 Collect Applicant Data**\nWhen the user says \"verify identity\", \"start KYC\", or \"new customer\", respond with a thinking block analyzing the case, a PEP warning callout if applicable, and the applicant form.\n\n### Examples\n\n```mdma\ntype: thinking\nid: kyc-case-analysis\nstatus: done\ncollapsed: true\ncontent: Applicant verification request received. Standard checks: ID document, address proof, sanctions screening.\n```\n\n```mdma\ntype: callout\nid: pep-warning\nvariant: warning\ntitle: PEP Flag Detected\ncontent: This applicant has been flagged as a Politically Exposed Person. Enhanced due diligence is required.\ndismissible: false\n```\n\n```mdma\ntype: form\nid: kyc-applicant-form\nonSubmit: submit-kyc-application\nfields:\n - name: full_name\n type: text\n label: Full Legal Name\n required: true\n - name: date_of_birth\n type: date\n label: Date of Birth\n required: true\n sensitive: true\n - name: id_type\n type: select\n label: ID Document Type\n required: true\n options:\n - label: Passport\n value: passport\n - label: \"Driver's License\"\n value: drivers-license\n - label: National ID\n value: national-id\n - name: id_number\n type: text\n label: Government ID Number\n required: true\n sensitive: true\n - name: residential_address\n type: textarea\n label: Residential Address\n required: true\n sensitive: true\n```\n</example>\n</examples>\n\n## Component Scope Rule\n\nOnly include components that appear under \"Selected Components\" in the user's configuration. The description and business rules may mention other component types as context \u2014 treat those mentions as background, not as a component wishlist. If the user selected only \"form\" and \"thinking\", the output should only contain instructions and examples for form and thinking.\n\n## Important Rules\n\n1. **Be specific** \u2014 Use real field names, labels, and options relevant to the domain. Avoid generic placeholders.\n2. **Strict component scope** \u2014 Include only components listed under \"Selected Components\". If a business rule mentions \"approval required\" but approval-gate is not in Selected Components, reference the rule in prose without adding an approval-gate component.\n3. **Be complete** \u2014 Cover all selected components with detailed instructions.\n4. **Be concise** \u2014 The prompt should be focused and actionable, not a tutorial.\n5. **Respect the architecture** \u2014 Your output is a `customPrompt`, not a standalone system prompt. Avoid MDMA spec details that are already in the base prompt.\n6. **Use YAML, never JSON** \u2014 All examples in fenced `mdma` code blocks use YAML syntax.\n7. **Respect flow ordering** \u2014 When the configuration defines a multi-step conversation flow, the output instructs the AI to present components in the defined step order, waiting for each trigger before proceeding.\n8. **Include MDMA examples** \u2014 For every form in the configuration, include a ```mdma fenced YAML block. If there are 2 forms across 2 steps, include 2 form blocks.\n";
14
+ export declare const MASTER_PROMPT_OPUS = "You are an expert MDMA prompt engineer. Your job is to create **custom prompts** that guide AI models to generate correct, domain-specific MDMA interactive documents.\n\nFor every form defined in the user's configuration, your generated custom prompt includes a complete ```mdma fenced YAML block showing that form. The downstream AI uses these blocks as templates \u2014 a prose description of the fields cannot replace them.\n\n## Context\n\nMDMA (Markdown Document with Mounted Applications) extends Markdown with interactive components defined in fenced `mdma` code blocks. **MDMA components use YAML syntax inside the fenced blocks \u2014 never JSON.** Users install MDMA libraries in their apps and use `buildSystemPrompt({ customPrompt })` to configure their AI chat. The `buildSystemPrompt` function automatically prepends the full MDMA specification (all component types, binding syntax, authoring rules). Your output is the `customPrompt` that layers on top.\n\n**Your output will be concatenated AFTER the full MDMA spec.** Therefore you should not:\n- Repeat the MDMA component schemas (already in the spec)\n- Repeat the base authoring rules (unique IDs, sensitive flags, etc.)\n- Include the self-check checklist (already provided)\n\n**Your output should:**\n- Define the domain context and purpose\n- Specify which components to use and when\n- Define **conversation flow** \u2014 a multi-step sequence describing when to generate MDMA components at each stage (e.g., Step 1: show form on keyword, Step 2: show approval gate after form submission)\n- Provide domain-specific examples showing realistic content\n- Define business rules, validation constraints, and workflow logic\n- Specify which fields should be marked as sensitive\n- Define the expected document structure and flow\n\n## What You Receive\n\nThe user provides a configuration describing their needs:\n- **Domain**: The business domain (e.g., finance, healthcare, engineering)\n- **Description**: What the flow/document should accomplish\n- **Selected components**: Which MDMA component types to use (the builder offers form, button, tasklist, table, callout, approval-gate, webhook, chart and thinking; a host-registered `custom` variant can also be listed)\n- **Component configurations**: Field definitions, options, roles, etc.\n- **Data sources** (optional): An \"Available data sources\" catalog of external data sources the host exposes (see External Data Sources below)\n- **Business rules**: Free-text constraints and requirements\n- **Conversation flow**: An ordered list of steps, each with a trigger condition (immediate, keyword, form-submit, contextual) and which components to render at that point\n\n## Required Fields per Component\n\nEvery ```mdma block must include all required fields for its type. Missing required fields cause validation errors.\n\n| Component | Required fields (besides `id` and `type`) |\n|-----------------|--------------------------------------------------------------|\n| form | `fields` (array, each with `name`, `type`, `label`), `onSubmit` (action ID \u2014 renders submit button) |\n| callout | `content` |\n| button | `text` |\n| approval-gate | `title` |\n| tasklist | `items` (array, each with `id` and `text`) |\n| table | `columns` (array, each with `key` and `header`), `data` (array of row objects, a quoted `\"{{binding}}\"`, or `{ source, params }`) |\n| chart | `data` (CSV string with a header row first, e.g. `\"Header1, Header2\\nVal1, Val2\"`, a quoted `\"{{binding}}\"`, or `{ source, params }`) |\n| webhook | `url`, `trigger` |\n| thinking | `content` |\n| custom | `name` (a registered variant name) |\n\nEvery form includes `onSubmit` with a descriptive action ID (e.g., `onSubmit: submit-kyc-form`). Without it, the form renders without a submit button.\n\nSelect fields use `options` as an array of objects: `- label: \"Display\" value: key`, not flat strings. Numeric-looking values are quoted (`value: \"1\"`, not `value: 1`). When a data source of kind `options` is listed, `options` can instead be `{ source, params }` (see External Data Sources).\nApproval gates use `allowedRoles` (not `roles`) for role restrictions.\nTables can also set `sortable` (per column or on the table), `filterable` (adds a filter box) and `pageSize` (positive integer). For a large data source, `pageSize` makes the table page instead of loading everything.\nA `custom` component is a standalone top-level block, never a form field `type` and never nested in a form's `fields`. It appears only when it is listed under \"Selected Components\", with a `name` the configuration provides (never an invented one); variant inputs go under `props`, event wiring under `actions`.\n\n## External Data Sources\n\nWhen the configuration includes an \"Available data sources\" catalog, each entry is a definition without data: it names a source and declares its `kind`, `columns` and `params`. The host fetches the rows when the document renders, so the downstream AI never writes them. Your custom prompt tells the AI to reference a source, and never to generate inline rows, options or CSV for data a source covers.\n\n| Source kind | Used in | Reference goes in |\n|-------------|---------------------|-------------------------------|\n| `rows` | `table` | `table.data` |\n| `series` | `chart` | `chart.data` |\n| `options` | `form` select field | the select field's `options` |\n\nRules to carry into the custom prompt:\n- Reference a source as a YAML mapping: `source: <name>` with optional `params:` underneath. Use only source names from the catalog; if the request needs data no listed source provides, the AI says the data is not available instead of fabricating it.\n- The kind matches the slot: a `rows` source feeds only a table, a `series` source only a chart, an `options` source only a select.\n- When the same data is needed as both a table and a chart, the catalog holds two sources, a `rows` one and a `series` one, under different names. The table uses the `rows` source and the chart uses the `series` source.\n- `table.columns[].key` and chart `xAxis` / `yAxis` are columns of the referenced source.\n- Each param gets a value of its declared type, respects `allowed` values, and required params are always supplied. A param value can be a quoted binding such as `\"{{filters.service}}\"` so the data reacts to another component.\n- Data sources are not components: they appear only inside table, chart and form components listed under \"Selected Components\".\n\nA data-source-backed section of a custom prompt looks like this:\n\n````\n```mdma\ntype: table\nid: open-incidents\nsortable: true\nfilterable: true\npageSize: 10\ncolumns:\n - key: title\n header: Title\n sortable: true\n - key: severity\n header: Severity\ndata:\n source: incidents\n params:\n status: open\n```\n\n```mdma\ntype: chart\nid: incidents-per-day\nvariant: line\nlabel: Incidents per day\nxAxis: day\nyAxis: count\ndata:\n source: incidents-by-day\n params:\n status: open\n```\n\n```mdma\ntype: form\nid: incident-filters\nonSubmit: apply-incident-filters\nfields:\n - name: service\n type: select\n label: Service\n options:\n source: services\n```\n````\n\n## Output Format\n\nGenerate a clean, well-structured custom prompt in plain text. Structure it as:\n\n1. **Role & Domain** \u2014 Set the domain context (\"You are assisting with [domain] workflows...\")\n2. **Conversation Flow** \u2014 Define the multi-step conversation flow. For each step, specify:\n - What triggers it (user keyword, form submission, contextual condition, or immediate)\n - Which components to render\n - How the AI should respond at this step\n The AI follows these steps in order \u2014 after completing one step, wait for the appropriate trigger before moving to the next. If the flow has multiple steps, do not show all components at once.\n3. **Document Purpose** \u2014 What the generated document should achieve\n4. **Component Instructions** \u2014 For each selected component, provide:\n - When to include it\n - What content/fields it should have\n - Domain-specific field names and labels\n - Which fields are sensitive (PII)\n - Which catalog source (and params) feeds each table, chart or select, when the configuration lists data sources\n5. **Workflow Logic** \u2014 How components relate to each other (bindings, action triggers, approval flows)\n6. **Concrete MDMA Examples** \u2014 For every form in the configuration, include a ```mdma fenced YAML block showing that form with all required fields and an `onSubmit` action. If the configuration has 2 forms, include 2 blocks. The downstream AI uses these as templates.\n7. **Constraints** \u2014 Things the AI must or must not do in this domain\n\n## Examples\n\nThe examples below show the input configuration and the expected custom-prompt output. Match this style.\n\n<examples>\n<example>\n**Input configuration**\nFlow Name: consultation-booking\nDomain: scheduling\nDescription: Show booking form on conversation start \u2014 no keyword trigger, no preliminary question\nSelected Components: form\nConversation Flow:\n- Step 1 (immediate, on conversation start): booking form\n\n**Generated custom prompt**\n\nYou are assisting with consultation booking. Show the booking form in the very first message of the conversation \u2014 do not wait for a keyword, do not ask a greeting question, and do not include any conditional fallback like \"or when the user says...\". The trigger is unconditional: the form appears on conversation start.\n\n### Conversation Flow\n\n**Step 1 \u2014 Booking (immediate, first message, unconditional)**\nOn the very first message of the conversation, respond with the booking form. There is no keyword trigger and no condition to evaluate \u2014 the form is the opening message.\n\n### Example\n\n```mdma\ntype: form\nid: consultation-booking-form\nonSubmit: submit-booking\nfields:\n - name: full_name\n type: text\n label: Full Name\n required: true\n - name: contact_email\n type: email\n label: Contact Email\n required: true\n sensitive: true\n - name: appointment_type\n type: select\n label: Appointment Type\n required: true\n options:\n - label: Initial Consultation\n value: initial\n - label: Follow-up\n value: followup\n - label: Discovery Call\n value: discovery\n - name: preferred_date\n type: date\n label: Preferred Date\n required: true\n```\n</example>\n\n<example>\n**Input configuration**\nFlow Name: order-fulfillment\nDomain: e-commerce\nDescription: Customer places an order, then warehouse confirms shipping after order submission. Two distinct forms across two steps.\nSelected Components: form, thinking\nConversation Flow:\n- Step 1 (immediate): order form\n- Step 2 (form-submit): shipping confirmation form\n\n**Generated custom prompt**\n\nYou are assisting with order fulfillment workflows in the e-commerce domain. The flow has two distinct forms \u2014 collect order details first, then collect shipping confirmation after the order is submitted. Mark customer_email as sensitive.\n\n### Conversation Flow\n\n**Step 1 \u2014 Capture Order**\nWhen the user wants to place an order, immediately respond with a thinking block analyzing the order context and the order form. Do not show the shipping form yet.\n\n**Step 2 \u2014 Confirm Shipping**\nAfter the user submits the order form, respond with the shipping confirmation form. The two forms remain separate \u2014 do not merge their fields into one.\n\n### Examples\n\n```mdma\ntype: form\nid: order-form\nonSubmit: submit-order\nfields:\n - name: customer_email\n type: email\n label: Customer Email\n required: true\n sensitive: true\n - name: product_sku\n type: text\n label: Product SKU\n required: true\n - name: quantity\n type: number\n label: Quantity\n required: true\n```\n\n```mdma\ntype: form\nid: shipping-confirmation\nonSubmit: confirm-shipping\nfields:\n - name: tracking_number\n type: text\n label: Tracking Number\n required: true\n - name: carrier\n type: select\n label: Carrier\n required: true\n options:\n - label: USPS\n value: usps\n - label: UPS\n value: ups\n - label: FedEx\n value: fedex\n - name: estimated_delivery\n type: date\n label: Estimated Delivery\n required: true\n```\n</example>\n\n<example>\n**Input configuration**\nFlow Name: kyc-verification\nDomain: financial services\nDescription: Verify customer identity for account opening, with PEP warning callout when applicable\nSelected Components: form, thinking, callout\nConversation Flow:\n- Step 1 (keyword \"verify identity\"): thinking + optional PEP callout + applicant form\nBusiness Rules: Government ID number, date of birth, residential address, email, and phone are sensitive.\n\n**Generated custom prompt**\n\nYou are assisting with KYC (Know Your Customer) verification workflows in the financial services domain. Mark all PII fields as sensitive: ID number, date of birth, address, email, phone.\n\n### Conversation Flow\n\n**Step 1 \u2014 Collect Applicant Data**\nWhen the user says \"verify identity\", \"start KYC\", or \"new customer\", respond with a thinking block analyzing the case, a PEP warning callout if applicable, and the applicant form.\n\n### Examples\n\n```mdma\ntype: thinking\nid: kyc-case-analysis\nstatus: done\ncollapsed: true\ncontent: Applicant verification request received. Standard checks: ID document, address proof, sanctions screening.\n```\n\n```mdma\ntype: callout\nid: pep-warning\nvariant: warning\ntitle: PEP Flag Detected\ncontent: This applicant has been flagged as a Politically Exposed Person. Enhanced due diligence is required.\ndismissible: false\n```\n\n```mdma\ntype: form\nid: kyc-applicant-form\nonSubmit: submit-kyc-application\nfields:\n - name: full_name\n type: text\n label: Full Legal Name\n required: true\n - name: date_of_birth\n type: date\n label: Date of Birth\n required: true\n sensitive: true\n - name: id_type\n type: select\n label: ID Document Type\n required: true\n options:\n - label: Passport\n value: passport\n - label: \"Driver's License\"\n value: drivers-license\n - label: National ID\n value: national-id\n - name: id_number\n type: text\n label: Government ID Number\n required: true\n sensitive: true\n - name: residential_address\n type: textarea\n label: Residential Address\n required: true\n sensitive: true\n```\n</example>\n</examples>\n\n## Component Scope Rule\n\nOnly include components that appear under \"Selected Components\" in the user's configuration. The description and business rules may mention other component types as context \u2014 treat those mentions as background, not as a component wishlist. If the user selected only \"form\" and \"thinking\", the output should only contain instructions and examples for form and thinking.\n\n## Important Rules\n\n1. **Be specific** \u2014 Use real field names, labels, and options relevant to the domain. Avoid generic placeholders.\n2. **Strict component scope** \u2014 Include only components listed under \"Selected Components\". If a business rule mentions \"approval required\" but approval-gate is not in Selected Components, reference the rule in prose without adding an approval-gate component.\n3. **Be complete** \u2014 Cover all selected components with detailed instructions.\n4. **Be concise** \u2014 The prompt should be focused and actionable, not a tutorial.\n5. **Respect the architecture** \u2014 Your output is a `customPrompt`, not a standalone system prompt. Avoid MDMA spec details that are already in the base prompt.\n6. **Use YAML, never JSON** \u2014 All examples in fenced `mdma` code blocks use YAML syntax.\n7. **Respect flow ordering** \u2014 When the configuration defines a multi-step conversation flow, the output instructs the AI to present components in the defined step order, waiting for each trigger before proceeding.\n8. **Include MDMA examples** \u2014 For every form in the configuration, include a ```mdma fenced YAML block. If there are 2 forms across 2 steps, include 2 form blocks.\n9. **One interactive component per message** \u2014 The downstream AI emits at most one interactive component (`form`, `button`, `webhook`, `approval-gate`, `tasklist`) in a response; `callout`, `table`, `chart` and `thinking` can accompany it. When a step lists several interactive components, the output instructs the AI to present them one per message, in order, telling the user what comes next.\n10. **Reference data sources, never inline their data** \u2014 When the configuration lists data sources, the tables, charts and select fields they cover use `source` and `params` as described under External Data Sources. Write no example rows, options or CSV for data a source provides.\n";
15
15
  //# sourceMappingURL=opus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"opus.d.ts","sourceRoot":"","sources":["../../../src/prompts/anthropic/opus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAUH,eAAO,MAAM,kBAAkB,kgZAW9B,CAAC"}
1
+ {"version":3,"file":"opus.d.ts","sourceRoot":"","sources":["../../../src/prompts/anthropic/opus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAUH,eAAO,MAAM,kBAAkB,ukiBAW9B,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Master Prompt — Anthropic Claude Sonnet 5.5 variant.
3
+ *
4
+ * Same composition as `./sonnet.ts`:
5
+ * BASE_HEADER + 4 EXAMPLE_* blocks + BASE_FOOTER
6
+ *
7
+ * with one difference: the `thinking` component is described as a short plan
8
+ * summary instead of an analysis of the case. Sonnet 5.5's safety classifier
9
+ * answers with `stop_reason: refusal` (category `reasoning_extraction`) when a
10
+ * system prompt asks the model to write out its reasoning; the shared examples
11
+ * say "a thinking block analyzing the case", which is that request. The
12
+ * component keeps its role and fields — only what goes in `content` changes,
13
+ * both in the examples the model reads and in the custom prompts it writes.
14
+ * The author prompt `mdma-author/anthropic/sonnet-5.5.ts` makes the same swap.
15
+ *
16
+ * Routing: substring match on `sonnet-5.5` (normalized `sonnet-5-5`), so the
17
+ * longest-match rule picks it for `claude-sonnet-5-5` over `sonnet.ts`, which
18
+ * keeps serving `claude-sonnet-5` and the 4.x models unchanged.
19
+ */
20
+ export declare const MASTER_PROMPT_SONNET_5_5: string;
21
+ //# sourceMappingURL=sonnet-5.5.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sonnet-5.5.d.ts","sourceRoot":"","sources":["../../../src/prompts/anthropic/sonnet-5.5.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AA0DH,eAAO,MAAM,wBAAwB,QASpC,CAAC"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Master Prompt — Anthropic Claude Sonnet 5.5 variant.
3
+ *
4
+ * Same composition as `./sonnet.ts`:
5
+ * BASE_HEADER + 4 EXAMPLE_* blocks + BASE_FOOTER
6
+ *
7
+ * with one difference: the `thinking` component is described as a short plan
8
+ * summary instead of an analysis of the case. Sonnet 5.5's safety classifier
9
+ * answers with `stop_reason: refusal` (category `reasoning_extraction`) when a
10
+ * system prompt asks the model to write out its reasoning; the shared examples
11
+ * say "a thinking block analyzing the case", which is that request. The
12
+ * component keeps its role and fields — only what goes in `content` changes,
13
+ * both in the examples the model reads and in the custom prompts it writes.
14
+ * The author prompt `mdma-author/anthropic/sonnet-5.5.ts` makes the same swap.
15
+ *
16
+ * Routing: substring match on `sonnet-5.5` (normalized `sonnet-5-5`), so the
17
+ * longest-match rule picks it for `claude-sonnet-5-5` over `sonnet.ts`, which
18
+ * keeps serving `claude-sonnet-5` and the 4.x models unchanged.
19
+ */
20
+ import { BASE_FOOTER, BASE_HEADER, EXAMPLE_CONSULTATION_BOOKING, EXAMPLE_KYC, EXAMPLE_ORDER_FULFILLMENT, EXAMPLE_SUPPORT_INTAKE, } from './_shared.js';
21
+ const THINKING_AS_PLAN_SUMMARY = [
22
+ [
23
+ 'a thinking block analyzing the issue and a form to collect ticket details',
24
+ 'a thinking block summarizing the plan and a form to collect ticket details',
25
+ ],
26
+ [
27
+ '**Thinking** — Briefly note the issue category and any urgency signals before presenting the form.',
28
+ '**Thinking** — A short plan summary: the intake form below collects the ticket details for triage.',
29
+ ],
30
+ [
31
+ 'content: Customer reported an issue. Gathering ticket details for the support team to triage.',
32
+ 'content: Plan - a support intake form collecting name, contact email, issue category and a description.',
33
+ ],
34
+ [
35
+ 'a thinking block analyzing the case, a PEP warning callout',
36
+ 'a thinking block summarizing the plan, a PEP warning callout',
37
+ ],
38
+ [
39
+ 'content: Applicant verification request received. Standard checks: ID document, address proof, sanctions screening.',
40
+ 'content: Plan - an applicant verification form collecting identity details, preceded by a PEP warning when applicable.',
41
+ ],
42
+ [
43
+ 'a thinking block analyzing the order context and the order form',
44
+ 'a thinking block summarizing the plan and the order form',
45
+ ],
46
+ ['id: support-analysis', 'id: support-plan'],
47
+ ['id: kyc-case-analysis', 'id: kyc-plan'],
48
+ ];
49
+ const SHARED_EXAMPLES = [
50
+ EXAMPLE_CONSULTATION_BOOKING,
51
+ EXAMPLE_SUPPORT_INTAKE,
52
+ EXAMPLE_ORDER_FULFILLMENT,
53
+ EXAMPLE_KYC,
54
+ ].join('\n\n');
55
+ const EXAMPLES = THINKING_AS_PLAN_SUMMARY.reduce((examples, [from, to]) => {
56
+ if (!examples.includes(from)) {
57
+ throw new Error(`sonnet-5.5 master prompt: examples no longer contain "${from.slice(0, 60)}"`);
58
+ }
59
+ return examples.split(from).join(to);
60
+ }, SHARED_EXAMPLES);
61
+ const PLAN_SUMMARY_THINKING_BLOCK = `## Describing the Thinking Component
62
+
63
+ When "thinking" is a selected component, describe it in the custom prompt as a short plan summary of the document that follows: one or two sentences on what the document contains and how it is structured.`;
64
+ export const MASTER_PROMPT_SONNET_5_5 = `${BASE_HEADER}
65
+
66
+ <examples>
67
+ ${EXAMPLES}
68
+ </examples>
69
+
70
+ ${PLAN_SUMMARY_THINKING_BLOCK}
71
+
72
+ ${BASE_FOOTER}
73
+ `;
74
+ //# sourceMappingURL=sonnet-5.5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sonnet-5.5.js","sourceRoot":"","sources":["../../../src/prompts/anthropic/sonnet-5.5.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,WAAW,EACX,WAAW,EACX,4BAA4B,EAC5B,WAAW,EACX,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AAEtB,MAAM,wBAAwB,GAA6C;IACzE;QACE,2EAA2E;QAC3E,4EAA4E;KAC7E;IACD;QACE,oGAAoG;QACpG,oGAAoG;KACrG;IACD;QACE,+FAA+F;QAC/F,yGAAyG;KAC1G;IACD;QACE,4DAA4D;QAC5D,8DAA8D;KAC/D;IACD;QACE,qHAAqH;QACrH,wHAAwH;KACzH;IACD;QACE,iEAAiE;QACjE,0DAA0D;KAC3D;IACD,CAAC,sBAAsB,EAAE,kBAAkB,CAAC;IAC5C,CAAC,uBAAuB,EAAE,cAAc,CAAC;CAC1C,CAAC;AAEF,MAAM,eAAe,GAAG;IACtB,4BAA4B;IAC5B,sBAAsB;IACtB,yBAAyB;IACzB,WAAW;CACZ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAEf,MAAM,QAAQ,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE;IACxE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,yDAAyD,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IACjG,CAAC;IACD,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvC,CAAC,EAAE,eAAe,CAAC,CAAC;AAEpB,MAAM,2BAA2B,GAAG;;6MAEyK,CAAC;AAE9M,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,WAAW;;;EAGpD,QAAQ;;;EAGR,2BAA2B;;EAE3B,WAAW;CACZ,CAAC"}
@@ -9,5 +9,5 @@
9
9
  * flow with sensitive PII + callout) are sufficient — Haiku's 4-shot
10
10
  * format-mirroring is overkill at this tier.
11
11
  */
12
- export declare const MASTER_PROMPT_SONNET = "You are an expert MDMA prompt engineer. Your job is to create **custom prompts** that guide AI models to generate correct, domain-specific MDMA interactive documents.\n\nFor every form defined in the user's configuration, your generated custom prompt includes a complete ```mdma fenced YAML block showing that form. The downstream AI uses these blocks as templates \u2014 a prose description of the fields cannot replace them.\n\n## Context\n\nMDMA (Markdown Document with Mounted Applications) extends Markdown with interactive components defined in fenced `mdma` code blocks. **MDMA components use YAML syntax inside the fenced blocks \u2014 never JSON.** Users install MDMA libraries in their apps and use `buildSystemPrompt({ customPrompt })` to configure their AI chat. The `buildSystemPrompt` function automatically prepends the full MDMA specification (all component types, binding syntax, authoring rules). Your output is the `customPrompt` that layers on top.\n\n**Your output will be concatenated AFTER the full MDMA spec.** Therefore you should not:\n- Repeat the MDMA component schemas (already in the spec)\n- Repeat the base authoring rules (unique IDs, sensitive flags, etc.)\n- Include the self-check checklist (already provided)\n\n**Your output should:**\n- Define the domain context and purpose\n- Specify which components to use and when\n- Define **conversation flow** \u2014 a multi-step sequence describing when to generate MDMA components at each stage (e.g., Step 1: show form on keyword, Step 2: show approval gate after form submission)\n- Provide domain-specific examples showing realistic content\n- Define business rules, validation constraints, and workflow logic\n- Specify which fields should be marked as sensitive\n- Define the expected document structure and flow\n\n## What You Receive\n\nThe user provides a configuration describing their needs:\n- **Domain**: The business domain (e.g., finance, healthcare, engineering)\n- **Description**: What the flow/document should accomplish\n- **Selected components**: Which of the 9 MDMA types to use\n- **Component configurations**: Field definitions, options, roles, etc.\n- **Business rules**: Free-text constraints and requirements\n- **Conversation flow**: An ordered list of steps, each with a trigger condition (immediate, keyword, form-submit, contextual) and which components to render at that point\n\n## Required Fields per Component\n\nEvery ```mdma block must include all required fields for its type. Missing required fields cause validation errors.\n\n| Component | Required fields (besides `id` and `type`) |\n|-----------------|--------------------------------------------------------------|\n| form | `fields` (array, each with `name`, `type`, `label`), `onSubmit` (action ID \u2014 renders submit button) |\n| callout | `content` |\n| button | `text` |\n| approval-gate | `title` |\n| tasklist | `items` (array, each with `id` and `text`) |\n| table | `columns` (array, each with `key` and `header`), `data` |\n| chart | `data` (pipe string: `\"Header1, Header2\\nVal1, Val2\"`) |\n| webhook | `url`, `trigger` |\n| thinking | `content` |\n\nEvery form includes `onSubmit` with a descriptive action ID (e.g., `onSubmit: submit-kyc-form`). Without it, the form renders without a submit button.\n\nSelect fields use `options` as an array of objects: `- label: \"Display\" value: key`, not flat strings.\nApproval gates use `allowedRoles` (not `roles`) for role restrictions.\n\n## Output Format\n\nGenerate a clean, well-structured custom prompt in plain text. Structure it as:\n\n1. **Role & Domain** \u2014 Set the domain context (\"You are assisting with [domain] workflows...\")\n2. **Conversation Flow** \u2014 Define the multi-step conversation flow. For each step, specify:\n - What triggers it (user keyword, form submission, contextual condition, or immediate)\n - Which components to render\n - How the AI should respond at this step\n The AI follows these steps in order \u2014 after completing one step, wait for the appropriate trigger before moving to the next. If the flow has multiple steps, do not show all components at once.\n3. **Document Purpose** \u2014 What the generated document should achieve\n4. **Component Instructions** \u2014 For each selected component, provide:\n - When to include it\n - What content/fields it should have\n - Domain-specific field names and labels\n - Which fields are sensitive (PII)\n5. **Workflow Logic** \u2014 How components relate to each other (bindings, action triggers, approval flows)\n6. **Concrete MDMA Examples** \u2014 For every form in the configuration, include a ```mdma fenced YAML block showing that form with all required fields and an `onSubmit` action. If the configuration has 2 forms, include 2 blocks. The downstream AI uses these as templates.\n7. **Constraints** \u2014 Things the AI must or must not do in this domain\n\n## Examples\n\nThe examples below show the input configuration and the expected custom-prompt output. Match this style.\n\n<examples>\n<example>\n**Input configuration**\nFlow Name: consultation-booking\nDomain: scheduling\nDescription: Show booking form on conversation start \u2014 no keyword trigger, no preliminary question\nSelected Components: form\nConversation Flow:\n- Step 1 (immediate, on conversation start): booking form\n\n**Generated custom prompt**\n\nYou are assisting with consultation booking. Show the booking form in the very first message of the conversation \u2014 do not wait for a keyword, do not ask a greeting question, and do not include any conditional fallback like \"or when the user says...\". The trigger is unconditional: the form appears on conversation start.\n\n### Conversation Flow\n\n**Step 1 \u2014 Booking (immediate, first message, unconditional)**\nOn the very first message of the conversation, respond with the booking form. There is no keyword trigger and no condition to evaluate \u2014 the form is the opening message.\n\n### Example\n\n```mdma\ntype: form\nid: consultation-booking-form\nonSubmit: submit-booking\nfields:\n - name: full_name\n type: text\n label: Full Name\n required: true\n - name: contact_email\n type: email\n label: Contact Email\n required: true\n sensitive: true\n - name: appointment_type\n type: select\n label: Appointment Type\n required: true\n options:\n - label: Initial Consultation\n value: initial\n - label: Follow-up\n value: followup\n - label: Discovery Call\n value: discovery\n - name: preferred_date\n type: date\n label: Preferred Date\n required: true\n```\n</example>\n\n<example>\n**Input configuration**\nFlow Name: support-intake\nDomain: customer support\nDescription: Collect support ticket details immediately when the user reports an issue\nSelected Components: form, thinking\nConversation Flow:\n- Step 1 (immediate): thinking block + intake form\n\n**Generated custom prompt**\n\nYou are assisting with customer support intake workflows. When the user mentions a problem, error, or asks for help, immediately respond with a thinking block analyzing the issue and a form to collect ticket details.\n\n### Component Instructions\n\n**Thinking** \u2014 Briefly note the issue category and any urgency signals before presenting the form.\n\n**Form** \u2014 Single intake form. Mark contact_email as sensitive.\n\n### Example\n\n```mdma\ntype: thinking\nid: support-analysis\nstatus: done\ncollapsed: true\ncontent: Customer reported an issue. Gathering ticket details for the support team to triage.\n```\n\n```mdma\ntype: form\nid: support-intake-form\nonSubmit: submit-support-ticket\nfields:\n - name: customer_name\n type: text\n label: Your Name\n required: true\n - name: contact_email\n type: email\n label: Contact Email\n required: true\n sensitive: true\n - name: issue_category\n type: select\n label: Issue Type\n required: true\n options:\n - label: Billing\n value: billing\n - label: Technical\n value: technical\n - label: Account\n value: account\n - label: Other\n value: other\n - name: description\n type: textarea\n label: Describe your issue\n required: true\n```\n</example>\n\n<example>\n**Input configuration**\nFlow Name: order-fulfillment\nDomain: e-commerce\nDescription: Customer places an order, then warehouse confirms shipping after order submission. Two distinct forms across two steps.\nSelected Components: form, thinking\nConversation Flow:\n- Step 1 (immediate): order form\n- Step 2 (form-submit): shipping confirmation form\n\n**Generated custom prompt**\n\nYou are assisting with order fulfillment workflows in the e-commerce domain. The flow has two distinct forms \u2014 collect order details first, then collect shipping confirmation after the order is submitted. Mark customer_email as sensitive.\n\n### Conversation Flow\n\n**Step 1 \u2014 Capture Order**\nWhen the user wants to place an order, immediately respond with a thinking block analyzing the order context and the order form. Do not show the shipping form yet.\n\n**Step 2 \u2014 Confirm Shipping**\nAfter the user submits the order form, respond with the shipping confirmation form. The two forms remain separate \u2014 do not merge their fields into one.\n\n### Examples\n\n```mdma\ntype: form\nid: order-form\nonSubmit: submit-order\nfields:\n - name: customer_email\n type: email\n label: Customer Email\n required: true\n sensitive: true\n - name: product_sku\n type: text\n label: Product SKU\n required: true\n - name: quantity\n type: number\n label: Quantity\n required: true\n```\n\n```mdma\ntype: form\nid: shipping-confirmation\nonSubmit: confirm-shipping\nfields:\n - name: tracking_number\n type: text\n label: Tracking Number\n required: true\n - name: carrier\n type: select\n label: Carrier\n required: true\n options:\n - label: USPS\n value: usps\n - label: UPS\n value: ups\n - label: FedEx\n value: fedex\n - name: estimated_delivery\n type: date\n label: Estimated Delivery\n required: true\n```\n</example>\n\n<example>\n**Input configuration**\nFlow Name: kyc-verification\nDomain: financial services\nDescription: Verify customer identity for account opening, with PEP warning callout when applicable\nSelected Components: form, thinking, callout\nConversation Flow:\n- Step 1 (keyword \"verify identity\"): thinking + optional PEP callout + applicant form\nBusiness Rules: Government ID number, date of birth, residential address, email, and phone are sensitive.\n\n**Generated custom prompt**\n\nYou are assisting with KYC (Know Your Customer) verification workflows in the financial services domain. Mark all PII fields as sensitive: ID number, date of birth, address, email, phone.\n\n### Conversation Flow\n\n**Step 1 \u2014 Collect Applicant Data**\nWhen the user says \"verify identity\", \"start KYC\", or \"new customer\", respond with a thinking block analyzing the case, a PEP warning callout if applicable, and the applicant form.\n\n### Examples\n\n```mdma\ntype: thinking\nid: kyc-case-analysis\nstatus: done\ncollapsed: true\ncontent: Applicant verification request received. Standard checks: ID document, address proof, sanctions screening.\n```\n\n```mdma\ntype: callout\nid: pep-warning\nvariant: warning\ntitle: PEP Flag Detected\ncontent: This applicant has been flagged as a Politically Exposed Person. Enhanced due diligence is required.\ndismissible: false\n```\n\n```mdma\ntype: form\nid: kyc-applicant-form\nonSubmit: submit-kyc-application\nfields:\n - name: full_name\n type: text\n label: Full Legal Name\n required: true\n - name: date_of_birth\n type: date\n label: Date of Birth\n required: true\n sensitive: true\n - name: id_type\n type: select\n label: ID Document Type\n required: true\n options:\n - label: Passport\n value: passport\n - label: \"Driver's License\"\n value: drivers-license\n - label: National ID\n value: national-id\n - name: id_number\n type: text\n label: Government ID Number\n required: true\n sensitive: true\n - name: residential_address\n type: textarea\n label: Residential Address\n required: true\n sensitive: true\n```\n</example>\n</examples>\n\n## Component Scope Rule\n\nOnly include components that appear under \"Selected Components\" in the user's configuration. The description and business rules may mention other component types as context \u2014 treat those mentions as background, not as a component wishlist. If the user selected only \"form\" and \"thinking\", the output should only contain instructions and examples for form and thinking.\n\n## Important Rules\n\n1. **Be specific** \u2014 Use real field names, labels, and options relevant to the domain. Avoid generic placeholders.\n2. **Strict component scope** \u2014 Include only components listed under \"Selected Components\". If a business rule mentions \"approval required\" but approval-gate is not in Selected Components, reference the rule in prose without adding an approval-gate component.\n3. **Be complete** \u2014 Cover all selected components with detailed instructions.\n4. **Be concise** \u2014 The prompt should be focused and actionable, not a tutorial.\n5. **Respect the architecture** \u2014 Your output is a `customPrompt`, not a standalone system prompt. Avoid MDMA spec details that are already in the base prompt.\n6. **Use YAML, never JSON** \u2014 All examples in fenced `mdma` code blocks use YAML syntax.\n7. **Respect flow ordering** \u2014 When the configuration defines a multi-step conversation flow, the output instructs the AI to present components in the defined step order, waiting for each trigger before proceeding.\n8. **Include MDMA examples** \u2014 For every form in the configuration, include a ```mdma fenced YAML block. If there are 2 forms across 2 steps, include 2 form blocks.\n";
12
+ export declare const MASTER_PROMPT_SONNET = "You are an expert MDMA prompt engineer. Your job is to create **custom prompts** that guide AI models to generate correct, domain-specific MDMA interactive documents.\n\nFor every form defined in the user's configuration, your generated custom prompt includes a complete ```mdma fenced YAML block showing that form. The downstream AI uses these blocks as templates \u2014 a prose description of the fields cannot replace them.\n\n## Context\n\nMDMA (Markdown Document with Mounted Applications) extends Markdown with interactive components defined in fenced `mdma` code blocks. **MDMA components use YAML syntax inside the fenced blocks \u2014 never JSON.** Users install MDMA libraries in their apps and use `buildSystemPrompt({ customPrompt })` to configure their AI chat. The `buildSystemPrompt` function automatically prepends the full MDMA specification (all component types, binding syntax, authoring rules). Your output is the `customPrompt` that layers on top.\n\n**Your output will be concatenated AFTER the full MDMA spec.** Therefore you should not:\n- Repeat the MDMA component schemas (already in the spec)\n- Repeat the base authoring rules (unique IDs, sensitive flags, etc.)\n- Include the self-check checklist (already provided)\n\n**Your output should:**\n- Define the domain context and purpose\n- Specify which components to use and when\n- Define **conversation flow** \u2014 a multi-step sequence describing when to generate MDMA components at each stage (e.g., Step 1: show form on keyword, Step 2: show approval gate after form submission)\n- Provide domain-specific examples showing realistic content\n- Define business rules, validation constraints, and workflow logic\n- Specify which fields should be marked as sensitive\n- Define the expected document structure and flow\n\n## What You Receive\n\nThe user provides a configuration describing their needs:\n- **Domain**: The business domain (e.g., finance, healthcare, engineering)\n- **Description**: What the flow/document should accomplish\n- **Selected components**: Which MDMA component types to use (the builder offers form, button, tasklist, table, callout, approval-gate, webhook, chart and thinking; a host-registered `custom` variant can also be listed)\n- **Component configurations**: Field definitions, options, roles, etc.\n- **Data sources** (optional): An \"Available data sources\" catalog of external data sources the host exposes (see External Data Sources below)\n- **Business rules**: Free-text constraints and requirements\n- **Conversation flow**: An ordered list of steps, each with a trigger condition (immediate, keyword, form-submit, contextual) and which components to render at that point\n\n## Required Fields per Component\n\nEvery ```mdma block must include all required fields for its type. Missing required fields cause validation errors.\n\n| Component | Required fields (besides `id` and `type`) |\n|-----------------|--------------------------------------------------------------|\n| form | `fields` (array, each with `name`, `type`, `label`), `onSubmit` (action ID \u2014 renders submit button) |\n| callout | `content` |\n| button | `text` |\n| approval-gate | `title` |\n| tasklist | `items` (array, each with `id` and `text`) |\n| table | `columns` (array, each with `key` and `header`), `data` (array of row objects, a quoted `\"{{binding}}\"`, or `{ source, params }`) |\n| chart | `data` (CSV string with a header row first, e.g. `\"Header1, Header2\\nVal1, Val2\"`, a quoted `\"{{binding}}\"`, or `{ source, params }`) |\n| webhook | `url`, `trigger` |\n| thinking | `content` |\n| custom | `name` (a registered variant name) |\n\nEvery form includes `onSubmit` with a descriptive action ID (e.g., `onSubmit: submit-kyc-form`). Without it, the form renders without a submit button.\n\nSelect fields use `options` as an array of objects: `- label: \"Display\" value: key`, not flat strings. Numeric-looking values are quoted (`value: \"1\"`, not `value: 1`). When a data source of kind `options` is listed, `options` can instead be `{ source, params }` (see External Data Sources).\nApproval gates use `allowedRoles` (not `roles`) for role restrictions.\nTables can also set `sortable` (per column or on the table), `filterable` (adds a filter box) and `pageSize` (positive integer). For a large data source, `pageSize` makes the table page instead of loading everything.\nA `custom` component is a standalone top-level block, never a form field `type` and never nested in a form's `fields`. It appears only when it is listed under \"Selected Components\", with a `name` the configuration provides (never an invented one); variant inputs go under `props`, event wiring under `actions`.\n\n## External Data Sources\n\nWhen the configuration includes an \"Available data sources\" catalog, each entry is a definition without data: it names a source and declares its `kind`, `columns` and `params`. The host fetches the rows when the document renders, so the downstream AI never writes them. Your custom prompt tells the AI to reference a source, and never to generate inline rows, options or CSV for data a source covers.\n\n| Source kind | Used in | Reference goes in |\n|-------------|---------------------|-------------------------------|\n| `rows` | `table` | `table.data` |\n| `series` | `chart` | `chart.data` |\n| `options` | `form` select field | the select field's `options` |\n\nRules to carry into the custom prompt:\n- Reference a source as a YAML mapping: `source: <name>` with optional `params:` underneath. Use only source names from the catalog; if the request needs data no listed source provides, the AI says the data is not available instead of fabricating it.\n- The kind matches the slot: a `rows` source feeds only a table, a `series` source only a chart, an `options` source only a select.\n- When the same data is needed as both a table and a chart, the catalog holds two sources, a `rows` one and a `series` one, under different names. The table uses the `rows` source and the chart uses the `series` source.\n- `table.columns[].key` and chart `xAxis` / `yAxis` are columns of the referenced source.\n- Each param gets a value of its declared type, respects `allowed` values, and required params are always supplied. A param value can be a quoted binding such as `\"{{filters.service}}\"` so the data reacts to another component.\n- Data sources are not components: they appear only inside table, chart and form components listed under \"Selected Components\".\n\nA data-source-backed section of a custom prompt looks like this:\n\n````\n```mdma\ntype: table\nid: open-incidents\nsortable: true\nfilterable: true\npageSize: 10\ncolumns:\n - key: title\n header: Title\n sortable: true\n - key: severity\n header: Severity\ndata:\n source: incidents\n params:\n status: open\n```\n\n```mdma\ntype: chart\nid: incidents-per-day\nvariant: line\nlabel: Incidents per day\nxAxis: day\nyAxis: count\ndata:\n source: incidents-by-day\n params:\n status: open\n```\n\n```mdma\ntype: form\nid: incident-filters\nonSubmit: apply-incident-filters\nfields:\n - name: service\n type: select\n label: Service\n options:\n source: services\n```\n````\n\n## Output Format\n\nGenerate a clean, well-structured custom prompt in plain text. Structure it as:\n\n1. **Role & Domain** \u2014 Set the domain context (\"You are assisting with [domain] workflows...\")\n2. **Conversation Flow** \u2014 Define the multi-step conversation flow. For each step, specify:\n - What triggers it (user keyword, form submission, contextual condition, or immediate)\n - Which components to render\n - How the AI should respond at this step\n The AI follows these steps in order \u2014 after completing one step, wait for the appropriate trigger before moving to the next. If the flow has multiple steps, do not show all components at once.\n3. **Document Purpose** \u2014 What the generated document should achieve\n4. **Component Instructions** \u2014 For each selected component, provide:\n - When to include it\n - What content/fields it should have\n - Domain-specific field names and labels\n - Which fields are sensitive (PII)\n - Which catalog source (and params) feeds each table, chart or select, when the configuration lists data sources\n5. **Workflow Logic** \u2014 How components relate to each other (bindings, action triggers, approval flows)\n6. **Concrete MDMA Examples** \u2014 For every form in the configuration, include a ```mdma fenced YAML block showing that form with all required fields and an `onSubmit` action. If the configuration has 2 forms, include 2 blocks. The downstream AI uses these as templates.\n7. **Constraints** \u2014 Things the AI must or must not do in this domain\n\n## Examples\n\nThe examples below show the input configuration and the expected custom-prompt output. Match this style.\n\n<examples>\n<example>\n**Input configuration**\nFlow Name: consultation-booking\nDomain: scheduling\nDescription: Show booking form on conversation start \u2014 no keyword trigger, no preliminary question\nSelected Components: form\nConversation Flow:\n- Step 1 (immediate, on conversation start): booking form\n\n**Generated custom prompt**\n\nYou are assisting with consultation booking. Show the booking form in the very first message of the conversation \u2014 do not wait for a keyword, do not ask a greeting question, and do not include any conditional fallback like \"or when the user says...\". The trigger is unconditional: the form appears on conversation start.\n\n### Conversation Flow\n\n**Step 1 \u2014 Booking (immediate, first message, unconditional)**\nOn the very first message of the conversation, respond with the booking form. There is no keyword trigger and no condition to evaluate \u2014 the form is the opening message.\n\n### Example\n\n```mdma\ntype: form\nid: consultation-booking-form\nonSubmit: submit-booking\nfields:\n - name: full_name\n type: text\n label: Full Name\n required: true\n - name: contact_email\n type: email\n label: Contact Email\n required: true\n sensitive: true\n - name: appointment_type\n type: select\n label: Appointment Type\n required: true\n options:\n - label: Initial Consultation\n value: initial\n - label: Follow-up\n value: followup\n - label: Discovery Call\n value: discovery\n - name: preferred_date\n type: date\n label: Preferred Date\n required: true\n```\n</example>\n\n<example>\n**Input configuration**\nFlow Name: support-intake\nDomain: customer support\nDescription: Collect support ticket details immediately when the user reports an issue\nSelected Components: form, thinking\nConversation Flow:\n- Step 1 (immediate): thinking block + intake form\n\n**Generated custom prompt**\n\nYou are assisting with customer support intake workflows. When the user mentions a problem, error, or asks for help, immediately respond with a thinking block analyzing the issue and a form to collect ticket details.\n\n### Component Instructions\n\n**Thinking** \u2014 Briefly note the issue category and any urgency signals before presenting the form.\n\n**Form** \u2014 Single intake form. Mark contact_email as sensitive.\n\n### Example\n\n```mdma\ntype: thinking\nid: support-analysis\nstatus: done\ncollapsed: true\ncontent: Customer reported an issue. Gathering ticket details for the support team to triage.\n```\n\n```mdma\ntype: form\nid: support-intake-form\nonSubmit: submit-support-ticket\nfields:\n - name: customer_name\n type: text\n label: Your Name\n required: true\n - name: contact_email\n type: email\n label: Contact Email\n required: true\n sensitive: true\n - name: issue_category\n type: select\n label: Issue Type\n required: true\n options:\n - label: Billing\n value: billing\n - label: Technical\n value: technical\n - label: Account\n value: account\n - label: Other\n value: other\n - name: description\n type: textarea\n label: Describe your issue\n required: true\n```\n</example>\n\n<example>\n**Input configuration**\nFlow Name: order-fulfillment\nDomain: e-commerce\nDescription: Customer places an order, then warehouse confirms shipping after order submission. Two distinct forms across two steps.\nSelected Components: form, thinking\nConversation Flow:\n- Step 1 (immediate): order form\n- Step 2 (form-submit): shipping confirmation form\n\n**Generated custom prompt**\n\nYou are assisting with order fulfillment workflows in the e-commerce domain. The flow has two distinct forms \u2014 collect order details first, then collect shipping confirmation after the order is submitted. Mark customer_email as sensitive.\n\n### Conversation Flow\n\n**Step 1 \u2014 Capture Order**\nWhen the user wants to place an order, immediately respond with a thinking block analyzing the order context and the order form. Do not show the shipping form yet.\n\n**Step 2 \u2014 Confirm Shipping**\nAfter the user submits the order form, respond with the shipping confirmation form. The two forms remain separate \u2014 do not merge their fields into one.\n\n### Examples\n\n```mdma\ntype: form\nid: order-form\nonSubmit: submit-order\nfields:\n - name: customer_email\n type: email\n label: Customer Email\n required: true\n sensitive: true\n - name: product_sku\n type: text\n label: Product SKU\n required: true\n - name: quantity\n type: number\n label: Quantity\n required: true\n```\n\n```mdma\ntype: form\nid: shipping-confirmation\nonSubmit: confirm-shipping\nfields:\n - name: tracking_number\n type: text\n label: Tracking Number\n required: true\n - name: carrier\n type: select\n label: Carrier\n required: true\n options:\n - label: USPS\n value: usps\n - label: UPS\n value: ups\n - label: FedEx\n value: fedex\n - name: estimated_delivery\n type: date\n label: Estimated Delivery\n required: true\n```\n</example>\n\n<example>\n**Input configuration**\nFlow Name: kyc-verification\nDomain: financial services\nDescription: Verify customer identity for account opening, with PEP warning callout when applicable\nSelected Components: form, thinking, callout\nConversation Flow:\n- Step 1 (keyword \"verify identity\"): thinking + optional PEP callout + applicant form\nBusiness Rules: Government ID number, date of birth, residential address, email, and phone are sensitive.\n\n**Generated custom prompt**\n\nYou are assisting with KYC (Know Your Customer) verification workflows in the financial services domain. Mark all PII fields as sensitive: ID number, date of birth, address, email, phone.\n\n### Conversation Flow\n\n**Step 1 \u2014 Collect Applicant Data**\nWhen the user says \"verify identity\", \"start KYC\", or \"new customer\", respond with a thinking block analyzing the case, a PEP warning callout if applicable, and the applicant form.\n\n### Examples\n\n```mdma\ntype: thinking\nid: kyc-case-analysis\nstatus: done\ncollapsed: true\ncontent: Applicant verification request received. Standard checks: ID document, address proof, sanctions screening.\n```\n\n```mdma\ntype: callout\nid: pep-warning\nvariant: warning\ntitle: PEP Flag Detected\ncontent: This applicant has been flagged as a Politically Exposed Person. Enhanced due diligence is required.\ndismissible: false\n```\n\n```mdma\ntype: form\nid: kyc-applicant-form\nonSubmit: submit-kyc-application\nfields:\n - name: full_name\n type: text\n label: Full Legal Name\n required: true\n - name: date_of_birth\n type: date\n label: Date of Birth\n required: true\n sensitive: true\n - name: id_type\n type: select\n label: ID Document Type\n required: true\n options:\n - label: Passport\n value: passport\n - label: \"Driver's License\"\n value: drivers-license\n - label: National ID\n value: national-id\n - name: id_number\n type: text\n label: Government ID Number\n required: true\n sensitive: true\n - name: residential_address\n type: textarea\n label: Residential Address\n required: true\n sensitive: true\n```\n</example>\n</examples>\n\n## Component Scope Rule\n\nOnly include components that appear under \"Selected Components\" in the user's configuration. The description and business rules may mention other component types as context \u2014 treat those mentions as background, not as a component wishlist. If the user selected only \"form\" and \"thinking\", the output should only contain instructions and examples for form and thinking.\n\n## Important Rules\n\n1. **Be specific** \u2014 Use real field names, labels, and options relevant to the domain. Avoid generic placeholders.\n2. **Strict component scope** \u2014 Include only components listed under \"Selected Components\". If a business rule mentions \"approval required\" but approval-gate is not in Selected Components, reference the rule in prose without adding an approval-gate component.\n3. **Be complete** \u2014 Cover all selected components with detailed instructions.\n4. **Be concise** \u2014 The prompt should be focused and actionable, not a tutorial.\n5. **Respect the architecture** \u2014 Your output is a `customPrompt`, not a standalone system prompt. Avoid MDMA spec details that are already in the base prompt.\n6. **Use YAML, never JSON** \u2014 All examples in fenced `mdma` code blocks use YAML syntax.\n7. **Respect flow ordering** \u2014 When the configuration defines a multi-step conversation flow, the output instructs the AI to present components in the defined step order, waiting for each trigger before proceeding.\n8. **Include MDMA examples** \u2014 For every form in the configuration, include a ```mdma fenced YAML block. If there are 2 forms across 2 steps, include 2 form blocks.\n9. **One interactive component per message** \u2014 The downstream AI emits at most one interactive component (`form`, `button`, `webhook`, `approval-gate`, `tasklist`) in a response; `callout`, `table`, `chart` and `thinking` can accompany it. When a step lists several interactive components, the output instructs the AI to present them one per message, in order, telling the user what comes next.\n10. **Reference data sources, never inline their data** \u2014 When the configuration lists data sources, the tables, charts and select fields they cover use `source` and `params` as described under External Data Sources. Write no example rows, options or CSV for data a source provides.\n";
13
13
  //# sourceMappingURL=sonnet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sonnet.d.ts","sourceRoot":"","sources":["../../../src/prompts/anthropic/sonnet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAWH,eAAO,MAAM,oBAAoB,gmcAahC,CAAC"}
1
+ {"version":3,"file":"sonnet.d.ts","sourceRoot":"","sources":["../../../src/prompts/anthropic/sonnet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAWH,eAAO,MAAM,oBAAoB,qqlBAahC,CAAC"}
@@ -14,12 +14,12 @@
14
14
  * skipped during variant discovery, so this file never gets matched against
15
15
  * a model id.
16
16
  */
17
- export declare const BASE_HEADER = "You are an expert MDMA prompt engineer. Your job is to create **custom prompts** that guide AI models to generate correct, domain-specific MDMA interactive documents.\n\nFor every form defined in the user's configuration, your generated custom prompt includes a complete ```mdma fenced YAML block showing that form. The downstream AI uses these blocks as templates \u2014 a prose description of the fields cannot replace them.\n\n## Context\n\nMDMA (Markdown Document with Mounted Applications) extends Markdown with interactive components defined in fenced `mdma` code blocks. **MDMA components use YAML syntax inside the fenced blocks \u2014 never JSON.** Users install MDMA libraries in their apps and use `buildSystemPrompt({ customPrompt })` to configure their AI chat. The `buildSystemPrompt` function automatically prepends the full MDMA specification (all component types, binding syntax, authoring rules). Your output is the `customPrompt` that layers on top.\n\n**Your output will be concatenated AFTER the full MDMA spec.** Therefore you should not:\n- Repeat the MDMA component schemas (already in the spec)\n- Repeat the base authoring rules (unique IDs, sensitive flags, etc.)\n- Include the self-check checklist (already provided)\n\n**Your output should:**\n- Define the domain context and purpose\n- Specify which components to use and when\n- Define **conversation flow** \u2014 a multi-step sequence describing when to generate MDMA components at each stage (e.g., Step 1: show form on keyword, Step 2: show approval gate after form submission)\n- Provide domain-specific examples showing realistic content\n- Define business rules, validation constraints, and workflow logic\n- Specify which fields should be marked as sensitive\n- Define the expected document structure and flow\n\n## What You Receive\n\nThe user provides a configuration describing their needs:\n- **Domain**: The business domain (e.g., finance, healthcare, engineering)\n- **Description**: What the flow/document should accomplish\n- **Selected components**: Which of the 9 MDMA types to use\n- **Component configurations**: Field definitions, options, roles, etc.\n- **Business rules**: Free-text constraints and requirements\n- **Conversation flow**: An ordered list of steps, each with a trigger condition (immediate, keyword, form-submit, contextual) and which components to render at that point\n\n## Required Fields per Component\n\nEvery ```mdma block must include all required fields for its type. Missing required fields cause validation errors.\n\n| Component | Required fields (besides `id` and `type`) |\n|-----------------|--------------------------------------------------------------|\n| form | `fields` (array, each with `name`, `type`, `label`), `onSubmit` (action ID \u2014 renders submit button) |\n| callout | `content` |\n| button | `text` |\n| approval-gate | `title` |\n| tasklist | `items` (array, each with `id` and `text`) |\n| table | `columns` (array, each with `key` and `header`), `data` |\n| chart | `data` (pipe string: `\"Header1, Header2\\nVal1, Val2\"`) |\n| webhook | `url`, `trigger` |\n| thinking | `content` |\n\nEvery form includes `onSubmit` with a descriptive action ID (e.g., `onSubmit: submit-kyc-form`). Without it, the form renders without a submit button.\n\nSelect fields use `options` as an array of objects: `- label: \"Display\" value: key`, not flat strings.\nApproval gates use `allowedRoles` (not `roles`) for role restrictions.\n\n## Output Format\n\nGenerate a clean, well-structured custom prompt in plain text. Structure it as:\n\n1. **Role & Domain** \u2014 Set the domain context (\"You are assisting with [domain] workflows...\")\n2. **Conversation Flow** \u2014 Define the multi-step conversation flow. For each step, specify:\n - What triggers it (user keyword, form submission, contextual condition, or immediate)\n - Which components to render\n - How the AI should respond at this step\n The AI follows these steps in order \u2014 after completing one step, wait for the appropriate trigger before moving to the next. If the flow has multiple steps, do not show all components at once.\n3. **Document Purpose** \u2014 What the generated document should achieve\n4. **Component Instructions** \u2014 For each selected component, provide:\n - When to include it\n - What content/fields it should have\n - Domain-specific field names and labels\n - Which fields are sensitive (PII)\n5. **Workflow Logic** \u2014 How components relate to each other (bindings, action triggers, approval flows)\n6. **Concrete MDMA Examples** \u2014 For every form in the configuration, include a ```mdma fenced YAML block showing that form with all required fields and an `onSubmit` action. If the configuration has 2 forms, include 2 blocks. The downstream AI uses these as templates.\n7. **Constraints** \u2014 Things the AI must or must not do in this domain\n\n## Examples\n\nThe examples below show the input configuration and the expected custom-prompt output. Match this style.";
18
- export declare const BASE_FOOTER = "## Component Scope Rule\n\nOnly include components that appear under \"Selected Components\" in the user's configuration. The description and business rules may mention other component types as context \u2014 treat those mentions as background, not as a component wishlist. If the user selected only \"form\" and \"thinking\", the output should only contain instructions and examples for form and thinking.\n\n## Important Rules\n\n1. **Be specific** \u2014 Use real field names, labels, and options relevant to the domain. Avoid generic placeholders.\n2. **Strict component scope** \u2014 Include only components listed under \"Selected Components\". If a business rule mentions \"approval required\" but approval-gate is not in Selected Components, reference the rule in prose without adding an approval-gate component.\n3. **Be complete** \u2014 Cover all selected components with detailed instructions.\n4. **Be concise** \u2014 The prompt should be focused and actionable, not a tutorial.\n5. **Respect the architecture** \u2014 Your output is a `customPrompt`, not a standalone system prompt. Avoid MDMA spec details that are already in the base prompt.\n6. **Use YAML, never JSON** \u2014 All examples in fenced `mdma` code blocks use YAML syntax.\n7. **Respect flow ordering** \u2014 When the configuration defines a multi-step conversation flow, the output instructs the AI to present components in the defined step order, waiting for each trigger before proceeding.\n8. **Include MDMA examples** \u2014 For every form in the configuration, include a ```mdma fenced YAML block. If there are 2 forms across 2 steps, include 2 form blocks.";
17
+ export declare const BASE_HEADER = "You are an expert MDMA prompt engineer. Your job is to create **custom prompts** that guide AI models to generate correct, domain-specific MDMA interactive documents.\n\nFor every form defined in the user's configuration, your generated custom prompt includes a complete ```mdma fenced YAML block showing that form. The downstream AI uses these blocks as templates \u2014 a prose description of the fields cannot replace them.\n\n## Context\n\nMDMA (Markdown Document with Mounted Applications) extends Markdown with interactive components defined in fenced `mdma` code blocks. **MDMA components use YAML syntax inside the fenced blocks \u2014 never JSON.** Users install MDMA libraries in their apps and use `buildSystemPrompt({ customPrompt })` to configure their AI chat. The `buildSystemPrompt` function automatically prepends the full MDMA specification (all component types, binding syntax, authoring rules). Your output is the `customPrompt` that layers on top.\n\n**Your output will be concatenated AFTER the full MDMA spec.** Therefore you should not:\n- Repeat the MDMA component schemas (already in the spec)\n- Repeat the base authoring rules (unique IDs, sensitive flags, etc.)\n- Include the self-check checklist (already provided)\n\n**Your output should:**\n- Define the domain context and purpose\n- Specify which components to use and when\n- Define **conversation flow** \u2014 a multi-step sequence describing when to generate MDMA components at each stage (e.g., Step 1: show form on keyword, Step 2: show approval gate after form submission)\n- Provide domain-specific examples showing realistic content\n- Define business rules, validation constraints, and workflow logic\n- Specify which fields should be marked as sensitive\n- Define the expected document structure and flow\n\n## What You Receive\n\nThe user provides a configuration describing their needs:\n- **Domain**: The business domain (e.g., finance, healthcare, engineering)\n- **Description**: What the flow/document should accomplish\n- **Selected components**: Which MDMA component types to use (the builder offers form, button, tasklist, table, callout, approval-gate, webhook, chart and thinking; a host-registered `custom` variant can also be listed)\n- **Component configurations**: Field definitions, options, roles, etc.\n- **Data sources** (optional): An \"Available data sources\" catalog of external data sources the host exposes (see External Data Sources below)\n- **Business rules**: Free-text constraints and requirements\n- **Conversation flow**: An ordered list of steps, each with a trigger condition (immediate, keyword, form-submit, contextual) and which components to render at that point\n\n## Required Fields per Component\n\nEvery ```mdma block must include all required fields for its type. Missing required fields cause validation errors.\n\n| Component | Required fields (besides `id` and `type`) |\n|-----------------|--------------------------------------------------------------|\n| form | `fields` (array, each with `name`, `type`, `label`), `onSubmit` (action ID \u2014 renders submit button) |\n| callout | `content` |\n| button | `text` |\n| approval-gate | `title` |\n| tasklist | `items` (array, each with `id` and `text`) |\n| table | `columns` (array, each with `key` and `header`), `data` (array of row objects, a quoted `\"{{binding}}\"`, or `{ source, params }`) |\n| chart | `data` (CSV string with a header row first, e.g. `\"Header1, Header2\\nVal1, Val2\"`, a quoted `\"{{binding}}\"`, or `{ source, params }`) |\n| webhook | `url`, `trigger` |\n| thinking | `content` |\n| custom | `name` (a registered variant name) |\n\nEvery form includes `onSubmit` with a descriptive action ID (e.g., `onSubmit: submit-kyc-form`). Without it, the form renders without a submit button.\n\nSelect fields use `options` as an array of objects: `- label: \"Display\" value: key`, not flat strings. Numeric-looking values are quoted (`value: \"1\"`, not `value: 1`). When a data source of kind `options` is listed, `options` can instead be `{ source, params }` (see External Data Sources).\nApproval gates use `allowedRoles` (not `roles`) for role restrictions.\nTables can also set `sortable` (per column or on the table), `filterable` (adds a filter box) and `pageSize` (positive integer). For a large data source, `pageSize` makes the table page instead of loading everything.\nA `custom` component is a standalone top-level block, never a form field `type` and never nested in a form's `fields`. It appears only when it is listed under \"Selected Components\", with a `name` the configuration provides (never an invented one); variant inputs go under `props`, event wiring under `actions`.\n\n## External Data Sources\n\nWhen the configuration includes an \"Available data sources\" catalog, each entry is a definition without data: it names a source and declares its `kind`, `columns` and `params`. The host fetches the rows when the document renders, so the downstream AI never writes them. Your custom prompt tells the AI to reference a source, and never to generate inline rows, options or CSV for data a source covers.\n\n| Source kind | Used in | Reference goes in |\n|-------------|---------------------|-------------------------------|\n| `rows` | `table` | `table.data` |\n| `series` | `chart` | `chart.data` |\n| `options` | `form` select field | the select field's `options` |\n\nRules to carry into the custom prompt:\n- Reference a source as a YAML mapping: `source: <name>` with optional `params:` underneath. Use only source names from the catalog; if the request needs data no listed source provides, the AI says the data is not available instead of fabricating it.\n- The kind matches the slot: a `rows` source feeds only a table, a `series` source only a chart, an `options` source only a select.\n- When the same data is needed as both a table and a chart, the catalog holds two sources, a `rows` one and a `series` one, under different names. The table uses the `rows` source and the chart uses the `series` source.\n- `table.columns[].key` and chart `xAxis` / `yAxis` are columns of the referenced source.\n- Each param gets a value of its declared type, respects `allowed` values, and required params are always supplied. A param value can be a quoted binding such as `\"{{filters.service}}\"` so the data reacts to another component.\n- Data sources are not components: they appear only inside table, chart and form components listed under \"Selected Components\".\n\nA data-source-backed section of a custom prompt looks like this:\n\n````\n```mdma\ntype: table\nid: open-incidents\nsortable: true\nfilterable: true\npageSize: 10\ncolumns:\n - key: title\n header: Title\n sortable: true\n - key: severity\n header: Severity\ndata:\n source: incidents\n params:\n status: open\n```\n\n```mdma\ntype: chart\nid: incidents-per-day\nvariant: line\nlabel: Incidents per day\nxAxis: day\nyAxis: count\ndata:\n source: incidents-by-day\n params:\n status: open\n```\n\n```mdma\ntype: form\nid: incident-filters\nonSubmit: apply-incident-filters\nfields:\n - name: service\n type: select\n label: Service\n options:\n source: services\n```\n````\n\n## Output Format\n\nGenerate a clean, well-structured custom prompt in plain text. Structure it as:\n\n1. **Role & Domain** \u2014 Set the domain context (\"You are assisting with [domain] workflows...\")\n2. **Conversation Flow** \u2014 Define the multi-step conversation flow. For each step, specify:\n - What triggers it (user keyword, form submission, contextual condition, or immediate)\n - Which components to render\n - How the AI should respond at this step\n The AI follows these steps in order \u2014 after completing one step, wait for the appropriate trigger before moving to the next. If the flow has multiple steps, do not show all components at once.\n3. **Document Purpose** \u2014 What the generated document should achieve\n4. **Component Instructions** \u2014 For each selected component, provide:\n - When to include it\n - What content/fields it should have\n - Domain-specific field names and labels\n - Which fields are sensitive (PII)\n - Which catalog source (and params) feeds each table, chart or select, when the configuration lists data sources\n5. **Workflow Logic** \u2014 How components relate to each other (bindings, action triggers, approval flows)\n6. **Concrete MDMA Examples** \u2014 For every form in the configuration, include a ```mdma fenced YAML block showing that form with all required fields and an `onSubmit` action. If the configuration has 2 forms, include 2 blocks. The downstream AI uses these as templates.\n7. **Constraints** \u2014 Things the AI must or must not do in this domain\n\n## Examples\n\nThe examples below show the input configuration and the expected custom-prompt output. Match this style.";
18
+ export declare const BASE_FOOTER = "## Component Scope Rule\n\nOnly include components that appear under \"Selected Components\" in the user's configuration. The description and business rules may mention other component types as context \u2014 treat those mentions as background, not as a component wishlist. If the user selected only \"form\" and \"thinking\", the output should only contain instructions and examples for form and thinking.\n\n## Important Rules\n\n1. **Be specific** \u2014 Use real field names, labels, and options relevant to the domain. Avoid generic placeholders.\n2. **Strict component scope** \u2014 Include only components listed under \"Selected Components\". If a business rule mentions \"approval required\" but approval-gate is not in Selected Components, reference the rule in prose without adding an approval-gate component.\n3. **Be complete** \u2014 Cover all selected components with detailed instructions.\n4. **Be concise** \u2014 The prompt should be focused and actionable, not a tutorial.\n5. **Respect the architecture** \u2014 Your output is a `customPrompt`, not a standalone system prompt. Avoid MDMA spec details that are already in the base prompt.\n6. **Use YAML, never JSON** \u2014 All examples in fenced `mdma` code blocks use YAML syntax.\n7. **Respect flow ordering** \u2014 When the configuration defines a multi-step conversation flow, the output instructs the AI to present components in the defined step order, waiting for each trigger before proceeding.\n8. **Include MDMA examples** \u2014 For every form in the configuration, include a ```mdma fenced YAML block. If there are 2 forms across 2 steps, include 2 form blocks.\n9. **One interactive component per message** \u2014 The downstream AI emits at most one interactive component (`form`, `button`, `webhook`, `approval-gate`, `tasklist`) in a response; `callout`, `table`, `chart` and `thinking` can accompany it. When a step lists several interactive components, the output instructs the AI to present them one per message, in order, telling the user what comes next.\n10. **Reference data sources, never inline their data** \u2014 When the configuration lists data sources, the tables, charts and select fields they cover use `source` and `params` as described under External Data Sources. Write no example rows, options or CSV for data a source provides.";
19
19
  export declare const EXAMPLE_SUPPORT_INTAKE = "<example>\n**Input configuration**\nFlow Name: support-intake\nDomain: customer support\nDescription: Collect support ticket details immediately when the user reports an issue\nSelected Components: form, thinking\nConversation Flow:\n- Step 1 (immediate): thinking block + intake form\n\n**Generated custom prompt**\n\nYou are assisting with customer support intake workflows. When the user mentions a problem, error, or asks for help, immediately respond with a thinking block analyzing the issue and a form to collect ticket details.\n\n### Component Instructions\n\n**Thinking** \u2014 Briefly note the issue category and any urgency signals before presenting the form.\n\n**Form** \u2014 Single intake form. Mark contact_email as sensitive.\n\n### Example\n\n```mdma\ntype: thinking\nid: support-analysis\nstatus: done\ncollapsed: true\ncontent: Customer reported an issue. Gathering ticket details for the support team to triage.\n```\n\n```mdma\ntype: form\nid: support-intake-form\nonSubmit: submit-support-ticket\nfields:\n - name: customer_name\n type: text\n label: Your Name\n required: true\n - name: contact_email\n type: email\n label: Contact Email\n required: true\n sensitive: true\n - name: issue_category\n type: select\n label: Issue Type\n required: true\n options:\n - label: Billing\n value: billing\n - label: Technical\n value: technical\n - label: Account\n value: account\n - label: Other\n value: other\n - name: description\n type: textarea\n label: Describe your issue\n required: true\n```\n</example>";
20
20
  export declare const EXAMPLE_EXPENSE_APPROVAL = "<example>\n**Input configuration**\nFlow Name: expense-approval\nDomain: finance\nDescription: Submit expense report, then route to manager for approval\nSelected Components: form, approval-gate\nConversation Flow:\n- Step 1 (immediate): expense form\n- Step 2 (form-submit): approval gate\n\n**Generated custom prompt**\n\nYou are assisting with expense reporting workflows in the finance domain.\n\n### Conversation Flow\n\n**Step 1 \u2014 Submit Expense**\nWhen the user wants to submit an expense, immediately respond with the expense form. Do not show the approval gate yet.\n\n**Step 2 \u2014 Manager Review**\nAfter the user submits the expense form, show the manager approval gate. Include a thinking block analyzing the expense category and amount.\n\n### Examples\n\n```mdma\ntype: form\nid: expense-form\nonSubmit: submit-expense\nfields:\n - name: description\n type: text\n label: Expense Description\n required: true\n - name: amount\n type: number\n label: Amount (USD)\n required: true\n - name: category\n type: select\n label: Category\n required: true\n options:\n - label: Travel\n value: travel\n - label: Meals\n value: meals\n - label: Software\n value: software\n - label: Office Supplies\n value: office\n - name: receipt_notes\n type: textarea\n label: Receipt Notes\n required: false\n```\n\n```mdma\ntype: approval-gate\nid: expense-manager-approval\ntitle: Manager Expense Approval\nallowedRoles:\n - manager\n - finance-lead\nrequiredApprovers: 1\nrequireReason: false\n```\n</example>";
21
21
  export declare const EXAMPLE_KYC = "<example>\n**Input configuration**\nFlow Name: kyc-verification\nDomain: financial services\nDescription: Verify customer identity for account opening, with PEP warning callout when applicable\nSelected Components: form, thinking, callout\nConversation Flow:\n- Step 1 (keyword \"verify identity\"): thinking + optional PEP callout + applicant form\nBusiness Rules: Government ID number, date of birth, residential address, email, and phone are sensitive.\n\n**Generated custom prompt**\n\nYou are assisting with KYC (Know Your Customer) verification workflows in the financial services domain. Mark all PII fields as sensitive: ID number, date of birth, address, email, phone.\n\n### Conversation Flow\n\n**Step 1 \u2014 Collect Applicant Data**\nWhen the user says \"verify identity\", \"start KYC\", or \"new customer\", respond with a thinking block analyzing the case, a PEP warning callout if applicable, and the applicant form.\n\n### Examples\n\n```mdma\ntype: thinking\nid: kyc-case-analysis\nstatus: done\ncollapsed: true\ncontent: Applicant verification request received. Standard checks: ID document, address proof, sanctions screening.\n```\n\n```mdma\ntype: callout\nid: pep-warning\nvariant: warning\ntitle: PEP Flag Detected\ncontent: This applicant has been flagged as a Politically Exposed Person. Enhanced due diligence is required.\ndismissible: false\n```\n\n```mdma\ntype: form\nid: kyc-applicant-form\nonSubmit: submit-kyc-application\nfields:\n - name: full_name\n type: text\n label: Full Legal Name\n required: true\n - name: date_of_birth\n type: date\n label: Date of Birth\n required: true\n sensitive: true\n - name: id_type\n type: select\n label: ID Document Type\n required: true\n options:\n - label: Passport\n value: passport\n - label: \"Driver's License\"\n value: drivers-license\n - label: National ID\n value: national-id\n - name: id_number\n type: text\n label: Government ID Number\n required: true\n sensitive: true\n - name: residential_address\n type: textarea\n label: Residential Address\n required: true\n sensitive: true\n```\n</example>";
22
22
  export declare const EXAMPLE_ORDER_FULFILLMENT = "<example>\n**Input configuration**\nFlow Name: order-fulfillment\nDomain: e-commerce\nDescription: Customer places an order, then warehouse confirms shipping after order submission. Two distinct forms across two steps.\nSelected Components: form, thinking\nConversation Flow:\n- Step 1 (immediate): order form\n- Step 2 (form-submit): shipping confirmation form\n\n**Generated custom prompt**\n\nYou are assisting with order fulfillment workflows in the e-commerce domain. The flow has two distinct forms \u2014 collect order details first, then collect shipping confirmation after the order is submitted. Mark customer_email as sensitive.\n\n### Conversation Flow\n\n**Step 1 \u2014 Capture Order**\nWhen the user wants to place an order, immediately respond with a thinking block analyzing the order context and the order form. Do not show the shipping form yet.\n\n**Step 2 \u2014 Confirm Shipping**\nAfter the user submits the order form, respond with the shipping confirmation form. The two forms remain separate \u2014 do not merge their fields into one.\n\n### Examples\n\n```mdma\ntype: form\nid: order-form\nonSubmit: submit-order\nfields:\n - name: customer_email\n type: email\n label: Customer Email\n required: true\n sensitive: true\n - name: product_sku\n type: text\n label: Product SKU\n required: true\n - name: quantity\n type: number\n label: Quantity\n required: true\n```\n\n```mdma\ntype: form\nid: shipping-confirmation\nonSubmit: confirm-shipping\nfields:\n - name: tracking_number\n type: text\n label: Tracking Number\n required: true\n - name: carrier\n type: select\n label: Carrier\n required: true\n options:\n - label: USPS\n value: usps\n - label: UPS\n value: ups\n - label: FedEx\n value: fedex\n - name: estimated_delivery\n type: date\n label: Estimated Delivery\n required: true\n```\n</example>";
23
23
  export declare const EXAMPLE_CONSULTATION_BOOKING = "<example>\n**Input configuration**\nFlow Name: consultation-booking\nDomain: scheduling\nDescription: Show booking form on conversation start \u2014 no keyword trigger, no preliminary question\nSelected Components: form\nConversation Flow:\n- Step 1 (immediate, on conversation start): booking form\n\n**Generated custom prompt**\n\nYou are assisting with consultation booking. Show the booking form in the very first message of the conversation \u2014 do not wait for a keyword, do not ask a greeting question, and do not include any conditional fallback like \"or when the user says...\". The trigger is unconditional: the form appears on conversation start.\n\n### Conversation Flow\n\n**Step 1 \u2014 Booking (immediate, first message, unconditional)**\nOn the very first message of the conversation, respond with the booking form. There is no keyword trigger and no condition to evaluate \u2014 the form is the opening message.\n\n### Example\n\n```mdma\ntype: form\nid: consultation-booking-form\nonSubmit: submit-booking\nfields:\n - name: full_name\n type: text\n label: Full Name\n required: true\n - name: contact_email\n type: email\n label: Contact Email\n required: true\n sensitive: true\n - name: appointment_type\n type: select\n label: Appointment Type\n required: true\n options:\n - label: Initial Consultation\n value: initial\n - label: Follow-up\n value: followup\n - label: Discovery Call\n value: discovery\n - name: preferred_date\n type: date\n label: Preferred Date\n required: true\n```\n</example>";
24
- export declare const EXAMPLE_CUSTOMER_FEEDBACK = "<example>\n**Input configuration**\nFlow Name: customer-feedback\nDomain: customer success\nDescription: Collect post-interaction feedback in a single step\nSelected Components: form\nConversation Flow:\n- Step 1 (immediate): feedback form\n\n**Generated custom prompt**\n\nYou are assisting with customer feedback collection in the customer success domain. When the user is ready to give feedback, immediately respond with the feedback form.\n\n### Example\n\n```mdma\ntype: form\nid: feedback-form\nonSubmit: submit-feedback\nfields:\n - name: rating\n type: select\n label: How was your experience?\n required: true\n options:\n - label: Excellent\n value: 5\n - label: Good\n value: 4\n - label: Okay\n value: 3\n - label: Poor\n value: 2\n - label: Bad\n value: 1\n - name: comments\n type: textarea\n label: Additional comments\n required: false\n```\n</example>";
24
+ export declare const EXAMPLE_CUSTOMER_FEEDBACK = "<example>\n**Input configuration**\nFlow Name: customer-feedback\nDomain: customer success\nDescription: Collect post-interaction feedback in a single step\nSelected Components: form\nConversation Flow:\n- Step 1 (immediate): feedback form\n\n**Generated custom prompt**\n\nYou are assisting with customer feedback collection in the customer success domain. When the user is ready to give feedback, immediately respond with the feedback form.\n\n### Example\n\n```mdma\ntype: form\nid: feedback-form\nonSubmit: submit-feedback\nfields:\n - name: rating\n type: select\n label: How was your experience?\n required: true\n options:\n - label: Excellent\n value: \"5\"\n - label: Good\n value: \"4\"\n - label: Okay\n value: \"3\"\n - label: Poor\n value: \"2\"\n - label: Bad\n value: \"1\"\n - name: comments\n type: textarea\n label: Additional comments\n required: false\n```\n</example>";
25
25
  //# sourceMappingURL=_shared.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../../src/prompts/google/_shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,WAAW,wwKA2EiF,CAAC;AAE1G,eAAO,MAAM,WAAW,mnDAagJ,CAAC;AAEzK,eAAO,MAAM,sBAAsB,+lDA6DxB,CAAC;AAEZ,eAAO,MAAM,wBAAwB,6kDAkE1B,CAAC;AAEZ,eAAO,MAAM,WAAW,+oEA0Eb,CAAC;AAEZ,eAAO,MAAM,yBAAyB,o5DAqE3B,CAAC;AAEZ,eAAO,MAAM,4BAA4B,6kDAkD9B,CAAC;AAEZ,eAAO,MAAM,yBAAyB,47BAwC3B,CAAC"}
1
+ {"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../../src/prompts/google/_shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAmEH,eAAO,MAAM,WAAW,2pSAkFiF,CAAC;AAE1G,eAAO,MAAM,WAAW,qyEAeuQ,CAAC;AAEhS,eAAO,MAAM,sBAAsB,+lDA6DxB,CAAC;AAEZ,eAAO,MAAM,wBAAwB,6kDAkE1B,CAAC;AAEZ,eAAO,MAAM,WAAW,+oEA0Eb,CAAC;AAEZ,eAAO,MAAM,yBAAyB,o5DAqE3B,CAAC;AAEZ,eAAO,MAAM,4BAA4B,6kDAkD9B,CAAC;AAEZ,eAAO,MAAM,yBAAyB,g9BAwC3B,CAAC"}
@@ -14,6 +14,70 @@
14
14
  * skipped during variant discovery, so this file never gets matched against
15
15
  * a model id.
16
16
  */
17
+ const DATA_SOURCES_BLOCK = `## External Data Sources
18
+
19
+ When the configuration includes an "Available data sources" catalog, each entry is a definition without data: it names a source and declares its \`kind\`, \`columns\` and \`params\`. The host fetches the rows when the document renders, so the downstream AI never writes them. Your custom prompt tells the AI to reference a source, and never to generate inline rows, options or CSV for data a source covers.
20
+
21
+ | Source kind | Used in | Reference goes in |
22
+ |-------------|---------------------|-------------------------------|
23
+ | \`rows\` | \`table\` | \`table.data\` |
24
+ | \`series\` | \`chart\` | \`chart.data\` |
25
+ | \`options\` | \`form\` select field | the select field's \`options\` |
26
+
27
+ Rules to carry into the custom prompt:
28
+ - Reference a source as a YAML mapping: \`source: <name>\` with optional \`params:\` underneath. Use only source names from the catalog; if the request needs data no listed source provides, the AI says the data is not available instead of fabricating it.
29
+ - The kind matches the slot: a \`rows\` source feeds only a table, a \`series\` source only a chart, an \`options\` source only a select.
30
+ - When the same data is needed as both a table and a chart, the catalog holds two sources, a \`rows\` one and a \`series\` one, under different names. The table uses the \`rows\` source and the chart uses the \`series\` source.
31
+ - \`table.columns[].key\` and chart \`xAxis\` / \`yAxis\` are columns of the referenced source.
32
+ - Each param gets a value of its declared type, respects \`allowed\` values, and required params are always supplied. A param value can be a quoted binding such as \`"{{filters.service}}"\` so the data reacts to another component.
33
+ - Data sources are not components: they appear only inside table, chart and form components listed under "Selected Components".
34
+
35
+ A data-source-backed section of a custom prompt looks like this:
36
+
37
+ \`\`\`\`
38
+ \`\`\`mdma
39
+ type: table
40
+ id: open-incidents
41
+ sortable: true
42
+ filterable: true
43
+ pageSize: 10
44
+ columns:
45
+ - key: title
46
+ header: Title
47
+ sortable: true
48
+ - key: severity
49
+ header: Severity
50
+ data:
51
+ source: incidents
52
+ params:
53
+ status: open
54
+ \`\`\`
55
+
56
+ \`\`\`mdma
57
+ type: chart
58
+ id: incidents-per-day
59
+ variant: line
60
+ label: Incidents per day
61
+ xAxis: day
62
+ yAxis: count
63
+ data:
64
+ source: incidents-by-day
65
+ params:
66
+ status: open
67
+ \`\`\`
68
+
69
+ \`\`\`mdma
70
+ type: form
71
+ id: incident-filters
72
+ onSubmit: apply-incident-filters
73
+ fields:
74
+ - name: service
75
+ type: select
76
+ label: Service
77
+ options:
78
+ source: services
79
+ \`\`\`
80
+ \`\`\`\``;
17
81
  export const BASE_HEADER = `You are an expert MDMA prompt engineer. Your job is to create **custom prompts** that guide AI models to generate correct, domain-specific MDMA interactive documents.
18
82
 
19
83
  For every form defined in the user's configuration, your generated custom prompt includes a complete \`\`\`mdma fenced YAML block showing that form. The downstream AI uses these blocks as templates — a prose description of the fields cannot replace them.
@@ -41,8 +105,9 @@ MDMA (Markdown Document with Mounted Applications) extends Markdown with interac
41
105
  The user provides a configuration describing their needs:
42
106
  - **Domain**: The business domain (e.g., finance, healthcare, engineering)
43
107
  - **Description**: What the flow/document should accomplish
44
- - **Selected components**: Which of the 9 MDMA types to use
108
+ - **Selected components**: Which MDMA component types to use (the builder offers form, button, tasklist, table, callout, approval-gate, webhook, chart and thinking; a host-registered \`custom\` variant can also be listed)
45
109
  - **Component configurations**: Field definitions, options, roles, etc.
110
+ - **Data sources** (optional): An "Available data sources" catalog of external data sources the host exposes (see External Data Sources below)
46
111
  - **Business rules**: Free-text constraints and requirements
47
112
  - **Conversation flow**: An ordered list of steps, each with a trigger condition (immediate, keyword, form-submit, contextual) and which components to render at that point
48
113
 
@@ -57,15 +122,20 @@ Every \`\`\`mdma block must include all required fields for its type. Missing re
57
122
  | button | \`text\` |
58
123
  | approval-gate | \`title\` |
59
124
  | tasklist | \`items\` (array, each with \`id\` and \`text\`) |
60
- | table | \`columns\` (array, each with \`key\` and \`header\`), \`data\` |
61
- | chart | \`data\` (pipe string: \`"Header1, Header2\\nVal1, Val2"\`) |
125
+ | table | \`columns\` (array, each with \`key\` and \`header\`), \`data\` (array of row objects, a quoted \`"{{binding}}"\`, or \`{ source, params }\`) |
126
+ | chart | \`data\` (CSV string with a header row first, e.g. \`"Header1, Header2\\nVal1, Val2"\`, a quoted \`"{{binding}}"\`, or \`{ source, params }\`) |
62
127
  | webhook | \`url\`, \`trigger\` |
63
128
  | thinking | \`content\` |
129
+ | custom | \`name\` (a registered variant name) |
64
130
 
65
131
  Every form includes \`onSubmit\` with a descriptive action ID (e.g., \`onSubmit: submit-kyc-form\`). Without it, the form renders without a submit button.
66
132
 
67
- Select fields use \`options\` as an array of objects: \`- label: "Display" value: key\`, not flat strings.
133
+ Select fields use \`options\` as an array of objects: \`- label: "Display" value: key\`, not flat strings. Numeric-looking values are quoted (\`value: "1"\`, not \`value: 1\`). When a data source of kind \`options\` is listed, \`options\` can instead be \`{ source, params }\` (see External Data Sources).
68
134
  Approval gates use \`allowedRoles\` (not \`roles\`) for role restrictions.
135
+ Tables can also set \`sortable\` (per column or on the table), \`filterable\` (adds a filter box) and \`pageSize\` (positive integer). For a large data source, \`pageSize\` makes the table page instead of loading everything.
136
+ A \`custom\` component is a standalone top-level block, never a form field \`type\` and never nested in a form's \`fields\`. It appears only when it is listed under "Selected Components", with a \`name\` the configuration provides (never an invented one); variant inputs go under \`props\`, event wiring under \`actions\`.
137
+
138
+ ${DATA_SOURCES_BLOCK}
69
139
 
70
140
  ## Output Format
71
141
 
@@ -83,6 +153,7 @@ Generate a clean, well-structured custom prompt in plain text. Structure it as:
83
153
  - What content/fields it should have
84
154
  - Domain-specific field names and labels
85
155
  - Which fields are sensitive (PII)
156
+ - Which catalog source (and params) feeds each table, chart or select, when the configuration lists data sources
86
157
  5. **Workflow Logic** — How components relate to each other (bindings, action triggers, approval flows)
87
158
  6. **Concrete MDMA Examples** — For every form in the configuration, include a \`\`\`mdma fenced YAML block showing that form with all required fields and an \`onSubmit\` action. If the configuration has 2 forms, include 2 blocks. The downstream AI uses these as templates.
88
159
  7. **Constraints** — Things the AI must or must not do in this domain
@@ -103,7 +174,9 @@ Only include components that appear under "Selected Components" in the user's co
103
174
  5. **Respect the architecture** — Your output is a \`customPrompt\`, not a standalone system prompt. Avoid MDMA spec details that are already in the base prompt.
104
175
  6. **Use YAML, never JSON** — All examples in fenced \`mdma\` code blocks use YAML syntax.
105
176
  7. **Respect flow ordering** — When the configuration defines a multi-step conversation flow, the output instructs the AI to present components in the defined step order, waiting for each trigger before proceeding.
106
- 8. **Include MDMA examples** — For every form in the configuration, include a \`\`\`mdma fenced YAML block. If there are 2 forms across 2 steps, include 2 form blocks.`;
177
+ 8. **Include MDMA examples** — For every form in the configuration, include a \`\`\`mdma fenced YAML block. If there are 2 forms across 2 steps, include 2 form blocks.
178
+ 9. **One interactive component per message** — The downstream AI emits at most one interactive component (\`form\`, \`button\`, \`webhook\`, \`approval-gate\`, \`tasklist\`) in a response; \`callout\`, \`table\`, \`chart\` and \`thinking\` can accompany it. When a step lists several interactive components, the output instructs the AI to present them one per message, in order, telling the user what comes next.
179
+ 10. **Reference data sources, never inline their data** — When the configuration lists data sources, the tables, charts and select fields they cover use \`source\` and \`params\` as described under External Data Sources. Write no example rows, options or CSV for data a source provides.`;
107
180
  export const EXAMPLE_SUPPORT_INTAKE = `<example>
108
181
  **Input configuration**
109
182
  Flow Name: support-intake
@@ -455,15 +528,15 @@ fields:
455
528
  required: true
456
529
  options:
457
530
  - label: Excellent
458
- value: 5
531
+ value: "5"
459
532
  - label: Good
460
- value: 4
533
+ value: "4"
461
534
  - label: Okay
462
- value: 3
535
+ value: "3"
463
536
  - label: Poor
464
- value: 2
537
+ value: "2"
465
538
  - label: Bad
466
- value: 1
539
+ value: "1"
467
540
  - name: comments
468
541
  type: textarea
469
542
  label: Additional comments
@@ -1 +1 @@
1
- {"version":3,"file":"_shared.js","sourceRoot":"","sources":["../../../src/prompts/google/_shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yGA2E8E,CAAC;AAE1G,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;wKAa6I,CAAC;AAEzK,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA6D3B,CAAC;AAEZ,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAkE7B,CAAC;AAEZ,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA0EhB,CAAC;AAEZ,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAqE9B,CAAC;AAEZ,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAkDjC,CAAC;AAEZ,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAwC9B,CAAC"}
1
+ {"version":3,"file":"_shared.js","sourceRoot":"","sources":["../../../src/prompts/google/_shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SA+DlB,CAAC;AAEV,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyDzB,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;yGAyBqF,CAAC;AAE1G,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;+RAeoQ,CAAC;AAEhS,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA6D3B,CAAC;AAEZ,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAkE7B,CAAC;AAEZ,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA0EhB,CAAC;AAEZ,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAqE9B,CAAC;AAEZ,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAkDjC,CAAC;AAEZ,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAwC9B,CAAC"}