A2UI icon indicating copy to clipboard operation
A2UI copied to clipboard

[v1.0][spec/docs] a2ui_custom_functions.md is unlinked from docs/public/ and its getScreenResolution example omits allowedCallers, failing with INVALID_FUNCTION_CALL

Open josemontespg opened this issue 1 month ago • 2 comments

Summary

There are two issues with specification/v1_0/docs/a2ui_custom_functions.md:

  1. Unpublished in docs/public/: specification/v1_0/docs/a2ui_custom_functions.md is a dedicated v1.0 custom functions guide, but it is neither copied into docs/public/ nor linked from mkdocs.yml or any page under docs/public/.
  2. Broken getScreenResolution Example (Spec Self-Contradiction):
    • In specification/v1_0/docs/a2ui_protocol.md (lines 333–346), getScreenResolution is used as the canonical example of an agent calling a client function via callRendererFunction:
      {
        "version": "v1.0",
        "callRendererFunction": {
          "surfaceId": "main-content",
          "functionCallId": "req-001",
          "callFunction": {
            "@call": "getScreenResolution",
            "catalogId": "https://example.com/a2ui/custom-catalog/v1"
          }
        }
      }
      
    • However, in specification/v1_0/docs/a2ui_custom_functions.md (lines 78–83), the catalog definition for getScreenResolution omits allowedCallers:
      "getScreenResolution": {
        "description": "Returns the current screen width and height in pixels.",
        "returnType": "object",
        "properties": { "type": "object", "properties": {}, "additionalProperties": false }
      }
      
    • Because allowedCallers defaults to "rendererOnly" (specification/v1_0/json/catalog_definition.json line 82, and RpcHandler.checkExecutionPermissions in typescript/core/web_core/src/v1_0/rpc/rpc-handler.ts lines 522–525: const allowedCallers = funcImpl.allowedCallers ?? 'rendererOnly'; if (allowedCallers === 'rendererOnly') throw new A2uiRpcError(RpcErrorCode.INVALID_FUNCTION_CALL, ...)), calling getScreenResolution via callRendererFunction always fails at runtime with INVALID_FUNCTION_CALL!

Affected Component / Files

  • Repository commit: e9dbcc3 (main)
  • File path(s):
    • specification/v1_0/docs/a2ui_custom_functions.md (lines 72–97)
    • specification/v1_0/docs/a2ui_protocol.md (lines 322–346)
    • specification/v1_0/json/catalog_definition.json (lines 79–87)
    • typescript/core/web_core/src/v1_0/rpc/rpc-handler.ts (lines 518–531)

Steps to Reproduce / Evidence

  1. Define getScreenResolution exactly as shown in specification/v1_0/docs/a2ui_custom_functions.md (lines 78–83, without allowedCallers).
  2. Send the callRendererFunction message from specification/v1_0/docs/a2ui_protocol.md (lines 333–346) into MessageProcessor.processMessages().
  3. RpcHandler.checkExecutionPermissions() defaults allowedCallers to 'rendererOnly' and rejects the call with:
    {
      "version": "v1.0",
      "rendererFunctionResponse": {
        "functionCallId": "req-001",
        "error": {
          "code": "INVALID_FUNCTION_CALL",
          "message": "Function 'getScreenResolution' is restricted to 'rendererOnly' and cannot be called by the agent."
        }
      }
    }
    

Expected Behavior

  1. specification/v1_0/docs/a2ui_custom_functions.md should include "allowedCallers": "rendererOrAgent" (or "agentOnly") on getScreenResolution and explain how allowedCallers governs callRendererFunction vs UI bindings.
  2. The guide should be published/linked in docs/public/guides/ (mkdocs.yml).

Actual Behavior

Following the official specification examples verbatim causes getScreenResolution to be rejected with INVALID_FUNCTION_CALL.

Suggested Fix

  1. Add "allowedCallers": "rendererOrAgent" to getScreenResolution in specification/v1_0/docs/a2ui_custom_functions.md (line 80).
  2. Surface a2ui_custom_functions.md in docs/public/guides/ and link it in mkdocs.yml.

josemontespg avatar Oct 22 '26 20:10 josemontespg

Confirmed in specification/v1_0/docs/a2ui_custom_functions.md (lines 48-67): the getScreenResolution catalog schema omits "allowedCallers": "rendererOrAgent", causing the callRendererFunction example in a2ui_protocol.md (lines 333-346) to be rejected with INVALID_FUNCTION_CALL under the default "rendererOnly" boundary. Also confirmed a2ui_custom_functions.md is not included in docs/scripts/convert_docs.py / mkdocs.yaml. Marking as P1.

josemontespg avatar Oct 23 '26 00:10 josemontespg

Closing this as resolved on the new documentation site (https://a2ui.org/):

  1. The getScreenResolution example in specification/v1_0/docs/a2ui_custom_functions.md now includes "allowedCallers": "rendererOrAgent" and explains INVALID_FUNCTION_CALL.
  2. Custom functions, allowedCallers, requiresUserActivation, and callRendererFunction are now documented on a2ui.org:

(Feel free to reopen if I missed anything!)

ditman avatar Nov 12 '26 23:11 ditman