- Move MCP session registry and preview broker out of `Layers/` and `Services/` - Update imports, tests, and server wiring to use the new module layout
29 lines
905 B
TypeScript
29 lines
905 B
TypeScript
import type { EnvironmentId, ProviderInstanceId, ThreadId } from "@t3tools/contracts";
|
|
|
|
export interface McpProviderSessionConfig {
|
|
readonly environmentId: EnvironmentId;
|
|
readonly threadId: ThreadId;
|
|
readonly providerSessionId: string;
|
|
readonly providerInstanceId: ProviderInstanceId;
|
|
readonly endpoint: string;
|
|
readonly authorizationHeader: string;
|
|
}
|
|
|
|
const sessionsByThread = new Map<ThreadId, McpProviderSessionConfig>();
|
|
|
|
export function setMcpProviderSession(config: McpProviderSessionConfig): void {
|
|
sessionsByThread.set(config.threadId, config);
|
|
}
|
|
|
|
export function readMcpProviderSession(threadId: ThreadId): McpProviderSessionConfig | undefined {
|
|
return sessionsByThread.get(threadId);
|
|
}
|
|
|
|
export function clearMcpProviderSession(threadId: ThreadId): void {
|
|
sessionsByThread.delete(threadId);
|
|
}
|
|
|
|
export function clearAllMcpProviderSessions(): void {
|
|
sessionsByThread.clear();
|
|
}
|