1106
switch (action.type) {
1107
case ActionType.ChatTurnStarted: {
1109
throw new Error(`ChatTurnStarted must be handled on an AHP chat channel: ${channel}`);
1110
}
1112
>
// Per-turn streaming part tracking is owned by the agent
1113
>
// (e.g. CopilotAgentSession) and reset on its `send()` call.
1114
>
1115
>
// Generic, agent-agnostic host commands (`/rename`, `!command`,
1116
>
// …) are intercepted here and handled by the local-command
1117
>
// dispatcher rather than forwarded to the agent SDK.
1118
>
const handled = this._localCommands.tryHandle({ turnChannel: channel, turnId: action.turnId, text: action.message.text });
1119
>
if (handled) {
1120
if (handled.suggestedTitle !== undefined) {
1121
this._titleController.seedProvisionalTitle(sessionChannel, handled.suggestedTitle, chatChannel);