You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: nodejs/docs/extensions.md
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,9 +18,9 @@ Extensions add custom tools, hooks, and behaviors to the Copilot CLI. They run a
18
18
19
19
1.**Discovery**: The CLI scans `.github/extensions/` (project) and the user's copilot config extensions directory for subdirectories containing `extension.mjs`.
20
20
2.**Launch**: Each extension is forked as a child process with `@github/copilot-sdk` available via an automatic module resolver.
21
-
3.**Connection**: The extension calls `extension.resumeSession()` which establishes a JSON-RPC connection over stdio to the CLI.
21
+
3.**Connection**: The extension calls `joinSession()` which establishes a JSON-RPC connection over stdio to the CLI and attaches to the user's current foreground session.
22
22
4.**Registration**: Tools and hooks declared in the session options are registered with the CLI and become available to the agent.
23
-
5.**Lifecycle**: Extensions are reloaded on `/clear` (new session) and stopped on CLI exit (SIGTERM, then SIGKILL after 5s).
23
+
5.**Lifecycle**: Extensions are reloaded on `/clear` (or if the foreground session is replaced) and stopped on CLI exit (SIGTERM, then SIGKILL after 5s).
24
24
25
25
## File Structure
26
26
@@ -33,21 +33,23 @@ Extensions add custom tools, hooks, and behaviors to the Copilot CLI. They run a
33
33
- Only `.mjs` files are supported (ES modules). The file must be named `extension.mjs`.
34
34
- Each extension lives in its own subdirectory.
35
35
- The `@github/copilot-sdk` import is resolved automatically — you don't install it.
36
-
-`process.env.SESSION_ID` provides the session ID to connect to.
37
36
38
37
## The SDK
39
38
40
39
Extensions use `@github/copilot-sdk` for all interactions with the CLI:
0 commit comments