@@ -24,9 +24,7 @@ type ChatCommandSettingsContext = {
2424 defaultAgentId ?: string ;
2525 agentId ?: string ;
2626} ;
27- type PendingPatchStore = WeakMap < SessionCapability , Map < string , Promise < boolean > > > ;
28-
29- const pendingChatPickerPatches : PendingPatchStore = new WeakMap ( ) ;
27+ const pendingChatPickerPatches = new WeakMap < SessionCapability , Map < string , Promise < boolean > > > ( ) ;
3028
3129function resolveChatPickerPatchKey (
3230 host : ChatPickerPatchHost ,
@@ -64,25 +62,24 @@ function resolveChatPickerPatchKey(
6462 return `agent:${ normalizeAgentId ( resolvedAgentId ) } :${ settingsKey } ` ;
6563}
6664
67- function getPendingPatch (
68- store : PendingPatchStore ,
65+ export function getPendingChatPickerPatch (
6966 host : ChatPickerPatchHost ,
7067 sessionKey : string ,
7168 agentId ?: string ,
7269) : Promise < boolean > | undefined {
7370 const patchKey = resolveChatPickerPatchKey ( host , sessionKey , agentId ) ;
74- return store . get ( host . sessions ) ?. get ( patchKey ) ;
71+ return pendingChatPickerPatches . get ( host . sessions ) ?. get ( patchKey ) ;
7572}
7673
77- function trackLatestPatch (
78- store : PendingPatchStore ,
74+ function trackPendingChatSettingsPatch (
7975 host : ChatPickerPatchHost ,
8076 sessionKey : string ,
8177 patchPromise : Promise < boolean > ,
8278 agentId ?: string ,
8379) : void {
84- const pendingBySession = store . get ( host . sessions ) ?? new Map < string , Promise < boolean > > ( ) ;
85- store . set ( host . sessions , pendingBySession ) ;
80+ const pendingBySession =
81+ pendingChatPickerPatches . get ( host . sessions ) ?? new Map < string , Promise < boolean > > ( ) ;
82+ pendingChatPickerPatches . set ( host . sessions , pendingBySession ) ;
8683 const patchKey = resolveChatPickerPatchKey ( host , sessionKey , agentId ) ;
8784 pendingBySession . set ( patchKey , patchPromise ) ;
8885 void patchPromise . finally ( ( ) => {
@@ -92,23 +89,6 @@ function trackLatestPatch(
9289 } ) ;
9390}
9491
95- export function getPendingChatPickerPatch (
96- host : ChatPickerPatchHost ,
97- sessionKey : string ,
98- agentId ?: string ,
99- ) : Promise < boolean > | undefined {
100- return getPendingPatch ( pendingChatPickerPatches , host , sessionKey , agentId ) ;
101- }
102-
103- function trackPendingChatSettingsPatch (
104- host : ChatPickerPatchHost ,
105- sessionKey : string ,
106- patchPromise : Promise < boolean > ,
107- agentId ?: string ,
108- ) : void {
109- trackLatestPatch ( pendingChatPickerPatches , host , sessionKey , patchPromise , agentId ) ;
110- }
111-
11292export function patchChatSessionSettings (
11393 host : ChatPickerPatchHost ,
11494 sessionKey : string ,
0 commit comments