From 8c6297aef4af0d299d11f8e12ca61c09f87becd9 Mon Sep 17 00:00:00 2001 From: Rajhans Jadhao Date: Thu, 12 Feb 2026 19:40:17 +0530 Subject: [PATCH 1/2] spec(v0_10): add copyToClipboard standard local action to catalog, docs, and tests --- specification/v0_10/docs/a2ui_protocol.md | 16 +++ specification/v0_10/eval/src/prompts.ts | 7 ++ .../v0_10/json/standard_catalog.json | 26 +++++ .../cases/function_catalog_validation.json | 100 ++++++++++++++++++ 4 files changed, 149 insertions(+) diff --git a/specification/v0_10/docs/a2ui_protocol.md b/specification/v0_10/docs/a2ui_protocol.md index 52da38a9..535434ff 100644 --- a/specification/v0_10/docs/a2ui_protocol.md +++ b/specification/v0_10/docs/a2ui_protocol.md @@ -379,6 +379,21 @@ To execute a local function, use the `functionCall` property within the `action` } ``` +```json +{ + "component": "Button", + "text": "Copy Invite Code", + "action": { + "functionCall": { + "call": "copyToClipboard", + "args": { + "text": "INVITE-1234" + } + } + } +} +``` + ## Data model representation: binding, scope This section describes how UI components **represent** and reference data from the Data Model. A2UI relies on a strictly defined relationship between the UI structure (Components) and the state (Data Model), defining the mechanics of path resolution, variable scope during iteration. @@ -687,6 +702,7 @@ The [`standard_catalog.json`] provides the baseline set of components and functi | **formatDate** | Formats a date/time using a pattern. | | **pluralize** | Selects a localized string based on a numeric count. | | **openUrl** | Opens a URL in a browser. | +| **copyToClipboard**| Copies text to the system clipboard. | | **and** | Logical AND operation on a list of boolean values. | | **or** | Logical OR operation on a list of boolean values. | | **not** | Logical NOT operation on a boolean value. | diff --git a/specification/v0_10/eval/src/prompts.ts b/specification/v0_10/eval/src/prompts.ts index f44b1f2d..d880fac2 100644 --- a/specification/v0_10/eval/src/prompts.ts +++ b/specification/v0_10/eval/src/prompts.ts @@ -396,6 +396,13 @@ Each activity in the inner lists should be a 'Row' containing a 'CheckBox' (to m Include a 'Button' labeled "Visit Website". The button's action should be a client-side function call to 'openUrl' with the argument 'url': 'https://a2ui.org'.`, }, + { + name: "copyToClipboardAction", + description: "A button that copies text to clipboard.", + promptText: `Create a 'createSurface' and 'updateComponents' message. Surface ID 'main'. + Include a 'Button' labeled "Copy Code". + The button's action should be a client-side function call to 'copyToClipboard' with the argument 'text': 'SAVE20'.`, + }, { name: "nestedLayoutRecursive", description: "A deeply nested layout to test component recursion.", diff --git a/specification/v0_10/json/standard_catalog.json b/specification/v0_10/json/standard_catalog.json index 076f9ef6..6fad1cc0 100644 --- a/specification/v0_10/json/standard_catalog.json +++ b/specification/v0_10/json/standard_catalog.json @@ -981,6 +981,31 @@ "required": ["call", "args"], "unevaluatedProperties": false }, + "copyToClipboard": { + "type": "object", + "description": "Copies text to the system clipboard. This function has no return value.", + "properties": { + "call": { + "const": "copyToClipboard" + }, + "args": { + "type": "object", + "properties": { + "text": { + "$ref": "common_types.json#/$defs/DynamicString", + "description": "The text to copy." + } + }, + "required": ["text"], + "additionalProperties": false + }, + "returnType": { + "const": "void" + } + }, + "required": ["call", "args"], + "unevaluatedProperties": false + }, "and": { "type": "object", "description": "Performs a logical AND operation on a list of boolean values.", @@ -1129,6 +1154,7 @@ { "$ref": "#/functions/formatDate" }, { "$ref": "#/functions/pluralize" }, { "$ref": "#/functions/openUrl" }, + { "$ref": "#/functions/copyToClipboard" }, { "$ref": "#/functions/and" }, { "$ref": "#/functions/or" }, { "$ref": "#/functions/not" } diff --git a/specification/v0_10/test/cases/function_catalog_validation.json b/specification/v0_10/test/cases/function_catalog_validation.json index fb6d964e..40a6a46d 100644 --- a/specification/v0_10/test/cases/function_catalog_validation.json +++ b/specification/v0_10/test/cases/function_catalog_validation.json @@ -472,6 +472,106 @@ } } }, + { + "description": "copyToClipboard: Valid call in Action", + "valid": true, + "data": { + "version": "v0.10", + "updateComponents": { + "surfaceId": "test", + "components": [ + { + "id": "btn1", + "component": "Button", + "child": "txt1", + "action": { + "functionCall": { + "call": "copyToClipboard", + "args": { "text": "ABC-123" }, + "returnType": "void" + } + } + }, + { "id": "txt1", "component": "Text", "text": "Copy" } + ] + } + } + }, + { + "description": "copyToClipboard: Invalid args (string instead of object)", + "valid": false, + "data": { + "version": "v0.10", + "updateComponents": { + "surfaceId": "test", + "components": [ + { + "id": "btn1", + "component": "Button", + "child": "txt1", + "action": { + "functionCall": { + "call": "copyToClipboard", + "args": "ABC-123", + "returnType": "void" + } + } + }, + { "id": "txt1", "component": "Text", "text": "Copy" } + ] + } + } + }, + { + "description": "copyToClipboard: Invalid returnType", + "valid": false, + "data": { + "version": "v0.10", + "updateComponents": { + "surfaceId": "test", + "components": [ + { + "id": "btn1", + "component": "Button", + "child": "txt1", + "action": { + "functionCall": { + "call": "copyToClipboard", + "args": { "text": "ABC-123" }, + "returnType": "string" + } + } + }, + { "id": "txt1", "component": "Text", "text": "Copy" } + ] + } + } + }, + { + "description": "copyToClipboard: Invalid text type (number)", + "valid": false, + "data": { + "version": "v0.10", + "updateComponents": { + "surfaceId": "test", + "components": [ + { + "id": "btn1", + "component": "Button", + "child": "txt1", + "action": { + "functionCall": { + "call": "copyToClipboard", + "args": { "text": 12345 }, + "returnType": "void" + } + } + }, + { "id": "txt1", "component": "Text", "text": "Copy" } + ] + } + } + }, { "description": "length: Invalid min type (string)", "valid": false, From aaeeb51de91a540a00e0d44bac960f29770a1432 Mon Sep 17 00:00:00 2001 From: Rajhans Jadhao Date: Thu, 12 Feb 2026 19:51:27 +0530 Subject: [PATCH 2/2] Update specification/v0_10/docs/a2ui_protocol.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- specification/v0_10/docs/a2ui_protocol.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/specification/v0_10/docs/a2ui_protocol.md b/specification/v0_10/docs/a2ui_protocol.md index 535434ff..367afc18 100644 --- a/specification/v0_10/docs/a2ui_protocol.md +++ b/specification/v0_10/docs/a2ui_protocol.md @@ -388,7 +388,8 @@ To execute a local function, use the `functionCall` property within the `action` "call": "copyToClipboard", "args": { "text": "INVITE-1234" - } + }, + "returnType": "void" } } }