@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/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;
@@ -1317,14 +1322,12 @@ class CopilotClient {
1317
1322
  async resumeSession(sessionId, config) {
1318
1323
  return this.resumeSessionInternal(sessionId, config);
1319
1324
  }
1325
+ /** @internal */
1320
1326
  async resumeSessionForExtension(sessionId, config, contributions = {}, extensionOptions) {
1321
1327
  return this.resumeSessionInternal(sessionId, config, contributions, extensionOptions);
1322
1328
  }
1323
1329
  async resumeSessionInternal(sessionId, config, contributions = {}, extensionOptions) {
1324
- const { factories, workflows } = Array.isArray(contributions) ? { factories: contributions, workflows: void 0 } : contributions;
1325
- if (factories !== void 0 && workflows !== void 0) {
1326
- throw new Error("Session configuration cannot include both factories and workflows");
1327
- }
1330
+ const { workflows } = contributions;
1328
1331
  if (config.gitHubToken !== void 0 && config.gitHubTokenProvider !== void 0) {
1329
1332
  throw new Error("gitHubToken and gitHubTokenProvider are mutually exclusive");
1330
1333
  }
@@ -1344,7 +1347,6 @@ class CopilotClient {
1344
1347
  session.registerTools(config.tools);
1345
1348
  session.registerCanvases(config.canvases);
1346
1349
  session.registerCommands(config.commands);
1347
- session.registerFactories(factories);
1348
1350
  session.registerWorkflows(workflows);
1349
1351
  const {
1350
1352
  wireProvider: bearerWireProvider,
@@ -1426,7 +1428,6 @@ class CopilotClient {
1426
1428
  })),
1427
1429
  toolSearch: config.toolSearch,
1428
1430
  canvases: config.canvases?.map((canvas) => canvas.declaration),
1429
- factories: factories?.map((factory) => factory.meta),
1430
1431
  workflows: workflows?.map((workflow) => workflow.meta),
1431
1432
  requestCanvasRenderer: config.requestCanvasRenderer,
1432
1433
  requestExtensions: config.requestExtensions,
@@ -1889,6 +1890,9 @@ class CopilotClient {
1889
1890
  if (this.options.mode === "empty") {
1890
1891
  env.COPILOT_DISABLE_KEYTAR = "1";
1891
1892
  }
1893
+ if (this.options.mode !== "empty") {
1894
+ env.COPILOT_RUNTIME_PROCESS_FILE_LOGGING = "1";
1895
+ }
1892
1896
  if (this.options.telemetry) {
1893
1897
  const t = this.options.telemetry;
1894
1898
  env.COPILOT_OTEL_ENABLED = "true";
@@ -2263,6 +2267,16 @@ stderr: ${stderrOutput}` : ""}`
2263
2267
  return session.clientSessionApis;
2264
2268
  });
2265
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
+ }
2266
2280
  this.connection.onRequest(
2267
2281
  "hooks.invoke",
2268
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
  };