@github/copilot-sdk 0.1.33-unstable.1 → 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.
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var extension_exports = {};
20
+ __export(extension_exports, {
21
+ joinSession: () => joinSession
22
+ });
23
+ module.exports = __toCommonJS(extension_exports);
24
+ var import_client = require("./client.js");
25
+ const defaultJoinSessionPermissionHandler = () => ({
26
+ kind: "no-result"
27
+ });
28
+ async function joinSession(config = {}) {
29
+ const sessionId = process.env.SESSION_ID;
30
+ if (!sessionId) {
31
+ throw new Error(
32
+ "joinSession() is intended for extensions running as child processes of the Copilot CLI."
33
+ );
34
+ }
35
+ const client = new import_client.CopilotClient({ isChildProcess: true });
36
+ return client.resumeSession(sessionId, {
37
+ ...config,
38
+ onPermissionRequest: config.onPermissionRequest ?? defaultJoinSessionPermissionHandler,
39
+ disableResume: config.disableResume ?? true
40
+ });
41
+ }
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ joinSession
45
+ });
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var rpc_exports = {};
20
+ __export(rpc_exports, {
21
+ createServerRpc: () => createServerRpc,
22
+ createSessionRpc: () => createSessionRpc
23
+ });
24
+ module.exports = __toCommonJS(rpc_exports);
25
+ function createServerRpc(connection) {
26
+ return {
27
+ ping: async (params) => connection.sendRequest("ping", params),
28
+ models: {
29
+ list: async () => connection.sendRequest("models.list", {})
30
+ },
31
+ tools: {
32
+ list: async (params) => connection.sendRequest("tools.list", params)
33
+ },
34
+ account: {
35
+ getQuota: async () => connection.sendRequest("account.getQuota", {})
36
+ }
37
+ };
38
+ }
39
+ function createSessionRpc(connection, sessionId) {
40
+ return {
41
+ model: {
42
+ getCurrent: async () => connection.sendRequest("session.model.getCurrent", { sessionId }),
43
+ switchTo: async (params) => connection.sendRequest("session.model.switchTo", { sessionId, ...params })
44
+ },
45
+ mode: {
46
+ get: async () => connection.sendRequest("session.mode.get", { sessionId }),
47
+ set: async (params) => connection.sendRequest("session.mode.set", { sessionId, ...params })
48
+ },
49
+ plan: {
50
+ read: async () => connection.sendRequest("session.plan.read", { sessionId }),
51
+ update: async (params) => connection.sendRequest("session.plan.update", { sessionId, ...params }),
52
+ delete: async () => connection.sendRequest("session.plan.delete", { sessionId })
53
+ },
54
+ workspace: {
55
+ listFiles: async () => connection.sendRequest("session.workspace.listFiles", { sessionId }),
56
+ readFile: async (params) => connection.sendRequest("session.workspace.readFile", { sessionId, ...params }),
57
+ createFile: async (params) => connection.sendRequest("session.workspace.createFile", { sessionId, ...params })
58
+ },
59
+ /** @experimental */
60
+ fleet: {
61
+ start: async (params) => connection.sendRequest("session.fleet.start", { sessionId, ...params })
62
+ },
63
+ /** @experimental */
64
+ agent: {
65
+ list: async () => connection.sendRequest("session.agent.list", { sessionId }),
66
+ getCurrent: async () => connection.sendRequest("session.agent.getCurrent", { sessionId }),
67
+ select: async (params) => connection.sendRequest("session.agent.select", { sessionId, ...params }),
68
+ deselect: async () => connection.sendRequest("session.agent.deselect", { sessionId }),
69
+ reload: async () => connection.sendRequest("session.agent.reload", { sessionId })
70
+ },
71
+ /** @experimental */
72
+ skills: {
73
+ list: async () => connection.sendRequest("session.skills.list", { sessionId }),
74
+ enable: async (params) => connection.sendRequest("session.skills.enable", { sessionId, ...params }),
75
+ disable: async (params) => connection.sendRequest("session.skills.disable", { sessionId, ...params }),
76
+ reload: async () => connection.sendRequest("session.skills.reload", { sessionId })
77
+ },
78
+ /** @experimental */
79
+ mcp: {
80
+ list: async () => connection.sendRequest("session.mcp.list", { sessionId }),
81
+ enable: async (params) => connection.sendRequest("session.mcp.enable", { sessionId, ...params }),
82
+ disable: async (params) => connection.sendRequest("session.mcp.disable", { sessionId, ...params }),
83
+ reload: async () => connection.sendRequest("session.mcp.reload", { sessionId })
84
+ },
85
+ /** @experimental */
86
+ plugins: {
87
+ list: async () => connection.sendRequest("session.plugins.list", { sessionId })
88
+ },
89
+ /** @experimental */
90
+ extensions: {
91
+ list: async () => connection.sendRequest("session.extensions.list", { sessionId }),
92
+ enable: async (params) => connection.sendRequest("session.extensions.enable", { sessionId, ...params }),
93
+ disable: async (params) => connection.sendRequest("session.extensions.disable", { sessionId, ...params }),
94
+ reload: async () => connection.sendRequest("session.extensions.reload", { sessionId })
95
+ },
96
+ /** @experimental */
97
+ compaction: {
98
+ compact: async () => connection.sendRequest("session.compaction.compact", { sessionId })
99
+ },
100
+ tools: {
101
+ handlePendingToolCall: async (params) => connection.sendRequest("session.tools.handlePendingToolCall", { sessionId, ...params })
102
+ },
103
+ commands: {
104
+ handlePendingCommand: async (params) => connection.sendRequest("session.commands.handlePendingCommand", { sessionId, ...params })
105
+ },
106
+ ui: {
107
+ elicitation: async (params) => connection.sendRequest("session.ui.elicitation", { sessionId, ...params })
108
+ },
109
+ permissions: {
110
+ handlePendingPermissionRequest: async (params) => connection.sendRequest("session.permissions.handlePendingPermissionRequest", { sessionId, ...params })
111
+ },
112
+ log: async (params) => connection.sendRequest("session.log", { sessionId, ...params }),
113
+ shell: {
114
+ exec: async (params) => connection.sendRequest("session.shell.exec", { sessionId, ...params }),
115
+ kill: async (params) => connection.sendRequest("session.shell.kill", { sessionId, ...params })
116
+ }
117
+ };
118
+ }
119
+ // Annotate the CommonJS export names for ESM import in node:
120
+ 0 && (module.exports = {
121
+ createServerRpc,
122
+ createSessionRpc
123
+ });
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var session_events_exports = {};
16
+ module.exports = __toCommonJS(session_events_exports);
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var index_exports = {};
20
+ __export(index_exports, {
21
+ CopilotClient: () => import_client.CopilotClient,
22
+ CopilotSession: () => import_session.CopilotSession,
23
+ SYSTEM_PROMPT_SECTIONS: () => import_types.SYSTEM_PROMPT_SECTIONS,
24
+ approveAll: () => import_types.approveAll,
25
+ defineTool: () => import_types.defineTool
26
+ });
27
+ module.exports = __toCommonJS(index_exports);
28
+ var import_client = require("./client.js");
29
+ var import_session = require("./session.js");
30
+ var import_types = require("./types.js");
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ CopilotClient,
34
+ CopilotSession,
35
+ SYSTEM_PROMPT_SECTIONS,
36
+ approveAll,
37
+ defineTool
38
+ });
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var sdkProtocolVersion_exports = {};
20
+ __export(sdkProtocolVersion_exports, {
21
+ SDK_PROTOCOL_VERSION: () => SDK_PROTOCOL_VERSION,
22
+ getSdkProtocolVersion: () => getSdkProtocolVersion
23
+ });
24
+ module.exports = __toCommonJS(sdkProtocolVersion_exports);
25
+ const SDK_PROTOCOL_VERSION = 3;
26
+ function getSdkProtocolVersion() {
27
+ return SDK_PROTOCOL_VERSION;
28
+ }
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ SDK_PROTOCOL_VERSION,
32
+ getSdkProtocolVersion
33
+ });