@github/copilot-sdk 1.0.0-beta.4 → 1.0.0-beta.6
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/README.md +35 -33
- package/dist/cjs/client.js +222 -166
- package/dist/cjs/extension.js +2 -2
- package/dist/cjs/generated/rpc.js +1150 -13
- package/dist/cjs/index.js +9 -6
- package/dist/cjs/session.js +22 -61
- package/dist/cjs/sessionFsProvider.js +34 -0
- package/dist/cjs/types.js +30 -0
- package/dist/client.d.ts +45 -24
- package/dist/client.js +222 -166
- package/dist/extension.js +2 -2
- package/dist/generated/rpc.d.ts +8486 -1065
- package/dist/generated/rpc.js +1150 -13
- package/dist/generated/session-events.d.ts +1132 -110
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/session.d.ts +5 -212
- package/dist/session.js +22 -61
- package/dist/sessionFsProvider.d.ts +28 -1
- package/dist/sessionFsProvider.js +34 -0
- package/dist/types.d.ts +301 -115
- package/dist/types.js +29 -0
- package/docs/examples.md +3 -3
- package/package.json +3 -3
package/dist/types.js
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
import { createSessionFsAdapter } from "./sessionFsProvider.js";
|
|
2
|
+
const RuntimeConnection = {
|
|
3
|
+
/**
|
|
4
|
+
* Spawn a runtime child process and communicate over its stdin/stdout.
|
|
5
|
+
* This is the default if no {@link CopilotClientOptions.connection} is set.
|
|
6
|
+
*/
|
|
7
|
+
forStdio(opts = {}) {
|
|
8
|
+
return { kind: "stdio", path: opts.path, args: opts.args };
|
|
9
|
+
},
|
|
10
|
+
/**
|
|
11
|
+
* Spawn a runtime child process that listens on a TCP socket and connect to it.
|
|
12
|
+
*/
|
|
13
|
+
forTcp(opts = {}) {
|
|
14
|
+
return {
|
|
15
|
+
kind: "tcp",
|
|
16
|
+
port: opts.port,
|
|
17
|
+
connectionToken: opts.connectionToken,
|
|
18
|
+
path: opts.path,
|
|
19
|
+
args: opts.args
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* Connect to an already-running runtime at the given URL. The SDK does not
|
|
24
|
+
* spawn a process in this mode.
|
|
25
|
+
*/
|
|
26
|
+
forUri(url, opts = {}) {
|
|
27
|
+
return { kind: "uri", url, connectionToken: opts.connectionToken };
|
|
28
|
+
}
|
|
29
|
+
};
|
|
2
30
|
function convertMcpCallToolResult(callResult) {
|
|
3
31
|
const textParts = [];
|
|
4
32
|
const binaryResults = [];
|
|
@@ -63,6 +91,7 @@ const defaultJoinSessionPermissionHandler = () => ({
|
|
|
63
91
|
kind: "no-result"
|
|
64
92
|
});
|
|
65
93
|
export {
|
|
94
|
+
RuntimeConnection,
|
|
66
95
|
SYSTEM_PROMPT_SECTIONS,
|
|
67
96
|
approveAll,
|
|
68
97
|
convertMcpCallToolResult,
|
package/docs/examples.md
CHANGED
|
@@ -561,12 +561,12 @@ const session = await joinSession({
|
|
|
561
561
|
onPermissionRequest: async (request) => {
|
|
562
562
|
if (request.kind === "shell") {
|
|
563
563
|
// request.fullCommandText has the shell command
|
|
564
|
-
return { kind: "
|
|
564
|
+
return { kind: "approve-once" };
|
|
565
565
|
}
|
|
566
566
|
if (request.kind === "write") {
|
|
567
|
-
return { kind: "
|
|
567
|
+
return { kind: "approve-once" };
|
|
568
568
|
}
|
|
569
|
-
return { kind: "
|
|
569
|
+
return { kind: "reject" };
|
|
570
570
|
},
|
|
571
571
|
});
|
|
572
572
|
```
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"type": "git",
|
|
5
5
|
"url": "https://github.com/github/copilot-sdk.git"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.0.0-beta.
|
|
7
|
+
"version": "1.0.0-beta.6",
|
|
8
8
|
"description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC",
|
|
9
9
|
"main": "./dist/cjs/index.js",
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\" --ignore-path .prettierignore",
|
|
41
41
|
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
42
42
|
"lint:fix": "eslint --fix \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
43
|
-
"typecheck": "tsc --noEmit",
|
|
43
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.test.json",
|
|
44
44
|
"generate": "cd ../scripts/codegen && npm run generate",
|
|
45
45
|
"update:protocol-version": "tsx scripts/update-protocol-version.ts",
|
|
46
46
|
"prepublishOnly": "npm run build",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"author": "GitHub",
|
|
57
57
|
"license": "MIT",
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@github/copilot": "^1.0.
|
|
59
|
+
"@github/copilot": "^1.0.52-1",
|
|
60
60
|
"vscode-jsonrpc": "^8.2.1",
|
|
61
61
|
"zod": "^4.3.6"
|
|
62
62
|
},
|