@github/copilot-sdk 0.1.33-unstable.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/examples.md CHANGED
@@ -7,11 +7,9 @@ A practical guide to writing extensions using the `@github/copilot-sdk` extensio
7
7
  Every extension starts with the same boilerplate:
8
8
 
9
9
  ```js
10
- import { approveAll } from "@github/copilot-sdk";
11
10
  import { joinSession } from "@github/copilot-sdk/extension";
12
11
 
13
12
  const session = await joinSession({
14
- onPermissionRequest: approveAll,
15
13
  hooks: { /* ... */ },
16
14
  tools: [ /* ... */ ],
17
15
  });
@@ -33,7 +31,6 @@ Use `session.log()` to surface messages to the user in the CLI timeline:
33
31
 
34
32
  ```js
35
33
  const session = await joinSession({
36
- onPermissionRequest: approveAll,
37
34
  hooks: {
38
35
  onSessionStart: async () => {
39
36
  await session.log("My extension loaded");
@@ -383,7 +380,6 @@ function copyToClipboard(text) {
383
380
  }
384
381
 
385
382
  const session = await joinSession({
386
- onPermissionRequest: approveAll,
387
383
  hooks: {
388
384
  onUserPromptSubmitted: async (input) => {
389
385
  if (/\\bcopy\\b/i.test(input.prompt)) {
@@ -425,15 +421,12 @@ Correlate `tool.execution_start` / `tool.execution_complete` events by `toolCall
425
421
  ```js
426
422
  import { existsSync, watchFile, readFileSync } from "node:fs";
427
423
  import { join } from "node:path";
428
- import { approveAll } from "@github/copilot-sdk";
429
424
  import { joinSession } from "@github/copilot-sdk/extension";
430
425
 
431
426
  const agentEdits = new Set(); // toolCallIds for in-flight agent edits
432
427
  const recentAgentPaths = new Set(); // paths recently written by the agent
433
428
 
434
- const session = await joinSession({
435
- onPermissionRequest: approveAll,
436
- });
429
+ const session = await joinSession();
437
430
 
438
431
  const workspace = session.workspacePath; // e.g. ~/.copilot/session-state/<id>
439
432
  if (workspace) {
@@ -480,14 +473,11 @@ Filter out agent edits by tracking `tool.execution_start` / `tool.execution_comp
480
473
  ```js
481
474
  import { watch, readFileSync, statSync } from "node:fs";
482
475
  import { join, relative, resolve } from "node:path";
483
- import { approveAll } from "@github/copilot-sdk";
484
476
  import { joinSession } from "@github/copilot-sdk/extension";
485
477
 
486
478
  const agentEditPaths = new Set();
487
479
 
488
- const session = await joinSession({
489
- onPermissionRequest: approveAll,
490
- });
480
+ const session = await joinSession();
491
481
 
492
482
  const cwd = process.cwd();
493
483
  const IGNORE = new Set(["node_modules", ".git", "dist"]);
@@ -582,7 +572,6 @@ Register `onUserInputRequest` to enable the agent's `ask_user` tool:
582
572
 
583
573
  ```js
584
574
  const session = await joinSession({
585
- onPermissionRequest: approveAll,
586
575
  onUserInputRequest: async (request) => {
587
576
  // request.question has the agent's question
588
577
  // request.choices has the options (if multiple choice)
@@ -599,7 +588,6 @@ An extension that combines tools, hooks, and events.
599
588
 
600
589
  ```js
601
590
  import { execFile, exec } from "node:child_process";
602
- import { approveAll } from "@github/copilot-sdk";
603
591
  import { joinSession } from "@github/copilot-sdk/extension";
604
592
 
605
593
  const isWindows = process.platform === "win32";
@@ -617,7 +605,6 @@ function openInEditor(filePath) {
617
605
  }
618
606
 
619
607
  const session = await joinSession({
620
- onPermissionRequest: approveAll,
621
608
  hooks: {
622
609
  onUserPromptSubmitted: async (input) => {
623
610
  if (/\\bcopy this\\b/i.test(input.prompt)) {
@@ -39,11 +39,9 @@ Extensions add custom tools, hooks, and behaviors to the Copilot CLI. They run a
39
39
  Extensions use `@github/copilot-sdk` for all interactions with the CLI:
40
40
 
41
41
  ```js
42
- import { approveAll } from "@github/copilot-sdk";
43
42
  import { joinSession } from "@github/copilot-sdk/extension";
44
43
 
45
44
  const session = await joinSession({
46
- onPermissionRequest: approveAll,
47
45
  tools: [
48
46
  /* ... */
49
47
  ],
package/package.json CHANGED
@@ -4,18 +4,30 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/github/copilot-sdk.git"
6
6
  },
7
- "version": "0.1.33-unstable.0",
7
+ "version": "0.2.0",
8
8
  "description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC",
9
- "main": "./dist/index.js",
9
+ "main": "./dist/cjs/index.js",
10
10
  "types": "./dist/index.d.ts",
11
11
  "exports": {
12
12
  ".": {
13
- "import": "./dist/index.js",
14
- "types": "./dist/index.d.ts"
13
+ "import": {
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.js"
16
+ },
17
+ "require": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/cjs/index.js"
20
+ }
15
21
  },
16
22
  "./extension": {
17
- "import": "./dist/extension.js",
18
- "types": "./dist/extension.d.ts"
23
+ "import": {
24
+ "types": "./dist/extension.d.ts",
25
+ "default": "./dist/extension.js"
26
+ },
27
+ "require": {
28
+ "types": "./dist/extension.d.ts",
29
+ "default": "./dist/cjs/extension.js"
30
+ }
19
31
  }
20
32
  },
21
33
  "type": "module",
@@ -44,7 +56,7 @@
44
56
  "author": "GitHub",
45
57
  "license": "MIT",
46
58
  "dependencies": {
47
- "@github/copilot": "^1.0.2",
59
+ "@github/copilot": "^1.0.10",
48
60
  "vscode-jsonrpc": "^8.2.1",
49
61
  "zod": "^4.3.6"
50
62
  },