@@ -527,7 +527,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
527527 runtime . channel . text . chunkTextWithMode . mockReturnValue ( [ "final text" , " overflow" ] ) ;
528528
529529 const { result, options } = createDispatcherHarness ( { runtime : createRuntimeLogger ( ) } ) ;
530- result . replyOptions . onPartialReply ?.( { text : "partial" } ) ;
530+ await result . replyOptions . onPartialReply ?.( { text : "partial" } ) ;
531531 await options . deliver ( { text : "final text overflow" } , { kind : "final" } ) ;
532532 await options . onIdle ?.( ) ;
533533
@@ -906,7 +906,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
906906 const { result, options } = createDispatcherHarness ( {
907907 runtime : createRuntimeLogger ( ) ,
908908 } ) ;
909- result . replyOptions . onPartialReply ?.( { text : "Working on it..." } ) ;
909+ await result . replyOptions . onPartialReply ?.( { text : "Working on it..." } ) ;
910910 await options . deliver ( { text : "⚠️ Exec failed" , isError : true } , { kind : "final" } ) ;
911911 await options . onIdle ?.( ) ;
912912
@@ -970,7 +970,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
970970 } ) ;
971971
972972 await options . onReplyStart ?.( ) ;
973- result . replyOptions . onPartialReply ?.( { text : "```md\nidle streamed reply\n```" } ) ;
973+ await result . replyOptions . onPartialReply ?.( { text : "```md\nidle streamed reply\n```" } ) ;
974974 await options . onIdle ?.( ) ;
975975 await options . deliver ( { text : "```md\nidle streamed reply\n```" } , { kind : "final" } ) ;
976976
@@ -1022,8 +1022,8 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
10221022 runtime : createRuntimeLogger ( ) ,
10231023 } ) ;
10241024
1025- result . replyOptions . onPartialReply ?.( { text : "plain" } ) ;
1026- result . replyOptions . onPartialReply ?.( { text : "plain streamed answer" } ) ;
1025+ await result . replyOptions . onPartialReply ?.( { text : "plain" } ) ;
1026+ await result . replyOptions . onPartialReply ?.( { text : "plain streamed answer" } ) ;
10271027 await options . onIdle ?.( ) ;
10281028
10291029 expect ( streamingInstances ) . toHaveLength ( 1 ) ;
@@ -1151,7 +1151,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
11511151 runtime : createRuntimeLogger ( ) ,
11521152 } ) ;
11531153 await options . onReplyStart ?.( ) ;
1154- result . replyOptions . onPartialReply ?.( { text : "hello" } ) ;
1154+ await result . replyOptions . onPartialReply ?.( { text : "hello" } ) ;
11551155 await options . deliver ( { text : "lo world" } , { kind : "block" } ) ;
11561156 await options . onIdle ?.( ) ;
11571157
@@ -1178,7 +1178,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
11781178 runtime : createRuntimeLogger ( ) ,
11791179 } ) ;
11801180 await options . onReplyStart ?.( ) ;
1181- result . replyOptions . onPartialReply ?.( { text : "```md\npartial\n```" } ) ;
1181+ await result . replyOptions . onPartialReply ?.( { text : "```md\npartial\n```" } ) ;
11821182 await options . deliver ( { text : "```md\npartial\n```" } , { kind : "block" } ) ;
11831183 await options . onIdle ?.( ) ;
11841184
@@ -1205,11 +1205,11 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
12051205 runtime : createRuntimeLogger ( ) ,
12061206 } ) ;
12071207 await options . onReplyStart ?.( ) ;
1208- result . replyOptions . onPartialReply ?.( {
1208+ await result . replyOptions . onPartialReply ?.( {
12091209 text : "Preparing the lookup plan with enough text to count as one block." ,
12101210 } ) ;
1211- result . replyOptions . onPartialReply ?.( { text : "Found" } ) ;
1212- result . replyOptions . onPartialReply ?.( { text : "Found the answer." } ) ;
1211+ await result . replyOptions . onPartialReply ?.( { text : "Found" } ) ;
1212+ await result . replyOptions . onPartialReply ?.( { text : "Found the answer." } ) ;
12131213 await options . onIdle ?.( ) ;
12141214
12151215 expect ( streamingInstances ) . toHaveLength ( 1 ) ;
@@ -1237,7 +1237,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
12371237 runtime : createRuntimeLogger ( ) ,
12381238 } ) ;
12391239 await options . onReplyStart ?.( ) ;
1240- result . replyOptions . onPartialReply ?.( {
1240+ await result . replyOptions . onPartialReply ?.( {
12411241 text : "<thinking>private chain of thought</thinking>\nvisible answer" ,
12421242 } ) ;
12431243 await options . onIdle ?.( ) ;
@@ -1298,7 +1298,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
12981298 runtime : createRuntimeLogger ( ) ,
12991299 } ) ;
13001300
1301- result . replyOptions . onPartialReply ?.( { text : "spoken reply" } ) ;
1301+ await result . replyOptions . onPartialReply ?.( { text : "spoken reply" } ) ;
13021302 await options . deliver (
13031303 {
13041304 text : "spoken reply" ,
@@ -1326,7 +1326,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
13261326 runtime : createRuntimeLogger ( ) ,
13271327 } ) ;
13281328
1329- result . replyOptions . onPartialReply ?.( { text : "caption from stream" } ) ;
1329+ await result . replyOptions . onPartialReply ?.( { text : "caption from stream" } ) ;
13301330 await options . deliver (
13311331 {
13321332 mediaUrl : "https://example.com/image.png" ,
@@ -1497,7 +1497,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
14971497 runtime : createRuntimeLogger ( ) ,
14981498 } ) ;
14991499
1500- result . replyOptions . onPartialReply ?.( { text : "Dashboard caption" } ) ;
1500+ await result . replyOptions . onPartialReply ?.( { text : "Dashboard caption" } ) ;
15011501 streamingInstances [ 0 ] . close = vi . fn ( async ( ) => {
15021502 streamingInstances [ 0 ] . active = false ;
15031503 return false ;
@@ -1598,11 +1598,11 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
15981598 } ) ;
15991599
16001600 await options . onReplyStart ?.( ) ;
1601- result . replyOptions . onReasoningStream ?.( { text : "thinking step 1" } ) ;
1602- result . replyOptions . onReasoningStream ?.( {
1601+ await result . replyOptions . onReasoningStream ?.( { text : "thinking step 1" } ) ;
1602+ await result . replyOptions . onReasoningStream ?.( {
16031603 text : "thinking step 1\nstep 2" ,
16041604 } ) ;
1605- result . replyOptions . onPartialReply ?.( { text : "answer part" } ) ;
1605+ await result . replyOptions . onPartialReply ?.( { text : "answer part" } ) ;
16061606 result . replyOptions . onReasoningEnd ?.( ) ;
16071607 await options . deliver ( { text : "answer part final" } , { kind : "final" } ) ;
16081608 await options . onIdle ?.( ) ;
@@ -1676,7 +1676,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
16761676 } ) ;
16771677
16781678 await options . onReplyStart ?.( ) ;
1679- result . replyOptions . onReasoningStream ?.( { text : "deep thought" } ) ;
1679+ await result . replyOptions . onReasoningStream ?.( { text : "deep thought" } ) ;
16801680 result . replyOptions . onReasoningEnd ?.( ) ;
16811681 await options . onIdle ?.( ) ;
16821682
@@ -1696,8 +1696,8 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
16961696 } ) ;
16971697
16981698 await options . onReplyStart ?.( ) ;
1699- result . replyOptions . onReasoningStream ?.( { text : "" } ) ;
1700- result . replyOptions . onPartialReply ?.( { text : "```ts\ncode\n```" } ) ;
1699+ await result . replyOptions . onReasoningStream ?.( { text : "" } ) ;
1700+ await result . replyOptions . onPartialReply ?.( { text : "```ts\ncode\n```" } ) ;
17011701 await options . deliver ( { text : "```ts\ncode\n```" } , { kind : "final" } ) ;
17021702 await options . onIdle ?.( ) ;
17031703
@@ -1714,7 +1714,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
17141714 } ) ;
17151715
17161716 await options . onReplyStart ?.( ) ;
1717- result . replyOptions . onReasoningStream ?.( { text : "thought" } ) ;
1717+ await result . replyOptions . onReasoningStream ?.( { text : "thought" } ) ;
17181718 result . replyOptions . onReasoningEnd ?.( ) ;
17191719 await options . deliver ( { text : "```ts\nfinal answer\n```" } , { kind : "final" } ) ;
17201720 await options . onIdle ?.( ) ;
@@ -1827,7 +1827,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
18271827 } ) ;
18281828 await options . onReplyStart ?.( ) ;
18291829 result . replyOptions . onToolStart ?.( { name : "web_search" } ) ;
1830- result . replyOptions . onPartialReply ?.( { text : "final answer" } ) ;
1830+ await result . replyOptions . onPartialReply ?.( { text : "final answer" } ) ;
18311831 await options . onIdle ?.( ) ;
18321832
18331833 const updateTexts = streamingUpdateTexts ( ) ;
@@ -1858,7 +1858,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
18581858 args : { command : "pnpm test -- --watch=false" } ,
18591859 detailMode : "raw" ,
18601860 } ) ;
1861- result . replyOptions . onPartialReply ?.( { text : "final answer" } ) ;
1861+ await result . replyOptions . onPartialReply ?.( { text : "final answer" } ) ;
18621862 await options . onIdle ?.( ) ;
18631863
18641864 const updateTexts = streamingUpdateTexts ( ) ;
@@ -1882,7 +1882,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
18821882 } ) ;
18831883 await options . onReplyStart ?.( ) ;
18841884 result . replyOptions . onToolStart ?.( { name : "message" } ) ;
1885- result . replyOptions . onPartialReply ?.( { text : "final answer" } ) ;
1885+ await result . replyOptions . onPartialReply ?.( { text : "final answer" } ) ;
18861886 await options . onIdle ?.( ) ;
18871887
18881888 const updateTexts = streamingUpdateTexts ( ) ;
0 commit comments