Repository navigation
a2ui-core 0.5.0
·
159 commits
to main
since this release
- BREAKING CHANGE:
DataContextrefuses a function whoseallowed_callers
isagentOnly, before running it, so a binding, check or function call
action that calls one reports anEXPRESSION_ERRORinstead of running it, as
the v1.0 specification requires.RpcHandlerstill runs such a function for
an agent'scallRendererFunction. Recommended migration: set
allowed_callerstorendererOrAgenton a function both the renderer and
the agent call (#3483,
#3773). - From v0.9, a component its catalog declares with no
ComponentIdor
ChildListproperty has no child references. Previously any of its string
properties that named a component on the surface, such as anIconnamed
mailinside theRowwhose id ismail, was read as one, so a valid
surface could fail topology checks as a cycle. A property declared as a plain
string is read as text, as the protocol's catalog rules require. v0.8
catalogs, and components a catalog does not declare, still infer references
from property names and values. - BREAKING CHANGE: Unify the v1.0 protocol version wire value on
'1.0'
(without a'v'prefix) across message envelopes, capability objects, and
catalog documents (ProtocolVersion.V1_0.valueis now'1.0'), while
continuing to accept'v1.0'inCatalog.from_json.
Catalog.protocol_versionis typed asProtocolVersion | str.
#3097,
#3726 - BREAKING CHANGE:
validate_composition_constraintsand
SurfaceComponentsModel.validate_components_updateapply the"Surface"
allowedParentsrule only to the surface's root component (root_id,
"root"by default), even when another component also references it, and
check every parent of a component that has several, not only the last one
in surface order. A non-root component that nothing references is no longer
checked against"Surface"; the topology checks report it as an orphan, or
allow it. This matches the specification and the TypeScript, Dart and Swift
SDKs, and changes which payloads are accepted.
(#3354,
#3360) - BREAKING CHANGE: A
MessageProcessorwithout avalidation_config, as a
renderer has by default, checks eachupdateComponentsagainst the
allowedParentsandallowedChildrenrules of its catalogs, as the
TypeScript and Dart SDKs do. Before, it checked nothing, so a payload
that breaks those rules is now rejected. The check is skipped when no catalog
of the surface's components declares such rules.
#3360 - Add extension metadata APIs across
SurfaceModel(metadata,extensions,on_metadata_changed,set_extension,remove_extension, anddispatch_action(..., metadata=...)),ComponentModel(metadata,extensions,on_metadata_changed,set_extension,remove_extension),ComponentNode(metadataandon_metadata_changed),ComponentContextandGenericBinder(metadata,extensions, and optionalmetadataon bound action closures), andComponentApi(metadataparsed and serialized inCatalog.from_json()andCatalog.to_json()). FixMessageProcessorto store componentmetadataonComponentModel.metadataoutsideComponentModel.propertiesand validate UAX 31 extension keys on component creation as well as updates, and fix Pydantic code generation to emit a distinctActionMetadatawrapper model instead of colliding withExtensions(#3103, #3468, #3560, #3708, #3757). - A function defined without an argument schema (
FunctionApior
FunctionImplementationwithoutschema) takes any args, as one given
schema={}does:validation_schemaandresolved_function_schemagive
{}for it rather thanNone.Catalog.to_jsonwrites theargsof either
as{"type": "object", "additionalProperties": true}, so a catalog read back
withCatalog.from_jsonaccepts any args for it too.to_jsonused to write
{"type": "object"}forschema={}, whichfrom_jsonreads as taking no
args.to_jsonno longer raisesTypeErrorfor a catalog that holds such a
function, and neither do the paths that call it:link_catalogs, and so a
MessageProcessorof two or more catalogs, andget_renderer_capabilities
with v1.0 inline catalogs. - (v1_0)
DataContextreads aValidationResultdict that a function argument
resolves to by itsvalidboolean wherever the function's argument schema
types that argument asDynamicBoolean, as the specification defines the
type. This applies to everyDynamicBooleanargument, in built-in and
custom catalogs, soformatNumber'sgroupingand a custom function's
boolean parameters now read a failing validation asFalserather than as
a truthy dict;and,orandnotalready did. Catalogs below v1.0, whose
validation functions return booleans, are unchanged.
#3653 - Add
map_error_to_renderer_message,extract_envelope_error_context, andErrorEnvelopeContexttoa2ui.core.processingand thea2ui.corepublic facade, along withSurfaceGroupModel.on_errorandMessageProcessor.process_messages_with_errorsfor emitting and collecting structured wire-format renderer error messages. #3580 - Add
NodeResolver,ComponentNode, andNodeStatetoa2ui.core.resolutionand thea2ui.corepublic facade for reactive surface node-graph resolution, template expansion, and placeholder/cycle tracking. #3580 - (v1_0) Support
@-prefixed system function calls (such as${@index()}) inExpressionParserstring interpolation templates, and preserveValidationResult.messageon path-boundCheckRuleconditions inGenericBinderwhile overriding function default messages on evaluated checks. #3583 - BREAKING CHANGE: Cross-catalog
$refresolution across peer catalogs is
removed.Catalog.peer_catalogs,Catalog.with_peer_catalogsand
link_catalogsare gone,inline_local_refsno longer takes apeers
argument, andMessageProcessorno longer links the catalogs passed to it.
A catalog resolves$refs only against its own document and the protocol's
common_types.json.Catalog.from_jsonraisesA2uiCatalogErrorfor a
v1.0 catalog with a$refto any other document, such as
basic_catalog.json#/components/Textor an absolute catalog URI, and never
fetches it; v0.8 and v0.9 catalogs load as before. Recommended migration:
bundle referenced components, properties and functions into each catalog so
it is standalone.
#3232,
#3575 - Add
Catalog.derive, which builds a catalog with a newcatalog_idfrom
the namedcomponentsandfunctionsof an existing one and new entries,
with theinstructionsit is given, and does not keep the source's$id,
title, description or instructions.
#3597 - (v1_0) Relaxed v1.0
CatalogDefinitionschema rules to permit non-object
catalog$defs(such as primitive, enum, or union design tokens), property
$refs to#/$defs/..., and arbitrary vendor/metadata extension keys on
components and functions. Factoredweightin the v1.0 basic catalog into
#/$defs/Weight(annotated withCatalogDef), inlining leaf catalog$defs
into component schemas inCatalog.from_jsonand
Catalog.resolved_component_schemawhile restoring#/$defs/...references
inCatalog.to_json()andCatalog.validation_schema
(#2724). - Schema validation never fetches a
$refover the network. A$refto a
document that is not available locally fails validation with an
unresolvable-reference error instead of being downloaded
(#3554). - (v1_0) The
createSurfacedescription no longer says that a surface's
components and data must come in later messages. They can be sent inline in
createSurfaceor in laterupdateComponentsandupdateDataModelmessages.
#3678 SchemaValidator.evolveno longer raisesTypeError(_registry) for a
subschema that declares its own$schema, and keeps the validator's
registry.to_protocol_versionis exported from thea2ui.corepublic facade.- Under a
ValidationConfigthat allows dangling references, and orphans or a
missing root, as an agent mirroring a renderer's surfaces uses,
MessageProcessorchecks eachupdateComponentsagainst the components it
changes rather than copying the surface and walking its whole graph. A
surface that arrives in many small messages now takes time in proportion to
its size rather than its square. The checks and the errors they raise are
unchanged: composition constraints, the root when it is required, and
self-references, cycles and depth. Other configs check the whole surface as
before. SurfaceComponentsModel.components_update_appliedreports that a batch
validate_components_updatepassed has been applied, so that the next check
can start from what that check found.MessageProcessorcalls it.SurfaceComponentsModel.insert_component(index, component)adds a component
at a position in the model's order, the order its components are iterated
in.add_componentstill appends.ComponentModel.get_child_referencesandis_v0_8_heuristic_child_prop_key
accept any container of known component ids, not only a set.- A component property declared directly as an array of component ids
({"type": "array", "items": {"$ref": ".../ComponentId"}}) rather than as a
ChildListis now read as a list of child references under every
validation config. Previously it was only read that way when an item named
a component the surface already held, so a strict config now reports an
item naming a missing component as a dangling reference, and error paths
readname[i]instead ofname.[i].
Published to PyPI: a2ui-core 0.5.0
pip install a2ui-core==0.5.0