@@ -115,11 +115,8 @@ where
115115 N : SubscribeClient + PublishClient + FlushClient + Clone + ' static ,
116116 A : Agent + ' static ,
117117{
118- // TODO: These two wildcards overlap when session_id == "agent", causing duplicate
119- // dispatch. A single {prefix}.> avoids duplicates but consumes client messages.
120- // Revisit the subject topology to eliminate both problems.
121118 let global_wildcard = acp_nats:: nats:: agent:: wildcards:: all ( prefix) ;
122- let session_wildcard = acp_nats:: nats:: agent :: wildcards:: all_sessions ( prefix) ;
119+ let session_wildcard = acp_nats:: nats:: session :: wildcards:: all_agent ( prefix) ;
123120
124121 info ! (
125122 global = %global_wildcard,
@@ -461,8 +458,8 @@ mod tests {
461458 #[ tokio:: test]
462459 async fn dispatch_cancel_is_notification_no_reply_published ( ) {
463460 let ( nats, agent) = dispatch (
464- "acp.s1.agent.session .cancel" ,
465- & CancelNotification :: new ( "sess-1 " ) ,
461+ "acp.session. s1.agent.cancel" ,
462+ & CancelNotification :: new ( "s1 " ) ,
466463 None ,
467464 )
468465 . await ;
@@ -496,8 +493,8 @@ mod tests {
496493 #[ tokio:: test]
497494 async fn dispatch_prompt_returns_stop_reason ( ) {
498495 let ( nats, _) = dispatch (
499- "acp.s1.agent.session .prompt" ,
500- & PromptRequest :: new ( "sess-1 " , vec ! [ ] ) ,
496+ "acp.session. s1.agent.prompt" ,
497+ & PromptRequest :: new ( "s1 " , vec ! [ ] ) ,
501498 Some ( "_INBOX.3" ) ,
502499 )
503500 . await ;
@@ -599,8 +596,8 @@ mod tests {
599596 #[ tokio:: test]
600597 async fn dispatch_session_load_publishes_response ( ) {
601598 assert_dispatch_publishes (
602- "acp.s1.agent.session .load" ,
603- & LoadSessionRequest :: new ( "sess-1 " , "/tmp" ) ,
599+ "acp.session. s1.agent.load" ,
600+ & LoadSessionRequest :: new ( "s1 " , "/tmp" ) ,
604601 )
605602 . await ;
606603 }
@@ -613,53 +610,53 @@ mod tests {
613610 #[ tokio:: test]
614611 async fn dispatch_set_session_mode_publishes_response ( ) {
615612 assert_dispatch_publishes (
616- "acp.s1.agent.session .set_mode" ,
617- & SetSessionModeRequest :: new ( "sess-1 " , "code" ) ,
613+ "acp.session. s1.agent.set_mode" ,
614+ & SetSessionModeRequest :: new ( "s1 " , "code" ) ,
618615 )
619616 . await ;
620617 }
621618
622619 #[ tokio:: test]
623620 async fn dispatch_set_session_config_option_publishes_response ( ) {
624621 assert_dispatch_publishes (
625- "acp.s1.agent.session .set_config_option" ,
626- & SetSessionConfigOptionRequest :: new ( "sess-1 " , "key" , "val" ) ,
622+ "acp.session. s1.agent.set_config_option" ,
623+ & SetSessionConfigOptionRequest :: new ( "s1 " , "key" , "val" ) ,
627624 )
628625 . await ;
629626 }
630627
631628 #[ tokio:: test]
632629 async fn dispatch_set_session_model_publishes_response ( ) {
633630 assert_dispatch_publishes (
634- "acp.s1.agent.session .set_model" ,
635- & SetSessionModelRequest :: new ( "sess-1 " , "gpt-4" ) ,
631+ "acp.session. s1.agent.set_model" ,
632+ & SetSessionModelRequest :: new ( "s1 " , "gpt-4" ) ,
636633 )
637634 . await ;
638635 }
639636
640637 #[ tokio:: test]
641638 async fn dispatch_fork_session_publishes_response ( ) {
642639 assert_dispatch_publishes (
643- "acp.s1.agent.session .fork" ,
644- & ForkSessionRequest :: new ( "sess-1 " , "/tmp" ) ,
640+ "acp.session. s1.agent.fork" ,
641+ & ForkSessionRequest :: new ( "s1 " , "/tmp" ) ,
645642 )
646643 . await ;
647644 }
648645
649646 #[ tokio:: test]
650647 async fn dispatch_resume_session_publishes_response ( ) {
651648 assert_dispatch_publishes (
652- "acp.s1.agent.session .resume" ,
653- & ResumeSessionRequest :: new ( "sess-1 " , "/tmp" ) ,
649+ "acp.session. s1.agent.resume" ,
650+ & ResumeSessionRequest :: new ( "s1 " , "/tmp" ) ,
654651 )
655652 . await ;
656653 }
657654
658655 #[ tokio:: test]
659656 async fn dispatch_close_session_publishes_response ( ) {
660657 assert_dispatch_publishes (
661- "acp.s1.agent.session .close" ,
662- & CloseSessionRequest :: new ( "sess-1 " ) ,
658+ "acp.session. s1.agent.close" ,
659+ & CloseSessionRequest :: new ( "s1 " ) ,
663660 )
664661 . await ;
665662 }
@@ -832,7 +829,7 @@ mod tests {
832829
833830 let subjects = nats. subscribed_to ( ) ;
834831 assert ! ( subjects. contains( & "myprefix.agent.>" . to_string( ) ) ) ;
835- assert ! ( subjects. contains( & "myprefix.*.agent.>" . to_string( ) ) ) ;
832+ assert ! ( subjects. contains( & "myprefix.session. *.agent.>" . to_string( ) ) ) ;
836833 } )
837834 . await ;
838835 }
0 commit comments