170
return buildTurnsFromHistory(this.sessionMessages);
171
}
173
>
async disposeSession(session: URI): Promise<void> {
174
this.disposeSessionCalls.push(session);
175
this._sessions.delete(AgentSession.id(session));
176
}
178
>
async releaseSession(session: URI): Promise<void> {
179
// Non-destructive: record the call but keep the session in the catalog
180
// so a later restore/resume still finds its durable data.
181
this.releaseSessionCalls.push(session);
182
}
184
>
async abortSession(session: URI): Promise<void> {
185
this.abortSessionCalls.push(session);
186
}
188
>
async truncateSession(session: URI, turnId?: string, chat?: URI): Promise<void> {
189
this.truncateSessionCalls.push({ session, turnId, chat });
190
}
192
>
respondToPermissionRequest(requestId: string, approved: boolean): void {
193
this.respondToPermissionCalls.push({ requestId, approved });
194
}
196
>
respondToUserInputRequest(): void {
197
// no-op for tests
198
}
200
>
async changeModel(session: URI, model: ModelSelection, chat?: URI): Promise<void> {
201
this.changeModelCalls.push({ session, model, chat });
202
}
204
>
async changeAgent(session: URI, agent: AgentSelection | undefined, chat?: URI): Promise<void> {
205
this.changeAgentCalls.push({ session, agent, chat });
206
}
208
>
/**
209
>
* Create an additional (peer) chat. The base mock is single-chat and
210
>
* rejects; multi-chat test subclasses override this.
211
>
*/
212
>
async createChat(_session: URI, _chat: URI, _options?: IAgentCreateChatOptions): Promise<IAgentCreateChatResult | void> {
213
throw new Error(`Agent ${this.id} does not support multiple chats`);
214
}
216
>
/** Dispose an additional (peer) chat. Overridden by multi-chat subclasses. */
217
>
async disposeChat(_session: URI, _chat: URI): Promise<void> { }
218
>
219
>
/**
220
>
* Map an already-resolved chat URI to the `(session, chat)` pair the
221
>
* mock records calls against (mirroring the real agents).
222
>
*/
223
>
private _resolveChatTarget(chat: URI): { session: URI; chat: URI } {
224
const parsed = parseChatUri(chat);
225
if (!parsed) {