Skip to content

a2ui-core 0.5.0

Choose a tag to compare

@github-actions github-actions released this 02 Nov 02:38
· 159 commits to main since this release
9e8a9ba
  • BREAKING CHANGE: DataContext refuses a function whose allowed_callers
    is agentOnly, before running it, so a binding, check or function call
    action that calls one reports an EXPRESSION_ERROR instead of running it, as
    the v1.0 specification requires. RpcHandler still runs such a function for
    an agent's callRendererFunction. Recommended migration: set
    allowed_callers to rendererOrAgent on a function both the renderer and
    the agent call (#3483,
    #3773).
  • From v0.9, a component its catalog declares with no ComponentId or
    ChildList property has no child references. Previously any of its string
    properties that named a component on the surface, such as an Icon named
    mail inside the Row whose id is mail, 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.value is now '1.0'), while
    continuing to accept 'v1.0' in Catalog.from_json.
    Catalog.protocol_version is typed as ProtocolVersion | str.
    #3097,
    #3726
  • BREAKING CHANGE: validate_composition_constraints and
    SurfaceComponentsModel.validate_components_update apply the "Surface"
    allowedParents rule 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 MessageProcessor without a validation_config, as a
    renderer has by default, checks each updateComponents against the
    allowedParents and allowedChildren rules 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, and dispatch_action(..., metadata=...)), ComponentModel (metadata, extensions, on_metadata_changed, set_extension, remove_extension), ComponentNode (metadata and on_metadata_changed), ComponentContext and GenericBinder (metadata, extensions, and optional metadata on bound action closures), and ComponentApi (metadata parsed and serialized in Catalog.from_json() and Catalog.to_json()). Fix MessageProcessor to store component metadata on ComponentModel.metadata outside ComponentModel.properties and validate UAX 31 extension keys on component creation as well as updates, and fix Pydantic code generation to emit a distinct ActionMetadata wrapper model instead of colliding with Extensions (#3103, #3468, #3560, #3708, #3757).
  • A function defined without an argument schema (FunctionApi or
    FunctionImplementation without schema) takes any args, as one given
    schema={} does: validation_schema and resolved_function_schema give
    {} for it rather than None. Catalog.to_json writes the args of either
    as {"type": "object", "additionalProperties": true}, so a catalog read back
    with Catalog.from_json accepts any args for it too. to_json used to write
    {"type": "object"} for schema={}, which from_json reads as taking no
    args. to_json no longer raises TypeError for a catalog that holds such a
    function, and neither do the paths that call it: link_catalogs, and so a
    MessageProcessor of two or more catalogs, and get_renderer_capabilities
    with v1.0 inline catalogs.
  • (v1_0) DataContext reads a ValidationResult dict that a function argument
    resolves to by its valid boolean wherever the function's argument schema
    types that argument as DynamicBoolean, as the specification defines the
    type. This applies to every DynamicBoolean argument, in built-in and
    custom catalogs, so formatNumber's grouping and a custom function's
    boolean parameters now read a failing validation as False rather than as
    a truthy dict; and, or and not already did. Catalogs below v1.0, whose
    validation functions return booleans, are unchanged.
    #3653
  • Add map_error_to_renderer_message, extract_envelope_error_context, and ErrorEnvelopeContext to a2ui.core.processing and the a2ui.core public facade, along with SurfaceGroupModel.on_error and MessageProcessor.process_messages_with_errors for emitting and collecting structured wire-format renderer error messages. #3580
  • Add NodeResolver, ComponentNode, and NodeState to a2ui.core.resolution and the a2ui.core public facade for reactive surface node-graph resolution, template expansion, and placeholder/cycle tracking. #3580
  • (v1_0) Support @-prefixed system function calls (such as ${@index()}) in ExpressionParser string interpolation templates, and preserve ValidationResult.message on path-bound CheckRule conditions in GenericBinder while overriding function default messages on evaluated checks. #3583
  • BREAKING CHANGE: Cross-catalog $ref resolution across peer catalogs is
    removed. Catalog.peer_catalogs, Catalog.with_peer_catalogs and
    link_catalogs are gone, inline_local_refs no longer takes a peers
    argument, and MessageProcessor no 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_json raises A2uiCatalogError for a
    v1.0 catalog with a $ref to any other document, such as
    basic_catalog.json#/components/Text or 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 new catalog_id from
    the named components and functions of an existing one and new entries,
    with the instructions it is given, and does not keep the source's $id,
    title, description or instructions.
    #3597
  • (v1_0) Relaxed v1.0 CatalogDefinition schema 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. Factored weight in the v1.0 basic catalog into
    #/$defs/Weight (annotated with CatalogDef), inlining leaf catalog $defs
    into component schemas in Catalog.from_json and
    Catalog.resolved_component_schema while restoring #/$defs/... references
    in Catalog.to_json() and Catalog.validation_schema
    (#2724).
  • Schema validation never fetches a $ref over the network. A $ref to a
    document that is not available locally fails validation with an
    unresolvable-reference error instead of being downloaded
    (#3554).
  • (v1_0) The createSurface description no longer says that a surface's
    components and data must come in later messages. They can be sent inline in
    createSurface or in later updateComponents and updateDataModel messages.
    #3678
  • SchemaValidator.evolve no longer raises TypeError (_registry) for a
    subschema that declares its own $schema, and keeps the validator's
    registry.
  • to_protocol_version is exported from the a2ui.core public facade.
  • Under a ValidationConfig that allows dangling references, and orphans or a
    missing root, as an agent mirroring a renderer's surfaces uses,
    MessageProcessor checks each updateComponents against 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_applied reports that a batch
    validate_components_update passed has been applied, so that the next check
    can start from what that check found. MessageProcessor calls 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_component still appends.
  • ComponentModel.get_child_references and is_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
    ChildList is 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
    read name[i] instead of name.[i].

Published to PyPI: a2ui-core 0.5.0

pip install a2ui-core==0.5.0