mergedTools method
Compute the merged tool list keyed by fully-qualified name.
Tool names must be bare tokens (no .); the registry prefixes each
with the owning extension's namespace. Throws ArgumentError for a
dotted tool name and StateError for a collision (intra- or
inter-extension).
Implementation
Map<String, LeonardTool> mergedTools() {
final out = <String, LeonardTool>{};
for (final e in _entries) {
for (final t in e.plugin.tools) {
if (t.name.contains('.')) {
throw ArgumentError.value(
t.name,
'tool.name',
'must be bare token (no ".")',
);
}
final fq = '${e.plugin.namespace}.${t.name}';
if (out.containsKey(fq)) {
throw StateError('tool name collision: $fq');
}
out[fq] = t;
}
}
_finalized = true;
return Map.unmodifiable(out);
}