Skip to content

Commit 56141ec

Browse files
patnikoCopilot
andcommitted
Merge branch 'main' into copilot/review-code-changes
Resolve merge conflicts in 4 files: - dotnet/src/Client.cs: Keep MergeExcludedTools with main's non-nullable config access - go/client.go: Keep mergeExcludedTools with main's direct config access (no nil guard) - go/client_test.go: Keep both MergeExcludedTools tests and permission handler tests - python/test_client.py: Merge imports (both define_tool and PermissionHandler) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2 parents e277552 + 388f2f3 commit 56141ec

130 files changed

Lines changed: 3737 additions & 1017 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/auth/byok.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ BYOK allows you to use the Copilot SDK with your own API keys from model provide
1010
| Azure OpenAI / Azure AI Foundry | `"azure"` | Azure-hosted models |
1111
| Anthropic | `"anthropic"` | Claude models |
1212
| Ollama | `"openai"` | Local models via OpenAI-compatible API |
13+
| Microsoft Foundry Local | `"openai"` | Run AI models locally on your device via OpenAI-compatible API |
1314
| Other OpenAI-compatible | `"openai"` | vLLM, LiteLLM, etc. |
1415

1516
## Quick Start: Azure AI Foundry
@@ -250,6 +251,37 @@ provider: {
250251
}
251252
```
252253

254+
### Microsoft Foundry Local
255+
256+
[Microsoft Foundry Local](https://foundrylocal.ai) lets you run AI models locally on your own device with an OpenAI-compatible API. Install it via the Foundry Local CLI, then point the SDK at your local endpoint:
257+
258+
```typescript
259+
provider: {
260+
type: "openai",
261+
baseUrl: "http://localhost:<PORT>/v1",
262+
// No apiKey needed for local Foundry Local
263+
}
264+
```
265+
266+
> **Note:** Foundry Local starts on a **dynamic port** — the port is not fixed. Use `foundry service status` to confirm the port the service is currently listening on, then use that port in your `baseUrl`.
267+
268+
To get started with Foundry Local:
269+
270+
```bash
271+
# Windows: Install Foundry Local CLI (requires winget)
272+
winget install Microsoft.FoundryLocal
273+
274+
# macOS / Linux: see https://foundrylocal.ai for installation instructions
275+
# List available models
276+
foundry model list
277+
278+
# Run a model (starts the local server automatically)
279+
foundry model run phi-4-mini
280+
281+
# Check the port the service is running on
282+
foundry service status
283+
```
284+
253285
### Anthropic
254286

255287
```typescript
@@ -305,6 +337,7 @@ Some Copilot features may behave differently with BYOK:
305337
|----------|-------------|
306338
| Azure AI Foundry | No Entra ID auth; must use API keys |
307339
| Ollama | No API key; local only; model support varies |
340+
| [Microsoft Foundry Local](https://foundrylocal.ai) | Local only; model availability depends on device hardware; no API key required |
308341
| OpenAI | Subject to OpenAI rate limits and quotas |
309342

310343
## Troubleshooting
@@ -368,6 +401,21 @@ curl http://localhost:11434/v1/models
368401
ollama serve
369402
```
370403

404+
### Connection Refused (Foundry Local)
405+
406+
Foundry Local uses a dynamic port that may change between restarts. Confirm the active port:
407+
408+
```bash
409+
# Check the service status and port
410+
foundry service status
411+
```
412+
413+
Update your `baseUrl` to match the port shown in the output. If the service is not running, start a model to launch it:
414+
415+
```bash
416+
foundry model run phi-4-mini
417+
```
418+
371419
### Authentication Failed
372420

373421
1. Verify your API key is correct and not expired

docs/getting-started.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,14 +1193,14 @@ Once the CLI is running in server mode, configure your SDK client to connect to
11931193
<summary><strong>Node.js / TypeScript</strong></summary>
11941194

11951195
```typescript
1196-
import { CopilotClient } from "@github/copilot-sdk";
1196+
import { CopilotClient, approveAll } from "@github/copilot-sdk";
11971197

11981198
const client = new CopilotClient({
11991199
cliUrl: "localhost:4321"
12001200
});
12011201

12021202
// Use the client normally
1203-
const session = await client.createSession();
1203+
const session = await client.createSession({ onPermissionRequest: approveAll });
12041204
// ...
12051205
```
12061206

@@ -1210,15 +1210,15 @@ const session = await client.createSession();
12101210
<summary><strong>Python</strong></summary>
12111211

12121212
```python
1213-
from copilot import CopilotClient
1213+
from copilot import CopilotClient, PermissionHandler
12141214

12151215
client = CopilotClient({
12161216
"cli_url": "localhost:4321"
12171217
})
12181218
await client.start()
12191219

12201220
# Use the client normally
1221-
session = await client.create_session()
1221+
session = await client.create_session({"on_permission_request": PermissionHandler.approve_all})
12221222
# ...
12231223
```
12241224

@@ -1241,7 +1241,9 @@ if err := client.Start(ctx); err != nil {
12411241
defer client.Stop()
12421242

12431243
// Use the client normally
1244-
session, err := client.CreateSession(ctx, nil)
1244+
session, err := client.CreateSession(ctx, &copilot.SessionConfig{
1245+
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
1246+
})
12451247
// ...
12461248
```
12471249

@@ -1260,7 +1262,10 @@ using var client = new CopilotClient(new CopilotClientOptions
12601262
});
12611263

