a2ui

package module
v0.0.0-...-b42a892 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 1 Imported by: 0

README

Package a2ui provides Go types and helpers for the A2UI protocol.

Go Reference

Documentation

Overview

Package a2ui provides Go types for the A2UI (Agent-to-User Interface) protocol, a declarative JSON format for AI agents to generate rich, interactive user interfaces.

This package is the v0.9 compatibility API. It re-exports all types from github.com/tmc/a2ui/v09.

Version-specific code should import the subpackage directly, such as github.com/tmc/a2ui/v010.

Example
package main

import (
	"encoding/json"
	"fmt"

	"github.com/tmc/a2ui"
)

func main() {
	msg := a2ui.ServerMessage{
		Version: a2ui.Version,
		CreateSurface: &a2ui.CreateSurface{
			SurfaceID: "demo",
			CatalogID: "https://a2ui.org/specification/v0_9/catalogs/basic/catalog.json",
		},
	}
	data, _ := json.Marshal(msg)
	fmt.Println(string(data))
}
Output:
{"version":"v0.9","createSurface":{"surfaceId":"demo","catalogId":"https://a2ui.org/specification/v0_9/catalogs/basic/catalog.json"}}

Index

Examples

Constants

View Source
const (
	ReturnTypeString  = v09.ReturnTypeString
	ReturnTypeNumber  = v09.ReturnTypeNumber
	ReturnTypeBoolean = v09.ReturnTypeBoolean
	ReturnTypeArray   = v09.ReturnTypeArray
	ReturnTypeObject  = v09.ReturnTypeObject
	ReturnTypeAny     = v09.ReturnTypeAny
	ReturnTypeVoid    = v09.ReturnTypeVoid
)

ReturnType constants.

View Source
const (
	IconAccountCircle    = v09.IconAccountCircle
	IconAdd              = v09.IconAdd
	IconArrowBack        = v09.IconArrowBack
	IconArrowForward     = v09.IconArrowForward
	IconAttachFile       = v09.IconAttachFile
	IconCalendarToday    = v09.IconCalendarToday
	IconCall             = v09.IconCall
	IconCamera           = v09.IconCamera
	IconCheck            = v09.IconCheck
	IconClose            = v09.IconClose
	IconDelete           = v09.IconDelete
	IconDownload         = v09.IconDownload
	IconEdit             = v09.IconEdit
	IconEvent            = v09.IconEvent
	IconError            = v09.IconError
	IconFastForward      = v09.IconFastForward
	IconFavorite         = v09.IconFavorite
	IconFavoriteOff      = v09.IconFavoriteOff
	IconFolder           = v09.IconFolder
	IconHelp             = v09.IconHelp
	IconHome             = v09.IconHome
	IconInfo             = v09.IconInfo
	IconLocationOn       = v09.IconLocationOn
	IconLock             = v09.IconLock
	IconLockOpen         = v09.IconLockOpen
	IconMail             = v09.IconMail
	IconMenu             = v09.IconMenu
	IconMoreVert         = v09.IconMoreVert
	IconMoreHoriz        = v09.IconMoreHoriz
	IconNotificationsOff = v09.IconNotificationsOff
	IconNotifications    = v09.IconNotifications
	IconPause            = v09.IconPause
	IconPayment          = v09.IconPayment
	IconPerson           = v09.IconPerson
	IconPhone            = v09.IconPhone
	IconPhoto            = v09.IconPhoto
	IconPlay             = v09.IconPlay
	IconPrint            = v09.IconPrint
	IconRefresh          = v09.IconRefresh
	IconRewind           = v09.IconRewind
	IconSearch           = v09.IconSearch
	IconSend             = v09.IconSend
	IconSettings         = v09.IconSettings
	IconShare            = v09.IconShare
	IconShoppingCart     = v09.IconShoppingCart
	IconSkipNext         = v09.IconSkipNext
	IconSkipPrevious     = v09.IconSkipPrevious
	IconStar             = v09.IconStar
	IconStarHalf         = v09.IconStarHalf
	IconStarOff          = v09.IconStarOff
	IconStop             = v09.IconStop
	IconUpload           = v09.IconUpload
	IconVisibility       = v09.IconVisibility
	IconVisibilityOff    = v09.IconVisibilityOff
	IconVolumeDown       = v09.IconVolumeDown
	IconVolumeMute       = v09.IconVolumeMute
	IconVolumeOff        = v09.IconVolumeOff
	IconVolumeUp         = v09.IconVolumeUp
	IconWarning          = v09.IconWarning
)

