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 ¶
- Constants
- Variables
- type AccessibilityAttributes
- type Action
- type ActionEvent
- type AudioPlayerComponent
- type ButtonComponent
- type ButtonVariant
- type CardComponent
- type CatalogDef
- type CheckBoxComponent
- type CheckRule
- type ChildList
- type ChildTemplate
- type ChoiceOption
- type ChoicePickerComponent
- type ChoicePickerDisplayStyle
- type ChoicePickerVariant
- type ClientCapabilities
- type ClientCapabilitiesV09
- type ClientDataModel
- type ClientError
- type ClientMessage
- type ClientMessageListWrapper
- type ColumnComponent
- type Component
- type CreateSurface
- type DataBinding
- type DateTimeInputComponent
- type DeleteSurface
- type DividerAxis
- type DividerComponent
- type DynamicBoolean
- type DynamicNumber
- type DynamicString
- type DynamicStringList
- type DynamicValue
- type EventAction
- type FunctionCall
- type FunctionDefinition
- type IconComponent
- type IconName
- type IconNameOrPath
- type ImageComponent
- type ImageFit
- type ImageVariant
- type LayoutAlign
- type LayoutJustify
- type ListComponent
- type ListDirection
- type ModalComponent
- type ReturnType
- type RowComponent
- type ServerCapabilities
- type ServerCapabilitiesV09
- type ServerMessage
- type ServerMessageListWrapper
- type SliderComponent
- type TabDef
- type TabsComponent
- type TextComponent
- type TextFieldComponent
- type TextFieldVariant
- type TextVariant
- type Theme
- type UpdateComponents
- type UpdateDataModel
- type VideoComponent
Examples ¶
Constants ¶
const ( ReturnTypeString = v09.ReturnTypeString ReturnTypeNumber = v09.ReturnTypeNumber ReturnTypeBoolean = v09.ReturnTypeBoolean ReturnTypeArray = v09.ReturnTypeArray ReturnTypeObject = v09.ReturnTypeObject ReturnTypeAny = v09.ReturnTypeAny ReturnTypeVoid = v09.ReturnTypeVoid )
ReturnType constants.
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 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.
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.
const Version = v09.Version
Version re-exports the protocol version from the active implementation.
Variables ¶
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.
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 AudioPlayerComponent ¶
type AudioPlayerComponent = v09.AudioPlayerComponent
Generated component types.
type ChoicePickerComponent ¶
type ChoicePickerComponent = v09.ChoicePickerComponent
Generated component types.
type ChoicePickerDisplayStyle ¶
type ChoicePickerDisplayStyle = v09.ChoicePickerDisplayStyle
Generated enum types.
type ClientCapabilitiesV09 ¶
type ClientCapabilitiesV09 = v09.ClientCapabilitiesV09
Capability types.
type ClientMessageListWrapper ¶
type ClientMessageListWrapper = v09.ClientMessageListWrapper
Generated message list-wrapper 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 DateTimeInputComponent ¶
type DateTimeInputComponent = v09.DateTimeInputComponent
Generated component types.
type DeleteSurface ¶
type DeleteSurface = v09.DeleteSurface
Hand-written server-to-client message types.
type ServerCapabilitiesV09 ¶
type ServerCapabilitiesV09 = v09.ServerCapabilitiesV09
Capability types.
type ServerMessageListWrapper ¶
type ServerMessageListWrapper = v09.ServerMessageListWrapper
Generated message list-wrapper types.
type TextFieldComponent ¶
type TextFieldComponent = v09.TextFieldComponent
Generated component 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.
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. |