@microsoft/copilot-sdk 2.0.0-preview.0 → 2.0.0-preview.1

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.
@@ -1,10 +1,12 @@
1
1
  import { CopilotClient } from "./client.js";
2
2
  import type { CopilotSession } from "./session.js";
3
- import { type PermissionHandler, type ResumeSessionConfig } from "./types.js";
3
+ import { type ResumeSessionOptions, type SessionExtensionOptions, type SessionSkillOptions, type SessionToolOptions } from "./types.js";
4
4
  import type { WorkflowHandle } from "./workflow.js";
5
5
  export { Canvas, CanvasError, createCanvas, type CanvasAction, type CanvasDeclaration, type CanvasHostContext, type CanvasJsonSchema, type CanvasOptions, } from "./canvas.js";
6
- export type JoinSessionConfig = Omit<ResumeSessionConfig, "onPermissionRequest" | "extensionSdkPath" | "skillProvider" | "imageGeneration"> & {
7
- onPermissionRequest?: PermissionHandler;
6
+ export type JoinSessionOptions = Omit<ResumeSessionOptions, "extensions" | "skills" | "tools"> & {
7
+ extensions?: Omit<SessionExtensionOptions, "sdkPath">;
8
+ skills?: Omit<SessionSkillOptions, "provider">;
9
+ tools?: Omit<SessionToolOptions, "imageGeneration">;
8
10
  /**
9
11
  * Names of sensitive environment variables this extension needs, such as
10
12
  * `"GITHUB_TOKEN"`.
@@ -63,7 +65,7 @@ export { defineWorkflow, WorkflowResumeError, isWorkflowRunTerminal, type Workfl
63
65
  * ```typescript
64
66
  * import { joinSession } from "@microsoft/copilot-sdk/extension";
65
67
  *
66
- * const session = await joinSession({ tools: [myTool] });
68
+ * const session = await joinSession({ tools: { definitions: [myTool] } });
67
69
  * ```
68
70
  */
69
- export declare function joinSession(config?: JoinSessionConfig): Promise<JoinedSession>;
71
+ export declare function joinSession(config?: JoinSessionOptions): Promise<JoinedSession>;
package/dist/extension.js CHANGED
@@ -23,14 +23,10 @@ async function joinSession(config = {}) {
23
23
  mode: "coding-agent",
24
24
  _internalConnection: { kind: "parent-process" }
25
25
  });
26
- const {
27
- extensionSdkPath: _stripped,
28
- skillProvider: _strippedSkillProvider,
29
- imageGeneration: _strippedImageGeneration,
30
- workflows,
31
- requestedEnvironmentVariables,
32
- ...rest
33
- } = config;
26
+ const { workflows, requestedEnvironmentVariables, ...rest } = config;
27
+ const { sdkPath: _stripped, ...extensions } = config.extensions ?? {};
28
+ const { provider: _strippedSkillProvider, ...skills } = config.skills ?? {};
29
+ const { imageGeneration: _strippedImageGeneration, ...tools } = config.tools ?? {};
34
30
  void _stripped;
35
31
  void _strippedSkillProvider;
36
32
  void _strippedImageGeneration;
@@ -38,7 +34,13 @@ async function joinSession(config = {}) {
38
34
  sessionId,
39
35
  {
40
36
  ...rest,
41
- onPermissionRequest: config.onPermissionRequest ?? defaultJoinSessionPermissionHandler,
37
+ extensions,
38
+ skills,
39
+ tools,
40
+ permissions: {
41
+ ...rest.permissions,
42
+ onRequest: config.permissions?.onRequest ?? defaultJoinSessionPermissionHandler
43
+ },
42
44
  suppressResumeEvent: config.suppressResumeEvent ?? true
43
45
  },
44
46
  { workflows },