@@ -7,11 +7,9 @@ A practical guide to writing extensions using the `@github/copilot-sdk` extensio
77Every extension starts with the same boilerplate:
88
99``` js
10- import { approveAll } from " @github/copilot-sdk" ;
1110import { joinSession } from " @github/copilot-sdk/extension" ;
1211
1312const 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
3533const 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
385382const 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
426422import { existsSync, watchFile, readFileSync } from "node:fs";
427423import { join } from "node:path";
428- import { approveAll } from "@github/copilot-sdk";
429424import { joinSession } from "@github/copilot-sdk/extension";
430425
431426const agentEdits = new Set(); // toolCallIds for in-flight agent edits
432427const 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
438431const workspace = session.workspacePath; // e.g. ~/.copilot/session-state/<id>
439432if (workspace) {
@@ -480,14 +473,11 @@ Filter out agent edits by tracking `tool.execution_start` / `tool.execution_comp
480473` ` ` js
481474import { watch, readFileSync, statSync } from "node:fs";
482475import { join, relative, resolve } from "node:path";
483- import { approveAll } from "@github/copilot-sdk";
484476import { joinSession } from "@github/copilot-sdk/extension";
485477
486478const agentEditPaths = new Set();
487479
488- const session = await joinSession({
489- onPermissionRequest: approveAll,
490- });
480+ const session = await joinSession();
491481
492482const cwd = process.cwd();
493483const IGNORE = new Set(["node_modules", ".git", "dist"]);
@@ -582,7 +572,6 @@ Register `onUserInputRequest` to enable the agent's `ask_user` tool:
582572
583573```js
584574const 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
601590import { execFile, exec } from "node:child_process";
602- import { approveAll } from "@github/copilot-sdk";
603591import { joinSession } from "@github/copilot-sdk/extension";
604592
605593const isWindows = process.platform === "win32";
@@ -617,7 +605,6 @@ function openInEditor(filePath) {
617605}
618606
619607const session = await joinSession({
620- onPermissionRequest: approveAll,
621608 hooks: {
622609 onUserPromptSubmitted: async (input) => {
623610 if (/\\ bcopy this\\ b/i.test(input.prompt)) {
0 commit comments