Icon constants.

View Source
const (
	ButtonVariantDefault                 = v09.ButtonVariantDefault
	ButtonVariantPrimary                 = v09.ButtonVariantPrimary
	ButtonVariantBorderless              = v09.ButtonVariantBorderless
	ChoicePickerDisplayStyleCheckbox     = v09.ChoicePickerDisplayStyleCheckbox
	ChoicePickerDisplayStyleChips        = v09.ChoicePickerDisplayStyleChips
	ChoicePickerVariantMultipleSelection = v09.ChoicePickerVariantMultipleSelection
	ChoicePickerVariantMutuallyExclusive = v09.ChoicePickerVariantMutuallyExclusive
	DividerAxisHorizontal                = v09.DividerAxisHorizontal
	DividerAxisVertical                  = v09.DividerAxisVertical
	ImageFitContain                      = v09.ImageFitContain
	ImageFitCover                        = v09.ImageFitCover
	ImageFitFill                         = v09.ImageFitFill
	ImageFitNone                         = v09.ImageFitNone
	ImageFitScaleDown                    = v09.ImageFitScaleDown
	ImageVariantIcon                     = v09.ImageVariantIcon
	ImageVariantAvatar                   = v09.ImageVariantAvatar
	ImageVariantSmallFeature             = v09.ImageVariantSmallFeature
	ImageVariantMediumFeature            = v09.ImageVariantMediumFeature
	ImageVariantLargeFeature             = v09.ImageVariantLargeFeature
	ImageVariantHeader                   = v09.ImageVariantHeader
	LayoutAlignCenter                    = v09.LayoutAlignCenter
	LayoutAlignEnd                       = v09.LayoutAlignEnd
	LayoutAlignStart                     = v09.LayoutAlignStart
	LayoutAlignStretch                   = v09.LayoutAlignStretch
	LayoutJustifyStart                   = v09.LayoutJustifyStart
	LayoutJustifyCenter                  = v09.LayoutJustifyCenter
	LayoutJustifyEnd                     = v09.LayoutJustifyEnd
	LayoutJustifySpaceBetween            = v09.LayoutJustifySpaceBetween
	LayoutJustifySpaceAround             = v09.LayoutJustifySpaceAround
	LayoutJustifySpaceEvenly             = v09.LayoutJustifySpaceEvenly
	LayoutJustifyStretch                 = v09.LayoutJustifyStretch
	ListDirectionVertical                = v09.ListDirectionVertical
	ListDirectionHorizontal              = v09.ListDirectionHorizontal
	TextFieldVariantLongText             = v09.TextFieldVariantLongText
	TextFieldVariantNumber               = v09.TextFieldVariantNumber
	TextFieldVariantShortText            = v09.TextFieldVariantShortText
	TextFieldVariantObscured             = v09.TextFieldVariantObscured
	TextVariantH1                        = v09.TextVariantH1
	TextVariantH2                        = v09.TextVariantH2
	TextVariantH3                        = v09.TextVariantH3
	TextVariantH4                        = v09.TextVariantH4
	TextVariantH5                        = v09.TextVariantH5
	TextVariantCaption                   = v09.TextVariantCaption
	TextVariantBody                      = v09.TextVariantBody
)

Enum constants.

View Source
const Version = v09.Version

Version re-exports the protocol version from the active implementation.

Variables

View Source
var (
	StringLiteral     = v09.StringLiteral
	StringBinding     = v09.StringBinding
	StringFunc        = v09.StringFunc
	NumberLiteral     = v09.NumberLiteral
	NumberBinding     = v09.NumberBinding
	NumberFunc        = v09.NumberFunc
	BoolLiteral       = v09.BoolLiteral
	BoolBinding       = v09.BoolBinding
	BoolFunc          = v09.BoolFunc
	StringListLiteral = v09.StringListLiteral
	StringListBinding = v09.StringListBinding
	StringListFunc    = v09.StringListFunc
	ValueString       = v09.ValueString
	ValueNumber       = v09.ValueNumber
	ValueBool         = v09.ValueBool
	ValueArray        = v09.ValueArray
	ValueBinding      = v09.ValueBinding
	ValueFunc         = v09.ValueFunc
)

