@@ -185,6 +185,7 @@ vi.mock("../../talk/client-voice-session.js", async (importOriginal) => {
185185
186186vi . mock ( "./chat-send-handler.js" , ( ) => ( {
187187 handleChatSend : mocks . chatSend ,
188+ handleChatSendWithRuntimeTools : mocks . chatSend ,
188189} ) ) ;
189190
190191vi . mock ( "../sessions-resolve.js" , ( ) => ( {
@@ -1653,6 +1654,7 @@ describe("talk.session unified handlers", () => {
16531654 language : "de" ,
16541655 } ,
16551656 respond : createRespond ,
1657+ client : { connId : "conn-1" , connect : { scopes : [ "operator.talk" ] } } ,
16561658 context : {
16571659 getRuntimeConfig : ( ) =>
16581660 ( {
@@ -1687,7 +1689,15 @@ describe("talk.session unified handlers", () => {
16871689 string ,
16881690 unknown
16891691 > ;
1690- expectRecordFields ( relayCreateInput , { connId : "conn-1" , provider, language : "de" } ) ;
1692+ expectRecordFields ( relayCreateInput , {
1693+ connId : "conn-1" ,
1694+ provider,
1695+ language : "de" ,
1696+ consultAuthority : {
1697+ senderIsOwner : false ,
1698+ toolsAllow : [ "read" , "web_search" , "web_fetch" , "x_search" , "memory_search" , "memory_get" ] ,
1699+ } ,
1700+ } ) ;
16911701 expectRecordFields ( relayCreateInput . providerConfig , {
16921702 apiKey : "openai-key" ,
16931703 model : "gpt-realtime" ,
@@ -2495,6 +2505,7 @@ describe("talk.client.toolCall handler", () => {
24952505 args : { question : "What is in this repo?" , responseStyle : "one sentence" } ,
24962506 } ,
24972507 respond,
2508+ client : { connId : "conn-1" , connect : { scopes : [ "operator.talk" ] } } ,
24982509 context : {
24992510 getRuntimeConfig : ( ) => ( { } ) as OpenClawConfig ,
25002511 } ,
@@ -2508,6 +2519,14 @@ describe("talk.client.toolCall handler", () => {
25082519 expectRecordFields ( chatInput . params , { sessionKey : "main" } ) ;
25092520 expect ( chatInput . params ?. message ) . toContain ( "What is in this repo?" ) ;
25102521 expect ( chatInput . params ?. idempotencyKey ) . toMatch ( / ^ t a l k - c a l l - 1 - / ) ;
2522+ expect ( mockCallArg ( mocks . chatSend , 0 , 1 ) ) . toEqual ( [
2523+ "read" ,
2524+ "web_search" ,
2525+ "web_fetch" ,
2526+ "x_search" ,
2527+ "memory_search" ,
2528+ "memory_get" ,
2529+ ] ) ;
25112530 const response = expectRespondOk ( respond , { runId : "run-voice-1" } ) as Record < string , unknown > ;
25122531 expect ( response . idempotencyKey ) . toMatch ( / ^ t a l k - c a l l - 1 - / ) ;
25132532 } ) ;
@@ -2554,6 +2573,7 @@ describe("talk.client.toolCall handler", () => {
25542573 args : { question : "Are the basement lights off?" } ,
25552574 } ,
25562575 respond,
2576+ client : { connId : "conn-1" , connect : { scopes : [ "operator.write" ] } } ,
25572577 context : {
25582578 getRuntimeConfig : ( ) =>
25592579 ( {
@@ -2570,6 +2590,7 @@ describe("talk.client.toolCall handler", () => {
25702590 thinking : "low" ,
25712591 fastMode : true ,
25722592 } ) ;
2593+ expect ( mockCallArg ( mocks . chatSend , 0 , 1 ) ) . toBeUndefined ( ) ;
25732594 expectRespondOk ( respond , { runId : "run-voice-1" } ) ;
25742595 } ) ;
25752596
@@ -2835,6 +2856,7 @@ describe("talk.client.create handler", () => {
28352856 reasoningEffort : "low" ,
28362857 } ,
28372858 respond,
2859+ client : { connId : "conn-1" , connect : { scopes : [ "operator.talk" ] } } ,
28382860 context : {
28392861 getRuntimeConfig : ( ) =>
28402862 ( {
@@ -2903,6 +2925,8 @@ describe("talk.client.create handler", () => {
29032925 ] ,
29042926 surface : "a browser Talk session" ,
29052927 abortSignal : consultSignal ,
2928+ senderIsOwner : false ,
2929+ toolsAllow : [ "read" , "web_search" , "web_fetch" , "x_search" , "memory_search" , "memory_get" ] ,
29062930 } ) ,
29072931 ) ;
29082932 expect ( createInput ) . not . toHaveProperty ( "provider" ) ;
@@ -2959,6 +2983,7 @@ describe("talk.client.create handler", () => {
29592983 await callTalkHandler ( "talk.client.create" , {
29602984 params : { sessionKey : "main" , model : "gpt-live-1" } ,
29612985 respond,
2986+ client : { connId : "conn-1" , connect : { scopes : [ "operator.write" ] } } ,
29622987 context : {
29632988 getRuntimeConfig : ( ) =>
29642989 ( {
@@ -2983,6 +3008,12 @@ describe("talk.client.create handler", () => {
29833008 model : "gpt-live-1" ,
29843009 runAgentConsult : expect . any ( Function ) ,
29853010 } ) ;
3011+ await (
3012+ createInput . runAgentConsult as ( params : { prompt : string } ) => Promise < { text : string } >
3013+ ) ( { prompt : "Check the repository" } ) ;
3014+ const consultInput = mockCallArg ( mocks . consultRealtimeVoiceAgent ) as Record < string , unknown > ;
3015+ expect ( consultInput . senderIsOwner ) . toBe ( false ) ;
3016+ expect ( consultInput ) . not . toHaveProperty ( "toolsAllow" ) ;
29863017 expect ( createInput ) . not . toHaveProperty ( "tools" ) ;
29873018 expectRespondOk ( respond , { provider : "openai" , transport : "webrtc" } ) ;
29883019 } ) ;
0 commit comments