Skip to content

Commit 42474eb

Browse files
Update joinSession docs
Remove extension doc suggestions to pass onPermissionRequest: approveAll when using joinSession(), since extensions now default to no-result permission handling. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9ae7eac commit 42474eb

3 files changed

Lines changed: 2 additions & 25 deletions

File tree

nodejs/docs/agent-author.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,12 @@ Discovery rules:
5959
## Minimal Skeleton
6060

6161
```js
62-
import { approveAll } from "@github/copilot-sdk";
6362
import { joinSession } from "@github/copilot-sdk/extension";
6463

6564
await joinSession({
6665
tools: [], // Optional — custom tools
6766
hooks: {}, // Optional — lifecycle hooks
6867
});
69-
70-
// Optional — provide this if your extension should actively answer
71-
// permission requests instead of leaving them pending for another client.
72-
await joinSession({ onPermissionRequest: approveAll });
7368
```
7469

7570
---

nodejs/docs/examples.md

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ A practical guide to writing extensions using the `@github/copilot-sdk` extensio
77
Every extension starts with the same boilerplate:
88

99
```js
10-
import { approveAll } from "@github/copilot-sdk";
1110
import { joinSession } from "@github/copilot-sdk/extension";
1211

1312
const session = await joinSession({
14-
onPermissionRequest: approveAll,
1513
hooks: { /* ... */ },
1614
tools: [ /* ... */ ],
1715
});
@@ -33,7 +31,6 @@ Use `session.log()` to surface messages to the user in the CLI timeline:
3331

3432
```js
3533
const session = await joinSession({
36-
onPermissionRequest: approveAll,
3734
hooks: {
3835
onSessionStart: async () => {
3936
await session.log("My extension loaded");
@@ -383,7 +380,6 @@ function copyToClipboard(text) {
383380
}
384381
385382
const session = await joinSession({
386-
onPermissionRequest: approveAll,
387383
hooks: {
388384
onUserPromptSubmitted: async (input) => {
389385
if (/\\bcopy\\b/i.test(input.prompt)) {
@@ -425,15 +421,12 @@ Correlate `tool.execution_start` / `tool.execution_complete` events by `toolCall
425421
```js
426422
import { existsSync, watchFile, readFileSync } from "node:fs";
427423
import { join } from "node:path";
428-
import { approveAll } from "@github/copilot-sdk";
429424
import { joinSession } from "@github/copilot-sdk/extension";
430425
431426
const agentEdits = new Set(); // toolCallIds for in-flight agent edits
432427
const recentAgentPaths = new Set(); // paths recently written by the agent
433428
434-
const session = await joinSession({
435-
onPermissionRequest: approveAll,
436-
});
429+
const session = await joinSession();
437430
438431
const workspace = session.workspacePath; // e.g. ~/.copilot/session-state/<id>
439432
if (workspace) {
@@ -480,14 +473,11 @@ Filter out agent edits by tracking `tool.execution_start` / `tool.execution_comp
480473
```js
481474
import { watch, readFileSync, statSync } from "node:fs";
482475
import { join, relative, resolve } from "node:path";
483-
import { approveAll } from "@github/copilot-sdk";
484476
import { joinSession } from "@github/copilot-sdk/extension";
485477
486478
const agentEditPaths = new Set();
487479
488-
const session = await joinSession({
489-
onPermissionRequest: approveAll,
490-
});
480+
const session = await joinSession();
491481
492482
const cwd = process.cwd();
493483
const IGNORE = new Set(["node_modules", ".git", "dist"]);
@@ -582,7 +572,6 @@ Register `onUserInputRequest` to enable the agent's `ask_user` tool:
582572
583573
```js
584574
const session = await joinSession({
585-
onPermissionRequest: approveAll,
586575
onUserInputRequest: async (request) => {
587576
// request.question has the agent's question
588577
// request.choices has the options (if multiple choice)
@@ -599,7 +588,6 @@ An extension that combines tools, hooks, and events.
599588

600589
```js
601590
import { execFile, exec } from "node:child_process";
602-
import { approveAll } from "@github/copilot-sdk";
603591
import { joinSession } from "@github/copilot-sdk/extension";
604592
605593
const isWindows = process.platform === "win32";
@@ -617,7 +605,6 @@ function openInEditor(filePath) {
617605
}
618606
619607
const session = await joinSession({
620-
onPermissionRequest: approveAll,
621608
hooks: {
622609
onUserPromptSubmitted: async (input) => {
623610
if (/\\bcopy this\\b/i.test(input.prompt)) {

nodejs/docs/extensions.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ Extensions add custom tools, hooks, and behaviors to the Copilot CLI. They run a
3939
Extensions use `@github/copilot-sdk` for all interactions with the CLI:
4040

4141
```js
42-
import { approveAll } from "@github/copilot-sdk";
4342
import { joinSession } from "@github/copilot-sdk/extension";
4443

4544
const session = await joinSession({
@@ -50,10 +49,6 @@ const session = await joinSession({
5049
/* ... */
5150
},
5251
});
53-
54-
// Optional: override the default "no result" behavior if this extension
55-
// should actively answer permission requests itself.
56-
await joinSession({ onPermissionRequest: approveAll });
5752
```
5853

5954
The `session` object provides methods for sending messages, logging to the timeline, listening to events, and accessing the RPC API. See the `.d.ts` files in the SDK package for full type information.

0 commit comments

Comments
 (0)