Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion nodejs/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import type {
TraceContextProvider,
TypedSessionLifecycleHandler,
} from "./types.js";
import { defaultJoinSessionPermissionHandler } from "./types.js";

/**
* Minimum protocol version this SDK can communicate with.
Expand Down Expand Up @@ -868,7 +869,7 @@ export class CopilotClient {
})),
provider: config.provider,
modelCapabilities: config.modelCapabilities,
requestPermission: true,
requestPermission: config.onPermissionRequest !== defaultJoinSessionPermissionHandler,
Comment thread
MRayermannMSFT marked this conversation as resolved.
Outdated
requestUserInput: !!config.onUserInputRequest,
requestElicitation: !!config.onElicitationRequest,
hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
Expand Down
6 changes: 1 addition & 5 deletions nodejs/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

import { CopilotClient } from "./client.js";
import type { CopilotSession } from "./session.js";
import type { PermissionHandler, PermissionRequestResult, ResumeSessionConfig } from "./types.js";

const defaultJoinSessionPermissionHandler: PermissionHandler = (): PermissionRequestResult => ({
kind: "no-result",
});
import { defaultJoinSessionPermissionHandler, type PermissionHandler, type PermissionRequestResult, type ResumeSessionConfig } from "./types.js";

Check failure on line 7 in nodejs/src/extension.ts

View workflow job for this annotation

GitHub Actions / Node.js SDK Tests (macos-latest)

'PermissionRequestResult' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 7 in nodejs/src/extension.ts

View workflow job for this annotation

GitHub Actions / Node.js SDK Tests (windows-latest)

'PermissionRequestResult' is defined but never used. Allowed unused vars must match /^_/u
Comment thread
MRayermannMSFT marked this conversation as resolved.
Outdated

export type JoinSessionConfig = Omit<ResumeSessionConfig, "onPermissionRequest"> & {
onPermissionRequest?: PermissionHandler;
Expand Down
4 changes: 4 additions & 0 deletions nodejs/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,10 @@ export type PermissionHandler = (

export const approveAll: PermissionHandler = () => ({ kind: "approved" });

export const defaultJoinSessionPermissionHandler: PermissionHandler = (): PermissionRequestResult => ({
kind: "no-result",
});

// ============================================================================
// User Input Request Types
// ============================================================================
Expand Down
Loading