@@ -471,6 +471,7 @@ describe("active-memory plugin", () => {
471471 } ;
472472 expect ( command . name ) . toBe ( "active-memory" ) ;
473473 expect ( command . acceptsArgs ) . toBe ( true ) ;
474+ expect ( command . exposeSenderIsOwner ) . toBe ( true ) ;
474475
475476 const offResult = await command . handler ( {
476477 channel : "webchat" ,
@@ -568,6 +569,7 @@ describe("active-memory plugin", () => {
568569 const offResult = await command . handler ( {
569570 channel : "webchat" ,
570571 isAuthorizedSender : true ,
572+ senderIsOwner : true ,
571573 args : "off --global" ,
572574 commandBody : "/active-memory off --global" ,
573575 config : { } ,
@@ -617,6 +619,7 @@ describe("active-memory plugin", () => {
617619 const onResult = await command . handler ( {
618620 channel : "webchat" ,
619621 isAuthorizedSender : true ,
622+ senderIsOwner : true ,
620623 args : "on --global" ,
621624 commandBody : "/active-memory on --global" ,
622625 config : { } ,
@@ -650,6 +653,30 @@ describe("active-memory plugin", () => {
650653 expect ( runEmbeddedAgent ) . toHaveBeenCalledTimes ( 1 ) ;
651654 } ) ;
652655
656+ it ( "blocks external non-owner callers from changing global active-memory config" , async ( ) => {
657+ const command = registeredCommands [ "active-memory" ] ;
658+
659+ for ( const args of [ "off --global" , "on --global" ] ) {
660+ const result = await command . handler ( {
661+ channel : "telegram" ,
662+ isAuthorizedSender : true ,
663+ senderIsOwner : false ,
664+ args,
665+ commandBody : `/active-memory ${ args } ` ,
666+ config : { } ,
667+ requestConversationBinding : async ( ) => ( { status : "error" , message : "unsupported" } ) ,
668+ detachConversationBinding : async ( ) => ( { removed : false } ) ,
669+ getCurrentConversationBinding : async ( ) => null ,
670+ } ) ;
671+
672+ expect ( result . text ) . toContain (
673+ "global enable/disable changes require owner or operator.admin" ,
674+ ) ;
675+ }
676+
677+ expect ( api . runtime . config . mutateConfigFile ) . not . toHaveBeenCalled ( ) ;
678+ } ) ;
679+
653680 it ( "blocks gateway callers without admin scope from changing global active-memory config" , async ( ) => {
654681 const command = registeredCommands [ "active-memory" ] ;
655682
@@ -674,7 +701,9 @@ describe("active-memory plugin", () => {
674701 getCurrentConversationBinding : async ( ) => null ,
675702 } ) ;
676703
677- expect ( result . text ) . toContain ( "global enable/disable changes require operator.admin" ) ;
704+ expect ( result . text ) . toContain (
705+ "global enable/disable changes require owner or operator.admin" ,
706+ ) ;
678707 }
679708
680709 expect ( api . runtime . config . mutateConfigFile ) . not . toHaveBeenCalled ( ) ;
0 commit comments