@github/copilot-sdk
Advanced tools
+55
-0
@@ -533,2 +533,8 @@ "use strict"; | ||
| } | ||
| if (config.onExitPlanMode) { | ||
| session.registerExitPlanModeHandler(config.onExitPlanMode); | ||
| } | ||
| if (config.onAutoModeSwitch) { | ||
| session.registerAutoModeSwitchHandler(config.onAutoModeSwitch); | ||
| } | ||
| if (config.hooks) { | ||
@@ -580,2 +586,3 @@ session.registerHooks(config.hooks); | ||
| provider: config.provider ? toWireProviderConfig(config.provider) : void 0, | ||
| enableSessionTelemetry: config.enableSessionTelemetry, | ||
| modelCapabilities: config.modelCapabilities, | ||
@@ -585,2 +592,4 @@ requestPermission: true, | ||
| requestElicitation: !!config.onElicitationRequest, | ||
| requestExitPlanMode: !!config.onExitPlanMode, | ||
| requestAutoModeSwitch: !!config.onAutoModeSwitch, | ||
| hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)), | ||
@@ -664,2 +673,8 @@ workingDirectory: config.workingDirectory, | ||
| } | ||
| if (config.onExitPlanMode) { | ||
| session.registerExitPlanModeHandler(config.onExitPlanMode); | ||
| } | ||
| if (config.onAutoModeSwitch) { | ||
| session.registerAutoModeSwitchHandler(config.onAutoModeSwitch); | ||
| } | ||
| if (config.hooks) { | ||
@@ -699,2 +714,3 @@ session.registerHooks(config.hooks); | ||
| excludedTools: config.excludedTools, | ||
| enableSessionTelemetry: config.enableSessionTelemetry, | ||
| tools: config.tools?.map((tool) => ({ | ||
@@ -716,2 +732,4 @@ name: tool.name, | ||
| requestElicitation: !!config.onElicitationRequest, | ||
| requestExitPlanMode: !!config.onExitPlanMode, | ||
| requestAutoModeSwitch: !!config.onAutoModeSwitch, | ||
| hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)), | ||
@@ -1342,2 +1360,10 @@ workingDirectory: config.workingDirectory, | ||
| this.connection.onRequest( | ||
| "exitPlanMode.request", | ||
| async (params) => await this.handleExitPlanModeRequest(params) | ||
| ); | ||
| this.connection.onRequest( | ||
| "autoModeSwitch.request", | ||
| async (params) => await this.handleAutoModeSwitchRequest(params) | ||
| ); | ||
| this.connection.onRequest( | ||
| "hooks.invoke", | ||
@@ -1408,2 +1434,31 @@ async (params) => await this.handleHooksInvoke(params) | ||
| } | ||
| async handleExitPlanModeRequest(params) { | ||
| if (!params || typeof params.sessionId !== "string" || typeof params.summary !== "string" || !Array.isArray(params.actions) || typeof params.recommendedAction !== "string") { | ||
| throw new Error("Invalid exit plan mode request payload"); | ||
| } | ||
| const session = this.sessions.get(params.sessionId); | ||
| if (!session) { | ||
| throw new Error(`Session not found: ${params.sessionId}`); | ||
| } | ||
| return await session._handleExitPlanModeRequest({ | ||
| summary: params.summary, | ||
| planContent: params.planContent, | ||
| actions: params.actions, | ||
| recommendedAction: params.recommendedAction | ||
| }); | ||
| } | ||
| async handleAutoModeSwitchRequest(params) { | ||
| if (!params || typeof params.sessionId !== "string") { | ||
| throw new Error("Invalid auto mode switch request payload"); | ||
| } | ||
| const session = this.sessions.get(params.sessionId); | ||
| if (!session) { | ||
| throw new Error(`Session not found: ${params.sessionId}`); | ||
| } | ||
| const response = await session._handleAutoModeSwitchRequest({ | ||
| errorCode: params.errorCode, | ||
| retryAfterSeconds: params.retryAfterSeconds | ||
| }); | ||
| return { response }; | ||
| } | ||
| async handleHooksInvoke(params) { | ||
@@ -1410,0 +1465,0 @@ if (!params || typeof params.sessionId !== "string" || typeof params.hookType !== "string") { |
+44
-0
@@ -52,2 +52,4 @@ "use strict"; | ||
| elicitationHandler; | ||
| exitPlanModeHandler; | ||
| autoModeSwitchHandler; | ||
| hooks; | ||
@@ -449,2 +451,20 @@ transformCallbacks; | ||
| /** | ||
| * Registers the exit-plan-mode handler for this session. | ||
| * | ||
| * @param handler - The handler to invoke when the server dispatches an exit-plan-mode request | ||
| * @internal This method is typically called internally when creating/resuming a session. | ||
| */ | ||
| registerExitPlanModeHandler(handler) { | ||
| this.exitPlanModeHandler = handler; | ||
| } | ||
| /** | ||
| * Registers the auto-mode-switch handler for this session. | ||
| * | ||
| * @param handler - The handler to invoke when the server dispatches an auto-mode-switch request | ||
| * @internal This method is typically called internally when creating/resuming a session. | ||
| */ | ||
| registerAutoModeSwitchHandler(handler) { | ||
| this.autoModeSwitchHandler = handler; | ||
| } | ||
| /** | ||
| * Handles an elicitation.requested broadcast event. | ||
@@ -475,2 +495,22 @@ * Invokes the registered handler and responds via handlePendingElicitation RPC. | ||
| /** | ||
| * Handles an exitPlanMode.request callback from the runtime. | ||
| * @internal | ||
| */ | ||
| async _handleExitPlanModeRequest(request) { | ||
| if (!this.exitPlanModeHandler) { | ||
| return { approved: true }; | ||
| } | ||
| return await this.exitPlanModeHandler(request, { sessionId: this.sessionId }); | ||
| } | ||
| /** | ||
| * Handles an autoModeSwitch.request callback from the runtime. | ||
| * @internal | ||
| */ | ||
| async _handleAutoModeSwitchRequest(request) { | ||
| if (!this.autoModeSwitchHandler) { | ||
| return "no"; | ||
| } | ||
| return await this.autoModeSwitchHandler(request, { sessionId: this.sessionId }); | ||
| } | ||
| /** | ||
| * Sets the host capabilities for this session. | ||
@@ -755,2 +795,6 @@ * | ||
| this.permissionHandler = void 0; | ||
| this.userInputHandler = void 0; | ||
| this.elicitationHandler = void 0; | ||
| this.exitPlanModeHandler = void 0; | ||
| this.autoModeSwitchHandler = void 0; | ||
| } | ||
@@ -757,0 +801,0 @@ /** |
@@ -54,5 +54,6 @@ "use strict"; | ||
| if (block.resource?.blob) { | ||
| const mimeType = block.resource.mimeType; | ||
| binaryResults.push({ | ||
| data: block.resource.blob, | ||
| mimeType: block.resource.mimeType ?? "application/octet-stream", | ||
| mimeType: typeof mimeType === "string" && mimeType ? mimeType : "application/octet-stream", | ||
| type: "resource", | ||
@@ -59,0 +60,0 @@ description: block.resource.uri |
+2
-0
@@ -458,2 +458,4 @@ import { createServerRpc } from "./generated/rpc.js"; | ||
| private handleUserInputRequest; | ||
| private handleExitPlanModeRequest; | ||
| private handleAutoModeSwitchRequest; | ||
| private handleHooksInvoke; | ||
@@ -460,0 +462,0 @@ private handleSystemMessageTransform; |
+55
-0
@@ -519,2 +519,8 @@ import { spawn } from "node:child_process"; | ||
| } | ||
| if (config.onExitPlanMode) { | ||
| session.registerExitPlanModeHandler(config.onExitPlanMode); | ||
| } | ||
| if (config.onAutoModeSwitch) { | ||
| session.registerAutoModeSwitchHandler(config.onAutoModeSwitch); | ||
| } | ||
| if (config.hooks) { | ||
@@ -566,2 +572,3 @@ session.registerHooks(config.hooks); | ||
| provider: config.provider ? toWireProviderConfig(config.provider) : void 0, | ||
| enableSessionTelemetry: config.enableSessionTelemetry, | ||
| modelCapabilities: config.modelCapabilities, | ||
@@ -571,2 +578,4 @@ requestPermission: true, | ||
| requestElicitation: !!config.onElicitationRequest, | ||
| requestExitPlanMode: !!config.onExitPlanMode, | ||
| requestAutoModeSwitch: !!config.onAutoModeSwitch, | ||
| hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)), | ||
@@ -650,2 +659,8 @@ workingDirectory: config.workingDirectory, | ||
| } | ||
| if (config.onExitPlanMode) { | ||
| session.registerExitPlanModeHandler(config.onExitPlanMode); | ||
| } | ||
| if (config.onAutoModeSwitch) { | ||
| session.registerAutoModeSwitchHandler(config.onAutoModeSwitch); | ||
| } | ||
| if (config.hooks) { | ||
@@ -685,2 +700,3 @@ session.registerHooks(config.hooks); | ||
| excludedTools: config.excludedTools, | ||
| enableSessionTelemetry: config.enableSessionTelemetry, | ||
| tools: config.tools?.map((tool) => ({ | ||
@@ -702,2 +718,4 @@ name: tool.name, | ||
| requestElicitation: !!config.onElicitationRequest, | ||
| requestExitPlanMode: !!config.onExitPlanMode, | ||
| requestAutoModeSwitch: !!config.onAutoModeSwitch, | ||
| hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)), | ||
@@ -1328,2 +1346,10 @@ workingDirectory: config.workingDirectory, | ||
| this.connection.onRequest( | ||
| "exitPlanMode.request", | ||
| async (params) => await this.handleExitPlanModeRequest(params) | ||
| ); | ||
| this.connection.onRequest( | ||
| "autoModeSwitch.request", | ||
| async (params) => await this.handleAutoModeSwitchRequest(params) | ||
| ); | ||
| this.connection.onRequest( | ||
| "hooks.invoke", | ||
@@ -1394,2 +1420,31 @@ async (params) => await this.handleHooksInvoke(params) | ||
| } | ||
| async handleExitPlanModeRequest(params) { | ||
| if (!params || typeof params.sessionId !== "string" || typeof params.summary !== "string" || !Array.isArray(params.actions) || typeof params.recommendedAction !== "string") { | ||
| throw new Error("Invalid exit plan mode request payload"); | ||
| } | ||
| const session = this.sessions.get(params.sessionId); | ||
| if (!session) { | ||
| throw new Error(`Session not found: ${params.sessionId}`); | ||
| } | ||
| return await session._handleExitPlanModeRequest({ | ||
| summary: params.summary, | ||
| planContent: params.planContent, | ||
| actions: params.actions, | ||
| recommendedAction: params.recommendedAction | ||
| }); | ||
| } | ||
| async handleAutoModeSwitchRequest(params) { | ||
| if (!params || typeof params.sessionId !== "string") { | ||
| throw new Error("Invalid auto mode switch request payload"); | ||
| } | ||
| const session = this.sessions.get(params.sessionId); | ||
| if (!session) { | ||
| throw new Error(`Session not found: ${params.sessionId}`); | ||
| } | ||
| const response = await session._handleAutoModeSwitchRequest({ | ||
| errorCode: params.errorCode, | ||
| retryAfterSeconds: params.retryAfterSeconds | ||
| }); | ||
| return { response }; | ||
| } | ||
| async handleHooksInvoke(params) { | ||
@@ -1396,0 +1451,0 @@ if (!params || typeof params.sessionId !== "string" || typeof params.hookType !== "string") { |
+1
-1
@@ -9,2 +9,2 @@ /** | ||
| export { defineTool, approveAll, convertMcpCallToolResult, createSessionFsAdapter, SYSTEM_PROMPT_SECTIONS, } from "./types.js"; | ||
| export type { CommandContext, CommandDefinition, CommandHandler, ConnectionState, CopilotClientOptions, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, InfiniteSessionConfig, InputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, MessageOptions, ModelBilling, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventType, SessionLifecycleHandler, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemPromptSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js"; | ||
| export type { CommandContext, CommandDefinition, CommandHandler, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, ConnectionState, CopilotClientOptions, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, InfiniteSessionConfig, InputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, MessageOptions, ModelBilling, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventType, SessionLifecycleHandler, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemPromptSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js"; |
+27
-1
@@ -8,3 +8,3 @@ /** | ||
| import type { ClientSessionApiHandlers } from "./generated/rpc.js"; | ||
| import type { CommandHandler, ElicitationHandler, ElicitationContext, MessageOptions, PermissionHandler, PermissionRequestResult, ReasoningEffort, ModelCapabilitiesOverride, SectionTransformFn, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionHooks, SessionUiApi, Tool, ToolHandler, TraceContextProvider, TypedSessionEventHandler, UserInputHandler, UserInputResponse } from "./types.js"; | ||
| import type { CommandHandler, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, ElicitationHandler, ElicitationContext, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, MessageOptions, PermissionHandler, PermissionRequestResult, ReasoningEffort, ModelCapabilitiesOverride, SectionTransformFn, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionHooks, SessionUiApi, Tool, ToolHandler, TraceContextProvider, TypedSessionEventHandler, UserInputHandler, UserInputResponse } from "./types.js"; | ||
| export declare const NO_RESULT_PERMISSION_V2_ERROR = "Permission handlers cannot return 'no-result' when connected to a protocol v2 server."; | ||
@@ -51,2 +51,4 @@ /** Assistant message event - the final response from the assistant. */ | ||
| private elicitationHandler?; | ||
| private exitPlanModeHandler?; | ||
| private autoModeSwitchHandler?; | ||
| private hooks?; | ||
@@ -252,2 +254,16 @@ private transformCallbacks?; | ||
| /** | ||
| * Registers the exit-plan-mode handler for this session. | ||
| * | ||
| * @param handler - The handler to invoke when the server dispatches an exit-plan-mode request | ||
| * @internal This method is typically called internally when creating/resuming a session. | ||
| */ | ||
| registerExitPlanModeHandler(handler?: ExitPlanModeHandler): void; | ||
| /** | ||
| * Registers the auto-mode-switch handler for this session. | ||
| * | ||
| * @param handler - The handler to invoke when the server dispatches an auto-mode-switch request | ||
| * @internal This method is typically called internally when creating/resuming a session. | ||
| */ | ||
| registerAutoModeSwitchHandler(handler?: AutoModeSwitchHandler): void; | ||
| /** | ||
| * Handles an elicitation.requested broadcast event. | ||
@@ -259,2 +275,12 @@ * Invokes the registered handler and responds via handlePendingElicitation RPC. | ||
| /** | ||
| * Handles an exitPlanMode.request callback from the runtime. | ||
| * @internal | ||
| */ | ||
| _handleExitPlanModeRequest(request: ExitPlanModeRequest): Promise<ExitPlanModeResult>; | ||
| /** | ||
| * Handles an autoModeSwitch.request callback from the runtime. | ||
| * @internal | ||
| */ | ||
| _handleAutoModeSwitchRequest(request: AutoModeSwitchRequest): Promise<AutoModeSwitchResponse>; | ||
| /** | ||
| * Sets the host capabilities for this session. | ||
@@ -261,0 +287,0 @@ * |
+44
-0
@@ -28,2 +28,4 @@ import { ConnectionError, ResponseError } from "vscode-jsonrpc/node.js"; | ||
| elicitationHandler; | ||
| exitPlanModeHandler; | ||
| autoModeSwitchHandler; | ||
| hooks; | ||
@@ -425,2 +427,20 @@ transformCallbacks; | ||
| /** | ||
| * Registers the exit-plan-mode handler for this session. | ||
| * | ||
| * @param handler - The handler to invoke when the server dispatches an exit-plan-mode request | ||
| * @internal This method is typically called internally when creating/resuming a session. | ||
| */ | ||
| registerExitPlanModeHandler(handler) { | ||
| this.exitPlanModeHandler = handler; | ||
| } | ||
| /** | ||
| * Registers the auto-mode-switch handler for this session. | ||
| * | ||
| * @param handler - The handler to invoke when the server dispatches an auto-mode-switch request | ||
| * @internal This method is typically called internally when creating/resuming a session. | ||
| */ | ||
| registerAutoModeSwitchHandler(handler) { | ||
| this.autoModeSwitchHandler = handler; | ||
| } | ||
| /** | ||
| * Handles an elicitation.requested broadcast event. | ||
@@ -451,2 +471,22 @@ * Invokes the registered handler and responds via handlePendingElicitation RPC. | ||
| /** | ||
| * Handles an exitPlanMode.request callback from the runtime. | ||
| * @internal | ||
| */ | ||
| async _handleExitPlanModeRequest(request) { | ||
| if (!this.exitPlanModeHandler) { | ||
| return { approved: true }; | ||
| } | ||
| return await this.exitPlanModeHandler(request, { sessionId: this.sessionId }); | ||
| } | ||
| /** | ||
| * Handles an autoModeSwitch.request callback from the runtime. | ||
| * @internal | ||
| */ | ||
| async _handleAutoModeSwitchRequest(request) { | ||
| if (!this.autoModeSwitchHandler) { | ||
| return "no"; | ||
| } | ||
| return await this.autoModeSwitchHandler(request, { sessionId: this.sessionId }); | ||
| } | ||
| /** | ||
| * Sets the host capabilities for this session. | ||
@@ -731,2 +771,6 @@ * | ||
| this.permissionHandler = void 0; | ||
| this.userInputHandler = void 0; | ||
| this.elicitationHandler = void 0; | ||
| this.exitPlanModeHandler = void 0; | ||
| this.autoModeSwitchHandler = void 0; | ||
| } | ||
@@ -733,0 +777,0 @@ /** |
@@ -9,3 +9,3 @@ import type { SessionFsHandler, SessionFsStatResult, SessionFsReaddirWithTypesEntry } from "./generated/rpc.js"; | ||
| /** | ||
| * Interface for session filesystem providers. Implementors use idiomatic | ||
| * Interface for session filesystem providers. Implementers use idiomatic | ||
| * TypeScript patterns: throw on error, return values directly. Use | ||
@@ -12,0 +12,0 @@ * {@link createSessionFsAdapter} to convert a provider into the |
+69
-1
@@ -654,2 +654,51 @@ /** | ||
| /** | ||
| * Request to exit plan mode and continue with a selected action. | ||
| */ | ||
| export interface ExitPlanModeRequest { | ||
| /** Summary of the plan or proposed next step. */ | ||
| summary: string; | ||
| /** Full plan content, when available. */ | ||
| planContent?: string; | ||
| /** Available actions the user can select. */ | ||
| actions: string[]; | ||
| /** The action recommended by the runtime. */ | ||
| recommendedAction: string; | ||
| } | ||
| /** | ||
| * Response to an exit-plan-mode request. | ||
| */ | ||
| export interface ExitPlanModeResult { | ||
| /** Whether the user approved exiting plan mode. */ | ||
| approved: boolean; | ||
| /** Selected action, if the user chose one. */ | ||
| selectedAction?: string; | ||
| /** Optional feedback provided by the user. */ | ||
| feedback?: string; | ||
| } | ||
| /** | ||
| * Handler for exit-plan-mode requests from the agent. | ||
| */ | ||
| export type ExitPlanModeHandler = (request: ExitPlanModeRequest, invocation: { | ||
| sessionId: string; | ||
| }) => Promise<ExitPlanModeResult> | ExitPlanModeResult; | ||
| /** | ||
| * Request to switch to auto mode after an eligible rate limit. | ||
| */ | ||
| export interface AutoModeSwitchRequest { | ||
| /** The rate-limit error code that triggered the request. */ | ||
| errorCode?: string; | ||
| /** Seconds until the rate limit resets, when known. */ | ||
| retryAfterSeconds?: number; | ||
| } | ||
| /** | ||
| * Response to an auto-mode-switch request. | ||
| */ | ||
| export type AutoModeSwitchResponse = "yes" | "yes_always" | "no"; | ||
| /** | ||
| * Handler for auto-mode-switch requests from the agent. | ||
| */ | ||
| export type AutoModeSwitchHandler = (request: AutoModeSwitchRequest, invocation: { | ||
| sessionId: string; | ||
| }) => Promise<AutoModeSwitchResponse> | AutoModeSwitchResponse; | ||
| /** | ||
| * Base interface for all hook inputs | ||
@@ -1025,2 +1074,11 @@ */ | ||
| /** | ||
| * Enables or disables internal session telemetry for this session. | ||
| * When `false`, disables session telemetry. When omitted (the default) or `true`, | ||
| * telemetry is enabled for GitHub-authenticated sessions. | ||
| * When a custom {@link provider} (BYOK) is configured, session telemetry is always | ||
| * disabled regardless of this setting. | ||
| * This is independent of the OpenTelemetry configuration in {@link CopilotClientOptions.telemetry}. | ||
| */ | ||
| enableSessionTelemetry?: boolean; | ||
| /** | ||
| * Handler for permission requests from the server. | ||
@@ -1042,2 +1100,12 @@ * When provided, the server will call this handler to request permission for operations. | ||
| /** | ||
| * Handler for exit-plan-mode requests from the agent. | ||
| * When provided, enables `exitPlanMode.request` callbacks. | ||
| */ | ||
| onExitPlanMode?: ExitPlanModeHandler; | ||
| /** | ||
| * Handler for auto-mode-switch requests from the agent. | ||
| * When provided, enables `autoModeSwitch.request` callbacks. | ||
| */ | ||
| onAutoModeSwitch?: AutoModeSwitchHandler; | ||
| /** | ||
| * Hook handlers for intercepting session lifecycle events. | ||
@@ -1133,3 +1201,3 @@ * When provided, enables hooks callback allowing custom logic at various points. | ||
| */ | ||
| export type ResumeSessionConfig = Pick<SessionConfig, "clientName" | "model" | "tools" | "commands" | "systemMessage" | "availableTools" | "excludedTools" | "provider" | "modelCapabilities" | "streaming" | "includeSubAgentStreamingEvents" | "reasoningEffort" | "onPermissionRequest" | "onUserInputRequest" | "onElicitationRequest" | "hooks" | "workingDirectory" | "configDir" | "enableConfigDiscovery" | "mcpServers" | "customAgents" | "defaultAgent" | "agent" | "skillDirectories" | "instructionDirectories" | "disabledSkills" | "infiniteSessions" | "gitHubToken" | "onEvent" | "createSessionFsHandler"> & { | ||
| export type ResumeSessionConfig = Pick<SessionConfig, "clientName" | "model" | "tools" | "commands" | "systemMessage" | "availableTools" | "excludedTools" | "provider" | "enableSessionTelemetry" | "modelCapabilities" | "streaming" | "includeSubAgentStreamingEvents" | "reasoningEffort" | "onPermissionRequest" | "onUserInputRequest" | "onElicitationRequest" | "onExitPlanMode" | "onAutoModeSwitch" | "hooks" | "workingDirectory" | "configDir" | "enableConfigDiscovery" | "mcpServers" | "customAgents" | "defaultAgent" | "agent" | "skillDirectories" | "instructionDirectories" | "disabledSkills" | "infiniteSessions" | "gitHubToken" | "onEvent" | "createSessionFsHandler"> & { | ||
| /** | ||
@@ -1136,0 +1204,0 @@ * When true, skips emitting the session.resume event. |
+2
-1
@@ -26,5 +26,6 @@ import { createSessionFsAdapter } from "./sessionFsProvider.js"; | ||
| if (block.resource?.blob) { | ||
| const mimeType = block.resource.mimeType; | ||
| binaryResults.push({ | ||
| data: block.resource.blob, | ||
| mimeType: block.resource.mimeType ?? "application/octet-stream", | ||
| mimeType: typeof mimeType === "string" && mimeType ? mimeType : "application/octet-stream", | ||
| type: "resource", | ||
@@ -31,0 +32,0 @@ description: block.resource.uri |
+2
-2
@@ -7,3 +7,3 @@ { | ||
| }, | ||
| "version": "1.0.0-beta.2", | ||
| "version": "1.0.0-beta.3", | ||
| "description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC", | ||
@@ -60,3 +60,3 @@ "main": "./dist/cjs/index.js", | ||
| "dependencies": { | ||
| "@github/copilot": "^1.0.43-0", | ||
| "@github/copilot": "^1.0.44-2", | ||
| "vscode-jsonrpc": "^8.2.1", | ||
@@ -63,0 +63,0 @@ "zod": "^4.3.6" |
+1
-1
@@ -41,3 +41,3 @@ # Copilot SDK for Node.js/TypeScript | ||
| // Wait for response using typed event handlers | ||
| // Wait for the response using typed event handlers | ||
| const done = new Promise<void>((resolve) => { | ||
@@ -44,0 +44,0 @@ session.on("assistant.message", (event) => { |
Sorry, the diff of this file is too big to display
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
593817
2.05%16137
1.91%Updated