@github/copilot-sdk 1.0.15-preview.2 → 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/dist/client.d.ts CHANGED
@@ -43,6 +43,7 @@ export declare class CopilotClient {
43
43
  private sessionFsConfig;
44
44
  private requestHandler;
45
45
  private extensionLaunchProvider?;
46
+ private installationConfirmationHandler?;
46
47
  private builtinPluginDirectories;
47
48
  private onGitHubTelemetry?;
48
49
  private clientGlobalHandlers;
package/dist/client.js CHANGED
@@ -22,6 +22,9 @@ import { ensureRuntimeBundle } from "./runtimeArtifacts.js";
22
22
  import { COPILOT_CLI_VERSION } from "./cliVersion.js";
23
23
  import { createSessionFsAdapter } from "./sessionFsProvider.js";
24
24
  import { createCopilotRequestAdapter } from "./copilotRequestHandler.js";
25
+ import {
26
+ createInstallationConfirmationAdapter
27
+ } from "./installationConfirmation.js";
25
28
  import { getTraceContext } from "./telemetry.js";
26
29
  import { toJsonSchema } from "./schema.js";
27
30
  import { ToolSet } from "./toolSet.js";
@@ -243,6 +246,7 @@ class CopilotClient {
243
246
  sessionFsConfig = null;
244
247
  requestHandler = null;
245
248
  extensionLaunchProvider;
249
+ installationConfirmationHandler;
246
250
  builtinPluginDirectories = [];
247
251
  onGitHubTelemetry;
248
252
  clientGlobalHandlers = {};
@@ -401,6 +405,7 @@ class CopilotClient {
401
405
  this.sessionFsConfig = options.sessionFs ?? null;
402
406
  this.requestHandler = options.requestHandler ?? null;
403
407
  this.extensionLaunchProvider = options.extensionLaunchProvider;
408
+ this.installationConfirmationHandler = options.installationConfirmationHandler;
404
409
  this.onGitHubTelemetry = options.onGitHubTelemetry;
405
410
  this.setupClientGlobalHandlers();
406
411
  const connEnv = conn.kind === "stdio" || conn.kind === "tcp" ? conn.env : void 0;
@@ -1215,6 +1220,7 @@ class CopilotClient {
1215
1220
  includeSubAgentStreamingEvents: config.includeSubAgentStreamingEvents ?? true,
1216
1221
  ...this.onGitHubTelemetry != null ? { enableGitHubTelemetryForwarding: true } : {},
1217
1222
  mcpServers: toWireMcpServers(config.mcpServers),
1223
+ ...config.diagnostics !== void 0 ? { diagnostics: config.diagnostics } : {},
1218
1224
  mcpOAuthTokenStorage: config.mcpOAuthTokenStorage,
1219
1225
  authClientIdMetadataUrl: config.authClientIdMetadataUrl,
1220
1226
  envValueMode: "direct",
@@ -1224,6 +1230,7 @@ class CopilotClient {
1224
1230
  agent: config.agent,
1225
1231
  configDir: config.configDirectory,
1226
1232
  enableConfigDiscovery: config.enableConfigDiscovery,
1233
+ refreshCustomInstructions: config.refreshCustomInstructions,
1227
1234
  skipEmbeddingRetrieval: config.skipEmbeddingRetrieval,
1228
1235
  embeddingCacheStorage: config.embeddingCacheStorage,
1229
1236
  organizationCustomInstructions: config.organizationCustomInstructions,
@@ -1315,14 +1322,12 @@ class CopilotClient {
1315
1322
  async resumeSession(sessionId, config) {
1316
1323
  return this.resumeSessionInternal(sessionId, config);
1317
1324
  }
1325
+ /** @internal */
1318
1326
  async resumeSessionForExtension(sessionId, config, contributions = {}, extensionOptions) {
1319
1327
  return this.resumeSessionInternal(sessionId, config, contributions, extensionOptions);
1320
1328
  }
1321
1329
  async resumeSessionInternal(sessionId, config, contributions = {}, extensionOptions) {
1322
- const { factories, workflows } = Array.isArray(contributions) ? { factories: contributions, workflows: void 0 } : contributions;
1323
- if (factories !== void 0 && workflows !== void 0) {
1324
- throw new Error("Session configuration cannot include both factories and workflows");
1325
- }
1330
+ const { workflows } = contributions;
1326
1331
  if (config.gitHubToken !== void 0 && config.gitHubTokenProvider !== void 0) {
1327
1332
  throw new Error("gitHubToken and gitHubTokenProvider are mutually exclusive");
1328
1333
  }
@@ -1342,7 +1347,6 @@ class CopilotClient {
1342
1347
  session.registerTools(config.tools);
1343
1348
  session.registerCanvases(config.canvases);
1344
1349
  session.registerCommands(config.commands);
1345
- session.registerFactories(factories);
1346
1350
  session.registerWorkflows(workflows);
1347
1351
  const {
1348
1352
  wireProvider: bearerWireProvider,
@@ -1424,7 +1428,6 @@ class CopilotClient {
1424
1428
  })),
1425
1429
  toolSearch: config.toolSearch,
1426
1430
  canvases: config.canvases?.map((canvas) => canvas.declaration),
1427
- factories: factories?.map((factory) => factory.meta),
1428
1431
  workflows: workflows?.map((workflow) => workflow.meta),
1429
1432
  requestCanvasRenderer: config.requestCanvasRenderer,
1430
1433
  requestExtensions: config.requestExtensions,
@@ -1466,6 +1469,7 @@ class CopilotClient {
1466
1469
  includeSubAgentStreamingEvents: config.includeSubAgentStreamingEvents ?? true,
1467
1470
  ...this.onGitHubTelemetry != null ? { enableGitHubTelemetryForwarding: true } : {},
1468
1471
  mcpServers: toWireMcpServers(config.mcpServers),
1472
+ ...config.diagnostics !== void 0 ? { diagnostics: config.diagnostics } : {},
1469
1473
  mcpOAuthTokenStorage: config.mcpOAuthTokenStorage,
1470
1474
  authClientIdMetadataUrl: config.authClientIdMetadataUrl,
1471
1475
  envValueMode: "direct",
@@ -1886,6 +1890,9 @@ class CopilotClient {
1886
1890
  if (this.options.mode === "empty") {
1887
1891
  env.COPILOT_DISABLE_KEYTAR = "1";
1888
1892
  }
1893
+ if (this.options.mode !== "empty") {
1894
+ env.COPILOT_RUNTIME_PROCESS_FILE_LOGGING = "1";
1895
+ }
1889
1896
  if (this.options.telemetry) {
1890
1897
  const t = this.options.telemetry;
1891
1898
  env.COPILOT_OTEL_ENABLED = "true";
@@ -2260,6 +2267,16 @@ stderr: ${stderrOutput}` : ""}`
2260
2267
  return session.clientSessionApis;
2261
2268
  });
2262
2269
  registerClientGlobalApiHandlers(this.connection, this.clientGlobalHandlers);
2270
+ if (this.installationConfirmationHandler) {
2271
+ const confirmation = createInstallationConfirmationAdapter(
2272
+ this.connection,
2273
+ this.installationConfirmationHandler
2274
+ );
2275
+ this.connection.onRequest(
2276
+ "installations.confirm",
2277
+ (params, token) => confirmation.confirm(params, token)
2278
+ );
2279
+ }
2263
2280
  this.connection.onRequest(
2264
2281
  "hooks.invoke",
2265
2282
  async (params) => {
@@ -1,27 +1,7 @@
1
1
  import type { CopilotSession } from "./session.js";
2
2
  import { type PermissionHandler, type ResumeSessionConfig } from "./types.js";
3
- import type { FactoryHandle } from "./factory.js";
4
3
  import type { WorkflowHandle } from "./workflow.js";
5
4
  export { Canvas, CanvasError, createCanvas, type CanvasAction, type CanvasDeclaration, type CanvasHostContext, type CanvasJsonSchema, type CanvasOptions, } from "./canvas.js";
6
- type JoinSessionContributionConfig = {
7
- /**
8
- * Factory handles to register when the extension joins the session.
9
- *
10
- * @experimental Part of the experimental Agent Factories surface and may
11
- * change or be removed in future SDK or CLI releases.
12
- */
13
- factories?: FactoryHandle[];
14
- workflows?: never;
15
- } | {
16
- factories?: never;
17
- /**
18
- * Workflow handles to register when the extension joins the session.
19
- *
20
- * @experimental Part of the experimental Dynamic Workflows surface and may
21
- * change or be removed in future SDK or CLI releases.
22
- */
23
- workflows?: WorkflowHandle[];
24
- };
25
5
  export type JoinSessionConfig = Omit<ResumeSessionConfig, "onPermissionRequest" | "extensionSdkPath"> & {
26
6
  onPermissionRequest?: PermissionHandler;
27
7
  /**
@@ -53,10 +33,16 @@ export type JoinSessionConfig = Omit<ResumeSessionConfig, "onPermissionRequest"
53
33
  * ```
54
34
  */
55
35
  requestedEnvironmentVariables?: string[];
56
- } & JoinSessionContributionConfig;
57
- export type { ExtensionInfo, FactoryLimits, FactoryMeta } from "./types.js";
58
- export { defineFactory, FactoryResumeError, isFactoryRunTerminal, type RunOptions, type ResumeOptions, type FactoryResumeErrorCode, type SessionFactoryApi, type FactoryAgentOptions, type FactoryContext, type FactoryDefinition, type FactoryHandle, type FactoryJsonSchema, type JsonValue, type FactoryPipelineStage, type FactoryStepOptions, type FactoryRunResult, type FactoryRunStatus, type FactoryRunSummary, type FactoryListRunsOptions, type FactoryRunsPage, type FactoryRunDetail, type FactoryProgressPage, type FactoryProgressLine, type FactoryPhaseObservation, type FactoryPhaseStatus, type FactoryAgentSummary, } from "./factory.js";
59
- export { defineWorkflow, WorkflowResumeError, isWorkflowRunTerminal, type WorkflowRunOptions, type WorkflowResumeOptions, type WorkflowLimitOverrides, type WorkflowResumeErrorCode, type SessionWorkflowApi, type WorkflowAgentOptions, type WorkflowContext, type WorkflowDefinition, type WorkflowHandle, type WorkflowJsonSchema, type WorkflowLimits, type WorkflowMeta, type WorkflowPipelineStage, type WorkflowStepOptions, type WorkflowRunResult, type WorkflowRunStatus, type WorkflowRunSummary, type WorkflowListRunsOptions, type WorkflowRunsPage, type WorkflowRunDetail, type WorkflowProgressPage, type WorkflowProgressLine, type WorkflowPhaseObservation, type WorkflowPhaseStatus, type WorkflowAgentSummary, } from "./workflow.js";
36
+ /**
37
+ * Workflow handles to register when the extension joins the session.
38
+ *
39
+ * @experimental Part of the experimental Dynamic Workflows surface and may
40
+ * change or be removed in future SDK or CLI releases.
41
+ */
42
+ workflows?: WorkflowHandle[];
43
+ };
44
+ export type { ExtensionInfo } from "./types.js";
45
+ export { defineWorkflow, WorkflowResumeError, isWorkflowRunTerminal, type WorkflowRunOptions, type WorkflowResumeOptions, type WorkflowLimitOverrides, type WorkflowResumeErrorCode, type SessionWorkflowApi, type WorkflowAgentOptions, type WorkflowContext, type WorkflowDefinition, type WorkflowHandle, type JsonValue, type WorkflowJsonSchema, type WorkflowLimits, type WorkflowMeta, type WorkflowPipelineStage, type WorkflowStepOptions, type WorkflowRunResult, type WorkflowRunStatus, type WorkflowRunSummary, type WorkflowListRunsOptions, type WorkflowRunsPage, type WorkflowRunDetail, type WorkflowProgressPage, type WorkflowProgressLine, type WorkflowPhaseObservation, type WorkflowPhaseStatus, type WorkflowAgentSummary, } from "./workflow.js";
60
46
  /**
61
47
  * Joins the current foreground session.
62
48
  *
package/dist/extension.js CHANGED
@@ -7,11 +7,6 @@ import {
7
7
  CanvasError,
8
8
  createCanvas
9
9
  } from "./canvas.js";
10
- import {
11
- defineFactory,
12
- FactoryResumeError,
13
- isFactoryRunTerminal
14
- } from "./factory.js";
15
10
  import {
16
11
  defineWorkflow,
17
12
  WorkflowResumeError,
@@ -27,15 +22,11 @@ async function joinSession(config = {}) {
27
22
  const client = new CopilotClient({ _internalConnection: { kind: "parent-process" } });
28
23
  const {
29
24
  extensionSdkPath: _stripped,
30
- factories,
31
25
  workflows,
32
26
  requestedEnvironmentVariables,
33
27
  ...rest
34
28
  } = config;
35
29
  void _stripped;
36
- if (factories !== void 0 && workflows !== void 0) {
37
- throw new Error("joinSession cannot register both factories and workflows");
38
- }
39
30
  return client.resumeSessionForExtension(
40
31
  sessionId,
41
32
  {
@@ -43,19 +34,16 @@ async function joinSession(config = {}) {
43
34
  onPermissionRequest: config.onPermissionRequest ?? defaultJoinSessionPermissionHandler,
44
35
  suppressResumeEvent: config.suppressResumeEvent ?? true
45
36
  },
46
- { factories, workflows },
37
+ { workflows },
47
38
  requestedEnvironmentVariables?.length ? { requestedEnvironmentVariables } : void 0
48
39
  );
49
40
  }
50
41
  export {
51
42
  Canvas,
52
43
  CanvasError,
53
- FactoryResumeError,
54
44
  WorkflowResumeError,
55
45
  createCanvas,
56
- defineFactory,
57
46
  defineWorkflow,
58
- isFactoryRunTerminal,
59
47
  isWorkflowRunTerminal,
60
48
  joinSession
61
49
  };