diff --git a/dotnet/Directory.Packages.props b/dotnet/Directory.Packages.props index ef1eb280f0..bc0b0dd0db 100644 --- a/dotnet/Directory.Packages.props +++ b/dotnet/Directory.Packages.props @@ -107,7 +107,8 @@ - + + all diff --git a/dotnet/agent-framework-dotnet.slnx b/dotnet/agent-framework-dotnet.slnx index db6552a9c8..246768b367 100644 --- a/dotnet/agent-framework-dotnet.slnx +++ b/dotnet/agent-framework-dotnet.slnx @@ -77,6 +77,8 @@ + + @@ -271,7 +273,6 @@ - diff --git a/dotnet/eng/MSBuild/Shared.props b/dotnet/eng/MSBuild/Shared.props index ffb4fc7269..54f93699ad 100644 --- a/dotnet/eng/MSBuild/Shared.props +++ b/dotnet/eng/MSBuild/Shared.props @@ -8,4 +8,7 @@ + + + diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/DeclarativeWorkflow.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/DeclarativeWorkflow.csproj index 52bc3c4328..37ba5f0f5b 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/DeclarativeWorkflow.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/DeclarativeWorkflow.csproj @@ -25,7 +25,6 @@ - diff --git a/dotnet/samples/GettingStarted/Workflows/DeclarativeCode/DeclarativeCode.csproj b/dotnet/samples/GettingStarted/Workflows/DeclarativeCode/DeclarativeCode.csproj new file mode 100644 index 0000000000..c8321d553d --- /dev/null +++ b/dotnet/samples/GettingStarted/Workflows/DeclarativeCode/DeclarativeCode.csproj @@ -0,0 +1,32 @@ + + + + Exe + net9.0 + net9.0 + $(ProjectsDebugTargetFrameworks) + enable + disable + 5ee045b0-aea3-4f08-8d31-32d1a6f8fed0 + $(NoWarn);CA1812 + + + + true + + + + + + + + + + + + + + + + + diff --git a/dotnet/samples/GettingStarted/Workflows/DeclarativeCode/Generated.cs b/dotnet/samples/GettingStarted/Workflows/DeclarativeCode/Generated.cs new file mode 100644 index 0000000000..32ba92bb66 --- /dev/null +++ b/dotnet/samples/GettingStarted/Workflows/DeclarativeCode/Generated.cs @@ -0,0 +1,1351 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; + +namespace Test.WorkflowProviders; + +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class TestWorkflowProvider +{ + /// + /// The root executor for a declarative workflow. + /// + internal sealed class WorkflowDemoRootExecutor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("workflow_demo_Root", options, inputTransform) + where TInput : notnull + { + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + { + // Set environment variables + await this.InitializeEnvironmentAsync( + context, + "FOUNDRY_AGENT_RESEARCHWEB", + "FOUNDRY_AGENT_RESEARCHANALYST", + "FOUNDRY_AGENT_RESEARCHMANAGER", + "FOUNDRY_AGENT_RESEARCHWEATHER", + "FOUNDRY_AGENT_RESEARCHCODER").ConfigureAwait(false); + + // Initialize variables + await context.QueueStateUpdateAsync("AgentResponse", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("AgentResponseText", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("AvailableAgents", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("FinalResponse", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("InputTask", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("InternalConversationId", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("NextSpeaker", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("Plan", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("ProgressLedgerUpdate", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("RestartCount", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("SeedTask", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("StallCount", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("TaskFacts", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("TaskInstructions", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("TeamDescription", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("TypedProgressLedger", UnassignedValue.Instance, "Local").ConfigureAwait(false); + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.AvailableAgents" variable. + /// + internal sealed class SetvariableAaslmfExecutor(FormulaSession session) : ActionExecutor(id: "setVariable_aASlmF", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync(""" + [ + { + name: "WeatherAgent", + description: "Able to retrieve weather information", + agentid: Env.FOUNDRY_AGENT_RESEARCHWEATHER + }, + { + name: "CoderAgent", + description: "Able to write and execute Python code", + agentid: Env.FOUNDRY_AGENT_RESEARCHCODER + }, + { + name: "WebAgent", + description: "Able to perform generic websearches", + agentid: Env.FOUNDRY_AGENT_RESEARCHWEB + } + ] + """).ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "AvailableAgents", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.TeamDescription" variable. + /// + internal sealed class SetvariableV6yeboExecutor(FormulaSession session) : ActionExecutor(id: "setVariable_V6yEbo", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync(""" + Concat(ForAll(Local.AvailableAgents, $"- " & name & $": " & description), Value, " + ") + """).ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "TeamDescription", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.InputTask" variable. + /// + internal sealed class SetvariableNz2u0lExecutor(FormulaSession session) : ActionExecutor(id: "setVariable_NZ2u0l", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync("System.LastMessage.Text").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "InputTask", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.SeedTask" variable. + /// + internal sealed class Setvariable10U2znExecutor(FormulaSession session) : ActionExecutor(id: "setVariable_10u2ZN", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync("UserMessage(Local.InputTask)").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "SeedTask", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendactivityYfsbryExecutor(FormulaSession session) : ActionExecutor(id: "sendActivity_yFsbRy", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + Analyzing facts... + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + /// + /// Creates a new conversation and stores the identifier value to the "Local.InternalConversationId" variable. + /// + internal sealed class Conversation1A2b3cExecutor(FormulaSession session, WorkflowAgentProvider agentProvider) : ActionExecutor(id: "conversation_1a2b3c", session) + { + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string conversationId = await agentProvider.CreateConversationAsync(cancellationToken).ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "InternalConversationId", value: conversationId, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Invokes an agent to process messages and return a response within a conversation context. + /// + internal sealed class QuestionUdomuwExecutor(FormulaSession session, WorkflowAgentProvider agentProvider) : AgentExecutor(id: "question_UDoMUw", session, agentProvider) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string? agentName = await context.ReadStateAsync(key: "FOUNDRY_AGENT_RESEARCHANALYST", scopeName: "Env").ConfigureAwait(false); + + if (string.IsNullOrWhiteSpace(agentName)) + { + throw new InvalidOperationException($"Agent name must be defined: {this.Id}"); + } + + string? conversationId = await context.ReadStateAsync(key: "InternalConversationId", scopeName: "Local").ConfigureAwait(false); + bool autoSend = true; + string additionalInstructions = + await context.FormatTemplateAsync( + """ + In order to help begin addressing the user request, please answer the following pre-survey to the best of your ability. + Keep in mind that you are Ken Jennings-level with trivia, and Mensa-level with puzzles, so there should be a deep well to draw from. + + Here is the pre-survey: + + 1. Please list any specific facts or figures that are GIVEN in the request itself. It is possible that there are none. + 2. Please list any facts that may need to be looked up, and WHERE SPECIFICALLY they might be found. In some cases, authoritative sources are mentioned in the request itself. + 3. Please list any facts that may need to be derived (e.g., via logical deduction, simulation, or computation) + 4. Please list any facts that are recalled from memory, hunches, well-reasoned guesses, etc. + + When answering this survey, keep in mind that 'facts' will typically be specific names, dates, statistics, etc. Your answer must only use the headings: + + 1. GIVEN OR VERIFIED FACTS + 2. FACTS TO LOOK UP + 3. FACTS TO DERIVE + 4. EDUCATED GUESSES + + DO NOT include any other headings or sections in your response. DO NOT list next steps or plans until asked to do so. + """); + IList? inputMessages = await context.EvaluateListAsync("UserMessage(Local.InputTask)").ConfigureAwait(false); + + AgentRunResponse agentResponse = + await InvokeAgentAsync( + context, + agentName, + conversationId, + autoSend, + additionalInstructions, + inputMessages, + cancellationToken).ConfigureAwait(false); + + if (autoSend) + { + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, agentResponse)).ConfigureAwait(false); + } + + await context.QueueStateUpdateAsync(key: "TaskFacts", value: agentResponse.Messages, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendactivityYfsbrzExecutor(FormulaSession session) : ActionExecutor(id: "sendActivity_yFsbRz", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + Creating a plan... + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + /// + /// Invokes an agent to process messages and return a response within a conversation context. + /// + internal sealed class QuestionDsbajuExecutor(FormulaSession session, WorkflowAgentProvider agentProvider) : AgentExecutor(id: "question_DsBaJU", session, agentProvider) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string? agentName = await context.ReadStateAsync(key: "FOUNDRY_AGENT_RESEARCHMANAGER", scopeName: "Env").ConfigureAwait(false); + + if (string.IsNullOrWhiteSpace(agentName)) + { + throw new InvalidOperationException($"Agent name must be defined: {this.Id}"); + } + + string? conversationId = await context.ReadStateAsync(key: "InternalConversationId", scopeName: "Local").ConfigureAwait(false); + bool autoSend = true; + string additionalInstructions = + await context.FormatTemplateAsync( + """ + Your only job is to devise an efficient plan that identifies (by name) how a team member may contribute to addressing the user request. + + Only select the following team which is listed as "- [Name]: [Description]" + + {Local.TeamDescription} + + The plan must be a bullet point list must be in the form "- [AgentName]: [Specific action or task for that agent to perform]" + + Remember, there is no requirement to involve the entire team -- only select team member's whose particular expertise is required for this task. + """); + IList? inputMessages = await context.EvaluateListAsync("UserMessage(Local.InputTask)").ConfigureAwait(false); + + AgentRunResponse agentResponse = + await InvokeAgentAsync( + context, + agentName, + conversationId, + autoSend, + additionalInstructions, + inputMessages, + cancellationToken).ConfigureAwait(false); + + if (autoSend) + { + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, agentResponse)).ConfigureAwait(false); + } + + await context.QueueStateUpdateAsync(key: "Plan", value: agentResponse.Messages, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.TaskInstructions" variable. + /// + internal sealed class SetvariableKk2ldlExecutor(FormulaSession session) : ActionExecutor(id: "setVariable_Kk2LDL", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync(""" + "# TASK + Address the following user request: + + " & Local.InputTask & " + + + # TEAM + Use the following team to answer this request: + + " & Local.TeamDescription & " + + + # FACTS + Consider this initial fact sheet: + + " & Trim(Last(Local.TaskFacts).Text) & " + + + # PLAN + Here is the plan to follow as best as possible: + + " & Last(Local.Plan).Text + """).ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "TaskInstructions", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendactivityBwnzimExecutor(FormulaSession session) : ActionExecutor(id: "sendActivity_bwNZiM", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + {Local.TaskInstructions} + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + /// + /// Invokes an agent to process messages and return a response within a conversation context. + /// + internal sealed class QuestionO3bqkfExecutor(FormulaSession session, WorkflowAgentProvider agentProvider) : AgentExecutor(id: "question_o3BQkf", session, agentProvider) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string? agentName = await context.ReadStateAsync(key: "FOUNDRY_AGENT_RESEARCHMANAGER", scopeName: "Env").ConfigureAwait(false); + + if (string.IsNullOrWhiteSpace(agentName)) + { + throw new InvalidOperationException($"Agent name must be defined: {this.Id}"); + } + + string? conversationId = await context.ReadStateAsync(key: "InternalConversationId", scopeName: "Local").ConfigureAwait(false); + bool autoSend = true; + string additionalInstructions = + await context.FormatTemplateAsync( + """ + Recall we are working on the following request: + + {Local.InputTask} + + And we have assembled the following team: + + {Local.TeamDescription} + + To make progress on the request, please answer the following questions, including necessary reasoning: + + - Is the request fully satisfied? (True if complete, or False if the original request has yet to be SUCCESSFULLY and FULLY addressed) + - Are we in a loop where we are repeating the same requests and / or getting the same responses from an agent multiple times? Loops can span multiple turns, and can include repeated actions like scrolling up or down more than a handful of times. + - Are we making forward progress? (True if just starting, or recent messages are adding value. False if recent messages show evidence of being stuck in a loop or if there is evidence of significant barriers to success such as the inability to read from a required file) + - Who should speak next? (select from: {Concat(Local.AvailableAgents, name, ",")}) + - What instruction or question would you give this team member? (Phrase as if speaking directly to them, and include any specific information they may need) + + Please output an answer in pure JSON format according to the following schema. The JSON object must be parsable as-is. DO NOT OUTPUT ANYTHING OTHER THAN JSON, AND DO NOT DEVIATE FROM THIS SCHEMA: + + {{ + "is_request_satisfied": {{ + "reason": string, + "answer": boolean + }}, + "is_in_loop": {{ + "reason": string, + "answer": boolean + }}, + "is_progress_being_made": {{ + "reason": string, + "answer": boolean + }}, + "next_speaker": {{ + "reason": string, + "answer": string (select from: {Concat(Local.AvailableAgents, name, ",")}) + }}, + "instruction_or_question": {{ + "reason": string, + "answer": string + }} + }} + """); + IList? inputMessages = await context.EvaluateListAsync("UserMessage(Local.AgentResponseText)").ConfigureAwait(false); + + AgentRunResponse agentResponse = + await InvokeAgentAsync( + context, + agentName, + conversationId, + autoSend, + additionalInstructions, + inputMessages, + cancellationToken).ConfigureAwait(false); + + if (autoSend) + { + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, agentResponse)).ConfigureAwait(false); + } + + await context.QueueStateUpdateAsync(key: "ProgressLedgerUpdate", value: agentResponse.Messages, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Parses a string or untyped value to the provided data type. When the input is a string, it will be treated as JSON. + /// + internal sealed class ParseRnztlvExecutor(FormulaSession session) : ActionExecutor(id: "parse_rNZtlV", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + VariableType targetType = + VariableType.Record( + ("instruction_or_question", + VariableType.Record( + ("reason", typeof(string)), + ("answer", typeof(string)))), + ("next_speaker", + VariableType.Record( + ("reason", typeof(string)), + ("answer", typeof(string)))), + ("is_request_satisfied", + VariableType.Record( + ("reason", typeof(string)), + ("answer", typeof(bool)))), + ("is_progress_being_made", + VariableType.Record( + ("reason", typeof(string)), + ("answer", typeof(bool)))), + ("is_in_loop", + VariableType.Record( + ("reason", typeof(string)), + ("answer", typeof(bool))))); + object? parsedValue = await context.ConvertValueAsync(targetType, "Last(Local.ProgressLedgerUpdate).Text", cancellationToken).ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "TypedProgressLedger", value: parsedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Conditional branching similar to an if / elseif / elseif / else chain. + /// + internal sealed class ConditiongroupMvieccExecutor(FormulaSession session) : ActionExecutor(id: "conditionGroup_mVIecC", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + bool condition0 = await context.EvaluateValueAsync("Local.TypedProgressLedger.is_request_satisfied.answer").ConfigureAwait(false); + if (condition0) + { + return "conditionItem_fj432c"; + } + + bool condition1 = await context.EvaluateValueAsync("Local.TypedProgressLedger.is_in_loop.answer || Not(Local.TypedProgressLedger.is_progress_being_made.answer)").ConfigureAwait(false); + if (condition1) + { + return "conditionItem_yiqund"; + } + + return "conditionGroup_mVIecCElseActions"; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendactivityKdl3mcExecutor(FormulaSession session) : ActionExecutor(id: "sendActivity_kdl3mC", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + Completed! {Local.TypedProgressLedger.is_request_satisfied.reason} + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + /// + /// Invokes an agent to process messages and return a response within a conversation context. + /// + internal sealed class QuestionKe3l1dExecutor(FormulaSession session, WorkflowAgentProvider agentProvider) : AgentExecutor(id: "question_Ke3l1d", session, agentProvider) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string? agentName = await context.ReadStateAsync(key: "FOUNDRY_AGENT_RESEARCHMANAGER", scopeName: "Env").ConfigureAwait(false); + + if (string.IsNullOrWhiteSpace(agentName)) + { + throw new InvalidOperationException($"Agent name must be defined: {this.Id}"); + } + + string? conversationId = await context.ReadStateAsync(key: "ConversationId", scopeName: "System").ConfigureAwait(false); + bool autoSend = true; + string additionalInstructions = + await context.FormatTemplateAsync( + """ + We have completed the task. + Based only on the conversation and without adding any new information, synthesize the result of the conversation as a complete response to the user task. + The user will only every see this last response and not the entire conversation, so please ensure it is complete and self-contained. + """); + IList? inputMessages = await context.ReadListAsync(key: "SeedTask", scopeName: "Local").ConfigureAwait(false); + + AgentRunResponse agentResponse = + await InvokeAgentAsync( + context, + agentName, + conversationId, + autoSend, + additionalInstructions, + inputMessages, + cancellationToken).ConfigureAwait(false); + + if (autoSend) + { + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, agentResponse)).ConfigureAwait(false); + } + + await context.QueueStateUpdateAsync(key: "FinalResponse", value: agentResponse.Messages, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.StallCount" variable. + /// + internal sealed class SetvariableH5lxddExecutor(FormulaSession session) : ActionExecutor(id: "setVariable_H5lXdD", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync("Local.StallCount + 1").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "StallCount", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Conditional branching similar to an if / elseif / elseif / else chain. + /// + internal sealed class ConditiongroupVbtqd3Executor(FormulaSession session) : ActionExecutor(id: "conditionGroup_vBTQd3", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + bool condition0 = await context.EvaluateValueAsync(".TypedProgressLedger.is_in_loop.answer").ConfigureAwait(false); + if (condition0) + { + return "conditionItem_fpaNL9"; + } + + bool condition1 = await context.EvaluateValueAsync("Not(Local.TypedProgressLedger.is_progress_being_made.answer)").ConfigureAwait(false); + if (condition1) + { + return "conditionItem_NnqvXh"; + } + + return "conditionGroup_vBTQd3ElseActions"; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendactivityFpanl9Executor(FormulaSession session) : ActionExecutor(id: "sendActivity_fpaNL9", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + {Local.TypedProgressLedger.is_in_loop.reason} + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendactivityNnqvxhExecutor(FormulaSession session) : ActionExecutor(id: "sendActivity_NnqvXh", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + {Local.TypedProgressLedger.is_progress_being_made.reason} + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + /// + /// Conditional branching similar to an if / elseif / elseif / else chain. + /// + internal sealed class ConditiongroupXznrdmExecutor(FormulaSession session) : ActionExecutor(id: "conditionGroup_xzNrdM", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + bool condition0 = await context.EvaluateValueAsync("Local.StallCount > 2").ConfigureAwait(false); + if (condition0) + { + return "conditionItem_NlQTBv"; + } + + return "conditionGroup_xzNrdMElseActions"; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendactivityH5lxddExecutor(FormulaSession session) : ActionExecutor(id: "sendActivity_H5lXdD", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + Unable to make sufficient progress... + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + /// + /// Conditional branching similar to an if / elseif / elseif / else chain. + /// + internal sealed class Conditiongroup4S1z27Executor(FormulaSession session) : ActionExecutor(id: "conditionGroup_4s1Z27", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + bool condition0 = await context.EvaluateValueAsync("Local.RestartCount > 2").ConfigureAwait(false); + if (condition0) + { + return "conditionItem_EXAlhZ"; + } + + return "conditionGroup_4s1Z27ElseActions"; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendactivityXkxfuuExecutor(FormulaSession session) : ActionExecutor(id: "sendActivity_xKxFUU", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + Stopping after attempting {Local.RestartCount} restarts... + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendactivityCwnzimExecutor(FormulaSession session) : ActionExecutor(id: "sendActivity_cwNZiM", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + Re-analyzing facts... + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + /// + /// Invokes an agent to process messages and return a response within a conversation context. + /// + internal sealed class QuestionWfj123Executor(FormulaSession session, WorkflowAgentProvider agentProvider) : AgentExecutor(id: "question_wFJ123", session, agentProvider) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string? agentName = await context.ReadStateAsync(key: "FOUNDRY_AGENT_RESEARCHANALYST", scopeName: "Env").ConfigureAwait(false); + + if (string.IsNullOrWhiteSpace(agentName)) + { + throw new InvalidOperationException($"Agent name must be defined: {this.Id}"); + } + + string? conversationId = await context.ReadStateAsync(key: "InternalConversationId", scopeName: "Local").ConfigureAwait(false); + bool autoSend = true; + string additionalInstructions = + await context.FormatTemplateAsync( + """ + It's clear we aren't making as much progress as we would like, but we may have learned something new. + Please rewrite the following fact sheet, updating it to include anything new we have learned that may be helpful. + Example edits can include (but are not limited to) adding new guesses, moving educated guesses to verified facts if appropriate, etc. + Updates may be made to any section of the fact sheet, and more than one section of the fact sheet can be edited. + This is an especially good time to update educated guesses, so please at least add or update one educated guess or hunch, and explain your reasoning. + + Here is the old fact sheet: + + {Local.TaskFacts} + """); + IList? inputMessages = await context.EvaluateListAsync(""" + UserMessage( + "As a reminder, we are working to solve the following task: + + " & Local.InputTask) + """).ConfigureAwait(false); + + AgentRunResponse agentResponse = + await InvokeAgentAsync( + context, + agentName, + conversationId, + autoSend, + additionalInstructions, + inputMessages, + cancellationToken).ConfigureAwait(false); + + if (autoSend) + { + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, agentResponse)).ConfigureAwait(false); + } + + await context.QueueStateUpdateAsync(key: "TaskFacts", value: agentResponse.Messages, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendactivityDsbajuExecutor(FormulaSession session) : ActionExecutor(id: "sendActivity_dsBaJU", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + Re-analyzing plan... + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + /// + /// Invokes an agent to process messages and return a response within a conversation context. + /// + internal sealed class QuestionUej456Executor(FormulaSession session, WorkflowAgentProvider agentProvider) : AgentExecutor(id: "question_uEJ456", session, agentProvider) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string? agentName = await context.ReadStateAsync(key: "FOUNDRY_AGENT_RESEARCHMANAGER", scopeName: "Env").ConfigureAwait(false); + + if (string.IsNullOrWhiteSpace(agentName)) + { + throw new InvalidOperationException($"Agent name must be defined: {this.Id}"); + } + + string? conversationId = await context.ReadStateAsync(key: "InternalConversationId", scopeName: "Local").ConfigureAwait(false); + bool autoSend = true; + string additionalInstructions = + await context.FormatTemplateAsync( + """ + Please briefly explain what went wrong on this last run (the root cause of the failure), + and then come up with a new plan that takes steps and/or includes hints to overcome prior challenges and especially avoids repeating the same mistakes. + As before, the new plan should be concise, be expressed in bullet-point form, and consider the following team composition + (do not involve any other outside people since we cannot contact anyone else): + + {Local.TeamDescription} + """); + IList? inputMessages = null; + + AgentRunResponse agentResponse = + await InvokeAgentAsync( + context, + agentName, + conversationId, + autoSend, + additionalInstructions, + inputMessages, + cancellationToken).ConfigureAwait(false); + + if (autoSend) + { + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, agentResponse)).ConfigureAwait(false); + } + + await context.QueueStateUpdateAsync(key: "Plan", value: agentResponse.Messages, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.TaskInstructions" variable. + /// + internal sealed class SetvariableJw7tmmExecutor(FormulaSession session) : ActionExecutor(id: "setVariable_jW7tmM", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync(""" + "# TASK + Address the following user request: + + " & Local.InputTask & " + + + # TEAM + Use the following team to answer this request: + + " & Local.TeamDescription & " + + + # FACTS + Consider this initial fact sheet: + + " & Local.TaskFacts.Text & " + + + # PLAN + Here is the plan to follow as best as possible: + + " & Local.Plan.Text + """).ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "TaskInstructions", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.StallCount" variable. + /// + internal sealed class Setvariable6J2snpExecutor(FormulaSession session) : ActionExecutor(id: "setVariable_6J2snP", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = 0; + await context.QueueStateUpdateAsync(key: "StallCount", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.RestartCount" variable. + /// + internal sealed class SetvariableS6hcghExecutor(FormulaSession session) : ActionExecutor(id: "setVariable_S6HCgh", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync("Local.RestartCount + 1").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "RestartCount", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendactivityL7ooqoExecutor(FormulaSession session) : ActionExecutor(id: "sendActivity_L7ooQO", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + ({Local.TypedProgressLedger.next_speaker.reason}) + + {Local.TypedProgressLedger.next_speaker.answer} - {Local.TypedProgressLedger.instruction_or_question.answer} + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.StallCount" variable. + /// + internal sealed class SetvariableL7ooqoExecutor(FormulaSession session) : ActionExecutor(id: "setVariable_L7ooQO", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = 0; + await context.QueueStateUpdateAsync(key: "StallCount", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.NextSpeaker" variable. + /// + internal sealed class SetvariableNxn1meExecutor(FormulaSession session) : ActionExecutor(id: "setVariable_nxN1mE", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync("Search(Local.AvailableAgents, Local.TypedProgressLedger.next_speaker.answer, name)").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "NextSpeaker", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Conditional branching similar to an if / elseif / elseif / else chain. + /// + internal sealed class ConditiongroupQfpif5Executor(FormulaSession session) : ActionExecutor(id: "conditionGroup_QFPiF5", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + bool condition0 = await context.EvaluateValueAsync("CountRows(Local.NextSpeaker) = 1").ConfigureAwait(false); + if (condition0) + { + return "conditionItem_GmigcU"; + } + + return "conditionGroup_QFPiF5ElseActions"; + } + } + + /// + /// Invokes an agent to process messages and return a response within a conversation context. + /// + internal sealed class QuestionOrsbf06Executor(FormulaSession session, WorkflowAgentProvider agentProvider) : AgentExecutor(id: "question_orsBf06", session, agentProvider) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string? agentName = await context.EvaluateValueAsync("First(Local.NextSpeaker).agentid").ConfigureAwait(false); + + if (string.IsNullOrWhiteSpace(agentName)) + { + throw new InvalidOperationException($"Agent name must be defined: {this.Id}"); + } + + string? conversationId = await context.ReadStateAsync(key: "ConversationId", scopeName: "System").ConfigureAwait(false); + bool autoSend = true; + string additionalInstructions = + await context.FormatTemplateAsync( + """ + {Local.TypedProgressLedger.instruction_or_question.answer} + """); + IList? inputMessages = await context.ReadListAsync(key: "SeedTask", scopeName: "Local").ConfigureAwait(false); + + AgentRunResponse agentResponse = + await InvokeAgentAsync( + context, + agentName, + conversationId, + autoSend, + additionalInstructions, + inputMessages, + cancellationToken).ConfigureAwait(false); + + if (autoSend) + { + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, agentResponse)).ConfigureAwait(false); + } + + await context.QueueStateUpdateAsync(key: "AgentResponse", value: agentResponse.Messages, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.AgentResponseText" variable. + /// + internal sealed class SetvariableXznrdmExecutor(FormulaSession session) : ActionExecutor(id: "setVariable_XzNrdM", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync("Last(Local.AgentResponse).Text").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "AgentResponseText", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Resets the value of the "Local.SeedTask" variable, potentially causing re-evaluation + /// of the default value, question or action that provides the value to this variable. + /// + internal sealed class Setvariable8Eix2aExecutor(FormulaSession session) : ActionExecutor(id: "setVariable_8eIx2A", session) + { + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + await context.QueueStateUpdateAsync(key: "SeedTask", value: UnassignedValue.Instance, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendactivityBhcsi7Executor(FormulaSession session) : ActionExecutor(id: "sendActivity_BhcsI7", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + Unable to choose next agent... + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.StallCount" variable. + /// + internal sealed class SetvariableBhcsi7Executor(FormulaSession session) : ActionExecutor(id: "setVariable_BhcsI7", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync("Local.StallCount + 1").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "StallCount", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + WorkflowDemoRootExecutor workflowDemoRoot = new(options, inputTransform); + DelegateExecutor workflowDemo = new(id: "workflow_demo", workflowDemoRoot.Session); + SetvariableAaslmfExecutor setVariableAaslmf = new(workflowDemoRoot.Session); + SetvariableV6yeboExecutor setVariableV6yebo = new(workflowDemoRoot.Session); + SetvariableNz2u0lExecutor setVariableNz2u0l = new(workflowDemoRoot.Session); + Setvariable10U2znExecutor setVariable10U2zn = new(workflowDemoRoot.Session); + SendactivityYfsbryExecutor sendActivityYfsbry = new(workflowDemoRoot.Session); + Conversation1A2b3cExecutor conversation1A2b3c = new(workflowDemoRoot.Session, options.AgentProvider); + QuestionUdomuwExecutor questionUdomuw = new(workflowDemoRoot.Session, options.AgentProvider); + SendactivityYfsbrzExecutor sendActivityYfsbrz = new(workflowDemoRoot.Session); + QuestionDsbajuExecutor questionDsbaju = new(workflowDemoRoot.Session, options.AgentProvider); + SetvariableKk2ldlExecutor setVariableKk2ldl = new(workflowDemoRoot.Session); + SendactivityBwnzimExecutor sendActivityBwnzim = new(workflowDemoRoot.Session); + QuestionO3bqkfExecutor questionO3bqkf = new(workflowDemoRoot.Session, options.AgentProvider); + ParseRnztlvExecutor parseRnztlv = new(workflowDemoRoot.Session); + ConditiongroupMvieccExecutor conditionGroupMviecc = new(workflowDemoRoot.Session); + DelegateExecutor conditionItemFj432c = new(id: "conditionItem_fj432c", workflowDemoRoot.Session); + DelegateExecutor conditionItemYiqund = new(id: "conditionItem_yiqund", workflowDemoRoot.Session); + DelegateExecutor conditionGroupMvieccelseactions = new(id: "conditionGroup_mVIecCElseActions", workflowDemoRoot.Session); + DelegateExecutor conditionItemFj432cactions = new(id: "conditionItem_fj432cActions", workflowDemoRoot.Session); + SendactivityKdl3mcExecutor sendActivityKdl3mc = new(workflowDemoRoot.Session); + QuestionKe3l1dExecutor questionKe3l1d = new(workflowDemoRoot.Session, options.AgentProvider); + DelegateExecutor endSvonsv = new(id: "end_SVoNSV", workflowDemoRoot.Session); + DelegateExecutor conditionItemYiqundactions = new(id: "conditionItem_yiqundActions", workflowDemoRoot.Session); + SetvariableH5lxddExecutor setVariableH5lxdd = new(workflowDemoRoot.Session); + ConditiongroupVbtqd3Executor conditionGroupVbtqd3 = new(workflowDemoRoot.Session); + DelegateExecutor conditionItemFpanl9 = new(id: "conditionItem_fpaNL9", workflowDemoRoot.Session); + DelegateExecutor conditionItemNnqvxh = new(id: "conditionItem_NnqvXh", workflowDemoRoot.Session); + DelegateExecutor conditionItemFpanl9actions = new(id: "conditionItem_fpaNL9Actions", workflowDemoRoot.Session); + SendactivityFpanl9Executor sendActivityFpanl9 = new(workflowDemoRoot.Session); + DelegateExecutor conditionItemNnqvxhactions = new(id: "conditionItem_NnqvXhActions", workflowDemoRoot.Session); + SendactivityNnqvxhExecutor sendActivityNnqvxh = new(workflowDemoRoot.Session); + DelegateExecutor conditionGroupVbtqd3Post = new(id: "conditionGroup_vBTQd3_Post", workflowDemoRoot.Session); + ConditiongroupXznrdmExecutor conditionGroupXznrdm = new(workflowDemoRoot.Session); + DelegateExecutor conditionItemNlqtbv = new(id: "conditionItem_NlQTBv", workflowDemoRoot.Session); + DelegateExecutor conditionItemNlqtbvactions = new(id: "conditionItem_NlQTBvActions", workflowDemoRoot.Session); + SendactivityH5lxddExecutor sendActivityH5lxdd = new(workflowDemoRoot.Session); + Conditiongroup4S1z27Executor conditionGroup4S1z27 = new(workflowDemoRoot.Session); + DelegateExecutor conditionItemExalhz = new(id: "conditionItem_EXAlhZ", workflowDemoRoot.Session); + DelegateExecutor conditionItemExalhzactions = new(id: "conditionItem_EXAlhZActions", workflowDemoRoot.Session); + SendactivityXkxfuuExecutor sendActivityXkxfuu = new(workflowDemoRoot.Session); + DelegateExecutor endGhvrfh = new(id: "end_GHVrFh", workflowDemoRoot.Session); + DelegateExecutor conditionGroup4S1z27Post = new(id: "conditionGroup_4s1Z27_Post", workflowDemoRoot.Session); + SendactivityCwnzimExecutor sendActivityCwnzim = new(workflowDemoRoot.Session); + QuestionWfj123Executor questionWfj123 = new(workflowDemoRoot.Session, options.AgentProvider); + SendactivityDsbajuExecutor sendActivityDsbaju = new(workflowDemoRoot.Session); + QuestionUej456Executor questionUej456 = new(workflowDemoRoot.Session, options.AgentProvider); + SetvariableJw7tmmExecutor setVariableJw7tmm = new(workflowDemoRoot.Session); + Setvariable6J2snpExecutor setVariable6J2snp = new(workflowDemoRoot.Session); + SetvariableS6hcghExecutor setVariableS6hcgh = new(workflowDemoRoot.Session); + DelegateExecutor gotoLzfj8u = new(id: "goto_LzfJ8u", workflowDemoRoot.Session); + DelegateExecutor conditionItemYiqundRestart = new(id: "conditionItem_yiqund_Restart", workflowDemoRoot.Session); + SendactivityL7ooqoExecutor sendActivityL7ooqo = new(workflowDemoRoot.Session); + SetvariableL7ooqoExecutor setVariableL7ooqo = new(workflowDemoRoot.Session); + DelegateExecutor conditionGroupMvieccPost = new(id: "conditionGroup_mVIecC_Post", workflowDemoRoot.Session); + SetvariableNxn1meExecutor setVariableNxn1me = new(workflowDemoRoot.Session); + ConditiongroupQfpif5Executor conditionGroupQfpif5 = new(workflowDemoRoot.Session); + DelegateExecutor conditionItemGmigcu = new(id: "conditionItem_GmigcU", workflowDemoRoot.Session); + DelegateExecutor conditionGroupQfpif5elseactions = new(id: "conditionGroup_QFPiF5ElseActions", workflowDemoRoot.Session); + DelegateExecutor conditionItemGmigcuactions = new(id: "conditionItem_GmigcUActions", workflowDemoRoot.Session); + QuestionOrsbf06Executor questionOrsbf06 = new(workflowDemoRoot.Session, options.AgentProvider); + SetvariableXznrdmExecutor setVariableXznrdm = new(workflowDemoRoot.Session); + Setvariable8Eix2aExecutor setVariable8Eix2a = new(workflowDemoRoot.Session); + DelegateExecutor conditionItemGmigcuRestart = new(id: "conditionItem_GmigcU_Restart", workflowDemoRoot.Session); + SendactivityBhcsi7Executor sendActivityBhcsi7 = new(workflowDemoRoot.Session); + SetvariableBhcsi7Executor setVariableBhcsi7 = new(workflowDemoRoot.Session); + DelegateExecutor conditionGroupQfpif5Post = new(id: "conditionGroup_QFPiF5_Post", workflowDemoRoot.Session); + DelegateExecutor goto76Hne8 = new(id: "goto_76Hne8", workflowDemoRoot.Session); + DelegateExecutor conditionItemFj432cPost = new(id: "conditionItem_fj432c_Post", workflowDemoRoot.Session); + DelegateExecutor conditionItemYiqundPost = new(id: "conditionItem_yiqund_Post", workflowDemoRoot.Session); + DelegateExecutor endSvonsvRestart = new(id: "end_SVoNSV_Restart", workflowDemoRoot.Session); + DelegateExecutor conditionItemFj432cactionsPost = new(id: "conditionItem_fj432cActions_Post", workflowDemoRoot.Session); + DelegateExecutor conditionGroupXznrdmPost = new(id: "conditionGroup_xzNrdM_Post", workflowDemoRoot.Session); + DelegateExecutor conditionItemYiqundactionsPost = new(id: "conditionItem_yiqundActions_Post", workflowDemoRoot.Session); + DelegateExecutor conditionItemFpanl9Post = new(id: "conditionItem_fpaNL9_Post", workflowDemoRoot.Session); + DelegateExecutor conditionItemNnqvxhPost = new(id: "conditionItem_NnqvXh_Post", workflowDemoRoot.Session); + DelegateExecutor conditionItemFpanl9actionsPost = new(id: "conditionItem_fpaNL9Actions_Post", workflowDemoRoot.Session); + DelegateExecutor conditionItemNnqvxhactionsPost = new(id: "conditionItem_NnqvXhActions_Post", workflowDemoRoot.Session); + DelegateExecutor conditionItemNlqtbvPost = new(id: "conditionItem_NlQTBv_Post", workflowDemoRoot.Session); + DelegateExecutor gotoLzfj8uRestart = new(id: "goto_LzfJ8u_Restart", workflowDemoRoot.Session); + DelegateExecutor conditionItemNlqtbvactionsPost = new(id: "conditionItem_NlQTBvActions_Post", workflowDemoRoot.Session); + DelegateExecutor conditionItemExalhzPost = new(id: "conditionItem_EXAlhZ_Post", workflowDemoRoot.Session); + DelegateExecutor endGhvrfhRestart = new(id: "end_GHVrFh_Restart", workflowDemoRoot.Session); + DelegateExecutor conditionItemExalhzactionsPost = new(id: "conditionItem_EXAlhZActions_Post", workflowDemoRoot.Session); + DelegateExecutor conditionGroupMvieccelseactionsPost = new(id: "conditionGroup_mVIecCElseActions_Post", workflowDemoRoot.Session); + DelegateExecutor conditionItemGmigcuPost = new(id: "conditionItem_GmigcU_Post", workflowDemoRoot.Session); + DelegateExecutor conditionItemGmigcuactionsPost = new(id: "conditionItem_GmigcUActions_Post", workflowDemoRoot.Session); + DelegateExecutor conditionGroupQfpif5elseactionsPost = new(id: "conditionGroup_QFPiF5ElseActions_Post", workflowDemoRoot.Session); + + // Define the workflow builder + WorkflowBuilder builder = new(workflowDemoRoot); + + // Connect executors + builder.AddEdge(workflowDemoRoot, workflowDemo); + builder.AddEdge(workflowDemo, setVariableAaslmf); + builder.AddEdge(setVariableAaslmf, setVariableV6yebo); + builder.AddEdge(setVariableV6yebo, setVariableNz2u0l); + builder.AddEdge(setVariableNz2u0l, setVariable10U2zn); + builder.AddEdge(setVariable10U2zn, sendActivityYfsbry); + builder.AddEdge(sendActivityYfsbry, conversation1A2b3c); + builder.AddEdge(conversation1A2b3c, questionUdomuw); + builder.AddEdge(questionUdomuw, sendActivityYfsbrz); + builder.AddEdge(sendActivityYfsbrz, questionDsbaju); + builder.AddEdge(questionDsbaju, setVariableKk2ldl); + builder.AddEdge(setVariableKk2ldl, sendActivityBwnzim); + builder.AddEdge(sendActivityBwnzim, questionO3bqkf); + builder.AddEdge(questionO3bqkf, parseRnztlv); + builder.AddEdge(parseRnztlv, conditionGroupMviecc); + builder.AddEdge(conditionGroupMviecc, conditionItemFj432c, (object? result) => ActionExecutor.IsMatch("conditionItem_fj432c", result)); + builder.AddEdge(conditionGroupMviecc, conditionItemYiqund, (object? result) => ActionExecutor.IsMatch("conditionItem_yiqund", result)); + builder.AddEdge(conditionGroupMviecc, conditionGroupMvieccelseactions, (object? result) => ActionExecutor.IsMatch("conditionGroup_mVIecCElseActions", result)); + builder.AddEdge(conditionItemFj432c, conditionItemFj432cactions); + builder.AddEdge(conditionItemFj432cactions, sendActivityKdl3mc); + builder.AddEdge(sendActivityKdl3mc, questionKe3l1d); + builder.AddEdge(questionKe3l1d, endSvonsv); + builder.AddEdge(conditionItemYiqund, conditionItemYiqundactions); + builder.AddEdge(conditionItemYiqundactions, setVariableH5lxdd); + builder.AddEdge(setVariableH5lxdd, conditionGroupVbtqd3); + builder.AddEdge(conditionGroupVbtqd3, conditionItemFpanl9, (object? result) => ActionExecutor.IsMatch("conditionItem_fpaNL9", result)); + builder.AddEdge(conditionGroupVbtqd3, conditionItemNnqvxh, (object? result) => ActionExecutor.IsMatch("conditionItem_NnqvXh", result)); + builder.AddEdge(conditionItemFpanl9, conditionItemFpanl9actions); + builder.AddEdge(conditionItemFpanl9actions, sendActivityFpanl9); + builder.AddEdge(conditionItemNnqvxh, conditionItemNnqvxhactions); + builder.AddEdge(conditionItemNnqvxhactions, sendActivityNnqvxh); + builder.AddEdge(conditionGroupVbtqd3Post, conditionGroupXznrdm); + builder.AddEdge(conditionGroupXznrdm, conditionItemNlqtbv, (object? result) => ActionExecutor.IsMatch("conditionItem_NlQTBv", result)); + builder.AddEdge(conditionItemNlqtbv, conditionItemNlqtbvactions); + builder.AddEdge(conditionItemNlqtbvactions, sendActivityH5lxdd); + builder.AddEdge(sendActivityH5lxdd, conditionGroup4S1z27); + builder.AddEdge(conditionGroup4S1z27, conditionItemExalhz, (object? result) => ActionExecutor.IsMatch("conditionItem_EXAlhZ", result)); + builder.AddEdge(conditionItemExalhz, conditionItemExalhzactions); + builder.AddEdge(conditionItemExalhzactions, sendActivityXkxfuu); + builder.AddEdge(sendActivityXkxfuu, endGhvrfh); + builder.AddEdge(conditionGroup4S1z27Post, sendActivityCwnzim); + builder.AddEdge(sendActivityCwnzim, questionWfj123); + builder.AddEdge(questionWfj123, sendActivityDsbaju); + builder.AddEdge(sendActivityDsbaju, questionUej456); + builder.AddEdge(questionUej456, setVariableJw7tmm); + builder.AddEdge(setVariableJw7tmm, setVariable6J2snp); + builder.AddEdge(setVariable6J2snp, setVariableS6hcgh); + builder.AddEdge(setVariableS6hcgh, gotoLzfj8u); + builder.AddEdge(gotoLzfj8u, questionO3bqkf); + builder.AddEdge(conditionItemYiqundRestart, conditionGroupMvieccelseactions); + builder.AddEdge(conditionGroupMvieccelseactions, sendActivityL7ooqo); + builder.AddEdge(sendActivityL7ooqo, setVariableL7ooqo); + builder.AddEdge(conditionGroupMvieccPost, setVariableNxn1me); + builder.AddEdge(setVariableNxn1me, conditionGroupQfpif5); + builder.AddEdge(conditionGroupQfpif5, conditionItemGmigcu, (object? result) => ActionExecutor.IsMatch("conditionItem_GmigcU", result)); + builder.AddEdge(conditionGroupQfpif5, conditionGroupQfpif5elseactions, (object? result) => ActionExecutor.IsMatch("conditionGroup_QFPiF5ElseActions", result)); + builder.AddEdge(conditionItemGmigcu, conditionItemGmigcuactions); + builder.AddEdge(conditionItemGmigcuactions, questionOrsbf06); + builder.AddEdge(questionOrsbf06, setVariableXznrdm); + builder.AddEdge(setVariableXznrdm, setVariable8Eix2a); + builder.AddEdge(conditionItemGmigcuRestart, conditionGroupQfpif5elseactions); + builder.AddEdge(conditionGroupQfpif5elseactions, sendActivityBhcsi7); + builder.AddEdge(sendActivityBhcsi7, setVariableBhcsi7); + builder.AddEdge(conditionGroupQfpif5Post, goto76Hne8); + builder.AddEdge(goto76Hne8, questionO3bqkf); + builder.AddEdge(conditionItemFj432cPost, conditionGroupMvieccPost); + builder.AddEdge(conditionItemYiqundPost, conditionGroupMvieccPost); + builder.AddEdge(endSvonsvRestart, conditionItemFj432cactionsPost); + builder.AddEdge(conditionItemFj432cactionsPost, conditionItemFj432cPost); + builder.AddEdge(conditionGroupXznrdmPost, conditionItemYiqundactionsPost); + builder.AddEdge(conditionItemYiqundactionsPost, conditionItemYiqundPost); + builder.AddEdge(conditionItemFpanl9Post, conditionGroupVbtqd3Post); + builder.AddEdge(conditionItemNnqvxhPost, conditionGroupVbtqd3Post); + builder.AddEdge(sendActivityFpanl9, conditionItemFpanl9actionsPost); + builder.AddEdge(conditionItemFpanl9actionsPost, conditionItemFpanl9Post); + builder.AddEdge(sendActivityNnqvxh, conditionItemNnqvxhactionsPost); + builder.AddEdge(conditionItemNnqvxhactionsPost, conditionItemNnqvxhPost); + builder.AddEdge(conditionItemNlqtbvPost, conditionGroupXznrdmPost); + builder.AddEdge(gotoLzfj8uRestart, conditionItemNlqtbvactionsPost); + builder.AddEdge(conditionItemNlqtbvactionsPost, conditionItemNlqtbvPost); + builder.AddEdge(conditionItemExalhzPost, conditionGroup4S1z27Post); + builder.AddEdge(endGhvrfhRestart, conditionItemExalhzactionsPost); + builder.AddEdge(conditionItemExalhzactionsPost, conditionItemExalhzPost); + builder.AddEdge(setVariableL7ooqo, conditionGroupMvieccelseactionsPost); + builder.AddEdge(conditionGroupMvieccelseactionsPost, conditionGroupMvieccPost); + builder.AddEdge(conditionItemGmigcuPost, conditionGroupQfpif5Post); + builder.AddEdge(setVariable8Eix2a, conditionItemGmigcuactionsPost); + builder.AddEdge(conditionItemGmigcuactionsPost, conditionItemGmigcuPost); + builder.AddEdge(setVariableBhcsi7, conditionGroupQfpif5elseactionsPost); + builder.AddEdge(conditionGroupQfpif5elseactionsPost, conditionGroupQfpif5Post); + + // Build the workflow + return builder.Build(); + } +} diff --git a/dotnet/samples/GettingStarted/Workflows/DeclarativeCode/Program.cs b/dotnet/samples/GettingStarted/Workflows/DeclarativeCode/Program.cs new file mode 100644 index 0000000000..c91ec3702d --- /dev/null +++ b/dotnet/samples/GettingStarted/Workflows/DeclarativeCode/Program.cs @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using Azure.AI.Agents.Persistent; +using Azure.Identity; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Extensions.AI; +using Microsoft.Extensions.Configuration; +using Test.WorkflowProviders; + +namespace Demo.DeclarativeCode; + +/// +/// HOW TO: Execute a declarative workflow that has been converted to code. +/// +/// +/// Configuration +/// Define FOUNDRY_PROJECT_ENDPOINT as a user-secret or environment variable that +/// points to your Foundry project endpoint. +/// +internal sealed class Program +{ + public static async Task Main(string[] args) + { + Program program = new(args); + await program.ExecuteAsync(); + } + + private async Task ExecuteAsync() + { + // Use DeclarativeWorkflowBuilder to build a workflow based on a YAML file. + DeclarativeWorkflowOptions options = + new(new AzureAgentProvider(this.FoundryEndpoint, new AzureCliCredential())) + { + Configuration = this.Configuration + }; + + // Use the generated provider to create a workflow instance. + Workflow workflow = TestWorkflowProvider.CreateWorkflow(options); + + Notify("\nWORKFLOW: Starting..."); + + // Run the workflow, just like any other workflow + string input = this.GetWorkflowInput(); + StreamingRun run = await InProcessExecution.StreamAsync(workflow, input); + await this.MonitorWorkflowRunAsync(run); + + Notify("\nWORKFLOW: Done!"); + } + + private const string ConfigKeyFoundryEndpoint = "FOUNDRY_PROJECT_ENDPOINT"; + + private static readonly Dictionary s_nameCache = []; + private static readonly HashSet s_fileCache = []; + + private string? WorkflowInput { get; } + private string FoundryEndpoint { get; } + private PersistentAgentsClient FoundryClient { get; } + private IConfiguration Configuration { get; } + + private Program(string[] args) + { + this.WorkflowInput = ParseWorkflowInput(args); + + this.Configuration = InitializeConfig(); + + this.FoundryEndpoint = this.Configuration[ConfigKeyFoundryEndpoint] ?? throw new InvalidOperationException($"Undefined configuration setting: {ConfigKeyFoundryEndpoint}"); + this.FoundryClient = new PersistentAgentsClient(this.FoundryEndpoint, new AzureCliCredential()); + } + + private async Task MonitorWorkflowRunAsync(StreamingRun run) + { + string? messageId = null; + + await foreach (WorkflowEvent evt in run.WatchStreamAsync().ConfigureAwait(false)) + { + if (evt is ExecutorInvokedEvent executorInvoked) + { + Debug.WriteLine($"STEP ENTER #{executorInvoked.ExecutorId}"); + } + else if (evt is ExecutorCompletedEvent executorComplete) + { + Debug.WriteLine($"STEP EXIT #{executorComplete.ExecutorId}"); + } + else if (evt is ExecutorFailedEvent executorFailure) + { + Debug.WriteLine($"STEP ERROR #{executorFailure.ExecutorId}: {executorFailure.Data?.Message ?? "Unknown"}"); + } + else if (evt is WorkflowErrorEvent workflowError) + { + Debug.WriteLine("WORKFLOW ERROR"); + } + else if (evt is ConversationUpdateEvent invokeEvent) + { + Debug.WriteLine($"CONVERSATION: {invokeEvent.Data}"); + } + else if (evt is AgentRunUpdateEvent streamEvent) + { + if (!string.Equals(messageId, streamEvent.Update.MessageId, StringComparison.Ordinal)) + { + messageId = streamEvent.Update.MessageId; + + if (messageId is not null) + { + string? agentId = streamEvent.Update.AuthorName; + if (agentId is not null) + { + if (!s_nameCache.TryGetValue(agentId, out string? realName)) + { + PersistentAgent agent = await this.FoundryClient.Administration.GetAgentAsync(agentId); + s_nameCache[agentId] = agent.Name; + realName = agent.Name; + } + agentId = realName; + } + agentId ??= nameof(ChatRole.Assistant); + Console.ForegroundColor = ConsoleColor.Cyan; + Console.Write($"\n{agentId.ToUpperInvariant()}:"); + Console.ForegroundColor = ConsoleColor.DarkGray; + Console.WriteLine($" [{messageId}]"); + } + } + + ChatResponseUpdate? chatUpdate = streamEvent.Update.RawRepresentation as ChatResponseUpdate; + switch (chatUpdate?.RawRepresentation) + { + case MessageContentUpdate messageUpdate: + string? fileId = messageUpdate.ImageFileId ?? messageUpdate.TextAnnotation?.OutputFileId; + if (fileId is not null && s_fileCache.Add(fileId)) + { + BinaryData content = await this.FoundryClient.Files.GetFileContentAsync(fileId); + await DownloadFileContentAsync(Path.GetFileName(messageUpdate.TextAnnotation?.TextToReplace ?? "response.png"), content); + } + break; + } + try + { + Console.ResetColor(); + Console.Write(streamEvent.Data); + } + finally + { + Console.ResetColor(); + } + } + else if (evt is AgentRunResponseEvent messageEvent) + { + try + { + Console.WriteLine(); + if (messageEvent.Response.AgentId is null) + { + Console.ForegroundColor = ConsoleColor.Cyan; + Console.WriteLine("ACTIVITY:"); + Console.ForegroundColor = ConsoleColor.Yellow; + Console.WriteLine(messageEvent.Response?.Text.Trim()); + } + else + { + if (messageEvent.Response.Usage is not null) + { + Console.ForegroundColor = ConsoleColor.DarkGray; + Console.WriteLine($"[Tokens Total: {messageEvent.Response.Usage.TotalTokenCount}, Input: {messageEvent.Response.Usage.InputTokenCount}, Output: {messageEvent.Response.Usage.OutputTokenCount}]"); + } + } + } + finally + { + Console.ResetColor(); + } + } + } + } + + private string GetWorkflowInput() + { + string? input = this.WorkflowInput; + + try + { + Console.ForegroundColor = ConsoleColor.DarkGreen; + + Console.Write("\nINPUT: "); + + Console.ForegroundColor = ConsoleColor.White; + + if (!string.IsNullOrWhiteSpace(input)) + { + Console.WriteLine(input); + return input; + } + while (string.IsNullOrWhiteSpace(input)) + { + input = Console.ReadLine(); + } + + return input.Trim(); + } + finally + { + Console.ResetColor(); + } + } + + private static string? ParseWorkflowInput(string[] args) + { + return args?.FirstOrDefault(); + } + + // Load configuration from user-secrets + private static IConfigurationRoot InitializeConfig() => + new ConfigurationBuilder() + .AddUserSecrets(Assembly.GetExecutingAssembly()) + .AddEnvironmentVariables() + .Build(); + + private static void Notify(string message) + { + Console.ForegroundColor = ConsoleColor.Cyan; + try + { + Console.WriteLine(message); + } + finally + { + Console.ResetColor(); + } + } + + private static async ValueTask DownloadFileContentAsync(string filename, BinaryData content) + { + string filePath = Path.Combine(Path.GetTempPath(), Path.GetFileName(filename)); + filePath = Path.ChangeExtension(filePath, ".png"); + + await File.WriteAllBytesAsync(filePath, content.ToArray()); + + Process.Start( + new ProcessStartInfo + { + FileName = "cmd.exe", + Arguments = $"/C start {filePath}" + }); + } +} diff --git a/dotnet/samples/GettingStarted/Workflows/DeclarativeEject/DeclarativeEject.csproj b/dotnet/samples/GettingStarted/Workflows/DeclarativeEject/DeclarativeEject.csproj new file mode 100644 index 0000000000..c8321d553d --- /dev/null +++ b/dotnet/samples/GettingStarted/Workflows/DeclarativeEject/DeclarativeEject.csproj @@ -0,0 +1,32 @@ + + + + Exe + net9.0 + net9.0 + $(ProjectsDebugTargetFrameworks) + enable + disable + 5ee045b0-aea3-4f08-8d31-32d1a6f8fed0 + $(NoWarn);CA1812 + + + + true + + + + + + + + + + + + + + + + + diff --git a/dotnet/samples/GettingStarted/Workflows/DeclarativeEject/Program.cs b/dotnet/samples/GettingStarted/Workflows/DeclarativeEject/Program.cs new file mode 100644 index 0000000000..fd8eb86cd8 --- /dev/null +++ b/dotnet/samples/GettingStarted/Workflows/DeclarativeEject/Program.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; +using Microsoft.Agents.AI.Workflows.Declarative; + +namespace Demo.DeclarativeEject; + +/// +/// HOW TO: Convert a workflow from a declartive (yaml based) definition to code. +/// +/// +/// Usage +/// Provide the path to the workflow definition file as the first argument. +/// All other arguments are intepreted as a queue of inputs. +/// When no input is queued, interactive input is requested from the console. +/// +internal sealed class Program +{ + public static void Main(string[] args) + { + Program program = new(args); + program.Execute(); + } + + private void Execute() + { + // Read and parse the declarative workflow. + Notify($"WORKFLOW: Parsing {Path.GetFullPath(this.WorkflowFile)}"); + + Stopwatch timer = Stopwatch.StartNew(); + + // Use DeclarativeWorkflowBuilder to generate code based on a YAML file. + string code = DeclarativeWorkflowBuilder.Eject(this.WorkflowFile, DeclarativeWorkflowLanguage.CSharp, workflowNamespace: "Demo.DeclarativeCode", workflowPrefix: "Sample"); + + Notify($"\nWORKFLOW: Defined {timer.Elapsed}\n"); + + Console.WriteLine(code); + } + + private const string DefaultWorkflow = "HelloWorld.yaml"; + + private string WorkflowFile { get; } + + private Program(string[] args) + { + this.WorkflowFile = ParseWorkflowFile(args); + } + + private static string ParseWorkflowFile(string[] args) + { + string workflowFile = args.FirstOrDefault() ?? DefaultWorkflow; + + if (!File.Exists(workflowFile) && !Path.IsPathFullyQualified(workflowFile)) + { + string? repoFolder = GetRepoFolder(); + if (repoFolder is not null) + { + workflowFile = Path.Combine(repoFolder, "workflow-samples", workflowFile); + workflowFile = Path.ChangeExtension(workflowFile, ".yaml"); + } + } + + if (!File.Exists(workflowFile)) + { + throw new InvalidOperationException($"Unable to locate workflow: {Path.GetFullPath(workflowFile)}."); + } + + return workflowFile; + + static string? GetRepoFolder() + { + DirectoryInfo? current = new(Directory.GetCurrentDirectory()); + + while (current is not null) + { + if (Directory.Exists(Path.Combine(current.FullName, ".git"))) + { + return current.FullName; + } + + current = current.Parent; + } + + return null; + } + } + + private static void Notify(string message) + { + Console.ForegroundColor = ConsoleColor.Cyan; + try + { + Console.WriteLine(message); + } + finally + { + Console.ResetColor(); + } + } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ActionTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ActionTemplate.cs new file mode 100644 index 0000000000..7208095a58 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ActionTemplate.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.Extensions; +using Microsoft.Agents.AI.Workflows.Declarative.Interpreter; +using Microsoft.Bot.ObjectModel; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal abstract class ActionTemplate : CodeTemplate, IModeledAction +{ + public string Id { get; private set; } = string.Empty; + + public string Name { get; private set; } = string.Empty; + + public string ParentId { get; private set; } = string.Empty; + + public bool UseAgentProvider { get; init; } + + protected TAction Initialize(TAction model) where TAction : DialogAction + { + this.Id = model.GetId(); + this.ParentId = model.GetParentId() ?? WorkflowActionVisitor.Steps.Root(); + this.Name = this.Id.FormatType(); + + return model; + } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/AddConversationMessageTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/AddConversationMessageTemplate.cs new file mode 100644 index 0000000000..7d9c848a7d --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/AddConversationMessageTemplate.cs @@ -0,0 +1,2791 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; + using Microsoft.Bot.ObjectModel; + using Microsoft.Extensions.AI; + using System.Collections.Generic; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\AddConversationMessageTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class AddConversationMessageTemplate : ActionTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n\n/// \n/// Adds a new message to the specified agent conversation\n/// \ninternal sealed class "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\AddConversationMessageTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Name)); + + #line default + #line hidden + this.Write("Executor(FormulaSession session, WorkflowAgentProvider agentProvider) : ActionExe" + + "cutor(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\AddConversationMessageTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write("\", session)\n{\n // \n protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken)\n " + + " {"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\AddConversationMessageTemplate.tt" + + EvaluateStringExpression(this.Model.ConversationId, "conversationId", isNullable: true); + + #line default + #line hidden + this.Write("\n ArgumentNullException.ThrowIfNull(conversationId, nameof(conversationId)" + + ");\n ChatMessage newMessage = new(ChatRole."); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\AddConversationMessageTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(FormatEnum(this.Model.Role, RoleMap))); + + #line default + #line hidden + this.Write(", [.. this.GetContentAsync(context).ToEnumerable()]) { AdditionalProperties = thi" + + "s.GetMetadata() };\n await agentProvider.CreateMessageAsync(conversationId" + + ", newMessage, cancellationToken).ConfigureAwait(false);"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\AddConversationMessageTemplate.tt" + + AssignVariable(this.Message, "newMessage"); + + + #line default + #line hidden + this.Write("\n return default;\n }\n\n private async IAsyncEnumerable Get" + + "ContentAsync(IWorkflowContext context)\n {"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\AddConversationMessageTemplate.tt" + + int index = 0; + foreach (AddConversationMessageContent content in this.Model.Content) + { + ++index; + EvaluateMessageTemplate(content.Value, $"contentValue{index}"); + AgentMessageContentType contentType = content.Type.Value; + if (contentType == AgentMessageContentType.ImageUrl) + { + + #line default + #line hidden + this.Write("\n yield return new UriContent(contentValue, \"image/*\");"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\AddConversationMessageTemplate.tt" + + } + else if (contentType == AgentMessageContentType.ImageFile) + { + + #line default + #line hidden + this.Write("\n yield return new HostedFileContent(contentValue);"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\AddConversationMessageTemplate.tt" + + } + else + { + + #line default + #line hidden + this.Write("\n yield return new TextContent(contentValue"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\AddConversationMessageTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(index)); + + #line default + #line hidden + this.Write(");"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\AddConversationMessageTemplate.tt" + + } + } + + #line default + #line hidden + this.Write("\n }\n\n private AdditionalPropertiesDictionary? GetMetadata()\n {"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\AddConversationMessageTemplate.tt" + + EvaluateRecordExpression(this.Model.Metadata, "metadata"); + + #line default + #line hidden + this.Write("\n\n if (metadata is null)\n {\n return null; \n }\n" + + "\n return new AdditionalPropertiesDictionary(metadata);\n }\n}"); + return this.GenerationEnvironment.ToString(); + } + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + +void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false) +{ + if (targetVariable is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n await context.QueueStateUpdateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableName(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\", value: "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(valueVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableScope(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + + if (!tightFormat) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +} + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + +void EvaluateBoolExpression(BoolExpression expression, string targetVariable, bool defaultValue = false) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync>("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + +void EvaluateEnumExpression( + EnumExpression expression, + string targetVariable, + IDictionary resultMap, + string defaultValue = null, + bool qualifyResult = false, + bool isNullable = false) + where TWrapper : EnumWrapper +{ + string resultType = $"{GetTypeAlias()}{(isNullable ? "?" : "")}"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + resultMap.TryGetValue(expression.LiteralValue, out string resultValue); + if (qualifyResult) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("."); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(resultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + +void EvaluateIntExpression(IntExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "int?" : "int"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "0")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + +void EvaluateListExpression(ValueExpression expression, string targetVariable) +{ + string typeName = GetTypeAlias(); + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.ReadListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("> = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + +void EvaluateRecordExpression(ObjectExpression expression, string targetVariable) +{ + string resultTypeName = $"Dictionary()}?>?"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" =\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + +void EvaluateStringExpression(StringExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "string?" : "string"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "string.Empty")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + if (expression.LiteralValue.Contains("\n")) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = \n \"\"\"\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n \"\"\";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) => + EvaluateValueExpression(expression, targetVariable); + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + +void EvaluateMessageTemplate(TemplateLine templateLine, string variableName) +{ + if (templateLine is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" =\n await context.FormatTemplateAsync(\n \"\"\""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + FormatMessageTemplate(templateLine); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n \"\"\");"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + +void FormatMessageTemplate(TemplateLine line) +{ + foreach (string text in line.ToTemplateString().ByLine()) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(text)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + + + #line default + #line hidden + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/AddConversationMessageTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/AddConversationMessageTemplate.tt new file mode 100644 index 0000000000..24c2923864 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/AddConversationMessageTemplate.tt @@ -0,0 +1,57 @@ +<#@ template language="C#" inherits="ActionTemplate" visibility="internal" #> +<#@ output extension=".cs" #> +<#@ assembly name="System.Core" #> +<#@ include file="Snippets/Index.tt" once="true" #> + +/// +/// Adds a new message to the specified agent conversation +/// +internal sealed class <#= this.Name #>Executor(FormulaSession session, WorkflowAgentProvider agentProvider) : ActionExecutor(id: "<#= this.Id #>", session) +{ + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + {<# + EvaluateStringExpression(this.Model.ConversationId, "conversationId", isNullable: true); #> + ArgumentNullException.ThrowIfNull(conversationId, nameof(conversationId)); + ChatMessage newMessage = new(ChatRole.<#= FormatEnum(this.Model.Role, RoleMap) #>, [.. this.GetContentAsync(context).ToEnumerable()]) { AdditionalProperties = this.GetMetadata() }; + await agentProvider.CreateMessageAsync(conversationId, newMessage, cancellationToken).ConfigureAwait(false);<# + AssignVariable(this.Message, "newMessage"); + #> + return default; + } + + private async IAsyncEnumerable GetContentAsync(IWorkflowContext context) + {<# + int index = 0; + foreach (AddConversationMessageContent content in this.Model.Content) + { + ++index; + EvaluateMessageTemplate(content.Value, $"contentValue{index}"); + AgentMessageContentType contentType = content.Type.Value; + if (contentType == AgentMessageContentType.ImageUrl) + {#> + yield return new UriContent(contentValue, "image/*");<# + } + else if (contentType == AgentMessageContentType.ImageFile) + {#> + yield return new HostedFileContent(contentValue);<# + } + else + {#> + yield return new TextContent(contentValue<#= index #>);<# + } + }#> + } + + private AdditionalPropertiesDictionary? GetMetadata() + {<# + EvaluateRecordExpression(this.Model.Metadata, "metadata"); #> + + if (metadata is null) + { + return null; + } + + return new AdditionalPropertiesDictionary(metadata); + } +} \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/AddConversationMessageTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/AddConversationMessageTemplateCode.cs new file mode 100644 index 0000000000..39f0ff6344 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/AddConversationMessageTemplateCode.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System.Collections.Frozen; +using System.Collections.Generic; +using Microsoft.Bot.ObjectModel; +using Microsoft.Extensions.AI; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class AddConversationMessageTemplate +{ + public AddConversationMessageTemplate(AddConversationMessage model) + { + this.Model = this.Initialize(model); + this.Message = this.Model.Message?.Path; + this.UseAgentProvider = true; + } + + public AddConversationMessage Model { get; } + + public PropertyPath? Message { get; } + + public const string DefaultRole = nameof(ChatRole.User); + + public static readonly FrozenDictionary RoleMap = + new Dictionary() + { + [AgentMessageRoleWrapper.Get(AgentMessageRole.User)] = nameof(ChatRole.User), + [AgentMessageRoleWrapper.Get(AgentMessageRole.Agent)] = nameof(ChatRole.Assistant), + }.ToFrozenDictionary(); +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ClearAllVariablesTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ClearAllVariablesTemplate.cs new file mode 100644 index 0000000000..fc9224a3a3 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ClearAllVariablesTemplate.cs @@ -0,0 +1,2711 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; + using Microsoft.Bot.ObjectModel; + using Microsoft.Extensions.AI; + using System.Collections.Generic; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ClearAllVariablesTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class ClearAllVariablesTemplate : ActionTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n/// \n/// Reset all the state for the targeted variable scope.\n/// \ninternal sealed class "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ClearAllVariablesTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Name)); + + #line default + #line hidden + this.Write("Executor(FormulaSession session) : ActionExecutor(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ClearAllVariablesTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write("\", session)\n{\n // \n protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken)\n " + + " {"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ClearAllVariablesTemplate.tt" + + EvaluateEnumExpression(this.Model.Variables, "targetScopeName", ScopeMap, isNullable: true); + + #line default + #line hidden + this.Write("\n await context.QueueClearScopeAsync(targetScopeName).ConfigureAwait(false" + + ");\n\n return default;\n }\n}\n"); + return this.GenerationEnvironment.ToString(); + } + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + +void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false) +{ + if (targetVariable is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n await context.QueueStateUpdateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableName(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\", value: "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(valueVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableScope(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + + if (!tightFormat) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +} + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + +void EvaluateBoolExpression(BoolExpression expression, string targetVariable, bool defaultValue = false) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync>("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + +void EvaluateEnumExpression( + EnumExpression expression, + string targetVariable, + IDictionary resultMap, + string defaultValue = null, + bool qualifyResult = false, + bool isNullable = false) + where TWrapper : EnumWrapper +{ + string resultType = $"{GetTypeAlias()}{(isNullable ? "?" : "")}"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + resultMap.TryGetValue(expression.LiteralValue, out string resultValue); + if (qualifyResult) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("."); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(resultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + +void EvaluateIntExpression(IntExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "int?" : "int"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "0")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + +void EvaluateListExpression(ValueExpression expression, string targetVariable) +{ + string typeName = GetTypeAlias(); + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.ReadListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("> = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + +void EvaluateRecordExpression(ObjectExpression expression, string targetVariable) +{ + string resultTypeName = $"Dictionary()}?>?"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" =\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + +void EvaluateStringExpression(StringExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "string?" : "string"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "string.Empty")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + if (expression.LiteralValue.Contains("\n")) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = \n \"\"\"\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n \"\"\";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) => + EvaluateValueExpression(expression, targetVariable); + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + +void EvaluateMessageTemplate(TemplateLine templateLine, string variableName) +{ + if (templateLine is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" =\n await context.FormatTemplateAsync(\n \"\"\""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + FormatMessageTemplate(templateLine); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n \"\"\");"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + +void FormatMessageTemplate(TemplateLine line) +{ + foreach (string text in line.ToTemplateString().ByLine()) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(text)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + + + #line default + #line hidden + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ClearAllVariablesTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ClearAllVariablesTemplate.tt new file mode 100644 index 0000000000..0b0ce3595c --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ClearAllVariablesTemplate.tt @@ -0,0 +1,18 @@ +<#@ template language="C#" inherits="ActionTemplate" visibility="internal" #> +<#@ output extension=".cs" #> +<#@ assembly name="System.Core" #> +<#@ include file="Snippets/Index.tt" once="true" #> +/// +/// Reset all the state for the targeted variable scope. +/// +internal sealed class <#= this.Name #>Executor(FormulaSession session) : ActionExecutor(id: "<#= this.Id #>", session) +{ + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + {<# + EvaluateEnumExpression(this.Model.Variables, "targetScopeName", ScopeMap, isNullable: true); #> + await context.QueueClearScopeAsync(targetScopeName).ConfigureAwait(false); + + return default; + } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ClearAllVariablesTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ClearAllVariablesTemplateCode.cs new file mode 100644 index 0000000000..6a5449c37b --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ClearAllVariablesTemplateCode.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System.Collections.Frozen; +using System.Collections.Generic; +using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; +using Microsoft.Bot.ObjectModel; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class ClearAllVariablesTemplate +{ + public ClearAllVariablesTemplate(ClearAllVariables model) + { + this.Model = this.Initialize(model); + } + + public ClearAllVariables Model { get; } + + public static readonly FrozenDictionary ScopeMap = + new Dictionary() + { + [VariablesToClearWrapper.Get(VariablesToClear.AllGlobalVariables)] = VariableScopeNames.Global, + [VariablesToClearWrapper.Get(VariablesToClear.ConversationScopedVariables)] = WorkflowFormulaState.DefaultScopeName, + }.ToFrozenDictionary(); +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CodeTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CodeTemplate.cs new file mode 100644 index 0000000000..87d9ab748b --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CodeTemplate.cs @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using Microsoft.Bot.ObjectModel; +using Microsoft.Shared.Diagnostics; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal abstract class CodeTemplate +{ + private StringBuilder? _generationEnvironmentField; + private CompilerErrorCollection? _errorsField; + private List? _indentLengthsField; + private bool _endsWithNewline; + + private string CurrentIndentField { get; set; } = string.Empty; + + /// + /// Create the template output + /// + public abstract string TransformText(); + + #region Object Model helpers + + public static string VariableName(PropertyPath path) => Throw.IfNull(path.VariableName); + public static string VariableScope(PropertyPath path) => Throw.IfNull(path.NamespaceAlias); + + public static string FormatBoolValue(bool? value, bool defaultValue = false) => + value ?? defaultValue ? "true" : "false"; + + public static string FormatStringValue(string? value) + { + if (value is null) + { + return "null"; + } + + if (value.Contains('\n') || value.Contains('\r')) + { + return @$"""""""{Environment.NewLine}{value}{Environment.NewLine}"""""""; + } + + if (value.Contains('"') || value.Contains('\\')) + { + return @$"""""""{value}"""""""; + } + + return @$"""{value}"""; + } + + public static string FormatValue(string? value) + { + if (typeof(TValue) == typeof(string)) + { + return FormatStringValue(value); + } + + if (value is null) + { + return "null"; + } + + if (typeof(TValue).IsEnum) + { + return $"{typeof(TValue).Name}.{value}"; + } + + return $"{value}"; + } + + public static string FormatDataValue(DataValue value) => + value switch + { + BlankDataValue => "null", + BooleanDataValue booleanValue => FormatBoolValue(booleanValue.Value), + FloatDataValue decimalValue => $"{decimalValue.Value}", + NumberDataValue numberValue => $"{numberValue.Value}", + DateDataValue dateValue => $"new DateTime({dateValue.Value.Ticks}, DateTimeKind.{dateValue.Value.Kind})", + DateTimeDataValue datetimeValue => $"new DateTimeOffset({datetimeValue.Value.Ticks}, TimeSpan.FromTicks({datetimeValue.Value.Offset}))", + TimeDataValue timeValue => $"TimeSpan.FromTicks({timeValue.Value.Ticks})", + StringDataValue stringValue => FormatStringValue(stringValue.Value), + OptionDataValue optionValue => @$"""{optionValue.Value}""", + // Indenting is important here to make the generated code readable. Don't change it without testing the output. + RecordDataValue recordValue => + $""" + [ + {string.Join(",\n ", recordValue.Properties.Select(p => $"[\"{p.Key}\"] = {FormatDataValue(p.Value)}"))} + ] + """, + _ => throw new DeclarativeModelException($"Unable to format '{value.GetType().Name}'"), + }; + + public static TTarget FormatEnum(TSource value, IDictionary map, TTarget? defaultValue = default) + { + if (map.TryGetValue(value, out TTarget? target)) + { + return target; + } + + if (defaultValue is null) + { + throw new DeclarativeModelException($"No default value suppied for '{typeof(TTarget).Name}'"); + } + + return defaultValue; + } + + public static string GetTypeAlias() => GetTypeAlias(typeof(TValue)); + + public static string GetTypeAlias(Type type) + { + return type switch + { + Type t when t == typeof(bool) => "bool", + Type t when t == typeof(byte) => "byte", + Type t when t == typeof(sbyte) => "sbyte", + Type t when t == typeof(char) => "char", + Type t when t == typeof(decimal) => "decimal", + Type t when t == typeof(double) => "double", + Type t when t == typeof(float) => "float", + Type t when t == typeof(int) => "int", + Type t when t == typeof(uint) => "uint", + Type t when t == typeof(long) => "long", + Type t when t == typeof(ulong) => "ulong", + Type t when t == typeof(nint) => "nint", + Type t when t == typeof(nuint) => "nuint", + Type t when t == typeof(short) => "short", + Type t when t == typeof(ushort) => "ushort", + Type t when t == typeof(string) => "string", + Type t when t == typeof(object) => "object", + _ => type.Name + }; + } + #endregion + + #region Properties + /// + /// The string builder that generation-time code is using to assemble generated output + /// + public StringBuilder GenerationEnvironment + { + get + { + return this._generationEnvironmentField ??= new StringBuilder(); + } + set + { + this._generationEnvironmentField = value; + } + } + /// + /// The error collection for the generation process + /// + public CompilerErrorCollection Errors => this._errorsField ??= []; + + /// + /// A list of the lengths of each indent that was added with PushIndent + /// + private List indentLengths => this._indentLengthsField ??= []; + + /// + /// Gets the current indent we use when adding lines to the output + /// + public string CurrentIndent + { + get + { + return this.CurrentIndentField; + } + } + /// + /// Current transformation session + /// + public virtual IDictionary? Session { get; set; } + + #endregion + + #region Transform-time helpers + + /// + /// Write text directly into the generated output + /// + public void Write(string textToAppend) + { + if (string.IsNullOrEmpty(textToAppend)) + { + return; + } + // If we're starting off, or if the previous text ended with a newline, + // we have to append the current indent first. + if ((this.GenerationEnvironment.Length == 0) + || this._endsWithNewline) + { + this.GenerationEnvironment.Append(this.CurrentIndentField); + this._endsWithNewline = false; + } + // Check if the current text ends with a newline + if (textToAppend.EndsWith(Environment.NewLine, StringComparison.CurrentCulture)) + { + this._endsWithNewline = true; + } + // This is an optimization. If the current indent is "", then we don't have to do any + // of the more complex stuff further down. + if (this.CurrentIndentField.Length == 0) + { + this.GenerationEnvironment.Append(textToAppend); + return; + } + // Everywhere there is a newline in the text, add an indent after it + textToAppend = textToAppend.Replace(Environment.NewLine, Environment.NewLine + this.CurrentIndentField); + // If the text ends with a newline, then we should strip off the indent added at the very end + // because the appropriate indent will be added when the next time Write() is called + if (this._endsWithNewline) + { + this.GenerationEnvironment.Append(textToAppend, 0, textToAppend.Length - this.CurrentIndentField.Length); + } + else + { + this.GenerationEnvironment.Append(textToAppend); + } + } + + /// + /// Write text directly into the generated output + /// + public void WriteLine(string textToAppend) + { + this.Write(textToAppend); + this.GenerationEnvironment.AppendLine(); + this._endsWithNewline = true; + } + + /// + /// Write formatted text directly into the generated output + /// + public void Write(string format, params object[] args) + { + this.Write(string.Format(CultureInfo.CurrentCulture, format, args)); + } + + /// + /// Write formatted text directly into the generated output + /// + public void WriteLine(string format, params object[] args) + { + this.WriteLine(string.Format(CultureInfo.CurrentCulture, format, args)); + } + + /// + /// Raise an error + /// + public void Error(string message) + { + CompilerError error = new() + { + ErrorText = message + }; + this.Errors.Add(error); + } + + /// + /// Raise a warning + /// + public void Warning(string message) + { + CompilerError error = new() + { + ErrorText = message, + IsWarning = true + }; + error.ErrorText = message; + error.IsWarning = true; + this.Errors.Add(error); + } + + /// + /// Increase the indent + /// + public void PushIndent(string indent) + { + if (indent is null) + { + throw new ArgumentNullException(nameof(indent)); + } + this.CurrentIndentField += indent; + this.indentLengths.Add(indent.Length); + } + + /// + /// Remove the last indent that was added with PushIndent + /// + public string PopIndent() + { + string returnValue = string.Empty; + if (this.indentLengths.Count > 0) + { + int indentLength = this.indentLengths[this.indentLengths.Count - 1]; + this.indentLengths.RemoveAt(this.indentLengths.Count - 1); + if (indentLength > 0) + { + returnValue = this.CurrentIndentField.Substring(this.CurrentIndentField.Length - indentLength); + this.CurrentIndentField = this.CurrentIndentField.Remove(this.CurrentIndentField.Length - indentLength); + } + } + return returnValue; + } + + /// + /// Remove any indentation + /// + public void ClearIndent() + { + this.indentLengths.Clear(); + this.CurrentIndentField = string.Empty; + } + + #endregion + + #region ToString Helpers + + /// + /// Utility class to produce culture-oriented representation of an object as a string. + /// + public sealed class ToStringInstanceHelper + { + /// + /// This is called from the compile/run appdomain to convert objects within an expression block to a string + /// +#pragma warning disable CA1822 // Required to be non-static for use in generated code + public string ToStringWithCulture(object objectToConvert) => $"{objectToConvert}"; +#pragma warning restore CA1822 + } + + /// + /// Helper to produce culture-oriented representation of an object as a string + /// + public ToStringInstanceHelper ToStringHelper { get; } = new(); + + #endregion +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ConditionGroupTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ConditionGroupTemplate.cs new file mode 100644 index 0000000000..bbf8f68c3c --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ConditionGroupTemplate.cs @@ -0,0 +1,2748 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; + using Microsoft.Bot.ObjectModel; + using Microsoft.Extensions.AI; + using System.Collections.Generic; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ConditionGroupTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class ConditionGroupTemplate : ActionTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n/// \n/// Conditional branching similar to an if / elseif / elseif / els" + + "e chain.\n/// \ninternal sealed class "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ConditionGroupTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Name)); + + #line default + #line hidden + this.Write("Executor(FormulaSession session) : ActionExecutor(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ConditionGroupTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write("\", session)\n{\n // \n protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken)\n " + + " {"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ConditionGroupTemplate.tt" + + for (int index = 0; index < this.Model.Conditions.Length; ++index) + { + ConditionItem conditionItem = this.Model.Conditions[index]; + if (conditionItem.Condition is null) + { + continue; // Skip if no condition is defined + } + + EvaluateBoolExpression(conditionItem.Condition, $"condition{index}"); + + #line default + #line hidden + this.Write("\n if (condition"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ConditionGroupTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(index)); + + #line default + #line hidden + this.Write(")\n {\n return \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ConditionGroupTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(ConditionGroupExecutor.Steps.Item(this.Model, conditionItem))); + + #line default + #line hidden + this.Write("\";\n }\n "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ConditionGroupTemplate.tt" + + } + + + #line default + #line hidden + this.Write("\n return \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ConditionGroupTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(ConditionGroupExecutor.Steps.Else(this.Model))); + + #line default + #line hidden + this.Write("\";\n }\n}"); + return this.GenerationEnvironment.ToString(); + } + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + +void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false) +{ + if (targetVariable is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n await context.QueueStateUpdateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableName(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\", value: "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(valueVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableScope(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + + if (!tightFormat) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +} + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + +void EvaluateBoolExpression(BoolExpression expression, string targetVariable, bool defaultValue = false) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync>("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + +void EvaluateEnumExpression( + EnumExpression expression, + string targetVariable, + IDictionary resultMap, + string defaultValue = null, + bool qualifyResult = false, + bool isNullable = false) + where TWrapper : EnumWrapper +{ + string resultType = $"{GetTypeAlias()}{(isNullable ? "?" : "")}"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + resultMap.TryGetValue(expression.LiteralValue, out string resultValue); + if (qualifyResult) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("."); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(resultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + +void EvaluateIntExpression(IntExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "int?" : "int"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "0")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + +void EvaluateListExpression(ValueExpression expression, string targetVariable) +{ + string typeName = GetTypeAlias(); + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.ReadListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("> = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + +void EvaluateRecordExpression(ObjectExpression expression, string targetVariable) +{ + string resultTypeName = $"Dictionary()}?>?"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" =\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + +void EvaluateStringExpression(StringExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "string?" : "string"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "string.Empty")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + if (expression.LiteralValue.Contains("\n")) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = \n \"\"\"\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n \"\"\";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) => + EvaluateValueExpression(expression, targetVariable); + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + +void EvaluateMessageTemplate(TemplateLine templateLine, string variableName) +{ + if (templateLine is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" =\n await context.FormatTemplateAsync(\n \"\"\""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + FormatMessageTemplate(templateLine); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n \"\"\");"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + +void FormatMessageTemplate(TemplateLine line) +{ + foreach (string text in line.ToTemplateString().ByLine()) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(text)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + + + #line default + #line hidden + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ConditionGroupTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ConditionGroupTemplate.tt new file mode 100644 index 0000000000..bef9936240 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ConditionGroupTemplate.tt @@ -0,0 +1,31 @@ +<#@ template language="C#" inherits="ActionTemplate" visibility="internal" #> +<#@ output extension=".cs" #> +<#@ assembly name="System.Core" #> +<#@ include file="Snippets/Index.tt" once="true" #> +/// +/// Conditional branching similar to an if / elseif / elseif / else chain. +/// +internal sealed class <#= this.Name #>Executor(FormulaSession session) : ActionExecutor(id: "<#= this.Id #>", session) +{ + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + {<# + for (int index = 0; index < this.Model.Conditions.Length; ++index) + { + ConditionItem conditionItem = this.Model.Conditions[index]; + if (conditionItem.Condition is null) + { + continue; // Skip if no condition is defined + } + + EvaluateBoolExpression(conditionItem.Condition, $"condition{index}");#> + if (condition<#= index #>) + { + return "<#= ConditionGroupExecutor.Steps.Item(this.Model, conditionItem)#>"; + } + <# + } + #> + return "<#= ConditionGroupExecutor.Steps.Else(this.Model)#>"; + } +} \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ConditionGroupTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ConditionGroupTemplateCode.cs new file mode 100644 index 0000000000..3af3c41c5a --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ConditionGroupTemplateCode.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Bot.ObjectModel; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class ConditionGroupTemplate +{ + public ConditionGroupTemplate(ConditionGroup model) + { + this.Model = this.Initialize(model); + } + + public ConditionGroup Model { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CopyConversationMessagesTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CopyConversationMessagesTemplate.cs new file mode 100644 index 0000000000..6df1461111 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CopyConversationMessagesTemplate.cs @@ -0,0 +1,2731 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; + using Microsoft.Bot.ObjectModel; + using Microsoft.Extensions.AI; + using System.Collections.Generic; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\CopyConversationMessagesTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class CopyConversationMessagesTemplate : ActionTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n/// \n/// Copies one or more messages into the specified agent conversat" + + "ion.\n/// \ninternal sealed class "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\CopyConversationMessagesTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Name)); + + #line default + #line hidden + this.Write("Executor(FormulaSession session, WorkflowAgentProvider agentProvider) : ActionExe" + + "cutor(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\CopyConversationMessagesTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write("\", session)\n{\n // \n protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken)\n " + + " {"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\CopyConversationMessagesTemplate.tt" + + EvaluateStringExpression(this.Model.ConversationId, "conversationId", isNullable: true); + + #line default + #line hidden + this.Write("\n ArgumentNullException.ThrowIfNull(conversationId, nameof(conversationId)" + + ");"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\CopyConversationMessagesTemplate.tt" + + EvaluateValueExpression(this.Model.Messages, "messages"); + + + #line default + #line hidden + this.Write(@" + if (messages is not null) + { + foreach (ChatMessage message in messages) + { + await agentProvider.CreateMessageAsync(conversationId, message, cancellationToken).ConfigureAwait(false); + } + } + return default; + } +}"); + return this.GenerationEnvironment.ToString(); + } + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + +void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false) +{ + if (targetVariable is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n await context.QueueStateUpdateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableName(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\", value: "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(valueVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableScope(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + + if (!tightFormat) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +} + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + +void EvaluateBoolExpression(BoolExpression expression, string targetVariable, bool defaultValue = false) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync>("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + +void EvaluateEnumExpression( + EnumExpression expression, + string targetVariable, + IDictionary resultMap, + string defaultValue = null, + bool qualifyResult = false, + bool isNullable = false) + where TWrapper : EnumWrapper +{ + string resultType = $"{GetTypeAlias()}{(isNullable ? "?" : "")}"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + resultMap.TryGetValue(expression.LiteralValue, out string resultValue); + if (qualifyResult) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("."); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(resultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + +void EvaluateIntExpression(IntExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "int?" : "int"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "0")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + +void EvaluateListExpression(ValueExpression expression, string targetVariable) +{ + string typeName = GetTypeAlias(); + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.ReadListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("> = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + +void EvaluateRecordExpression(ObjectExpression expression, string targetVariable) +{ + string resultTypeName = $"Dictionary()}?>?"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" =\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + +void EvaluateStringExpression(StringExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "string?" : "string"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "string.Empty")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + if (expression.LiteralValue.Contains("\n")) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = \n \"\"\"\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n \"\"\";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) => + EvaluateValueExpression(expression, targetVariable); + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + +void EvaluateMessageTemplate(TemplateLine templateLine, string variableName) +{ + if (templateLine is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" =\n await context.FormatTemplateAsync(\n \"\"\""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + FormatMessageTemplate(templateLine); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n \"\"\");"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + +void FormatMessageTemplate(TemplateLine line) +{ + foreach (string text in line.ToTemplateString().ByLine()) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(text)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + + + #line default + #line hidden + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CopyConversationMessagesTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CopyConversationMessagesTemplate.tt new file mode 100644 index 0000000000..15c26d75f7 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CopyConversationMessagesTemplate.tt @@ -0,0 +1,26 @@ +<#@ template language="C#" inherits="ActionTemplate" visibility="internal" #> +<#@ output extension=".cs" #> +<#@ assembly name="System.Core" #> +<#@ include file="Snippets/Index.tt" once="true" #> +/// +/// Copies one or more messages into the specified agent conversation. +/// +internal sealed class <#= this.Name #>Executor(FormulaSession session, WorkflowAgentProvider agentProvider) : ActionExecutor(id: "<#= this.Id #>", session) +{ + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + {<# + EvaluateStringExpression(this.Model.ConversationId, "conversationId", isNullable: true); #> + ArgumentNullException.ThrowIfNull(conversationId, nameof(conversationId));<# + EvaluateValueExpression(this.Model.Messages, "messages"); + #> + if (messages is not null) + { + foreach (ChatMessage message in messages) + { + await agentProvider.CreateMessageAsync(conversationId, message, cancellationToken).ConfigureAwait(false); + } + } + return default; + } +} \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CopyConversationMessagesTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CopyConversationMessagesTemplateCode.cs new file mode 100644 index 0000000000..aa81b1fba7 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CopyConversationMessagesTemplateCode.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Bot.ObjectModel; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class CopyConversationMessagesTemplate +{ + public CopyConversationMessagesTemplate(CopyConversationMessages model) + { + this.Model = this.Initialize(model); + this.UseAgentProvider = true; + } + + public CopyConversationMessages Model { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CreateConversationTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CreateConversationTemplate.cs new file mode 100644 index 0000000000..9b77f0c6a4 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CreateConversationTemplate.cs @@ -0,0 +1,2721 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; + using Microsoft.Bot.ObjectModel; + using Microsoft.Extensions.AI; + using System.Collections.Generic; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\CreateConversationTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class CreateConversationTemplate : ActionTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n/// \n/// Creates a new conversation and stores the identifier value to " + + "the \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\CreateConversationTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Model.ConversationId)); + + #line default + #line hidden + this.Write("\" variable.\n/// \ninternal sealed class "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\CreateConversationTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Name)); + + #line default + #line hidden + this.Write("Executor(FormulaSession session, WorkflowAgentProvider agentProvider) : ActionExe" + + "cutor(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\CreateConversationTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write(@""", session) +{ + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string conversationId = await agentProvider.CreateConversationAsync(cancellationToken).ConfigureAwait(false);"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\CreateConversationTemplate.tt" + + AssignVariable(this.ConversationId, "conversationId"); + + + #line default + #line hidden + this.Write("\n return default;\n }\n}\n"); + return this.GenerationEnvironment.ToString(); + } + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + +void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false) +{ + if (targetVariable is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n await context.QueueStateUpdateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableName(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\", value: "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(valueVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableScope(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + + if (!tightFormat) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +} + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + +void EvaluateBoolExpression(BoolExpression expression, string targetVariable, bool defaultValue = false) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync>("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + +void EvaluateEnumExpression( + EnumExpression expression, + string targetVariable, + IDictionary resultMap, + string defaultValue = null, + bool qualifyResult = false, + bool isNullable = false) + where TWrapper : EnumWrapper +{ + string resultType = $"{GetTypeAlias()}{(isNullable ? "?" : "")}"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + resultMap.TryGetValue(expression.LiteralValue, out string resultValue); + if (qualifyResult) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("."); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(resultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + +void EvaluateIntExpression(IntExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "int?" : "int"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "0")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + +void EvaluateListExpression(ValueExpression expression, string targetVariable) +{ + string typeName = GetTypeAlias(); + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.ReadListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("> = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + +void EvaluateRecordExpression(ObjectExpression expression, string targetVariable) +{ + string resultTypeName = $"Dictionary()}?>?"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" =\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + +void EvaluateStringExpression(StringExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "string?" : "string"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "string.Empty")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + if (expression.LiteralValue.Contains("\n")) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = \n \"\"\"\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n \"\"\";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) => + EvaluateValueExpression(expression, targetVariable); + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + +void EvaluateMessageTemplate(TemplateLine templateLine, string variableName) +{ + if (templateLine is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" =\n await context.FormatTemplateAsync(\n \"\"\""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + FormatMessageTemplate(templateLine); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n \"\"\");"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + +void FormatMessageTemplate(TemplateLine line) +{ + foreach (string text in line.ToTemplateString().ByLine()) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(text)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + + + #line default + #line hidden + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CreateConversationTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CreateConversationTemplate.tt new file mode 100644 index 0000000000..1e9cbaa6b2 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CreateConversationTemplate.tt @@ -0,0 +1,17 @@ +<#@ template language="C#" inherits="ActionTemplate" visibility="internal" #> +<#@ output extension=".cs" #> +<#@ assembly name="System.Core" #> +<#@ include file="Snippets/Index.tt" once="true" #> +/// +/// Creates a new conversation and stores the identifier value to the "<#= this.Model.ConversationId #>" variable. +/// +internal sealed class <#= this.Name #>Executor(FormulaSession session, WorkflowAgentProvider agentProvider) : ActionExecutor(id: "<#= this.Id #>", session) +{ + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string conversationId = await agentProvider.CreateConversationAsync(cancellationToken).ConfigureAwait(false);<# + AssignVariable(this.ConversationId, "conversationId"); + #> + return default; + } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CreateConversationTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CreateConversationTemplateCode.cs new file mode 100644 index 0000000000..d92cd5f4fc --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CreateConversationTemplateCode.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Bot.ObjectModel; +using Microsoft.Shared.Diagnostics; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class CreateConversationTemplate +{ + public CreateConversationTemplate(CreateConversation model) + { + this.Model = this.Initialize(model); + this.ConversationId = Throw.IfNull(this.Model.ConversationId); + this.UseAgentProvider = true; + } + + public CreateConversation Model { get; } + + public PropertyPath ConversationId { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/DefaultTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/DefaultTemplate.cs new file mode 100644 index 0000000000..02a28511a1 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/DefaultTemplate.cs @@ -0,0 +1,66 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Interpreter; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\DefaultTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class DefaultTemplate : ActionTemplate, IModeledAction + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\nDelegateExecutor "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\DefaultTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.InstanceVariable)); + + #line default + #line hidden + this.Write(" = new(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\DefaultTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write("\", "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\DefaultTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.RootVariable)); + + #line default + #line hidden + this.Write(".Session"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\DefaultTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Action is not null ? $", {this.Action}" : "")); + + #line default + #line hidden + this.Write(");\n"); + return this.GenerationEnvironment.ToString(); + } + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/DefaultTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/DefaultTemplate.tt new file mode 100644 index 0000000000..32c550ae07 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/DefaultTemplate.tt @@ -0,0 +1,4 @@ +<#@ template language="C#" inherits="ActionTemplate, IModeledAction" visibility="internal" #> +<#@ import namespace="Microsoft.Agents.AI.Workflows.Declarative.Interpreter" #> +<#@ assembly name="System.Core" #> +DelegateExecutor <#= this.InstanceVariable #> = new(id: "<#= this.Id #>", <#= this.RootVariable #>.Session<#= this.Action is not null ? $", {this.Action}" : "" #>); diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/DefaultTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/DefaultTemplateCode.cs new file mode 100644 index 0000000000..653af05c49 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/DefaultTemplateCode.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.Extensions; +using Microsoft.Bot.ObjectModel; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class DefaultTemplate +{ + public DefaultTemplate(DialogAction model, string rootId, string? action = null) + { + this.Initialize(model); + this.Action = action; + this.InstanceVariable = this.Id.FormatName(); + this.RootVariable = rootId.FormatName(); + } + + public string? Action { get; } + public string InstanceVariable { get; } + public string RootVariable { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EdgeTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EdgeTemplate.cs new file mode 100644 index 0000000000..16268eb331 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EdgeTemplate.cs @@ -0,0 +1,97 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\EdgeTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class EdgeTemplate : CodeTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\EdgeTemplate.tt" + if (this.Condition is not null) +{ + + #line default + #line hidden + this.Write("\n builder.AddEdge("); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\EdgeTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.SourceId)); + + #line default + #line hidden + this.Write(", "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\EdgeTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.TargetId)); + + #line default + #line hidden + this.Write(", (object? result) => "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\EdgeTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Condition)); + + #line default + #line hidden + this.Write(");"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\EdgeTemplate.tt" + +} +else +{ + + #line default + #line hidden + this.Write("\n builder.AddEdge("); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\EdgeTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.SourceId)); + + #line default + #line hidden + this.Write(", "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\EdgeTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.TargetId)); + + #line default + #line hidden + this.Write(");"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\EdgeTemplate.tt" + +} + + #line default + #line hidden + this.Write("\n"); + return this.GenerationEnvironment.ToString(); + } + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EdgeTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EdgeTemplate.tt new file mode 100644 index 0000000000..e76408e167 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EdgeTemplate.tt @@ -0,0 +1,10 @@ +<#@ template language="C#" inherits="CodeTemplate" visibility="internal" #> +<#@ assembly name="System.Core" #> +<# if (this.Condition is not null) +{#> + builder.AddEdge(<#= this.SourceId #>, <#= this.TargetId #>, (object? result) => <#= this.Condition #>);<# +} +else +{#> + builder.AddEdge(<#= this.SourceId #>, <#= this.TargetId #>);<# +} #> diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EdgeTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EdgeTemplateCode.cs new file mode 100644 index 0000000000..7e6c93b1ff --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EdgeTemplateCode.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class EdgeTemplate +{ + public EdgeTemplate(string sourceId, string targetId, string? condition = null) + { + this.SourceId = sourceId.FormatName(); + this.TargetId = targetId.FormatName(); + this.Condition = condition; + } + + public string SourceId { get; } + public string TargetId { get; } + public string? Condition { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EditTableV2Template.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EditTableV2Template.cs new file mode 100644 index 0000000000..f464e712e8 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EditTableV2Template.cs @@ -0,0 +1,2701 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; + using Microsoft.Bot.ObjectModel; + using Microsoft.Extensions.AI; + using System.Collections.Generic; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\EditTableV2Template.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class EditTableV2Template : ActionTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n/// \n/// Modify items in a list\n/// \ninternal sealed class "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\EditTableV2Template.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Name)); + + #line default + #line hidden + this.Write("Executor(FormulaSession session) : ActionExecutor(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\EditTableV2Template.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write("\", session)\n{\n // \n protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken)\n " + + " {\n return default;\n }\n}"); + return this.GenerationEnvironment.ToString(); + } + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + +void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false) +{ + if (targetVariable is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n await context.QueueStateUpdateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableName(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\", value: "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(valueVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableScope(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + + if (!tightFormat) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +} + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + +void EvaluateBoolExpression(BoolExpression expression, string targetVariable, bool defaultValue = false) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync>("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + +void EvaluateEnumExpression( + EnumExpression expression, + string targetVariable, + IDictionary resultMap, + string defaultValue = null, + bool qualifyResult = false, + bool isNullable = false) + where TWrapper : EnumWrapper +{ + string resultType = $"{GetTypeAlias()}{(isNullable ? "?" : "")}"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + resultMap.TryGetValue(expression.LiteralValue, out string resultValue); + if (qualifyResult) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("."); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(resultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + +void EvaluateIntExpression(IntExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "int?" : "int"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "0")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + +void EvaluateListExpression(ValueExpression expression, string targetVariable) +{ + string typeName = GetTypeAlias(); + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.ReadListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("> = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + +void EvaluateRecordExpression(ObjectExpression expression, string targetVariable) +{ + string resultTypeName = $"Dictionary()}?>?"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" =\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + +void EvaluateStringExpression(StringExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "string?" : "string"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "string.Empty")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + if (expression.LiteralValue.Contains("\n")) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = \n \"\"\"\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n \"\"\";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) => + EvaluateValueExpression(expression, targetVariable); + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + +void EvaluateMessageTemplate(TemplateLine templateLine, string variableName) +{ + if (templateLine is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" =\n await context.FormatTemplateAsync(\n \"\"\""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + FormatMessageTemplate(templateLine); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n \"\"\");"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + +void FormatMessageTemplate(TemplateLine line) +{ + foreach (string text in line.ToTemplateString().ByLine()) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(text)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + + + #line default + #line hidden + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EditTableV2Template.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EditTableV2Template.tt new file mode 100644 index 0000000000..58b25b9a74 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EditTableV2Template.tt @@ -0,0 +1,15 @@ +<#@ template language="C#" inherits="ActionTemplate" visibility="internal" #> +<#@ output extension=".cs" #> +<#@ assembly name="System.Core" #> +<#@ include file="Snippets/Index.tt" once="true" #> +/// +/// Modify items in a list +/// +internal sealed class <#= this.Name #>Executor(FormulaSession session) : ActionExecutor(id: "<#= this.Id #>", session) +{ + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + return default; + } +} \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EditTableV2TemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EditTableV2TemplateCode.cs new file mode 100644 index 0000000000..3cafad2433 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EditTableV2TemplateCode.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Bot.ObjectModel; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class EditTableV2Template +{ + public EditTableV2Template(EditTableV2 model) + { + this.Model = this.Initialize(model); + } + + public EditTableV2 Model { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EmptyTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EmptyTemplate.cs new file mode 100644 index 0000000000..8bbf0fdb33 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EmptyTemplate.cs @@ -0,0 +1,66 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Interpreter; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\EmptyTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class EmptyTemplate : CodeTemplate, IModeledAction + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\nDelegateExecutor "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\EmptyTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.InstanceVariable)); + + #line default + #line hidden + this.Write(" = new(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\EmptyTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write("\", "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\EmptyTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.RootVariable)); + + #line default + #line hidden + this.Write(".Session"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\EmptyTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Action is not null ? $", {this.Action}" : "")); + + #line default + #line hidden + this.Write(");\n"); + return this.GenerationEnvironment.ToString(); + } + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EmptyTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EmptyTemplate.tt new file mode 100644 index 0000000000..799e00f6b4 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EmptyTemplate.tt @@ -0,0 +1,4 @@ +<#@ template language="C#" inherits="CodeTemplate, IModeledAction" visibility="internal" #> +<#@ import namespace="Microsoft.Agents.AI.Workflows.Declarative.Interpreter" #> +<#@ assembly name="System.Core" #> +DelegateExecutor <#= this.InstanceVariable #> = new(id: "<#= this.Id #>", <#= this.RootVariable #>.Session<#= this.Action is not null ? $", {this.Action}" : "" #>); diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EmptyTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EmptyTemplateCode.cs new file mode 100644 index 0000000000..24f2064fbb --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EmptyTemplateCode.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class EmptyTemplate +{ + public EmptyTemplate(string actionId, string rootId, string? action = null) + { + this.Id = actionId; + this.Name = this.Id.FormatType(); + this.InstanceVariable = this.Id.FormatName(); + this.RootVariable = rootId.FormatName(); + this.Action = action; + } + + public string Id { get; } + public string Name { get; } + public string InstanceVariable { get; } + public string RootVariable { get; } + public string? Action { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ForeachTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ForeachTemplate.cs new file mode 100644 index 0000000000..9ba11d7a1e --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ForeachTemplate.cs @@ -0,0 +1,2782 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; + using Microsoft.Bot.ObjectModel; + using Microsoft.Extensions.AI; + using System.Collections.Generic; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ForeachTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class ForeachTemplate : ActionTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n/// \n/// Loops over a list assignign the loop variable to \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ForeachTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Model.Value)); + + #line default + #line hidden + this.Write("\" variable.\n/// \ninternal sealed class "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ForeachTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Name)); + + #line default + #line hidden + this.Write("Executor(FormulaSession session) : ActionExecutor(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ForeachTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write(@""", session) +{ + private int _index; + private object[] _values = []; + + public bool HasValue { get; private set; } + + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + this._index = 0;"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ForeachTemplate.tt" + + + EvaluateValueExpression(this.Model.Items, "evaluatedValue"); + + #line default + #line hidden + this.Write(@" + + if (evaluatedValue == null) + { + this._values = []; + this.HasValue = false; + } + else + if (evaluatedValue is IEnumerable evaluatedList) + { + this._values = [.. evaluatedList]; + } + else + { + this._values = [evaluatedValue]; + } + + await this.ResetAsync(context, null, cancellationToken).ConfigureAwait(false); + + return default; + } + + public async ValueTask TakeNextAsync(IWorkflowContext context, object? _, CancellationToken cancellationToken) + { + if (this.HasValue = this._index < this._values.Length) + { + object value = this._values[this._index]; + "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ForeachTemplate.tt" + + AssignVariable(this.Value, "value", tightFormat: true); + + if (this.Index is not null) + { + AssignVariable(this.Index, "this._index", tightFormat: true); + } + + + #line default + #line hidden + this.Write("\n\n this._index++;\n }\n }\n\n public async ValueTask ResetAsy" + + "nc(IWorkflowContext context, object? _, CancellationToken cancellationToken)\n " + + " {"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ForeachTemplate.tt" + + AssignVariable(this.Value, "UnassignedValue.Instance", tightFormat: true); + + if (this.Index is not null) + { + AssignVariable(this.Index, "UnassignedValue.Instance", tightFormat: true); + } + + + #line default + #line hidden + this.Write("\n }\n}"); + return this.GenerationEnvironment.ToString(); + } + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + +void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false) +{ + if (targetVariable is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n await context.QueueStateUpdateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableName(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\", value: "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(valueVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableScope(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + + if (!tightFormat) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +} + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + +void EvaluateBoolExpression(BoolExpression expression, string targetVariable, bool defaultValue = false) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync>("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + +void EvaluateEnumExpression( + EnumExpression expression, + string targetVariable, + IDictionary resultMap, + string defaultValue = null, + bool qualifyResult = false, + bool isNullable = false) + where TWrapper : EnumWrapper +{ + string resultType = $"{GetTypeAlias()}{(isNullable ? "?" : "")}"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + resultMap.TryGetValue(expression.LiteralValue, out string resultValue); + if (qualifyResult) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("."); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(resultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + +void EvaluateIntExpression(IntExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "int?" : "int"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "0")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + +void EvaluateListExpression(ValueExpression expression, string targetVariable) +{ + string typeName = GetTypeAlias(); + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.ReadListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("> = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + +void EvaluateRecordExpression(ObjectExpression expression, string targetVariable) +{ + string resultTypeName = $"Dictionary()}?>?"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" =\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + +void EvaluateStringExpression(StringExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "string?" : "string"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "string.Empty")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + if (expression.LiteralValue.Contains("\n")) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = \n \"\"\"\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n \"\"\";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) => + EvaluateValueExpression(expression, targetVariable); + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + +void EvaluateMessageTemplate(TemplateLine templateLine, string variableName) +{ + if (templateLine is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" =\n await context.FormatTemplateAsync(\n \"\"\""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + FormatMessageTemplate(templateLine); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n \"\"\");"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + +void FormatMessageTemplate(TemplateLine line) +{ + foreach (string text in line.ToTemplateString().ByLine()) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(text)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + + + #line default + #line hidden + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ForeachTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ForeachTemplate.tt new file mode 100644 index 0000000000..930641dc45 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ForeachTemplate.tt @@ -0,0 +1,70 @@ +<#@ template language="C#" inherits="ActionTemplate" visibility="internal" #> +<#@ output extension=".cs" #> +<#@ assembly name="System.Core" #> +<#@ include file="Snippets/Index.tt" once="true" #> +/// +/// Loops over a list assignign the loop variable to "<#= this.Model.Value #>" variable. +/// +internal sealed class <#= this.Name #>Executor(FormulaSession session) : ActionExecutor(id: "<#= this.Id #>", session) +{ + private int _index; + private object[] _values = []; + + public bool HasValue { get; private set; } + + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + this._index = 0;<# + + EvaluateValueExpression(this.Model.Items, "evaluatedValue");#> + + if (evaluatedValue == null) + { + this._values = []; + this.HasValue = false; + } + else + if (evaluatedValue is IEnumerable evaluatedList) + { + this._values = [.. evaluatedList]; + } + else + { + this._values = [evaluatedValue]; + } + + await this.ResetAsync(context, null, cancellationToken).ConfigureAwait(false); + + return default; + } + + public async ValueTask TakeNextAsync(IWorkflowContext context, object? _, CancellationToken cancellationToken) + { + if (this.HasValue = this._index < this._values.Length) + { + object value = this._values[this._index]; + <# + AssignVariable(this.Value, "value", tightFormat: true); + + if (this.Index is not null) + { + AssignVariable(this.Index, "this._index", tightFormat: true); + } + #> + + this._index++; + } + } + + public async ValueTask ResetAsync(IWorkflowContext context, object? _, CancellationToken cancellationToken) + {<# + AssignVariable(this.Value, "UnassignedValue.Instance", tightFormat: true); + + if (this.Index is not null) + { + AssignVariable(this.Index, "UnassignedValue.Instance", tightFormat: true); + } + #> + } +} \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ForeachTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ForeachTemplateCode.cs new file mode 100644 index 0000000000..cb9909382b --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ForeachTemplateCode.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Bot.ObjectModel; +using Microsoft.Shared.Diagnostics; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class ForeachTemplate +{ + public ForeachTemplate(Foreach model) + { + this.Model = this.Initialize(model); + this.Index = this.Model.Index?.Path; + this.Value = Throw.IfNull(this.Model.Value); + } + + public Foreach Model { get; } + public PropertyPath? Index { get; } + public PropertyPath Value { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InstanceTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InstanceTemplate.cs new file mode 100644 index 0000000000..8257ab46f9 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InstanceTemplate.cs @@ -0,0 +1,64 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\InstanceTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class InstanceTemplate : CodeTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\InstanceTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.ExecutorType)); + + #line default + #line hidden + this.Write("Executor "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\InstanceTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.InstanceVariable)); + + #line default + #line hidden + this.Write(" = new("); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\InstanceTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.RootVariable)); + + #line default + #line hidden + this.Write(".Session"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\InstanceTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.HasProvider ? ", options.AgentProvider" : "")); + + #line default + #line hidden + this.Write(");"); + return this.GenerationEnvironment.ToString(); + } + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InstanceTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InstanceTemplate.tt new file mode 100644 index 0000000000..d6602b308a --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InstanceTemplate.tt @@ -0,0 +1,3 @@ +<#@ template language="C#" inherits="CodeTemplate" visibility="internal" #> +<#@ assembly name="System.Core" #> +<#= this.ExecutorType #>Executor <#= this.InstanceVariable #> = new(<#= this.RootVariable #>.Session<#= this.HasProvider ? ", options.AgentProvider" : "" #>); \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InstanceTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InstanceTemplateCode.cs new file mode 100644 index 0000000000..0be236e824 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InstanceTemplateCode.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class InstanceTemplate +{ + public InstanceTemplate(string executorId, string rootId, bool hasProvider = false) + { + this.InstanceVariable = executorId.FormatName(); + this.ExecutorType = executorId.FormatType(); + this.RootVariable = rootId.FormatName(); + this.HasProvider = hasProvider; + } + + public string InstanceVariable { get; } + public string ExecutorType { get; } + public string RootVariable { get; } + public bool HasProvider { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InvokeAzureAgentTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InvokeAzureAgentTemplate.cs new file mode 100644 index 0000000000..a145a79e03 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InvokeAzureAgentTemplate.cs @@ -0,0 +1,2748 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; + using Microsoft.Bot.ObjectModel; + using Microsoft.Extensions.AI; + using System.Collections.Generic; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\InvokeAzureAgentTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class InvokeAzureAgentTemplate : ActionTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n/// \n/// Invokes an agent to process messages and return a response wit" + + "hin a conversation context.\n/// \ninternal sealed class "); + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\InvokeAzureAgentTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Name)); + + #line default + #line hidden + this.Write("Executor(FormulaSession session, WorkflowAgentProvider agentProvider) : AgentExec" + + "utor(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\InvokeAzureAgentTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write("\", session, agentProvider)\n{\n // \n protected override async V" + + "alueTask ExecuteAsync(IWorkflowContext context, CancellationToken cance" + + "llationToken)\n {"); + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\InvokeAzureAgentTemplate.tt" + + EvaluateStringExpression(this.Model.Agent.Name, "agentName", isNullable: true); + + #line default + #line hidden + this.Write("\n\n if (string.IsNullOrWhiteSpace(agentName))\n {\n throw n" + + "ew InvalidOperationException($\"Agent name must be defined: {this.Id}\");\n " + + "}\n "); + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\InvokeAzureAgentTemplate.tt" + + EvaluateStringExpression(this.Model.ConversationId, "conversationId", isNullable: true); + EvaluateBoolExpression(this.Model.Output?.AutoSend, "autoSend", defaultValue: true); + EvaluateMessageTemplate(this.Model.Input?.AdditionalInstructions, "additionalInstructions"); + EvaluateListExpression(this.Model.Input?.Messages, "inputMessages"); + + #line default + #line hidden + this.Write(@" + + AgentRunResponse agentResponse = + await InvokeAgentAsync( + context, + agentName, + conversationId, + autoSend, + additionalInstructions, + inputMessages, + cancellationToken).ConfigureAwait(false); + + if (autoSend) + { + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, agentResponse)).ConfigureAwait(false); + } + "); + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\InvokeAzureAgentTemplate.tt" + + AssignVariable(this.Messages, "agentResponse.Messages"); + + #line default + #line hidden + this.Write("\n return default;\n }\n}"); + return this.GenerationEnvironment.ToString(); + } + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + +void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false) +{ + if (targetVariable is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n await context.QueueStateUpdateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableName(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\", value: "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(valueVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableScope(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + + if (!tightFormat) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +} + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + +void EvaluateBoolExpression(BoolExpression expression, string targetVariable, bool defaultValue = false) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync>("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + +void EvaluateEnumExpression( + EnumExpression expression, + string targetVariable, + IDictionary resultMap, + string defaultValue = null, + bool qualifyResult = false, + bool isNullable = false) + where TWrapper : EnumWrapper +{ + string resultType = $"{GetTypeAlias()}{(isNullable ? "?" : "")}"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + resultMap.TryGetValue(expression.LiteralValue, out string resultValue); + if (qualifyResult) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("."); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(resultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + +void EvaluateIntExpression(IntExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "int?" : "int"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "0")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + +void EvaluateListExpression(ValueExpression expression, string targetVariable) +{ + string typeName = GetTypeAlias(); + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.ReadListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("> = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + +void EvaluateRecordExpression(ObjectExpression expression, string targetVariable) +{ + string resultTypeName = $"Dictionary()}?>?"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" =\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + +void EvaluateStringExpression(StringExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "string?" : "string"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "string.Empty")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + if (expression.LiteralValue.Contains("\n")) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = \n \"\"\"\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n \"\"\";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) => + EvaluateValueExpression(expression, targetVariable); + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + +void EvaluateMessageTemplate(TemplateLine templateLine, string variableName) +{ + if (templateLine is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" =\n await context.FormatTemplateAsync(\n \"\"\""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + FormatMessageTemplate(templateLine); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n \"\"\");"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + +void FormatMessageTemplate(TemplateLine line) +{ + foreach (string text in line.ToTemplateString().ByLine()) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(text)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + + + #line default + #line hidden + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InvokeAzureAgentTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InvokeAzureAgentTemplate.tt new file mode 100644 index 0000000000..bb5628d3aa --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InvokeAzureAgentTemplate.tt @@ -0,0 +1,43 @@ +<#@ template language="C#" inherits="ActionTemplate" visibility="internal" #> +<#@ output extension=".cs" #> +<#@ assembly name="System.Core" #> +<#@ include file="Snippets/Index.tt" once="true" #> +/// +/// Invokes an agent to process messages and return a response within a conversation context. +/// +internal sealed class <#= this.Name #>Executor(FormulaSession session, WorkflowAgentProvider agentProvider) : AgentExecutor(id: "<#= this.Id #>", session, agentProvider) +{ + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + {<# + EvaluateStringExpression(this.Model.Agent.Name, "agentName", isNullable: true);#> + + if (string.IsNullOrWhiteSpace(agentName)) + { + throw new InvalidOperationException($"Agent name must be defined: {this.Id}"); + } + <# + EvaluateStringExpression(this.Model.ConversationId, "conversationId", isNullable: true); + EvaluateBoolExpression(this.Model.Output?.AutoSend, "autoSend", defaultValue: true); + EvaluateMessageTemplate(this.Model.Input?.AdditionalInstructions, "additionalInstructions"); + EvaluateListExpression(this.Model.Input?.Messages, "inputMessages");#> + + AgentRunResponse agentResponse = + await InvokeAgentAsync( + context, + agentName, + conversationId, + autoSend, + additionalInstructions, + inputMessages, + cancellationToken).ConfigureAwait(false); + + if (autoSend) + { + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, agentResponse)).ConfigureAwait(false); + } + <# + AssignVariable(this.Messages, "agentResponse.Messages"); #> + return default; + } +} \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InvokeAzureAgentTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InvokeAzureAgentTemplateCode.cs new file mode 100644 index 0000000000..038cba1cde --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InvokeAzureAgentTemplateCode.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Bot.ObjectModel; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class InvokeAzureAgentTemplate +{ + public InvokeAzureAgentTemplate(InvokeAzureAgent model) + { + this.Model = this.Initialize(model); + this.Messages = this.Model.Output?.Messages?.Path; + this.UseAgentProvider = true; + } + + public InvokeAzureAgent Model { get; } + + public PropertyPath? Messages { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ParseValueTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ParseValueTemplate.cs new file mode 100644 index 0000000000..e4bf72a90b --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ParseValueTemplate.cs @@ -0,0 +1,2777 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; + using Microsoft.Bot.ObjectModel; + using Microsoft.Extensions.AI; + using System.Collections.Generic; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ParseValueTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class ParseValueTemplate : ActionTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n/// \n/// Parses a string or untyped value to the provided data type. Wh" + + "en the input is a string, it will be treated as JSON.\n/// \ninternal se" + + "aled class "); + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ParseValueTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Name)); + + #line default + #line hidden + this.Write("Executor(FormulaSession session) : ActionExecutor(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ParseValueTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write("\", session)\n{\n // \n protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken)\n " + + " { \n VariableType targetType = "); + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ParseValueTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.GetVariableType())); + + #line default + #line hidden + this.Write(";"); + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ParseValueTemplate.tt" + +if (this.Model.Value.IsVariableReference && this.Model.Value.VariableReference.SegmentCount == 2) +{ + + #line default + #line hidden + this.Write("\n object? parsedValue = await context.ConvertValueAsync(targetType, key: \"" + + ""); + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ParseValueTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Model.Value.VariableReference.VariableName)); + + #line default + #line hidden + this.Write("\", scopeName: \""); + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ParseValueTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Model.Value.VariableReference.NamespaceAlias)); + + #line default + #line hidden + this.Write("\", cancellationToken).ConfigureAwait(false);"); + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ParseValueTemplate.tt" + +} +else if (this.Model.Value.IsVariableReference) +{ + + #line default + #line hidden + this.Write("\n object? parsedValue = await context.ConvertValueAsync(targetType, "); + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ParseValueTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(this.Model.Value.VariableReference.ToString()))); + + #line default + #line hidden + this.Write(", cancellationToken).ConfigureAwait(false);"); + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ParseValueTemplate.tt" + +} +else +{ + + #line default + #line hidden + this.Write("\n object? parsedValue = await context.ConvertValueAsync(targetType, "); + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ParseValueTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(this.Model.Value.ExpressionText))); + + #line default + #line hidden + this.Write(", cancellationToken).ConfigureAwait(false);"); + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ParseValueTemplate.tt" + +} + AssignVariable(this.Variable, "parsedValue"); + + #line default + #line hidden + this.Write("\n return default;\n }\n}"); + return this.GenerationEnvironment.ToString(); + } + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + +void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false) +{ + if (targetVariable is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n await context.QueueStateUpdateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableName(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\", value: "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(valueVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableScope(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + + if (!tightFormat) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +} + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + +void EvaluateBoolExpression(BoolExpression expression, string targetVariable, bool defaultValue = false) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync>("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + +void EvaluateEnumExpression( + EnumExpression expression, + string targetVariable, + IDictionary resultMap, + string defaultValue = null, + bool qualifyResult = false, + bool isNullable = false) + where TWrapper : EnumWrapper +{ + string resultType = $"{GetTypeAlias()}{(isNullable ? "?" : "")}"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + resultMap.TryGetValue(expression.LiteralValue, out string resultValue); + if (qualifyResult) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("."); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(resultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + +void EvaluateIntExpression(IntExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "int?" : "int"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "0")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + +void EvaluateListExpression(ValueExpression expression, string targetVariable) +{ + string typeName = GetTypeAlias(); + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.ReadListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("> = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + +void EvaluateRecordExpression(ObjectExpression expression, string targetVariable) +{ + string resultTypeName = $"Dictionary()}?>?"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" =\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + +void EvaluateStringExpression(StringExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "string?" : "string"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "string.Empty")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + if (expression.LiteralValue.Contains("\n")) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = \n \"\"\"\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n \"\"\";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) => + EvaluateValueExpression(expression, targetVariable); + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + +void EvaluateMessageTemplate(TemplateLine templateLine, string variableName) +{ + if (templateLine is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" =\n await context.FormatTemplateAsync(\n \"\"\""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + FormatMessageTemplate(templateLine); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n \"\"\");"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + +void FormatMessageTemplate(TemplateLine line) +{ + foreach (string text in line.ToTemplateString().ByLine()) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(text)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af4\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + + + #line default + #line hidden + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ParseValueTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ParseValueTemplate.tt new file mode 100644 index 0000000000..7db7053a43 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ParseValueTemplate.tt @@ -0,0 +1,29 @@ +<#@ template language="C#" inherits="ActionTemplate" visibility="internal" #> +<#@ output extension=".cs" #> +<#@ assembly name="System.Core" #> +<#@ include file="Snippets/Index.tt" once="true" #> +/// +/// Parses a string or untyped value to the provided data type. When the input is a string, it will be treated as JSON. +/// +internal sealed class <#= this.Name #>Executor(FormulaSession session) : ActionExecutor(id: "<#= this.Id #>", session) +{ + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + VariableType targetType = <#= this.GetVariableType() #>;<# +if (this.Model.Value.IsVariableReference && this.Model.Value.VariableReference.SegmentCount == 2) +{#> + object? parsedValue = await context.ConvertValueAsync(targetType, key: "<#= this.Model.Value.VariableReference.VariableName #>", scopeName: "<#= this.Model.Value.VariableReference.NamespaceAlias #>", cancellationToken).ConfigureAwait(false);<# +} +else if (this.Model.Value.IsVariableReference) +{#> + object? parsedValue = await context.ConvertValueAsync(targetType, <#= FormatStringValue(this.Model.Value.VariableReference.ToString()) #>, cancellationToken).ConfigureAwait(false);<# +} +else +{#> + object? parsedValue = await context.ConvertValueAsync(targetType, <#= FormatStringValue(this.Model.Value.ExpressionText) #>, cancellationToken).ConfigureAwait(false);<# +} + AssignVariable(this.Variable, "parsedValue"); #> + return default; + } +} \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ParseValueTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ParseValueTemplateCode.cs new file mode 100644 index 0000000000..750ba7bbc5 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ParseValueTemplateCode.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System.Linq; +using Microsoft.Bot.ObjectModel; +using Microsoft.Shared.Diagnostics; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class ParseValueTemplate +{ + public ParseValueTemplate(ParseValue model) + { + this.Model = this.Initialize(model); + this.Variable = Throw.IfNull(this.Model.Variable); + } + + public ParseValue Model { get; } + public PropertyPath Variable { get; } + + private string GetVariableType() + { + return GetVariableType(this.Model.ValueType); + + static string GetVariableType(DataType? dataType) => + dataType switch + { + null => "null", + StringDataType => "typeof(string)", + BooleanDataType => "typeof(bool)", + FloatDataType => "typeof(double)", + NumberDataType => "typeof(decimal)", + DateTimeDataType => "typeof(DateTime)", + DateDataType => "typeof(DateTime)", + TimeDataType => "typeof(TimeSpan)", + RecordDataType recordType => $"\nVariableType.Record(\n{string.Join(",\n ", recordType.Properties.Select(property => @$"( ""{property.Key}"", {GetVariableType(property.Value.Type)} )"))})", + TableDataType tableType => $"\nVariableType.Record(\n{string.Join(",\n ", tableType.Properties.Select(property => @$"( ""{property.Key}"", {GetVariableType(property.Value.Type)} )"))})", + _ => throw new DeclarativeModelException($"Unsupported data type: {dataType}"), + }; + } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ProviderTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ProviderTemplate.cs new file mode 100644 index 0000000000..30a3fc1bb9 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ProviderTemplate.cs @@ -0,0 +1,203 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ProviderTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class ProviderTemplate : CodeTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write(@" +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; +"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ProviderTemplate.tt" + +if (this.Namespace is not null) +{ + + #line default + #line hidden + this.Write("\nnamespace "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ProviderTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Namespace)); + + #line default + #line hidden + this.Write(";\n"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ProviderTemplate.tt" + +} + + + #line default + #line hidden + this.Write(@" +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ProviderTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Prefix ?? string.Empty)); + + #line default + #line hidden + this.Write("WorkflowProvider\n{"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ProviderTemplate.tt" + +foreach (string executor in ByLine(this.Executors, formatGroup: true)) +{ + + #line default + #line hidden + this.Write("\n "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ProviderTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(executor)); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ProviderTemplate.tt" + +} + + + #line default + #line hidden + this.Write(@" + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ProviderTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.RootExecutorType)); + + #line default + #line hidden + this.Write("Executor "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ProviderTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.RootInstance)); + + #line default + #line hidden + this.Write(" = new(options, inputTransform);"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ProviderTemplate.tt" + + + // Create executor instances +foreach (string instance in ByLine(this.Instances)) +{ + + #line default + #line hidden + this.Write("\n "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ProviderTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(instance)); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ProviderTemplate.tt" + +} + + #line default + #line hidden + this.Write("\n\n // Define the workflow builder\n WorkflowBuilder builder = new("); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ProviderTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.RootInstance)); + + #line default + #line hidden + this.Write(");\n\n // Connect executors"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ProviderTemplate.tt" + +foreach (string edge in ByLine(this.Edges)) +{ + + #line default + #line hidden + this.Write("\n "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ProviderTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(edge)); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ProviderTemplate.tt" + +} + + + #line default + #line hidden + this.Write("\n\n // Build the workflow\n return builder.Build();\n }\n}\n"); + return this.GenerationEnvironment.ToString(); + } + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ProviderTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ProviderTemplate.tt new file mode 100644 index 0000000000..4244ea820b --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ProviderTemplate.tt @@ -0,0 +1,75 @@ +<#@ template language="C#" inherits="CodeTemplate" visibility="internal" #> +<#@ import namespace="Microsoft.Agents.AI.Workflows.Declarative.Extensions" #> +<#@ assembly name="System.Core" #> +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; +<# +if (this.Namespace is not null) +{#> +namespace <#= this.Namespace #>; +<# +} +#> +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class <#= this.Prefix ?? string.Empty #>WorkflowProvider +{<# +foreach (string executor in ByLine(this.Executors, formatGroup: true)) +{ #> + <#= executor #><# +} +#> + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + <#= this.RootExecutorType #>Executor <#= this.RootInstance #> = new(options, inputTransform);<# + + // Create executor instances +foreach (string instance in ByLine(this.Instances)) +{ #> + <#= instance #><# +}#> + + // Define the workflow builder + WorkflowBuilder builder = new(<#= this.RootInstance #>); + + // Connect executors<# +foreach (string edge in ByLine(this.Edges)) +{ #> + <#= edge #><# +} + #> + + // Build the workflow + return builder.Build(); + } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ProviderTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ProviderTemplateCode.cs new file mode 100644 index 0000000000..d07f0bf8d1 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ProviderTemplateCode.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System.Collections.Generic; +using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class ProviderTemplate +{ + public ProviderTemplate( + string workflowId, + IEnumerable executors, + IEnumerable instances, + IEnumerable edges) + { + this.Executors = executors; + this.Instances = instances; + this.Edges = edges; + this.RootInstance = workflowId.FormatName(); + this.RootExecutorType = workflowId.FormatType(); + } + + public string? Namespace { get; init; } + public string? Prefix { get; init; } + + public string RootInstance { get; } + public string RootExecutorType { get; } + + public IEnumerable Executors { get; } + public IEnumerable Instances { get; } + public IEnumerable Edges { get; } + + public static IEnumerable ByLine(IEnumerable templates, bool formatGroup = false) + { + foreach (string template in templates) + { + foreach (string line in template.ByLine()) + { + yield return line; + } + + if (formatGroup) + { + yield return string.Empty; + } + } + } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/QuestionTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/QuestionTemplate.cs new file mode 100644 index 0000000000..3c506c5562 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/QuestionTemplate.cs @@ -0,0 +1,2701 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; + using Microsoft.Bot.ObjectModel; + using Microsoft.Extensions.AI; + using System.Collections.Generic; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\QuestionTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class QuestionTemplate : ActionTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n/// \n/// Request input.\n/// \ninternal sealed class "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\QuestionTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Name)); + + #line default + #line hidden + this.Write("Executor(FormulaSession session) : ActionExecutor(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\QuestionTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write("\", session)\n{\n // \n protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken)\n " + + " {\n return default;\n }\n}"); + return this.GenerationEnvironment.ToString(); + } + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + +void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false) +{ + if (targetVariable is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n await context.QueueStateUpdateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableName(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\", value: "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(valueVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableScope(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + + if (!tightFormat) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +} + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + +void EvaluateBoolExpression(BoolExpression expression, string targetVariable, bool defaultValue = false) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync>("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + +void EvaluateEnumExpression( + EnumExpression expression, + string targetVariable, + IDictionary resultMap, + string defaultValue = null, + bool qualifyResult = false, + bool isNullable = false) + where TWrapper : EnumWrapper +{ + string resultType = $"{GetTypeAlias()}{(isNullable ? "?" : "")}"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + resultMap.TryGetValue(expression.LiteralValue, out string resultValue); + if (qualifyResult) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("."); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(resultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + +void EvaluateIntExpression(IntExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "int?" : "int"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "0")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + +void EvaluateListExpression(ValueExpression expression, string targetVariable) +{ + string typeName = GetTypeAlias(); + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.ReadListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("> = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + +void EvaluateRecordExpression(ObjectExpression expression, string targetVariable) +{ + string resultTypeName = $"Dictionary()}?>?"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" =\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + +void EvaluateStringExpression(StringExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "string?" : "string"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "string.Empty")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + if (expression.LiteralValue.Contains("\n")) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = \n \"\"\"\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n \"\"\";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) => + EvaluateValueExpression(expression, targetVariable); + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + +void EvaluateMessageTemplate(TemplateLine templateLine, string variableName) +{ + if (templateLine is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" =\n await context.FormatTemplateAsync(\n \"\"\""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + FormatMessageTemplate(templateLine); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n \"\"\");"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + +void FormatMessageTemplate(TemplateLine line) +{ + foreach (string text in line.ToTemplateString().ByLine()) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(text)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + + + #line default + #line hidden + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/QuestionTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/QuestionTemplate.tt new file mode 100644 index 0000000000..bf2d4ae74b --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/QuestionTemplate.tt @@ -0,0 +1,15 @@ +<#@ template language="C#" inherits="ActionTemplate" visibility="internal" #> +<#@ output extension=".cs" #> +<#@ assembly name="System.Core" #> +<#@ include file="Snippets/Index.tt" once="true" #> +/// +/// Request input. +/// +internal sealed class <#= this.Name #>Executor(FormulaSession session) : ActionExecutor(id: "<#= this.Id #>", session) +{ + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + return default; + } +} \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/QuestionTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/QuestionTemplateCode.cs new file mode 100644 index 0000000000..c3d302ea23 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/QuestionTemplateCode.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Bot.ObjectModel; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class QuestionTemplate +{ + public QuestionTemplate(Question model) + { + this.Model = this.Initialize(model); + } + + public Question Model { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ResetVariableTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ResetVariableTemplate.cs new file mode 100644 index 0000000000..da7c93b23a --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ResetVariableTemplate.cs @@ -0,0 +1,2717 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; + using Microsoft.Bot.ObjectModel; + using Microsoft.Extensions.AI; + using System.Collections.Generic; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ResetVariableTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class ResetVariableTemplate : ActionTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n/// \n/// Resets the value of the \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ResetVariableTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Model.Variable)); + + #line default + #line hidden + this.Write("\" variable, potentially causing re-evaluation \n/// of the default value, question" + + " or action that provides the value to this variable.\n/// \ninternal sea" + + "led class "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ResetVariableTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Name)); + + #line default + #line hidden + this.Write("Executor(FormulaSession session) : ActionExecutor(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ResetVariableTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write("\", session)\n{\n protected override async ValueTask ExecuteAsync(IWorkf" + + "lowContext context, CancellationToken cancellationToken)\n {"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\ResetVariableTemplate.tt" + + AssignVariable(this.Variable, "UnassignedValue.Instance"); + + #line default + #line hidden + this.Write("\n return default;\n }\n}"); + return this.GenerationEnvironment.ToString(); + } + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + +void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false) +{ + if (targetVariable is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n await context.QueueStateUpdateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableName(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\", value: "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(valueVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableScope(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + + if (!tightFormat) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +} + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + +void EvaluateBoolExpression(BoolExpression expression, string targetVariable, bool defaultValue = false) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync>("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + +void EvaluateEnumExpression( + EnumExpression expression, + string targetVariable, + IDictionary resultMap, + string defaultValue = null, + bool qualifyResult = false, + bool isNullable = false) + where TWrapper : EnumWrapper +{ + string resultType = $"{GetTypeAlias()}{(isNullable ? "?" : "")}"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + resultMap.TryGetValue(expression.LiteralValue, out string resultValue); + if (qualifyResult) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("."); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(resultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + +void EvaluateIntExpression(IntExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "int?" : "int"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "0")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + +void EvaluateListExpression(ValueExpression expression, string targetVariable) +{ + string typeName = GetTypeAlias(); + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.ReadListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("> = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + +void EvaluateRecordExpression(ObjectExpression expression, string targetVariable) +{ + string resultTypeName = $"Dictionary()}?>?"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" =\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + +void EvaluateStringExpression(StringExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "string?" : "string"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "string.Empty")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + if (expression.LiteralValue.Contains("\n")) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = \n \"\"\"\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n \"\"\";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) => + EvaluateValueExpression(expression, targetVariable); + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + +void EvaluateMessageTemplate(TemplateLine templateLine, string variableName) +{ + if (templateLine is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" =\n await context.FormatTemplateAsync(\n \"\"\""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + FormatMessageTemplate(templateLine); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n \"\"\");"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + +void FormatMessageTemplate(TemplateLine line) +{ + foreach (string text in line.ToTemplateString().ByLine()) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(text)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + + + #line default + #line hidden + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ResetVariableTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ResetVariableTemplate.tt new file mode 100644 index 0000000000..ef974b10eb --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ResetVariableTemplate.tt @@ -0,0 +1,16 @@ +<#@ template language="C#" inherits="ActionTemplate" visibility="internal" #> +<#@ output extension=".cs" #> +<#@ assembly name="System.Core" #> +<#@ include file="Snippets/Index.tt" once="true" #> +/// +/// Resets the value of the "<#= this.Model.Variable #>" variable, potentially causing re-evaluation +/// of the default value, question or action that provides the value to this variable. +/// +internal sealed class <#= this.Name #>Executor(FormulaSession session) : ActionExecutor(id: "<#= this.Id #>", session) +{ + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + {<# + AssignVariable(this.Variable, "UnassignedValue.Instance"); #> + return default; + } +} \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ResetVariableTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ResetVariableTemplateCode.cs new file mode 100644 index 0000000000..314d02dacd --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ResetVariableTemplateCode.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Bot.ObjectModel; +using Microsoft.Shared.Diagnostics; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class ResetVariableTemplate +{ + public ResetVariableTemplate(ResetVariable model) + { + this.Model = this.Initialize(model); + this.Variable = Throw.IfNull(this.Model.Variable); + } + + public ResetVariable Model { get; } + + public PropertyPath Variable { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessageTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessageTemplate.cs new file mode 100644 index 0000000000..1bb397766c --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessageTemplate.cs @@ -0,0 +1,2722 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; + using Microsoft.Bot.ObjectModel; + using Microsoft.Extensions.AI; + using System.Collections.Generic; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RetrieveConversationMessageTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class RetrieveConversationMessageTemplate : ActionTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n/// \n/// Retrieves a list of messages from an agent conversation.\n/// <" + + "/summary>\ninternal sealed class "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RetrieveConversationMessageTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Name)); + + #line default + #line hidden + this.Write("Executor(FormulaSession session, WorkflowAgentProvider agentProvider) : ActionExe" + + "cutor(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RetrieveConversationMessageTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write("\", session)\n{\n // \n protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken)\n " + + " {"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RetrieveConversationMessageTemplate.tt" + + EvaluateStringExpression(this.Model.ConversationId, "conversationId"); + EvaluateStringExpression(this.Model.MessageId, "messageId"); + + #line default + #line hidden + this.Write("\n ChatMessage message = await agentProvider.GetMessageAsync(conversationId" + + ", messageId, cancellationToken).ConfigureAwait(false);"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RetrieveConversationMessageTemplate.tt" + + AssignVariable(this.Model.Message, "message"); + + + #line default + #line hidden + this.Write("\n return default;\n }\n}"); + return this.GenerationEnvironment.ToString(); + } + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + +void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false) +{ + if (targetVariable is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n await context.QueueStateUpdateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableName(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\", value: "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(valueVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableScope(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + + if (!tightFormat) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +} + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + +void EvaluateBoolExpression(BoolExpression expression, string targetVariable, bool defaultValue = false) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync>("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + +void EvaluateEnumExpression( + EnumExpression expression, + string targetVariable, + IDictionary resultMap, + string defaultValue = null, + bool qualifyResult = false, + bool isNullable = false) + where TWrapper : EnumWrapper +{ + string resultType = $"{GetTypeAlias()}{(isNullable ? "?" : "")}"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + resultMap.TryGetValue(expression.LiteralValue, out string resultValue); + if (qualifyResult) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("."); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(resultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + +void EvaluateIntExpression(IntExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "int?" : "int"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "0")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + +void EvaluateListExpression(ValueExpression expression, string targetVariable) +{ + string typeName = GetTypeAlias(); + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.ReadListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("> = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + +void EvaluateRecordExpression(ObjectExpression expression, string targetVariable) +{ + string resultTypeName = $"Dictionary()}?>?"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" =\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + +void EvaluateStringExpression(StringExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "string?" : "string"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "string.Empty")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + if (expression.LiteralValue.Contains("\n")) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = \n \"\"\"\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n \"\"\";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) => + EvaluateValueExpression(expression, targetVariable); + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + +void EvaluateMessageTemplate(TemplateLine templateLine, string variableName) +{ + if (templateLine is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" =\n await context.FormatTemplateAsync(\n \"\"\""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + FormatMessageTemplate(templateLine); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n \"\"\");"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + +void FormatMessageTemplate(TemplateLine line) +{ + foreach (string text in line.ToTemplateString().ByLine()) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(text)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + + + #line default + #line hidden + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessageTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessageTemplate.tt new file mode 100644 index 0000000000..16bfb17276 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessageTemplate.tt @@ -0,0 +1,20 @@ +<#@ template language="C#" inherits="ActionTemplate" visibility="internal" #> +<#@ output extension=".cs" #> +<#@ assembly name="System.Core" #> +<#@ include file="Snippets/Index.tt" once="true" #> +/// +/// Retrieves a list of messages from an agent conversation. +/// +internal sealed class <#= this.Name #>Executor(FormulaSession session, WorkflowAgentProvider agentProvider) : ActionExecutor(id: "<#= this.Id #>", session) +{ + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + {<# + EvaluateStringExpression(this.Model.ConversationId, "conversationId"); + EvaluateStringExpression(this.Model.MessageId, "messageId"); #> + ChatMessage message = await agentProvider.GetMessageAsync(conversationId, messageId, cancellationToken).ConfigureAwait(false);<# + AssignVariable(this.Model.Message, "message"); + #> + return default; + } +} \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessageTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessageTemplateCode.cs new file mode 100644 index 0000000000..ad85c91e71 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessageTemplateCode.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Bot.ObjectModel; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class RetrieveConversationMessageTemplate +{ + public RetrieveConversationMessageTemplate(RetrieveConversationMessage model) + { + this.Model = this.Initialize(model); + this.UseAgentProvider = true; + } + + public RetrieveConversationMessage Model { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessagesTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessagesTemplate.cs new file mode 100644 index 0000000000..244b7d7d83 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessagesTemplate.cs @@ -0,0 +1,2732 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; + using Microsoft.Bot.ObjectModel; + using Microsoft.Extensions.AI; + using System.Collections.Generic; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RetrieveConversationMessagesTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class RetrieveConversationMessagesTemplate : ActionTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("f\n/// \n/// Retrieves a specific message from an agent conversation.\n/// " + + "\ninternal sealed class "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RetrieveConversationMessagesTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Name)); + + #line default + #line hidden + this.Write("Executor(FormulaSession session, WorkflowAgentProvider agentProvider) : ActionExe" + + "cutor(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RetrieveConversationMessagesTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write("\", session)\n{\n // \n protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken)\n " + + " {"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RetrieveConversationMessagesTemplate.tt" + + EvaluateStringExpression(this.Model.ConversationId, "conversationId"); + EvaluateIntExpression(this.Model.Limit, "limit"); + EvaluateStringExpression(this.Model.MessageAfter, "after", isNullable: true); + EvaluateStringExpression(this.Model.MessageBefore, "before", isNullable: true); + EvaluateEnumExpression(this.Model.SortOrder, "newestFirst", SortMap, defaultValue: DefaultSort); + + #line default + #line hidden + this.Write(@" + ChatMessage messages = + await agentProvider.GetMessageAsync( + converationId, + limit, + after, + before, + newestFirst, + cancellationToken).ConfigureAwait(false);"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RetrieveConversationMessagesTemplate.tt" + + AssignVariable(this.Model.Messages, "messages"); + + + #line default + #line hidden + this.Write("\n return default;\n }\n}"); + return this.GenerationEnvironment.ToString(); + } + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + +void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false) +{ + if (targetVariable is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n await context.QueueStateUpdateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableName(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\", value: "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(valueVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableScope(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + + if (!tightFormat) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +} + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + +void EvaluateBoolExpression(BoolExpression expression, string targetVariable, bool defaultValue = false) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync>("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + +void EvaluateEnumExpression( + EnumExpression expression, + string targetVariable, + IDictionary resultMap, + string defaultValue = null, + bool qualifyResult = false, + bool isNullable = false) + where TWrapper : EnumWrapper +{ + string resultType = $"{GetTypeAlias()}{(isNullable ? "?" : "")}"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + resultMap.TryGetValue(expression.LiteralValue, out string resultValue); + if (qualifyResult) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("."); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(resultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + +void EvaluateIntExpression(IntExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "int?" : "int"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "0")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + +void EvaluateListExpression(ValueExpression expression, string targetVariable) +{ + string typeName = GetTypeAlias(); + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.ReadListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("> = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + +void EvaluateRecordExpression(ObjectExpression expression, string targetVariable) +{ + string resultTypeName = $"Dictionary()}?>?"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" =\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + +void EvaluateStringExpression(StringExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "string?" : "string"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "string.Empty")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + if (expression.LiteralValue.Contains("\n")) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = \n \"\"\"\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n \"\"\";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) => + EvaluateValueExpression(expression, targetVariable); + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + +void EvaluateMessageTemplate(TemplateLine templateLine, string variableName) +{ + if (templateLine is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" =\n await context.FormatTemplateAsync(\n \"\"\""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + FormatMessageTemplate(templateLine); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n \"\"\");"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + +void FormatMessageTemplate(TemplateLine line) +{ + foreach (string text in line.ToTemplateString().ByLine()) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(text)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + + + #line default + #line hidden + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessagesTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessagesTemplate.tt new file mode 100644 index 0000000000..e8dad974ac --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessagesTemplate.tt @@ -0,0 +1,30 @@ +<#@ template language="C#" inherits="ActionTemplate" visibility="internal" #> +<#@ output extension=".cs" #> +<#@ assembly name="System.Core" #> +<#@ include file="Snippets/Index.tt" once="true" #>f +/// +/// Retrieves a specific message from an agent conversation. +/// +internal sealed class <#= this.Name #>Executor(FormulaSession session, WorkflowAgentProvider agentProvider) : ActionExecutor(id: "<#= this.Id #>", session) +{ + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + {<# + EvaluateStringExpression(this.Model.ConversationId, "conversationId"); + EvaluateIntExpression(this.Model.Limit, "limit"); + EvaluateStringExpression(this.Model.MessageAfter, "after", isNullable: true); + EvaluateStringExpression(this.Model.MessageBefore, "before", isNullable: true); + EvaluateEnumExpression(this.Model.SortOrder, "newestFirst", SortMap, defaultValue: DefaultSort); #> + ChatMessage messages = + await agentProvider.GetMessageAsync( + converationId, + limit, + after, + before, + newestFirst, + cancellationToken).ConfigureAwait(false);<# + AssignVariable(this.Model.Messages, "messages"); + #> + return default; + } +} \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessagesTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessagesTemplateCode.cs new file mode 100644 index 0000000000..3cedb86181 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessagesTemplateCode.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System.Collections.Frozen; +using System.Collections.Generic; +using Microsoft.Bot.ObjectModel; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class RetrieveConversationMessagesTemplate +{ + public RetrieveConversationMessagesTemplate(RetrieveConversationMessages model) + { + this.Model = this.Initialize(model); + this.UseAgentProvider = true; + } + + public RetrieveConversationMessages Model { get; } + + public const string DefaultSort = "false"; + + public static readonly FrozenDictionary SortMap = + new Dictionary() + { + [AgentMessageSortOrderWrapper.Get(AgentMessageSortOrder.NewestFirst)] = "true", + [AgentMessageSortOrderWrapper.Get(AgentMessageSortOrder.OldestFirst)] = "false", + }.ToFrozenDictionary(); +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RootTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RootTemplate.cs new file mode 100644 index 0000000000..ca84ce6360 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RootTemplate.cs @@ -0,0 +1,145 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using Microsoft.Agents.AI.Workflows.Declarative.Interpreter; + using Microsoft.Bot.ObjectModel; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RootTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class RootTemplate : CodeTemplate, IModeledAction + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n/// \n/// The root executor for a declarative workflow.\n/// \ni" + + "nternal sealed class "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RootTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.TypeName)); + + #line default + #line hidden + this.Write("Executor(\n DeclarativeWorkflowOptions options,\n Func inputTransform) :\n RootExecutor(\""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RootTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write("\", options, inputTransform)\n where TInput : notnull\n{\n protected override a" + + "sync ValueTask ExecuteAsync(TInput message, IWorkflowContext context, Cancellati" + + "onToken cancellationToken)\n {"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RootTemplate.tt" + +if (this.TypeInfo.EnvironmentVariables.Count > 0) +{ + + #line default + #line hidden + this.Write("\n // Set environment variables\n await this.InitializeEnvironmentAsy" + + "nc(\n context,"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RootTemplate.tt" + + int index = this.TypeInfo.EnvironmentVariables.Count - 1; + foreach (string variableName in this.TypeInfo.EnvironmentVariables) + { + + #line default + #line hidden + this.Write("\n \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RootTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + #line default + #line hidden + this.Write("\""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RootTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(index > 0 ? "," : "")); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RootTemplate.tt" + + --index; + } + + #line default + #line hidden + this.Write(").ConfigureAwait(false);\n"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RootTemplate.tt" +} + +if (this.TypeInfo.UserVariables.Count > 0) +{ + + + #line default + #line hidden + this.Write("\n // Initialize variables"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RootTemplate.tt" + + foreach (VariableInformationDiagnostic variableInfo in this.TypeInfo.UserVariables) + { + + #line default + #line hidden + this.Write("\n await context.QueueStateUpdateAsync(\""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RootTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(variableInfo.Path.VariableName)); + + #line default + #line hidden + this.Write("\", UnassignedValue.Instance, \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RootTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(variableInfo.Path.NamespaceAlias)); + + #line default + #line hidden + this.Write("\").ConfigureAwait(false);"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\RootTemplate.tt" + + } +} + + #line default + #line hidden + this.Write("\n }\n}\n"); + return this.GenerationEnvironment.ToString(); + } + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RootTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RootTemplate.tt new file mode 100644 index 0000000000..d1b70f89e7 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RootTemplate.tt @@ -0,0 +1,40 @@ +<#@ template language="C#" inherits="CodeTemplate, IModeledAction" visibility="internal" #> +<#@ import namespace="Microsoft.Agents.AI.Workflows.Declarative.Extensions" #> +<#@ import namespace="Microsoft.Agents.AI.Workflows.Declarative.Interpreter" #> +<#@ import namespace="Microsoft.Bot.ObjectModel" #> +<#@ assembly name="System.Core" #> +/// +/// The root executor for a declarative workflow. +/// +internal sealed class <#= this.TypeName #>Executor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("<#= this.Id #>", options, inputTransform) + where TInput : notnull +{ + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + {<# +if (this.TypeInfo.EnvironmentVariables.Count > 0) +{ #> + // Set environment variables + await this.InitializeEnvironmentAsync( + context,<# + int index = this.TypeInfo.EnvironmentVariables.Count - 1; + foreach (string variableName in this.TypeInfo.EnvironmentVariables) + {#> + "<#= variableName #>"<#= index > 0 ? "," : "" #><# + --index; + }#>).ConfigureAwait(false); +<#} + +if (this.TypeInfo.UserVariables.Count > 0) +{ +#> + // Initialize variables<# + foreach (VariableInformationDiagnostic variableInfo in this.TypeInfo.UserVariables) + {#> + await context.QueueStateUpdateAsync("<#= variableInfo.Path.VariableName #>", UnassignedValue.Instance, "<#= variableInfo.Path.NamespaceAlias #>").ConfigureAwait(false);<# + } +}#> + } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RootTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RootTemplateCode.cs new file mode 100644 index 0000000000..61b625188b --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RootTemplateCode.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.Extensions; +using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class RootTemplate +{ + internal RootTemplate( + string workflowId, + WorkflowTypeInfo typeInfo) + { + this.Id = workflowId; + this.TypeInfo = typeInfo; + this.TypeName = workflowId.FormatType(); + } + + public string Id { get; } + public WorkflowTypeInfo TypeInfo { get; } + public string TypeName { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplate.cs new file mode 100644 index 0000000000..f3c578be75 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplate.cs @@ -0,0 +1,2762 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; + using Microsoft.Bot.ObjectModel; + using Microsoft.Extensions.AI; + using System.Collections.Generic; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SendActivityTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class SendActivityTemplate : ActionTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n/// \n/// Formats a message template and sends an activity event.\n/// \ninternal sealed class "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SendActivityTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Name)); + + #line default + #line hidden + this.Write("Executor(FormulaSession session) : ActionExecutor(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SendActivityTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write("\", session)\n{\n // \n protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken)\n " + + " { "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SendActivityTemplate.tt" + +if (this.Model.Activity is MessageActivityTemplate messageActivity) +{ + + #line default + #line hidden + this.Write("\n string activityText = \n await context.FormatTemplateAsync( "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SendActivityTemplate.tt" + + foreach (TemplateLine line in messageActivity.Text) + { + + #line default + #line hidden + this.Write("\n \"\"\""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SendActivityTemplate.tt" + + foreach (string text in line.ToTemplateString().ByLine()) + { + + #line default + #line hidden + this.Write("\n "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SendActivityTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(text)); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SendActivityTemplate.tt" + + } + + #line default + #line hidden + this.Write("\n \"\"\""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SendActivityTemplate.tt" + + } + + + #line default + #line hidden + this.Write("\n );\n AgentRunResponse response = new([new ChatMessage(ChatRole" + + ".Assistant, activityText)]);\n await context.AddEventAsync(new AgentRunRes" + + "ponseEvent(this.Id, response)).ConfigureAwait(false);"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SendActivityTemplate.tt" + +} + + #line default + #line hidden + this.Write("\n\n return default;\n }\n}"); + return this.GenerationEnvironment.ToString(); + } + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + +void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false) +{ + if (targetVariable is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n await context.QueueStateUpdateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableName(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\", value: "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(valueVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableScope(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + + if (!tightFormat) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +} + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + +void EvaluateBoolExpression(BoolExpression expression, string targetVariable, bool defaultValue = false) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync>("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + +void EvaluateEnumExpression( + EnumExpression expression, + string targetVariable, + IDictionary resultMap, + string defaultValue = null, + bool qualifyResult = false, + bool isNullable = false) + where TWrapper : EnumWrapper +{ + string resultType = $"{GetTypeAlias()}{(isNullable ? "?" : "")}"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + resultMap.TryGetValue(expression.LiteralValue, out string resultValue); + if (qualifyResult) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("."); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(resultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + +void EvaluateIntExpression(IntExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "int?" : "int"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "0")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + +void EvaluateListExpression(ValueExpression expression, string targetVariable) +{ + string typeName = GetTypeAlias(); + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.ReadListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("> = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + +void EvaluateRecordExpression(ObjectExpression expression, string targetVariable) +{ + string resultTypeName = $"Dictionary()}?>?"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" =\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + +void EvaluateStringExpression(StringExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "string?" : "string"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "string.Empty")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + if (expression.LiteralValue.Contains("\n")) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = \n \"\"\"\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n \"\"\";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) => + EvaluateValueExpression(expression, targetVariable); + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + +void EvaluateMessageTemplate(TemplateLine templateLine, string variableName) +{ + if (templateLine is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" =\n await context.FormatTemplateAsync(\n \"\"\""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + FormatMessageTemplate(templateLine); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n \"\"\");"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + +void FormatMessageTemplate(TemplateLine line) +{ + foreach (string text in line.ToTemplateString().ByLine()) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(text)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + + + #line default + #line hidden + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplate.tt new file mode 100644 index 0000000000..562ba9de27 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplate.tt @@ -0,0 +1,34 @@ +<#@ template language="C#" inherits="ActionTemplate" visibility="internal" #> +<#@ output extension=".cs" #> +<#@ assembly name="System.Core" #> +<#@ include file="Snippets/Index.tt" once="true" #> +/// +/// Formats a message template and sends an activity event. +/// +internal sealed class <#= this.Name #>Executor(FormulaSession session) : ActionExecutor(id: "<#= this.Id #>", session) +{ + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { <# +if (this.Model.Activity is MessageActivityTemplate messageActivity) +{ #> + string activityText = + await context.FormatTemplateAsync( <# + foreach (TemplateLine line in messageActivity.Text) + { #> + """<# + foreach (string text in line.ToTemplateString().ByLine()) + { #> + <#= text #><# + } #> + """<# + } + #> + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false);<# +} #> + + return default; + } +} \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplateCode.cs new file mode 100644 index 0000000000..f05cdabc47 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplateCode.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Bot.ObjectModel; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class SendActivityTemplate +{ + public SendActivityTemplate(SendActivity model) + { + this.Model = this.Initialize(model); + } + + public SendActivity Model { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetMultipleVariablesTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetMultipleVariablesTemplate.cs new file mode 100644 index 0000000000..3e60e36d75 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetMultipleVariablesTemplate.cs @@ -0,0 +1,2727 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; + using Microsoft.Bot.ObjectModel; + using Microsoft.Extensions.AI; + using System.Collections.Generic; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SetMultipleVariablesTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class SetMultipleVariablesTemplate : ActionTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n/// \n/// Assigns an evaluated expression, other variable, or literal va" + + "lue to one or more variables.\n/// \ninternal sealed class "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SetMultipleVariablesTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Name)); + + #line default + #line hidden + this.Write("Executor(FormulaSession session) : ActionExecutor(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SetMultipleVariablesTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write("\", session)\n{\n // \n protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken)\n " + + " {"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SetMultipleVariablesTemplate.tt" + int index = 0; + foreach (var assignment in this.Model.Assignments) + { + // Separate assigments with a blank line for readability + if (index > 0) + { + + #line default + #line hidden + this.Write("\n "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SetMultipleVariablesTemplate.tt" + + } + ++index; + EvaluateValueExpression(assignment.Value, $"evaluatedValue{index}"); + AssignVariable(assignment.Variable, $"evaluatedValue{index}"); + } + + + #line default + #line hidden + this.Write("\n return default;\n }\n}"); + return this.GenerationEnvironment.ToString(); + } + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + +void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false) +{ + if (targetVariable is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n await context.QueueStateUpdateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableName(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\", value: "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(valueVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableScope(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + + if (!tightFormat) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +} + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + +void EvaluateBoolExpression(BoolExpression expression, string targetVariable, bool defaultValue = false) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync>("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + +void EvaluateEnumExpression( + EnumExpression expression, + string targetVariable, + IDictionary resultMap, + string defaultValue = null, + bool qualifyResult = false, + bool isNullable = false) + where TWrapper : EnumWrapper +{ + string resultType = $"{GetTypeAlias()}{(isNullable ? "?" : "")}"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + resultMap.TryGetValue(expression.LiteralValue, out string resultValue); + if (qualifyResult) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("."); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(resultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + +void EvaluateIntExpression(IntExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "int?" : "int"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "0")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + +void EvaluateListExpression(ValueExpression expression, string targetVariable) +{ + string typeName = GetTypeAlias(); + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.ReadListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("> = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + +void EvaluateRecordExpression(ObjectExpression expression, string targetVariable) +{ + string resultTypeName = $"Dictionary()}?>?"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" =\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + +void EvaluateStringExpression(StringExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "string?" : "string"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "string.Empty")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + if (expression.LiteralValue.Contains("\n")) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = \n \"\"\"\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n \"\"\";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) => + EvaluateValueExpression(expression, targetVariable); + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + +void EvaluateMessageTemplate(TemplateLine templateLine, string variableName) +{ + if (templateLine is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" =\n await context.FormatTemplateAsync(\n \"\"\""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + FormatMessageTemplate(templateLine); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n \"\"\");"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + +void FormatMessageTemplate(TemplateLine line) +{ + foreach (string text in line.ToTemplateString().ByLine()) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(text)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + + + #line default + #line hidden + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetMultipleVariablesTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetMultipleVariablesTemplate.tt new file mode 100644 index 0000000000..0448c4da69 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetMultipleVariablesTemplate.tt @@ -0,0 +1,27 @@ +<#@ template language="C#" inherits="ActionTemplate" visibility="internal" #> +<#@ output extension=".cs" #> +<#@ assembly name="System.Core" #> +<#@ include file="Snippets/Index.tt" once="true" #> +/// +/// Assigns an evaluated expression, other variable, or literal value to one or more variables. +/// +internal sealed class <#= this.Name #>Executor(FormulaSession session) : ActionExecutor(id: "<#= this.Id #>", session) +{ + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + {<# int index = 0; + foreach (var assignment in this.Model.Assignments) + { + // Separate assigments with a blank line for readability + if (index > 0) + {#> + <# + } + ++index; + EvaluateValueExpression(assignment.Value, $"evaluatedValue{index}"); + AssignVariable(assignment.Variable, $"evaluatedValue{index}"); + } + #> + return default; + } +} \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetMultipleVariablesTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetMultipleVariablesTemplateCode.cs new file mode 100644 index 0000000000..28cc4170f5 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetMultipleVariablesTemplateCode.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Bot.ObjectModel; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class SetMultipleVariablesTemplate +{ + public SetMultipleVariablesTemplate(SetMultipleVariables model) + { + this.Model = this.Initialize(model); + } + + public SetMultipleVariables Model { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetTextVariableTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetTextVariableTemplate.cs new file mode 100644 index 0000000000..0f571c597e --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetTextVariableTemplate.cs @@ -0,0 +1,2716 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; + using Microsoft.Bot.ObjectModel; + using Microsoft.Extensions.AI; + using System.Collections.Generic; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SetTextVariableTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class SetTextVariableTemplate : ActionTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n/// \n/// Assigns an evaluated message template to the \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SetTextVariableTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Model.Variable)); + + #line default + #line hidden + this.Write("\" variable.\n/// \ninternal sealed class "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SetTextVariableTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Name)); + + #line default + #line hidden + this.Write("Executor(FormulaSession session) : ActionExecutor(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SetTextVariableTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write("\", session)\n{\n protected override async ValueTask ExecuteAsync(IWorkf" + + "lowContext context, CancellationToken cancellationToken)\n {"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SetTextVariableTemplate.tt" + + EvaluateMessageTemplate(this.Model.Value, "textValue"); + AssignVariable(this.Variable, "textValue"); + + #line default + #line hidden + this.Write("\n return default;\n }\n}"); + return this.GenerationEnvironment.ToString(); + } + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + +void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false) +{ + if (targetVariable is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n await context.QueueStateUpdateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableName(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\", value: "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(valueVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableScope(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + + if (!tightFormat) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +} + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + +void EvaluateBoolExpression(BoolExpression expression, string targetVariable, bool defaultValue = false) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync>("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + +void EvaluateEnumExpression( + EnumExpression expression, + string targetVariable, + IDictionary resultMap, + string defaultValue = null, + bool qualifyResult = false, + bool isNullable = false) + where TWrapper : EnumWrapper +{ + string resultType = $"{GetTypeAlias()}{(isNullable ? "?" : "")}"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + resultMap.TryGetValue(expression.LiteralValue, out string resultValue); + if (qualifyResult) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("."); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(resultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + +void EvaluateIntExpression(IntExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "int?" : "int"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "0")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + +void EvaluateListExpression(ValueExpression expression, string targetVariable) +{ + string typeName = GetTypeAlias(); + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.ReadListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("> = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + +void EvaluateRecordExpression(ObjectExpression expression, string targetVariable) +{ + string resultTypeName = $"Dictionary()}?>?"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" =\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + +void EvaluateStringExpression(StringExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "string?" : "string"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "string.Empty")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + if (expression.LiteralValue.Contains("\n")) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = \n \"\"\"\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n \"\"\";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) => + EvaluateValueExpression(expression, targetVariable); + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + +void EvaluateMessageTemplate(TemplateLine templateLine, string variableName) +{ + if (templateLine is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" =\n await context.FormatTemplateAsync(\n \"\"\""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + FormatMessageTemplate(templateLine); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n \"\"\");"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + +void FormatMessageTemplate(TemplateLine line) +{ + foreach (string text in line.ToTemplateString().ByLine()) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(text)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + + + #line default + #line hidden + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetTextVariableTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetTextVariableTemplate.tt new file mode 100644 index 0000000000..086583e750 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetTextVariableTemplate.tt @@ -0,0 +1,16 @@ +<#@ template language="C#" inherits="ActionTemplate" visibility="internal" #> +<#@ output extension=".cs" #> +<#@ assembly name="System.Core" #> +<#@ include file="Snippets/Index.tt" once="true" #> +/// +/// Assigns an evaluated message template to the "<#= this.Model.Variable #>" variable. +/// +internal sealed class <#= this.Name #>Executor(FormulaSession session) : ActionExecutor(id: "<#= this.Id #>", session) +{ + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + {<# + EvaluateMessageTemplate(this.Model.Value, "textValue"); + AssignVariable(this.Variable, "textValue"); #> + return default; + } +} \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetTextVariableTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetTextVariableTemplateCode.cs new file mode 100644 index 0000000000..e1985416da --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetTextVariableTemplateCode.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Bot.ObjectModel; +using Microsoft.Shared.Diagnostics; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class SetTextVariableTemplate +{ + public SetTextVariableTemplate(SetTextVariable model) + { + this.Model = this.Initialize(model); + this.Variable = Throw.IfNull(this.Model.Variable); + } + + public SetTextVariable Model { get; } + + public PropertyPath Variable { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetVariableTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetVariableTemplate.cs new file mode 100644 index 0000000000..61dfa2c47d --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetVariableTemplate.cs @@ -0,0 +1,2718 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version: 17.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen +{ + using Microsoft.Agents.AI.Workflows.Declarative.Extensions; + using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; + using Microsoft.Bot.ObjectModel; + using Microsoft.Extensions.AI; + using System.Collections.Generic; + using System; + + /// + /// Class to produce the template output + /// + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SetVariableTemplate.tt" + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] + internal partial class SetVariableTemplate : ActionTemplate + { +#line hidden + /// + /// Create the template output + /// + public override string TransformText() + { + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n"); + this.Write("\n/// \n/// Assigns an evaluated expression, other variable, or literal va" + + "lue to the \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SetVariableTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Model.Variable)); + + #line default + #line hidden + this.Write("\" variable.\n/// \ninternal sealed class "); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SetVariableTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Name)); + + #line default + #line hidden + this.Write("Executor(FormulaSession session) : ActionExecutor(id: \""); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SetVariableTemplate.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); + + #line default + #line hidden + this.Write("\", session)\n{\n // \n protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken)\n " + + " {"); + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\SetVariableTemplate.tt" + + EvaluateValueExpression(this.Model.Value, "evaluatedValue"); + AssignVariable(this.Variable, "evaluatedValue"); + + #line default + #line hidden + this.Write("\n return default;\n }\n}\n"); + return this.GenerationEnvironment.ToString(); + } + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + +void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false) +{ + if (targetVariable is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n await context.QueueStateUpdateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableName(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\", value: "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(valueVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(VariableScope(targetVariable))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" + + if (!tightFormat) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\AssignVariableTemplate.tt" +} + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + +void EvaluateBoolExpression(BoolExpression expression, string targetVariable, bool defaultValue = false) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatBoolValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync>("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write("\n bool "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateBoolExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + +void EvaluateEnumExpression( + EnumExpression expression, + string targetVariable, + IDictionary resultMap, + string defaultValue = null, + bool qualifyResult = false, + bool isNullable = false) + where TWrapper : EnumWrapper +{ + string resultType = $"{GetTypeAlias()}{(isNullable ? "?" : "")}"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(defaultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + resultMap.TryGetValue(expression.LiteralValue, out string resultValue); + if (qualifyResult) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("."); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatValue(resultValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultType)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateEnumExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + +void EvaluateIntExpression(IntExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "int?" : "int"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "0")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateIntExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + +void EvaluateListExpression(ValueExpression expression, string targetVariable) +{ + string typeName = GetTypeAlias(); + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.ReadListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("> = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write("\n IList<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(" = await context.EvaluateListAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateListExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + +void EvaluateRecordExpression(ObjectExpression expression, string targetVariable) +{ + string resultTypeName = $"Dictionary()}?>?"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" =\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(" = await context.EvaluateExpressionAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(resultTypeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateRecordExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + +void EvaluateStringExpression(StringExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "string?" : "string"; + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(isNullable ? "null" : "string.Empty")); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + if (expression.LiteralValue.Contains("\n")) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = \n \"\"\"\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.LiteralValue)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n \"\"\";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(typeName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateStringExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) => + EvaluateValueExpression(expression, targetVariable); + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) +{ + if (expression is null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsLiteral) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatDataValue(expression.LiteralValue))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(";"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.ReadStateAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">(key: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.VariableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\", scopeName: \""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(expression.VariableReference.NamespaceAlias)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else if (expression.IsVariableReference) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.VariableReference.ToString()))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write("? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(targetVariable)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(" = await context.EvaluateValueAsync<"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(GetTypeAlias())); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(">("); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(FormatStringValue(expression.ExpressionText))); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" +this.Write(").ConfigureAwait(false);"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\EvaluateValueExpressionTemplate.tt" + + } +} + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + +void EvaluateMessageTemplate(TemplateLine templateLine, string variableName) +{ + if (templateLine is not null) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" =\n await context.FormatTemplateAsync(\n \"\"\""); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + FormatMessageTemplate(templateLine); + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n \"\"\");"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } + else + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n string? "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(variableName)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(" = null;"); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + +void FormatMessageTemplate(TemplateLine line) +{ + foreach (string text in line.ToTemplateString().ByLine()) + { + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write("\n "); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" +this.Write(this.ToStringHelper.ToStringWithCulture(text)); + + + #line default + #line hidden + + #line 1 "C:\Users\crickman\source\repos\af5\dotnet\src\Microsoft.Agents.AI.Workflows.Declarative\CodeGen\Snippets\FormatMessageTemplate.tt" + + } +} + + + #line default + #line hidden + } + + #line default + #line hidden +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetVariableTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetVariableTemplate.tt new file mode 100644 index 0000000000..80c0c4fd2f --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetVariableTemplate.tt @@ -0,0 +1,17 @@ +<#@ template language="C#" inherits="ActionTemplate" visibility="internal" #> +<#@ output extension=".cs" #> +<#@ assembly name="System.Core" #> +<#@ include file="Snippets/Index.tt" once="true" #> +/// +/// Assigns an evaluated expression, other variable, or literal value to the "<#= this.Model.Variable #>" variable. +/// +internal sealed class <#= this.Name #>Executor(FormulaSession session) : ActionExecutor(id: "<#= this.Id #>", session) +{ + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + {<# + EvaluateValueExpression(this.Model.Value, "evaluatedValue"); + AssignVariable(this.Variable, "evaluatedValue"); #> + return default; + } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetVariableTemplateCode.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetVariableTemplateCode.cs new file mode 100644 index 0000000000..f3a1edf6c0 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetVariableTemplateCode.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Bot.ObjectModel; +using Microsoft.Shared.Diagnostics; + +namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +internal partial class SetVariableTemplate +{ + internal SetVariableTemplate(SetVariable model) + { + this.Model = this.Initialize(model); + this.Variable = Throw.IfNull(this.Model.Variable); + } + + public SetVariable Model { get; } + public PropertyPath Variable { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/AssignVariableTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/AssignVariableTemplate.tt new file mode 100644 index 0000000000..a3f13aead0 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/AssignVariableTemplate.tt @@ -0,0 +1,12 @@ +<#+ +void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false) +{ + if (targetVariable is not null) + {#> + await context.QueueStateUpdateAsync(key: "<#= VariableName(targetVariable) #>", value: <#= valueVariable #>, scopeName: "<#= VariableScope(targetVariable) #>").ConfigureAwait(false);<#+ + if (!tightFormat) + {#> + <#+} + } +} +#> \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateBoolExpressionTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateBoolExpressionTemplate.tt new file mode 100644 index 0000000000..c4f860cf7e --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateBoolExpressionTemplate.tt @@ -0,0 +1,25 @@ +<#+ +void EvaluateBoolExpression(BoolExpression expression, string targetVariable, bool defaultValue = false) +{ + if (expression is null) + {#> + bool <#= targetVariable #> = <#= FormatBoolValue(defaultValue) #>;<#+ + } + else if (expression.IsLiteral) + {#> + bool <#= targetVariable #> = <#= FormatBoolValue(expression.LiteralValue) #>;<#+ + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + {#> + bool <#= targetVariable #> = await context.ReadStateAsync(key: "<#= expression.VariableReference.VariableName #>", scopeName: "<#= expression.VariableReference.NamespaceAlias #>").ConfigureAwait(false);<#+ + } + else if (expression.IsVariableReference) + {#> + bool <#= targetVariable #> = await context.EvaluateValueAsync>(<#= FormatStringValue(expression.VariableReference.ToString()) #>).ConfigureAwait(false);<#+ + } + else + {#> + bool <#= targetVariable #> = await context.EvaluateValueAsync(<#= FormatStringValue(expression.ExpressionText) #>).ConfigureAwait(false);<#+ + } +} +#> \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateEnumExpressionTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateEnumExpressionTemplate.tt new file mode 100644 index 0000000000..b730e0c519 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateEnumExpressionTemplate.tt @@ -0,0 +1,41 @@ +<#+ +void EvaluateEnumExpression( + EnumExpression expression, + string targetVariable, + IDictionary resultMap, + string defaultValue = null, + bool qualifyResult = false, + bool isNullable = false) + where TWrapper : EnumWrapper +{ + string resultType = $"{GetTypeAlias()}{(isNullable ? "?" : "")}"; + if (expression is null) + {#> + <#= resultType #> <#= targetVariable #> = <#= FormatValue(defaultValue) #>;<#+ + } + else if (expression.IsLiteral) + { + resultMap.TryGetValue(expression.LiteralValue, out string resultValue); + if (qualifyResult) + {#> + <#= resultType #> <#= targetVariable #> = <#= GetTypeAlias() #>.<#= resultValue #>;<#+ + } + else + {#> + <#= resultType #> <#= targetVariable #> = <#= FormatValue(resultValue) #>;<#+ + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + {#> + <#= resultType #> <#= targetVariable #> = await context.ReadStateAsync<<#= resultType #>>(key: "<#= expression.VariableReference.VariableName #>", scopeName: "<#= expression.VariableReference.NamespaceAlias #>").ConfigureAwait(false);<#+ + } + else if (expression.IsVariableReference) + {#> + <#= resultType #>? <#= targetVariable #> = await context.EvaluateValueAsync<<#= resultType #>>(<#= FormatStringValue(expression.VariableReference.ToString()) #>).ConfigureAwait(false);<#+ + } + else + {#> + <#= resultType #> <#= targetVariable #> = await context.EvaluateValueAsync<<#= resultType #>>(<#= FormatStringValue(expression.ExpressionText) #>).ConfigureAwait(false);<#+ + } +} +#> \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateIntExpressionTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateIntExpressionTemplate.tt new file mode 100644 index 0000000000..2d94162c43 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateIntExpressionTemplate.tt @@ -0,0 +1,26 @@ +<#+ +void EvaluateIntExpression(IntExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "int?" : "int"; + if (expression is null) + {#> + <#= typeName #> <#= targetVariable #> = <#= isNullable ? "null" : "0" #>;<#+ + } + else if (expression.IsLiteral) + {#> + <#= typeName #> <#= targetVariable #> = <#= expression.LiteralValue #>;<#+ + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + {#> + <#= typeName #> <#= targetVariable #> = await context.ReadStateAsync(key: "<#= expression.VariableReference.VariableName #>", scopeName: "<#= expression.VariableReference.NamespaceAlias #>").ConfigureAwait(false);<#+ + } + else if (expression.IsVariableReference) + {#> + <#= typeName #>? <#= targetVariable #> = await context.EvaluateValueAsync<<#= typeName #>>(<#= FormatStringValue(expression.VariableReference.ToString()) #>).ConfigureAwait(false);<#+ + } + else + {#> + <#= typeName #> <#= targetVariable #> = await context.EvaluateValueAsync<<#= typeName #>>(<#= FormatStringValue(expression.ExpressionText) #>).ConfigureAwait(false);<#+ + } +} +#> \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateListExpressionTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateListExpressionTemplate.tt new file mode 100644 index 0000000000..a9a40293e5 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateListExpressionTemplate.tt @@ -0,0 +1,26 @@ +<#+ +void EvaluateListExpression(ValueExpression expression, string targetVariable) +{ + string typeName = GetTypeAlias(); + if (expression is null) + {#> + IList<<#= typeName #>>? <#= targetVariable #> = null;<#+ + } + else if (expression.IsLiteral) + {#> + IList<<#= typeName #>>? <#= targetVariable #> = <#= FormatDataValue(expression.LiteralValue) #>;<#+ + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + {#> + IList<<#= typeName #>>? <#= targetVariable #> = await context.ReadListAsync<<#= GetTypeAlias() #>>(key: "<#= expression.VariableReference.VariableName #>", scopeName: "<#= expression.VariableReference.NamespaceAlias #>").ConfigureAwait(false);<#+ + } + else if (expression.IsVariableReference) + {#> + IList<<#= typeName #>>? <#= targetVariable #>> = await context.EvaluateListAsync<<#= typeName #>>(<#= FormatStringValue(expression.VariableReference.ToString()) #>).ConfigureAwait(false);<#+ + } + else + {#> + IList<<#= typeName #>>? <#= targetVariable #> = await context.EvaluateListAsync<<#= typeName #>>(<#= FormatStringValue(expression.ExpressionText) #>).ConfigureAwait(false);<#+ + } +} +#> \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateRecordExpressionTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateRecordExpressionTemplate.tt new file mode 100644 index 0000000000..c1d1513dc2 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateRecordExpressionTemplate.tt @@ -0,0 +1,27 @@ +<#+ +void EvaluateRecordExpression(ObjectExpression expression, string targetVariable) +{ + string resultTypeName = $"Dictionary()}?>?"; + if (expression is null) + {#> + <#= resultTypeName #> <#= targetVariable #> = null;<#+ + } + else if (expression.IsLiteral) + {#> + <#= resultTypeName #> <#= targetVariable #> = + <#= FormatDataValue(expression.LiteralValue) #>;<#+ + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + {#> + <#= resultTypeName #> <#= targetVariable #> = await context.ReadStateAsync<<#= resultTypeName #>>(key: "<#= expression.VariableReference.VariableName #>", scopeName: "<#= expression.VariableReference.NamespaceAlias #>").ConfigureAwait(false);<#+ + } + else if (expression.IsVariableReference) + {#> + <#= resultTypeName #>? <#= targetVariable #> = await context.EvaluateExpressionAsync<<#= resultTypeName #>>(<#= FormatStringValue(expression.VariableReference.ToString()) #>).ConfigureAwait(false);<#+ + } + else + {#> + <#= resultTypeName #> <#= targetVariable #> = await context.EvaluateExpressionAsync<<#= resultTypeName #>>(<#= FormatStringValue(expression.ExpressionText) #>).ConfigureAwait(false);<#+ + } +} +#> \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateStringExpressionTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateStringExpressionTemplate.tt new file mode 100644 index 0000000000..81a2197961 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateStringExpressionTemplate.tt @@ -0,0 +1,36 @@ +<#+ +void EvaluateStringExpression(StringExpression expression, string targetVariable, bool isNullable = false) +{ + string typeName = isNullable ? "string?" : "string"; + if (expression is null) + {#> + <#= typeName #> <#= targetVariable #> = <#= isNullable ? "null" : "string.Empty" #>;<#+ + } + else if (expression.IsLiteral) + { + if (expression.LiteralValue.Contains("\n")) + {#> + <#= typeName #> <#= targetVariable #> = + """ + <#= expression.LiteralValue #> + """;<#+ + } + else + {#> + <#= typeName #> <#= targetVariable #> = <#= FormatStringValue(expression.LiteralValue) #>;<#+ + } + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + {#> + <#= typeName #> <#= targetVariable #> = await context.ReadStateAsync(key: "<#= expression.VariableReference.VariableName #>", scopeName: "<#= expression.VariableReference.NamespaceAlias #>").ConfigureAwait(false);<#+ + } + else if (expression.IsVariableReference) + {#> + <#= typeName #> <#= targetVariable #> = await context.EvaluateValueAsync(<#= FormatStringValue(expression.VariableReference.ToString()) #>).ConfigureAwait(false);<#+ + } + else + {#> + <#= typeName #> <#= targetVariable #> = await context.EvaluateValueAsync(<#= FormatStringValue(expression.ExpressionText) #>).ConfigureAwait(false);<#+ + } +} +#> \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateValueExpressionTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateValueExpressionTemplate.tt new file mode 100644 index 0000000000..3085b86ece --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateValueExpressionTemplate.tt @@ -0,0 +1,28 @@ +<#+ +void EvaluateValueExpression(ValueExpression expression, string targetVariable) => + EvaluateValueExpression(expression, targetVariable); + +void EvaluateValueExpression(ValueExpression expression, string targetVariable) +{ + if (expression is null) + {#> + <#= GetTypeAlias() #>? <#= targetVariable #> = null;<#+ + } + else if (expression.IsLiteral) + {#> + <#= GetTypeAlias() #>? <#= targetVariable #> = <#= FormatDataValue(expression.LiteralValue) #>;<#+ + } + else if (expression.IsVariableReference && expression.VariableReference.SegmentCount == 2) + {#> + <#= GetTypeAlias() #>? <#= targetVariable #> = await context.ReadStateAsync<<#= GetTypeAlias() #>>(key: "<#= expression.VariableReference.VariableName #>", scopeName: "<#= expression.VariableReference.NamespaceAlias #>").ConfigureAwait(false);<#+ + } + else if (expression.IsVariableReference) + {#> + <#= GetTypeAlias() #>? <#= targetVariable #> = await context.EvaluateValueAsync<<#= GetTypeAlias() #>>(<#= FormatStringValue(expression.VariableReference.ToString()) #>).ConfigureAwait(false);<#+ + } + else + {#> + <#= GetTypeAlias() #>? <#= targetVariable #> = await context.EvaluateValueAsync<<#= GetTypeAlias() #>>(<#= FormatStringValue(expression.ExpressionText) #>).ConfigureAwait(false);<#+ + } +} +#> \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/FormatMessageTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/FormatMessageTemplate.tt new file mode 100644 index 0000000000..8c68811d76 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/FormatMessageTemplate.tt @@ -0,0 +1,25 @@ +<#+ +void EvaluateMessageTemplate(TemplateLine templateLine, string variableName) +{ + if (templateLine is not null) + {#> + string <#= variableName #> = + await context.FormatTemplateAsync( + """<#+ + FormatMessageTemplate(templateLine); #> + """);<#+ + } + else + {#> + string? <#= variableName #> = null;<#+ + } +} + +void FormatMessageTemplate(TemplateLine line) +{ + foreach (string text in line.ToTemplateString().ByLine()) + { #> + <#= text #><#+ + } +} +#> \ No newline at end of file diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/Index.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/Index.tt new file mode 100644 index 0000000000..6fd6a0477f --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/Index.tt @@ -0,0 +1,14 @@ +<#@ import namespace="Microsoft.Agents.AI.Workflows.Declarative.Extensions" #> +<#@ import namespace="Microsoft.Agents.AI.Workflows.Declarative.ObjectModel" #> +<#@ import namespace="Microsoft.Bot.ObjectModel" #> +<#@ import namespace="Microsoft.Extensions.AI" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ include file="AssignVariableTemplate.tt" once="true" #> +<#@ include file="EvaluateBoolExpressionTemplate.tt" once="true" #> +<#@ include file="EvaluateEnumExpressionTemplate.tt" once="true" #> +<#@ include file="EvaluateIntExpressionTemplate.tt" once="true" #> +<#@ include file="EvaluateListExpressionTemplate.tt" once="true" #> +<#@ include file="EvaluateRecordExpressionTemplate.tt" once="true" #> +<#@ include file="EvaluateStringExpressionTemplate.tt" once="true" #> +<#@ include file="EvaluateValueExpressionTemplate.tt" once="true" #> +<#@ include file="FormatMessageTemplate.tt" once="true" #> diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/DeclarativeWorkflowBuilder.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/DeclarativeWorkflowBuilder.cs index 7efdf0c455..0fafa4e9db 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/DeclarativeWorkflowBuilder.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/DeclarativeWorkflowBuilder.cs @@ -16,6 +16,20 @@ namespace Microsoft.Agents.AI.Workflows.Declarative; /// public static class DeclarativeWorkflowBuilder { + /// + /// Transforms the input message into a based on . + /// Also performs pass-through for input. + /// + /// The input message to transform. + /// The transformed message (as + public static ChatMessage DefaultTransform(object message) => + message switch + { + ChatMessage chatMessage => chatMessage, + string stringMessage => new ChatMessage(ChatRole.User, stringMessage), + _ => new(ChatRole.User, $"{message}") + }; + /// /// Builder for converting a Foundry workflow object-model YAML definition into a process. /// @@ -48,13 +62,7 @@ public static class DeclarativeWorkflowBuilder Func? inputTransform = null) where TInput : notnull { - BotElement rootElement = YamlSerializer.Deserialize(yamlReader) ?? throw new DeclarativeModelException("Workflow undefined."); - - if (rootElement is not AdaptiveDialog workflowElement) - { - throw new DeclarativeModelException($"Unsupported root element: {rootElement.GetType().Name}. Expected an {nameof(Workflow)}."); - } - + AdaptiveDialog workflowElement = ReadWorkflow(yamlReader); string rootId = WorkflowActionVisitor.Steps.Root(workflowElement); WorkflowFormulaState state = new(options.CreateRecalcEngine()); @@ -72,11 +80,65 @@ public static class DeclarativeWorkflowBuilder return visitor.Complete(); } - internal static ChatMessage DefaultTransform(object message) => - message switch - { - ChatMessage chatMessage => chatMessage, - string stringMessage => new ChatMessage(ChatRole.User, stringMessage), - _ => new(ChatRole.User, $"{message}") - }; + /// + /// Generates source code (provider/executor scaffolding) for the workflow defined in the YAML file. + /// + /// The path to the workflow YAML file. + /// The language to use for the generated code. + /// Optional target namespace for the generated code. + /// Optional prefix for generated workflow type. + /// The generated source code representing the workflow. + public static string Eject( + string workflowFile, + DeclarativeWorkflowLanguage workflowLanguage, + string? workflowNamespace = null, + string? workflowPrefix = null) + { + using StreamReader yamlReader = File.OpenText(workflowFile); + return Eject(yamlReader, workflowLanguage, workflowNamespace, workflowPrefix); + } + + /// + /// Generates source code (provider/executor scaffolding) for the workflow defined in the provided YAML reader. + /// + /// The reader supplying the workflow YAML. + /// The language to use for the generated code. + /// Optional target namespace for the generated code. + /// Optional prefix for generated workflow type. + /// The generated source code representing the workflow. + public static string Eject( + TextReader yamlReader, + DeclarativeWorkflowLanguage workflowLanguage, + string? workflowNamespace = null, + string? workflowPrefix = null) + { + if (workflowLanguage != DeclarativeWorkflowLanguage.CSharp) + { + throw new NotSupportedException($"Converting workflow to {workflowLanguage} is not currently supported."); + } + + AdaptiveDialog workflowElement = ReadWorkflow(yamlReader); + + string rootId = WorkflowActionVisitor.Steps.Root(workflowElement); + WorkflowTypeInfo typeInfo = workflowElement.WrapWithBot().Describe(); + + WorkflowTemplateVisitor visitor = new(rootId, typeInfo); + WorkflowElementWalker walker = new(visitor); + walker.Visit(workflowElement); + + return visitor.Complete(workflowNamespace, workflowPrefix); + } + + private static AdaptiveDialog ReadWorkflow(TextReader yamlReader) + { + BotElement rootElement = YamlSerializer.Deserialize(yamlReader) ?? throw new DeclarativeModelException("Workflow undefined."); + + // "Workflow" is an alias for "AdaptiveDialog" + if (rootElement is not AdaptiveDialog workflowElement) + { + throw new DeclarativeModelException($"Unsupported root element: {rootElement.GetType().Name}. Expected an {nameof(Workflow)}."); + } + + return workflowElement; + } } diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/DeclarativeWorkflowLanguage.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/DeclarativeWorkflowLanguage.cs new file mode 100644 index 0000000000..0d3a27b440 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/DeclarativeWorkflowLanguage.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft. All rights reserved. + +namespace Microsoft.Agents.AI.Workflows.Declarative; + +/// +/// Defines programming language for workflow ejection. +/// +public enum DeclarativeWorkflowLanguage +{ + /// + /// Python programming language. + /// + Python, + + /// + /// C# programming language. + /// + CSharp, + + /// + /// JavaScript programming language. + /// + JavaScript, +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/ChatMessageExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/ChatMessageExtensions.cs index 0312d243b0..c8df8c277a 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/ChatMessageExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/ChatMessageExtensions.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.Agents.AI.Workflows.Declarative.PowerFx.Functions; +using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; using Microsoft.Bot.ObjectModel; using Microsoft.Extensions.AI; using Microsoft.PowerFx.Types; diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/DataValueExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/DataValueExtensions.cs index 3aa53a337d..df3432a68f 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/DataValueExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/DataValueExtensions.cs @@ -1,14 +1,43 @@ // Copyright (c) Microsoft. All rights reserved. +using System; +using System.Collections; using System.Collections.Generic; +using System.Collections.Immutable; +using System.Dynamic; using System.Linq; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; using Microsoft.Bot.ObjectModel; +using Microsoft.Extensions.AI; using Microsoft.PowerFx.Types; namespace Microsoft.Agents.AI.Workflows.Declarative.Extensions; internal static class DataValueExtensions { + public static DataValue ToDataValue(this object? value) => + value switch + { + null => DataValue.Blank(), + UnassignedValue => DataValue.Blank(), + FormulaValue formulaValue => formulaValue.ToDataValue(), + DataValue dataValue => dataValue, + bool booleanValue => BooleanDataValue.Create(booleanValue), + int decimalValue => NumberDataValue.Create(decimalValue), + long decimalValue => NumberDataValue.Create(decimalValue), + float decimalValue => FloatDataValue.Create(decimalValue), + decimal decimalValue => NumberDataValue.Create(decimalValue), + double numberValue => FloatDataValue.Create(numberValue), + string stringValue => StringDataValue.Create(stringValue), + DateTime dateonlyValue when dateonlyValue.TimeOfDay == TimeSpan.Zero => DateDataValue.Create(dateonlyValue), + DateTime datetimeValue => DateTimeDataValue.Create(datetimeValue), + TimeSpan timeValue => TimeDataValue.Create(timeValue), + object when value is IDictionary dictionaryValue => dictionaryValue.ToRecordValue(), + object when value is IEnumerable tableValue => tableValue.ToTableValue(), + _ => throw new DeclarativeModelException($"Unsupported variable type: {value.GetType().Name}"), + }; + public static FormulaValue ToFormula(this DataValue? value) => value switch { @@ -65,12 +94,37 @@ internal static class DataValueExtensions DateTimeDataValue dateTimeValue => dateTimeValue.Value.DateTime, DateDataValue dateValue => dateValue.Value, TimeDataValue timeValue => timeValue.Value, - TableDataValue tableValue => tableValue.Values.Select(value => value.ToDictionary()).ToArray(), - RecordDataValue recordValue => recordValue.ToDictionary(), + TableDataValue tableValue => tableValue.ToObject(), + RecordDataValue recordValue => recordValue.ToObject(), OptionDataValue optionValue => optionValue.Value.Value, _ => throw new DeclarativeModelException($"Unsupported {nameof(DataValue)} type: {value.GetType().Name}"), }; + public static Type ToClrType(this DataType type) => + type switch + { + BooleanDataType => typeof(bool), + NumberDataType => typeof(decimal), + FloatDataType => typeof(double), + StringDataType => typeof(string), + DateTimeDataType => typeof(DateTime), + DateDataType => typeof(DateTime), + TimeDataType => typeof(TimeSpan), + TableDataType tableType => VariableType.ListType, + RecordDataType recordValue => VariableType.RecordType, + _ => throw new DeclarativeModelException($"Unsupported {nameof(DataValue)} type: {type.GetType().Name}"), + }; + + public static IList? AsList(this DataValue? value) + { + if (value is null || value is BlankDataValue) + { + return null; + } + + return value.ToObject().AsList(); + } + public static FormulaValue NewBlank(this DataType? type) => FormulaValue.NewBlank(type?.ToFormulaType() ?? FormulaType.Blank); public static RecordValue ToRecordValue(this RecordDataValue recordDataValue) => @@ -88,6 +142,53 @@ internal static class DataValueExtensions return recordType; } + public static RecordDataValue ToRecordValue(this IDictionary value) + { + return DataValue.RecordFromFields(GetFields()); + + IEnumerable> GetFields() + { + yield return new KeyValuePair(TypeSchema.Discriminator, nameof(ExpandoObject).ToDataValue()); + + foreach (string key in value.Keys) + { + yield return new KeyValuePair(key, value[key].ToDataValue()); + } + } + } + + public static TableDataValue ToTableValue(this IEnumerable values) + { + IEnumerator enumerator = values.GetEnumerator(); + if (!enumerator.MoveNext()) + { + return DataValue.EmptyTable; + } + + if (enumerator.Current is IDictionary) + { + DataValue.TableFromRecords(GetFields().ToImmutableArray()); + } + + return DataValue.TableFromValues(GetValues().ToImmutableArray()); + + IEnumerable GetFields() + { + foreach (IDictionary value in values) + { + yield return value.ToRecordValue(); + } + } + + IEnumerable GetValues() + { + foreach (object value in values) + { + yield return value.ToDataValue(); + } + } + } + private static RecordType ParseRecordType(this RecordDataValue record) { RecordType recordType = RecordType.Empty(); @@ -98,9 +199,60 @@ internal static class DataValueExtensions return recordType; } + private static object ToObject(this TableDataValue table) + { + DataValue? firstElement = table.Values.FirstOrDefault(); + if (firstElement is null) + { + return Array.Empty(); + } + + if (firstElement is RecordDataValue record) + { + if (record.Properties.Count == 1 && record.Properties.TryGetValue("Value", out DataValue? singleColumn)) + { + record = singleColumn as RecordDataValue ?? record; + } + + if (record.Properties.TryGetValue(TypeSchema.Discriminator, out DataValue? value) && value is StringDataValue typeValue) + { + if (string.Equals(nameof(ChatMessage), typeValue.Value, StringComparison.Ordinal)) + { + return table.ToChatMessages().ToArray(); + } + + if (string.Equals(nameof(ExpandoObject), typeValue.Value, StringComparison.Ordinal)) + { + return table.Values.Select(dataValue => dataValue.ToDictionary()).ToArray(); + } + } + } + + return table.Values.Select(value => value.ToObject()).ToArray(); + } + + private static object ToObject(this RecordDataValue record) + { + if (record.Properties.TryGetValue(TypeSchema.Discriminator, out DataValue? value) && value is StringDataValue typeValue) + { + if (string.Equals(nameof(ChatMessage), typeValue.Value, StringComparison.Ordinal)) + { + return record.ToChatMessage(); + } + + if (string.Equals(nameof(ExpandoObject), typeValue.Value, StringComparison.Ordinal)) + { + return record.ToDictionary(); + } + } + + return record.ToDictionary(); + } + private static Dictionary ToDictionary(this RecordDataValue record) { Dictionary result = []; + result[TypeSchema.Discriminator] = nameof(ExpandoObject); foreach (KeyValuePair property in record.Properties) { result[property.Key] = property.Value.ToObject(); diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/FormulaValueExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/FormulaValueExtensions.cs index 84d58d40bb..7c0dee450a 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/FormulaValueExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/FormulaValueExtensions.cs @@ -8,8 +8,8 @@ using System.Dynamic; using System.Linq; using System.Text.Json; using System.Text.Json.Nodes; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; -using Microsoft.Agents.AI.Workflows.Declarative.PowerFx.Functions; using Microsoft.Bot.ObjectModel; using Microsoft.Extensions.AI; using Microsoft.PowerFx.Types; diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/IWorkflowContextExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/IWorkflowContextExtensions.cs index 3171e2ac2a..eb82ee796b 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/IWorkflowContextExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/IWorkflowContextExtensions.cs @@ -4,6 +4,7 @@ using System; using System.Threading; using System.Threading.Tasks; using Microsoft.Agents.AI.Workflows.Declarative.Interpreter; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; using Microsoft.Bot.ObjectModel; using Microsoft.PowerFx.Types; diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/JsonDocumentExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/JsonDocumentExtensions.cs new file mode 100644 index 0000000000..af1931d6d2 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/JsonDocumentExtensions.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System; +using System.Collections.Frozen; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Bot.ObjectModel; +using Microsoft.PowerFx.Types; + +namespace Microsoft.Agents.AI.Workflows.Declarative.Extensions; + +internal static class JsonDocumentExtensions +{ + public static FrozenDictionary ParseRecord(this JsonDocument jsonDocument, VariableType recordType) => jsonDocument.RootElement.ParseRecord(recordType); + + public static RecordValue ParseRecord(this JsonDocument jsonDocument, RecordDataType recordType) => jsonDocument.RootElement.ParseRecord(recordType); + + private static FrozenDictionary ParseRecord(this JsonElement currentElement, VariableType recordType) + { + if (!recordType.IsRecord || recordType.Schema is null) + { + throw new DeclarativeActionException($"Unable to parse JSON element as {recordType.Type.Name}."); + } + + return ParseValues().ToFrozenDictionary(kvp => kvp.Key, kvp => kvp.Value); + + IEnumerable> ParseValues() + { + foreach (KeyValuePair property in recordType.Schema) + { + JsonElement propertyElement = currentElement.GetProperty(property.Key); + object? parsedValue = + property.Value?.Type switch + { + null => null, + _ when property.Value.Type == typeof(string) => propertyElement.GetString(), + _ when property.Value.Type == typeof(int) => propertyElement.GetInt32(), + _ when property.Value.Type == typeof(long) => propertyElement.GetInt64(), + _ when property.Value.Type == typeof(decimal) => propertyElement.GetDecimal(), + _ when property.Value.Type == typeof(double) => propertyElement.GetDouble(), + _ when property.Value.Type == typeof(bool) => propertyElement.GetBoolean(), + _ when property.Value.Type == typeof(DateTime) => propertyElement.GetDateTime(), + _ when property.Value.Type == typeof(TimeSpan) => propertyElement.GetDateTimeOffset().TimeOfDay, + _ when property.Value.IsRecord => propertyElement.ParseRecord(property.Value), + //TableDataType tableType => ParseTable(tableType, propertyElement), + _ => throw new InvalidOperationException($"Unsupported data type '{property.Value.Type}' for property '{property.Key}'"), + }; + yield return new KeyValuePair(property.Key, parsedValue); + } + + //static TableValue ParseTable(TableDataType tableType, JsonElement propertyElement) + //{ + // RecordDataType recordType = tableType.ToRecord(); + // return + // FormulaValue.NewTable( + // recordType.ToRecordType(), + // propertyElement.EnumerateArray().Select(tableElement => tableElement.ParseRecord(recordType))); + //} + } + } + + private static RecordValue ParseRecord(this JsonElement currentElement, RecordDataType recordType) + { + return FormulaValue.NewRecordFromFields(ParseValues()); + + IEnumerable ParseValues() + { + foreach (KeyValuePair property in recordType.Properties) + { + JsonElement propertyElement = currentElement.GetProperty(property.Key); + FormulaValue? parsedValue = + property.Value.Type switch + { + StringDataType => FormulaValue.New(propertyElement.GetString()), + NumberDataType => FormulaValue.New(propertyElement.GetDecimal()), + BooleanDataType => FormulaValue.New(propertyElement.GetBoolean()), + DateTimeDataType => FormulaValue.New(propertyElement.GetDateTime()), + DateDataType => FormulaValue.New(propertyElement.GetDateTime()), + TimeDataType => FormulaValue.New(propertyElement.GetDateTimeOffset().TimeOfDay), + RecordDataType recordType => propertyElement.ParseRecord(recordType), + TableDataType tableType => ParseTable(tableType, propertyElement), + _ => throw new InvalidOperationException($"Unsupported data type '{property.Value.Type}' for property '{property.Key}'"), + }; + yield return new NamedValue(property.Key, parsedValue); + } + + static TableValue ParseTable(TableDataType tableType, JsonElement propertyElement) + { + RecordDataType recordType = tableType.ToRecord(); + return + FormulaValue.NewTable( + recordType.ToRecordType(), + propertyElement.EnumerateArray().Select(tableElement => tableElement.ParseRecord(recordType))); + } + } + } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/ObjectExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/ObjectExtensions.cs new file mode 100644 index 0000000000..c4350bb84c --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/ObjectExtensions.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Bot.ObjectModel; +using Microsoft.PowerFx.Types; + +namespace Microsoft.Agents.AI.Workflows.Declarative.Extensions; + +internal static class ObjectExtensions +{ + public static IList? AsList(this object? value) + { + return value switch + { + null => null, + UnassignedValue => null, + BlankValue => null, + BlankDataValue => null, + IList list => list, + IEnumerable enumerable => enumerable.ToList(), + TElement element => [element], + _ => TypedElements().ToList(), + }; + + IEnumerable TypedElements() + { + if (value is not IEnumerable enumerable) + { + throw new DeclarativeActionException($"Value '{value.GetType().Name}' is not '{nameof(IEnumerable)}'."); + } + + foreach (var item in enumerable) + { + if (item is not TElement element) + { + throw new DeclarativeActionException($"Item '{item.GetType().Name}' is not of type '{typeof(TElement).Name}'"); + } + + yield return element; + } + } + } + + public static object? ConvertType(this object? sourceValue, VariableType targetType) + { + if (!targetType.IsValid()) + { + throw new DeclarativeActionException($"Unsupported type: '{targetType.Type.Name}'."); + } + + if (sourceValue != null && targetType.Type.IsAssignableFrom(sourceValue.GetType())) + { + return sourceValue; + } + + return targetType switch + { + _ when typeof(string).IsAssignableFrom(targetType.Type) => ConvertToString(), + _ when typeof(bool).IsAssignableFrom(targetType.Type) => ConvertToBool(), + _ when targetType.IsRecord => ConvertToRecord(), + _ when targetType.IsList => ConvertToList(), + _ when typeof(int).IsAssignableFrom(targetType.Type) => ConvertToInt(), + _ when typeof(long).IsAssignableFrom(targetType.Type) => ConvertToLong(), + _ when typeof(decimal).IsAssignableFrom(targetType.Type) => ConvertToDecimal(), + _ when typeof(double).IsAssignableFrom(targetType.Type) => ConvertToDouble(), + _ when typeof(DateTime).IsAssignableFrom(targetType.Type) => ConvertToDateTime(), + _ when typeof(TimeSpan).IsAssignableFrom(targetType.Type) => ConvertToTimeSpan(), + _ => throw new DeclarativeActionException($"Unsupported type: '{targetType.Type.Name}'."), + }; + + bool? ConvertToBool() => + sourceValue switch + { + null => null, + string s => bool.Parse(s), + int i => i != 0, + long l => l != 0, + decimal c => c != 0, + double d => d != 0, + DateTime dt => dt > DateTime.MinValue, + TimeSpan ts => ts > TimeSpan.MinValue, + _ => sourceValue != null, + }; + + int? ConvertToInt() => + sourceValue switch + { + null => null, + string s => int.Parse(s), + int i => i, + long l => Convert.ToInt32(l), + decimal c => Convert.ToInt32(c), + double d => Convert.ToInt32(d), + DateTime dt => Convert.ToInt32(dt), + TimeSpan ts => Convert.ToInt32(ts), + _ => throw new DeclarativeActionException($"Unsupported target type for '{sourceValue.GetType().Name}': '{targetType.Type.Name}'."), + }; + + long? ConvertToLong() => + sourceValue switch + { + null => null, + string s => long.Parse(s), + int i => i, + long l => l, + decimal c => Convert.ToInt64(c), + double d => Convert.ToInt64(d), + DateTime dt => Convert.ToInt64(dt), + TimeSpan ts => Convert.ToInt64(ts), + _ => throw new DeclarativeActionException($"Unsupported target type for '{sourceValue.GetType().Name}': '{targetType.Type.Name}'."), + }; + + decimal? ConvertToDecimal() => + sourceValue switch + { + null => null, + string s => decimal.Parse(s), + int i => i, + long l => l, + decimal c => c, + double d => Convert.ToDecimal(d), + DateTime dt => Convert.ToDecimal(dt), + TimeSpan ts => Convert.ToDecimal(ts), + _ => throw new DeclarativeActionException($"Unsupported target type for '{sourceValue.GetType().Name}': '{targetType.Type.Name}'."), + }; + + double? ConvertToDouble() => + sourceValue switch + { + null => null, + string s => double.Parse(s), + int i => i, + long l => l, + decimal c => Convert.ToDouble(c), + double d => d, + DateTime dt => dt.Ticks, + TimeSpan ts => ts.Ticks, + _ => throw new DeclarativeActionException($"Unsupported target type for '{sourceValue.GetType().Name}': '{targetType.Type.Name}'."), + }; + + DateTime? ConvertToDateTime() => + sourceValue switch + { + null => null, + string s => DateTime.Parse(s), + int i => new DateTime(i), + long l => new DateTime(l), + decimal c => new DateTime(Convert.ToInt64(c)), + double d => new DateTime(Convert.ToInt64(d)), + DateTime dt => dt, + TimeSpan ts => DateTime.Now.Date.AddTicks(ts.Ticks), + _ => throw new DeclarativeActionException($"Unsupported target type for '{sourceValue.GetType().Name}': '{targetType.Type.Name}'."), + }; + + TimeSpan? ConvertToTimeSpan() => + sourceValue switch + { + null => null, + string s => TimeSpan.Parse(s), + int i => TimeSpan.FromTicks(i), + long l => TimeSpan.FromTicks(l), + decimal c => TimeSpan.FromTicks(Convert.ToInt64(c)), + double d => TimeSpan.FromTicks(Convert.ToInt64(d)), + DateTime dt => dt.TimeOfDay, + TimeSpan ts => ts, + _ => throw new DeclarativeActionException($"Unsupported target type for '{sourceValue.GetType().Name}': '{targetType.Type.Name}'."), + }; + + object? ConvertToList() => + sourceValue switch + { + null => null, + //string jsonText => JsonDocument.Parse(jsonText.TrimJsonDelimiter()).ParseRecord(targetType), + _ => throw new DeclarativeActionException($"Cannot convert '{sourceValue?.GetType().Name}' to 'Record' (expected JSON string)."), + }; + + object? ConvertToRecord() => + sourceValue switch + { + null => null, + string jsonText => JsonDocument.Parse(jsonText.TrimJsonDelimiter()).ParseRecord(targetType), + _ => throw new DeclarativeActionException($"Cannot convert '{sourceValue?.GetType().Name}' to 'Record' (expected JSON string)."), + }; + + string? ConvertToString() => + sourceValue switch + { + null => null, + string sourceText => sourceText, + DateTime dateTime => dateTime.ToString("o"), // ISO 8601 + TimeSpan timeSpan => timeSpan.ToString("c"), // Constant ("c") format + _ => $"{sourceValue}", + }; + } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/RecordDataTypeExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/RecordDataTypeExtensions.cs deleted file mode 100644 index 49ca8ad006..0000000000 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/RecordDataTypeExtensions.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; -using Microsoft.Bot.ObjectModel; -using Microsoft.PowerFx.Types; - -namespace Microsoft.Agents.AI.Workflows.Declarative.Extensions; - -internal static class RecordDataTypeExtensions -{ - public static RecordValue ParseRecord(this RecordDataType recordType, JsonElement currentElement) - { - return FormulaValue.NewRecordFromFields(ParseValues()); - - IEnumerable ParseValues() - { - foreach (KeyValuePair property in recordType.Properties) - { - JsonElement propertyElement = currentElement.GetProperty(property.Key); - FormulaValue? parsedValue = - property.Value.Type switch - { - StringDataType => FormulaValue.New(propertyElement.GetString()), - NumberDataType => FormulaValue.New(propertyElement.GetDecimal()), - BooleanDataType => FormulaValue.New(propertyElement.GetBoolean()), - DateTimeDataType => FormulaValue.New(propertyElement.GetDateTime()), - DateDataType => FormulaValue.New(propertyElement.GetDateTime()), - TimeDataType => FormulaValue.New(propertyElement.GetDateTimeOffset().TimeOfDay), - RecordDataType recordType => recordType.ParseRecord(propertyElement), - TableDataType tableType => ParseTable(tableType, propertyElement), - _ => throw new InvalidOperationException($"Unsupported data type '{property.Value.Type}' for property '{property.Key}'"), - }; - yield return new NamedValue(property.Key, parsedValue); - } - - static TableValue ParseTable(TableDataType tableType, JsonElement propertyElement) - { - RecordDataType recordType = tableType.ToRecord(); - return - FormulaValue.NewTable( - recordType.ToRecordType(), - propertyElement.EnumerateArray().Select(tableElement => ParseRecord(recordType, tableElement))); - } - } - } -} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/StringExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/StringExtensions.cs index e8e2858577..eaf0e637e0 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/StringExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/StringExtensions.cs @@ -1,5 +1,7 @@ // Copyright (c) Microsoft. All rights reserved. +using System.Collections.Generic; +using System.Globalization; using System.Text.RegularExpressions; using Microsoft.PowerFx.Types; @@ -27,4 +29,30 @@ internal static partial class StringExtensions public static FormulaValue ToFormula(this string? value) => string.IsNullOrWhiteSpace(value) ? FormulaValue.NewBlank() : FormulaValue.New(value); + + public static string FormatType(this string identifier) => FormatIdentifier(identifier); + + public static string FormatName(this string identifier) => FormatIdentifier(identifier, skipFirst: true); + + private static string FormatIdentifier(string identifier, bool skipFirst = false) + { + string[] words = identifier.Split('_'); + + // Capitalize each word + for (int index = skipFirst ? 1 : 0; index < words.Length; ++index) + { + words[index] = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(words[index]); + } + + // Combine the words and return + return string.Concat(words); + } + + public static IEnumerable ByLine(this string source) + { + foreach (string line in source.Trim().Split('\n')) + { + yield return line.TrimEnd(); + } + } } diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeActionExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeActionExecutor.cs index 042b7c4b68..ac09c9a605 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeActionExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeActionExecutor.cs @@ -5,6 +5,7 @@ using System.Diagnostics; using System.Threading; using System.Threading.Tasks; using Microsoft.Agents.AI.Workflows.Declarative.Extensions; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; using Microsoft.Bot.ObjectModel; using Microsoft.Extensions.Logging; @@ -21,7 +22,7 @@ internal abstract class DeclarativeActionExecutor(TAction model, Workfl public new TAction Model => (TAction)base.Model; } -internal abstract class DeclarativeActionExecutor : Executor +internal abstract class DeclarativeActionExecutor : Executor, IModeledAction { private string? _parentId; private readonly WorkflowFormulaState _state; diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeWorkflowContext.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeWorkflowContext.cs index 018b99bc49..cabec25607 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeWorkflowContext.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeWorkflowContext.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.Agents.AI.Workflows.Declarative.Extensions; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; using Microsoft.Bot.ObjectModel; using Microsoft.PowerFx.Types; diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeWorkflowExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeWorkflowExecutor.cs index b0e9b169a3..bfb73e644e 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeWorkflowExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeWorkflowExecutor.cs @@ -16,8 +16,7 @@ internal sealed class DeclarativeWorkflowExecutor( WorkflowAgentProvider agentProvider, WorkflowFormulaState state, Func inputTransform) : - Executor(workflowId) - where TInput : notnull + Executor(workflowId), IModeledAction where TInput : notnull { public override async ValueTask HandleAsync(TInput message, IWorkflowContext context) { diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DelegateActionExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DelegateActionExecutor.cs index 5090f4771c..569b498aa6 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DelegateActionExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DelegateActionExecutor.cs @@ -1,15 +1,13 @@ // Copyright (c) Microsoft. All rights reserved. using System.Diagnostics; -using System.Threading; using System.Threading.Tasks; using Microsoft.Agents.AI.Workflows.Declarative.Extensions; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; namespace Microsoft.Agents.AI.Workflows.Declarative.Interpreter; -internal delegate ValueTask DelegateAction(IWorkflowContext context, TMessage message, CancellationToken cancellationToken) where TMessage : notnull; - internal sealed class DelegateActionExecutor(string actionId, WorkflowFormulaState state, DelegateAction? action = null, bool emitResult = true) : DelegateActionExecutor(actionId, state, action, emitResult) { @@ -21,7 +19,7 @@ internal sealed class DelegateActionExecutor(string actionId, WorkflowFormulaSta } } -internal class DelegateActionExecutor : Executor where TMessage : notnull +internal class DelegateActionExecutor : Executor, IModeledAction where TMessage : notnull { private readonly WorkflowFormulaState _state; private readonly DelegateAction? _action; diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/InputPortAction.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/InputPortAction.cs new file mode 100644 index 0000000000..5f8d691efe --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/InputPortAction.cs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft. All rights reserved. + +namespace Microsoft.Agents.AI.Workflows.Declarative.Interpreter; + +internal sealed class InputPortAction(InputPort port) : IModeledAction +{ + public string Id => port.Id; + public InputPort InputPort => port; +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowActionVisitor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowActionVisitor.cs index 23c51e8ea1..172f156371 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowActionVisitor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowActionVisitor.cs @@ -5,6 +5,7 @@ using System.Diagnostics; using System.Linq; using Microsoft.Agents.AI.Workflows.Declarative.Events; using Microsoft.Agents.AI.Workflows.Declarative.Extensions; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; using Microsoft.Bot.ObjectModel; @@ -26,8 +27,8 @@ internal sealed class WorkflowActionVisitor : DialogActionVisitor public static string Restart(string actionId) => $"{actionId}_{nameof(Restart)}"; } - private readonly WorkflowBuilder _workflowBuilder; - private readonly DeclarativeWorkflowModel _workflowModel; + private readonly Executor _rootAction; + private readonly WorkflowModel> _workflowModel; private readonly DeclarativeWorkflowOptions _workflowOptions; private readonly WorkflowFormulaState _workflowState; @@ -36,8 +37,8 @@ internal sealed class WorkflowActionVisitor : DialogActionVisitor WorkflowFormulaState state, DeclarativeWorkflowOptions options) { - this._workflowBuilder = new WorkflowBuilder(rootAction); - this._workflowModel = new DeclarativeWorkflowModel(rootAction); + this._rootAction = rootAction; + this._workflowModel = new WorkflowModel>((IModeledAction)rootAction); this._workflowOptions = options; this._workflowState = state; } @@ -46,11 +47,12 @@ internal sealed class WorkflowActionVisitor : DialogActionVisitor public Workflow Complete() { - // Process the cached links - this._workflowModel.ConnectNodes(this._workflowBuilder); + WorkflowModelBuilder builder = new(this._rootAction); + + this._workflowModel.Build(builder); // Build final workflow - return this._workflowBuilder.Build(); + return builder.WorkflowBuilder.Build(); } protected override void Visit(ActionScope item) @@ -250,9 +252,8 @@ internal sealed class WorkflowActionVisitor : DialogActionVisitor // Define input action string inputId = QuestionExecutor.Steps.Input(actionId); - //ModeledPort inputPort = new(InputPort.Create(inputId)); // %%% MODELING - InputPort inputPort = InputPort.Create(inputId); - this._workflowModel.AddPort(inputPort, parentId); + InputPortAction inputPort = new(InputPort.Create(inputId)); + this._workflowModel.AddNode(inputPort, parentId); this._workflowModel.AddLinkFromPeer(parentId, inputId); // Capture input response @@ -474,13 +475,13 @@ internal sealed class WorkflowActionVisitor : DialogActionVisitor } private void ContinueWith( - Executor executor, + IModeledAction action, string parentId, Func? condition = null, Action? completionHandler = null) { - this._workflowModel.AddNode(executor, parentId, completionHandler); - this._workflowModel.AddLinkFromPeer(parentId, executor.Id, condition); + this._workflowModel.AddNode(action, parentId, completionHandler); + this._workflowModel.AddLinkFromPeer(parentId, action.Id, condition); } private string ContinuationFor(string parentId, DelegateAction? stepAction = null) => this.ContinuationFor(parentId, parentId, stepAction); @@ -493,7 +494,7 @@ internal sealed class WorkflowActionVisitor : DialogActionVisitor } private void RestartAfter(string actionId, string parentId) => - this._workflowModel.AddNode(new DelegateActionExecutor($"{actionId}_Continue", this._workflowState), parentId); + this._workflowModel.AddNode(new DelegateActionExecutor(Steps.Restart(actionId), this._workflowState), parentId); private static string GetParentId(BotElement item) => item.GetParentId() ?? diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowCodeBuilder.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowCodeBuilder.cs new file mode 100644 index 0000000000..33eb5b6a0e --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowCodeBuilder.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System.Collections.Generic; +using System.Diagnostics; +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; + +namespace Microsoft.Agents.AI.Workflows.Declarative.Interpreter; + +internal sealed class WorkflowCodeBuilder : IModelBuilder +{ + private readonly HashSet _actions; + private readonly List _definitions; + private readonly List _instances; + private readonly List _edges; + private readonly string _rootId; + + public WorkflowCodeBuilder(string rootId) + { + this._actions = []; + this._definitions = []; + this._instances = []; + this._edges = []; + this._rootId = rootId; + } + + public string GenerateCode(string? workflowNamespace, string? workflowPrefix) + { + ProviderTemplate template = + new(this._rootId, this._definitions, this._instances, this._edges) + { + Namespace = workflowNamespace, + Prefix = workflowPrefix, + }; + + return template.TransformText().Trim(); + } + + public void Connect(IModeledAction source, IModeledAction target, string? condition) + { + Debug.WriteLine($"> CONNECT: {source.Id} => {target.Id}{(condition is null ? string.Empty : " (?)")}"); + + this.HandelAction(source); + this.HandelAction(target); + + this._edges.Add(new EdgeTemplate(source.Id, target.Id, condition).TransformText()); + } + + private void HandelAction(IModeledAction action) + { + // All templates are based on "CodeTemplate" + if (action is not CodeTemplate template) + { + // Something has gone very wrong. + throw new DeclarativeModelException($"Unable to generate code for: {action.GetType().Name}."); + } + + if (this._actions.Add(action.Id)) + { + switch (action) + { + case EmptyTemplate: + case DefaultTemplate: + this._instances.Add(template.TransformText()); + break; + case ActionTemplate actionTemplate: + this._definitions.Add(template.TransformText()); + this._instances.Add(new InstanceTemplate(action.Id, this._rootId, actionTemplate.UseAgentProvider).TransformText()); + break; + case RootTemplate: + this._definitions.Add(template.TransformText()); + break; + } + } + } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeWorkflowModel.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowModel.cs similarity index 52% rename from dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeWorkflowModel.cs rename to dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowModel.cs index 53caa6d4ec..1837c3b334 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeWorkflowModel.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowModel.cs @@ -7,14 +7,21 @@ using System.Linq; namespace Microsoft.Agents.AI.Workflows.Declarative.Interpreter; -/// -/// Provides dynamic model for constructing a declarative workflow. -/// -internal sealed class DeclarativeWorkflowModel +internal interface IModeledAction { - public DeclarativeWorkflowModel(Executor rootStep) + string Id { get; } +} + +internal interface IModelBuilder where TCondition : class +{ + void Connect(IModeledAction source, IModeledAction target, TCondition? condition = null); +} + +internal sealed class WorkflowModel where TCondition : class +{ + public WorkflowModel(IModeledAction rootAction) { - this.DefineNode(rootStep); + this.DefineNode(rootAction); } private Dictionary Nodes { get; } = []; @@ -36,31 +43,19 @@ internal sealed class DeclarativeWorkflowModel return sourceNode.Depth; } - public void AddNode(Executor executor, string parentId, Action? completionHandler = null) + public void AddNode(IModeledAction action, string parentId, Action? completionHandler = null) { if (!this.Nodes.TryGetValue(parentId, out ModelNode? parentNode)) { - throw new DeclarativeModelException($"Unresolved parent for {executor.Id}: {parentId}."); + throw new DeclarativeModelException($"Unresolved parent for {action.Id}: {parentId}."); } - ModelNode stepNode = this.DefineNode(executor, parentNode, completionHandler); + ModelNode stepNode = this.DefineNode(action, parentNode, completionHandler); parentNode.Children.Add(stepNode); } - public void AddPort(InputPort port, string parentId) - { - if (!this.Nodes.TryGetValue(parentId, out ModelNode? parentNode)) - { - throw new DeclarativeModelException($"Unresolved parent for {port.Id}: {parentId}."); - } - - ModelNode stepNode = this.DefineNode(port, parentNode); - - parentNode.Children.Add(stepNode); - } - - public void AddLinkFromPeer(string parentId, string targetId, Func? condition = null) + public void AddLinkFromPeer(string parentId, string targetId, TCondition? condition = null) { if (!this.Nodes.TryGetValue(parentId, out ModelNode? parentNode)) { @@ -77,7 +72,7 @@ internal sealed class DeclarativeWorkflowModel this.Links.Add(new ModelLink(sourceNode, targetId, condition)); } - public void AddLink(string sourceId, string targetId, Func? condition = null) + public void AddLink(string sourceId, string targetId, TCondition? condition = null) { if (!this.Nodes.TryGetValue(sourceId, out ModelNode? sourceNode)) { @@ -87,14 +82,14 @@ internal sealed class DeclarativeWorkflowModel this.Links.Add(new ModelLink(sourceNode, targetId, condition)); } - public void ConnectNodes(WorkflowBuilder workflowBuilder) + public void Build(IModelBuilder builder) { - // Push `Values` into array to avoid modification during iteration. + // Push into array to avoid modification during iteration. foreach (ModelNode node in this.Nodes.Values.ToArray()) { if (node.CompletionHandler is not null) { - Debug.WriteLine($"> CLOSE: {node.Id} (x{node.Children.Count})"); + Debug.WriteLine($"> CLOSE: {node.Action.Id} (x{node.Children.Count})"); node.CompletionHandler.Invoke(); } @@ -104,36 +99,23 @@ internal sealed class DeclarativeWorkflowModel { if (!this.Nodes.TryGetValue(link.TargetId, out ModelNode? targetNode)) { - throw new DeclarativeModelException($"Unresolved target for {link.Source.Id}: {link.TargetId}."); + throw new DeclarativeModelException($"Unresolved target for {link.Source.Action.Id}: {link.TargetId}."); } - Debug.WriteLine($"> CONNECT: {link.Source.Id} => {link.TargetId}{(link.Condition is null ? string.Empty : " (?)")}"); - - workflowBuilder.AddEdge(GetExecutorIsh(link.Source), GetExecutorIsh(targetNode), link.Condition); + builder.Connect(link.Source.Action, targetNode.Action, link.Condition); } - - static ExecutorIsh GetExecutorIsh(ModelNode node) => node.Port ?? (ExecutorIsh)node.Executor; } - private ModelNode DefineNode(Executor executor, ModelNode? parentNode = null, Action? completionHandler = null) + private ModelNode DefineNode(IModeledAction action, ModelNode? parentNode = null, Action? completionHandler = null) { - ModelNode stepNode = new(executor, port: null, parentNode, completionHandler); + ModelNode newNode = new(action, parentNode, completionHandler); - this.Nodes.Add(stepNode.Id, stepNode); + this.Nodes.Add(action.Id, newNode); - return stepNode; + return newNode; } - private ModelNode DefineNode(InputPort port, ModelNode? parentNode = null) - { - ModelNode stepNode = new(executor: null!, port, parentNode); - - this.Nodes.Add(stepNode.Id, stepNode); - - return stepNode; - } - - internal TAction? LocateParent(string? itemId) where TAction : Executor + public TAction? LocateParent(string? itemId) where TAction : class, IModeledAction { if (string.IsNullOrEmpty(itemId)) { @@ -147,26 +129,20 @@ internal sealed class DeclarativeWorkflowModel throw new DeclarativeModelException($"Unresolved child: {itemId}."); } - if (itemNode.ExecutorType == typeof(TAction)) + if (itemNode.Action.GetType() == typeof(TAction)) { - return (TAction)itemNode.Executor; + return (TAction)itemNode.Action; } - itemId = itemNode.Parent?.Id; + itemId = itemNode.Parent?.Action.Id; } return null; } - private sealed class ModelNode(Executor executor, InputPort? port, ModelNode? parent = null, Action? completionHandler = null) + private sealed class ModelNode(IModeledAction action, ModelNode? parent = null, Action? completionHandler = null) { - public string Id => port?.Id ?? executor.Id; - - public Executor Executor => executor; - - public InputPort? Port => port; - - public Type? ExecutorType => this.Port?.GetType() ?? this.Executor.GetType(); + public IModeledAction Action => action; public ModelNode? Parent { get; } = parent; @@ -177,5 +153,5 @@ internal sealed class DeclarativeWorkflowModel public Action? CompletionHandler => completionHandler; } - private sealed record class ModelLink(ModelNode Source, string TargetId, Func? Condition = null); + private sealed record class ModelLink(ModelNode Source, string TargetId, TCondition? Condition = null); } diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowModelBuilder.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowModelBuilder.cs new file mode 100644 index 0000000000..dfac6e0543 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowModelBuilder.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System; +using System.Diagnostics; + +namespace Microsoft.Agents.AI.Workflows.Declarative.Interpreter; + +internal sealed class WorkflowModelBuilder : IModelBuilder> +{ + public WorkflowModelBuilder(Executor rootAction) + { + this.WorkflowBuilder = new WorkflowBuilder(rootAction); + } + + public WorkflowBuilder WorkflowBuilder { get; } + + public void Connect(IModeledAction source, IModeledAction target, Func? condition) + { + Debug.WriteLine($"> CONNECT: {source.Id} => {target.Id}{(condition is null ? string.Empty : " (?)")}"); + + this.WorkflowBuilder.AddEdge( + GetExecutorIsh(source), + GetExecutorIsh(target), + condition); + } + + private static ExecutorIsh GetExecutorIsh(IModeledAction action) => + action switch + { + InputPortAction port => port.InputPort, + Executor executor => executor, + _ => throw new DeclarativeModelException($"Unsupported modeled action: {action.GetType().Name}.") + }; +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowTemplateVisitor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowTemplateVisitor.cs new file mode 100644 index 0000000000..88d4486255 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowTemplateVisitor.cs @@ -0,0 +1,479 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System; +using System.Diagnostics; +using System.Linq; +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Agents.AI.Workflows.Declarative.Extensions; +using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; +using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; +using Microsoft.Bot.ObjectModel; + +namespace Microsoft.Agents.AI.Workflows.Declarative.Interpreter; + +internal sealed class WorkflowTemplateVisitor : DialogActionVisitor +{ + private readonly string _rootId; + private readonly WorkflowModel _workflowModel; + + public WorkflowTemplateVisitor( + string workflowId, + WorkflowTypeInfo typeInfo) + { + this._rootId = workflowId; + this._workflowModel = new WorkflowModel(new RootTemplate(workflowId, typeInfo)); + } + + public bool HasUnsupportedActions { get; private set; } + + public string Complete(string? workflowNamespace = null, string? workflowPrefix = null) + { + WorkflowCodeBuilder builder = new(this._rootId); + + this._workflowModel.Build(builder); + + return builder.GenerateCode(workflowNamespace, workflowPrefix); + } + + protected override void Visit(ActionScope item) + { + this.Trace(item); + + string parentId = GetParentId(item); + + // Handle case where root element is its own parent + if (item.Id.Equals(parentId)) + { + parentId = WorkflowActionVisitor.Steps.Root(parentId); + } + + this.ContinueWith(new EmptyTemplate(item.Id.Value, this._rootId), parentId, condition: null, CompletionHandler); + + //// Complete the action scope. + void CompletionHandler() + { + // No completion for root scope + if (this._workflowModel.GetDepth(item.Id.Value) > 1) + { + // Define post action for this scope + string completionId = this.ContinuationFor(item.Id.Value); + this._workflowModel.AddLinkFromPeer(item.Id.Value, completionId); + // Transition to post action of parent scope + this._workflowModel.AddLink(completionId, WorkflowActionVisitor.Steps.Post(parentId)); + } + } + } + + public override void VisitConditionItem(ConditionItem item) + { + this.Trace(item); + + string parentId = GetParentId(item); + ConditionGroupTemplate? conditionGroup = this._workflowModel.LocateParent(parentId); + if (conditionGroup is not null) + { + string stepId = ConditionGroupExecutor.Steps.Item(conditionGroup.Model, item); + this._workflowModel.AddNode(new EmptyTemplate(stepId, this._rootId), parentId, CompletionHandler); + + base.VisitConditionItem(item); + + // Complete the condition item. + void CompletionHandler() + { + string completionId = this.ContinuationFor(stepId); + this._workflowModel.AddLink(completionId, WorkflowActionVisitor.Steps.Post(conditionGroup.Id)); + + // Merge link when no action group is defined + if (!item.Actions.Any()) + { + this._workflowModel.AddLink(stepId, completionId); + } + } + } + } + + protected override void Visit(ConditionGroup item) + { + this.Trace(item); + + ConditionGroupTemplate action = new(item); + this.ContinueWith(action); + this.ContinuationFor(action.Id, parentId: action.ParentId); + + string? lastConditionItemId = null; + foreach (ConditionItem conditionItem in item.Conditions) + { + // Create conditional link for conditional action + lastConditionItemId = ConditionGroupExecutor.Steps.Item(item, conditionItem); + this._workflowModel.AddLink(action.Id, lastConditionItemId, $@"ActionExecutor.IsMatch(""{lastConditionItemId}"", result)"); + + conditionItem.Accept(this); + } + + if (item.ElseActions?.Actions.Length > 0) + { + if (lastConditionItemId is not null) + { + // Create clean start for else action from prior conditions + this.RestartAfter(lastConditionItemId, action.Id); + } + + // Create conditional link for else action + string stepId = ConditionGroupExecutor.Steps.Else(item); + this._workflowModel.AddLink(action.Id, stepId, $@"ActionExecutor.IsMatch(""{stepId}"", result)"); + } + } + + protected override void Visit(GotoAction item) + { + this.Trace(item); + + // Represent action with default executor + DefaultTemplate action = new(item, this._rootId); + this.ContinueWith(action); + // Transition to target action + this._workflowModel.AddLink(action.Id, item.ActionId.Value); + // Define a clean-start to ensure "goto" is not a source for any edge + this.RestartAfter(action.Id, action.ParentId); + } + + protected override void Visit(Foreach item) + { + this.Trace(item); + + // Entry point for loop + ForeachTemplate action = new(item); + string loopId = ForeachExecutor.Steps.Next(action.Id); + this.ContinueWith(action, condition: null, CompletionHandler); // Foreach + // Transition to select the next item + this.ContinueWith(new EmptyTemplate(loopId, this._rootId, $"{action.Id.FormatName()}.{nameof(ForeachExecutor.TakeNextAsync)}"), action.Id); + + // Transition to post action if no more items + string continuationId = this.ContinuationFor(action.Id, parentId: action.ParentId); // Action continuation + this._workflowModel.AddLink(loopId, continuationId, $"!{action.Id.FormatName()}.{nameof(ForeachExecutor.HasValue)}"); + + // Transition to start of inner actions if there is a current item + string startId = ForeachExecutor.Steps.Start(action.Id); + this._workflowModel.AddNode(new EmptyTemplate(startId, this._rootId), action.Id); + this._workflowModel.AddLink(loopId, startId, $"{action.Id.FormatName()}.{nameof(ForeachExecutor.HasValue)}"); + + void CompletionHandler() + { + // Transition to end of inner actions + string endActionsId = ForeachExecutor.Steps.End(action.Id); // Loop continuation + this.ContinueWith(new EmptyTemplate(endActionsId, this._rootId, $"{action.Id.FormatName()}.{nameof(ForeachExecutor.ResetAsync)}"), action.Id); + // Transition to select the next item + this._workflowModel.AddLink(endActionsId, loopId); + } + } + + protected override void Visit(BreakLoop item) + { + this.Trace(item); + + // Locate the nearest "Foreach" loop that contains this action + ForeachTemplate? loopAction = this._workflowModel.LocateParent(item.GetParentId()); + // Skip action if its not contained a loop + if (loopAction is not null) + { + // Represent action with default executor + DefaultTemplate action = new(item, this._rootId); + this.ContinueWith(action); + // Transition to post action + this._workflowModel.AddLink(action.Id, WorkflowActionVisitor.Steps.Post(loopAction.Id)); + // Define a clean-start to ensure "break" is not a source for any edge + this.RestartAfter(action.Id, action.ParentId); + } + } + + protected override void Visit(ContinueLoop item) + { + this.Trace(item); + + // Locate the nearest "Foreach" loop that contains this action + ForeachTemplate? loopAction = this._workflowModel.LocateParent(item.GetParentId()); + // Skip action if its not contained a loop + if (loopAction is not null) + { + // Represent action with default executor + DefaultTemplate action = new(item, this._rootId); + this.ContinueWith(action); + // Transition to select the next item + this._workflowModel.AddLink(action.Id, ForeachExecutor.Steps.Start(loopAction.Id)); + // Define a clean-start to ensure "continue" is not a source for any edge + this.RestartAfter(action.Id, action.ParentId); + } + } + + protected override void Visit(Question item) + { + this.NotSupported(item); + //this.Trace(item); + + //this.ContinueWith(new QuestionTemplate(item)); + } + + protected override void Visit(EndDialog item) + { + this.Trace(item); + + // Represent action with default executor + DefaultTemplate action = new(item, this._rootId); + this.ContinueWith(action); + // Define a clean-start to ensure "end" is not a source for any edge + this.RestartAfter(action.Id, action.ParentId); + } + + protected override void Visit(EndConversation item) + { + this.Trace(item); + + // Represent action with default executor + DefaultTemplate action = new(item, this._rootId); + this.ContinueWith(action); + // Define a clean-start to ensure "end" is not a source for any edge + this.RestartAfter(action.Id, action.ParentId); + } + + protected override void Visit(CreateConversation item) + { + this.Trace(item); + + this.ContinueWith(new CreateConversationTemplate(item)); + } + + protected override void Visit(AddConversationMessage item) + { + this.Trace(item); + + this.ContinueWith(new AddConversationMessageTemplate(item)); + } + + protected override void Visit(CopyConversationMessages item) + { + this.Trace(item); + + this.ContinueWith(new CopyConversationMessagesTemplate(item)); + } + + protected override void Visit(InvokeAzureAgent item) + { + this.Trace(item); + + this.ContinueWith(new InvokeAzureAgentTemplate(item)); + } + + protected override void Visit(RetrieveConversationMessage item) + { + this.Trace(item); + + this.ContinueWith(new RetrieveConversationMessageTemplate(item)); + } + + protected override void Visit(RetrieveConversationMessages item) + { + this.Trace(item); + + this.ContinueWith(new RetrieveConversationMessagesTemplate(item)); + } + + protected override void Visit(SetVariable item) + { + this.Trace(item); + + this.ContinueWith(new SetVariableTemplate(item)); + } + + protected override void Visit(SetMultipleVariables item) + { + this.Trace(item); + + this.ContinueWith(new SetMultipleVariablesTemplate(item)); + } + + protected override void Visit(SetTextVariable item) + { + this.Trace(item); + + this.ContinueWith(new SetTextVariableTemplate(item)); + } + + protected override void Visit(ClearAllVariables item) + { + this.Trace(item); + + this.ContinueWith(new ClearAllVariablesTemplate(item)); + } + + protected override void Visit(ResetVariable item) + { + this.Trace(item); + + this.ContinueWith(new ResetVariableTemplate(item)); + } + + protected override void Visit(EditTable item) + { + this.NotSupported(item); + //this.Trace(item); + + //this.ContinueWith(new EditTableTemplate(item)); + } + + protected override void Visit(EditTableV2 item) + { + this.NotSupported(item); + //this.Trace(item); + + //this.ContinueWith(new EditTableV2Template(item)); + } + + protected override void Visit(ParseValue item) + { + this.Trace(item); + + this.ContinueWith(new ParseValueTemplate(item)); + } + + protected override void Visit(SendActivity item) + { + this.Trace(item); + + this.ContinueWith(new SendActivityTemplate(item)); + } + + #region Not supported + + protected override void Visit(AnswerQuestionWithAI item) => this.NotSupported(item); + + protected override void Visit(DeleteActivity item) => this.NotSupported(item); + + protected override void Visit(GetActivityMembers item) => this.NotSupported(item); + + protected override void Visit(UpdateActivity item) => this.NotSupported(item); + + protected override void Visit(ActivateExternalTrigger item) => this.NotSupported(item); + + protected override void Visit(DisableTrigger item) => this.NotSupported(item); + + protected override void Visit(WaitForConnectorTrigger item) => this.NotSupported(item); + + protected override void Visit(InvokeConnectorAction item) => this.NotSupported(item); + + protected override void Visit(InvokeCustomModelAction item) => this.NotSupported(item); + + protected override void Visit(InvokeFlowAction item) => this.NotSupported(item); + + protected override void Visit(InvokeAIBuilderModelAction item) => this.NotSupported(item); + + protected override void Visit(InvokeSkillAction item) => this.NotSupported(item); + + protected override void Visit(AdaptiveCardPrompt item) => this.NotSupported(item); + + protected override void Visit(CSATQuestion item) => this.NotSupported(item); + + protected override void Visit(OAuthInput item) => this.NotSupported(item); + + protected override void Visit(BeginDialog item) => this.NotSupported(item); + + protected override void Visit(UnknownDialogAction item) => this.NotSupported(item); + + protected override void Visit(RepeatDialog item) => this.NotSupported(item); + + protected override void Visit(ReplaceDialog item) => this.NotSupported(item); + + protected override void Visit(CancelAllDialogs item) => this.NotSupported(item); + + protected override void Visit(CancelDialog item) => this.NotSupported(item); + + protected override void Visit(EmitEvent item) => this.NotSupported(item); + + protected override void Visit(GetConversationMembers item) => this.NotSupported(item); + + protected override void Visit(HttpRequestAction item) => this.NotSupported(item); + + protected override void Visit(RecognizeIntent item) => this.NotSupported(item); + + protected override void Visit(TransferConversation item) => this.NotSupported(item); + + protected override void Visit(TransferConversationV2 item) => this.NotSupported(item); + + protected override void Visit(SignOutUser item) => this.NotSupported(item); + + protected override void Visit(LogCustomTelemetryEvent item) => this.NotSupported(item); + + protected override void Visit(DisconnectedNodeContainer item) => this.NotSupported(item); + + protected override void Visit(CreateSearchQuery item) => this.NotSupported(item); + + protected override void Visit(SearchKnowledgeSources item) => this.NotSupported(item); + + protected override void Visit(SearchAndSummarizeWithCustomModel item) => this.NotSupported(item); + + protected override void Visit(SearchAndSummarizeContent item) => this.NotSupported(item); + + #endregion + + private void ContinueWith( + ActionTemplate action, + string? condition = null, + Action? completionHandler = null) + { + this.ContinueWith(action, action.ParentId, condition, completionHandler); + } + + private void ContinueWith( + IModeledAction action, + string parentId, + string? condition = null, + Action? completionHandler = null) + { + this._workflowModel.AddNode(action, parentId, completionHandler); + this._workflowModel.AddLinkFromPeer(parentId, action.Id, condition); + } + + private string ContinuationFor(string parentId, string? stepAction = null) => this.ContinuationFor(parentId, parentId, stepAction); + + private string ContinuationFor(string actionId, string parentId, string? stepAction = null) + { + actionId = WorkflowActionVisitor.Steps.Post(actionId); + + this._workflowModel.AddNode(new EmptyTemplate(actionId, this._rootId, stepAction), parentId); + + return actionId; + } + + private void RestartAfter(string actionId, string parentId) => + this._workflowModel.AddNode(new EmptyTemplate(WorkflowActionVisitor.Steps.Restart(actionId), this._rootId), parentId); + + private static string GetParentId(BotElement item) => + item.GetParentId() ?? + throw new DeclarativeModelException($"Missing parent ID for action element: {item.GetId()} [{item.GetType().Name}]."); + + private void NotSupported(DialogAction item) + { + Debug.WriteLine($"> UNKNOWN: {FormatItem(item)} => {FormatParent(item)}"); + this.HasUnsupportedActions = true; + } + + private void Trace(BotElement item) => + Debug.WriteLine($"> VISIT: {new string('\t', this._workflowModel.GetDepth(item.GetParentId()))}{FormatItem(item)} => {FormatParent(item)}"); + + private void Trace(DialogAction item) + { + string? parentId = item.GetParentId(); + if (item.Id.Equals(parentId ?? string.Empty)) + { + parentId = WorkflowActionVisitor.Steps.Root(parentId); + } + + Debug.WriteLine($"> VISIT: {new string('\t', this._workflowModel.GetDepth(parentId))}{FormatItem(item)} => {FormatParent(item)}"); + } + + private static string FormatItem(BotElement element) => $"{element.GetType().Name} ({element.GetId()})"; + + private static string FormatParent(BotElement element) => + element.Parent is null ? + throw new DeclarativeModelException($"Undefined parent for {element.GetType().Name} that is member of {element.GetId()}.") : + $"{element.Parent.GetType().Name} ({element.GetParentId()})"; +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/ActionExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/ActionExecutor.cs new file mode 100644 index 0000000000..9ceceaf991 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/ActionExecutor.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI.Workflows.Declarative.Extensions; +using Microsoft.Agents.AI.Workflows.Declarative.Interpreter; + +namespace Microsoft.Agents.AI.Workflows.Declarative.Kit; + +/// +/// Base class for action executors that do not consume the input message (most). +/// +/// The executor id +/// Session to support formula expressions. +public abstract class ActionExecutor(string id, FormulaSession session) : ActionExecutor(id, session) +{ + /// + protected override ValueTask ExecuteAsync(IWorkflowContext context, ActionExecutorResult message, CancellationToken cancellationToken = default) => + this.ExecuteAsync(context, cancellationToken); + + /// + /// Executes the core logic of the action. + /// + /// The workflow execution context providing messaging and state services. + /// A token that can be used to observe cancellation. + /// A representing the asynchronous execution operation. + protected abstract ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken = default); + + /// + /// Test wether the provided value matches the value returned by the prior executor. + /// + /// The value to test against the message result. + /// The message containing the prior executor result. + /// True if the value matches the message result + public static bool IsMatch(TValue value, object? message) where TValue : class + { + ActionExecutorResult executorMessage = ActionExecutorResult.ThrowIfNot(message); + + object? result = executorMessage.Result; + if (result is TValue resultValue) + { + return value.Equals(resultValue); + } + + return false; + } +} + +/// +/// Base class for an action executor that receives the initial trigger message. +/// +/// The type of message being handled +public abstract class ActionExecutor : Executor where TMessage : notnull +{ + private readonly FormulaSession _session; + + /// + /// Initializes a new instance of the class. + /// + /// The executor id + /// Session to support formula expressions. + protected ActionExecutor(string id, FormulaSession session) + : base(id) + { + this._session = session; + } + + /// + public override async ValueTask HandleAsync(TMessage message, IWorkflowContext context) + { + object? result = await this.ExecuteAsync(new DeclarativeWorkflowContext(context, this._session.State), message, cancellationToken: default).ConfigureAwait(false); + Debug.WriteLine($"RESULT #{this.Id} - {result ?? "(null)"}"); + + await context.SendResultMessageAsync(this.Id, result).ConfigureAwait(false); + } + + /// + /// Executes the core logic of the action. + /// + /// The workflow execution context providing messaging and state services. + /// The the message handled by this executor. + /// A token that can be used to observe cancellation. + /// A representing the asynchronous execution operation. + protected abstract ValueTask ExecuteAsync(IWorkflowContext context, TMessage message, CancellationToken cancellationToken = default); +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/ActionExecutorResult.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/ActionExecutorResult.cs similarity index 93% rename from dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/ActionExecutorResult.cs rename to dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/ActionExecutorResult.cs index ad837e35cf..99d2e29f50 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/ActionExecutorResult.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/ActionExecutorResult.cs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. -namespace Microsoft.Agents.AI.Workflows.Declarative.Interpreter; +namespace Microsoft.Agents.AI.Workflows.Declarative.Kit; /// /// Message sent to initiate a transition to another . diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/AgentExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/AgentExecutor.cs new file mode 100644 index 0000000000..8189e9b8aa --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/AgentExecutor.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI.Workflows.Declarative.Extensions; +using Microsoft.Extensions.AI; + +namespace Microsoft.Agents.AI.Workflows.Declarative.Kit; + +/// +/// Base class for agent invokcation. +/// +/// The executor id +/// Session to support formula expressions. +/// Provider for accessing and manipulating agents and conversations. +public abstract class AgentExecutor(string id, FormulaSession session, WorkflowAgentProvider agentProvider) : ActionExecutor(id, session) +{ + /// + /// Invokes an agent using the provided . + /// + /// The workflow execution context providing messaging and state services. + /// The name or identifier of the agent. + /// The identifier of the conversation. + /// Send the agent's response as workflow output. (default: true). + /// Optional additional instructions to the agent. + /// Optional messages to add to the conversation prior to invocation. + /// A token that can be used to observe cancellation. + /// + protected ValueTask InvokeAgentAsync( + IWorkflowContext context, + string agentName, + string? conversationId, + bool autoSend, + string? additionalInstructions = null, + IEnumerable? inputMessages = null, + CancellationToken cancellationToken = default) + => agentProvider.InvokeAgentAsync(this.Id, context, agentName, conversationId, autoSend, additionalInstructions, inputMessages, cancellationToken); +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/DelegateExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/DelegateExecutor.cs new file mode 100644 index 0000000000..e01dd3d751 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/DelegateExecutor.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.Agents.AI.Workflows.Declarative.Kit; + +/// +/// Signature for a delegate that can be used with . +/// +/// The type of message being handled +/// The workflow execution context providing messaging and state services. +/// The the message handled by this executor. +/// A token that can be used to observe cancellation. +/// A representing the asynchronous execution operation. +public delegate ValueTask DelegateAction(IWorkflowContext context, TMessage message, CancellationToken cancellationToken) where TMessage : notnull; + +/// +/// Base class for an action executor that receives the initial trigger message. +/// +public sealed class DelegateExecutor(string id, FormulaSession session, DelegateAction? action = null) + : DelegateExecutor(id, session, action); + +/// +/// Base class for an action executor that receives the initial trigger message. +/// +/// The type of message being handled +public class DelegateExecutor : ActionExecutor where TMessage : notnull +{ + private readonly DelegateAction? _action; + + /// + /// Initializes a new instance of the class. + /// + /// The executor id + /// Session to support formula expressions. + /// An optional delegate to execute. + public DelegateExecutor(string id, FormulaSession session, DelegateAction? action = null) + : base(id, session) + { + this._action = action; + } + + /// + protected override async ValueTask ExecuteAsync(IWorkflowContext context, TMessage message, CancellationToken cancellationToken = default) + { + if (this._action is not null) + { + await this._action.Invoke(context, message, cancellationToken).ConfigureAwait(false); + } + + return default; + } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/FormulaSession.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/FormulaSession.cs new file mode 100644 index 0000000000..96233633d3 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/FormulaSession.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; + +namespace Microsoft.Agents.AI.Workflows.Declarative.Kit; + +/// +/// Represents a session for supporting formula expressions within a workflow. +/// +public abstract class FormulaSession +{ + internal abstract WorkflowFormulaState State { get; } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/IWorkflowContextExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/IWorkflowContextExtensions.cs new file mode 100644 index 0000000000..185068d550 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/IWorkflowContextExtensions.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System.Collections.Generic; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI.Workflows.Declarative.Extensions; +using Microsoft.Agents.AI.Workflows.Declarative.Interpreter; +using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; +using Microsoft.Bot.ObjectModel; +using Microsoft.Bot.ObjectModel.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.Kit; + +/// +/// Extension methods for that assist with +/// Power Fx expression evaluation. +/// +public static class IWorkflowContextExtensions +{ + /// + /// Formats a template lines using the workflow's declarative state + /// and evaluating any embedded expressions (e.g., Power Fx) contained within each line. + /// + /// The workflow execution context used to restore persisted state prior to formatting. + /// The template line to format. + /// A token that propagates notification when operation should be canceled. + /// + /// A single string containing the formatted results of all lines separated by newline characters. + /// A trailing newline will be present if at least one line was processed. + /// + /// + /// Example: + /// var text = await context.FormatAsync("Hello @{User.Name}", "Count: @{Metrics.Count}"); + /// + public static ValueTask FormatTemplateAsync(this IWorkflowContext context, string line, CancellationToken cancellationToken = default) => + context.FormatTemplateAsync([line], cancellationToken); + + /// + /// Formats a template lines using the workflow's declarative state + /// and evaluating any embedded expressions (e.g., Power Fx) contained within each line. + /// + /// The workflow execution context used to restore persisted state prior to formatting. + /// The template lines to format. + /// A token that propagates notification when operation should be canceled. + /// + /// A single string containing the formatted results of all lines separated by newline characters. + /// A trailing newline will be present if at least one line was processed. + /// + /// + /// Example: + /// var text = await context.FormatAsync("Hello @{User.Name}", "Count: @{Metrics.Count}"); + /// + public static async ValueTask FormatTemplateAsync(this IWorkflowContext context, IEnumerable lines, CancellationToken cancellationToken = default) + { + WorkflowFormulaState state = await context.GetStateAsync(cancellationToken: default).ConfigureAwait(false); + + StringBuilder builder = new(); + foreach (string line in lines) + { + builder.AppendLine(state.Engine.Format(TemplateLine.Parse(line))); + } + + return builder.ToString(); + } + + /// + /// Evaluate an expression using the workflow's declarative state. + /// + /// The workflow execution context used to restore persisted state prior to formatting. + /// The expression to evaluate. + /// A token that propagates notification when operation should be canceled. + /// The evaluated expression value + public static ValueTask EvaluateValueAsync(this IWorkflowContext context, string expression, CancellationToken cancellationToken = default) => + context.EvaluateValueAsync(expression, cancellationToken); + + /// + /// Evaluate an expression using the workflow's declarative state. + /// + /// The workflow execution context used to restore persisted state prior to formatting. + /// The expression to evaluate. + /// A token that propagates notification when operation should be canceled. + /// The evaluated expression value + public static async ValueTask EvaluateValueAsync(this IWorkflowContext context, string expression, CancellationToken cancellationToken = default) + { + WorkflowFormulaState state = await context.GetStateAsync(cancellationToken).ConfigureAwait(false); + + EvaluationResult result = state.Evaluator.GetValue(ValueExpression.Expression(expression)); + + return (TValue?)result.Value.ToObject(); + } + + /// + /// Evaluate an expression using the workflow's declarative state. + /// + /// The type of the list element. + /// The workflow execution context used to restore persisted state prior to formatting. + /// The expression to evaluate. + /// A token that propagates notification when operation should be canceled. + /// The evaluated list expression + public static async ValueTask?> EvaluateListAsync(this IWorkflowContext context, string expression, CancellationToken cancellationToken = default) + { + WorkflowFormulaState state = await context.GetStateAsync(cancellationToken).ConfigureAwait(false); + + EvaluationResult result = state.Evaluator.GetValue(ValueExpression.Expression(expression)); + + return result.Value.AsList(); + } + + /// + /// Convert the result of an expression to the specified target type. + /// + /// The workflow execution context used to restore persisted state prior to formatting. + /// Describes the target type for the value conversion. + /// The expression to evaluate. + /// A token that propagates notification when operation should be canceled. + /// The converted expression value + public static async ValueTask ConvertValueAsync(this IWorkflowContext context, VariableType targetType, string expression, CancellationToken cancellationToken = default) + { + object? sourceValue = await context.EvaluateValueAsync(expression, cancellationToken).ConfigureAwait(false); + return sourceValue.ConvertType(targetType); + } + + /// + /// Convert the variable value to the specified target type. + /// + /// The workflow execution context used to restore persisted state prior to formatting. + /// Describes the target type for the value conversion. + /// The key of the state value. + /// An optional name that specifies the scope to read.If null, the default scope is used. + /// A token that propagates notification when operation should be canceled. + /// The converted value + public static async ValueTask ConvertValueAsync(this IWorkflowContext context, VariableType targetType, string key, string? scopeName = null, CancellationToken cancellationToken = default) + { + object? sourceValue = await context.ReadStateAsync(key, scopeName).ConfigureAwait(false); + return sourceValue.ConvertType(targetType); + } + + /// + /// Evaluate an expression using the workflow's declarative state. + /// + /// The type of the list element. + /// The workflow execution context used to restore persisted state prior to formatting. + /// The key of the state value. + /// An optional name that specifies the scope to read.If null, the default scope is used. + /// The evaluated list expression + public static async ValueTask?> ReadListAsync(this IWorkflowContext context, string key, string? scopeName = null) + { + object? value = await context.ReadStateAsync(key, scopeName).ConfigureAwait(false); + return value.AsList(); + } + + private static async Task GetStateAsync(this IWorkflowContext context, CancellationToken cancellationToken) + { + if (context is DeclarativeWorkflowContext declarativeContext) + { + return declarativeContext.State; + } + + WorkflowFormulaState state = new(RecalcEngineFactory.Create()); + + await state.RestoreAsync(context, cancellationToken).ConfigureAwait(false); + + return state; + } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/RootExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/RootExecutor.cs new file mode 100644 index 0000000000..eca5404f84 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/RootExecutor.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI.Workflows.Declarative.Extensions; +using Microsoft.Agents.AI.Workflows.Declarative.Interpreter; +using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; +using Microsoft.Bot.ObjectModel; +using Microsoft.Extensions.AI; +using Microsoft.Extensions.Configuration; + +namespace Microsoft.Agents.AI.Workflows.Declarative.Kit; + +/// +/// Base class for an entry-point workflow executor that receives the initial trigger message. +/// +/// The type of the initial message that starts the workflow. +public abstract class RootExecutor : Executor where TInput : notnull +{ + private readonly IConfiguration? _configuration; + private readonly WorkflowAgentProvider _agentProvider; + private readonly WorkflowFormulaState _state; + private readonly Func? _inputTransform; + + /// + /// Get the shared formula session to provide to workflow instances. + /// + public FormulaSession Session { get; } + + /// + /// Initializes a new instance of the class. + /// + /// An optional identifier. If omitted, an identifier is generated by the base class. + /// Configuration options for workflow execution. + /// An optional function to transform the input message into a . + protected RootExecutor(string id, DeclarativeWorkflowOptions options, Func? inputTransform) + : base(id) + { + this._configuration = options.Configuration; + this._agentProvider = options.AgentProvider; + this._inputTransform = inputTransform; + this._state = new WorkflowFormulaState(options.CreateRecalcEngine()); + this._state.InitializeSystem(); + this.Session = new RootFormulaSession(this._state); + } + + /// + public override async ValueTask HandleAsync(TInput message, IWorkflowContext context) + { + DeclarativeWorkflowContext declarativeContext = new(context, this._state); + await this.ExecuteAsync(message, declarativeContext, cancellationToken: default).ConfigureAwait(false); + + ChatMessage input = (this._inputTransform ?? DefaultInputTransform).Invoke(message); + + string conversationId = await this._agentProvider.CreateConversationAsync(cancellationToken: default).ConfigureAwait(false); + await declarativeContext.QueueConversationUpdateAsync(conversationId).ConfigureAwait(false); + + await this._agentProvider.CreateMessageAsync(conversationId, input, cancellationToken: default).ConfigureAwait(false); + await declarativeContext.SetLastMessageAsync(input).ConfigureAwait(false); + + await declarativeContext.SendMessageAsync(new ActionExecutorResult(this.Id)).ConfigureAwait(false); + } + + /// + /// Executes the core logic of the root workflow for the provided initial message. + /// + /// The initial input message that triggered workflow execution. + /// The workflow execution context providing messaging and state services. + /// A token that propagates notification when operation should be canceled. + /// A representing the asynchronous execution operation. + protected abstract ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken = default); + + /// + /// Initializes the specified variables from if available; + /// otherwise falls back to the process environment variables. + /// + /// The workflow execution context providing messaging and state services. + /// The set of variable names to initialize. + /// A representing the asynchronous execution operation. + protected async ValueTask InitializeEnvironmentAsync(IWorkflowContext context, params string[] variableNames) + { + foreach (string variableName in variableNames) + { + await context.QueueStateUpdateAsync(variableName, GetEnvironmentVariable(variableName), VariableScopeNames.Environment).ConfigureAwait(false); + } + + string GetEnvironmentVariable(string name) + { + if (this._configuration is not null) + { + return this._configuration[name] ?? string.Empty; + } + + return Environment.GetEnvironmentVariable(name) ?? string.Empty; + } + } + + /// + /// Transforms the input message into a . + /// + /// The original input object. + /// A derived from the input. + protected internal static ChatMessage DefaultInputTransform(TInput message) => + message switch + { + ChatMessage chatMessage => chatMessage, + string stringMessage => new ChatMessage(ChatRole.User, stringMessage), + _ => new(ChatRole.User, $"{message}") + }; + + private sealed class RootFormulaSession : FormulaSession + { + internal RootFormulaSession(WorkflowFormulaState state) + { + this.State = state; + } + + internal override WorkflowFormulaState State { get; } + } +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/PowerFx/UnassignedValue.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/UnassignedValue.cs similarity index 86% rename from dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/PowerFx/UnassignedValue.cs rename to dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/UnassignedValue.cs index 1ef3b9bb0f..c2661983fd 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/PowerFx/UnassignedValue.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/UnassignedValue.cs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. -namespace Microsoft.Agents.AI.Workflows.Declarative.PowerFx; +namespace Microsoft.Agents.AI.Workflows.Declarative.Kit; /// /// Represents the absence of an assigned value for a variable used in an expression. diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/VariableType.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/VariableType.cs new file mode 100644 index 0000000000..310d96f7a3 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Kit/VariableType.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System; +using System.Collections; +using System.Collections.Frozen; +using System.Collections.Generic; +using Microsoft.Agents.AI.Workflows.Declarative.Extensions; +using Microsoft.Bot.ObjectModel; + +namespace Microsoft.Agents.AI.Workflows.Declarative.Kit; + +/// +/// Describes an allowed declarative variable/type used in workflow configuration (primitives, lists, or record-like objects). +/// A record is modeled as IDictionary<string, VariableType?> along with an immutable schema for its fields. +/// +public sealed class VariableType +{ + // Canonical CLR type used to mark a "record" (object with named fields and per-field types). + internal static readonly Type RecordType = typeof(IDictionary); + // Any list of primitive values or records. + internal static readonly Type ListType = typeof(IEnumerable); + + // All supported root CLR types (only these may appear directly as VariableType.Type). + private static readonly FrozenSet s_supportedTypes = + [ + typeof(bool), + typeof(int), + typeof(long), + typeof(float), + typeof(decimal), + typeof(double), + typeof(string), + typeof(DateTime), + typeof(TimeSpan), + RecordType, + ListType, + ]; + + /// + /// Implicitly wraps a CLR as a (no validation is performed here). + /// Use or to confirm support. + /// + public static implicit operator VariableType(Type type) => new(type); + + /// + /// Returns true if is a supported variable type. + /// + public static bool IsValid() => IsValid(typeof(TValue)); + + /// + /// Returns true if the provided CLR is one of the supported root types. + /// + public static bool IsValid(Type type) => s_supportedTypes.Contains(type); + + /// + /// Creates a record (object) variable type with the supplied schema. + /// Each tuple's Key is the field name; Type is the declared VariableType (nullable to allow "unknown"/late binding). + /// + public static VariableType Record(params IEnumerable<(string Key, VariableType? Type)> fields) => + new(typeof(IDictionary)) + { + Schema = fields.ToFrozenDictionary(kv => kv.Key, kv => kv.Type), + }; + + /// + /// Initializes a new instance wrapping the given CLR (which should be one of the supported types). + /// + internal VariableType(DataType type) + { + this.Type = type.ToClrType(); + + if (type is RecordDataType recordType) + { + this.Schema = CreateSchema(recordType.Properties); + } + else if (type is TableDataType tableDataType) + { + this.Schema = CreateSchema(tableDataType.Properties); + } + + static FrozenDictionary CreateSchema(IEnumerable> properties) + { + Dictionary schema = []; + + foreach (KeyValuePair field in properties) + { + if (field.Value.Type is null) + { + continue; + } + + schema[field.Key] = new VariableType(field.Value.Type); + } + return schema.ToFrozenDictionary(); + } + } + + /// + /// Initializes a new instance wrapping the given CLR (which should be one of the supported types). + /// + public VariableType(Type type) + { + this.Type = type; + } + + /// + /// The underlying CLR type that categorizes this variable (primitive, list, or record sentinel type). + /// + public Type Type { get; } + + /// + /// Schema for record types: immutable mapping of field name to field VariableType (null means unspecified). + /// Null for non-record VariableTypes. + /// + public FrozenDictionary? Schema { get; init; } + + /// + /// True if this instance represents a record/object with a field schema. + /// + public bool IsList => ListType.IsAssignableFrom(this.Type); + + /// + /// True if this instance represents a record/object with a field schema. + /// + public bool IsRecord => RecordType.IsAssignableFrom(this.Type); + + /// + /// Instance convenience wrapper for on this VariableType's underlying CLR type. + /// + public bool IsValid() => IsValid(this.Type); +} diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Microsoft.Agents.AI.Workflows.Declarative.csproj b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Microsoft.Agents.AI.Workflows.Declarative.csproj index 12d72b1320..a31c191886 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Microsoft.Agents.AI.Workflows.Declarative.csproj +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Microsoft.Agents.AI.Workflows.Declarative.csproj @@ -27,6 +27,7 @@ + @@ -37,6 +38,22 @@ + + + + + + + TextTemplatingFilePreprocessor + %(Filename).cs + + + %(Filename).tt + True + True + + + diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/ConditionGroupExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/ConditionGroupExecutor.cs index ab4fb5ed7e..6995ba3517 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/ConditionGroupExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/ConditionGroupExecutor.cs @@ -5,6 +5,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Agents.AI.Workflows.Declarative.Extensions; using Microsoft.Agents.AI.Workflows.Declarative.Interpreter; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; using Microsoft.Bot.ObjectModel; using Microsoft.Bot.ObjectModel.Abstractions; diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/ParseValueExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/ParseValueExecutor.cs index 96bdae5580..04cce69710 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/ParseValueExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/ParseValueExecutor.cs @@ -1,12 +1,11 @@  // Copyright (c) Microsoft. All rights reserved. -using System; -using System.Text.Json; using System.Threading; using System.Threading.Tasks; using Microsoft.Agents.AI.Workflows.Declarative.Extensions; using Microsoft.Agents.AI.Workflows.Declarative.Interpreter; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; using Microsoft.Bot.ObjectModel; using Microsoft.Bot.ObjectModel.Abstractions; @@ -25,53 +24,20 @@ internal sealed class ParseValueExecutor(ParseValue model, WorkflowFormulaState EvaluationResult expressionResult = this.Evaluator.GetValue(valueExpression); - FormulaValue? parsedResult = null; - - if (expressionResult.Value is RecordDataValue recordValue) + FormulaValue parsedValue; + if (this.Model.ValueType is not null) { - parsedResult = recordValue.ToFormula(); + VariableType targetType = new(this.Model.ValueType); + object? parsedResult = expressionResult.Value.ToObject().ConvertType(targetType); + parsedValue = parsedResult.ToFormula(); } - else if (expressionResult.Value is StringDataValue stringValue) + else { - if (string.IsNullOrWhiteSpace(stringValue.Value)) - { - parsedResult = FormulaValue.NewBlank(expressionResult.Value.GetDataType().ToFormulaType()); - } - else - { - parsedResult = - this.Model.ValueType switch - { - StringDataType => FormulaValue.New(stringValue.Value), - NumberDataType => FormulaValue.New(stringValue.Value), - BooleanDataType => FormulaValue.New(stringValue.Value), - RecordDataType recordType => ParseRecord(recordType, stringValue.Value), - _ => null - }; - } + parsedValue = expressionResult.Value.ToFormula(); } - if (parsedResult is null) - { - throw this.Exception("Unable to parse value."); - } - - await this.AssignAsync(variablePath, parsedResult, context).ConfigureAwait(false); + await this.AssignAsync(variablePath, parsedValue, context).ConfigureAwait(false); return default; - - RecordValue ParseRecord(RecordDataType recordType, string rawText) - { - string jsonText = rawText.TrimJsonDelimiter(); - using JsonDocument json = JsonDocument.Parse(jsonText); - try - { - return recordType.ParseRecord(json.RootElement); - } - catch (Exception exception) - { - throw this.Exception("Failed to parse value.", exception); - } - } } } diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/QuestionExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/QuestionExecutor.cs index 77129ec357..c788d88463 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/QuestionExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/QuestionExecutor.cs @@ -6,6 +6,7 @@ using Microsoft.Agents.AI.Workflows.Declarative.Entities; using Microsoft.Agents.AI.Workflows.Declarative.Events; using Microsoft.Agents.AI.Workflows.Declarative.Extensions; using Microsoft.Agents.AI.Workflows.Declarative.Interpreter; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; using Microsoft.Bot.ObjectModel; using Microsoft.PowerFx.Types; @@ -29,7 +30,8 @@ internal sealed class QuestionExecutor(Question model, WorkflowFormulaState stat protected override bool IsDiscreteAction => false; protected override bool EmitResultEvent => false; - public static bool IsComplete(object? message) // %%% BASE CLASS ??? + // Input has been captured when Result is null + public static bool IsComplete(object? message) { ActionExecutorResult executorMessage = ActionExecutorResult.ThrowIfNot(message); return executorMessage.Result is null; diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/PowerFx/SystemScope.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/PowerFx/SystemScope.cs index a48494498b..139125396a 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/PowerFx/SystemScope.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/PowerFx/SystemScope.cs @@ -5,6 +5,7 @@ using System.Collections.Frozen; using System.Globalization; using System.Threading.Tasks; using Microsoft.Agents.AI.Workflows.Declarative.Extensions; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; using Microsoft.Bot.ObjectModel; using Microsoft.Bot.ObjectModel.SystemVariables; using Microsoft.Extensions.AI; diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/PowerFx/TypeSchema.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/PowerFx/TypeSchema.cs index 79a8ce8f40..3f183951da 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/PowerFx/TypeSchema.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/PowerFx/TypeSchema.cs @@ -3,7 +3,7 @@ using Microsoft.Bot.ObjectModel; using Microsoft.PowerFx.Types; -namespace Microsoft.Agents.AI.Workflows.Declarative.PowerFx.Functions; +namespace Microsoft.Agents.AI.Workflows.Declarative.PowerFx; internal static class TypeSchema { diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/PowerFx/WorkflowFormulaState.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/PowerFx/WorkflowFormulaState.cs index bde252b18f..bf8d225ae8 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/PowerFx/WorkflowFormulaState.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/PowerFx/WorkflowFormulaState.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Agents.AI.Workflows.Declarative.Extensions; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; using Microsoft.Bot.ObjectModel; using Microsoft.PowerFx; using Microsoft.PowerFx.Types; diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/WorkflowAgentProvider.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/WorkflowAgentProvider.cs index 6eb46c0f39..3b1ffdf6e2 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/WorkflowAgentProvider.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/WorkflowAgentProvider.cs @@ -16,7 +16,7 @@ public abstract class WorkflowAgentProvider /// Asynchronously retrieves an AI agent by its unique identifier. /// /// The unique identifier of the AI agent to retrieve. Cannot be null or empty. - /// The to monitor for cancellation requests. The default is . + /// A token that propagates notification when operation should be canceled. /// The task result contains the associated. public abstract Task GetAgentAsync(string agentId, CancellationToken cancellationToken = default); diff --git a/dotnet/src/Shared/CodeTests/Compiler.cs b/dotnet/src/Shared/CodeTests/Compiler.cs new file mode 100644 index 0000000000..a07043d218 --- /dev/null +++ b/dotnet/src/Shared/CodeTests/Compiler.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +#if !NET +using System.Threading.Tasks; +#endif +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.Emit; +using Microsoft.Extensions.AI; +using Xunit.Sdk; + +namespace Shared.Code; + +internal static class Compiler +{ + public static IEnumerable RepoDependencies(params IEnumerable types) + { + yield return typeof(object).Assembly; + yield return typeof(Console).Assembly; + yield return typeof(Enumerable).Assembly; +#if NET + yield return Assembly.Load("System.Runtime"); +#else + yield return Assembly.LoadFrom(AppDomain.CurrentDomain.GetAssemblies().Single(a => a.GetName().Name == "netstandard").Location); + yield return typeof(IAsyncEnumerable<>).Assembly; + yield return typeof(ValueTask).Assembly; +#endif + yield return typeof(AsyncEnumerable).Assembly; + yield return typeof(ChatMessage).Assembly; + yield return typeof(AIAgent).Assembly; + yield return typeof(Workflow).Assembly; + + foreach (Type type in types) + { + yield return type.Assembly; + } + } + + public static Assembly Build(string workflowProviderCode, params IEnumerable dependencies) + { + // Compile the code + SyntaxTree syntaxTree = CSharpSyntaxTree.ParseText(workflowProviderCode); + CSharpCompilation compilation = CSharpCompilation.Create( + "DynamicAssembly", + [syntaxTree], + dependencies.Select(d => MetadataReference.CreateFromFile(d.Location)), + new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary) + ); + + using MemoryStream memoryStream = new(); + EmitResult result = compilation.Emit(memoryStream); + + if (!result.Success) + { + Console.WriteLine("COMPLILATION FAILURE:"); + foreach (var diagnostic in result.Diagnostics) + { + Console.WriteLine(diagnostic.ToString()); + } + throw new XunitException("Compilation failed."); + } + + Console.WriteLine("COMPLILATION SUCCEEDED..."); + memoryStream.Seek(0, SeekOrigin.Begin); + return Assembly.Load(memoryStream.ToArray()); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/DeclarativeCodeGenTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/DeclarativeCodeGenTest.cs new file mode 100644 index 0000000000..97f4a3d30f --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/DeclarativeCodeGenTest.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.Framework; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests; + +/// +/// Tests execution of workflow created by . +/// +[Collection("Global")] +public sealed class DeclarativeCodeGenTest(ITestOutputHelper output) : WorkflowTest(output) +{ + [Theory] + [InlineData("SendActivity.yaml", "SendActivity.json")] + [InlineData("InvokeAgent.yaml", "InvokeAgent.json")] + [InlineData("ConversationMessages.yaml", "ConversationMessages.json")] + public Task ValidateCaseAsync(string workflowFileName, string testcaseFileName) => + this.RunWorkflowAsync(Path.Combine("Workflows", workflowFileName), testcaseFileName); + + [Theory] + [InlineData("Marketing.yaml", "Marketing.json")] + [InlineData("MathChat.yaml", "MathChat.json")] + [InlineData("DeepResearch.yaml", "DeepResearch.json")] + [InlineData("HumanInLoop.yaml", "HumanInLoop.json", Skip = "TODO")] + public Task ValidateScenarioAsync(string workflowFileName, string testcaseFileName) => + this.RunWorkflowAsync(Path.Combine(GetRepoFolder(), "workflow-samples", workflowFileName), testcaseFileName); + + protected override async Task RunAndVerifyAsync(Testcase testcase, string workflowPath, DeclarativeWorkflowOptions workflowOptions) + { + const string workflowNamespace = "Test.WorkflowProviders"; + const string workflowPrefix = "Test"; + + string workflowProviderCode = DeclarativeWorkflowBuilder.Eject(workflowPath, DeclarativeWorkflowLanguage.CSharp, workflowNamespace, workflowPrefix); + try + { + WorkflowEvents workflowEvents = await WorkflowHarness.RunCodeAsync(workflowProviderCode, $"{workflowPrefix}WorkflowProvider", workflowNamespace, workflowOptions, (TInput)GetInput(testcase)); + foreach (ExecutorEvent invokeEvent in workflowEvents.ExecutorInvokeEvents) + { + this.Output.WriteLine($"EXEC: {invokeEvent.ExecutorId}"); + } + + Assert.Empty(workflowEvents.ActionInvokeEvents); + Assert.Empty(workflowEvents.ActionCompleteEvents); + AssertWorkflow.EventCounts(workflowEvents.ExecutorInvokeEvents.Count - 2, testcase); + AssertWorkflow.EventCounts(workflowEvents.ExecutorCompleteEvents.Count - 2, testcase); + AssertWorkflow.EventSequence(workflowEvents.ExecutorInvokeEvents.Select(e => e.ExecutorId), testcase); + } + finally + { + this.Output.WriteLine($"CODE:\n{workflowProviderCode}"); + } + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowHarness.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowHarness.cs index 59cf96903e..83cf8c5b61 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowHarness.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowHarness.cs @@ -1,8 +1,11 @@ // Copyright (c) Microsoft. All rights reserved. +using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Threading.Tasks; +using Shared.Code; namespace Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.Framework; @@ -14,4 +17,25 @@ internal static class WorkflowHarness IReadOnlyList workflowEvents = run.WatchStreamAsync().ToEnumerable().ToList(); return new WorkflowEvents(workflowEvents); } + + public static async Task RunCodeAsync( + string workflowProviderCode, + string workflowProviderName, + string workflowProviderNamespace, + DeclarativeWorkflowOptions options, + TInput input) where TInput : notnull + { + // Compile the code + Assembly assembly = Compiler.Build(workflowProviderCode, Compiler.RepoDependencies(typeof(DeclarativeWorkflowBuilder))); + Type? type = assembly.GetType($"{workflowProviderNamespace}.{workflowProviderName}"); + Assert.NotNull(type); + MethodInfo? method = type.GetMethod("CreateWorkflow"); + Assert.NotNull(method); + MethodInfo genericMethod = method.MakeGenericMethod(typeof(TInput)); + object? workflowObject = genericMethod.Invoke(null, [options, null]); + Workflow workflow = Assert.IsType(workflowObject); + + Console.WriteLine("RUNNING WORKFLOW..."); + return await RunAsync(workflow, input); + } } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.csproj index bb72598c33..8da383a69a 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.csproj @@ -7,6 +7,7 @@ true + true @@ -16,6 +17,7 @@ + diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Testcases/MathChat.json b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Testcases/MathChat.json index 5e516f9361..4d6a0e69d9 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Testcases/MathChat.json +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Testcases/MathChat.json @@ -8,7 +8,7 @@ }, "validation": { "min_action_count": 6, - "max_action_count": 25, + "max_action_count": 56, "actions": { "start": [ "set_project" @@ -22,7 +22,8 @@ ], "final": [ "sendActivity_done", - "sendActivity_tired" + "sendActivity_tired", + "check_completion_Post" ] } } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/AddConversationMessageTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/AddConversationMessageTemplateTest.cs new file mode 100644 index 0000000000..f5b4a79e40 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/AddConversationMessageTemplateTest.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System.Collections.Generic; +using System.Collections.Immutable; +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Bot.ObjectModel; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class AddConversationMessageTemplateTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void NoRole() + { + // Act, Assert + this.ExecuteTest( + nameof(AddConversationMessage), + "TestVariable", + conversation: StringExpression.Literal("#rev_9"), + content: + [ + new AddConversationMessageContent.Builder() + { + Type = AgentMessageContentType.Text, + Value = TemplateLine.Parse("Hello! How can I help you today?"), + }, + ]); + } + + [Fact] + public void WithRole() + { + // Act, Assert + this.ExecuteTest( + nameof(AddConversationMessage), + "TestVariable", + conversation: StringExpression.Variable(PropertyPath.Create("System.ConversationId")), + role: AgentMessageRoleWrapper.Get(AgentMessageRole.Agent), + content: + [ + new AddConversationMessageContent.Builder() + { + Type = AgentMessageContentType.Text, + Value = TemplateLine.Parse("Hello! How can I help you today?"), + }, + ]); + } + + [Fact] + public void WithMetadataLiteral() + { + // Act, Assert + this.ExecuteTest( + nameof(AddConversationMessage), + "TestVariable", + conversation: StringExpression.Variable(PropertyPath.Create("System.Conversation.Id")), + role: AgentMessageRoleWrapper.Get(AgentMessageRole.Agent), + metadata: ObjectExpression.Literal( + new RecordDataValue( + new Dictionary + { + { "key1", StringDataValue.Create("value1") }, + { "key2", NumberDataValue.Create(42) }, + }.ToImmutableDictionary())), + content: + [ + new AddConversationMessageContent.Builder() + { + Type = AgentMessageContentType.Text, + Value = TemplateLine.Parse("Hello! How can I help you today?"), + }, + ]); + } + + [Fact] + public void WithMetadataVariable() + { + // Act, Assert + this.ExecuteTest( + nameof(AddConversationMessage), + "TestVariable", + conversation: StringExpression.Literal("#rev_9"), + role: AgentMessageRoleWrapper.Get(AgentMessageRole.Agent), + metadata: ObjectExpression.Variable(PropertyPath.TopicVariable("MyMetadata")), + content: + [ + new AddConversationMessageContent.Builder() + { + Type = AgentMessageContentType.Text, + Value = TemplateLine.Parse("Hello! How can I help you today?"), + }, + ]); + } + + private void ExecuteTest( + string displayName, + string variableName, + StringExpression conversation, + IEnumerable content, + AgentMessageRoleWrapper? role = null, + ObjectExpression.Builder? metadata = null) + { + // Arrange + AddConversationMessage model = + this.CreateModel( + displayName, + FormatVariablePath(variableName), + conversation, + content, + role, + metadata); + + // Act + AddConversationMessageTemplate template = new(model); + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + AssertGeneratedCode(template.Id, workflowCode); + AssertAgentProvider(template.UseAgentProvider, workflowCode); + AssertGeneratedAssignment(model.Message?.Path, workflowCode); + } + + private AddConversationMessage CreateModel( + string displayName, + string variablePath, + StringExpression conversation, + IEnumerable contents, + AgentMessageRoleWrapper? role, + ObjectExpression.Builder? metadata) + { + AddConversationMessage.Builder actionBuilder = + new() + { + Id = this.CreateActionId("add_message"), + DisplayName = this.FormatDisplayName(displayName), + ConversationId = conversation, + Message = PropertyPath.Create(variablePath), + Role = role, + Metadata = metadata, + }; + + foreach (AddConversationMessageContent.Builder content in contents) + { + actionBuilder.Content.Add(content); + } + + return actionBuilder.Build(); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/BreakLoopTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/BreakLoopTemplateTest.cs new file mode 100644 index 0000000000..816e98b52f --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/BreakLoopTemplateTest.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Bot.ObjectModel; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class BreakLoopTemplateTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void BreakLoop() + { + // Act, Assert + this.ExecuteTest(nameof(BreakLoop)); + } + + private void ExecuteTest(string displayName) + { + // Arrange + BreakLoop model = this.CreateModel(displayName); + + // Act + DefaultTemplate template = new(model, "workflow_id"); + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + AssertDelegate(template.Id, "workflow_id", workflowCode); + AssertAgentProvider(template.UseAgentProvider, workflowCode); + } + + private BreakLoop CreateModel(string displayName) + { + BreakLoop.Builder actionBuilder = + new() + { + Id = this.CreateActionId("break_loop"), + DisplayName = this.FormatDisplayName(displayName), + }; + + return actionBuilder.Build(); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ClearAllVariablesTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ClearAllVariablesTemplateTest.cs new file mode 100644 index 0000000000..da70c4a727 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ClearAllVariablesTemplateTest.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Bot.ObjectModel; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class ClearAllVariablesTemplateTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void LiteralEnum() + { + // Arrange + EnumExpression.Builder expressionBuilder = new(EnumExpression.Literal(VariablesToClear.AllGlobalVariables)); + + // Act, Assert + this.ExecuteTest(nameof(LiteralEnum), expressionBuilder); + } + + [Fact] + public void VariableEnum() + { + // Arrange + EnumExpression.Builder expressionBuilder = new(EnumExpression.Variable(PropertyPath.TopicVariable("MyClearEnum"))); + + // Act, Assert + this.ExecuteTest(nameof(VariableEnum), expressionBuilder); + } + + [Fact] + public void UnsupportedEnum() + { + // Arrange + EnumExpression.Builder expressionBuilder = new(EnumExpression.Literal(VariablesToClear.UserScopedVariables)); + + // Act, Assert + this.ExecuteTest(nameof(UnsupportedEnum), expressionBuilder); + } + + private void ExecuteTest( + string displayName, + EnumExpression.Builder variablesExpression) + { + // Arrange + ClearAllVariables model = + this.CreateModel( + displayName, + variablesExpression); + + // Act + ClearAllVariablesTemplate template = new(model); + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + AssertGeneratedCode(template.Id, workflowCode); + AssertAgentProvider(template.UseAgentProvider, workflowCode); + } + + private ClearAllVariables CreateModel( + string displayName, + EnumExpression.Builder variablesExpression) + { + ClearAllVariables.Builder actionBuilder = + new() + { + Id = this.CreateActionId("set_variable"), + DisplayName = this.FormatDisplayName(displayName), + Variables = variablesExpression, + }; + + return actionBuilder.Build(); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ConditionGroupTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ConditionGroupTemplateTest.cs new file mode 100644 index 0000000000..48514bcb70 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ConditionGroupTemplateTest.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Bot.ObjectModel; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class ConditionGroupTemplateTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void NoElse() + { + // Act, Assert + this.ExecuteTest( + nameof(WithElse), + hasElse: false); + } + + [Fact] + public void WithElse() + { + // Act, Assert + this.ExecuteTest( + nameof(WithElse), + hasElse: true); + } + + private void ExecuteTest(string displayName, bool hasElse = false) + { + // Arrange + ConditionGroup model = this.CreateModel(displayName, hasElse); + + // Act + ConditionGroupTemplate template = new(model); + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + AssertGeneratedCode(template.Id, workflowCode); + AssertAgentProvider(template.UseAgentProvider, workflowCode); + foreach (ConditionItem condition in model.Conditions) + { + Assert.Contains(@$"""{condition.Id}""", workflowCode); + } + if (model.ElseActions?.Actions.Length > 0) + { + Assert.Contains(@$"""{model.ElseActions.Id}""", workflowCode); + } + } + + private ConditionGroup CreateModel(string displayName, bool hasElse = false) + { + ConditionGroup.Builder actionBuilder = + new() + { + Id = this.CreateActionId("condition_group"), + DisplayName = this.FormatDisplayName(displayName), + }; + + actionBuilder.Conditions.Add( + new ConditionItem.Builder + { + Id = "condition_item_a", + Condition = BoolExpression.Expression("2 > 3"), + Actions = this.CreateActions("condition_a"), + }); + + actionBuilder.Conditions.Add( + new ConditionItem.Builder + { + Id = "condition_item_b", + Condition = BoolExpression.Expression("2 < 3"), + Actions = this.CreateActions("condition_b"), + }); + + if (hasElse) + { + actionBuilder.ElseActions = this.CreateActions("condition_else"); + } + + return actionBuilder.Build(); + } + + private ActionScope.Builder CreateActions(string prefix, int count = 2) + { + ActionScope.Builder actions = + new() + { + Id = this.CreateActionId("${prefix}_actions"), + }; + for (int index = 1; index <= count; ++index) + { + actions.Actions.Add( + new SendActivity.Builder + { + Id = this.CreateActionId($"{prefix}_action_{index}"), + Activity = new MessageActivityTemplate + { + //Value = TemplateLine.Parse($"This is message #{index}"), + }, + }); + } + + return actions; + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ContinueLoopTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ContinueLoopTemplateTest.cs new file mode 100644 index 0000000000..4435298c08 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ContinueLoopTemplateTest.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Bot.ObjectModel; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class ContinueLoopTemplateTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void ContinueLoop() + { + // Act, Assert + this.ExecuteTest(nameof(ContinueLoop)); + } + + private void ExecuteTest(string displayName) + { + // Arrange + ContinueLoop model = this.CreateModel(displayName); + + // Act + DefaultTemplate template = new(model, "workflow_id"); + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + AssertDelegate(template.Id, "workflow_id", workflowCode); + AssertAgentProvider(template.UseAgentProvider, workflowCode); + } + + private ContinueLoop CreateModel(string displayName) + { + ContinueLoop.Builder actionBuilder = + new() + { + Id = this.CreateActionId("continue_loop"), + DisplayName = this.FormatDisplayName(displayName), + }; + + return actionBuilder.Build(); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/CopyConversationMessagesTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/CopyConversationMessagesTemplateTest.cs new file mode 100644 index 0000000000..e7793529a5 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/CopyConversationMessagesTemplateTest.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Bot.ObjectModel; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class CopyConversationMessagesTemplateTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void CopyConversationMessages() + { + // Act, Assert + this.ExecuteTest( + nameof(CopyConversationMessages), + StringExpression.Literal("#conv_dm99"), + ValueExpression.Variable(PropertyPath.TopicVariable("MyMessages"))); + } + + private void ExecuteTest( + string displayName, + StringExpression conversation, + ValueExpression messages, + ValueExpression? metadata = null) + { + // Arrange + CopyConversationMessages model = + this.CreateModel( + displayName, + conversation, + messages); + + // Act + CopyConversationMessagesTemplate template = new(model); + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + AssertGeneratedCode(template.Id, workflowCode); + AssertAgentProvider(template.UseAgentProvider, workflowCode); + } + + private CopyConversationMessages CreateModel( + string displayName, + StringExpression conversation, + ValueExpression messages, + ValueExpression? metadata = null) + { + CopyConversationMessages.Builder actionBuilder = + new() + { + Id = this.CreateActionId("copy_messages"), + DisplayName = this.FormatDisplayName(displayName), + ConversationId = conversation, + Messages = messages, + }; + + return actionBuilder.Build(); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/CreateConversationTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/CreateConversationTemplateTest.cs new file mode 100644 index 0000000000..8b294d8dab --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/CreateConversationTemplateTest.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System.Collections.Generic; +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Agents.AI.Workflows.Declarative.Extensions; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Bot.ObjectModel; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class CreateConversationTemplateTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void Basic() + { + // Act, Assert + this.ExecuteTest( + nameof(Basic), + "TestVariable"); + } + + [Fact] + public void WithMetadata() + { + Dictionary metadata = + new() + { + ["key1"] = "value1", + ["key2"] = "value2", + }; + + // Act, Assert + this.ExecuteTest( + nameof(WithMetadata), + "TestVariable", + ObjectExpression.Literal(metadata.ToRecordValue())); + } + + private void ExecuteTest( + string displayName, + string variableName, + ObjectExpression? metadata = null) + { + // Arrange + CreateConversation model = + this.CreateModel( + displayName, + FormatVariablePath(variableName), + metadata); + + // Act + CreateConversationTemplate template = new(model); + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + AssertGeneratedCode(template.Id, workflowCode); + AssertAgentProvider(template.UseAgentProvider, workflowCode); + AssertGeneratedAssignment(model.ConversationId?.Path, workflowCode); + } + + private CreateConversation CreateModel( + string displayName, + string variablePath, + ObjectExpression? metadata = null) + { + CreateConversation.Builder actionBuilder = + new() + { + Id = this.CreateActionId("create_conversation"), + DisplayName = this.FormatDisplayName(displayName), + ConversationId = PropertyPath.Create(variablePath), + }; + + if (metadata is not null) + { + actionBuilder.Metadata = metadata; + } + + return actionBuilder.Build(); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/DeclarativeEjectionTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/DeclarativeEjectionTest.cs new file mode 100644 index 0000000000..190e1078f5 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/DeclarativeEjectionTest.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System; +using System.IO; +using System.Threading.Tasks; +using Shared.Code; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +/// +/// Tests execution of workflow created by . +/// +public sealed class DeclarativeEjectionTest(ITestOutputHelper output) : WorkflowTest(output) +{ + [Theory] + [InlineData("ClearAllVariables.yaml")] + [InlineData("Condition.yaml")] + [InlineData("ConditionElse.yaml")] + [InlineData("EditTable.yaml")] + [InlineData("EditTableV2.yaml")] + [InlineData("EndConversation.yaml")] + [InlineData("EndDialog.yaml")] + [InlineData("Goto.yaml")] + [InlineData("InvokeAgent.yaml")] + [InlineData("LoopBreak.yaml")] + [InlineData("LoopContinue.yaml")] + [InlineData("LoopEach.yaml")] + [InlineData("ParseValue.yaml")] + [InlineData("ResetVariable.yaml")] + [InlineData("SendActivity.yaml")] + [InlineData("SetVariable.yaml")] + [InlineData("SetTextVariable.yaml")] + public Task ExecuteActionAsync(string workflowFile) => + this.EjectWorkflowAsync(workflowFile); + + private async Task EjectWorkflowAsync(string workflowFile) + { + using StreamReader yamlReader = File.OpenText(Path.Combine("Workflows", workflowFile)); + string workflowCode = DeclarativeWorkflowBuilder.Eject(yamlReader, DeclarativeWorkflowLanguage.CSharp, "Test.WorkflowProviders"); + + string baselinePath = Path.Combine("Workflows", Path.ChangeExtension(workflowFile, ".cs")); + string generatedPath = Path.Combine("Workflows", Path.ChangeExtension(workflowFile, ".g.cs")); + + this.Output.WriteLine($"WRITING BASELINE TO: {Path.GetFullPath(generatedPath)}\n"); + + try + { + File.WriteAllText(Path.GetFullPath(generatedPath), workflowCode); + Compiler.Build(workflowCode, Compiler.RepoDependencies(typeof(DeclarativeWorkflowBuilder))); // Throws if build fails + } + finally + { + Console.WriteLine(workflowCode); + } + + string expectedCode = File.ReadAllText(baselinePath); + string[] expectedLines = expectedCode.Trim().Split('\n'); + string[] workflowLines = workflowCode.Trim().Split('\n'); + + Assert.Equal(expectedLines.Length, workflowLines.Length); + + for (int index = 0; index < workflowLines.Length; ++index) + { + this.Output.WriteLine($"Comparing line #{index + 1}/{workflowLines.Length}."); + Assert.Equal(expectedLines[index].Trim(), workflowLines[index].Trim()); + } + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/EdgeTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/EdgeTemplateTest.cs new file mode 100644 index 0000000000..ead2ca742a --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/EdgeTemplateTest.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class EdgeTemplateTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void InitializeNext() + { + this.ExecuteTest("set_variable_1", "invoke_agent_2"); + } + + private void ExecuteTest(string sourceId, string targetId) + { + // Arrange + EdgeTemplate template = new(sourceId, targetId); + + // Act + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + Assert.Equal("builder.AddEdge(setVariable1, invokeAgent2);", workflowCode.Trim()); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/EndConversationTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/EndConversationTest.cs new file mode 100644 index 0000000000..247d27e366 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/EndConversationTest.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Bot.ObjectModel; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class EndConversationTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void EndConversation() + { + // Act, Assert + this.ExecuteTest(nameof(EndConversation)); + } + + private void ExecuteTest(string displayName) + { + // Arrange + EndConversation model = this.CreateModel(displayName); + + // Act + DefaultTemplate template = new(model, "workflow_id"); + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + AssertDelegate(template.Id, "workflow_id", workflowCode); + AssertAgentProvider(template.UseAgentProvider, workflowCode); + } + + private EndConversation CreateModel(string displayName) + { + EndConversation.Builder actionBuilder = + new() + { + Id = this.CreateActionId("end_conversation"), + DisplayName = this.FormatDisplayName(displayName), + }; + + return actionBuilder.Build(); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/EndDialogTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/EndDialogTest.cs new file mode 100644 index 0000000000..60ba608c71 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/EndDialogTest.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Bot.ObjectModel; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class EndDialogTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void EndDialog() + { + // Act, Assert + this.ExecuteTest(nameof(EndDialog)); + } + + private void ExecuteTest(string displayName) + { + // Arrange + EndDialog model = this.CreateModel(displayName); + + // Act + DefaultTemplate template = new(model, "workflow_id"); + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + AssertDelegate(template.Id, "workflow_id", workflowCode); + AssertAgentProvider(template.UseAgentProvider, workflowCode); + } + + private EndDialog CreateModel(string displayName) + { + EndDialog.Builder actionBuilder = + new() + { + Id = this.CreateActionId("end_Dialog"), + DisplayName = this.FormatDisplayName(displayName), + }; + + return actionBuilder.Build(); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ForeachTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ForeachTemplateTest.cs new file mode 100644 index 0000000000..4fc76052ad --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ForeachTemplateTest.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Agents.AI.Workflows.Declarative.ObjectModel; +using Microsoft.Bot.ObjectModel; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class ForeachTemplateTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void LoopNoIndex() + { + // Act, Assert + this.ExecuteTest( + nameof(LoopNoIndex), + ValueExpression.Variable(PropertyPath.TopicVariable("MyItems")), + "LoopValue"); + } + + [Fact] + public void LoopWithIndex() + { + // Act, Assert + this.ExecuteTest( + nameof(LoopNoIndex), + ValueExpression.Variable(PropertyPath.TopicVariable("MyItems")), + "LoopValue", + "IndexValue"); + } + + private void ExecuteTest( + string displayName, + ValueExpression items, + string valueName, + string? indexName = null) + { + // Arrange + Foreach model = + this.CreateModel( + displayName, + items, + FormatVariablePath(valueName), + FormatOptionalPath(indexName)); + + // Act + ForeachTemplate template = new(model); + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + AssertGeneratedCode(template.Id, workflowCode); + AssertAgentProvider(template.UseAgentProvider, workflowCode); + AssertGeneratedMethod(nameof(ForeachExecutor.TakeNextAsync), workflowCode); + AssertGeneratedMethod(nameof(ForeachExecutor.ResetAsync), workflowCode); + } + + private Foreach CreateModel( + string displayName, + ValueExpression items, + string valueName, + string? indexName = null) + { + Foreach.Builder actionBuilder = + new() + { + Id = this.CreateActionId("loop_action"), + DisplayName = this.FormatDisplayName(displayName), + Items = items, + Value = PropertyPath.Create(valueName), + }; + + if (indexName is not null) + { + actionBuilder.Index = PropertyPath.Create(indexName); + } + + return actionBuilder.Build(); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/GotoTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/GotoTemplateTest.cs new file mode 100644 index 0000000000..d439e83fb3 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/GotoTemplateTest.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Bot.ObjectModel; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class GotoTemplateTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void GotoAction() + { + // Act, Assert + this.ExecuteTest(nameof(GotoAction), "target_action_id"); + } + + private void ExecuteTest(string displayName, string targetId) + { + // Arrange + GotoAction model = this.CreateModel(displayName, targetId); + + // Act + DefaultTemplate template = new(model, "workflow_id"); + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + AssertDelegate(template.Id, "workflow_id", workflowCode); + AssertAgentProvider(template.UseAgentProvider, workflowCode); + } + + private GotoAction CreateModel(string displayName, string targetId) + { + GotoAction.Builder actionBuilder = + new() + { + Id = this.CreateActionId("goto_action"), + DisplayName = this.FormatDisplayName(displayName), + ActionId = new ActionId(targetId), + }; + + return actionBuilder.Build(); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/InvokeAzureAgentTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/InvokeAzureAgentTemplateTest.cs new file mode 100644 index 0000000000..e1727e5666 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/InvokeAzureAgentTemplateTest.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Bot.ObjectModel; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class InvokeAzureAgentTemplateTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void LiteralConversation() + { + // Act, Assert + this.ExecuteTest( + nameof(LiteralConversation), + StringExpression.Literal("asst_123abc"), + StringExpression.Literal("conv_123abc"), + messagesVariable: null); + } + + [Fact] + public void VariableConversation() + { + // Act, Assert + this.ExecuteTest( + nameof(VariableConversation), + StringExpression.Variable(PropertyPath.GlobalVariable("TestAgent")), + StringExpression.Variable(PropertyPath.TopicVariable("TestConversation")), + "MyMessages", + BoolExpression.Literal(true)); + } + + [Fact] + public void ExpressionAutosend() + { + // Act, Assert + this.ExecuteTest( + nameof(VariableConversation), + StringExpression.Literal("asst_123abc"), + StringExpression.Variable(PropertyPath.TopicVariable("TestConversation")), + "MyMessages", + BoolExpression.Expression("1 < 2")); + } + + [Fact] + public void AdditionalInstructions() + { + // Act, Assert + this.ExecuteTest( + nameof(VariableConversation), + StringExpression.Literal("asst_123abc"), + StringExpression.Variable(PropertyPath.TopicVariable("TestConversation")), + "MyMessages", + additionalInstructions: "Test instructions..."); + } + + [Fact] + public void InputMessagesVariable() + { + // Act, Assert + this.ExecuteTest( + nameof(VariableConversation), + StringExpression.Literal("asst_123abc"), + StringExpression.Variable(PropertyPath.TopicVariable("TestConversation")), + "MyMessages", + messages: ValueExpression.Variable(PropertyPath.TopicVariable("TestConversation"))); + } + + [Fact] + public void InputMessagesExpression() + { + // Act, Assert + this.ExecuteTest( + nameof(VariableConversation), + StringExpression.Literal("asst_123abc"), + StringExpression.Literal("conv_123abc"), + "MyMessages", + messages: ValueExpression.Expression("[UserMessage(System.LastMessageText)]")); + } + + private void ExecuteTest( + string displayName, + StringExpression.Builder agentName, + StringExpression.Builder conversation, + string? messagesVariable = null, + BoolExpression.Builder? autoSend = null, + string? additionalInstructions = null, + ValueExpression.Builder? messages = null) + { + // Arrange + InvokeAzureAgent model = + this.CreateModel( + displayName, + agentName, + conversation, + messagesVariable, + autoSend, + additionalInstructions is null ? null : (TemplateLine.Builder)TemplateLine.Parse(additionalInstructions), + messages); + + // Act + InvokeAzureAgentTemplate template = new(model); + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + AssertGeneratedCode(template.Id, workflowCode); + AssertAgentProvider(template.UseAgentProvider, workflowCode); + AssertOptionalAssignment(model.Output?.Messages?.Path, workflowCode); + } + + private InvokeAzureAgent CreateModel( + string displayName, + StringExpression.Builder agentName, + StringExpression.Builder conversation, + string? messagesVariable = null, + BoolExpression.Builder? autoSend = null, + TemplateLine.Builder? additionalInstructions = null, + ValueExpression.Builder? messages = null) + { + InitializablePropertyPath? outputMessages = null; + if (messagesVariable is not null) + { + outputMessages = PropertyPath.Create(FormatVariablePath(messagesVariable)); + } + + InvokeAzureAgent.Builder actionBuilder = + new() + { + Id = this.CreateActionId("invoke_agent"), + DisplayName = this.FormatDisplayName(displayName), + ConversationId = conversation, + Agent = + new AzureAgentUsage.Builder + { + Name = agentName, + }, + Input = + new AzureAgentInput.Builder + { + Messages = messages, + AdditionalInstructions = additionalInstructions, + }, + Output = + new AzureAgentOutput.Builder + { + AutoSend = autoSend, + Messages = outputMessages, + }, + }; + + return actionBuilder.Build(); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ProviderTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ProviderTemplateTest.cs new file mode 100644 index 0000000000..fcaabcb4a1 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ProviderTemplateTest.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System.Threading.Tasks; +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class ProviderTemplateTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public async Task WithNamespaceAsync() + { + await this.ExecuteTestAsync( + [ + """ + internal sealed class TestExecutor1() : ActionExecutor(id: "test_1") + { + protected override ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + // Nothing to do + return default; + } + } + """ + ], + [ + """ + TestExecutor1 test1 = new(); + """ + ], + [ + """ + builder.AddEdge(builder.Root, test1); + """ + ], + "Test.Workflows.Generated"); + } + + [Fact] + public async Task WithoutNamespaceAsync() + { + await this.ExecuteTestAsync( + [ + """ + internal sealed class TestExecutor1() : ActionExecutor(id: "test_1") + { + protected override ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + // Nothing to do + return default; + } + } + + internal sealed class TestExecutor2() : ActionExecutor(id: "test_2") + { + protected override ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + // Nothing to do + return default; + } + } + """ + ], + [ + """ + TestExecutor1 test1 = new(); + TestExecutor2 test2 = new(); + """ + ], + [ + """ + builder.AddEdge(builder.Root, test1); + builder.AddEdge(test1, test2); + """ + ]); + } + + private async Task ExecuteTestAsync( + string[] executors, + string[] instances, + string[] edges, + string? workflowNamespace = null) + { + // Arrange + ProviderTemplate template = new("worflow-id", executors, instances, edges) { Namespace = workflowNamespace }; + + // Act + string workflowCode = template.TransformText(); + + // Assert + this.Output.WriteLine(workflowCode); + + Assert.True(Contains(executors)); + Assert.True(Contains(instances)); + Assert.True(Contains(edges)); + + bool Contains(string[] code) + { + foreach (string block in code) + { + foreach (string line in block.Split('\n')) + { + if (!workflowCode.Contains(line.Trim())) + { + return false; + } + } + } + + return true; + } + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ResetVariableTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ResetVariableTemplateTest.cs new file mode 100644 index 0000000000..f9ce242313 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ResetVariableTemplateTest.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Bot.ObjectModel; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class ResetVariableTemplateTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void ResetVariable() + { + // Act, Assert + this.ExecuteTest(nameof(ResetVariable), "TestVariable"); + } + + private void ExecuteTest(string displayName, string variableName) + { + // Arrange + ResetVariable model = + this.CreateModel( + displayName, + FormatVariablePath(variableName)); + + // Act + ResetVariableTemplate template = new(model); + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + AssertGeneratedCode(template.Id, workflowCode); + AssertAgentProvider(template.UseAgentProvider, workflowCode); + } + + private ResetVariable CreateModel(string displayName, string variablePath) + { + ResetVariable.Builder actionBuilder = + new() + { + Id = this.CreateActionId("set_variable"), + DisplayName = this.FormatDisplayName(displayName), + Variable = PropertyPath.Create(variablePath) + }; + + return actionBuilder.Build(); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/RetrieveConversationMessageTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/RetrieveConversationMessageTemplateTest.cs new file mode 100644 index 0000000000..ac6b88da84 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/RetrieveConversationMessageTemplateTest.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Bot.ObjectModel; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class RetrieveConversationMessageTemplateTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void RetrieveMessageLiteral() + { + // Act, Assert + this.ExecuteTest( + nameof(RetrieveMessageLiteral), + "TestVariable", + StringExpression.Literal("#cid_3"), + StringExpression.Literal("#mid_43")); + } + + private void ExecuteTest( + string displayName, + string variableName, + StringExpression conversationExpression, + StringExpression messageExpression) + { + // Arrange + RetrieveConversationMessage model = + this.CreateModel( + displayName, + FormatVariablePath(variableName), + conversationExpression, + messageExpression); + + // Act + RetrieveConversationMessageTemplate template = new(model); + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + AssertGeneratedCode(template.Id, workflowCode); + AssertAgentProvider(template.UseAgentProvider, workflowCode); + AssertGeneratedAssignment(model.Message?.Path, workflowCode); + } + + private RetrieveConversationMessage CreateModel( + string displayName, + string variableName, + StringExpression conversationExpression, + StringExpression messageExpression) + { + RetrieveConversationMessage.Builder actionBuilder = + new() + { + Id = this.CreateActionId("retrieve_message"), + DisplayName = this.FormatDisplayName(displayName), + Message = PropertyPath.Create(variableName), + ConversationId = conversationExpression, + MessageId = messageExpression, + }; + + return actionBuilder.Build(); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/RetrieveConversationMessagesTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/RetrieveConversationMessagesTemplateTest.cs new file mode 100644 index 0000000000..ef24147c57 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/RetrieveConversationMessagesTemplateTest.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Bot.ObjectModel; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class RetrieveConversationMessagesTemplateTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void DefaultQuery() + { + // Act, Assert + this.ExecuteTest( + nameof(DefaultQuery), + "TestVariable", + StringExpression.Literal("#cid_3")); + } + + [Fact] + public void LimitCountQuery() + { + // Act, Assert + this.ExecuteTest( + nameof(DefaultQuery), + "TestVariable", + StringExpression.Literal("#cid_3"), + limit: IntExpression.Literal(94)); + } + + [Fact] + public void AfterMessageQuery() + { + // Act, Assert + this.ExecuteTest( + nameof(DefaultQuery), + "TestVariable", + StringExpression.Literal("#cid_3"), + after: StringExpression.Literal("#mid_43")); + } + + [Fact] + public void BeforeMessageQuery() + { + // Act, Assert + this.ExecuteTest( + nameof(DefaultQuery), + "TestVariable", + StringExpression.Literal("#cid_3"), + before: StringExpression.Literal("#mid_43")); + } + + [Fact] + public void NewestFirstQuery() + { + // Act, Assert + this.ExecuteTest( + nameof(DefaultQuery), + "TestVariable", + StringExpression.Literal("#cid_3"), + sortOrder: EnumExpression.Literal(AgentMessageSortOrderWrapper.Get(AgentMessageSortOrder.NewestFirst))); + } + + private void ExecuteTest( + string displayName, + string variableName, + StringExpression conversation, + IntExpression? limit = null, + StringExpression? after = null, + StringExpression? before = null, + EnumExpression? sortOrder = null) + { + // Arrange + RetrieveConversationMessages model = + this.CreateModel( + displayName, + FormatVariablePath(variableName), + conversation, + limit, + after, + before, + sortOrder); + + // Act + RetrieveConversationMessagesTemplate template = new(model); + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + AssertGeneratedCode(template.Id, workflowCode); + AssertAgentProvider(template.UseAgentProvider, workflowCode); + AssertGeneratedAssignment(model.Messages?.Path, workflowCode); + } + + private RetrieveConversationMessages CreateModel( + string displayName, + string variableName, + StringExpression conversationExpression, + IntExpression? limitExpression, + StringExpression? afterExpression, + StringExpression? beforeExpression, + EnumExpression? sortExpression) + { + RetrieveConversationMessages.Builder actionBuilder = + new() + { + Id = this.CreateActionId("retrieve_messages"), + DisplayName = this.FormatDisplayName(displayName), + Messages = PropertyPath.Create(variableName), + ConversationId = conversationExpression, + }; + + if (limitExpression is not null) + { + actionBuilder.Limit = limitExpression; + } + + if (afterExpression is not null) + { + actionBuilder.MessageAfter = afterExpression; + } + + if (beforeExpression is not null) + { + actionBuilder.MessageBefore = beforeExpression; + } + + if (sortExpression is not null) + { + actionBuilder.SortOrder = sortExpression; + } + + return actionBuilder.Build(); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/SetMultipleVariablesTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/SetMultipleVariablesTemplateTest.cs new file mode 100644 index 0000000000..fb0013c3a6 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/SetMultipleVariablesTemplateTest.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Bot.ObjectModel; +using Microsoft.PowerFx.Types; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class SetMultipleVariablesTemplateTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void InitializeMultipleValues() + { + // Act, Assert + this.ExecuteTest( + nameof(InitializeMultipleValues), + new AssignmentCase("TestVariable1", new ValueExpression.Builder(ValueExpression.Literal(new NumberDataValue(420))), FormulaValue.New(420)), + new AssignmentCase("TestVariable2", new ValueExpression.Builder(ValueExpression.Variable(PropertyPath.TopicVariable("MyValue"))), FormulaValue.New(6)), + new AssignmentCase("TestVariable3", new ValueExpression.Builder(ValueExpression.Expression("9 - 3")), FormulaValue.New(6))); + } + + private void ExecuteTest(string displayName, params AssignmentCase[] assignments) + { + // Arrange + SetMultipleVariables model = + this.CreateModel( + displayName, + assignments); + + // Act + SetMultipleVariablesTemplate template = new(model); + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + AssertGeneratedCode(template.Id, workflowCode); + AssertAgentProvider(template.UseAgentProvider, workflowCode); + foreach (AssignmentCase assignment in assignments) + { + AssertGeneratedAssignment(PropertyPath.TopicVariable(assignment.Path), workflowCode); + } + } + + private SetMultipleVariables CreateModel(string displayName, params AssignmentCase[] assignments) + { + SetMultipleVariables.Builder actionBuilder = + new() + { + Id = this.CreateActionId("set_multiple"), + DisplayName = this.FormatDisplayName(displayName), + }; + + foreach (AssignmentCase assignment in assignments) + { + actionBuilder.Assignments.Add( + new VariableAssignment.Builder() + { + Variable = PropertyPath.Create(FormatVariablePath(assignment.Path)), + Value = assignment.Expression, + }); + } + + return actionBuilder.Build(); + } + + private sealed record AssignmentCase(string Path, ValueExpression.Builder Expression, FormulaValue Expected); +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/SetTextVariableTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/SetTextVariableTemplateTest.cs new file mode 100644 index 0000000000..f788f7d8be --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/SetTextVariableTemplateTest.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Bot.ObjectModel; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class SetTextVariableTemplateTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void InitializeTemplate() + { + // Act, Assert + this.ExecuteTest(nameof(InitializeTemplate), "TestVariable", "Value: {OtherVar}"); + } + + private void ExecuteTest( + string displayName, + string variableName, + string textValue) + { + // Arrange + SetTextVariable model = + this.CreateModel( + displayName, + FormatVariablePath(variableName), + textValue); + + // Act + SetTextVariableTemplate template = new(model); + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + AssertGeneratedCode(template.Id, workflowCode); + AssertAgentProvider(template.UseAgentProvider, workflowCode); + AssertGeneratedAssignment(model.Variable?.Path, workflowCode); + Assert.Contains(textValue, workflowCode); + } + + private SetTextVariable CreateModel(string displayName, string variablePath, string textValue) + { + SetTextVariable.Builder actionBuilder = + new() + { + Id = this.CreateActionId("set_variable"), + DisplayName = this.FormatDisplayName(displayName), + Variable = PropertyPath.Create(variablePath), + Value = TemplateLine.Parse(textValue), + }; + + return actionBuilder.Build(); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/SetVariableTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/SetVariableTemplateTest.cs new file mode 100644 index 0000000000..0e772279f6 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/SetVariableTemplateTest.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.CodeGen; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Bot.ObjectModel; +using Microsoft.PowerFx.Types; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +public class SetVariableTemplateTest(ITestOutputHelper output) : WorkflowActionTemplateTest(output) +{ + [Fact] + public void InitializeLiteralValue() + { + // Arrange + ValueExpression.Builder expressionBuilder = new(ValueExpression.Literal(new NumberDataValue(420))); + + // Act, Assert + this.ExecuteTest(nameof(InitializeLiteralValue), "TestVariable", expressionBuilder, FormulaValue.New(420)); + } + + [Fact] + public void InitializeVariable() + { + // Arrange + ValueExpression.Builder expressionBuilder = new(ValueExpression.Variable(PropertyPath.TopicVariable("MyValue"))); + + // Act, Assert + this.ExecuteTest(nameof(InitializeVariable), "TestVariable", expressionBuilder, FormulaValue.New(6)); + } + + [Fact] + public void InitializeExpression() + { + ValueExpression.Builder expressionBuilder = new(ValueExpression.Expression("9 - 3")); + + // Act, Assert + this.ExecuteTest(nameof(InitializeExpression), "TestVariable", expressionBuilder, FormulaValue.New(6)); + } + + private void ExecuteTest( + string displayName, + string variableName, + ValueExpression.Builder valueExpression, + FormulaValue expectedValue) + { + // Arrange + SetVariable model = + this.CreateModel( + displayName, + FormatVariablePath(variableName), + valueExpression); + + // Act + SetVariableTemplate template = new(model); + string workflowCode = template.TransformText(); + this.Output.WriteLine(workflowCode.Trim()); + + // Assert + AssertGeneratedCode(template.Id, workflowCode); + AssertAgentProvider(template.UseAgentProvider, workflowCode); + AssertGeneratedAssignment(model.Variable?.Path, workflowCode); + } + + private SetVariable CreateModel(string displayName, string variablePath, ValueExpression.Builder valueExpression) + { + SetVariable.Builder actionBuilder = + new() + { + Id = this.CreateActionId("set_variable"), + DisplayName = this.FormatDisplayName(displayName), + Variable = PropertyPath.Create(variablePath), + Value = valueExpression, + }; + + return actionBuilder.Build(); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/WorkflowActionTemplateTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/WorkflowActionTemplateTest.cs new file mode 100644 index 0000000000..be7fb57351 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/WorkflowActionTemplateTest.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft. All rights reserved. + +using Microsoft.Agents.AI.Workflows.Declarative.Extensions; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Bot.ObjectModel; +using Xunit.Abstractions; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.CodeGen; + +/// +/// Base test class for text template. +/// +public abstract class WorkflowActionTemplateTest(ITestOutputHelper output) : WorkflowTest(output) +{ + private int ActionIndex { get; set; } = 1; + +#pragma warning disable CA1308 // Normalize strings to uppercase + protected ActionId CreateActionId(string seed) => new($"{seed.ToLowerInvariant()}_{this.ActionIndex++}"); +#pragma warning restore CA1308 // Normalize strings to uppercase + + protected string FormatDisplayName(string name) => $"{this.GetType().Name}_{name}"; + + protected static void AssertGeneratedCode(string actionId, string workflowCode) where TBase : class + { + Assert.Contains($"internal sealed class {actionId.FormatType()}", workflowCode); + Assert.Contains($") : {typeof(TBase).Name}(", workflowCode); + Assert.Contains(@$"""{actionId}""", workflowCode); + } + + protected static void AssertGeneratedMethod(string methodName, string workflowCode) => + Assert.Contains($"ValueTask {methodName}(", workflowCode); + + protected static void AssertAgentProvider(bool expected, string workflowCode) + { + if (expected) + { + Assert.Contains(", WorkflowAgentProvider agentProvider", workflowCode); + } + else + { + Assert.DoesNotContain(", WorkflowAgentProvider agentProvider", workflowCode); + } + } + + protected static void AssertOptionalAssignment(PropertyPath? variablePath, string workflowCode) + { + if (variablePath is not null) + { + Assert.Contains(@$"key: ""{variablePath.VariableName}""", workflowCode); + Assert.Contains(@$"scopeName: ""{variablePath.NamespaceAlias}""", workflowCode); + } + } + + protected static void AssertGeneratedAssignment(PropertyPath? variablePath, string workflowCode) + { + Assert.NotNull(variablePath); + Assert.Contains(@$"key: ""{variablePath.VariableName}""", workflowCode); + Assert.Contains(@$"scopeName: ""{variablePath.NamespaceAlias}""", workflowCode); + } + + protected static void AssertDelegate(string actionId, string rootId, string workflowCode) + { + Assert.Contains($"{nameof(DelegateExecutor)} {actionId.FormatName()} = new(", workflowCode); + Assert.Contains(@$"""{actionId}""", workflowCode); + Assert.Contains($"{rootId.FormatName()}.Session", workflowCode); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/DeclarativeWorkflowTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/DeclarativeWorkflowTest.cs index 2bdd68a72a..32e2f3d92c 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/DeclarativeWorkflowTest.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/DeclarativeWorkflowTest.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Agents.AI.Workflows.Declarative.Interpreter; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; using Microsoft.Bot.ObjectModel; using Microsoft.Extensions.AI; @@ -147,7 +148,7 @@ public sealed class DeclarativeWorkflowTest(ITestOutputHelper output) : Workflow [InlineData("EndDialog.yaml", 1, "end_all")] [InlineData("EditTable.yaml", 2, "edit_var")] [InlineData("EditTableV2.yaml", 2, "edit_var")] - [InlineData("ParseValue.yaml", 1, "parse_var")] + [InlineData("ParseValue.yaml", 2, "parse_var")] [InlineData("SendActivity.yaml", 2, "activity_input")] [InlineData("SetVariable.yaml", 1, "set_var")] [InlineData("SetTextVariable.yaml", 1, "set_text")] diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/ObjectExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/ObjectExtensionsTests.cs new file mode 100644 index 0000000000..c2d8d49f82 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/ObjectExtensionsTests.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System; +using System.Collections.Generic; +using Microsoft.Agents.AI.Workflows.Declarative.Extensions; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; + +namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.Extensions; + +public sealed class ObjectExtensionsTests +{ + [Fact] + public void AsListWithNullInput() + { + object[]? nullList = null; + IList? result = nullList.AsList(); + Assert.Null(result); + } + + [Fact] + public void AsListWithEmptyInput() + { + IList? result = Array.Empty().AsList(); + Assert.NotNull(result); + Assert.Empty(result); + } + + [Fact] + public void AsListWithSingleElement() + { + const string value = "Test"; + IList? result = value.AsList(); + Assert.NotNull(result); + Assert.Single(result); + Assert.Equal(value, result[0]); + } + + [Fact] + public void AsListWithMultipleInput() + { + object[] inputs = ["33.3", "test"]; + IList? result = inputs.AsList(); + Assert.NotNull(result); + Assert.Equal(2, result.Count); + } + + [Fact] + public void ConvertSame() + { + VerifyConversion(true, typeof(bool), true); + VerifyConversion(32, typeof(int), 32); + VerifyConversion("Test", typeof(string), "Test"); + DateTime now = DateTime.Now; + VerifyConversion(now, typeof(DateTime), now); + VerifyConversion(now.TimeOfDay, typeof(TimeSpan), now.TimeOfDay); + } + + [Fact] + public void ConvertFailure() + { + VerifyInvalid(32, VariableType.RecordType); + VerifyInvalid(true, VariableType.RecordType); + VerifyInvalid(Guid.NewGuid(), typeof(Guid)); + } + + [Fact] + public void ConvertToString() + { + VerifyConversion(true, typeof(string), bool.TrueString); + VerifyConversion(32, typeof(string), "32"); + VerifyConversion(3.14d, typeof(string), "3.14"); + DateTime now = DateTime.Now; + VerifyConversion(now, typeof(string), $"{now:o}"); + VerifyConversion(now.TimeOfDay, typeof(string), $"{now.TimeOfDay:c}"); + } + + [Fact] + public void ConvertFromString() + { + VerifyConversion("true", typeof(bool), true); + VerifyConversion("32", typeof(int), 32); + VerifyConversion("3.14", typeof(double), 3.14D); + DateTime now = DateTime.Now; + VerifyConversion($"{now:o}", typeof(DateTime), now); + VerifyConversion($"{now.TimeOfDay:c}", typeof(TimeSpan), now.TimeOfDay); + } + + [Fact] + public void ConvertJson() + { + const string json = + """ + { + "id": "item1", + "count": 5 + } + """; + Dictionary expected = + new() + { + { "id", "item1"}, + { "count", 5}, + }; + VerifyConversion(json, VariableType.Record(("id", typeof(string)), ("count", typeof(int))), expected); + } + + private static void VerifyConversion(object? sourceValue, VariableType targetType, object? expectedValue) + { + object? actualValue = sourceValue.ConvertType(targetType); + if (expectedValue is IDictionary || expectedValue is DateTime) + { + Assert.Equivalent(expectedValue, actualValue); + } + else + { + Assert.Equal(expectedValue, actualValue); + } + } + + private static void VerifyInvalid(object? sourceValue, VariableType targetType) + { + Assert.Throws(() => sourceValue.ConvertType(targetType)); + } +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/StringExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/StringExtensionsTests.cs index c6dd4cc80c..70412d18ca 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/StringExtensionsTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/StringExtensionsTests.cs @@ -4,7 +4,7 @@ using Microsoft.Agents.AI.Workflows.Declarative.Extensions; namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.Extensions; -public class StringExtensionsTests +public sealed class StringExtensionsTests { [Fact] public void TrimJsonWithDelimiter() diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Interpreter/WorkflowModelTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Interpreter/WorkflowModelTest.cs index 2807dc14fe..95d738f8f0 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Interpreter/WorkflowModelTest.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Interpreter/WorkflowModelTest.cs @@ -1,71 +1,71 @@ // Copyright (c) Microsoft. All rights reserved. -using System; -using System.Threading.Tasks; using Microsoft.Agents.AI.Workflows.Declarative.Interpreter; -using Microsoft.Agents.AI.Workflows.Reflection; using Xunit.Abstractions; namespace Microsoft.Agents.AI.Workflows.Declarative.UnitTests.Interpreter; /// -/// Tests execution of workflow created by . +/// Tests execution of workflow created by . /// public sealed class DeclarativeWorkflowModelTest(ITestOutputHelper output) : WorkflowTest(output) { [Fact] public void GetDepthForDefault() { - DeclarativeWorkflowModel model = new(CreateExecutor("root")); + WorkflowModel model = new(new TestExecutor("root")); Assert.Equal(0, model.GetDepth(null)); } [Fact] public void GetDepthForMissingNode() { - DeclarativeWorkflowModel model = new(CreateExecutor("root")); + WorkflowModel model = new(new TestExecutor("root")); Assert.Throws(() => model.GetDepth("missing")); } [Fact] public void ConnectMissingNode() { - TestExecutor rootExecutor = CreateExecutor("root"); - DeclarativeWorkflowModel model = new(rootExecutor); + TestExecutor rootExecutor = new("root"); + WorkflowModel model = new(rootExecutor); model.AddLink("root", "missing"); - WorkflowBuilder workflowBuilder = new(rootExecutor); - Assert.Throws(() => model.ConnectNodes(workflowBuilder)); + TestWorkflowBuilder modelBuilder = new(); + Assert.Throws(() => model.Build(modelBuilder)); } [Fact] public void AddToMissingParent() { - DeclarativeWorkflowModel model = new(CreateExecutor("root")); - Assert.Throws(() => model.AddNode(CreateExecutor("next"), "missing")); + WorkflowModel model = new(new TestExecutor("root")); + Assert.Throws(() => model.AddNode(new TestExecutor("next"), "missing")); } [Fact] public void LinkFromMissingSource() { - DeclarativeWorkflowModel model = new(CreateExecutor("root")); + WorkflowModel model = new(new TestExecutor("root")); Assert.Throws(() => model.AddLink("missing", "anything")); } [Fact] public void LocateMissingParent() { - DeclarativeWorkflowModel model = new(CreateExecutor("root")); + WorkflowModel model = new(new TestExecutor("root")); Assert.Null(model.LocateParent(null)); Assert.Throws(() => model.LocateParent("missing")); } - private static TestExecutor CreateExecutor(string id) => new(id); - - internal sealed class TestExecutor(string actionId) : - ReflectingExecutor(actionId), - IMessageHandler + internal sealed class TestExecutor(string actionId) : IModeledAction { - public async ValueTask HandleAsync(string message, IWorkflowContext context) => - await context.SendMessageAsync($"{this.Id}: {DateTime.UtcNow:t}").ConfigureAwait(false); + public string Id { get; } = actionId; + } + + internal sealed class TestWorkflowBuilder : IModelBuilder + { + public void Connect(IModeledAction source, IModeledAction target, string? condition = null) + { + Assert.Fail(); // Not expected to be called in this test. + } } } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests.csproj index 8d8095960b..ddc4c32192 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests.csproj @@ -1,23 +1,36 @@ - + $(ProjectsTargetFrameworks) $(NoWarn);IDE1006 + + true + true + + + + + + Always + Always + + Always + diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/WorkflowActionExecutorTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/WorkflowActionExecutorTest.cs index 67df3e2526..10997e397c 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/WorkflowActionExecutorTest.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/WorkflowActionExecutorTest.cs @@ -5,8 +5,8 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.Agents.AI.Workflows.Declarative.Extensions; using Microsoft.Agents.AI.Workflows.Declarative.Interpreter; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; using Microsoft.Agents.AI.Workflows.Declarative.PowerFx; -using Microsoft.Agents.AI.Workflows.Reflection; using Microsoft.Bot.ObjectModel; using Microsoft.PowerFx.Types; using Xunit.Abstractions; @@ -68,11 +68,9 @@ public abstract class WorkflowActionExecutorTest(ITestOutputHelper output) : Wor return (TAction)model.Actions[0]; } - internal sealed class TestWorkflowExecutor() : - ReflectingExecutor(nameof(TestWorkflowExecutor)), - IMessageHandler + internal sealed class TestWorkflowExecutor() : Executor("test_workflow") { - public async ValueTask HandleAsync(WorkflowFormulaState message, IWorkflowContext context) => + public override async ValueTask HandleAsync(WorkflowFormulaState message, IWorkflowContext context) => await context.SendMessageAsync(new ActionExecutorResult(this.Id)).ConfigureAwait(false); } } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/UpdateBaseline.ps1 b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/UpdateBaseline.ps1 new file mode 100644 index 0000000000..56359529aa --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/UpdateBaseline.ps1 @@ -0,0 +1,7 @@ +$generatedCodeFiles = Get-ChildItem -Name -Path .\bin\Debug\net9.0\Workflows -Filter *.g.cs +Write-Output "x$($generatedCodeFiles.Count)" +foreach ($file in $generatedCodeFiles) { + $baselineFile = $file -replace '\.g\.cs$', '.cs' + Write-Output $baselineFile + Copy-Item -Path ".\bin\Debug\net9.0\Workflows\$file" -Destination ".\Workflows\$baselineFile" -Force +} \ No newline at end of file diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ClearAllVariables.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ClearAllVariables.cs new file mode 100644 index 0000000000..23f9655c08 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ClearAllVariables.cs @@ -0,0 +1,85 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; + +namespace Test.WorkflowProviders; + +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class WorkflowProvider +{ + /// + /// The root executor for a declarative workflow. + /// + internal sealed class MyWorkflowRootExecutor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("my_workflow_Root", options, inputTransform) + where TInput : notnull + { + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + { + } + } + + /// + /// Reset all the state for the targeted variable scope. + /// + internal sealed class ClearAllExecutor(FormulaSession session) : ActionExecutor(id: "clear_all", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string? targetScopeName = "Local"; + await context.QueueClearScopeAsync(targetScopeName).ConfigureAwait(false); + + return default; + } + } + + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + MyWorkflowRootExecutor myWorkflowRoot = new(options, inputTransform); + DelegateExecutor myWorkflow = new(id: "my_workflow", myWorkflowRoot.Session); + ClearAllExecutor clearAll = new(myWorkflowRoot.Session); + + // Define the workflow builder + WorkflowBuilder builder = new(myWorkflowRoot); + + // Connect executors + builder.AddEdge(myWorkflowRoot, myWorkflow); + builder.AddEdge(myWorkflow, clearAll); + + // Build the workflow + return builder.Build(); + } +} \ No newline at end of file diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/Condition.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/Condition.cs new file mode 100644 index 0000000000..2107c642ec --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/Condition.cs @@ -0,0 +1,180 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; + +namespace Test.WorkflowProviders; + +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class WorkflowProvider +{ + /// + /// The root executor for a declarative workflow. + /// + internal sealed class MyWorkflowRootExecutor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("my_workflow_Root", options, inputTransform) + where TInput : notnull + { + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + { + // Initialize variables + await context.QueueStateUpdateAsync("TestValue", UnassignedValue.Instance, "Local").ConfigureAwait(false); + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.TestValue" variable. + /// + internal sealed class SetvariableTestExecutor(FormulaSession session) : ActionExecutor(id: "setVariable_test", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync("Value(System.LastMessageText)").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "TestValue", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Conditional branching similar to an if / elseif / elseif / else chain. + /// + internal sealed class ConditiongroupTestExecutor(FormulaSession session) : ActionExecutor(id: "conditionGroup_test", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + bool condition0 = await context.EvaluateValueAsync("Mod(Local.TestValue, 2) = 1").ConfigureAwait(false); + if (condition0) + { + return "conditionItem_odd"; + } + + bool condition1 = await context.EvaluateValueAsync("Mod(Local.TestValue, 2) = 0").ConfigureAwait(false); + if (condition1) + { + return "conditionItem_even"; + } + + return "conditionGroup_testElseActions"; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendactivityOddExecutor(FormulaSession session) : ActionExecutor(id: "sendActivity_odd", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + ODD + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendactivityEvenExecutor(FormulaSession session) : ActionExecutor(id: "sendActivity_even", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + EVEN + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + MyWorkflowRootExecutor myWorkflowRoot = new(options, inputTransform); + DelegateExecutor myWorkflow = new(id: "my_workflow", myWorkflowRoot.Session); + SetvariableTestExecutor setVariableTest = new(myWorkflowRoot.Session); + ConditiongroupTestExecutor conditionGroupTest = new(myWorkflowRoot.Session); + DelegateExecutor conditionItemOdd = new(id: "conditionItem_odd", myWorkflowRoot.Session); + DelegateExecutor conditionItemEven = new(id: "conditionItem_even", myWorkflowRoot.Session); + DelegateExecutor conditionItemOddactions = new(id: "conditionItem_oddActions", myWorkflowRoot.Session); + SendactivityOddExecutor sendActivityOdd = new(myWorkflowRoot.Session); + DelegateExecutor conditionItemEvenactions = new(id: "conditionItem_evenActions", myWorkflowRoot.Session); + SendactivityEvenExecutor sendActivityEven = new(myWorkflowRoot.Session); + DelegateExecutor conditionGroupTestPost = new(id: "conditionGroup_test_Post", myWorkflowRoot.Session); + DelegateExecutor endAll = new(id: "end_all", myWorkflowRoot.Session); + DelegateExecutor conditionItemOddPost = new(id: "conditionItem_odd_Post", myWorkflowRoot.Session); + DelegateExecutor conditionItemEvenPost = new(id: "conditionItem_even_Post", myWorkflowRoot.Session); + DelegateExecutor conditionItemOddactionsPost = new(id: "conditionItem_oddActions_Post", myWorkflowRoot.Session); + DelegateExecutor conditionItemEvenactionsPost = new(id: "conditionItem_evenActions_Post", myWorkflowRoot.Session); + + // Define the workflow builder + WorkflowBuilder builder = new(myWorkflowRoot); + + // Connect executors + builder.AddEdge(myWorkflowRoot, myWorkflow); + builder.AddEdge(myWorkflow, setVariableTest); + builder.AddEdge(setVariableTest, conditionGroupTest); + builder.AddEdge(conditionGroupTest, conditionItemOdd, (object? result) => ActionExecutor.IsMatch("conditionItem_odd", result)); + builder.AddEdge(conditionGroupTest, conditionItemEven, (object? result) => ActionExecutor.IsMatch("conditionItem_even", result)); + builder.AddEdge(conditionItemOdd, conditionItemOddactions); + builder.AddEdge(conditionItemOddactions, sendActivityOdd); + builder.AddEdge(conditionItemEven, conditionItemEvenactions); + builder.AddEdge(conditionItemEvenactions, sendActivityEven); + builder.AddEdge(conditionGroupTestPost, endAll); + builder.AddEdge(conditionItemOddPost, conditionGroupTestPost); + builder.AddEdge(conditionItemEvenPost, conditionGroupTestPost); + builder.AddEdge(sendActivityOdd, conditionItemOddactionsPost); + builder.AddEdge(conditionItemOddactionsPost, conditionItemOddPost); + builder.AddEdge(sendActivityEven, conditionItemEvenactionsPost); + builder.AddEdge(conditionItemEvenactionsPost, conditionItemEvenPost); + + // Build the workflow + return builder.Build(); + } +} \ No newline at end of file diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ConditionElse.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ConditionElse.cs new file mode 100644 index 0000000000..0deafc2e28 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ConditionElse.cs @@ -0,0 +1,172 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; + +namespace Test.WorkflowProviders; + +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class WorkflowProvider +{ + /// + /// The root executor for a declarative workflow. + /// + internal sealed class MyWorkflowRootExecutor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("my_workflow_Root", options, inputTransform) + where TInput : notnull + { + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + { + // Initialize variables + await context.QueueStateUpdateAsync("TestValue", UnassignedValue.Instance, "Local").ConfigureAwait(false); + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.TestValue" variable. + /// + internal sealed class SetvariableTestExecutor(FormulaSession session) : ActionExecutor(id: "setVariable_test", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync("Value(System.LastMessageText)").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "TestValue", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Conditional branching similar to an if / elseif / elseif / else chain. + /// + internal sealed class ConditiongroupTestExecutor(FormulaSession session) : ActionExecutor(id: "conditionGroup_test", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + bool condition0 = await context.EvaluateValueAsync("Mod(Local.TestValue, 2) = 1").ConfigureAwait(false); + if (condition0) + { + return "conditionItem_odd"; + } + + return "conditionGroup_testElseActions"; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendactivityOddExecutor(FormulaSession session) : ActionExecutor(id: "sendActivity_odd", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + ODD + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendactivityElseExecutor(FormulaSession session) : ActionExecutor(id: "sendActivity_else", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + EVEN + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + MyWorkflowRootExecutor myWorkflowRoot = new(options, inputTransform); + DelegateExecutor myWorkflow = new(id: "my_workflow", myWorkflowRoot.Session); + SetvariableTestExecutor setVariableTest = new(myWorkflowRoot.Session); + ConditiongroupTestExecutor conditionGroupTest = new(myWorkflowRoot.Session); + DelegateExecutor conditionItemOdd = new(id: "conditionItem_odd", myWorkflowRoot.Session); + DelegateExecutor conditionGroupTestelseactions = new(id: "conditionGroup_testElseActions", myWorkflowRoot.Session); + DelegateExecutor conditionItemOddactions = new(id: "conditionItem_oddActions", myWorkflowRoot.Session); + SendactivityOddExecutor sendActivityOdd = new(myWorkflowRoot.Session); + DelegateExecutor conditionItemOddRestart = new(id: "conditionItem_odd_Restart", myWorkflowRoot.Session); + SendactivityElseExecutor sendActivityElse = new(myWorkflowRoot.Session); + DelegateExecutor conditionGroupTestPost = new(id: "conditionGroup_test_Post", myWorkflowRoot.Session); + DelegateExecutor endAll = new(id: "end_all", myWorkflowRoot.Session); + DelegateExecutor conditionItemOddPost = new(id: "conditionItem_odd_Post", myWorkflowRoot.Session); + DelegateExecutor conditionItemOddactionsPost = new(id: "conditionItem_oddActions_Post", myWorkflowRoot.Session); + DelegateExecutor conditionGroupTestelseactionsPost = new(id: "conditionGroup_testElseActions_Post", myWorkflowRoot.Session); + + // Define the workflow builder + WorkflowBuilder builder = new(myWorkflowRoot); + + // Connect executors + builder.AddEdge(myWorkflowRoot, myWorkflow); + builder.AddEdge(myWorkflow, setVariableTest); + builder.AddEdge(setVariableTest, conditionGroupTest); + builder.AddEdge(conditionGroupTest, conditionItemOdd, (object? result) => ActionExecutor.IsMatch("conditionItem_odd", result)); + builder.AddEdge(conditionGroupTest, conditionGroupTestelseactions, (object? result) => ActionExecutor.IsMatch("conditionGroup_testElseActions", result)); + builder.AddEdge(conditionItemOdd, conditionItemOddactions); + builder.AddEdge(conditionItemOddactions, sendActivityOdd); + builder.AddEdge(conditionItemOddRestart, conditionGroupTestelseactions); + builder.AddEdge(conditionGroupTestelseactions, sendActivityElse); + builder.AddEdge(conditionGroupTestPost, endAll); + builder.AddEdge(conditionItemOddPost, conditionGroupTestPost); + builder.AddEdge(sendActivityOdd, conditionItemOddactionsPost); + builder.AddEdge(conditionItemOddactionsPost, conditionItemOddPost); + builder.AddEdge(sendActivityElse, conditionGroupTestelseactionsPost); + builder.AddEdge(conditionGroupTestelseactionsPost, conditionGroupTestPost); + + // Build the workflow + return builder.Build(); + } +} \ No newline at end of file diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EditTable.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EditTable.cs new file mode 100644 index 0000000000..02fdd4ee9a --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EditTable.cs @@ -0,0 +1,87 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; + +namespace Test.WorkflowProviders; + +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class WorkflowProvider +{ + /// + /// The root executor for a declarative workflow. + /// + internal sealed class MyWorkflowRootExecutor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("my_workflow_Root", options, inputTransform) + where TInput : notnull + { + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + { + // Initialize variables + await context.QueueStateUpdateAsync("MyTable", UnassignedValue.Instance, "Local").ConfigureAwait(false); + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.MyTable" variable. + /// + internal sealed class SetVarExecutor(FormulaSession session) : ActionExecutor(id: "set_var", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync("[{id: 3}]").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "MyTable", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + MyWorkflowRootExecutor myWorkflowRoot = new(options, inputTransform); + DelegateExecutor myWorkflow = new(id: "my_workflow", myWorkflowRoot.Session); + SetVarExecutor setVar = new(myWorkflowRoot.Session); + + // Define the workflow builder + WorkflowBuilder builder = new(myWorkflowRoot); + + // Connect executors + builder.AddEdge(myWorkflowRoot, myWorkflow); + builder.AddEdge(myWorkflow, setVar); + + // Build the workflow + return builder.Build(); + } +} \ No newline at end of file diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EditTableV2.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EditTableV2.cs new file mode 100644 index 0000000000..02fdd4ee9a --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EditTableV2.cs @@ -0,0 +1,87 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; + +namespace Test.WorkflowProviders; + +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class WorkflowProvider +{ + /// + /// The root executor for a declarative workflow. + /// + internal sealed class MyWorkflowRootExecutor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("my_workflow_Root", options, inputTransform) + where TInput : notnull + { + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + { + // Initialize variables + await context.QueueStateUpdateAsync("MyTable", UnassignedValue.Instance, "Local").ConfigureAwait(false); + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.MyTable" variable. + /// + internal sealed class SetVarExecutor(FormulaSession session) : ActionExecutor(id: "set_var", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync("[{id: 3}]").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "MyTable", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + MyWorkflowRootExecutor myWorkflowRoot = new(options, inputTransform); + DelegateExecutor myWorkflow = new(id: "my_workflow", myWorkflowRoot.Session); + SetVarExecutor setVar = new(myWorkflowRoot.Session); + + // Define the workflow builder + WorkflowBuilder builder = new(myWorkflowRoot); + + // Connect executors + builder.AddEdge(myWorkflowRoot, myWorkflow); + builder.AddEdge(myWorkflow, setVar); + + // Build the workflow + return builder.Build(); + } +} \ No newline at end of file diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EndConversation.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EndConversation.cs new file mode 100644 index 0000000000..5d59c0f7ae --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EndConversation.cs @@ -0,0 +1,94 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; + +namespace Test.WorkflowProviders; + +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class WorkflowProvider +{ + /// + /// The root executor for a declarative workflow. + /// + internal sealed class MyWorkflowRootExecutor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("my_workflow_Root", options, inputTransform) + where TInput : notnull + { + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + { + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendActivity1Executor(FormulaSession session) : ActionExecutor(id: "send_activity_1", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + NEVER 1! + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + MyWorkflowRootExecutor myWorkflowRoot = new(options, inputTransform); + DelegateExecutor myWorkflow = new(id: "my_workflow", myWorkflowRoot.Session); + DelegateExecutor endAll = new(id: "end_all", myWorkflowRoot.Session); + DelegateExecutor endAllRestart = new(id: "end_all_Restart", myWorkflowRoot.Session); + SendActivity1Executor sendActivity1 = new(myWorkflowRoot.Session); + + // Define the workflow builder + WorkflowBuilder builder = new(myWorkflowRoot); + + // Connect executors + builder.AddEdge(myWorkflowRoot, myWorkflow); + builder.AddEdge(myWorkflow, endAll); + builder.AddEdge(endAllRestart, sendActivity1); + + // Build the workflow + return builder.Build(); + } +} \ No newline at end of file diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EndDialog.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EndDialog.cs new file mode 100644 index 0000000000..5d59c0f7ae --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EndDialog.cs @@ -0,0 +1,94 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; + +namespace Test.WorkflowProviders; + +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class WorkflowProvider +{ + /// + /// The root executor for a declarative workflow. + /// + internal sealed class MyWorkflowRootExecutor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("my_workflow_Root", options, inputTransform) + where TInput : notnull + { + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + { + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendActivity1Executor(FormulaSession session) : ActionExecutor(id: "send_activity_1", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + NEVER 1! + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + MyWorkflowRootExecutor myWorkflowRoot = new(options, inputTransform); + DelegateExecutor myWorkflow = new(id: "my_workflow", myWorkflowRoot.Session); + DelegateExecutor endAll = new(id: "end_all", myWorkflowRoot.Session); + DelegateExecutor endAllRestart = new(id: "end_all_Restart", myWorkflowRoot.Session); + SendActivity1Executor sendActivity1 = new(myWorkflowRoot.Session); + + // Define the workflow builder + WorkflowBuilder builder = new(myWorkflowRoot); + + // Connect executors + builder.AddEdge(myWorkflowRoot, myWorkflow); + builder.AddEdge(myWorkflow, endAll); + builder.AddEdge(endAllRestart, sendActivity1); + + // Build the workflow + return builder.Build(); + } +} \ No newline at end of file diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/Goto.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/Goto.cs new file mode 100644 index 0000000000..112e315d3d --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/Goto.cs @@ -0,0 +1,143 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; + +namespace Test.WorkflowProviders; + +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class WorkflowProvider +{ + /// + /// The root executor for a declarative workflow. + /// + internal sealed class MyWorkflowRootExecutor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("my_workflow_Root", options, inputTransform) + where TInput : notnull + { + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + { + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendActivity1Executor(FormulaSession session) : ActionExecutor(id: "send_activity_1", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + NEVER 1! + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendActivity2Executor(FormulaSession session) : ActionExecutor(id: "send_activity_2", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + NEVER 2! + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendActivity3Executor(FormulaSession session) : ActionExecutor(id: "send_activity_3", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + NEVER 3! + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + MyWorkflowRootExecutor myWorkflowRoot = new(options, inputTransform); + DelegateExecutor myWorkflow = new(id: "my_workflow", myWorkflowRoot.Session); + DelegateExecutor gotoEnd = new(id: "goto_end", myWorkflowRoot.Session); + DelegateExecutor endAll = new(id: "end_all", myWorkflowRoot.Session); + DelegateExecutor gotoEndRestart = new(id: "goto_end_Restart", myWorkflowRoot.Session); + SendActivity1Executor sendActivity1 = new(myWorkflowRoot.Session); + SendActivity2Executor sendActivity2 = new(myWorkflowRoot.Session); + SendActivity3Executor sendActivity3 = new(myWorkflowRoot.Session); + + // Define the workflow builder + WorkflowBuilder builder = new(myWorkflowRoot); + + // Connect executors + builder.AddEdge(myWorkflowRoot, myWorkflow); + builder.AddEdge(myWorkflow, gotoEnd); + builder.AddEdge(gotoEnd, endAll); + builder.AddEdge(gotoEndRestart, sendActivity1); + builder.AddEdge(sendActivity1, sendActivity2); + builder.AddEdge(sendActivity2, sendActivity3); + builder.AddEdge(sendActivity3, endAll); + + // Build the workflow + return builder.Build(); + } +} \ No newline at end of file diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/InvokeAgent.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/InvokeAgent.cs new file mode 100644 index 0000000000..b75cd445ed --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/InvokeAgent.cs @@ -0,0 +1,114 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; + +namespace Test.WorkflowProviders; + +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class WorkflowProvider +{ + /// + /// The root executor for a declarative workflow. + /// + internal sealed class MyWorkflowRootExecutor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("my_workflow_Root", options, inputTransform) + where TInput : notnull + { + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + { + // Set environment variables + await this.InitializeEnvironmentAsync( + context, + "MY_STUDENT").ConfigureAwait(false); + + } + } + + /// + /// Invokes an agent to process messages and return a response within a conversation context. + /// + internal sealed class InvokeAgentExecutor(FormulaSession session, WorkflowAgentProvider agentProvider) : AgentExecutor(id: "invoke_agent", session, agentProvider) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string? agentName = await context.ReadStateAsync(key: "MY_STUDENT", scopeName: "Env").ConfigureAwait(false); + + if (string.IsNullOrWhiteSpace(agentName)) + { + throw new InvalidOperationException($"Agent name must be defined: {this.Id}"); + } + + string? conversationId = await context.ReadStateAsync(key: "ConversationId", scopeName: "System").ConfigureAwait(false); + bool autoSend = true; + string? additionalInstructions = null; + IList? inputMessages = await context.EvaluateListAsync("[UserMessage(System.LastMessageText)]").ConfigureAwait(false); + + AgentRunResponse agentResponse = + await InvokeAgentAsync( + context, + agentName, + conversationId, + autoSend, + additionalInstructions, + inputMessages, + cancellationToken).ConfigureAwait(false); + + if (autoSend) + { + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, agentResponse)).ConfigureAwait(false); + } + + return default; + } + } + + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + MyWorkflowRootExecutor myWorkflowRoot = new(options, inputTransform); + DelegateExecutor myWorkflow = new(id: "my_workflow", myWorkflowRoot.Session); + InvokeAgentExecutor invokeAgent = new(myWorkflowRoot.Session, options.AgentProvider); + + // Define the workflow builder + WorkflowBuilder builder = new(myWorkflowRoot); + + // Connect executors + builder.AddEdge(myWorkflowRoot, myWorkflow); + builder.AddEdge(myWorkflow, invokeAgent); + + // Build the workflow + return builder.Build(); + } +} \ No newline at end of file diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/InvokeAgent.yaml b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/InvokeAgent.yaml new file mode 100644 index 0000000000..ab362b9b42 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/InvokeAgent.yaml @@ -0,0 +1,14 @@ +kind: Workflow +trigger: + + kind: OnConversationStart + id: my_workflow + actions: + + - kind: InvokeAzureAgent + id: invoke_agent + conversationId: =System.ConversationId + agent: + name: =Env.MY_STUDENT + input: + messages: =[UserMessage(System.LastMessageText)] diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopBreak.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopBreak.cs new file mode 100644 index 0000000000..678ba4c370 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopBreak.cs @@ -0,0 +1,185 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; + +namespace Test.WorkflowProviders; + +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class WorkflowProvider +{ + /// + /// The root executor for a declarative workflow. + /// + internal sealed class MyWorkflowRootExecutor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("my_workflow_Root", options, inputTransform) + where TInput : notnull + { + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + { + // Initialize variables + await context.QueueStateUpdateAsync("Count", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("LoopIndex", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("LoopValue", UnassignedValue.Instance, "Local").ConfigureAwait(false); + } + } + + /// + /// Loops over a list assignign the loop variable to "Local.LoopValue" variable. + /// + internal sealed class ForeachLoopExecutor(FormulaSession session) : ActionExecutor(id: "foreach_loop", session) + { + private int _index; + private object[] _values = []; + + public bool HasValue { get; private set; } + + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + this._index = 0; + object? evaluatedValue = await context.EvaluateValueAsync("""["a", "b", "c", "d", "e", "f"]""").ConfigureAwait(false); + + if (evaluatedValue == null) + { + this._values = []; + this.HasValue = false; + } + else + if (evaluatedValue is IEnumerable evaluatedList) + { + this._values = [.. evaluatedList]; + } + else + { + this._values = [evaluatedValue]; + } + + await this.ResetAsync(context, null, cancellationToken).ConfigureAwait(false); + + return default; + } + + public async ValueTask TakeNextAsync(IWorkflowContext context, object? _, CancellationToken cancellationToken) + { + if (this.HasValue = this._index < this._values.Length) + { + object value = this._values[this._index]; + + await context.QueueStateUpdateAsync(key: "LoopValue", value: value, scopeName: "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "LoopIndex", value: this._index, scopeName: "Local").ConfigureAwait(false); + + this._index++; + } + } + + public async ValueTask ResetAsync(IWorkflowContext context, object? _, CancellationToken cancellationToken) + { + await context.QueueStateUpdateAsync(key: "LoopValue", value: UnassignedValue.Instance, scopeName: "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "LoopIndex", value: UnassignedValue.Instance, scopeName: "Local").ConfigureAwait(false); + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.Count" variable. + /// + internal sealed class SetVariableInnerExecutor(FormulaSession session) : ActionExecutor(id: "set_variable_inner", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync("Local.Count + 1").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "Count", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendActivityInnerExecutor(FormulaSession session) : ActionExecutor(id: "send_activity_inner", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + x{Local.Count} - {Local.LoopIndex}:{Local.LoopValue} + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + MyWorkflowRootExecutor myWorkflowRoot = new(options, inputTransform); + DelegateExecutor myWorkflow = new(id: "my_workflow", myWorkflowRoot.Session); + ForeachLoopExecutor foreachLoop = new(myWorkflowRoot.Session); + DelegateExecutor foreachLoopNext = new(id: "foreach_loop_Next", myWorkflowRoot.Session, foreachLoop.TakeNextAsync); + DelegateExecutor foreachLoopPost = new(id: "foreach_loop_Post", myWorkflowRoot.Session); + DelegateExecutor foreachLoopStart = new(id: "foreach_loop_Start", myWorkflowRoot.Session); + DelegateExecutor breakLoopNow = new(id: "break_loop_now", myWorkflowRoot.Session); + DelegateExecutor breakLoopNowRestart = new(id: "break_loop_now_Restart", myWorkflowRoot.Session); + SetVariableInnerExecutor setVariableInner = new(myWorkflowRoot.Session); + SendActivityInnerExecutor sendActivityInner = new(myWorkflowRoot.Session); + DelegateExecutor endAll = new(id: "end_all", myWorkflowRoot.Session); + DelegateExecutor foreachLoopEnd = new(id: "foreach_loop_End", myWorkflowRoot.Session, foreachLoop.ResetAsync); + + // Define the workflow builder + WorkflowBuilder builder = new(myWorkflowRoot); + + // Connect executors + builder.AddEdge(myWorkflowRoot, myWorkflow); + builder.AddEdge(myWorkflow, foreachLoop); + builder.AddEdge(foreachLoop, foreachLoopNext); + builder.AddEdge(foreachLoopNext, foreachLoopPost, (object? result) => !foreachLoop.HasValue); + builder.AddEdge(foreachLoopNext, foreachLoopStart, (object? result) => foreachLoop.HasValue); + builder.AddEdge(foreachLoopStart, breakLoopNow); + builder.AddEdge(breakLoopNow, foreachLoopPost); + builder.AddEdge(breakLoopNowRestart, setVariableInner); + builder.AddEdge(setVariableInner, sendActivityInner); + builder.AddEdge(foreachLoopPost, endAll); + builder.AddEdge(sendActivityInner, foreachLoopEnd); + builder.AddEdge(foreachLoopEnd, foreachLoopNext); + + // Build the workflow + return builder.Build(); + } +} \ No newline at end of file diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopContinue.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopContinue.cs new file mode 100644 index 0000000000..32147adf76 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopContinue.cs @@ -0,0 +1,185 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; + +namespace Test.WorkflowProviders; + +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class WorkflowProvider +{ + /// + /// The root executor for a declarative workflow. + /// + internal sealed class MyWorkflowRootExecutor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("my_workflow_Root", options, inputTransform) + where TInput : notnull + { + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + { + // Initialize variables + await context.QueueStateUpdateAsync("Count", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("LoopIndex", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("LoopValue", UnassignedValue.Instance, "Local").ConfigureAwait(false); + } + } + + /// + /// Loops over a list assignign the loop variable to "Local.LoopValue" variable. + /// + internal sealed class ForeachLoopExecutor(FormulaSession session) : ActionExecutor(id: "foreach_loop", session) + { + private int _index; + private object[] _values = []; + + public bool HasValue { get; private set; } + + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + this._index = 0; + object? evaluatedValue = await context.EvaluateValueAsync("""["a", "b", "c", "d", "e", "f"]""").ConfigureAwait(false); + + if (evaluatedValue == null) + { + this._values = []; + this.HasValue = false; + } + else + if (evaluatedValue is IEnumerable evaluatedList) + { + this._values = [.. evaluatedList]; + } + else + { + this._values = [evaluatedValue]; + } + + await this.ResetAsync(context, null, cancellationToken).ConfigureAwait(false); + + return default; + } + + public async ValueTask TakeNextAsync(IWorkflowContext context, object? _, CancellationToken cancellationToken) + { + if (this.HasValue = this._index < this._values.Length) + { + object value = this._values[this._index]; + + await context.QueueStateUpdateAsync(key: "LoopValue", value: value, scopeName: "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "LoopIndex", value: this._index, scopeName: "Local").ConfigureAwait(false); + + this._index++; + } + } + + public async ValueTask ResetAsync(IWorkflowContext context, object? _, CancellationToken cancellationToken) + { + await context.QueueStateUpdateAsync(key: "LoopValue", value: UnassignedValue.Instance, scopeName: "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "LoopIndex", value: UnassignedValue.Instance, scopeName: "Local").ConfigureAwait(false); + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.Count" variable. + /// + internal sealed class SetVariableInnerExecutor(FormulaSession session) : ActionExecutor(id: "set_variable_inner", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync("Local.Count + 1").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "Count", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendActivityInnerExecutor(FormulaSession session) : ActionExecutor(id: "send_activity_inner", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + x{Local.Count} - {Local.LoopIndex}:{Local.LoopValue} + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + MyWorkflowRootExecutor myWorkflowRoot = new(options, inputTransform); + DelegateExecutor myWorkflow = new(id: "my_workflow", myWorkflowRoot.Session); + ForeachLoopExecutor foreachLoop = new(myWorkflowRoot.Session); + DelegateExecutor foreachLoopNext = new(id: "foreach_loop_Next", myWorkflowRoot.Session, foreachLoop.TakeNextAsync); + DelegateExecutor foreachLoopPost = new(id: "foreach_loop_Post", myWorkflowRoot.Session); + DelegateExecutor foreachLoopStart = new(id: "foreach_loop_Start", myWorkflowRoot.Session); + DelegateExecutor continueLoopNow = new(id: "continue_loop_now", myWorkflowRoot.Session); + DelegateExecutor continueLoopNowRestart = new(id: "continue_loop_now_Restart", myWorkflowRoot.Session); + SetVariableInnerExecutor setVariableInner = new(myWorkflowRoot.Session); + SendActivityInnerExecutor sendActivityInner = new(myWorkflowRoot.Session); + DelegateExecutor endAll = new(id: "end_all", myWorkflowRoot.Session); + DelegateExecutor foreachLoopEnd = new(id: "foreach_loop_End", myWorkflowRoot.Session, foreachLoop.ResetAsync); + + // Define the workflow builder + WorkflowBuilder builder = new(myWorkflowRoot); + + // Connect executors + builder.AddEdge(myWorkflowRoot, myWorkflow); + builder.AddEdge(myWorkflow, foreachLoop); + builder.AddEdge(foreachLoop, foreachLoopNext); + builder.AddEdge(foreachLoopNext, foreachLoopPost, (object? result) => !foreachLoop.HasValue); + builder.AddEdge(foreachLoopNext, foreachLoopStart, (object? result) => foreachLoop.HasValue); + builder.AddEdge(foreachLoopStart, continueLoopNow); + builder.AddEdge(continueLoopNow, foreachLoopStart); + builder.AddEdge(continueLoopNowRestart, setVariableInner); + builder.AddEdge(setVariableInner, sendActivityInner); + builder.AddEdge(foreachLoopPost, endAll); + builder.AddEdge(sendActivityInner, foreachLoopEnd); + builder.AddEdge(foreachLoopEnd, foreachLoopNext); + + // Build the workflow + return builder.Build(); + } +} \ No newline at end of file diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopEach.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopEach.cs new file mode 100644 index 0000000000..0d4f7470af --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopEach.cs @@ -0,0 +1,181 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; + +namespace Test.WorkflowProviders; + +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class WorkflowProvider +{ + /// + /// The root executor for a declarative workflow. + /// + internal sealed class MyWorkflowRootExecutor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("my_workflow_Root", options, inputTransform) + where TInput : notnull + { + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + { + // Initialize variables + await context.QueueStateUpdateAsync("Count", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("LoopIndex", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("LoopValue", UnassignedValue.Instance, "Local").ConfigureAwait(false); + } + } + + /// + /// Loops over a list assignign the loop variable to "Local.LoopValue" variable. + /// + internal sealed class ForeachLoopExecutor(FormulaSession session) : ActionExecutor(id: "foreach_loop", session) + { + private int _index; + private object[] _values = []; + + public bool HasValue { get; private set; } + + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + this._index = 0; + object? evaluatedValue = await context.EvaluateValueAsync("""["a", "b", "c", "d", "e", "f"]""").ConfigureAwait(false); + + if (evaluatedValue == null) + { + this._values = []; + this.HasValue = false; + } + else + if (evaluatedValue is IEnumerable evaluatedList) + { + this._values = [.. evaluatedList]; + } + else + { + this._values = [evaluatedValue]; + } + + await this.ResetAsync(context, null, cancellationToken).ConfigureAwait(false); + + return default; + } + + public async ValueTask TakeNextAsync(IWorkflowContext context, object? _, CancellationToken cancellationToken) + { + if (this.HasValue = this._index < this._values.Length) + { + object value = this._values[this._index]; + + await context.QueueStateUpdateAsync(key: "LoopValue", value: value, scopeName: "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "LoopIndex", value: this._index, scopeName: "Local").ConfigureAwait(false); + + this._index++; + } + } + + public async ValueTask ResetAsync(IWorkflowContext context, object? _, CancellationToken cancellationToken) + { + await context.QueueStateUpdateAsync(key: "LoopValue", value: UnassignedValue.Instance, scopeName: "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "LoopIndex", value: UnassignedValue.Instance, scopeName: "Local").ConfigureAwait(false); + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.Count" variable. + /// + internal sealed class SetVariableInnerExecutor(FormulaSession session) : ActionExecutor(id: "set_variable_inner", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync("Local.Count + 1").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "Count", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class SendActivityInnerExecutor(FormulaSession session) : ActionExecutor(id: "send_activity_inner", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + x{Local.Count} - {Local.LoopIndex}:{Local.LoopValue} + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + MyWorkflowRootExecutor myWorkflowRoot = new(options, inputTransform); + DelegateExecutor myWorkflow = new(id: "my_workflow", myWorkflowRoot.Session); + ForeachLoopExecutor foreachLoop = new(myWorkflowRoot.Session); + DelegateExecutor foreachLoopNext = new(id: "foreach_loop_Next", myWorkflowRoot.Session, foreachLoop.TakeNextAsync); + DelegateExecutor foreachLoopPost = new(id: "foreach_loop_Post", myWorkflowRoot.Session); + DelegateExecutor foreachLoopStart = new(id: "foreach_loop_Start", myWorkflowRoot.Session); + SetVariableInnerExecutor setVariableInner = new(myWorkflowRoot.Session); + SendActivityInnerExecutor sendActivityInner = new(myWorkflowRoot.Session); + DelegateExecutor endAll = new(id: "end_all", myWorkflowRoot.Session); + DelegateExecutor foreachLoopEnd = new(id: "foreach_loop_End", myWorkflowRoot.Session, foreachLoop.ResetAsync); + + // Define the workflow builder + WorkflowBuilder builder = new(myWorkflowRoot); + + // Connect executors + builder.AddEdge(myWorkflowRoot, myWorkflow); + builder.AddEdge(myWorkflow, foreachLoop); + builder.AddEdge(foreachLoop, foreachLoopNext); + builder.AddEdge(foreachLoopNext, foreachLoopPost, (object? result) => !foreachLoop.HasValue); + builder.AddEdge(foreachLoopNext, foreachLoopStart, (object? result) => foreachLoop.HasValue); + builder.AddEdge(foreachLoopStart, setVariableInner); + builder.AddEdge(setVariableInner, sendActivityInner); + builder.AddEdge(foreachLoopPost, endAll); + builder.AddEdge(sendActivityInner, foreachLoopEnd); + builder.AddEdge(foreachLoopEnd, foreachLoopNext); + + // Build the workflow + return builder.Build(); + } +} \ No newline at end of file diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ParseValue.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ParseValue.cs new file mode 100644 index 0000000000..e975d390c1 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ParseValue.cs @@ -0,0 +1,106 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; + +namespace Test.WorkflowProviders; + +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class WorkflowProvider +{ + /// + /// The root executor for a declarative workflow. + /// + internal sealed class MyWorkflowRootExecutor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("my_workflow_Root", options, inputTransform) + where TInput : notnull + { + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + { + // Initialize variables + await context.QueueStateUpdateAsync("MySource", UnassignedValue.Instance, "Local").ConfigureAwait(false); + await context.QueueStateUpdateAsync("MyVar", UnassignedValue.Instance, "Local").ConfigureAwait(false); + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.MySource" variable. + /// + internal sealed class SetVarExecutor(FormulaSession session) : ActionExecutor(id: "set_var", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = "42"; + await context.QueueStateUpdateAsync(key: "MySource", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Parses a string or untyped value to the provided data type. When the input is a string, it will be treated as JSON. + /// + internal sealed class ParseVarExecutor(FormulaSession session) : ActionExecutor(id: "parse_var", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + VariableType targetType = typeof(decimal); + object? parsedValue = await context.ConvertValueAsync(targetType, key: "MySource", scopeName: "Local", cancellationToken).ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "MyVar", value: parsedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + MyWorkflowRootExecutor myWorkflowRoot = new(options, inputTransform); + DelegateExecutor myWorkflow = new(id: "my_workflow", myWorkflowRoot.Session); + SetVarExecutor setVar = new(myWorkflowRoot.Session); + ParseVarExecutor parseVar = new(myWorkflowRoot.Session); + + // Define the workflow builder + WorkflowBuilder builder = new(myWorkflowRoot); + + // Connect executors + builder.AddEdge(myWorkflowRoot, myWorkflow); + builder.AddEdge(myWorkflow, setVar); + builder.AddEdge(setVar, parseVar); + + // Build the workflow + return builder.Build(); + } +} \ No newline at end of file diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ParseValue.yaml b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ParseValue.yaml index 89edf9a0bd..e3dceaa4ce 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ParseValue.yaml +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ParseValue.yaml @@ -5,8 +5,13 @@ trigger: id: my_workflow actions: + - kind: SetVariable + id: set_var + variable: Local.MySource + value: "42" + - kind: ParseValue id: parse_var variable: Local.MyVar - value: "42" + value: =Local.MySource valueType: Number diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ResetVariable.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ResetVariable.cs new file mode 100644 index 0000000000..e71641023a --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ResetVariable.cs @@ -0,0 +1,103 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; + +namespace Test.WorkflowProviders; + +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class WorkflowProvider +{ + /// + /// The root executor for a declarative workflow. + /// + internal sealed class MyWorkflowRootExecutor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("my_workflow_Root", options, inputTransform) + where TInput : notnull + { + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + { + // Initialize variables + await context.QueueStateUpdateAsync("MyVar", UnassignedValue.Instance, "Local").ConfigureAwait(false); + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.MyVar" variable. + /// + internal sealed class SetVarExecutor(FormulaSession session) : ActionExecutor(id: "set_var", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = 42; + await context.QueueStateUpdateAsync(key: "MyVar", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Resets the value of the "Local.MyVar" variable, potentially causing re-evaluation + /// of the default value, question or action that provides the value to this variable. + /// + internal sealed class ClearVarExecutor(FormulaSession session) : ActionExecutor(id: "clear_var", session) + { + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + await context.QueueStateUpdateAsync(key: "MyVar", value: UnassignedValue.Instance, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + MyWorkflowRootExecutor myWorkflowRoot = new(options, inputTransform); + DelegateExecutor myWorkflow = new(id: "my_workflow", myWorkflowRoot.Session); + SetVarExecutor setVar = new(myWorkflowRoot.Session); + ClearVarExecutor clearVar = new(myWorkflowRoot.Session); + + // Define the workflow builder + WorkflowBuilder builder = new(myWorkflowRoot); + + // Connect executors + builder.AddEdge(myWorkflowRoot, myWorkflow); + builder.AddEdge(myWorkflow, setVar); + builder.AddEdge(setVar, clearVar); + + // Build the workflow + return builder.Build(); + } +} \ No newline at end of file diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/SendActivity.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/SendActivity.cs new file mode 100644 index 0000000000..baf83d79e6 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/SendActivity.cs @@ -0,0 +1,110 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; + +namespace Test.WorkflowProviders; + +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class WorkflowProvider +{ + /// + /// The root executor for a declarative workflow. + /// + internal sealed class MyWorkflowRootExecutor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("my_workflow_Root", options, inputTransform) + where TInput : notnull + { + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + { + // Initialize variables + await context.QueueStateUpdateAsync("TestValue", UnassignedValue.Instance, "Local").ConfigureAwait(false); + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.TestValue" variable. + /// + internal sealed class SetInputExecutor(FormulaSession session) : ActionExecutor(id: "set_input", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.ReadStateAsync(key: "LastMessageText", scopeName: "System").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "TestValue", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + /// + /// Formats a message template and sends an activity event. + /// + internal sealed class ActivityInputExecutor(FormulaSession session) : ActionExecutor(id: "activity_input", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string activityText = + await context.FormatTemplateAsync( + """ + Input: "{Local.TestValue}" + """ + ); + AgentRunResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); + await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + + return default; + } + } + + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + MyWorkflowRootExecutor myWorkflowRoot = new(options, inputTransform); + DelegateExecutor myWorkflow = new(id: "my_workflow", myWorkflowRoot.Session); + SetInputExecutor setInput = new(myWorkflowRoot.Session); + ActivityInputExecutor activityInput = new(myWorkflowRoot.Session); + + // Define the workflow builder + WorkflowBuilder builder = new(myWorkflowRoot); + + // Connect executors + builder.AddEdge(myWorkflowRoot, myWorkflow); + builder.AddEdge(myWorkflow, setInput); + builder.AddEdge(setInput, activityInput); + + // Build the workflow + return builder.Build(); + } +} \ No newline at end of file diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/SetTextVariable.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/SetTextVariable.cs new file mode 100644 index 0000000000..36f4e7922d --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/SetTextVariable.cs @@ -0,0 +1,90 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; + +namespace Test.WorkflowProviders; + +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class WorkflowProvider +{ + /// + /// The root executor for a declarative workflow. + /// + internal sealed class MyWorkflowRootExecutor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("my_workflow_Root", options, inputTransform) + where TInput : notnull + { + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + { + // Initialize variables + await context.QueueStateUpdateAsync("TestVar", UnassignedValue.Instance, "Local").ConfigureAwait(false); + } + } + + /// + /// Assigns an evaluated message template to the "Local.TestVar" variable. + /// + internal sealed class SetTextExecutor(FormulaSession session) : ActionExecutor(id: "set_text", session) + { + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + string textValue = + await context.FormatTemplateAsync( + """ + Test content + """); + await context.QueueStateUpdateAsync(key: "TestVar", value: textValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + MyWorkflowRootExecutor myWorkflowRoot = new(options, inputTransform); + DelegateExecutor myWorkflow = new(id: "my_workflow", myWorkflowRoot.Session); + SetTextExecutor setText = new(myWorkflowRoot.Session); + + // Define the workflow builder + WorkflowBuilder builder = new(myWorkflowRoot); + + // Connect executors + builder.AddEdge(myWorkflowRoot, myWorkflow); + builder.AddEdge(myWorkflow, setText); + + // Build the workflow + return builder.Build(); + } +} \ No newline at end of file diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/SetVariable.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/SetVariable.cs new file mode 100644 index 0000000000..d05f4d1d94 --- /dev/null +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/SetVariable.cs @@ -0,0 +1,87 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// ------------------------------------------------------------------------------ + +#nullable enable +#pragma warning disable IDE0005 // Extra using directive is ok. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Agents.AI; +using Microsoft.Agents.AI.Workflows; +using Microsoft.Agents.AI.Workflows.Declarative; +using Microsoft.Agents.AI.Workflows.Declarative.Kit; +using Microsoft.Extensions.AI; + +namespace Test.WorkflowProviders; + +/// +/// This class provides a factory method to create a instance. +/// +/// +/// The workflow defined here was generated from a declarative workflow definition. +/// Declarative workflows utilize Power FX for defining conditions and expressions. +/// To learn more about Power FX, see: +/// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio +/// +public static class WorkflowProvider +{ + /// + /// The root executor for a declarative workflow. + /// + internal sealed class MyWorkflowRootExecutor( + DeclarativeWorkflowOptions options, + Func inputTransform) : + RootExecutor("my_workflow_Root", options, inputTransform) + where TInput : notnull + { + protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) + { + // Initialize variables + await context.QueueStateUpdateAsync("TestVar", UnassignedValue.Instance, "Local").ConfigureAwait(false); + } + } + + /// + /// Assigns an evaluated expression, other variable, or literal value to the "Local.TestVar" variable. + /// + internal sealed class SetVarExecutor(FormulaSession session) : ActionExecutor(id: "set_var", session) + { + // + protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) + { + object? evaluatedValue = await context.EvaluateValueAsync("3").ConfigureAwait(false); + await context.QueueStateUpdateAsync(key: "TestVar", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); + + return default; + } + } + + public static Workflow CreateWorkflow( + DeclarativeWorkflowOptions options, + Func? inputTransform = null) + where TInput : notnull + { + // Create root executor to initialize the workflow. + inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); + MyWorkflowRootExecutor myWorkflowRoot = new(options, inputTransform); + DelegateExecutor myWorkflow = new(id: "my_workflow", myWorkflowRoot.Session); + SetVarExecutor setVar = new(myWorkflowRoot.Session); + + // Define the workflow builder + WorkflowBuilder builder = new(myWorkflowRoot); + + // Connect executors + builder.AddEdge(myWorkflowRoot, myWorkflow); + builder.AddEdge(myWorkflow, setVar); + + // Build the workflow + return builder.Build(); + } +} \ No newline at end of file diff --git a/workflow-samples/Marketing.yaml b/workflow-samples/Marketing.yaml index 3a9c9c26a1..248508825d 100644 --- a/workflow-samples/Marketing.yaml +++ b/workflow-samples/Marketing.yaml @@ -19,7 +19,7 @@ trigger: conversationId: =System.ConversationId content: - type: Text - value: {System.LastMessage.Text} + value: {System.LastMessage.Text} - kind: InvokeAzureAgent id: invoke_analyst