Skip to content

Commit 3a239dc

Browse files
stephentoubCopilot
andcommitted
Add experimental API annotations from schema stability markers
Read the 'stability' field from api.schema.json and propagate it to generated code in all four SDK languages. APIs marked as experimental in the schema (fleet, agent, compaction) now carry appropriate annotations in the generated output. Changes to codegen scripts (scripts/codegen/): - utils.ts: Add stability field to RpcMethod; add isNodeFullyExperimental helper - csharp.ts: Emit [Experimental(Diagnostics.Experimental)] on types and API classes - typescript.ts: Emit /** @experimental */ JSDoc on types and groups - python.ts: Emit # Experimental comments on types and API classes, docstrings on methods - go.ts: Emit // Experimental: comments on types and API structs Design decisions: - When all methods in a group are experimental, the group/class is annotated and individual methods are not (annotation is inherited) - Data types (request/result) for experimental methods are also annotated - C# uses a Diagnostics.Experimental const ("GHCP001") referenced by all attributes - SDK csproj suppresses GHCP001 internally; consumers still see warnings Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 485ea5e commit 3a239dc

11 files changed

Lines changed: 643 additions & 586 deletions

File tree

dotnet/src/Generated/Rpc.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@
55
// AUTO-GENERATED FILE - DO NOT EDIT
66
// Generated from: api.schema.json
77

8+
using System.Diagnostics.CodeAnalysis;
89
using System.Text.Json;
910
using System.Text.Json.Serialization;
1011
using StreamJsonRpc;
1112

1213
namespace GitHub.Copilot.SDK.Rpc;
1314

15+
/// <summary>Diagnostic IDs for the Copilot SDK.</summary>
16+
internal static class Diagnostics
17+
{
18+
/// <summary>Indicates an experimental API that may change or be removed.</summary>
19+
internal const string Experimental = "GHCP001";
20+
}
21+
1422
/// <summary>RPC data type for Ping operations.</summary>
1523
public class PingResult
1624
{
@@ -427,6 +435,7 @@ internal class SessionWorkspaceCreateFileRequest
427435
}
428436

429437
/// <summary>RPC data type for SessionFleetStart operations.</summary>
438+
[Experimental(Diagnostics.Experimental)]
430439
public class SessionFleetStartResult
431440
{
432441
/// <summary>Whether fleet mode was successfully activated.</summary>
@@ -435,6 +444,7 @@ public class SessionFleetStartResult
435444
}
436445

437446
/// <summary>RPC data type for SessionFleetStart operations.</summary>
447+
[Experimental(Diagnostics.Experimental)]
438448
internal class SessionFleetStartRequest
439449
{
440450
/// <summary>Target session identifier.</summary>
@@ -463,6 +473,7 @@ public class Agent
463473
}
464474

465475
/// <summary>RPC data type for SessionAgentList operations.</summary>
476+
[Experimental(Diagnostics.Experimental)]
466477
public class SessionAgentListResult
467478
{
468479
/// <summary>Available custom agents.</summary>
@@ -471,6 +482,7 @@ public class SessionAgentListResult
471482
}
472483

473484
/// <summary>RPC data type for SessionAgentList operations.</summary>
485+
[Experimental(Diagnostics.Experimental)]
474486
internal class SessionAgentListRequest
475487
{
476488
/// <summary>Target session identifier.</summary>
@@ -495,6 +507,7 @@ public class SessionAgentGetCurrentResultAgent
495507
}
496508

497509
/// <summary>RPC data type for SessionAgentGetCurrent operations.</summary>
510+
[Experimental(Diagnostics.Experimental)]
498511
public class SessionAgentGetCurrentResult
499512
{
500513
/// <summary>Currently selected custom agent, or null if using the default agent.</summary>
@@ -503,6 +516,7 @@ public class SessionAgentGetCurrentResult
503516
}
504517

