@@ -74,13 +74,22 @@ export namespace SessionPrompt {
7474 callback : ( input : MessageV2 . WithParts ) => void
7575 } [ ]
7676 > ( )
77+ const pending = new Set < Promise < void > > ( )
78+
79+ const track = ( promise : Promise < void > ) => {
80+ pending . add ( promise )
81+ promise . finally ( ( ) => pending . delete ( promise ) )
82+ }
7783
7884 return {
7985 queued,
86+ pending,
87+ track,
8088 }
8189 } ,
8290 async ( current ) => {
8391 current . queued . clear ( )
92+ await Promise . allSettled ( [ ...current . pending ] )
8493 } ,
8594 )
8695
@@ -191,28 +200,6 @@ export namespace SessionPrompt {
191200 processor,
192201 } )
193202
194- // const permUnsub = (() => {
195- // const handled = new Set<string>()
196- // const options = [
197- // { optionId: "allow_once", kind: "allow_once", name: "Allow once" },
198- // { optionId: "allow_always", kind: "allow_always", name: "Always allow" },
199- // { optionId: "reject_once", kind: "reject_once", name: "Reject" },
200- // ]
201- // return Bus.subscribe(Permission.Event.Updated, async (event) => {
202- // const info = event.properties
203- // if (info.sessionID !== input.sessionID) return
204- // if (handled.has(info.id)) return
205- // handled.add(info.id)
206- // const toolCallId = info.callID ?? info.id
207- // const metadata = info.metadata ?? {}
208- // // TODO: emit permission event to bus for ACP to handle
209- // Permission.respond({ sessionID: info.sessionID, permissionID: info.id, response: "reject" })
210- // })
211- // })()
212- // await using _permSub = defer(() => {
213- // permUnsub?.()
214- // })
215-
216203 const params = await Plugin . trigger (
217204 "chat.params" ,
218205 {
@@ -247,13 +234,15 @@ export namespace SessionPrompt {
247234 step ++
248235 await processor . next ( msgs . findLast ( ( m ) => m . info . role === "user" ) ?. info . id ! )
249236 if ( step === 1 ) {
250- ensureTitle ( {
251- session,
252- history : msgs ,
253- message : userMsg ,
254- providerID : model . providerID ,
255- modelID : model . info . id ,
256- } )
237+ state ( ) . track (
238+ ensureTitle ( {
239+ session,
240+ history : msgs ,
241+ message : userMsg ,
242+ providerID : model . providerID ,
243+ modelID : model . info . id ,
244+ } ) ,
245+ )
257246 SessionSummary . summarize ( {
258247 sessionID : input . sessionID ,
259248 messageID : userMsg . info . id ,
@@ -1730,7 +1719,7 @@ export namespace SessionPrompt {
17301719 thinkingBudget : 0 ,
17311720 }
17321721 }
1733- generateText ( {
1722+ await generateText ( {
17341723 maxOutputTokens : small . info . reasoning ? 1500 : 20 ,
17351724 providerOptions : ProviderTransform . providerOptions ( small . npm , small . providerID , options ) ,
17361725 messages : [
0 commit comments