Hand-written Dynamic* constructors.

View Source
var (
	And            = v09.And
	Email          = v09.Email
	FormatCurrency = v09.FormatCurrency
	FormatDate     = v09.FormatDate
	FormatNumber   = v09.FormatNumber
	FormatString   = v09.FormatString
	Length         = v09.Length
	Not            = v09.Not
	Numeric        = v09.Numeric
	OpenURL        = v09.OpenURL
	Or             = v09.Or
	Pluralize      = v09.Pluralize
	Regex          = v09.Regex
	Required       = v09.Required
)

Generated function constructors.

Functions

This section is empty.

Types

type AccessibilityAttributes

type AccessibilityAttributes = v09.AccessibilityAttributes

Hand-written common types.

type Action

type Action = v09.Action

Hand-written common types.

type ActionEvent

type ActionEvent = v09.ActionEvent

Hand-written client-to-server message types.

type AudioPlayerComponent

type AudioPlayerComponent = v09.AudioPlayerComponent

Generated component types.

type ButtonComponent

type ButtonComponent = v09.ButtonComponent

Generated component types.

type ButtonVariant

type ButtonVariant = v09.ButtonVariant

Generated enum types.

type CardComponent

type CardComponent = v09.CardComponent

Generated component types.

type CatalogDef

type CatalogDef = v09.CatalogDef

Capability types.

type CheckBoxComponent

type CheckBoxComponent = v09.CheckBoxComponent

Generated component types.

type CheckRule

type CheckRule = v09.CheckRule

Hand-written common types.

type ChildList

type ChildList = v09.ChildList

Hand-written common types.

type ChildTemplate

type ChildTemplate = v09.ChildTemplate

Hand-written common types.

type ChoiceOption

type ChoiceOption = v09.ChoiceOption

Generated inline struct types.

type ChoicePickerComponent

type ChoicePickerComponent = v09.ChoicePickerComponent

Generated component types.

type ChoicePickerDisplayStyle

type ChoicePickerDisplayStyle = v09.ChoicePickerDisplayStyle

Generated enum types.

type ChoicePickerVariant

type ChoicePickerVariant = v09.ChoicePickerVariant

Generated enum types.

type ClientCapabilities

type ClientCapabilities = v09.ClientCapabilities

Capability types.

type ClientCapabilitiesV09

type ClientCapabilitiesV09 = v09.ClientCapabilitiesV09

Capability types.

type ClientDataModel

type ClientDataModel = v09.ClientDataModel

Capability types.

type ClientError

type ClientError = v09.ClientError

Hand-written client-to-server message types.

type ClientMessage

type ClientMessage = v09.ClientMessage

Hand-written message types.

type ClientMessageListWrapper

type ClientMessageListWrapper = v09.ClientMessageListWrapper

Generated message list-wrapper types.

type ColumnComponent

type ColumnComponent = v09.ColumnComponent

Generated component types.

type Component

type Component = v09.Component

Hand-written common types.

Example
package main

import (
	"encoding/json"
	"fmt"

	"github.com/tmc/a2ui"
)

func main() {
	comp := a2ui.Component{
		ID: "greeting",
		Text: &a2ui.TextComponent{
			Text:    a2ui.StringLiteral("Hello, world!"),
			Variant: a2ui.TextVariantH1,
		},
	}
	data, _ := json.Marshal(comp)
	fmt.Println(string(data))
}
Output:
{"component":"Text","id":"greeting","text":"Hello, world!","variant":"h1"}

type CreateSurface

type CreateSurface = v09.CreateSurface

Hand-written server-to-client message types.

type DataBinding

type DataBinding = v09.DataBinding

Hand-written common types.

type DateTimeInputComponent

type DateTimeInputComponent = v09.DateTimeInputComponent

Generated component types.

type DeleteSurface

type DeleteSurface = v09.DeleteSurface

Hand-written server-to-client message types.

type DividerAxis

type DividerAxis = v09.DividerAxis

Generated enum types.

type DividerComponent

type DividerComponent = v09.DividerComponent

Generated component types.

type DynamicBoolean

type DynamicBoolean = v09.DynamicBoolean

Hand-written common types.

type DynamicNumber

type DynamicNumber = v09.DynamicNumber

Hand-written common types.

type DynamicString

