resolveEntry method
FR-BUNDLE-002
Implementation
BundleEntryPoint resolveEntry(McpBundle bundle) {
final bundleId = bundle.manifest.id;
final raw = bundle.manifest.entryPoint ?? _default(bundle);
final parts = raw.split('.');
if (parts.length != 2) {
throw BundleAdaptException(
bundleId: bundleId,
reason: BundleAdaptReason.unsupportedEntryPoint,
message: 'Entry point must be "<type>.<id>" — got "$raw"',
);
}
final BundleEntryType type;
switch (parts[0]) {
case 'ui':
type = BundleEntryType.ui;
break;
case 'flow':
type = BundleEntryType.flow;
break;
case 'skill':
type = BundleEntryType.skill;
break;
default:
throw BundleAdaptException(
bundleId: bundleId,
reason: BundleAdaptReason.unsupportedEntryPoint,
message: 'Unknown entry type: "${parts[0]}"',
);
}
final id = parts[1];
if (id.isEmpty) {
throw BundleAdaptException(
bundleId: bundleId,
reason: BundleAdaptReason.unsupportedEntryPoint,
message: 'Entry id is empty in "$raw"',
);
}
return BundleEntryPoint(type, id);
}