Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions .github/workflows/rust-sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
workspaces: "rust"
prefix-key: v1-rust-no-bin
cache-bin: false

- name: cargo fmt --check (nightly)
if: runner.os == 'Linux'
Expand Down Expand Up @@ -135,6 +137,8 @@ jobs:
with:
workspaces: "rust"
key: bundled-cli
prefix-key: v1-rust-no-bin
cache-bin: false

- name: Read pinned @github/copilot CLI version
id: cli-version
Expand Down
464 changes: 459 additions & 5 deletions dotnet/src/Generated/Rpc.cs

Large diffs are not rendered by default.

77 changes: 77 additions & 0 deletions dotnet/src/Generated/SessionEvents.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions dotnet/test/Unit/SerializationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,21 @@ public void QueuedCommandResult_SerializesHandledAsBoolean_WithSdkOptions()
Assert.Null(deserialized.StopProcessingQueue);
}

[Fact]
public void PermissionDecision_SerializesBaseDiscriminator_WithSdkOptions()
{
var options = GetSerializerOptions();
var original = new PermissionDecision
{
Kind = PermissionRequestResultKind.Approved.Value
};

var json = JsonSerializer.Serialize(original, options);
using var document = JsonDocument.Parse(json);

Assert.Equal("approve-once", document.RootElement.GetProperty("kind").GetString());
}

private static JsonSerializerOptions GetSerializerOptions()
{
var prop = typeof(CopilotClient)
Expand Down
55 changes: 55 additions & 0 deletions go/rpc/generated_rpc_union_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package rpc

import (
"encoding/json"
"io"
"testing"

"github.com/github/copilot-sdk/go/internal/jsonrpc2"
)

func TestExternalToolResultJSONUnion(t *testing.T) {
Expand Down Expand Up @@ -130,6 +133,58 @@ func TestMcpServerConfigJSONUnion(t *testing.T) {
}
}

func TestCommandsInvokeUnmarshalsSlashCommandInvocationResult(t *testing.T) {
clientToServerReader, clientToServerWriter := io.Pipe()
serverToClientReader, serverToClientWriter := io.Pipe()

client := jsonrpc2.NewClient(clientToServerWriter, serverToClientReader)
server := jsonrpc2.NewClient(serverToClientWriter, clientToServerReader)
server.SetRequestHandler("session.commands.invoke", func(params json.RawMessage) (json.RawMessage, *jsonrpc2.Error) {
var request struct {
Input string `json:"input"`
Name string `json:"name"`
SessionID string `json:"sessionId"`
}
if err := json.Unmarshal(params, &request); err != nil {
return nil, &jsonrpc2.Error{Code: -32602, Message: err.Error()}
}
if request.SessionID != "session-1" || request.Name != "help" || request.Input != "details" {
return nil, &jsonrpc2.Error{Code: -32602, Message: "unexpected invoke request"}
}
return json.RawMessage(`{"kind":"text","text":"hello","markdown":true}`), nil
})

client.Start()
server.Start()
t.Cleanup(func() {
client.Stop()
server.Stop()
_ = clientToServerWriter.Close()
_ = clientToServerReader.Close()
_ = serverToClientWriter.Close()
_ = serverToClientReader.Close()
})

input := "details"
result, err := NewSessionRpc(client, "session-1").Commands.Invoke(t.Context(), &CommandsInvokeRequest{
Input: &input,
Name: "help",
})
if err != nil {
t.Fatalf("invoke command: %v", err)
}
textResult, ok := result.(*SlashCommandTextResult)
if !ok {
t.Fatalf("invoke result = %T, want *SlashCommandTextResult", result)
}
if textResult.Text != "hello" {
t.Fatalf("invoke result text = %q, want hello", textResult.Text)
}
if textResult.Markdown == nil || !*textResult.Markdown {
t.Fatalf("invoke result markdown = %v, want true", textResult.Markdown)
}
}

func TestUIElicitationFieldValueJSONUnion(t *testing.T) {
raw, err := json.Marshal(UIElicitationBooleanValue(true))
if err != nil {
Expand Down
Loading
Loading