505518
/// <summary>RPC data type for SessionAgentGetCurrent operations.</summary>
519+
[Experimental(Diagnostics.Experimental)]
506520
internal class SessionAgentGetCurrentRequest
507521
{
508522
/// <summary>Target session identifier.</summary>
@@ -527,6 +541,7 @@ public class SessionAgentSelectResultAgent
527541
}
528542

529543
/// <summary>RPC data type for SessionAgentSelect operations.</summary>
544+
[Experimental(Diagnostics.Experimental)]
530545
public class SessionAgentSelectResult
531546
{
532547
/// <summary>The newly selected custom agent.</summary>
@@ -535,6 +550,7 @@ public class SessionAgentSelectResult
535550
}
536551

537552
/// <summary>RPC data type for SessionAgentSelect operations.</summary>
553+
[Experimental(Diagnostics.Experimental)]
538554
internal class SessionAgentSelectRequest
539555
{
540556
/// <summary>Target session identifier.</summary>
@@ -547,11 +563,13 @@ internal class SessionAgentSelectRequest
547563
}
548564

549565
/// <summary>RPC data type for SessionAgentDeselect operations.</summary>
566+
[Experimental(Diagnostics.Experimental)]
550567
public class SessionAgentDeselectResult
551568
{
552569
}
553570

554571
/// <summary>RPC data type for SessionAgentDeselect operations.</summary>
572+
[Experimental(Diagnostics.Experimental)]
555573
internal class SessionAgentDeselectRequest
556574
{
557575
/// <summary>Target session identifier.</summary>
@@ -560,6 +578,7 @@ internal class SessionAgentDeselectRequest
560578
}
561579

562580
/// <summary>RPC data type for SessionCompactionCompact operations.</summary>
581+
[Experimental(Diagnostics.Experimental)]
563582
public class SessionCompactionCompactResult
564583
{
565584
/// <summary>Whether compaction completed successfully.</summary>
@@ -576,6 +595,7 @@ public class SessionCompactionCompactResult
576595
}
577596

578597
/// <summary>RPC data type for SessionCompactionCompact operations.</summary>
598+
[Experimental(Diagnostics.Experimental)]
579599
internal class SessionCompactionCompactRequest
580600
{
581601
/// <summary>Target session identifier.</summary>
@@ -1000,6 +1020,7 @@ public async Task<SessionWorkspaceCreateFileResult> CreateFileAsync(string path,
10001020
}
10011021

10021022
/// <summary>Provides session-scoped Fleet APIs.</summary>
1023+
[Experimental(Diagnostics.Experimental)]
10031024
public class FleetApi
10041025
{
10051026
private readonly JsonRpc _rpc;
@@ -1020,6 +1041,7 @@ public async Task<SessionFleetStartResult> StartAsync(string? prompt = null, Can
10201041
}
10211042

10221043
/// <summary>Provides session-scoped Agent APIs.</summary>
1044+
[Experimental(Diagnostics.Experimental)]
10231045
public class AgentApi
10241046
{
10251047
private readonly JsonRpc _rpc;
@@ -1061,6 +1083,7 @@ public async Task<SessionAgentDeselectResult> DeselectAsync(CancellationToken ca
10611083
}
10621084

10631085
/// <summary>Provides session-scoped Compaction APIs.</summary>
1086+
[Experimental(Diagnostics.Experimental)]
10641087
public class CompactionApi
10651088
{
10661089
private readonly JsonRpc _rpc;

dotnet/src/GitHub.Copilot.SDK.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
<EmbedUntrackedSources>true</EmbedUntrackedSources>
2121
</PropertyGroup>
2222

23+
<PropertyGroup>
24+
<NoWarn>$(NoWarn);GHCP001</NoWarn>
25+
</PropertyGroup>
26+
2327
<PropertyGroup Condition="'$(CI)' == 'true' or '$(TF_BUILD)' == 'true'">
2428
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
2529
</PropertyGroup>

dotnet/test/GitHub.Copilot.SDK.Test.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<IsPackable>false</IsPackable>
5+
<NoWarn>$(NoWarn);GHCP001</NoWarn>
56
</PropertyGroup>
67

78
<PropertyGroup>

0 commit comments

Comments
 (0)