Files
Netcatty/infrastructure/ai/harness/agentRuntimeHandle.ts
T
945722fbe8 fix(ai): place host_open tabs in the invoking chat's bound workspace (#4156)
* fix(ai): place host_open tabs in the invoking chat's bound workspace

* fix(ai): sync generated host open workspace guidance

* fix(ai): preserve invoking turn scope for resumed chats

---------

Co-authored-by: GOUKI9999 <GOUKI9999@users.noreply.github.com>
Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com>
2026-11-07 15:41:46 +08:00

24 lines
857 B
TypeScript

import type { AISessionScope } from '../types';
/**
* Lets startup code clean up per-chat / per-terminal agent runtime state
* without importing the runtime itself, which pulls the Catty harness and the
* AI SDK providers into the startup bundle. globalAgentRuntime registers here
* when it is created; before that there is no in-memory state to clear.
*/
export interface AgentRuntimeCleanup {
clearChatSession(chatSessionId: string): void;
clearTerminalSession(terminalSessionId: string): void;
getActiveScope?(chatSessionId: string): AISessionScope | undefined;
}
let registeredRuntime: AgentRuntimeCleanup | null = null;
export function registerAgentRuntimeCleanup(runtime: AgentRuntimeCleanup): void {
registeredRuntime = runtime;
}
export function peekAgentRuntimeCleanup(): AgentRuntimeCleanup | null {
return registeredRuntime;
}