TrustProfile class final

What an edited document may use: node types, action types, scripts, link and image hosts, navigation, and size limits. TrustProfile.none allows everything; TrustProfile.agent is the default for agent-written UI.

Annotations
  • @immutable

Constructors

TrustProfile({Set<String>? widgets, Set<String>? actions, bool scripts = true, Set<String>? linkHosts, Set<String>? imageHosts, NavigationLimit navigation = NavigationLimit.any, int? maxNodes, int? maxDepth, int? maxTextLength, int? maxOpsPerCall, Set<ScriptCapability>? scriptCapabilities})
const

Properties

actions → Set<String>?
Action types allowed; null: every type of the catalog.
final
hashCode → int
The hash code for this object.
no setterinherited
imageHosts → Set<String>?
Hosts images may load from (https://<host>/...); null: any. data: URIs are always allowed.
final
linkHosts → Set<String>?
Hosts openLink may open (https only); null: any link.
final
maxDepth → int?
final
maxNodes → int?
final
maxOpsPerCall → int?
final
maxTextLength → int?
final
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scriptCapabilities → Set<ScriptCapability>?
With scripts: the capabilities a script of the document may ask for; null: any.
final
scripts → bool
Whether runScript actions and script formulas (script.x(...)) are allowed.
final
widgets → Set<String>?
Node types allowed; null: every type of the catalog.
final

Methods

checkNode(String id, Json json, {required int op, required Catalog catalog, Set<String>? screens}) → List<EditDiagnostic>
The problems of node json (id id, op op) under this profile: node types, action types, scripts, links, images and navigation targets (screens: the canvases navigation may name, null for any), and text length.
copyWith({Set<String>? widgets, Set<String>? actions, bool? scripts, Set<String>? linkHosts, Set<String>? imageHosts, NavigationLimit? navigation, int? maxNodes, int? maxDepth, int? maxTextLength, int? maxOpsPerCall, Set<ScriptCapability>? scriptCapabilities}) → TrustProfile
agent with links to linkHosts, and other changes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
restrict(Catalog catalog) → Catalog
catalog restricted to what this profile allows: the catalog an agent is described and validated with.
toString() → String
A string representation of this object.
inherited
withComponents(ComponentLibrary components) → TrustProfile
This profile with the node types of components allowed too: what a session given a design system (or the project's components) checks ops with. A call is made of the nodes its definition holds, which the library's author wrote, not the agent; the call's own props, actions and children are checked as any node's. A profile that allows every type is returned as it is.

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

agent → TrustProfile
The default for agent-written UI: the core's node types (every type Catalog.core declares: layout, text, inputs, lists, charts; no feature library's, whatever catalog the session has), agentActions, no scripts, no links, navigation only to the document's own canvases, and size limits.
final
agentApps → TrustProfile
agent for apps and games an agent builds: the same, plus the document's own sandboxed scripts (the scripts op, runScript, script.name(...) in formulas), limited to what a local app needs: reading and writing variables and the clock. No APIs, cloud data, navigation or actions from scripts; no links, host functions or feature libraries.
final

Constants

agentActions → const Set<String>
The core's action types an agent may use by default: local state, in-document navigation, modals, toasts, scrolling, focus, animation, and componentEvent (an event to the agent). Not runScript, callFunction, openLink, copyToClipboard, editText or the controls of drag tracks.
none → const TrustProfile
No restriction.