@github/copilot-sdk
Advanced tools
+11
-3
@@ -24,2 +24,8 @@ import { spawn } from "node:child_process"; | ||
| } | ||
| function getNodeExecPath() { | ||
| if (process.versions.bun) { | ||
| return "node"; | ||
| } | ||
| return process.execPath; | ||
| } | ||
| function getBundledCliPath() { | ||
@@ -358,2 +364,3 @@ const sdkUrl = import.meta.resolve("@github/copilot/sdk"); | ||
| sessionId: config.sessionId, | ||
| clientName: config.clientName, | ||
| reasoningEffort: config.reasoningEffort, | ||
@@ -369,3 +376,3 @@ tools: config.tools?.map((tool) => ({ | ||
| provider: config.provider, | ||
| requestPermission: !!config.onPermissionRequest, | ||
| requestPermission: true, | ||
| requestUserInput: !!config.onUserInputRequest, | ||
@@ -431,2 +438,3 @@ hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)), | ||
| sessionId, | ||
| clientName: config.clientName, | ||
| model: config.model, | ||
@@ -443,3 +451,3 @@ reasoningEffort: config.reasoningEffort, | ||
| provider: config.provider, | ||
| requestPermission: !!config.onPermissionRequest, | ||
| requestPermission: true, | ||
| requestUserInput: !!config.onUserInputRequest, | ||
@@ -769,3 +777,3 @@ hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)), | ||
| if (isJsFile) { | ||
| this.cliProcess = spawn(process.execPath, [this.options.cliPath, ...args], { | ||
| this.cliProcess = spawn(getNodeExecPath(), [this.options.cliPath, ...args], { | ||
| stdio: stdioConfig, | ||
@@ -772,0 +780,0 @@ cwd: this.options.cwd, |
+1
-1
@@ -8,3 +8,3 @@ /** | ||
| export { CopilotSession, type AssistantMessageEvent } from "./session.js"; | ||
| export { defineTool } from "./types.js"; | ||
| export { defineTool, approveAll } from "./types.js"; | ||
| export type { ConnectionState, CopilotClientOptions, CustomAgentConfig, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, InfiniteSessionConfig, MCPLocalServerConfig, MCPRemoteServerConfig, MCPServerConfig, MessageOptions, ModelBilling, ModelCapabilities, ModelInfo, ModelPolicy, PermissionHandler, PermissionRequest, PermissionRequestResult, ResumeSessionConfig, SessionConfig, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventType, SessionLifecycleHandler, SessionContext, SessionListFilter, SessionMetadata, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageReplaceConfig, Tool, ToolHandler, ToolInvocation, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js"; |
+2
-1
| import { CopilotClient } from "./client.js"; | ||
| import { CopilotSession } from "./session.js"; | ||
| import { defineTool } from "./types.js"; | ||
| import { defineTool, approveAll } from "./types.js"; | ||
| export { | ||
| CopilotClient, | ||
| CopilotSession, | ||
| approveAll, | ||
| defineTool | ||
| }; |
+7
-1
@@ -182,2 +182,3 @@ /** | ||
| }) => Promise<PermissionRequestResult> | PermissionRequestResult; | ||
| export declare const approveAll: PermissionHandler; | ||
| /** | ||
@@ -505,2 +506,7 @@ * Request for user input from the agent (enables ask_user tool) | ||
| /** | ||
| * Client name to identify the application using the SDK. | ||
| * Included in the User-Agent header for API requests. | ||
| */ | ||
| clientName?: string; | ||
| /** | ||
| * Model to use for this session | ||
@@ -592,3 +598,3 @@ */ | ||
| */ | ||
| export type ResumeSessionConfig = Pick<SessionConfig, "model" | "tools" | "systemMessage" | "availableTools" | "excludedTools" | "provider" | "streaming" | "reasoningEffort" | "onPermissionRequest" | "onUserInputRequest" | "hooks" | "workingDirectory" | "configDir" | "mcpServers" | "customAgents" | "skillDirectories" | "disabledSkills" | "infiniteSessions"> & { | ||
| export type ResumeSessionConfig = Pick<SessionConfig, "clientName" | "model" | "tools" | "systemMessage" | "availableTools" | "excludedTools" | "provider" | "streaming" | "reasoningEffort" | "onPermissionRequest" | "onUserInputRequest" | "hooks" | "workingDirectory" | "configDir" | "mcpServers" | "customAgents" | "skillDirectories" | "disabledSkills" | "infiniteSessions"> & { | ||
| /** | ||
@@ -595,0 +601,0 @@ * When true, skips emitting the session.resume event. |
+2
-0
| function defineTool(name, config) { | ||
| return { name, ...config }; | ||
| } | ||
| const approveAll = () => ({ kind: "approved" }); | ||
| export { | ||
| approveAll, | ||
| defineTool | ||
| }; |
+1
-1
@@ -7,3 +7,3 @@ { | ||
| }, | ||
| "version": "0.1.25", | ||
| "version": "0.1.26-preview.0", | ||
| "description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC", | ||
@@ -10,0 +10,0 @@ "main": "./dist/index.js", |
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
150153
0.32%4103
0.42%