type DynamicString = v09.DynamicString

Hand-written common types.

type DynamicStringList

type DynamicStringList = v09.DynamicStringList

Hand-written common types.

type DynamicValue

type DynamicValue = v09.DynamicValue

Hand-written common types.

type EventAction

type EventAction = v09.EventAction

Hand-written common types.

type FunctionCall

type FunctionCall = v09.FunctionCall

Hand-written common types.

type FunctionDefinition

type FunctionDefinition = v09.FunctionDefinition

Capability types.

type IconComponent

type IconComponent = v09.IconComponent

Generated component types.

type IconName

type IconName = v09.IconName

Generated enum types.

type IconNameOrPath

type IconNameOrPath = v09.IconNameOrPath

Hand-written common types.

type ImageComponent

type ImageComponent = v09.ImageComponent

Generated component types.

type ImageFit

type ImageFit = v09.ImageFit

Generated enum types.

type ImageVariant

type ImageVariant = v09.ImageVariant

Generated enum types.

type LayoutAlign

type LayoutAlign = v09.LayoutAlign

Generated enum types.

type LayoutJustify

type LayoutJustify = v09.LayoutJustify

Generated enum types.

type ListComponent

type ListComponent = v09.ListComponent

Generated component types.

type ListDirection

type ListDirection = v09.ListDirection

Generated enum types.

type ModalComponent

type ModalComponent = v09.ModalComponent

Generated component types.

type ReturnType

type ReturnType = v09.ReturnType

Generated enum types.

type RowComponent

type RowComponent = v09.RowComponent

Generated component types.

type ServerCapabilities

type ServerCapabilities = v09.ServerCapabilities

Capability types.

type ServerCapabilitiesV09

type ServerCapabilitiesV09 = v09.ServerCapabilitiesV09

Capability types.

type ServerMessage

type ServerMessage = v09.ServerMessage

Hand-written message types.

type ServerMessageListWrapper

type ServerMessageListWrapper = v09.ServerMessageListWrapper

Generated message list-wrapper types.

type SliderComponent

type SliderComponent = v09.SliderComponent

Generated component types.

type TabDef

type TabDef = v09.TabDef

Generated inline struct types.

type TabsComponent

type TabsComponent = v09.TabsComponent

Generated component types.

type TextComponent

type TextComponent = v09.TextComponent

Generated component types.

type TextFieldComponent

type TextFieldComponent = v09.TextFieldComponent

Generated component types.

type TextFieldVariant

type TextFieldVariant = v09.TextFieldVariant

Generated enum types.

type TextVariant

type TextVariant = v09.TextVariant

Generated enum types.

type Theme

type Theme = v09.Theme

Hand-written common types.

type UpdateComponents

type UpdateComponents = v09.UpdateComponents

Hand-written server-to-client message types.

type UpdateDataModel

type UpdateDataModel = v09.UpdateDataModel

Hand-written server-to-client message types.

type VideoComponent

type VideoComponent = v09.VideoComponent

Generated component types.

Directories

Path Synopsis
Package a2a provides lightweight A2A helper types for transporting A2UI payloads without depending on a specific A2A Go implementation.
Package a2a provides lightweight A2A helper types for transporting A2UI payloads without depending on a specific A2A Go implementation.
Package a2uiadk provides transport-neutral helpers for ADK-style A2UI tools.
Package a2uiadk provides transport-neutral helpers for ADK-style A2UI tools.
Package a2uibuild provides convenience constructors and a value builder for the root A2UI compatibility API.
Package a2uibuild provides convenience constructors and a value builder for the root A2UI compatibility API.
Package a2uischema provides JSON schema validation for A2UI messages.
Package a2uischema provides JSON schema validation for A2UI messages.
Package a2uistream provides a streaming parser for A2UI messages embedded in LLM responses.
Package a2uistream provides a streaming parser for A2UI messages embedded in LLM responses.
Package v010 provides Go types for the A2UI protocol v0.10.
Package v010 provides Go types for the A2UI protocol v0.10.
Package v09 provides Go types for the A2UI protocol v0.9.
Package v09 provides Go types for the A2UI protocol v0.9.
Package v091 provides Go types for the A2UI v0.9.1 extension, whose JSON message version is v0.9.
Package v091 provides Go types for the A2UI v0.9.1 extension, whose JSON message version is v0.9.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL