parseAgentTriggerMode function
Parse a host- or backend-supplied string into a mode. Case- and
separator-insensitive — "co-pilot", "CO_PILOT", "coPilot" and
"copilot" all mean co-pilot — mirroring Android's parseAgentTriggerMode
so the SAME string is accepted everywhere. Returns null when absent or
unrecognised (never throws); callers fall back to co-pilot.
Implementation
AgentTriggerMode? parseAgentTriggerMode(String? raw) {
switch (_normaliseMode(raw)) {
case 'copilot':
return AgentTriggerMode.CO_PILOT;
case 'workflow':
return AgentTriggerMode.WORKFLOW;
default:
return null;
}
}