listFromJson static method
Tolerant decode of the .capabilities marker payload: a JSON list of
{name, description?, payload?} maps; malformed entries are skipped.
Implementation
static List<AgentCapability> listFromJson(Object? node) => [
if (node is List)
for (final entry in node)
if (entry is Map &&
entry['name'] is String &&
(entry['name'] as String).isNotEmpty)
AgentCapability(
name: entry['name'] as String,
description: entry['description'] is String
? entry['description'] as String
: null,
payload: entry['payload'] is String
? entry['payload'] as String
: null,
),
];