Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Better type info for result
Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
  • Loading branch information
SteveSandersonMS and Copilot committed Feb 24, 2026
commit 4918984f0b14b5b0de172f05a91fe5dbcd8007d8
18 changes: 17 additions & 1 deletion dotnet/src/Generated/Rpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,26 @@ internal class SessionAgentListRequest
public string SessionId { get; set; } = string.Empty;
}

public class SessionAgentGetCurrentResultAgent
{
/// <summary>Unique identifier of the custom agent</summary>
[JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;

/// <summary>Human-readable display name</summary>
[JsonPropertyName("displayName")]
public string DisplayName { get; set; } = string.Empty;

/// <summary>Description of the agent's purpose</summary>
[JsonPropertyName("description")]
public string Description { get; set; } = string.Empty;
}

public class SessionAgentGetCurrentResult
{
/// <summary>Currently selected custom agent, or null if using the default agent</summary>
[JsonPropertyName("agent")]
public object? Agent { get; set; }
public SessionAgentGetCurrentResultAgent? Agent { get; set; }
}

internal class SessionAgentGetCurrentRequest
Expand Down Expand Up @@ -794,6 +809,7 @@ public async Task<SessionCompactionCompactResult> CompactAsync(CancellationToken
[JsonSerializable(typeof(SessionAgentDeselectResult))]
[JsonSerializable(typeof(SessionAgentGetCurrentRequest))]
[JsonSerializable(typeof(SessionAgentGetCurrentResult))]
[JsonSerializable(typeof(SessionAgentGetCurrentResultAgent))]
[JsonSerializable(typeof(SessionAgentListRequest))]
[JsonSerializable(typeof(SessionAgentListResult))]
[JsonSerializable(typeof(SessionAgentSelectRequest))]
Expand Down
1 change: 1 addition & 0 deletions dotnet/test/AgentAndCompactRpcTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public async Task Should_Select_And_Get_Current_Agent()
// Verify getCurrent returns the selected agent
var currentResult = await session.Rpc.Agent.GetCurrentAsync();
Assert.NotNull(currentResult.Agent);
Assert.Equal("test-agent", currentResult.Agent.Name);
}

[Fact]
Expand Down
8 changes: 8 additions & 0 deletions scripts/codegen/csharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,14 @@ function singularPascal(s: string): string {
}

function resolveRpcType(schema: JSONSchema7, isRequired: boolean, parentClassName: string, propName: string, classes: string[]): string {
// Handle anyOf: [T, null] → T? (nullable typed property)
if (schema.anyOf) {
const hasNull = schema.anyOf.some((s) => typeof s === "object" && (s as JSONSchema7).type === "null");
const nonNull = schema.anyOf.filter((s) => typeof s === "object" && (s as JSONSchema7).type !== "null");
if (nonNull.length === 1) {
return resolveRpcType(nonNull[0] as JSONSchema7, isRequired && !hasNull, parentClassName, propName, classes);
}
}
// Handle enums (string unions like "interactive" | "plan" | "autopilot")
if (schema.enum && Array.isArray(schema.enum)) {
const enumName = getOrCreateEnum(parentClassName, propName, schema.enum as string[], rpcEnumOutput);
Expand Down