@copilotkit/shared 1.55.3 → 1.56.0

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 (69) hide show
  1. package/dist/a2ui-prompts.cjs +31 -22
  2. package/dist/a2ui-prompts.cjs.map +1 -1
  3. package/dist/a2ui-prompts.d.cts +2 -2
  4. package/dist/a2ui-prompts.d.cts.map +1 -1
  5. package/dist/a2ui-prompts.d.mts +2 -2
  6. package/dist/a2ui-prompts.d.mts.map +1 -1
  7. package/dist/a2ui-prompts.mjs +31 -22
  8. package/dist/a2ui-prompts.mjs.map +1 -1
  9. package/dist/debug.cjs +38 -0
  10. package/dist/debug.cjs.map +1 -0
  11. package/dist/debug.d.cts +29 -0
  12. package/dist/debug.d.cts.map +1 -0
  13. package/dist/debug.d.mts +29 -0
  14. package/dist/debug.d.mts.map +1 -0
  15. package/dist/debug.mjs +37 -0
  16. package/dist/debug.mjs.map +1 -0
  17. package/dist/index.cjs +4 -0
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +3 -1
  20. package/dist/index.d.cts.map +1 -1
  21. package/dist/index.d.mts +3 -1
  22. package/dist/index.d.mts.map +1 -1
  23. package/dist/index.mjs +3 -1
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/index.umd.js +133 -28
  26. package/dist/index.umd.js.map +1 -1
  27. package/dist/package.cjs +1 -1
  28. package/dist/package.mjs +1 -1
  29. package/dist/utils/clipboard.cjs +28 -0
  30. package/dist/utils/clipboard.cjs.map +1 -0
  31. package/dist/utils/clipboard.d.cts +14 -0
  32. package/dist/utils/clipboard.d.cts.map +1 -0
  33. package/dist/utils/clipboard.d.mts +14 -0
  34. package/dist/utils/clipboard.d.mts.map +1 -0
  35. package/dist/utils/clipboard.mjs +27 -0
  36. package/dist/utils/clipboard.mjs.map +1 -0
  37. package/dist/utils/index.cjs +1 -0
  38. package/dist/utils/index.cjs.map +1 -1
  39. package/dist/utils/index.d.cts +1 -0
  40. package/dist/utils/index.d.cts.map +1 -1
  41. package/dist/utils/index.d.mts +1 -0
  42. package/dist/utils/index.d.mts.map +1 -1
  43. package/dist/utils/index.mjs +1 -0
  44. package/dist/utils/index.mjs.map +1 -1
  45. package/dist/utils/json-schema.cjs +36 -5
  46. package/dist/utils/json-schema.cjs.map +1 -1
  47. package/dist/utils/json-schema.d.cts +1 -1
  48. package/dist/utils/json-schema.d.cts.map +1 -1
  49. package/dist/utils/json-schema.d.mts +1 -1
  50. package/dist/utils/json-schema.d.mts.map +1 -1
  51. package/dist/utils/json-schema.mjs +36 -5
  52. package/dist/utils/json-schema.mjs.map +1 -1
  53. package/dist/utils/types.cjs.map +1 -1
  54. package/dist/utils/types.d.cts +3 -0
  55. package/dist/utils/types.d.cts.map +1 -1
  56. package/dist/utils/types.d.mts +3 -0
  57. package/dist/utils/types.d.mts.map +1 -1
  58. package/dist/utils/types.mjs.map +1 -1
  59. package/package.json +1 -1
  60. package/src/__tests__/debug.test.ts +116 -0
  61. package/src/a2ui-prompts.ts +31 -22
  62. package/src/debug.ts +55 -0
  63. package/src/index.ts +1 -0
  64. package/src/utils/__tests__/clipboard.test.ts +87 -0
  65. package/src/utils/__tests__/json-schema.test.ts +250 -1
  66. package/src/utils/clipboard.ts +23 -0
  67. package/src/utils/index.ts +1 -0
  68. package/src/utils/json-schema.ts +84 -3
  69. package/src/utils/types.ts +3 -0
