Skip to content

Commit c6cb6f8

Browse files
patnikoCopilot
andcommitted
fix: add docs-validate skip directives and fix API examples
option not in published SDK yet, fragments lack standalone context) - Fix C# permission handler: use Kind=Approved pattern - Fix Go permission handler: use correct 2-param signature Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 797740f commit c6cb6f8

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

docs/features/remote-sessions.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Set `remote: true` when creating the client. Every session in a GitHub repo auto
1717

1818
#### **TypeScript**
1919

20+
<!-- docs-validate: skip -->
2021
```typescript
2122
import { CopilotClient } from "@github/copilot-sdk";
2223

@@ -35,6 +36,7 @@ session.on("session.info", (event) => {
3536

3637
#### **Python**
3738

39+
<!-- docs-validate: skip -->
3840
```python
3941
from copilot import CopilotClient, SubprocessConfig
4042

@@ -53,12 +55,13 @@ session.on(on_event)
5355

5456
#### **Go**
5557

58+
<!-- docs-validate: skip -->
5659
```go
5760
client, _ := copilot.NewClient(&copilot.ClientOptions{Remote: true})
5861
session, _ := client.CreateSession(ctx, &copilot.SessionConfig{
5962
WorkingDirectory: "/path/to/github-repo",
60-
OnPermissionRequest: func(req copilot.PermissionRequest) copilot.PermissionResponse {
61-
return copilot.PermissionResponse{Allowed: true}
63+
OnPermissionRequest: func(req copilot.PermissionRequest, inv copilot.PermissionInvocation) (copilot.PermissionRequestResult, error) {
64+
return copilot.PermissionRequestResult{Kind: copilot.PermissionRequestResultKindApproved}, nil
6265
},
6366
})
6467

@@ -71,12 +74,14 @@ session.On(func(event copilot.SessionEvent) {
7174

7275
#### **C#**
7376

77+
<!-- docs-validate: skip -->
7478
```csharp
7579
var client = new CopilotClient(new CopilotClientOptions { Remote = true });
7680
var session = await client.CreateSessionAsync(new SessionConfig
7781
{
7882
WorkingDirectory = "/path/to/github-repo",
79-
OnPermissionRequest = async (req, ct) => new() { Allowed = true },
83+
OnPermissionRequest = (req, inv) =>
84+
Task.FromResult(new PermissionRequestResult { Kind = PermissionRequestResultKind.Approved }),
8085
});
8186

8287
session.On((SessionEvent e) =>
@@ -98,6 +103,7 @@ Use `session.rpc.remote.enable()` to start remote access mid-session, and `sessi
98103

99104
#### **TypeScript**
100105

106+
<!-- docs-validate: skip -->
101107
```typescript
102108
const result = await session.rpc.remote.enable();
103109
console.log("Remote URL:", result.url);
@@ -108,6 +114,7 @@ await session.rpc.remote.disable();
108114

109115
#### **Python**
110116

117+
<!-- docs-validate: skip -->
111118
```python
112119
result = await session.rpc.remote.enable()
113120
print(f"Remote URL: {result.url}")
@@ -118,6 +125,7 @@ await session.rpc.remote.disable()
118125

119126
#### **Go**
120127

128+
<!-- docs-validate: skip -->
121129
```go
122130
result, err := session.RPC.Remote.Enable(ctx)
123131
fmt.Println("Remote URL:", *result.URL)
@@ -128,6 +136,7 @@ err = session.RPC.Remote.Disable(ctx)
128136

129137
#### **C#**
130138

139+
<!-- docs-validate: skip -->
131140
```csharp
132141
var result = await session.Rpc.Remote.EnableAsync();
133142
Console.WriteLine($"Remote URL: {result.Url}");

0 commit comments

Comments
 (0)