feat(gateway): wire safe-point runtime cancellation for agent.cancel

This commit is contained in:
William Valentin
2026-02-13 08:51:14 -08:00
parent 9f81c01603
commit 46099664f0
7 changed files with 182 additions and 26 deletions
+11
View File
@@ -97,6 +97,17 @@ export class SessionBridge {
if (client) {client.busy = busy;}
}
/** Request cancellation for the current operation on a connection's agent. */
cancel(connectionId: string): boolean {
const client = this.clients.get(connectionId);
if (!client || !client.busy) {
return false;
}
client.agent.cancel();
return true;
}
/** Set onToolUse callback for a connection's agent. */
setOnToolUse(connectionId: string, callback: ((event: ToolUseEvent) => void) | undefined): void {
const client = this.clients.get(connectionId);