@@ -48,29 +48,38 @@ CRITICAL: Do NOT use "/name" (absolute) inside templates — use "name" (relativ
48
48
  The container's path ("/items") uses a leading slash (absolute), but all
49
49
  components INSIDE the template use paths WITHOUT leading slash.
50
50
 
51
- DATA MODEL:
52
- The "data" key in the tool args is a plain JSON object that initializes the surface
53
- data model. Components bound to paths (e.g. "value": { "path": "/form/name" })
54
- read from and write to this data model. Examples:
55
- For forms: "data": { "form": { "name": "Alice", "email": "" } }
56
- For lists: "data": { "items": [{"name": "Product A"}, {"name": "Product B"}] }
57
- For mixed: "data": { "form": { "query": "" }, "results": [...] }
51
+ COMPONENT VALUES — DEFAULT RULE:
52
+ Use inline literal values for ALL component properties. Pass strings, numbers,
53
+ arrays, and objects directly on the component. Do NOT use { "path": "..." }
54
+ objects unless the property's schema explicitly allows it (see exception below).
55
+ CRITICAL: USING { "path": "..." } ON A PROPERTY THAT DOES NOT DECLARE PATH
56
+ SUPPORT IN ITS SCHEMA WILL CAUSE A RUNTIME CRASH AND BREAK THE ENTIRE UI.
57
+ ALWAYS CHECK THE COMPONENT SCHEMA FIRST IF THE PROPERTY ONLY ACCEPTS A
58
+ PLAIN TYPE, YOU MUST USE A LITERAL VALUE.
59
+ VERY IMPORTANT: THE APPLICATION WILL BREAK IF YOU DO NOT FOLLOW THIS RULE!
58
60
 
59
- FORMS AND TWO-WAY DATA BINDING:
60
- To create editable forms, bind input components to data model paths using { "path": "..." }.
61
- The client automatically writes user input back to the data model at the bound path.
62
- CRITICAL: Using a literal value (e.g. "value": "") makes the field READ-ONLY.
63
- You MUST use { "path": "..." } to make inputs editable.
61
+ For example, a chart's "data" must always be an inline array:
62
+ "data": [{"label": "Jan", "value": 100}, {"label": "Feb", "value": 200}]
63
+ A metric's "value" must always be an inline string:
64
+ "value": "$1,200"
64
65
 
65
- Input components use "value" as the binding property:
66
- "value": { "path": "/form/fieldName" }
66
+ PATH BINDING EXCEPTION SCHEMA-DRIVEN:
67
+ A few properties accept { "path": "/some/path" } as an alternative to a literal
68
+ value. You can identify these in the Available Components schema: the property
69
+ will list BOTH a literal type AND an object-with-path option. If a property only
70
+ shows a single type (string, number, array, etc.), it does NOT support path
71
+ binding — use a literal value only.
67
72
 
68
- To retrieve form values when a button is clicked, include "context" with path references
69
- in the button's action. Paths are resolved to their current values at click time:
70
- "action": { "event": { "name": "submit", "context": { "userName": { "path": "/form/name" } } } }
73
+ Path binding is typically used for editable form inputs so the client can write
74
+ user input back to the data model. When building forms:
75
+ - Bind input "value" to a data model path: "value": { "path": "/form/name" }
76
+ - Pre-fill via the "data" tool argument: "data": { "form": { "name": "Alice" } }
77
+ - Capture values on submit via button action context:
78
+ "action": { "event": { "name": "submit", "context": { "name": { "path": "/form/name" } } } }
71
79
 
72
- To pre-fill form values, pass initial data via the "data" tool argument:
73
- "data": { "form": { "name": "Markus" } }`;
80
+ REPEATING CONTENT uses a structural children format (not the same as value binding):
81
+ children: { componentId: "card-id", path: "/items" }
82
+ Components inside templates use RELATIVE paths (no leading slash): { "path": "name" }.`;
74
83
  /**
75
84
  * Design guidelines — visual design rules, component hierarchy tips,
76
85
  * and action handler patterns.
@@ -94,9 +103,9 @@ Design principles:
94
103
  "action": { "event": { "name": "myAction", "context": { "key": "value" } } }
95
104
  The "event" key holds an OBJECT with "name" (required) and "context" (optional).
96
105
  Do NOT use a flat format like {"event": "name"} — "event" must be an object.
97
- - For forms: every input MUST use path binding on the "value" property
98
- (e.g. "value": { "path": "/form/name" }) to be editable. The submit button's
99
- action context MUST reference the same paths to capture the user's input.
106
+ - For forms: check the component schema if an input's "value" property
107
+ supports path binding, use it for editable fields. The submit button's
108
+ action context should reference the same paths to capture user input.
100
109
 
101
110
  Use the SAME surfaceId as the main surface. Match action names to button action event names.`;
102
111
 
@@ -1 +1 @@
1
- {"version":3,"file":"a2ui-prompts.cjs","names":[],"sources":["../src/a2ui-prompts.ts"],"sourcesContent":["/**\n * Default A2UI generation and design guideline prompts.\n *\n * These are the canonical prompt fragments that instruct an LLM how to call\n * the render_a2ui tool, how to bind data, and how to style surfaces.\n */\n\n/**\n * Generation guidelines — protocol rules, tool arguments, path rules,\n * data model format, and form/two-way-binding instructions.\n */\nexport const A2UI_DEFAULT_GENERATION_GUIDELINES = `\\\nGenerate A2UI v0.9 JSON.\n\n## A2UI Protocol Instructions\n\nA2UI (Agent to UI) is a protocol for rendering rich UI surfaces from agent responses.\n\nCRITICAL: You MUST call the render_a2ui tool with ALL of these arguments:\n- surfaceId: A unique ID for the surface (e.g. \"product-comparison\")\n- components: REQUIRED — the A2UI component array. NEVER omit this. Only use\n components listed in the Available Components schema provided as context.\n- data: OPTIONAL — a JSON object written to the root of the surface data model.\n Use for pre-filling form values or providing data for path-bound components.\n- every component must have the \"component\" field specifying the component type.\n ONLY use component names from the Available Components schema — do NOT invent\n component names or use names not in the schema.\n\nCOMPONENT ID RULES:\n- Every component ID must be unique within the surface.\n- A component MUST NOT reference itself as child/children. This causes a\n circular dependency error. For example, if a component has id=\"avatar\",\n its child must be a DIFFERENT id (e.g. \"avatar-img\"), never \"avatar\".\n- The child/children tree must be a DAG — no cycles allowed.\n\nREPEATING CONTENT (TEMPLATES):\nTo repeat a component for each item in an array, use the structural children format:\n children: { componentId: \"card-id\", path: \"/items\" }\nThis tells the renderer to create one instance of \"card-id\" per item in the \"/items\" array.\n\nPATH RULES FOR TEMPLATES:\nComponents inside a repeating template use RELATIVE paths (no leading slash).\nThe path is resolved relative to each array item automatically.\nIf a container has children: { componentId: \"card\", path: \"/items\" } and each item\nhas a key \"name\", use { \"path\": \"name\" } (NO leading slash — relative to item).\nCRITICAL: Do NOT use \"/name\" (absolute) inside templates — use \"name\" (relative).\nThe container's path (\"/items\") uses a leading slash (absolute), but all\ncomponents INSIDE the template use paths WITHOUT leading slash.\n\nDATA MODEL:\nThe \"data\" key in the tool args is a plain JSON object that initializes the surface\ndata model. Components bound to paths (e.g. \"value\": { \"path\": \"/form/name\" })\nread from and write to this data model. Examples:\n For forms: \"data\": { \"form\": { \"name\": \"Alice\", \"email\": \"\" } }\n For lists: \"data\": { \"items\": [{\"name\": \"Product A\"}, {\"name\": \"Product B\"}] }\n For mixed: \"data\": { \"form\": { \"query\": \"\" }, \"results\": [...] }\n\nFORMS AND TWO-WAY DATA BINDING:\nTo create editable forms, bind input components to data model paths using { \"path\": \"...\" }.\nThe client automatically writes user input back to the data model at the bound path.\nCRITICAL: Using a literal value (e.g. \"value\": \"\") makes the field READ-ONLY.\nYou MUST use { \"path\": \"...\" } to make inputs editable.\n\nInput components use \"value\" as the binding property:\n \"value\": { \"path\": \"/form/fieldName\" }\n\nTo retrieve form values when a button is clicked, include \"context\" with path references\nin the button's action. Paths are resolved to their current values at click time:\n \"action\": { \"event\": { \"name\": \"submit\", \"context\": { \"userName\": { \"path\": \"/form/name\" } } } }\n\nTo pre-fill form values, pass initial data via the \"data\" tool argument:\n \"data\": { \"form\": { \"name\": \"Markus\" } }`;\n\n/**\n * Design guidelines — visual design rules, component hierarchy tips,\n * and action handler patterns.\n */\nexport const A2UI_DEFAULT_DESIGN_GUIDELINES = `\\\nCreate polished, visually appealing interfaces. ONLY use components listed in the\nAvailable Components schema — do NOT use component names that are not in the schema.\n\nDesign principles:\n- Create clear visual hierarchy within cards and layouts.\n- Keep cards clean — avoid clutter. Whitespace is good.\n- Use consistent surfaceIds (lowercase, hyphenated).\n- NEVER use the same ID for a component and its child — this creates a\n circular dependency. E.g. if id=\"avatar\", child must NOT be \"avatar\".\n- For side-by-side comparisons, use a container with structural children\n (children: { componentId, path }) to repeat a card template per data item.\n- Include images when relevant (logos, icons, product photos):\n - Prefer company logos via Google favicons: https://www.google.com/s2/favicons?domain=example.com&sz=128\n - Do NOT invent Unsplash photo-IDs — they will 404. Only use real, known URLs.\n- For buttons: action MUST use this exact nested format:\n \"action\": { \"event\": { \"name\": \"myAction\", \"context\": { \"key\": \"value\" } } }\n The \"event\" key holds an OBJECT with \"name\" (required) and \"context\" (optional).\n Do NOT use a flat format like {\"event\": \"name\"} — \"event\" must be an object.\n- For forms: every input MUST use path binding on the \"value\" property\n (e.g. \"value\": { \"path\": \"/form/name\" }) to be editable. The submit button's\n action context MUST reference the same paths to capture the user's input.\n\nUse the SAME surfaceId as the main surface. Match action names to button action event names.`;\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkElD,MAAa,iCAAiC"}
1
+ {"version":3,"file":"a2ui-prompts.cjs","names":[],"sources":["../src/a2ui-prompts.ts"],"sourcesContent":["/**\n * Default A2UI generation and design guideline prompts.\n *\n * These are the canonical prompt fragments that instruct an LLM how to call\n * the render_a2ui tool, how to bind data, and how to style surfaces.\n */\n\n/**\n * Generation guidelines — protocol rules, tool arguments, path rules,\n * data model format, and form/two-way-binding instructions.\n */\nexport const A2UI_DEFAULT_GENERATION_GUIDELINES = `\\\nGenerate A2UI v0.9 JSON.\n\n## A2UI Protocol Instructions\n\nA2UI (Agent to UI) is a protocol for rendering rich UI surfaces from agent responses.\n\nCRITICAL: You MUST call the render_a2ui tool with ALL of these arguments:\n- surfaceId: A unique ID for the surface (e.g. \"product-comparison\")\n- components: REQUIRED — the A2UI component array. NEVER omit this. Only use\n components listed in the Available Components schema provided as context.\n- data: OPTIONAL — a JSON object written to the root of the surface data model.\n Use for pre-filling form values or providing data for path-bound components.\n- every component must have the \"component\" field specifying the component type.\n ONLY use component names from the Available Components schema — do NOT invent\n component names or use names not in the schema.\n\nCOMPONENT ID RULES:\n- Every component ID must be unique within the surface.\n- A component MUST NOT reference itself as child/children. This causes a\n circular dependency error. For example, if a component has id=\"avatar\",\n its child must be a DIFFERENT id (e.g. \"avatar-img\"), never \"avatar\".\n- The child/children tree must be a DAG — no cycles allowed.\n\nREPEATING CONTENT (TEMPLATES):\nTo repeat a component for each item in an array, use the structural children format:\n children: { componentId: \"card-id\", path: \"/items\" }\nThis tells the renderer to create one instance of \"card-id\" per item in the \"/items\" array.\n\nPATH RULES FOR TEMPLATES:\nComponents inside a repeating template use RELATIVE paths (no leading slash).\nThe path is resolved relative to each array item automatically.\nIf a container has children: { componentId: \"card\", path: \"/items\" } and each item\nhas a key \"name\", use { \"path\": \"name\" } (NO leading slash — relative to item).\nCRITICAL: Do NOT use \"/name\" (absolute) inside templates — use \"name\" (relative).\nThe container's path (\"/items\") uses a leading slash (absolute), but all\ncomponents INSIDE the template use paths WITHOUT leading slash.\n\nCOMPONENT VALUES DEFAULT RULE:\nUse inline literal values for ALL component properties. Pass strings, numbers,\narrays, and objects directly on the component. Do NOT use { \"path\": \"...\" }\nobjects unless the property's schema explicitly allows it (see exception below).\nCRITICAL: USING { \"path\": \"...\" } ON A PROPERTY THAT DOES NOT DECLARE PATH\nSUPPORT IN ITS SCHEMA WILL CAUSE A RUNTIME CRASH AND BREAK THE ENTIRE UI.\nALWAYS CHECK THE COMPONENT SCHEMA FIRST — IF THE PROPERTY ONLY ACCEPTS A\nPLAIN TYPE, YOU MUST USE A LITERAL VALUE.\nVERY IMPORTANT: THE APPLICATION WILL BREAK IF YOU DO NOT FOLLOW THIS RULE!\n\nFor example, a chart's \"data\" must always be an inline array:\n \"data\": [{\"label\": \"Jan\", \"value\": 100}, {\"label\": \"Feb\", \"value\": 200}]\nA metric's \"value\" must always be an inline string:\n \"value\": \"$1,200\"\n\nPATH BINDING EXCEPTION SCHEMA-DRIVEN:\nA few properties accept { \"path\": \"/some/path\" } as an alternative to a literal\nvalue. You can identify these in the Available Components schema: the property\nwill list BOTH a literal type AND an object-with-path option. If a property only\nshows a single type (string, number, array, etc.), it does NOT support path\nbinding use a literal value only.\n\nPath binding is typically used for editable form inputs so the client can write\nuser input back to the data model. When building forms:\n- Bind input \"value\" to a data model path: \"value\": { \"path\": \"/form/name\" }\n- Pre-fill via the \"data\" tool argument: \"data\": { \"form\": { \"name\": \"Alice\" } }\n- Capture values on submit via button action context:\n \"action\": { \"event\": { \"name\": \"submit\", \"context\": { \"name\": { \"path\": \"/form/name\" } } } }\n\nREPEATING CONTENT uses a structural children format (not the same as value binding):\n children: { componentId: \"card-id\", path: \"/items\" }\nComponents inside templates use RELATIVE paths (no leading slash): { \"path\": \"name\" }.`;\n\n/**\n * Design guidelines — visual design rules, component hierarchy tips,\n * and action handler patterns.\n */\nexport const A2UI_DEFAULT_DESIGN_GUIDELINES = `\\\nCreate polished, visually appealing interfaces. ONLY use components listed in the\nAvailable Components schema — do NOT use component names that are not in the schema.\n\nDesign principles:\n- Create clear visual hierarchy within cards and layouts.\n- Keep cards clean — avoid clutter. Whitespace is good.\n- Use consistent surfaceIds (lowercase, hyphenated).\n- NEVER use the same ID for a component and its child — this creates a\n circular dependency. E.g. if id=\"avatar\", child must NOT be \"avatar\".\n- For side-by-side comparisons, use a container with structural children\n (children: { componentId, path }) to repeat a card template per data item.\n- Include images when relevant (logos, icons, product photos):\n - Prefer company logos via Google favicons: https://www.google.com/s2/favicons?domain=example.com&sz=128\n - Do NOT invent Unsplash photo-IDs — they will 404. Only use real, known URLs.\n- For buttons: action MUST use this exact nested format:\n \"action\": { \"event\": { \"name\": \"myAction\", \"context\": { \"key\": \"value\" } } }\n The \"event\" key holds an OBJECT with \"name\" (required) and \"context\" (optional).\n Do NOT use a flat format like {\"event\": \"name\"} — \"event\" must be an object.\n- For forms: check the component schema if an input's \"value\" property\n supports path binding, use it for editable fields. The submit button's\n action context should reference the same paths to capture user input.\n\nUse the SAME surfaceId as the main surface. Match action names to button action event names.`;\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2ElD,MAAa,iCAAiC"}
@@ -9,12 +9,12 @@
9
9
  * Generation guidelines — protocol rules, tool arguments, path rules,
10
10
  * data model format, and form/two-way-binding instructions.
11
11
  */
12
- declare const A2UI_DEFAULT_GENERATION_GUIDELINES = "Generate A2UI v0.9 JSON.\n\n## A2UI Protocol Instructions\n\nA2UI (Agent to UI) is a protocol for rendering rich UI surfaces from agent responses.\n\nCRITICAL: You MUST call the render_a2ui tool with ALL of these arguments:\n- surfaceId: A unique ID for the surface (e.g. \"product-comparison\")\n- components: REQUIRED \u2014 the A2UI component array. NEVER omit this. Only use\n components listed in the Available Components schema provided as context.\n- data: OPTIONAL \u2014 a JSON object written to the root of the surface data model.\n Use for pre-filling form values or providing data for path-bound components.\n- every component must have the \"component\" field specifying the component type.\n ONLY use component names from the Available Components schema \u2014 do NOT invent\n component names or use names not in the schema.\n\nCOMPONENT ID RULES:\n- Every component ID must be unique within the surface.\n- A component MUST NOT reference itself as child/children. This causes a\n circular dependency error. For example, if a component has id=\"avatar\",\n its child must be a DIFFERENT id (e.g. \"avatar-img\"), never \"avatar\".\n- The child/children tree must be a DAG \u2014 no cycles allowed.\n\nREPEATING CONTENT (TEMPLATES):\nTo repeat a component for each item in an array, use the structural children format:\n children: { componentId: \"card-id\", path: \"/items\" }\nThis tells the renderer to create one instance of \"card-id\" per item in the \"/items\" array.\n\nPATH RULES FOR TEMPLATES:\nComponents inside a repeating template use RELATIVE paths (no leading slash).\nThe path is resolved relative to each array item automatically.\nIf a container has children: { componentId: \"card\", path: \"/items\" } and each item\nhas a key \"name\", use { \"path\": \"name\" } (NO leading slash \u2014 relative to item).\nCRITICAL: Do NOT use \"/name\" (absolute) inside templates \u2014 use \"name\" (relative).\nThe container's path (\"/items\") uses a leading slash (absolute), but all\ncomponents INSIDE the template use paths WITHOUT leading slash.\n\nDATA MODEL:\nThe \"data\" key in the tool args is a plain JSON object that initializes the surface\ndata model. Components bound to paths (e.g. \"value\": { \"path\": \"/form/name\" })\nread from and write to this data model. Examples:\n For forms: \"data\": { \"form\": { \"name\": \"Alice\", \"email\": \"\" } }\n For lists: \"data\": { \"items\": [{\"name\": \"Product A\"}, {\"name\": \"Product B\"}] }\n For mixed: \"data\": { \"form\": { \"query\": \"\" }, \"results\": [...] }\n\nFORMS AND TWO-WAY DATA BINDING:\nTo create editable forms, bind input components to data model paths using { \"path\": \"...\" }.\nThe client automatically writes user input back to the data model at the bound path.\nCRITICAL: Using a literal value (e.g. \"value\": \"\") makes the field READ-ONLY.\nYou MUST use { \"path\": \"...\" } to make inputs editable.\n\nInput components use \"value\" as the binding property:\n \"value\": { \"path\": \"/form/fieldName\" }\n\nTo retrieve form values when a button is clicked, include \"context\" with path references\nin the button's action. Paths are resolved to their current values at click time:\n \"action\": { \"event\": { \"name\": \"submit\", \"context\": { \"userName\": { \"path\": \"/form/name\" } } } }\n\nTo pre-fill form values, pass initial data via the \"data\" tool argument:\n \"data\": { \"form\": { \"name\": \"Markus\" } }";
12
+ declare const A2UI_DEFAULT_GENERATION_GUIDELINES = "Generate A2UI v0.9 JSON.\n\n## A2UI Protocol Instructions\n\nA2UI (Agent to UI) is a protocol for rendering rich UI surfaces from agent responses.\n\nCRITICAL: You MUST call the render_a2ui tool with ALL of these arguments:\n- surfaceId: A unique ID for the surface (e.g. \"product-comparison\")\n- components: REQUIRED \u2014 the A2UI component array. NEVER omit this. Only use\n components listed in the Available Components schema provided as context.\n- data: OPTIONAL \u2014 a JSON object written to the root of the surface data model.\n Use for pre-filling form values or providing data for path-bound components.\n- every component must have the \"component\" field specifying the component type.\n ONLY use component names from the Available Components schema \u2014 do NOT invent\n component names or use names not in the schema.\n\nCOMPONENT ID RULES:\n- Every component ID must be unique within the surface.\n- A component MUST NOT reference itself as child/children. This causes a\n circular dependency error. For example, if a component has id=\"avatar\",\n its child must be a DIFFERENT id (e.g. \"avatar-img\"), never \"avatar\".\n- The child/children tree must be a DAG \u2014 no cycles allowed.\n\nREPEATING CONTENT (TEMPLATES):\nTo repeat a component for each item in an array, use the structural children format:\n children: { componentId: \"card-id\", path: \"/items\" }\nThis tells the renderer to create one instance of \"card-id\" per item in the \"/items\" array.\n\nPATH RULES FOR TEMPLATES:\nComponents inside a repeating template use RELATIVE paths (no leading slash).\nThe path is resolved relative to each array item automatically.\nIf a container has children: { componentId: \"card\", path: \"/items\" } and each item\nhas a key \"name\", use { \"path\": \"name\" } (NO leading slash \u2014 relative to item).\nCRITICAL: Do NOT use \"/name\" (absolute) inside templates \u2014 use \"name\" (relative).\nThe container's path (\"/items\") uses a leading slash (absolute), but all\ncomponents INSIDE the template use paths WITHOUT leading slash.\n\nCOMPONENT VALUES \u2014 DEFAULT RULE:\nUse inline literal values for ALL component properties. Pass strings, numbers,\narrays, and objects directly on the component. Do NOT use { \"path\": \"...\" }\nobjects unless the property's schema explicitly allows it (see exception below).\nCRITICAL: USING { \"path\": \"...\" } ON A PROPERTY THAT DOES NOT DECLARE PATH\nSUPPORT IN ITS SCHEMA WILL CAUSE A RUNTIME CRASH AND BREAK THE ENTIRE UI.\nALWAYS CHECK THE COMPONENT SCHEMA FIRST \u2014 IF THE PROPERTY ONLY ACCEPTS A\nPLAIN TYPE, YOU MUST USE A LITERAL VALUE.\nVERY IMPORTANT: THE APPLICATION WILL BREAK IF YOU DO NOT FOLLOW THIS RULE!\n\nFor example, a chart's \"data\" must always be an inline array:\n \"data\": [{\"label\": \"Jan\", \"value\": 100}, {\"label\": \"Feb\", \"value\": 200}]\nA metric's \"value\" must always be an inline string:\n \"value\": \"$1,200\"\n\nPATH BINDING EXCEPTION \u2014 SCHEMA-DRIVEN:\nA few properties accept { \"path\": \"/some/path\" } as an alternative to a literal\nvalue. You can identify these in the Available Components schema: the property\nwill list BOTH a literal type AND an object-with-path option. If a property only\nshows a single type (string, number, array, etc.), it does NOT support path\nbinding \u2014 use a literal value only.\n\nPath binding is typically used for editable form inputs so the client can write\nuser input back to the data model. When building forms:\n- Bind input \"value\" to a data model path: \"value\": { \"path\": \"/form/name\" }\n- Pre-fill via the \"data\" tool argument: \"data\": { \"form\": { \"name\": \"Alice\" } }\n- Capture values on submit via button action context:\n \"action\": { \"event\": { \"name\": \"submit\", \"context\": { \"name\": { \"path\": \"/form/name\" } } } }\n\nREPEATING CONTENT uses a structural children format (not the same as value binding):\n children: { componentId: \"card-id\", path: \"/items\" }\nComponents inside templates use RELATIVE paths (no leading slash): { \"path\": \"name\" }.";
13
13
  /**
14
14
  * Design guidelines — visual design rules, component hierarchy tips,
15
15
  * and action handler patterns.
16
16
  */
17
- declare const A2UI_DEFAULT_DESIGN_GUIDELINES = "Create polished, visually appealing interfaces. ONLY use components listed in the\nAvailable Components schema \u2014 do NOT use component names that are not in the schema.\n\nDesign principles:\n- Create clear visual hierarchy within cards and layouts.\n- Keep cards clean \u2014 avoid clutter. Whitespace is good.\n- Use consistent surfaceIds (lowercase, hyphenated).\n- NEVER use the same ID for a component and its child \u2014 this creates a\n circular dependency. E.g. if id=\"avatar\", child must NOT be \"avatar\".\n- For side-by-side comparisons, use a container with structural children\n (children: { componentId, path }) to repeat a card template per data item.\n- Include images when relevant (logos, icons, product photos):\n - Prefer company logos via Google favicons: https://www.google.com/s2/favicons?domain=example.com&sz=128\n - Do NOT invent Unsplash photo-IDs \u2014 they will 404. Only use real, known URLs.\n- For buttons: action MUST use this exact nested format:\n \"action\": { \"event\": { \"name\": \"myAction\", \"context\": { \"key\": \"value\" } } }\n The \"event\" key holds an OBJECT with \"name\" (required) and \"context\" (optional).\n Do NOT use a flat format like {\"event\": \"name\"} \u2014 \"event\" must be an object.\n- For forms: every input MUST use path binding on the \"value\" property\n (e.g. \"value\": { \"path\": \"/form/name\" }) to be editable. The submit button's\n action context MUST reference the same paths to capture the user's input.\n\nUse the SAME surfaceId as the main surface. Match action names to button action event names.";
17
+ declare const A2UI_DEFAULT_DESIGN_GUIDELINES = "Create polished, visually appealing interfaces. ONLY use components listed in the\nAvailable Components schema \u2014 do NOT use component names that are not in the schema.\n\nDesign principles:\n- Create clear visual hierarchy within cards and layouts.\n- Keep cards clean \u2014 avoid clutter. Whitespace is good.\n- Use consistent surfaceIds (lowercase, hyphenated).\n- NEVER use the same ID for a component and its child \u2014 this creates a\n circular dependency. E.g. if id=\"avatar\", child must NOT be \"avatar\".\n- For side-by-side comparisons, use a container with structural children\n (children: { componentId, path }) to repeat a card template per data item.\n- Include images when relevant (logos, icons, product photos):\n - Prefer company logos via Google favicons: https://www.google.com/s2/favicons?domain=example.com&sz=128\n - Do NOT invent Unsplash photo-IDs \u2014 they will 404. Only use real, known URLs.\n- For buttons: action MUST use this exact nested format:\n \"action\": { \"event\": { \"name\": \"myAction\", \"context\": { \"key\": \"value\" } } }\n The \"event\" key holds an OBJECT with \"name\" (required) and \"context\" (optional).\n Do NOT use a flat format like {\"event\": \"name\"} \u2014 \"event\" must be an object.\n- For forms: check the component schema \u2014 if an input's \"value\" property\n supports path binding, use it for editable fields. The submit button's\n action context should reference the same paths to capture user input.\n\nUse the SAME surfaceId as the main surface. Match action names to button action event names.";
18
18
  //#endregion
19
19
  export { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES };
20
20
  //# sourceMappingURL=a2ui-prompts.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"a2ui-prompts.d.cts","names":[],"sources":["../src/a2ui-prompts.ts"],"mappings":";;AAWA;;;;;AAkEA;;;;AAAA,cAlEa,kCAAA;;;;;cAkEA,8BAAA"}
1
+ {"version":3,"file":"a2ui-prompts.d.cts","names":[],"sources":["../src/a2ui-prompts.ts"],"mappings":";;AAWA;;;;;AA2EA;;;;AAAA,cA3Ea,kCAAA;;;;;cA2EA,8BAAA"}
@@ -9,12 +9,12 @@
9
9
  * Generation guidelines — protocol rules, tool arguments, path rules,
10
10
  * data model format, and form/two-way-binding instructions.
11
11
  */
12
- declare const A2UI_DEFAULT_GENERATION_GUIDELINES = "Generate A2UI v0.9 JSON.\n\n## A2UI Protocol Instructions\n\nA2UI (Agent to UI) is a protocol for rendering rich UI surfaces from agent responses.\n\nCRITICAL: You MUST call the render_a2ui tool with ALL of these arguments:\n- surfaceId: A unique ID for the surface (e.g. \"product-comparison\")\n- components: REQUIRED \u2014 the A2UI component array. NEVER omit this. Only use\n components listed in the Available Components schema provided as context.\n- data: OPTIONAL \u2014 a JSON object written to the root of the surface data model.\n Use for pre-filling form values or providing data for path-bound components.\n- every component must have the \"component\" field specifying the component type.\n ONLY use component names from the Available Components schema \u2014 do NOT invent\n component names or use names not in the schema.\n\nCOMPONENT ID RULES:\n- Every component ID must be unique within the surface.\n- A component MUST NOT reference itself as child/children. This causes a\n circular dependency error. For example, if a component has id=\"avatar\",\n its child must be a DIFFERENT id (e.g. \"avatar-img\"), never \"avatar\".\n- The child/children tree must be a DAG \u2014 no cycles allowed.\n\nREPEATING CONTENT (TEMPLATES):\nTo repeat a component for each item in an array, use the structural children format:\n children: { componentId: \"card-id\", path: \"/items\" }\nThis tells the renderer to create one instance of \"card-id\" per item in the \"/items\" array.\n\nPATH RULES FOR TEMPLATES:\nComponents inside a repeating template use RELATIVE paths (no leading slash).\nThe path is resolved relative to each array item automatically.\nIf a container has children: { componentId: \"card\", path: \"/items\" } and each item\nhas a key \"name\", use { \"path\": \"name\" } (NO leading slash \u2014 relative to item).\nCRITICAL: Do NOT use \"/name\" (absolute) inside templates \u2014 use \"name\" (relative).\nThe container's path (\"/items\") uses a leading slash (absolute), but all\ncomponents INSIDE the template use paths WITHOUT leading slash.\n\nDATA MODEL:\nThe \"data\" key in the tool args is a plain JSON object that initializes the surface\ndata model. Components bound to paths (e.g. \"value\": { \"path\": \"/form/name\" })\nread from and write to this data model. Examples:\n For forms: \"data\": { \"form\": { \"name\": \"Alice\", \"email\": \"\" } }\n For lists: \"data\": { \"items\": [{\"name\": \"Product A\"}, {\"name\": \"Product B\"}] }\n For mixed: \"data\": { \"form\": { \"query\": \"\" }, \"results\": [...] }\n\nFORMS AND TWO-WAY DATA BINDING:\nTo create editable forms, bind input components to data model paths using { \"path\": \"...\" }.\nThe client automatically writes user input back to the data model at the bound path.\nCRITICAL: Using a literal value (e.g. \"value\": \"\") makes the field READ-ONLY.\nYou MUST use { \"path\": \"...\" } to make inputs editable.\n\nInput components use \"value\" as the binding property:\n \"value\": { \"path\": \"/form/fieldName\" }\n\nTo retrieve form values when a button is clicked, include \"context\" with path references\nin the button's action. Paths are resolved to their current values at click time:\n \"action\": { \"event\": { \"name\": \"submit\", \"context\": { \"userName\": { \"path\": \"/form/name\" } } } }\n\nTo pre-fill form values, pass initial data via the \"data\" tool argument:\n \"data\": { \"form\": { \"name\": \"Markus\" } }";
12
+ declare const A2UI_DEFAULT_GENERATION_GUIDELINES = "Generate A2UI v0.9 JSON.\n\n## A2UI Protocol Instructions\n\nA2UI (Agent to UI) is a protocol for rendering rich UI surfaces from agent responses.\n\nCRITICAL: You MUST call the render_a2ui tool with ALL of these arguments:\n- surfaceId: A unique ID for the surface (e.g. \"product-comparison\")\n- components: REQUIRED \u2014 the A2UI component array. NEVER omit this. Only use\n components listed in the Available Components schema provided as context.\n- data: OPTIONAL \u2014 a JSON object written to the root of the surface data model.\n Use for pre-filling form values or providing data for path-bound components.\n- every component must have the \"component\" field specifying the component type.\n ONLY use component names from the Available Components schema \u2014 do NOT invent\n component names or use names not in the schema.\n\nCOMPONENT ID RULES:\n- Every component ID must be unique within the surface.\n- A component MUST NOT reference itself as child/children. This causes a\n circular dependency error. For example, if a component has id=\"avatar\",\n its child must be a DIFFERENT id (e.g. \"avatar-img\"), never \"avatar\".\n- The child/children tree must be a DAG \u2014 no cycles allowed.\n\nREPEATING CONTENT (TEMPLATES):\nTo repeat a component for each item in an array, use the structural children format:\n children: { componentId: \"card-id\", path: \"/items\" }\nThis tells the renderer to create one instance of \"card-id\" per item in the \"/items\" array.\n\nPATH RULES FOR TEMPLATES:\nComponents inside a repeating template use RELATIVE paths (no leading slash).\nThe path is resolved relative to each array item automatically.\nIf a container has children: { componentId: \"card\", path: \"/items\" } and each item\nhas a key \"name\", use { \"path\": \"name\" } (NO leading slash \u2014 relative to item).\nCRITICAL: Do NOT use \"/name\" (absolute) inside templates \u2014 use \"name\" (relative).\nThe container's path (\"/items\") uses a leading slash (absolute), but all\ncomponents INSIDE the template use paths WITHOUT leading slash.\n\nCOMPONENT VALUES \u2014 DEFAULT RULE:\nUse inline literal values for ALL component properties. Pass strings, numbers,\narrays, and objects directly on the component. Do NOT use { \"path\": \"...\" }\nobjects unless the property's schema explicitly allows it (see exception below).\nCRITICAL: USING { \"path\": \"...\" } ON A PROPERTY THAT DOES NOT DECLARE PATH\nSUPPORT IN ITS SCHEMA WILL CAUSE A RUNTIME CRASH AND BREAK THE ENTIRE UI.\nALWAYS CHECK THE COMPONENT SCHEMA FIRST \u2014 IF THE PROPERTY ONLY ACCEPTS A\nPLAIN TYPE, YOU MUST USE A LITERAL VALUE.\nVERY IMPORTANT: THE APPLICATION WILL BREAK IF YOU DO NOT FOLLOW THIS RULE!\n\nFor example, a chart's \"data\" must always be an inline array:\n \"data\": [{\"label\": \"Jan\", \"value\": 100}, {\"label\": \"Feb\", \"value\": 200}]\nA metric's \"value\" must always be an inline string:\n \"value\": \"$1,200\"\n\nPATH BINDING EXCEPTION \u2014 SCHEMA-DRIVEN:\nA few properties accept { \"path\": \"/some/path\" } as an alternative to a literal\nvalue. You can identify these in the Available Components schema: the property\nwill list BOTH a literal type AND an object-with-path option. If a property only\nshows a single type (string, number, array, etc.), it does NOT support path\nbinding \u2014 use a literal value only.\n\nPath binding is typically used for editable form inputs so the client can write\nuser input back to the data model. When building forms:\n- Bind input \"value\" to a data model path: \"value\": { \"path\": \"/form/name\" }\n- Pre-fill via the \"data\" tool argument: \"data\": { \"form\": { \"name\": \"Alice\" } }\n- Capture values on submit via button action context:\n \"action\": { \"event\": { \"name\": \"submit\", \"context\": { \"name\": { \"path\": \"/form/name\" } } } }\n\nREPEATING CONTENT uses a structural children format (not the same as value binding):\n children: { componentId: \"card-id\", path: \"/items\" }\nComponents inside templates use RELATIVE paths (no leading slash): { \"path\": \"name\" }.";
13
13
  /**
14
14
  * Design guidelines — visual design rules, component hierarchy tips,
15
15
  * and action handler patterns.
16
16
  */
17
- declare const A2UI_DEFAULT_DESIGN_GUIDELINES = "Create polished, visually appealing interfaces. ONLY use components listed in the\nAvailable Components schema \u2014 do NOT use component names that are not in the schema.\n\nDesign principles:\n- Create clear visual hierarchy within cards and layouts.\n- Keep cards clean \u2014 avoid clutter. Whitespace is good.\n- Use consistent surfaceIds (lowercase, hyphenated).\n- NEVER use the same ID for a component and its child \u2014 this creates a\n circular dependency. E.g. if id=\"avatar\", child must NOT be \"avatar\".\n- For side-by-side comparisons, use a container with structural children\n (children: { componentId, path }) to repeat a card template per data item.\n- Include images when relevant (logos, icons, product photos):\n - Prefer company logos via Google favicons: https://www.google.com/s2/favicons?domain=example.com&sz=128\n - Do NOT invent Unsplash photo-IDs \u2014 they will 404. Only use real, known URLs.\n- For buttons: action MUST use this exact nested format:\n \"action\": { \"event\": { \"name\": \"myAction\", \"context\": { \"key\": \"value\" } } }\n The \"event\" key holds an OBJECT with \"name\" (required) and \"context\" (optional).\n Do NOT use a flat format like {\"event\": \"name\"} \u2014 \"event\" must be an object.\n- For forms: every input MUST use path binding on the \"value\" property\n (e.g. \"value\": { \"path\": \"/form/name\" }) to be editable. The submit button's\n action context MUST reference the same paths to capture the user's input.\n\nUse the SAME surfaceId as the main surface. Match action names to button action event names.";
17
+ declare const A2UI_DEFAULT_DESIGN_GUIDELINES = "Create polished, visually appealing interfaces. ONLY use components listed in the\nAvailable Components schema \u2014 do NOT use component names that are not in the schema.\n\nDesign principles:\n- Create clear visual hierarchy within cards and layouts.\n- Keep cards clean \u2014 avoid clutter. Whitespace is good.\n- Use consistent surfaceIds (lowercase, hyphenated).\n- NEVER use the same ID for a component and its child \u2014 this creates a\n circular dependency. E.g. if id=\"avatar\", child must NOT be \"avatar\".\n- For side-by-side comparisons, use a container with structural children\n (children: { componentId, path }) to repeat a card template per data item.\n- Include images when relevant (logos, icons, product photos):\n - Prefer company logos via Google favicons: https://www.google.com/s2/favicons?domain=example.com&sz=128\n - Do NOT invent Unsplash photo-IDs \u2014 they will 404. Only use real, known URLs.\n- For buttons: action MUST use this exact nested format:\n \"action\": { \"event\": { \"name\": \"myAction\", \"context\": { \"key\": \"value\" } } }\n The \"event\" key holds an OBJECT with \"name\" (required) and \"context\" (optional).\n Do NOT use a flat format like {\"event\": \"name\"} \u2014 \"event\" must be an object.\n- For forms: check the component schema \u2014 if an input's \"value\" property\n supports path binding, use it for editable fields. The submit button's\n action context should reference the same paths to capture user input.\n\nUse the SAME surfaceId as the main surface. Match action names to button action event names.";
18
18
  //#endregion
19
19
  export { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES };
20
20
  //# sourceMappingURL=a2ui-prompts.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"a2ui-prompts.d.mts","names":[],"sources":["../src/a2ui-prompts.ts"],"mappings":";;AAWA;;;;;AAkEA;;;;AAAA,cAlEa,kCAAA;;;;;cAkEA,8BAAA"}
1
+ {"version":3,"file":"a2ui-prompts.d.mts","names":[],"sources":["../src/a2ui-prompts.ts"],"mappings":";;AAWA;;;;;AA2EA;;;;AAAA,cA3Ea,kCAAA;;;;;cA2EA,8BAAA"}
@@ -47,29 +47,38 @@ CRITICAL: Do NOT use "/name" (absolute) inside templates — use "name" (relativ
47
47
  The container's path ("/items") uses a leading slash (absolute), but all
48
48
  components INSIDE the template use paths WITHOUT leading slash.
49
49
 
50
- DATA MODEL:
51
- The "data" key in the tool args is a plain JSON object that initializes the surface
52
- data model. Components bound to paths (e.g. "value": { "path": "/form/name" })
53
- read from and write to this data model. Examples:
54
- For forms: "data": { "form": { "name": "Alice", "email": "" } }
55
- For lists: "data": { "items": [{"name": "Product A"}, {"name": "Product B"}] }
56
- For mixed: "data": { "form": { "query": "" }, "results": [...] }
50
+ COMPONENT VALUES — DEFAULT RULE:
51
+ Use inline literal values for ALL component properties. Pass strings, numbers,
52
+ arrays, and objects directly on the component. Do NOT use { "path": "..." }
53
+ objects unless the property's schema explicitly allows it (see exception below).
54
+ CRITICAL: USING { "path": "..." } ON A PROPERTY THAT DOES NOT DECLARE PATH
55
+ SUPPORT IN ITS SCHEMA WILL CAUSE A RUNTIME CRASH AND BREAK THE ENTIRE UI.
56
+ ALWAYS CHECK THE COMPONENT SCHEMA FIRST IF THE PROPERTY ONLY ACCEPTS A
57
+ PLAIN TYPE, YOU MUST USE A LITERAL VALUE.
58
+ VERY IMPORTANT: THE APPLICATION WILL BREAK IF YOU DO NOT FOLLOW THIS RULE!
57
59
 
58
- FORMS AND TWO-WAY DATA BINDING:
59
- To create editable forms, bind input components to data model paths using { "path": "..." }.
60
- The client automatically writes user input back to the data model at the bound path.
61
- CRITICAL: Using a literal value (e.g. "value": "") makes the field READ-ONLY.
62
- You MUST use { "path": "..." } to make inputs editable.
60
+ For example, a chart's "data" must always be an inline array:
61
+ "data": [{"label": "Jan", "value": 100}, {"label": "Feb", "value": 200}]
62
+ A metric's "value" must always be an inline string:
63
+ "value": "$1,200"
63
64
 
64
- Input components use "value" as the binding property:
65
- "value": { "path": "/form/fieldName" }
65
+ PATH BINDING EXCEPTION SCHEMA-DRIVEN:
66
+ A few properties accept { "path": "/some/path" } as an alternative to a literal
67
+ value. You can identify these in the Available Components schema: the property
68
+ will list BOTH a literal type AND an object-with-path option. If a property only
69
+ shows a single type (string, number, array, etc.), it does NOT support path
70
+ binding — use a literal value only.
66
71
 
67
- To retrieve form values when a button is clicked, include "context" with path references
68
- in the button's action. Paths are resolved to their current values at click time:
69
- "action": { "event": { "name": "submit", "context": { "userName": { "path": "/form/name" } } } }
72
+ Path binding is typically used for editable form inputs so the client can write
73
+ user input back to the data model. When building forms:
74
+ - Bind input "value" to a data model path: "value": { "path": "/form/name" }
75
+ - Pre-fill via the "data" tool argument: "data": { "form": { "name": "Alice" } }
76
+ - Capture values on submit via button action context:
77
+ "action": { "event": { "name": "submit", "context": { "name": { "path": "/form/name" } } } }
70
78
 
71
- To pre-fill form values, pass initial data via the "data" tool argument:
72
- "data": { "form": { "name": "Markus" } }`;
79
+ REPEATING CONTENT uses a structural children format (not the same as value binding):
80
+ children: { componentId: "card-id", path: "/items" }
81
+ Components inside templates use RELATIVE paths (no leading slash): { "path": "name" }.`;
73
82
  /**
74
83
  * Design guidelines — visual design rules, component hierarchy tips,
75
84
  * and action handler patterns.
@@ -93,9 +102,9 @@ Design principles:
93
102
  "action": { "event": { "name": "myAction", "context": { "key": "value" } } }
94
103
  The "event" key holds an OBJECT with "name" (required) and "context" (optional).
95
104
  Do NOT use a flat format like {"event": "name"} — "event" must be an object.
96
- - For forms: every input MUST use path binding on the "value" property
97
- (e.g. "value": { "path": "/form/name" }) to be editable. The submit button's
98
- action context MUST reference the same paths to capture the user's input.
105
+ - For forms: check the component schema if an input's "value" property
106
+ supports path binding, use it for editable fields. The submit button's
107
+ action context should reference the same paths to capture user input.
99
108
 
100
109
  Use the SAME surfaceId as the main surface. Match action names to button action event names.`;
101
110
 
@@ -1 +1 @@
1
- {"version":3,"file":"a2ui-prompts.mjs","names":[],"sources":["../src/a2ui-prompts.ts"],"sourcesContent":["/**\n * Default A2UI generation and design guideline prompts.\n *\n * These are the canonical prompt fragments that instruct an LLM how to call\n * the render_a2ui tool, how to bind data, and how to style surfaces.\n */\n\n/**\n * Generation guidelines — protocol rules, tool arguments, path rules,\n * data model format, and form/two-way-binding instructions.\n */\nexport const A2UI_DEFAULT_GENERATION_GUIDELINES = `\\\nGenerate A2UI v0.9 JSON.\n\n## A2UI Protocol Instructions\n\nA2UI (Agent to UI) is a protocol for rendering rich UI surfaces from agent responses.\n\nCRITICAL: You MUST call the render_a2ui tool with ALL of these arguments:\n- surfaceId: A unique ID for the surface (e.g. \"product-comparison\")\n- components: REQUIRED — the A2UI component array. NEVER omit this. Only use\n components listed in the Available Components schema provided as context.\n- data: OPTIONAL — a JSON object written to the root of the surface data model.\n Use for pre-filling form values or providing data for path-bound components.\n- every component must have the \"component\" field specifying the component type.\n ONLY use component names from the Available Components schema — do NOT invent\n component names or use names not in the schema.\n\nCOMPONENT ID RULES:\n- Every component ID must be unique within the surface.\n- A component MUST NOT reference itself as child/children. This causes a\n circular dependency error. For example, if a component has id=\"avatar\",\n its child must be a DIFFERENT id (e.g. \"avatar-img\"), never \"avatar\".\n- The child/children tree must be a DAG — no cycles allowed.\n\nREPEATING CONTENT (TEMPLATES):\nTo repeat a component for each item in an array, use the structural children format:\n children: { componentId: \"card-id\", path: \"/items\" }\nThis tells the renderer to create one instance of \"card-id\" per item in the \"/items\" array.\n\nPATH RULES FOR TEMPLATES:\nComponents inside a repeating template use RELATIVE paths (no leading slash).\nThe path is resolved relative to each array item automatically.\nIf a container has children: { componentId: \"card\", path: \"/items\" } and each item\nhas a key \"name\", use { \"path\": \"name\" } (NO leading slash — relative to item).\nCRITICAL: Do NOT use \"/name\" (absolute) inside templates — use \"name\" (relative).\nThe container's path (\"/items\") uses a leading slash (absolute), but all\ncomponents INSIDE the template use paths WITHOUT leading slash.\n\nDATA MODEL:\nThe \"data\" key in the tool args is a plain JSON object that initializes the surface\ndata model. Components bound to paths (e.g. \"value\": { \"path\": \"/form/name\" })\nread from and write to this data model. Examples:\n For forms: \"data\": { \"form\": { \"name\": \"Alice\", \"email\": \"\" } }\n For lists: \"data\": { \"items\": [{\"name\": \"Product A\"}, {\"name\": \"Product B\"}] }\n For mixed: \"data\": { \"form\": { \"query\": \"\" }, \"results\": [...] }\n\nFORMS AND TWO-WAY DATA BINDING:\nTo create editable forms, bind input components to data model paths using { \"path\": \"...\" }.\nThe client automatically writes user input back to the data model at the bound path.\nCRITICAL: Using a literal value (e.g. \"value\": \"\") makes the field READ-ONLY.\nYou MUST use { \"path\": \"...\" } to make inputs editable.\n\nInput components use \"value\" as the binding property:\n \"value\": { \"path\": \"/form/fieldName\" }\n\nTo retrieve form values when a button is clicked, include \"context\" with path references\nin the button's action. Paths are resolved to their current values at click time:\n \"action\": { \"event\": { \"name\": \"submit\", \"context\": { \"userName\": { \"path\": \"/form/name\" } } } }\n\nTo pre-fill form values, pass initial data via the \"data\" tool argument:\n \"data\": { \"form\": { \"name\": \"Markus\" } }`;\n\n/**\n * Design guidelines — visual design rules, component hierarchy tips,\n * and action handler patterns.\n */\nexport const A2UI_DEFAULT_DESIGN_GUIDELINES = `\\\nCreate polished, visually appealing interfaces. ONLY use components listed in the\nAvailable Components schema — do NOT use component names that are not in the schema.\n\nDesign principles:\n- Create clear visual hierarchy within cards and layouts.\n- Keep cards clean — avoid clutter. Whitespace is good.\n- Use consistent surfaceIds (lowercase, hyphenated).\n- NEVER use the same ID for a component and its child — this creates a\n circular dependency. E.g. if id=\"avatar\", child must NOT be \"avatar\".\n- For side-by-side comparisons, use a container with structural children\n (children: { componentId, path }) to repeat a card template per data item.\n- Include images when relevant (logos, icons, product photos):\n - Prefer company logos via Google favicons: https://www.google.com/s2/favicons?domain=example.com&sz=128\n - Do NOT invent Unsplash photo-IDs — they will 404. Only use real, known URLs.\n- For buttons: action MUST use this exact nested format:\n \"action\": { \"event\": { \"name\": \"myAction\", \"context\": { \"key\": \"value\" } } }\n The \"event\" key holds an OBJECT with \"name\" (required) and \"context\" (optional).\n Do NOT use a flat format like {\"event\": \"name\"} — \"event\" must be an object.\n- For forms: every input MUST use path binding on the \"value\" property\n (e.g. \"value\": { \"path\": \"/form/name\" }) to be editable. The submit button's\n action context MUST reference the same paths to capture the user's input.\n\nUse the SAME surfaceId as the main surface. Match action names to button action event names.`;\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkElD,MAAa,iCAAiC"}
1
+ {"version":3,"file":"a2ui-prompts.mjs","names":[],"sources":["../src/a2ui-prompts.ts"],"sourcesContent":["/**\n * Default A2UI generation and design guideline prompts.\n *\n * These are the canonical prompt fragments that instruct an LLM how to call\n * the render_a2ui tool, how to bind data, and how to style surfaces.\n */\n\n/**\n * Generation guidelines — protocol rules, tool arguments, path rules,\n * data model format, and form/two-way-binding instructions.\n */\nexport const A2UI_DEFAULT_GENERATION_GUIDELINES = `\\\nGenerate A2UI v0.9 JSON.\n\n## A2UI Protocol Instructions\n\nA2UI (Agent to UI) is a protocol for rendering rich UI surfaces from agent responses.\n\nCRITICAL: You MUST call the render_a2ui tool with ALL of these arguments:\n- surfaceId: A unique ID for the surface (e.g. \"product-comparison\")\n- components: REQUIRED — the A2UI component array. NEVER omit this. Only use\n components listed in the Available Components schema provided as context.\n- data: OPTIONAL — a JSON object written to the root of the surface data model.\n Use for pre-filling form values or providing data for path-bound components.\n- every component must have the \"component\" field specifying the component type.\n ONLY use component names from the Available Components schema — do NOT invent\n component names or use names not in the schema.\n\nCOMPONENT ID RULES:\n- Every component ID must be unique within the surface.\n- A component MUST NOT reference itself as child/children. This causes a\n circular dependency error. For example, if a component has id=\"avatar\",\n its child must be a DIFFERENT id (e.g. \"avatar-img\"), never \"avatar\".\n- The child/children tree must be a DAG — no cycles allowed.\n\nREPEATING CONTENT (TEMPLATES):\nTo repeat a component for each item in an array, use the structural children format:\n children: { componentId: \"card-id\", path: \"/items\" }\nThis tells the renderer to create one instance of \"card-id\" per item in the \"/items\" array.\n\nPATH RULES FOR TEMPLATES:\nComponents inside a repeating template use RELATIVE paths (no leading slash).\nThe path is resolved relative to each array item automatically.\nIf a container has children: { componentId: \"card\", path: \"/items\" } and each item\nhas a key \"name\", use { \"path\": \"name\" } (NO leading slash — relative to item).\nCRITICAL: Do NOT use \"/name\" (absolute) inside templates — use \"name\" (relative).\nThe container's path (\"/items\") uses a leading slash (absolute), but all\ncomponents INSIDE the template use paths WITHOUT leading slash.\n\nCOMPONENT VALUES DEFAULT RULE:\nUse inline literal values for ALL component properties. Pass strings, numbers,\narrays, and objects directly on the component. Do NOT use { \"path\": \"...\" }\nobjects unless the property's schema explicitly allows it (see exception below).\nCRITICAL: USING { \"path\": \"...\" } ON A PROPERTY THAT DOES NOT DECLARE PATH\nSUPPORT IN ITS SCHEMA WILL CAUSE A RUNTIME CRASH AND BREAK THE ENTIRE UI.\nALWAYS CHECK THE COMPONENT SCHEMA FIRST — IF THE PROPERTY ONLY ACCEPTS A\nPLAIN TYPE, YOU MUST USE A LITERAL VALUE.\nVERY IMPORTANT: THE APPLICATION WILL BREAK IF YOU DO NOT FOLLOW THIS RULE!\n\nFor example, a chart's \"data\" must always be an inline array:\n \"data\": [{\"label\": \"Jan\", \"value\": 100}, {\"label\": \"Feb\", \"value\": 200}]\nA metric's \"value\" must always be an inline string:\n \"value\": \"$1,200\"\n\nPATH BINDING EXCEPTION SCHEMA-DRIVEN:\nA few properties accept { \"path\": \"/some/path\" } as an alternative to a literal\nvalue. You can identify these in the Available Components schema: the property\nwill list BOTH a literal type AND an object-with-path option. If a property only\nshows a single type (string, number, array, etc.), it does NOT support path\nbinding use a literal value only.\n\nPath binding is typically used for editable form inputs so the client can write\nuser input back to the data model. When building forms:\n- Bind input \"value\" to a data model path: \"value\": { \"path\": \"/form/name\" }\n- Pre-fill via the \"data\" tool argument: \"data\": { \"form\": { \"name\": \"Alice\" } }\n- Capture values on submit via button action context:\n \"action\": { \"event\": { \"name\": \"submit\", \"context\": { \"name\": { \"path\": \"/form/name\" } } } }\n\nREPEATING CONTENT uses a structural children format (not the same as value binding):\n children: { componentId: \"card-id\", path: \"/items\" }\nComponents inside templates use RELATIVE paths (no leading slash): { \"path\": \"name\" }.`;\n\n/**\n * Design guidelines — visual design rules, component hierarchy tips,\n * and action handler patterns.\n */\nexport const A2UI_DEFAULT_DESIGN_GUIDELINES = `\\\nCreate polished, visually appealing interfaces. ONLY use components listed in the\nAvailable Components schema — do NOT use component names that are not in the schema.\n\nDesign principles:\n- Create clear visual hierarchy within cards and layouts.\n- Keep cards clean — avoid clutter. Whitespace is good.\n- Use consistent surfaceIds (lowercase, hyphenated).\n- NEVER use the same ID for a component and its child — this creates a\n circular dependency. E.g. if id=\"avatar\", child must NOT be \"avatar\".\n- For side-by-side comparisons, use a container with structural children\n (children: { componentId, path }) to repeat a card template per data item.\n- Include images when relevant (logos, icons, product photos):\n - Prefer company logos via Google favicons: https://www.google.com/s2/favicons?domain=example.com&sz=128\n - Do NOT invent Unsplash photo-IDs — they will 404. Only use real, known URLs.\n- For buttons: action MUST use this exact nested format:\n \"action\": { \"event\": { \"name\": \"myAction\", \"context\": { \"key\": \"value\" } } }\n The \"event\" key holds an OBJECT with \"name\" (required) and \"context\" (optional).\n Do NOT use a flat format like {\"event\": \"name\"} — \"event\" must be an object.\n- For forms: check the component schema if an input's \"value\" property\n supports path binding, use it for editable fields. The submit button's\n action context should reference the same paths to capture user input.\n\nUse the SAME surfaceId as the main surface. Match action names to button action event names.`;\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2ElD,MAAa,iCAAiC"}
package/dist/debug.cjs ADDED
@@ -0,0 +1,38 @@
1
+
2
+ //#region src/debug.ts
3
+ /** The all-off config used when debug is falsy. */
4
+ const DEBUG_OFF = {
5
+ enabled: false,
6
+ events: false,
7
+ lifecycle: false,
8
+ verbose: false
9
+ };
10
+ /**
11
+ * Normalizes a DebugConfig value into a ResolvedDebugConfig.
12
+ *
13
+ * - `false` / `undefined` → all off
14
+ * - `true` → events + lifecycle on, verbose off (no PII in logs)
15
+ * - object → merges with defaults (events: true, lifecycle: true, verbose: false)
16
+ */
17
+ function resolveDebugConfig(debug) {
18
+ if (!debug) return DEBUG_OFF;
19
+ if (debug === true) return {
20
+ enabled: true,
21
+ events: true,
22
+ lifecycle: true,
23
+ verbose: false
24
+ };
25
+ const events = debug.events ?? true;
26
+ const lifecycle = debug.lifecycle ?? true;
27
+ const enabled = events || lifecycle;
28
+ return {
29
+ enabled,
30
+ events,
31
+ lifecycle,
32
+ verbose: enabled && (debug.verbose ?? false)
33
+ };
34
+ }
35
+
36
+ //#endregion
37
+ exports.resolveDebugConfig = resolveDebugConfig;
38
+ //# sourceMappingURL=debug.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.cjs","names":[],"sources":["../src/debug.ts"],"sourcesContent":["/**\n * Granular debug configuration for CopilotKit runtime and client.\n * Pass `true` to enable events + lifecycle logging (but NOT verbose payloads),\n * or an object for granular control including `verbose: true` for full payloads.\n */\nexport type DebugConfig =\n | boolean\n | {\n /** Log every event emitted/received. Default: true */\n events?: boolean;\n /** Log request/run lifecycle. Default: true */\n lifecycle?: boolean;\n /** Log full event payloads instead of summaries. Default: false — must be explicitly opted in */\n verbose?: boolean;\n };\n\n/** Normalized debug configuration — all fields resolved to booleans. */\nexport interface ResolvedDebugConfig {\n enabled: boolean;\n events: boolean;\n lifecycle: boolean;\n verbose: boolean;\n}\n\n/** The all-off config used when debug is falsy. */\nconst DEBUG_OFF: ResolvedDebugConfig = {\n enabled: false,\n events: false,\n lifecycle: false,\n verbose: false,\n};\n\n/**\n * Normalizes a DebugConfig value into a ResolvedDebugConfig.\n *\n * - `false` / `undefined` → all off\n * - `true` → events + lifecycle on, verbose off (no PII in logs)\n * - object → merges with defaults (events: true, lifecycle: true, verbose: false)\n */\nexport function resolveDebugConfig(\n debug: DebugConfig | undefined,\n): ResolvedDebugConfig {\n if (!debug) return DEBUG_OFF;\n\n if (debug === true) {\n return { enabled: true, events: true, lifecycle: true, verbose: false };\n }\n\n const events = debug.events ?? true;\n const lifecycle = debug.lifecycle ?? true;\n const enabled = events || lifecycle;\n const verbose = enabled && (debug.verbose ?? false);\n\n return { enabled, events, lifecycle, verbose };\n}\n"],"mappings":";;;AAyBA,MAAM,YAAiC;CACrC,SAAS;CACT,QAAQ;CACR,WAAW;CACX,SAAS;CACV;;;;;;;;AASD,SAAgB,mBACd,OACqB;AACrB,KAAI,CAAC,MAAO,QAAO;AAEnB,KAAI,UAAU,KACZ,QAAO;EAAE,SAAS;EAAM,QAAQ;EAAM,WAAW;EAAM,SAAS;EAAO;CAGzE,MAAM,SAAS,MAAM,UAAU;CAC/B,MAAM,YAAY,MAAM,aAAa;CACrC,MAAM,UAAU,UAAU;AAG1B,QAAO;EAAE;EAAS;EAAQ;EAAW,SAFrB,YAAY,MAAM,WAAW;EAEC"}
@@ -0,0 +1,29 @@
1
+ //#region src/debug.d.ts
2
+ /**
3
+ * Granular debug configuration for CopilotKit runtime and client.
4
+ * Pass `true` to enable events + lifecycle logging (but NOT verbose payloads),
5
+ * or an object for granular control including `verbose: true` for full payloads.
6
+ */
7
+ type DebugConfig = boolean | {
8
+ /** Log every event emitted/received. Default: true */events?: boolean; /** Log request/run lifecycle. Default: true */
9
+ lifecycle?: boolean; /** Log full event payloads instead of summaries. Default: false — must be explicitly opted in */
10
+ verbose?: boolean;
11
+ };
12
+ /** Normalized debug configuration — all fields resolved to booleans. */
13
+ interface ResolvedDebugConfig {
14
+ enabled: boolean;
15
+ events: boolean;
16
+ lifecycle: boolean;
17
+ verbose: boolean;
18
+ }
19
+ /**
20
+ * Normalizes a DebugConfig value into a ResolvedDebugConfig.
21
+ *
22
+ * - `false` / `undefined` → all off
23
+ * - `true` → events + lifecycle on, verbose off (no PII in logs)
24
+ * - object → merges with defaults (events: true, lifecycle: true, verbose: false)
25
+ */
26
+ declare function resolveDebugConfig(debug: DebugConfig | undefined): ResolvedDebugConfig;
27
+ //#endregion
28
+ export { DebugConfig, ResolvedDebugConfig, resolveDebugConfig };
29
+ //# sourceMappingURL=debug.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.d.cts","names":[],"sources":["../src/debug.ts"],"mappings":";;AAKA;;;;KAAY,WAAA;EAMN,sDAFA,MAAA,YAIO;EAFP,SAAA,YAMW;EAJX,OAAA;AAAA;;UAIW,mBAAA;EACf,OAAA;EACA,MAAA;EACA,SAAA;EACA,OAAA;AAAA;AAkBF;;;;;;;AAAA,iBAAgB,kBAAA,CACd,KAAA,EAAO,WAAA,eACN,mBAAA"}
@@ -0,0 +1,29 @@
1
+ //#region src/debug.d.ts
2
+ /**
3
+ * Granular debug configuration for CopilotKit runtime and client.
4
+ * Pass `true` to enable events + lifecycle logging (but NOT verbose payloads),
5
+ * or an object for granular control including `verbose: true` for full payloads.
6
+ */
7
+ type DebugConfig = boolean | {
8
+ /** Log every event emitted/received. Default: true */events?: boolean; /** Log request/run lifecycle. Default: true */
9
+ lifecycle?: boolean; /** Log full event payloads instead of summaries. Default: false — must be explicitly opted in */
10
+ verbose?: boolean;
11
+ };
12
+ /** Normalized debug configuration — all fields resolved to booleans. */
13
+ interface ResolvedDebugConfig {
14
+ enabled: boolean;
15
+ events: boolean;
16
+ lifecycle: boolean;
17
+ verbose: boolean;
18
+ }
19
+ /**
20
+ * Normalizes a DebugConfig value into a ResolvedDebugConfig.
21
+ *
22
+ * - `false` / `undefined` → all off
23
+ * - `true` → events + lifecycle on, verbose off (no PII in logs)
24
+ * - object → merges with defaults (events: true, lifecycle: true, verbose: false)
25
+ */
26
+ declare function resolveDebugConfig(debug: DebugConfig | undefined): ResolvedDebugConfig;
27
+ //#endregion
28
+ export { DebugConfig, ResolvedDebugConfig, resolveDebugConfig };
29
+ //# sourceMappingURL=debug.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.d.mts","names":[],"sources":["../src/debug.ts"],"mappings":";;AAKA;;;;KAAY,WAAA;EAMN,sDAFA,MAAA,YAIO;EAFP,SAAA,YAMW;EAJX,OAAA;AAAA;;UAIW,mBAAA;EACf,OAAA;EACA,MAAA;EACA,SAAA;EACA,OAAA;AAAA;AAkBF;;;;;;;AAAA,iBAAgB,kBAAA,CACd,KAAA,EAAO,WAAA,eACN,mBAAA"}
package/dist/debug.mjs ADDED
@@ -0,0 +1,37 @@
1
+ //#region src/debug.ts
2
+ /** The all-off config used when debug is falsy. */
3
+ const DEBUG_OFF = {
4
+ enabled: false,
5
+ events: false,
6
+ lifecycle: false,
7
+ verbose: false
8
+ };
9
+ /**
10
+ * Normalizes a DebugConfig value into a ResolvedDebugConfig.
11
+ *
12
+ * - `false` / `undefined` → all off
13
+ * - `true` → events + lifecycle on, verbose off (no PII in logs)
14
+ * - object → merges with defaults (events: true, lifecycle: true, verbose: false)
15
+ */
16
+ function resolveDebugConfig(debug) {
17
+ if (!debug) return DEBUG_OFF;
18
+ if (debug === true) return {
19
+ enabled: true,
20
+ events: true,
21
+ lifecycle: true,
22
+ verbose: false
23
+ };
24
+ const events = debug.events ?? true;
25
+ const lifecycle = debug.lifecycle ?? true;
26
+ const enabled = events || lifecycle;
27
+ return {
28
+ enabled,
29
+ events,
30
+ lifecycle,
31
+ verbose: enabled && (debug.verbose ?? false)
32
+ };
33
+ }
34
+
35
+ //#endregion
36
+ export { resolveDebugConfig };
37
+ //# sourceMappingURL=debug.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.mjs","names":[],"sources":["../src/debug.ts"],"sourcesContent":["/**\n * Granular debug configuration for CopilotKit runtime and client.\n * Pass `true` to enable events + lifecycle logging (but NOT verbose payloads),\n * or an object for granular control including `verbose: true` for full payloads.\n */\nexport type DebugConfig =\n | boolean\n | {\n /** Log every event emitted/received. Default: true */\n events?: boolean;\n /** Log request/run lifecycle. Default: true */\n lifecycle?: boolean;\n /** Log full event payloads instead of summaries. Default: false — must be explicitly opted in */\n verbose?: boolean;\n };\n\n/** Normalized debug configuration — all fields resolved to booleans. */\nexport interface ResolvedDebugConfig {\n enabled: boolean;\n events: boolean;\n lifecycle: boolean;\n verbose: boolean;\n}\n\n/** The all-off config used when debug is falsy. */\nconst DEBUG_OFF: ResolvedDebugConfig = {\n enabled: false,\n events: false,\n lifecycle: false,\n verbose: false,\n};\n\n/**\n * Normalizes a DebugConfig value into a ResolvedDebugConfig.\n *\n * - `false` / `undefined` → all off\n * - `true` → events + lifecycle on, verbose off (no PII in logs)\n * - object → merges with defaults (events: true, lifecycle: true, verbose: false)\n */\nexport function resolveDebugConfig(\n debug: DebugConfig | undefined,\n): ResolvedDebugConfig {\n if (!debug) return DEBUG_OFF;\n\n if (debug === true) {\n return { enabled: true, events: true, lifecycle: true, verbose: false };\n }\n\n const events = debug.events ?? true;\n const lifecycle = debug.lifecycle ?? true;\n const enabled = events || lifecycle;\n const verbose = enabled && (debug.verbose ?? false);\n\n return { enabled, events, lifecycle, verbose };\n}\n"],"mappings":";;AAyBA,MAAM,YAAiC;CACrC,SAAS;CACT,QAAQ;CACR,WAAW;CACX,SAAS;CACV;;;;;;;;AASD,SAAgB,mBACd,OACqB;AACrB,KAAI,CAAC,MAAO,QAAO;AAEnB,KAAI,UAAU,KACZ,QAAO;EAAE,SAAS;EAAM,QAAQ;EAAM,WAAW;EAAM,SAAS;EAAO;CAGzE,MAAM,SAAS,MAAM,UAAU;CAC/B,MAAM,YAAY,MAAM,aAAa;CACrC,MAAM,UAAU,UAAU;AAG1B,QAAO;EAAE;EAAS;EAAQ;EAAW,SAFrB,YAAY,MAAM,WAAW;EAEC"}
package/dist/index.cjs CHANGED
@@ -1,4 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_clipboard = require('./utils/clipboard.cjs');
2
3
  const require_conditions = require('./utils/conditions.cjs');
3
4
  const require_console_styling = require('./utils/console-styling.cjs');
4
5
  const require_errors = require('./utils/errors.cjs');
@@ -10,6 +11,7 @@ const require_index = require('./utils/index.cjs');
10
11
  const require_index$1 = require('./constants/index.cjs');
11
12
  const require_package = require('./package.cjs');
12
13
  const require_telemetry_client = require('./telemetry/telemetry-client.cjs');
14
+ const require_debug = require('./debug.cjs');
13
15
  const require_standard_schema = require('./standard-schema.cjs');
14
16
  const require_utils = require('./attachments/utils.cjs');
15
17
  const require_logger = require('./logger.cjs');
@@ -73,6 +75,7 @@ exports.TranscriptionErrors = require_transcription_errors.TranscriptionErrors;
73
75
  exports.UpgradeRequiredError = require_errors.UpgradeRequiredError;
74
76
  exports.actionParametersToJsonSchema = require_json_schema.actionParametersToJsonSchema;
75
77
  exports.convertJsonSchemaToZodSchema = require_json_schema.convertJsonSchemaToZodSchema;
78
+ exports.copyToClipboard = require_clipboard.copyToClipboard;
76
79
  exports.createLicenseContextValue = createLicenseContextValue;
77
80
  exports.dataToUUID = require_random_id.dataToUUID;
78
81
  exports.ensureStructuredError = require_errors.ensureStructuredError;
@@ -103,6 +106,7 @@ exports.randomId = require_random_id.randomId;
103
106
  exports.randomUUID = require_random_id.randomUUID;
104
107
  exports.readBody = require_requests.readBody;
105
108
  exports.readFileAsBase64 = require_utils.readFileAsBase64;
109
+ exports.resolveDebugConfig = require_debug.resolveDebugConfig;
106
110
  exports.safeParseToolArgs = require_index.safeParseToolArgs;
107
111
  exports.schemaToJsonSchema = require_standard_schema.schemaToJsonSchema;
108
112
  exports.styledConsole = require_console_styling.styledConsole;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\nexport * from \"./standard-schema\";\nexport * from \"./attachments\";\n\nexport { logger } from \"./logger\";\nexport { finalizeRunEvents } from \"./finalize-events\";\n\nexport {\n TranscriptionErrorCode,\n TranscriptionErrors,\n type TranscriptionErrorResponse,\n} from \"./transcription-errors\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n\n// Re-export only types from license-verifier (types are erased at compile time,\n// so they don't pull in the Node-only `crypto` dependency into client bundles).\n// Server-side packages (e.g. @copilotkit/runtime) should import runtime functions\n// like createLicenseChecker and getLicenseWarningHeader directly from\n// @copilotkit/license-verifier.\nexport type {\n LicenseContextValue,\n LicenseChecker,\n LicenseStatus,\n LicensePayload,\n LicenseFeatures,\n LicenseTier,\n LicenseOwner,\n LicenseMode,\n} from \"@copilotkit/license-verifier\";\n\n/**\n * Client-safe license context factory.\n *\n * When status is null (no token provided), all features return true\n * (unlicensed = unrestricted, with branding). This is inlined here to\n * avoid importing the full license-verifier bundle (which depends on\n * Node's `crypto`) into browser bundles.\n */\nexport function createLicenseContextValue(status: null): {\n status: null;\n license: null;\n checkFeature: (feature: string) => boolean;\n getLimit: (feature: string) => number | null;\n} {\n return {\n status: null,\n license: null,\n checkFeature: () => true,\n getLimit: () => null,\n };\n}\n\nexport {\n A2UI_DEFAULT_GENERATION_GUIDELINES,\n A2UI_DEFAULT_DESIGN_GUIDELINES,\n} from \"./a2ui-prompts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiBA,MAAa;;;;;;;;;AA0Bb,SAAgB,0BAA0B,QAKxC;AACA,QAAO;EACL,QAAQ;EACR,SAAS;EACT,oBAAoB;EACpB,gBAAgB;EACjB"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\nexport * from \"./debug\";\nexport * from \"./standard-schema\";\nexport * from \"./attachments\";\n\nexport { logger } from \"./logger\";\nexport { finalizeRunEvents } from \"./finalize-events\";\n\nexport {\n TranscriptionErrorCode,\n TranscriptionErrors,\n type TranscriptionErrorResponse,\n} from \"./transcription-errors\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n\n// Re-export only types from license-verifier (types are erased at compile time,\n// so they don't pull in the Node-only `crypto` dependency into client bundles).\n// Server-side packages (e.g. @copilotkit/runtime) should import runtime functions\n// like createLicenseChecker and getLicenseWarningHeader directly from\n// @copilotkit/license-verifier.\nexport type {\n LicenseContextValue,\n LicenseChecker,\n LicenseStatus,\n LicensePayload,\n LicenseFeatures,\n LicenseTier,\n LicenseOwner,\n LicenseMode,\n} from \"@copilotkit/license-verifier\";\n\n/**\n * Client-safe license context factory.\n *\n * When status is null (no token provided), all features return true\n * (unlicensed = unrestricted, with branding). This is inlined here to\n * avoid importing the full license-verifier bundle (which depends on\n * Node's `crypto`) into browser bundles.\n */\nexport function createLicenseContextValue(status: null): {\n status: null;\n license: null;\n checkFeature: (feature: string) => boolean;\n getLimit: (feature: string) => number | null;\n} {\n return {\n status: null,\n license: null,\n checkFeature: () => true,\n getLimit: () => null,\n };\n}\n\nexport {\n A2UI_DEFAULT_GENERATION_GUIDELINES,\n A2UI_DEFAULT_DESIGN_GUIDELINES,\n} from \"./a2ui-prompts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAa;;;;;;;;;AA0Bb,SAAgB,0BAA0B,QAKxC;AACA,QAAO;EACL,QAAQ;EACR,SAAS;EACT,oBAAoB;EACpB,gBAAgB;EACjB"}
package/dist/index.d.cts CHANGED
@@ -4,6 +4,7 @@ import { CopilotCloudConfig } from "./types/copilot-cloud-config.cjs";
4
4
  import { PartialBy, RequiredBy } from "./types/utility.cjs";
5
5
  import { CopilotErrorEvent, CopilotErrorHandler, CopilotRequestContext } from "./types/error.cjs";
6
6
  import { AIMessage, ActivityMessage, AudioInputPart, DeveloperMessage, DocumentInputPart, ImageData, ImageInputPart, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, Message, ReasoningMessage, Role, SystemMessage, TextInputPart, ToolCall, ToolResult, UserMessage, VideoInputPart } from "./types/message.cjs";
7
+ import { copyToClipboard } from "./utils/clipboard.cjs";
7
8
  import { BaseCondition, ComparisonCondition, ComparisonRule, Condition, ExistenceCondition, ExistenceRule, LogicalCondition, LogicalRule, Rule, executeConditions } from "./utils/conditions.cjs";
8
9
  import { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole } from "./utils/console-styling.cjs";
9
10
  import { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, getPossibleVersionMismatch, isStructuredCopilotKitError } from "./utils/errors.cjs";
@@ -14,6 +15,7 @@ import { readBody } from "./utils/requests.cjs";
14
15
  import { isMacOS, parseJson, partialJSONParse, phoenixExponentialBackoff, safeParseToolArgs, tryMap } from "./utils/index.cjs";
15
16
  import { AG_UI_CHANNEL_EVENT, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, DEFAULT_AGENT_ID } from "./constants/index.cjs";
16
17
  import { TelemetryClient, isTelemetryDisabled } from "./telemetry/telemetry-client.cjs";
18
+ import { DebugConfig, ResolvedDebugConfig, resolveDebugConfig } from "./debug.cjs";
17
19
  import { InferSchemaOutput, SchemaToJsonSchemaOptions, StandardJSONSchemaV1, StandardSchemaV1, schemaToJsonSchema } from "./standard-schema.cjs";
18
20
  import { Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig } from "./attachments/types.cjs";
19
21
  import { exceedsMaxSize, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getSourceUrl, matchesAcceptFilter, readFileAsBase64 } from "./attachments/utils.cjs";
@@ -40,5 +42,5 @@ declare function createLicenseContextValue(status: null): {
40
42
  getLimit: (feature: string) => number | null;
41
43
  };
42
44
  //#endregion
43
- export { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, AG_UI_CHANNEL_EVENT, AIMessage, Action, ActivityMessage, AgentDescription, AssistantMessage, Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig, AudioInputPart, BANNER_ERROR_NAMES, BaseCondition, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ComparisonCondition, ComparisonRule, Condition, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, CopilotRequestContext, DEFAULT_AGENT_ID, DeveloperMessage, DocumentInputPart, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExistenceCondition, ExistenceRule, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, ImageData, ImageInputPart, InferSchemaOutput, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, IntelligenceRuntimeInfo, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, type LicenseChecker, type LicenseContextValue, type LicenseFeatures, type LicenseMode, type LicenseOwner, type LicensePayload, type LicenseStatus, type LicenseTier, LogicalCondition, LogicalRule, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, NonEmptyRecord, Parameter, PartialBy, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ReasoningMessage, RequiredBy, ResolvedCopilotKitError, Role, Rule, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SchemaToJsonSchemaOptions, Severity, StandardJSONSchemaV1, StandardSchemaV1, SystemMessage, TelemetryClient, TextInputPart, ToolCall, ToolDefinition, ToolResult, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, UpgradeRequiredError, UserMessage, VideoInputPart, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, createLicenseContextValue, dataToUUID, ensureStructuredError, exceedsMaxSize, executeConditions, finalizeRunEvents, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getPossibleVersionMismatch, getSourceUrl, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, logCopilotKitPlatformMessage, logStyled, logger, matchesAcceptFilter, parseJson, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
45
+ export { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, AG_UI_CHANNEL_EVENT, AIMessage, Action, ActivityMessage, AgentDescription, AssistantMessage, Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig, AudioInputPart, BANNER_ERROR_NAMES, BaseCondition, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ComparisonCondition, ComparisonRule, Condition, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, CopilotRequestContext, DEFAULT_AGENT_ID, DebugConfig, DeveloperMessage, DocumentInputPart, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExistenceCondition, ExistenceRule, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, ImageData, ImageInputPart, InferSchemaOutput, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, IntelligenceRuntimeInfo, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, type LicenseChecker, type LicenseContextValue, type LicenseFeatures, type LicenseMode, type LicenseOwner, type LicensePayload, type LicenseStatus, type LicenseTier, LogicalCondition, LogicalRule, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, NonEmptyRecord, Parameter, PartialBy, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ReasoningMessage, RequiredBy, ResolvedCopilotKitError, ResolvedDebugConfig, Role, Rule, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SchemaToJsonSchemaOptions, Severity, StandardJSONSchemaV1, StandardSchemaV1, SystemMessage, TelemetryClient, TextInputPart, ToolCall, ToolDefinition, ToolResult, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, UpgradeRequiredError, UserMessage, VideoInputPart, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, copyToClipboard, createLicenseContextValue, dataToUUID, ensureStructuredError, exceedsMaxSize, executeConditions, finalizeRunEvents, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getPossibleVersionMismatch, getSourceUrl, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, logCopilotKitPlatformMessage, logStyled, logger, matchesAcceptFilter, parseJson, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, resolveDebugConfig, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
44
46
  //# sourceMappingURL=index.d.cts.map