12621264
// Use the client normally
1263-
await using var session = await client.CreateSessionAsync();
1265+
await using var session = await client.CreateSessionAsync(new()
1266+
{
1267+
OnPermissionRequest = PermissionHandler.ApproveAll
1268+
});
12641269
// ...
12651270
```
12661271

docs/guides/skills.md

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
# Custom Skills
22

3-
Skills are reusable collections of prompts, tools, and configuration that extend Copilot's capabilities. Load skills from directories to give Copilot specialized abilities for specific domains or workflows.
3+
Skills are reusable prompt modules that extend Copilot's capabilities. Load skills from directories to give Copilot specialized abilities for specific domains or workflows.
44

55
## Overview
66

7-
A skill is a directory containing:
8-
- **Prompt files** - Instructions that guide Copilot's behavior
9-
- **Tool definitions** - Custom tools the skill provides
10-
- **Configuration** - Metadata about the skill
7+
A skill is a named directory containing a `SKILL.md` file — a markdown document that provides instructions to Copilot. When loaded, the skill's content is injected into the session context.
118

129
Skills allow you to:
1310
- Package domain expertise into reusable modules
@@ -31,8 +28,8 @@ const session = await client.createSession({
3128
skillDirectories: [
3229
"./skills/code-review",
3330
"./skills/documentation",
34-
"~/.copilot/skills", // User-level skills
3531
],
32+
onPermissionRequest: async () => ({ kind: "approved" }),
3633
});
3734

3835
// Copilot now has access to skills in those directories
@@ -56,8 +53,8 @@ async def main():
5653
"skill_directories": [
5754
"./skills/code-review",
5855
"./skills/documentation",
59-
"~/.copilot/skills", # User-level skills
6056
],
57+
"on_permission_request": lambda req: {"kind": "approved"},
6158
})
6259

6360
# Copilot now has access to skills in those directories
@@ -93,7 +90,9 @@ func main() {
9390
SkillDirectories: []string{
9491
"./skills/code-review",
9592
"./skills/documentation",
96-
"~/.copilot/skills", // User-level skills
93+
},
94+
OnPermissionRequest: func(req copilot.PermissionRequest, inv copilot.PermissionInvocation) (copilot.PermissionRequestResult, error) {
95+
return copilot.PermissionRequestResult{Kind: "approved"}, nil
9796
},
9897
})
9998
if err != nil {
@@ -126,8 +125,9 @@ await using var session = await client.CreateSessionAsync(new SessionConfig
126125
{
127126
"./skills/code-review",
128127
"./skills/documentation",
129-
"~/.copilot/skills", // User-level skills
130128
},
129+
OnPermissionRequest = (req, inv) =>
130+
Task.FromResult(new PermissionRequestResult { Kind = "approved" }),
131131
});
132132

133133
// Copilot now has access to skills in those directories
@@ -196,41 +196,28 @@ var session = await client.CreateSessionAsync(new SessionConfig
196196

197197
## Skill Directory Structure
198198

199-
A typical skill directory contains:
199+
Each skill is a named subdirectory containing a `SKILL.md` file:
200200

201201
```
202202
skills/
203-
└── code-review/
204-
├── skill.json # Skill metadata and configuration
205-
├── prompts/
206-
│ ├── system.md # System prompt additions
207-
│ └── examples.md # Few-shot examples
208-
└── tools/
209-
└── lint.json # Tool definitions
203+
├── code-review/
204+
│ └── SKILL.md
205+
└── documentation/
206+
└── SKILL.md
210207
```
211208

212-
### skill.json
213-
214-
The skill manifest file:
209+
The `skillDirectories` option points to the parent directory (e.g., `./skills`). The CLI discovers all `SKILL.md` files in immediate subdirectories.
215210

216-
```json
217-
{
218-
"name": "code-review",
219-
"displayName": "Code Review Assistant",
220-
"description": "Specialized code review capabilities",
221-
"version": "1.0.0",
222-
"author": "Your Team",
223-
"prompts": ["prompts/system.md"],
224-
"tools": ["tools/lint.json"]
225-
}
226-
```
211+
### SKILL.md Format
227212

228-
### Prompt Files
229-
230-
Markdown files that provide context to Copilot:
213+
A `SKILL.md` file is a markdown document with optional YAML frontmatter:
231214

232215
```markdown
233-
<!-- prompts/system.md -->
216+
---
217+
name: code-review
218+
description: Specialized code review capabilities
219+
---
220+
234221
# Code Review Guidelines
235222

