@github/copilot-sdk
Advanced tools
+14
-1
| import { CopilotSession } from "./session.js"; | ||
| import type { ConnectionState, CopilotClientOptions, ResumeSessionConfig, SessionConfig, SessionMetadata } from "./types.js"; | ||
| import type { ConnectionState, CopilotClientOptions, GetAuthStatusResponse, GetStatusResponse, ModelInfo, ResumeSessionConfig, SessionConfig, SessionMetadata } from "./types.js"; | ||
| /** | ||
@@ -224,2 +224,15 @@ * Main client for interacting with the Copilot CLI. | ||
| /** | ||
| * Get CLI status including version and protocol information | ||
| */ | ||
| getStatus(): Promise<GetStatusResponse>; | ||
| /** | ||
| * Get current authentication status | ||
| */ | ||
| getAuthStatus(): Promise<GetAuthStatusResponse>; | ||
| /** | ||
| * List available models with their metadata | ||
| * @throws Error if not authenticated | ||
| */ | ||
| listModels(): Promise<ModelInfo[]>; | ||
| /** | ||
| * Verify that the server's protocol version matches the SDK's expected version | ||
@@ -226,0 +239,0 @@ */ |
+41
-4
@@ -8,4 +8,4 @@ import { spawn } from "node:child_process"; | ||
| } from "vscode-jsonrpc/node.js"; | ||
| import { getSdkProtocolVersion } from "./sdkProtocolVersion.js"; | ||
| import { CopilotSession } from "./session.js"; | ||
| import { getSdkProtocolVersion } from "./sdkProtocolVersion.js"; | ||
| function isZodSchema(value) { | ||
@@ -71,3 +71,3 @@ return value != null && typeof value === "object" && "toJSONSchema" in value && typeof value.toJSONSchema === "function"; | ||
| cliUrl: options.cliUrl, | ||
| logLevel: options.logLevel || "info", | ||
| logLevel: options.logLevel || "debug", | ||
| autoStart: options.autoStart ?? true, | ||
@@ -324,3 +324,6 @@ autoRestart: options.autoRestart ?? true, | ||
| mcpServers: config.mcpServers, | ||
| customAgents: config.customAgents | ||
| customAgents: config.customAgents, | ||
| configDir: config.configDir, | ||
| skillDirectories: config.skillDirectories, | ||
| disabledSkills: config.disabledSkills | ||
| }); | ||
@@ -378,3 +381,5 @@ const sessionId = response.sessionId; | ||
| mcpServers: config.mcpServers, | ||
| customAgents: config.customAgents | ||
| customAgents: config.customAgents, | ||
| skillDirectories: config.skillDirectories, | ||
| disabledSkills: config.disabledSkills | ||
| }); | ||
@@ -426,2 +431,34 @@ const resumedSessionId = response.sessionId; | ||
| /** | ||
| * Get CLI status including version and protocol information | ||
| */ | ||
| async getStatus() { | ||
| if (!this.connection) { | ||
| throw new Error("Client not connected"); | ||
| } | ||
| const result = await this.connection.sendRequest("status.get", {}); | ||
| return result; | ||
| } | ||
| /** | ||
| * Get current authentication status | ||
| */ | ||
| async getAuthStatus() { | ||
| if (!this.connection) { | ||
| throw new Error("Client not connected"); | ||
| } | ||
| const result = await this.connection.sendRequest("auth.getStatus", {}); | ||
| return result; | ||
| } | ||
| /** | ||
| * List available models with their metadata | ||
| * @throws Error if not authenticated | ||
| */ | ||
| async listModels() { | ||
| if (!this.connection) { | ||
| throw new Error("Client not connected"); | ||
| } | ||
| const result = await this.connection.sendRequest("models.list", {}); | ||
| const response = result; | ||
| return response.models; | ||
| } | ||
| /** | ||
| * Verify that the server's protocol version matches the SDK's expected version | ||
@@ -428,0 +465,0 @@ */ |
@@ -6,3 +6,3 @@ /** | ||
| * Generated by: scripts/generate-session-types.ts | ||
| * Generated at: 2026-01-20T04:18:06.227Z | ||
| * Generated at: 2026-01-22T04:11:04.988Z | ||
| * | ||
@@ -335,2 +335,12 @@ * To update these types: | ||
| parentId: string | null; | ||
| ephemeral: true; | ||
| type: "tool.execution_progress"; | ||
| data: { | ||
| toolCallId: string; | ||
| progressMessage: string; | ||
| }; | ||
| } | { | ||
| id: string; | ||
| timestamp: string; | ||
| parentId: string | null; | ||
| ephemeral?: boolean; | ||
@@ -337,0 +347,0 @@ type: "tool.execution_complete"; |
+1
-1
@@ -9,2 +9,2 @@ /** | ||
| export { defineTool } from "./types.js"; | ||
| export type { ConnectionState, CopilotClientOptions, CustomAgentConfig, MCPLocalServerConfig, MCPRemoteServerConfig, MCPServerConfig, MessageOptions, PermissionHandler, PermissionRequest, PermissionRequestResult, ResumeSessionConfig, SessionConfig, SessionEvent, SessionEventHandler, SessionMetadata, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageReplaceConfig, Tool, ToolHandler, ToolInvocation, ToolResultObject, ZodSchema, } from "./types.js"; | ||
| export type { ConnectionState, CopilotClientOptions, CustomAgentConfig, GetAuthStatusResponse, GetStatusResponse, MCPLocalServerConfig, MCPRemoteServerConfig, MCPServerConfig, MessageOptions, ModelBilling, ModelCapabilities, ModelInfo, ModelPolicy, PermissionHandler, PermissionRequest, PermissionRequestResult, ResumeSessionConfig, SessionConfig, SessionEvent, SessionEventHandler, SessionMetadata, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageReplaceConfig, Tool, ToolHandler, ToolInvocation, ToolResultObject, ZodSchema, } from "./types.js"; |
@@ -5,3 +5,3 @@ /** | ||
| */ | ||
| export declare const SDK_PROTOCOL_VERSION = 1; | ||
| export declare const SDK_PROTOCOL_VERSION = 2; | ||
| /** | ||
@@ -8,0 +8,0 @@ * Gets the SDK protocol version. |
@@ -1,2 +0,2 @@ | ||
| const SDK_PROTOCOL_VERSION = 1; | ||
| const SDK_PROTOCOL_VERSION = 2; | ||
| function getSdkProtocolVersion() { | ||
@@ -3,0 +3,0 @@ return SDK_PROTOCOL_VERSION; |
+83
-1
@@ -264,2 +264,7 @@ /** | ||
| /** | ||
| * Override the default configuration directory location. | ||
| * When specified, the session will use this directory for storing config and state. | ||
| */ | ||
| configDir?: string; | ||
| /** | ||
| * Tools exposed to the CLI server | ||
@@ -303,2 +308,10 @@ */ | ||
| customAgents?: CustomAgentConfig[]; | ||
| /** | ||
| * Directories to load skills from. | ||
| */ | ||
| skillDirectories?: string[]; | ||
| /** | ||
| * List of skill names to disable. | ||
| */ | ||
| disabledSkills?: string[]; | ||
| } | ||
@@ -308,3 +321,3 @@ /** | ||
| */ | ||
| export type ResumeSessionConfig = Pick<SessionConfig, "tools" | "provider" | "streaming" | "onPermissionRequest" | "mcpServers" | "customAgents">; | ||
| export type ResumeSessionConfig = Pick<SessionConfig, "tools" | "provider" | "streaming" | "onPermissionRequest" | "mcpServers" | "customAgents" | "skillDirectories" | "disabledSkills">; | ||
| /** | ||
@@ -387,2 +400,71 @@ * Configuration for a custom API provider. | ||
| } | ||
| /** | ||
| * Response from status.get | ||
| */ | ||
| export interface GetStatusResponse { | ||
| /** Package version (e.g., "1.0.0") */ | ||
| version: string; | ||
| /** Protocol version for SDK compatibility */ | ||
| protocolVersion: number; | ||
| } | ||
| /** | ||
| * Response from auth.getStatus | ||
| */ | ||
| export interface GetAuthStatusResponse { | ||
| /** Whether the user is authenticated */ | ||
| isAuthenticated: boolean; | ||
| /** Authentication type */ | ||
| authType?: "user" | "env" | "gh-cli" | "hmac" | "api-key" | "token"; | ||
| /** GitHub host URL */ | ||
| host?: string; | ||
| /** User login name */ | ||
| login?: string; | ||
| /** Human-readable status message */ | ||
| statusMessage?: string; | ||
| } | ||
| /** | ||
| * Model capabilities and limits | ||
| */ | ||
| export interface ModelCapabilities { | ||
| supports: { | ||
| vision: boolean; | ||
| }; | ||
| limits: { | ||
| max_prompt_tokens?: number; | ||
| max_context_window_tokens: number; | ||
| vision?: { | ||
| supported_media_types: string[]; | ||
| max_prompt_images: number; | ||
| max_prompt_image_size: number; | ||
| }; | ||
| }; | ||
| } | ||
| /** | ||
| * Model policy state | ||
| */ | ||
| export interface ModelPolicy { | ||
| state: "enabled" | "disabled" | "unconfigured"; | ||
| terms: string; | ||
| } | ||
| /** | ||
| * Model billing information | ||
| */ | ||
| export interface ModelBilling { | ||
| multiplier: number; | ||
| } | ||
| /** | ||
| * Information about an available model | ||
| */ | ||
| export interface ModelInfo { | ||
| /** Model identifier (e.g., "claude-sonnet-4.5") */ | ||
| id: string; | ||
| /** Display name */ | ||
| name: string; | ||
| /** Model capabilities and limits */ | ||
| capabilities: ModelCapabilities; | ||
| /** Policy state */ | ||
| policy?: ModelPolicy; | ||
| /** Billing information */ | ||
| billing?: ModelBilling; | ||
| } | ||
| export {}; |
+2
-2
@@ -7,3 +7,3 @@ { | ||
| }, | ||
| "version": "0.1.15-preview.0", | ||
| "version": "0.1.15", | ||
| "description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC", | ||
@@ -44,3 +44,3 @@ "main": "./dist/index.js", | ||
| "dependencies": { | ||
| "@github/copilot": "^0.0.387", | ||
| "@github/copilot": "^0.0.389", | ||
| "vscode-jsonrpc": "^8.2.1", | ||
@@ -47,0 +47,0 @@ "zod": "^4.3.5" |
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
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
81487
4.99%2612
5.79%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated