@github/copilot-sdk 1.0.15-preview.3 → 1.0.15-preview.4
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 +44 -0
- package/dist/cjs/cliVersion.js +1 -1
- package/dist/cjs/client.js +18 -6
- package/dist/cjs/extension.js +1 -12
- package/dist/cjs/generated/rpc.js +262 -173
- package/dist/cjs/index.js +0 -7
- package/dist/cjs/installationConfirmation.js +98 -0
- package/dist/cjs/session.js +14 -524
- package/dist/cliVersion.d.ts +1 -1
- package/dist/cliVersion.js +1 -1
- package/dist/client.d.ts +1 -0
- package/dist/client.js +20 -6
- package/dist/extension.d.ts +10 -24
- package/dist/extension.js +1 -13
- package/dist/generated/rpc.d.ts +5960 -4645
- package/dist/generated/rpc.js +262 -173
- package/dist/generated/session-events.d.ts +197 -118
- package/dist/index.d.ts +2 -4
- package/dist/index.js +0 -4
- package/dist/installationConfirmation.d.ts +19 -0
- package/dist/installationConfirmation.js +77 -0
- package/dist/session.d.ts +2 -25
- package/dist/session.js +14 -529
- package/dist/types.d.ts +10 -65
- package/dist/workflow.d.ts +5 -2
- package/docs/extensions.md +0 -1
- package/docs/workflows.md +2 -4
- package/package.json +10 -10
- package/dist/cjs/factory.js +0 -134
- package/dist/factory.d.ts +0 -327
- package/dist/factory.js +0 -106
- package/docs/factories.md +0 -296
- package/docs/factory-patterns.md +0 -194
package/README.md
CHANGED
|
@@ -124,6 +124,7 @@ new CopilotClient(options?: CopilotClientOptions)
|
|
|
124
124
|
- `workingDirectory?: string` - Working directory for the runtime process (default: current process cwd).
|
|
125
125
|
- `baseDirectory?: string` - Base directory for Copilot data (session state, config, etc.). Sets `COPILOT_HOME` on the spawned runtime. When not set, the runtime defaults to `~/.copilot`. Ignored when connecting via `RuntimeConnection.forUri`.
|
|
126
126
|
- `extensionLaunchProvider?: ExtensionLaunchProvider` - Experimental connection-level resolver for extension launch profiles. The client installs the reverse-RPC handler and registers the provider during startup before sessions can be created.
|
|
127
|
+
- `installationConfirmationHandler?: InstallationConfirmationHandler` - Experimental connection-global human review for `installations.confirm`. Receives the typed request and independent request/connection cancellation signals, and returns an explicit decision. Does not enable installation capabilities.
|
|
127
128
|
- `logLevel?: "none" | "error" | "warning" | "info" | "debug" | "all"` - Log level. When omitted, the runtime uses its own default (currently `"info"`).
|
|
128
129
|
- `env?: Record<string, string | undefined>` - Environment variables for the runtime process. When omitted, inherits `process.env`.
|
|
129
130
|
- `gitHubToken?: string` - GitHub token for authentication. When provided, takes priority over other auth methods.
|
|
@@ -135,6 +136,49 @@ new CopilotClient(options?: CopilotClientOptions)
|
|
|
135
136
|
- `sessionIdleTimeoutSeconds?: number` - Server-wide idle timeout for sessions in seconds. Ignored when connecting via `RuntimeConnection.forUri`.
|
|
136
137
|
- `enableRemoteSessions?: boolean` - Enable Mission Control remote session support. Ignored when connecting via `RuntimeConnection.forUri`.
|
|
137
138
|
|
|
139
|
+
#### Installation confirmation (experimental)
|
|
140
|
+
|
|
141
|
+
All six SDKs (Node.js, Python, Go, .NET, Java and Rust) provide this receiver with the
|
|
142
|
+
same semantics: each review gets one cancellation token, concurrent reviews are
|
|
143
|
+
independent, and a decision returned after cancellation is never sent. Without a
|
|
144
|
+
configured handler, an `installations.confirm` request is refused, which the
|
|
145
|
+
runtime treats as no consent.
|
|
146
|
+
|
|
147
|
+
The installation confirmation handler receives the generated
|
|
148
|
+
`InstallationConfirmationRequest` and a `CancellationToken`. Match `operationId`
|
|
149
|
+
and `policySessionId` against the exact original action on this connection
|
|
150
|
+
before presenting the complete review. Refuse unknown operations or incomplete
|
|
151
|
+
reviews; missing legacy session metadata is not permission to use the current
|
|
152
|
+
session. Return `"confirm"`, `"decline"` or `"cancel"` only after an explicit
|
|
153
|
+
human decision. The SDK echoes the original challenge and fingerprint.
|
|
154
|
+
|
|
155
|
+
Concurrent reviews remain independent. The token is cancelled when the runtime
|
|
156
|
+
retires the request, including runtime-enforced expiry, or when the original
|
|
157
|
+
connection closes. Observe it to close pending UI. Late handler results cannot
|
|
158
|
+
approve a retired request. This incoming signal does not cancel outbound
|
|
159
|
+
installation or OAuth RPCs, and dropping those promises is not cancellation.
|
|
160
|
+
|
|
161
|
+
Use `client.rpc.mcp.prepareInstall` before `applyInstall`: preparation returns an
|
|
162
|
+
inert runtime-issued `operationId` and original expiry. Register that ID with its
|
|
163
|
+
captured session on this exact client before applying. Removal uses
|
|
164
|
+
`planUninstall` then `applyUninstall`; the returned `operationId` identifies the
|
|
165
|
+
operation, while `planHandle` is the one-use removal input. Never interchange them.
|
|
166
|
+
Use `client.rpc.mcp.installations.list` and `recover` for owned inventory.
|
|
167
|
+
Inspect or cancel uncertain work through `status` and `cancel` on the original
|
|
168
|
+
connection and operation ID, without selecting a replacement session or replaying apply.
|
|
169
|
+
|
|
170
|
+
Owned OAuth similarly uses `session.rpc.mcp.oauth.prepareLogin` to obtain
|
|
171
|
+
`loginId` before browser, network or cached-reconnect work. Retain that ID with
|
|
172
|
+
the original session and `expectedInstallationId` for `login` and `cancelLogin`.
|
|
173
|
+
Prepare freezes reauthentication and display options. Cancelling an incoming
|
|
174
|
+
confirmation or abandoning a login promise is not a substitute for `cancelLogin`.
|
|
175
|
+
Manual MCP OAuth retains its direct `login` path.
|
|
176
|
+
|
|
177
|
+
A matching runtime contract and available owned-lifecycle support are required.
|
|
178
|
+
Capability negotiation does not promise availability; preserve typed refusals
|
|
179
|
+
instead of falling back to raw configuration writes. Generated presence and
|
|
180
|
+
transport tests do not establish a working installer, live OAuth or restart safety.
|
|
181
|
+
|
|
138
182
|
#### Methods
|
|
139
183
|
|
|
140
184
|
##### `start(): Promise<void>`
|
package/dist/cjs/cliVersion.js
CHANGED
|
@@ -22,7 +22,7 @@ __export(cliVersion_exports, {
|
|
|
22
22
|
COPILOT_CLI_VERSION: () => COPILOT_CLI_VERSION
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(cliVersion_exports);
|
|
25
|
-
const COPILOT_CLI_VERSION = "1.0.89-
|
|
25
|
+
const COPILOT_CLI_VERSION = "1.0.89-7";
|
|
26
26
|
const COPILOT_CLI_USE_NPM_PACKAGE = false;
|
|
27
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
28
28
|
0 && (module.exports = {
|
package/dist/cjs/client.js
CHANGED
|
@@ -44,6 +44,7 @@ var import_runtimeArtifacts = require("./runtimeArtifacts.js");
|
|
|
44
44
|
var import_cliVersion = require("./cliVersion.js");
|
|
45
45
|
var import_sessionFsProvider = require("./sessionFsProvider.js");
|
|
46
46
|
var import_copilotRequestHandler = require("./copilotRequestHandler.js");
|
|
47
|
+
var import_installationConfirmation = require("./installationConfirmation.js");
|
|
47
48
|
var import_telemetry = require("./telemetry.js");
|
|
48
49
|
var import_schema = require("./schema.js");
|
|
49
50
|
var import_toolSet = require("./toolSet.js");
|
|
@@ -265,6 +266,7 @@ class CopilotClient {
|
|
|
265
266
|
sessionFsConfig = null;
|
|
266
267
|
requestHandler = null;
|
|
267
268
|
extensionLaunchProvider;
|
|
269
|
+
installationConfirmationHandler;
|
|
268
270
|
builtinPluginDirectories = [];
|
|
269
271
|
onGitHubTelemetry;
|
|
270
272
|
clientGlobalHandlers = {};
|
|
@@ -423,6 +425,7 @@ class CopilotClient {
|
|
|
423
425
|
this.sessionFsConfig = options.sessionFs ?? null;
|
|
424
426
|
this.requestHandler = options.requestHandler ?? null;
|
|
425
427
|
this.extensionLaunchProvider = options.extensionLaunchProvider;
|
|
428
|
+
this.installationConfirmationHandler = options.installationConfirmationHandler;
|
|
426
429
|
this.onGitHubTelemetry = options.onGitHubTelemetry;
|
|
427
430
|
this.setupClientGlobalHandlers();
|
|
428
431
|
const connEnv = conn.kind === "stdio" || conn.kind === "tcp" ? conn.env : void 0;
|
|
@@ -1339,14 +1342,12 @@ class CopilotClient {
|
|
|
1339
1342
|
async resumeSession(sessionId, config) {
|
|
1340
1343
|
return this.resumeSessionInternal(sessionId, config);
|
|
1341
1344
|
}
|
|
1345
|
+
/** @internal */
|
|
1342
1346
|
async resumeSessionForExtension(sessionId, config, contributions = {}, extensionOptions) {
|
|
1343
1347
|
return this.resumeSessionInternal(sessionId, config, contributions, extensionOptions);
|
|
1344
1348
|
}
|
|
1345
1349
|
async resumeSessionInternal(sessionId, config, contributions = {}, extensionOptions) {
|
|
1346
|
-
const {
|
|
1347
|
-
if (factories !== void 0 && workflows !== void 0) {
|
|
1348
|
-
throw new Error("Session configuration cannot include both factories and workflows");
|
|
1349
|
-
}
|
|
1350
|
+
const { workflows } = contributions;
|
|
1350
1351
|
if (config.gitHubToken !== void 0 && config.gitHubTokenProvider !== void 0) {
|
|
1351
1352
|
throw new Error("gitHubToken and gitHubTokenProvider are mutually exclusive");
|
|
1352
1353
|
}
|
|
@@ -1366,7 +1367,6 @@ class CopilotClient {
|
|
|
1366
1367
|
session.registerTools(config.tools);
|
|
1367
1368
|
session.registerCanvases(config.canvases);
|
|
1368
1369
|
session.registerCommands(config.commands);
|
|
1369
|
-
session.registerFactories(factories);
|
|
1370
1370
|
session.registerWorkflows(workflows);
|
|
1371
1371
|
const {
|
|
1372
1372
|
wireProvider: bearerWireProvider,
|
|
@@ -1448,7 +1448,6 @@ class CopilotClient {
|
|
|
1448
1448
|
})),
|
|
1449
1449
|
toolSearch: config.toolSearch,
|
|
1450
1450
|
canvases: config.canvases?.map((canvas) => canvas.declaration),
|
|
1451
|
-
factories: factories?.map((factory) => factory.meta),
|
|
1452
1451
|
workflows: workflows?.map((workflow) => workflow.meta),
|
|
1453
1452
|
requestCanvasRenderer: config.requestCanvasRenderer,
|
|
1454
1453
|
requestExtensions: config.requestExtensions,
|
|
@@ -1911,6 +1910,9 @@ class CopilotClient {
|
|
|
1911
1910
|
if (this.options.mode === "empty") {
|
|
1912
1911
|
env.COPILOT_DISABLE_KEYTAR = "1";
|
|
1913
1912
|
}
|
|
1913
|
+
if (this.options.mode !== "empty") {
|
|
1914
|
+
env.COPILOT_RUNTIME_PROCESS_FILE_LOGGING = "1";
|
|
1915
|
+
}
|
|
1914
1916
|
if (this.options.telemetry) {
|
|
1915
1917
|
const t = this.options.telemetry;
|
|
1916
1918
|
env.COPILOT_OTEL_ENABLED = "true";
|
|
@@ -2285,6 +2287,16 @@ stderr: ${stderrOutput}` : ""}`
|
|
|
2285
2287
|
return session.clientSessionApis;
|
|
2286
2288
|
});
|
|
2287
2289
|
(0, import_rpc.registerClientGlobalApiHandlers)(this.connection, this.clientGlobalHandlers);
|
|
2290
|
+
if (this.installationConfirmationHandler) {
|
|
2291
|
+
const confirmation = (0, import_installationConfirmation.createInstallationConfirmationAdapter)(
|
|
2292
|
+
this.connection,
|
|
2293
|
+
this.installationConfirmationHandler
|
|
2294
|
+
);
|
|
2295
|
+
this.connection.onRequest(
|
|
2296
|
+
"installations.confirm",
|
|
2297
|
+
(params, token) => confirmation.confirm(params, token)
|
|
2298
|
+
);
|
|
2299
|
+
}
|
|
2288
2300
|
this.connection.onRequest(
|
|
2289
2301
|
"hooks.invoke",
|
|
2290
2302
|
async (params) => {
|
package/dist/cjs/extension.js
CHANGED
|
@@ -20,12 +20,9 @@ var extension_exports = {};
|
|
|
20
20
|
__export(extension_exports, {
|
|
21
21
|
Canvas: () => import_canvas.Canvas,
|
|
22
22
|
CanvasError: () => import_canvas.CanvasError,
|
|
23
|
-
FactoryResumeError: () => import_factory.FactoryResumeError,
|
|
24
23
|
WorkflowResumeError: () => import_workflow.WorkflowResumeError,
|
|
25
24
|
createCanvas: () => import_canvas.createCanvas,
|
|
26
|
-
defineFactory: () => import_factory.defineFactory,
|
|
27
25
|
defineWorkflow: () => import_workflow.defineWorkflow,
|
|
28
|
-
isFactoryRunTerminal: () => import_factory.isFactoryRunTerminal,
|
|
29
26
|
isWorkflowRunTerminal: () => import_workflow.isWorkflowRunTerminal,
|
|
30
27
|
joinSession: () => joinSession
|
|
31
28
|
});
|
|
@@ -33,7 +30,6 @@ module.exports = __toCommonJS(extension_exports);
|
|
|
33
30
|
var import_client = require("./client.js");
|
|
34
31
|
var import_types = require("./types.js");
|
|
35
32
|
var import_canvas = require("./canvas.js");
|
|
36
|
-
var import_factory = require("./factory.js");
|
|
37
33
|
var import_workflow = require("./workflow.js");
|
|
38
34
|
async function joinSession(config = {}) {
|
|
39
35
|
const sessionId = process.env.SESSION_ID;
|
|
@@ -45,15 +41,11 @@ async function joinSession(config = {}) {
|
|
|
45
41
|
const client = new import_client.CopilotClient({ _internalConnection: { kind: "parent-process" } });
|
|
46
42
|
const {
|
|
47
43
|
extensionSdkPath: _stripped,
|
|
48
|
-
factories,
|
|
49
44
|
workflows,
|
|
50
45
|
requestedEnvironmentVariables,
|
|
51
46
|
...rest
|
|
52
47
|
} = config;
|
|
53
48
|
void _stripped;
|
|
54
|
-
if (factories !== void 0 && workflows !== void 0) {
|
|
55
|
-
throw new Error("joinSession cannot register both factories and workflows");
|
|
56
|
-
}
|
|
57
49
|
return client.resumeSessionForExtension(
|
|
58
50
|
sessionId,
|
|
59
51
|
{
|
|
@@ -61,7 +53,7 @@ async function joinSession(config = {}) {
|
|
|
61
53
|
onPermissionRequest: config.onPermissionRequest ?? import_types.defaultJoinSessionPermissionHandler,
|
|
62
54
|
suppressResumeEvent: config.suppressResumeEvent ?? true
|
|
63
55
|
},
|
|
64
|
-
{
|
|
56
|
+
{ workflows },
|
|
65
57
|
requestedEnvironmentVariables?.length ? { requestedEnvironmentVariables } : void 0
|
|
66
58
|
);
|
|
67
59
|
}
|
|
@@ -69,12 +61,9 @@ async function joinSession(config = {}) {
|
|
|
69
61
|
0 && (module.exports = {
|
|
70
62
|
Canvas,
|
|
71
63
|
CanvasError,
|
|
72
|
-
FactoryResumeError,
|
|
73
64
|
WorkflowResumeError,
|
|
74
65
|
createCanvas,
|
|
75
|
-
defineFactory,
|
|
76
66
|
defineWorkflow,
|
|
77
|
-
isFactoryRunTerminal,
|
|
78
67
|
isWorkflowRunTerminal,
|
|
79
68
|
joinSession
|
|
80
69
|
});
|