Added mailboxes as local data sources (#1022)
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-10-04 12:26:26 +02:00
1 parent 93be539e50
commit c4400c0ff6
343 files changed
+26051 -3122

No files matched your search

@@ -1,4 +1,5 @@
using AIStudio.Provider;
using AIStudio.Settings.DataModel;
namespace AIStudio.Tools.ToolCallingSystem;
@@ -10,33 +11,10 @@ public static class ToolSelectionRules
public const string READ_WEB_PAGE_TOOL_ID = "read_web_page";
public const string SEARCH_CONFLUENCE_TOOL_ID = "search_confluence";
public const string SEMANTIC_SEARCH_TOOL_ID = "semantic_search";
/// <summary>
/// Turns a set of selected tool IDs into the set which actually runs.
/// </summary>
/// <remarks>
/// Removes duplicates and adds the tools another one depends on: Search Confluence only finds
/// pages, so it brings Read Web Page along to open them. An added tool keeps its own rules.
/// ToolRegistry still drops it when it is switched off or the provider's confidence is too
/// low, and Read Web Page reaches a wiki on a private or VPN address only when its host is
/// allowed there.<br/><br/>
/// It also removes the tools nobody selects. Semantic Search offers itself whenever the data
/// sources of a chat call for it, see ToolActivation.CONTEXT; kept in a selection, it would
/// appear on the security card of a plugin and in its audit without the selection having any
/// say in whether it runs.<br/><br/>
/// Every place which shows or stores a selection normalizes it, the tool selection fields
/// included. That way a chat, a template, a policy, or an assistant plugin shows the tools
/// which will actually run, and the audit of a plugin judges exactly those.
/// </remarks>
public static HashSet<string> NormalizeSelection(IEnumerable<string> selectedToolIds)
{
var normalized = selectedToolIds.ToHashSet(StringComparer.Ordinal);
if (normalized.Contains(SEARCH_CONFLUENCE_TOOL_ID))
normalized.Add(READ_WEB_PAGE_TOOL_ID);
normalized.Remove(SEMANTIC_SEARCH_TOOL_ID);
return normalized;
}
public const string SEARCH_MAILS_TOOL_ID = "search_mails";
public const string READ_MAIL_TOOL_ID = "read_mail";
public const string COUNT_MAILS_TOOL_ID = "count_mails";
public const string MAILBOXES_COLLECTION_ID = "mailboxes";
public static string GetMaxToolCallsFinalResponseInstruction() => $"The maximum of {MAX_TOOL_CALLS} tool calls has been reached. No more tools are available. Provide the best possible final answer to the user based on the tool results already available.";
@@ -75,4 +53,22 @@ public static class ToolSelectionRules
public static bool IsProviderConfidenceAllowed(ConfidenceLevel providerConfidence, ConfidenceLevel minimumToolConfidence) =>
minimumToolConfidence is ConfidenceLevel.NONE || providerConfidence >= minimumToolConfidence;
/// <summary>
/// Whether a tool may run in a chat with this outbound data restriction.
/// </summary>
/// <remarks>
/// Services configured in AI Studio stay allowed on every level. Below UNRESTRICTED, both
/// queries to third parties and addresses the model chooses are kept back, unless the tool
/// keeps to the restriction itself. That is why both stricter levels decide alike here: they
/// differ only in what such a tool lets through. A level this version does not know is treated
/// like a strict one.
/// </remarks>
/// <param name="restriction">Where the chat may still send data.</param>
/// <param name="implementation">The tool.</param>
/// <returns>True when the tool may run.</returns>
public static bool IsOutboundDataAllowed(OutboundDataRestriction restriction, IToolImplementation implementation) =>
restriction is OutboundDataRestriction.UNRESTRICTED ||
implementation.OutboundData is ToolOutboundData.NONE or ToolOutboundData.CONFIGURED_SERVICE ||
implementation.EnforcesOutboundDataRestriction;
}