Assert.That(thread.IsWebAddressGivenToTheModel(newUri("https://EXAMPLE.org/report#summary")),Is.True,"The server gets the same request.");
Assert.That(thread.IsWebAddressGivenToTheModel(newUri("https://example.org/report?budget=2026")),Is.False,"The query would carry something the user never wrote.");
Block(ChatRole.AI,"You can read more at https://example.org/more.",2));
Assert.That(thread.IsWebAddressGivenToTheModel(newUri("https://example.org/more")),Is.False,"The model wrote it, and it could have written a mail into it as well.");
}
[Test]
publicvoidAnAddressAToolReturnedIsGiven()
{
varthread=Thread(Block(ChatRole.USER,"What does the newsletter link to?",1));
Assert.That(thread.IsWebAddressGivenToTheModel(newUri("https://intranet.example.org/travel")),Is.True,"The RAG process found it in a data source, the model did not choose it.");
Assert.That(thread.IsWebAddressGivenToTheModel(newUri("https://example.org/sources/2026")),Is.True,"The document is read only when the message is sent, which is when its addresses are collected.");
// An answer sent here from another chat, which the user then sent as a message of their own:
varthread=Thread(Block(ChatRole.USER,"Make slides of this: the details are on https://example.org/chosen, and our handbook is on https://example.org/handbook.",1));
thread.RequireRestrictions(ChatRestrictions.NONE.WithWebAddressesWrittenByModelIn("The details are on https://example.org/chosen."));
Assert.Multiple(()=>
{
Assert.That(thread.IsWebAddressGivenToTheModel(newUri("https://example.org/chosen")),Is.False,"A model wrote it, so it could carry anything of the chat it came from.");
Assert.That(thread.IsWebAddressGivenToTheModel(newUri("https://example.org/handbook")),Is.True,"Another address in the same message still counts.");
thread.RequireRestrictions(ChatRestrictions.NONE.WithWebAddressesWrittenByModelIn("See https://example.org/chosen and https://example.org/sources/2026."));
Assert.That(thread.IsWebAddressGivenToTheModel(newUri("https://example.org/chosen")),Is.True,"A tool returned it in this chat, so it was not only a model which wrote it.");
Assert.That(thread.IsWebAddressGivenToTheModel(newUri("https://example.org/sources/2026")),Is.True,"A document the user attached holds it.");
Assert.That(loaded.IsWebAddressGivenToTheModel(newUri("https://example.org/chosen")),Is.False,"Forgetting them would let the chat know more addresses after a restart, not fewer.");
Assert.That(thread.IsWebAddressGivenToTheModel(newUri("https://example.org/chosen")),Is.True,"What the copy took over must not reach the chat it was copied from.");