236223
When reviewing code, always check for:
@@ -243,6 +230,12 @@ When reviewing code, always check for:
243230
Provide specific line-number references and suggested fixes.
244231
```
245232

233+
The frontmatter fields:
234+
- **`name`** — The skill's identifier (used with `disabledSkills` to selectively disable it). If omitted, the directory name is used.
235+
- **`description`** — A short description of what the skill does.
236+
237+
The markdown body contains the instructions that are injected into the session context when the skill is loaded.
238+
246239
## Configuration Options
247240

248241
### SessionConfig Skill Fields
@@ -262,7 +255,7 @@ Provide specific line-number references and suggested fixes.
262255

263256
1. **Organize by domain** - Group related skills together (e.g., `skills/security/`, `skills/testing/`)
264257

265-
2. **Version your skills** - Include version numbers in `skill.json` for compatibility tracking
258+
2. **Use frontmatter** - Include `name` and `description` in YAML frontmatter for clarity
266259

267260
3. **Document dependencies** - Note any tools or MCP servers a skill requires
268261

@@ -284,6 +277,7 @@ const session = await client.createSession({
284277
description: "Security-focused code reviewer",
285278
prompt: "Focus on OWASP Top 10 vulnerabilities",
286279
}],
280+
onPermissionRequest: async () => ({ kind: "approved" }),
287281
});
288282
```
289283

@@ -302,23 +296,24 @@ const session = await client.createSession({
302296
tools: ["*"],
303297
},
304298
},
299+
onPermissionRequest: async () => ({ kind: "approved" }),
305300
});
306301
```
307302

308303
## Troubleshooting
309304

310305
### Skills Not Loading
311306

312-
1. **Check path exists** - Verify the directory path is correct
307+
1. **Check path exists** - Verify the skill directory path is correct and contains subdirectories with `SKILL.md` files
313308
2. **Check permissions** - Ensure the SDK can read the directory
314-
3. **Validate skill.json** - Check for JSON syntax errors
309+
3. **Check SKILL.md format** - Verify the markdown is well-formed and any YAML frontmatter uses valid syntax
315310
4. **Enable debug logging** - Set `logLevel: "debug"` to see skill loading logs
316311

317312
### Skill Conflicts
318313

319-
If multiple skills define the same tool:
320-
- Later directories in the array take precedence
314+
If multiple skills provide conflicting instructions:
321315
- Use `disabledSkills` to exclude conflicting skills
316+
- Reorganize skill directories to avoid overlaps
322317

323318
## See Also
324319

dotnet/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ new CopilotClient(CopilotClientOptions? options = null)
7777
- `Cwd` - Working directory for the CLI process
7878
- `Environment` - Environment variables to pass to the CLI process
7979
- `Logger` - `ILogger` instance for SDK logging
80-
- `GithubToken` - GitHub token for authentication. When provided, takes priority over other auth methods.
81-
- `UseLoggedInUser` - Whether to use logged-in user for authentication (default: true, but false when `GithubToken` is provided). Cannot be used with `CliUrl`.
80+
- `GitHubToken` - GitHub token for authentication. When provided, takes priority over other auth methods.
81+
- `UseLoggedInUser` - Whether to use logged-in user for authentication (default: true, but false when `GitHubToken` is provided). Cannot be used with `CliUrl`.
8282

8383
#### Methods
8484

0 commit comments

Comments
 (0)