@@ -3,6 +3,7 @@ import { describe, expect, it } from "vitest";
33import {
44 annotateInterSessionPromptText ,
55 isAgentMediatedCompletionSourceTool ,
6+ isAgentToAgentSendInputProvenance ,
67 shouldPreserveUserFacingSessionStateForInputProvenance ,
78 stripInterSessionPromptPrefixForDisplay ,
89} from "./input-provenance.js" ;
@@ -97,6 +98,32 @@ describe("isAgentMediatedCompletionSourceTool", () => {
9798 ) ;
9899} ) ;
99100
101+ describe ( "isAgentToAgentSendInputProvenance" , ( ) => {
102+ it ( "identifies an inter-session sessions_send turn" , ( ) => {
103+ expect (
104+ isAgentToAgentSendInputProvenance ( {
105+ kind : "inter_session" ,
106+ sourceSessionKey : "agent:other:discord:source" ,
107+ sourceTool : "sessions_send" ,
108+ } ) ,
109+ ) . toBe ( true ) ;
110+ } ) ;
111+
112+ it . each ( [ "subagent_announce" , "agent_harness_task" , "image_generate" ] ) (
113+ "does not flag inter-session %s turns" ,
114+ ( sourceTool ) => {
115+ expect ( isAgentToAgentSendInputProvenance ( { kind : "inter_session" , sourceTool } ) ) . toBe ( false ) ;
116+ } ,
117+ ) ;
118+
119+ it ( "does not flag external-user sessions_send provenance or missing provenance" , ( ) => {
120+ expect (
121+ isAgentToAgentSendInputProvenance ( { kind : "external_user" , sourceTool : "sessions_send" } ) ,
122+ ) . toBe ( false ) ;
123+ expect ( isAgentToAgentSendInputProvenance ( undefined ) ) . toBe ( false ) ;
124+ } ) ;
125+ } ) ;
126+
100127describe ( "shouldPreserveUserFacingSessionStateForInputProvenance" , ( ) => {
101128 it . each ( [
102129 "agent_harness_task" ,
0 commit comments