🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@github/copilot-sdk

Package Overview
Dependencies
Maintainers
24
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@github/copilot-sdk - npm Package Compare versions

Comparing version
1.0.7-preview.0
to
1.0.7-preview.1
+282
dist/cjs/ffiRuntimeHost.js
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var ffiRuntimeHost_exports = {};
__export(ffiRuntimeHost_exports, {
FfiRuntimeHost: () => FfiRuntimeHost
});
module.exports = __toCommonJS(ffiRuntimeHost_exports);
var import_node_fs = require("node:fs");
var import_koffi = __toESM(require("koffi"), 1);
var import_node_path = require("node:path");
var import_node_stream = require("node:stream");
const SYMBOL_PREFIX = "copilot_runtime_";
const KEEP_ALIVE_INTERVAL_MS = 1 << 30;
let loadedLibraryPath;
let loadedLibrary;
function loadLibrary(libraryPath) {
if (loadedLibrary) {
if (loadedLibraryPath !== libraryPath) {
throw new Error(
`An in-process FFI runtime library is already loaded from '${loadedLibraryPath}'; loading a different library from '${libraryPath}' in the same process is not supported.`
);
}
return loadedLibrary;
}
const lib = import_koffi.default.load(libraryPath);
const outboundCallbackType = import_koffi.default.pointer(
import_koffi.default.proto(
`void ${SYMBOL_PREFIX}outbound(void *userData, uint8 *bytesPtr, size_t bytesLen)`
)
);
loadedLibrary = {
hostStart: lib.func(`${SYMBOL_PREFIX}host_start`, "uint32", [
"uint8*",
"size_t",
"uint8*",
"size_t"
]),
hostShutdown: lib.func(`${SYMBOL_PREFIX}host_shutdown`, "bool", ["uint32"]),
connectionOpen: lib.func(`${SYMBOL_PREFIX}connection_open`, "uint32", [
"uint32",
outboundCallbackType,
"void*",
"uint8*",
"size_t",
"uint8*",
"size_t",
"uint8*",
"size_t"
]),
connectionWrite: lib.func(`${SYMBOL_PREFIX}connection_write`, "bool", [
"uint32",
"uint8*",
"size_t"
]),
connectionClose: lib.func(`${SYMBOL_PREFIX}connection_close`, "bool", ["uint32"]),
outboundCallbackType
};
loadedLibraryPath = libraryPath;
return loadedLibrary;
}
function buildArgvJson(cliEntrypoint) {
const argv = cliEntrypoint.toLowerCase().endsWith(".js") ? ["node", cliEntrypoint, "--embedded-host", "--no-auto-update"] : [cliEntrypoint, "--embedded-host", "--no-auto-update"];
return Buffer.from(JSON.stringify(argv), "utf8");
}
function buildEnvJson(environment) {
if (!environment) {
return null;
}
const obj = {};
for (const [key, value] of Object.entries(environment)) {
if (value !== void 0) {
obj[key] = value;
}
}
if (Object.keys(obj).length === 0) {
return null;
}
return Buffer.from(JSON.stringify(obj), "utf8");
}
class FfiRuntimeHost {
constructor(libraryPath, cliEntrypoint, environment) {
this.libraryPath = libraryPath;
this.cliEntrypoint = cliEntrypoint;
this.environment = environment;
this.lib = loadLibrary(libraryPath);
this.receiveStream = new import_node_stream.PassThrough();
this.sendStream = new import_node_stream.Writable({
// connection_write enqueues the frame into the runtime's inbound channel and
// returns immediately, so a synchronous FFI call is sufficient here.
write: (chunk, _encoding, callback) => {
try {
this.writeFrame(chunk);
callback();
} catch (error) {
callback(error);
}
}
});
}
libraryPath;
cliEntrypoint;
environment;
lib;
serverId = 0;
connectionId = 0;
disposed = false;
outboundCallback;
keepAliveTimer;
/** The stream JSON-RPC reads server→client frames from. */
receiveStream;
/** The stream JSON-RPC writes client→server frames to. */
sendStream;
/**
* Resolves the cdylib next to the given CLI entrypoint and prepares the FFI host.
* The cdylib is resolved as `prebuilds/<prebuildsFolder>/runtime.node` relative to
* the entrypoint directory (the napi-rs `<node-platform>-<arch>` layout, e.g.
* `linux-x64`). Throws if it cannot be found.
*/
static create(cliEntrypoint, prebuildsFolder, environment) {
const fullEntrypoint = (0, import_node_path.resolve)(cliEntrypoint);
const distDir = (0, import_node_path.dirname)(fullEntrypoint);
const libraryPath = (0, import_node_path.join)(distDir, "prebuilds", prebuildsFolder, "runtime.node");
if (!(0, import_node_fs.existsSync)(libraryPath)) {
throw new Error(`FFI runtime library not found. Looked for '${libraryPath}'.`);
}
return new FfiRuntimeHost(libraryPath, fullEntrypoint, environment);
}
/**
* Starts the in-process runtime: spawns the CLI worker via the native host,
* waits for readiness, and opens the FFI JSON-RPC connection.
*/
async start() {
const argvJson = buildArgvJson(this.cliEntrypoint);
const envJson = buildEnvJson(this.environment);
this.serverId = await new Promise((resolvePromise, rejectPromise) => {
this.lib.hostStart.async(
argvJson,
argvJson.length,
envJson,
envJson ? envJson.length : 0,
(error, result) => {
if (error) {
rejectPromise(error);
} else {
resolvePromise(result);
}
}
);
});
if (!this.serverId) {
throw new Error(
`copilot_runtime_host_start failed (library '${this.libraryPath}', entrypoint '${this.cliEntrypoint}').`
);
}
this.outboundCallback = import_koffi.default.register(
(_userData, bytesPtr, bytesLen) => this.feedInbound(bytesPtr, bytesLen),
this.lib.outboundCallbackType
);
this.connectionId = this.lib.connectionOpen(
this.serverId,
this.outboundCallback,
null,
null,
0,
null,
0,
null,
0
);
if (!this.connectionId) {
this.unregisterCallback();
this.lib.hostShutdown(this.serverId);
this.serverId = 0;
throw new Error("copilot_runtime_connection_open failed.");
}
this.keepAliveTimer = setInterval(() => {
}, KEEP_ALIVE_INTERVAL_MS);
}
writeFrame(frame) {
if (this.disposed || !this.connectionId) {
throw new Error("The in-process runtime connection is closed.");
}
const ok = this.lib.connectionWrite(this.connectionId, frame, frame.length);
if (!ok) {
throw new Error("Failed to write a frame to the in-process runtime connection.");
}
}
/**
* Native outbound (server→client) callback. koffi delivers it on the JS event loop
* via a threadsafe function, so the frame is decoded and written straight to
* {@link receiveStream}. The native pointer is only valid for this call, so the
* bytes are copied out before returning.
*/
feedInbound(bytesPtr, bytesLen) {
try {
if (this.disposed || this.receiveStream.writableEnded) {
return;
}
const length = Number(bytesLen);
if (!bytesPtr || length <= 0) {
return;
}
const bytes = import_koffi.default.decode(
bytesPtr,
import_koffi.default.array("uint8", length, "Typed")
);
this.receiveStream.write(Buffer.from(bytes));
} catch (error) {
console.error(
`In-process FFI inbound callback failed: ${error instanceof Error ? error.stack ?? error.message : String(error)}`
);
}
}
unregisterCallback() {
if (this.outboundCallback === void 0) {
return;
}
const callback = this.outboundCallback;
this.outboundCallback = void 0;
try {
import_koffi.default.unregister(callback);
} catch {
}
}
/** Closes the FFI connection, shuts down the native host, and releases resources. */
dispose() {
if (this.disposed) {
return;
}
this.disposed = true;
if (this.keepAliveTimer !== void 0) {
clearInterval(this.keepAliveTimer);
this.keepAliveTimer = void 0;
}
try {
if (this.connectionId) {
this.lib.connectionClose(this.connectionId);
this.connectionId = 0;
}
} catch {
}
try {
if (this.serverId) {
this.lib.hostShutdown(this.serverId);
this.serverId = 0;
}
} catch {
}
this.receiveStream.end();
this.unregisterCallback();
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
FfiRuntimeHost
});
import { PassThrough, Writable } from "node:stream";
export declare class FfiRuntimeHost {
private readonly libraryPath;
private readonly cliEntrypoint;
private readonly environment?;
private readonly lib;
private serverId;
private connectionId;
private disposed;
private outboundCallback;
private keepAliveTimer;
/** The stream JSON-RPC reads server→client frames from. */
readonly receiveStream: PassThrough;
/** The stream JSON-RPC writes client→server frames to. */
readonly sendStream: Writable;
private constructor();
/**
* Resolves the cdylib next to the given CLI entrypoint and prepares the FFI host.
* The cdylib is resolved as `prebuilds/<prebuildsFolder>/runtime.node` relative to
* the entrypoint directory (the napi-rs `<node-platform>-<arch>` layout, e.g.
* `linux-x64`). Throws if it cannot be found.
*/
static create(cliEntrypoint: string, prebuildsFolder: string, environment?: Record<string, string | undefined>): FfiRuntimeHost;
/**
* Starts the in-process runtime: spawns the CLI worker via the native host,
* waits for readiness, and opens the FFI JSON-RPC connection.
*/
start(): Promise<void>;
private writeFrame;
/**
* Native outbound (server→client) callback. koffi delivers it on the JS event loop
* via a threadsafe function, so the frame is decoded and written straight to
* {@link receiveStream}. The native pointer is only valid for this call, so the
* bytes are copied out before returning.
*/
private feedInbound;
private unregisterCallback;
/** Closes the FFI connection, shuts down the native host, and releases resources. */
dispose(): void;
}
import { existsSync } from "node:fs";
import koffi from "koffi";
import { dirname, join, resolve } from "node:path";
import { PassThrough, Writable } from "node:stream";
const SYMBOL_PREFIX = "copilot_runtime_";
const KEEP_ALIVE_INTERVAL_MS = 1 << 30;
let loadedLibraryPath;
let loadedLibrary;
function loadLibrary(libraryPath) {
if (loadedLibrary) {
if (loadedLibraryPath !== libraryPath) {
throw new Error(
`An in-process FFI runtime library is already loaded from '${loadedLibraryPath}'; loading a different library from '${libraryPath}' in the same process is not supported.`
);
}
return loadedLibrary;
}
const lib = koffi.load(libraryPath);
const outboundCallbackType = koffi.pointer(
koffi.proto(
`void ${SYMBOL_PREFIX}outbound(void *userData, uint8 *bytesPtr, size_t bytesLen)`
)
);
loadedLibrary = {
hostStart: lib.func(`${SYMBOL_PREFIX}host_start`, "uint32", [
"uint8*",
"size_t",
"uint8*",
"size_t"
]),
hostShutdown: lib.func(`${SYMBOL_PREFIX}host_shutdown`, "bool", ["uint32"]),
connectionOpen: lib.func(`${SYMBOL_PREFIX}connection_open`, "uint32", [
"uint32",
outboundCallbackType,
"void*",
"uint8*",
"size_t",
"uint8*",
"size_t",
"uint8*",
"size_t"
]),
connectionWrite: lib.func(`${SYMBOL_PREFIX}connection_write`, "bool", [
"uint32",
"uint8*",
"size_t"
]),
connectionClose: lib.func(`${SYMBOL_PREFIX}connection_close`, "bool", ["uint32"]),
outboundCallbackType
};
loadedLibraryPath = libraryPath;
return loadedLibrary;
}
function buildArgvJson(cliEntrypoint) {
const argv = cliEntrypoint.toLowerCase().endsWith(".js") ? ["node", cliEntrypoint, "--embedded-host", "--no-auto-update"] : [cliEntrypoint, "--embedded-host", "--no-auto-update"];
return Buffer.from(JSON.stringify(argv), "utf8");
}
function buildEnvJson(environment) {
if (!environment) {
return null;
}
const obj = {};
for (const [key, value] of Object.entries(environment)) {
if (value !== void 0) {
obj[key] = value;
}
}
if (Object.keys(obj).length === 0) {
return null;
}
return Buffer.from(JSON.stringify(obj), "utf8");
}
class FfiRuntimeHost {
constructor(libraryPath, cliEntrypoint, environment) {
this.libraryPath = libraryPath;
this.cliEntrypoint = cliEntrypoint;
this.environment = environment;
this.lib = loadLibrary(libraryPath);
this.receiveStream = new PassThrough();
this.sendStream = new Writable({
// connection_write enqueues the frame into the runtime's inbound channel and
// returns immediately, so a synchronous FFI call is sufficient here.
write: (chunk, _encoding, callback) => {
try {
this.writeFrame(chunk);
callback();
} catch (error) {
callback(error);
}
}
});
}
libraryPath;
cliEntrypoint;
environment;
lib;
serverId = 0;
connectionId = 0;
disposed = false;
outboundCallback;
keepAliveTimer;
/** The stream JSON-RPC reads server→client frames from. */
receiveStream;
/** The stream JSON-RPC writes client→server frames to. */
sendStream;
/**
* Resolves the cdylib next to the given CLI entrypoint and prepares the FFI host.
* The cdylib is resolved as `prebuilds/<prebuildsFolder>/runtime.node` relative to
* the entrypoint directory (the napi-rs `<node-platform>-<arch>` layout, e.g.
* `linux-x64`). Throws if it cannot be found.
*/
static create(cliEntrypoint, prebuildsFolder, environment) {
const fullEntrypoint = resolve(cliEntrypoint);
const distDir = dirname(fullEntrypoint);
const libraryPath = join(distDir, "prebuilds", prebuildsFolder, "runtime.node");
if (!existsSync(libraryPath)) {
throw new Error(`FFI runtime library not found. Looked for '${libraryPath}'.`);
}
return new FfiRuntimeHost(libraryPath, fullEntrypoint, environment);
}
/**
* Starts the in-process runtime: spawns the CLI worker via the native host,
* waits for readiness, and opens the FFI JSON-RPC connection.
*/
async start() {
const argvJson = buildArgvJson(this.cliEntrypoint);
const envJson = buildEnvJson(this.environment);
this.serverId = await new Promise((resolvePromise, rejectPromise) => {
this.lib.hostStart.async(
argvJson,
argvJson.length,
envJson,
envJson ? envJson.length : 0,
(error, result) => {
if (error) {
rejectPromise(error);
} else {
resolvePromise(result);
}
}
);
});
if (!this.serverId) {
throw new Error(
`copilot_runtime_host_start failed (library '${this.libraryPath}', entrypoint '${this.cliEntrypoint}').`
);
}
this.outboundCallback = koffi.register(
(_userData, bytesPtr, bytesLen) => this.feedInbound(bytesPtr, bytesLen),
this.lib.outboundCallbackType
);
this.connectionId = this.lib.connectionOpen(
this.serverId,
this.outboundCallback,
null,
null,
0,
null,
0,
null,
0
);
if (!this.connectionId) {
this.unregisterCallback();
this.lib.hostShutdown(this.serverId);
this.serverId = 0;
throw new Error("copilot_runtime_connection_open failed.");
}
this.keepAliveTimer = setInterval(() => {
}, KEEP_ALIVE_INTERVAL_MS);
}
writeFrame(frame) {
if (this.disposed || !this.connectionId) {
throw new Error("The in-process runtime connection is closed.");
}
const ok = this.lib.connectionWrite(this.connectionId, frame, frame.length);
if (!ok) {
throw new Error("Failed to write a frame to the in-process runtime connection.");
}
}
/**
* Native outbound (server→client) callback. koffi delivers it on the JS event loop
* via a threadsafe function, so the frame is decoded and written straight to
* {@link receiveStream}. The native pointer is only valid for this call, so the
* bytes are copied out before returning.
*/
feedInbound(bytesPtr, bytesLen) {
try {
if (this.disposed || this.receiveStream.writableEnded) {
return;
}
const length = Number(bytesLen);
if (!bytesPtr || length <= 0) {
return;
}
const bytes = koffi.decode(
bytesPtr,
koffi.array("uint8", length, "Typed")
);
this.receiveStream.write(Buffer.from(bytes));
} catch (error) {
console.error(
`In-process FFI inbound callback failed: ${error instanceof Error ? error.stack ?? error.message : String(error)}`
);
}
}
unregisterCallback() {
if (this.outboundCallback === void 0) {
return;
}
const callback = this.outboundCallback;
this.outboundCallback = void 0;
try {
koffi.unregister(callback);
} catch {
}
}
/** Closes the FFI connection, shuts down the native host, and releases resources. */
dispose() {
if (this.disposed) {
return;
}
this.disposed = true;
if (this.keepAliveTimer !== void 0) {
clearInterval(this.keepAliveTimer);
this.keepAliveTimer = void 0;
}
try {
if (this.connectionId) {
this.lib.connectionClose(this.connectionId);
this.connectionId = 0;
}
} catch {
}
try {
if (this.serverId) {
this.lib.hostShutdown(this.serverId);
this.serverId = 0;
}
} catch {
}
this.receiveStream.end();
this.unregisterCallback();
}
}
export {
FfiRuntimeHost
};
+9
-0

@@ -183,2 +183,5 @@ "use strict";

sessionId: exchange.sessionId,
agentId: exchange.agentId,
parentAgentId: exchange.parentAgentId,
interactionType: exchange.interactionType,
transport: exchange.transport,

@@ -309,2 +312,5 @@ url: exchange.url,

sessionId;
agentId;
parentAgentId;
interactionType;
method = "GET";

@@ -329,2 +335,5 @@ url = "";

this.sessionId = params.sessionId;
this.agentId = params.agentId;
this.parentAgentId = params.parentAgentId;
this.interactionType = params.interactionType;
this.method = params.method;

@@ -331,0 +340,0 @@ this.url = params.url;

@@ -62,2 +62,14 @@ "use strict";

return { kind: "uri", url, connectionToken: opts.connectionToken };
},
/**
* Host the runtime in-process over the native runtime library's C ABI (FFI).
*
* @experimental Per-client options lowered to environment variables (`env`,
* `telemetry`, `gitHubToken`, `baseDirectory`) are **not** honored in-process;
* the worker inherits the host process's ambient environment. Set the
* corresponding environment variables on the host process instead. See
* https://github.com/github/copilot-sdk/issues/1934.
*/
forInProcess() {
return { kind: "inprocess" };
}

@@ -64,0 +76,0 @@ };

@@ -7,2 +7,3 @@ import { createServerRpc } from "./generated/rpc.js";

private cliProcess;
private ffiHost;
private connection;

@@ -50,2 +51,14 @@ private messageWriter;

/**
* Environment variable that overrides the transport when the caller does not set
* {@link CopilotClientOptions.connection}. Accepts `"inprocess"` or `"stdio"`
* (case-insensitive); unset preserves the default stdio transport. Any other value
* is an error.
*/
private static readonly DEFAULT_CONNECTION_ENV_VAR;
/**
* Resolves the default {@link RuntimeConnection} for the no-connection case,
* honoring {@link CopilotClient.DEFAULT_CONNECTION_ENV_VAR}.
*/
private static resolveDefaultConnection;
/**
* Creates a new CopilotClient instance.

@@ -412,2 +425,10 @@ *

/**
* Builds the environment for the spawned runtime child process (stdio/TCP): applies
* the auth token, connection token, `COPILOT_HOME`, keychain setting, and telemetry
* variables on top of the effective env. Not used by the in-process (FFI) transport,
* whose worker inherits the host process's ambient environment
* (see {@link CopilotClient.startInProcessFfi}).
*/
private buildRuntimeEnv;
/**
* Start the CLI server process

@@ -421,2 +442,30 @@ */

/**
* Start the in-process FFI runtime host: resolve the CLI entrypoint and native
* runtime library, then let the native host spawn the CLI worker.
*
* The worker inherits this host process's ambient environment; per-client options
* that lower to environment variables (`env`, `telemetry`, `gitHubToken`,
* `baseDirectory`) are intentionally not applied here, because the native runtime
* loads into the shared host process and a single env block cannot carry per-client
* values. Configure the in-process runtime via the host process environment instead.
* See https://github.com/github/copilot-sdk/issues/1934.
*/
private startInProcessFfi;
/**
* Connect to the in-process FFI runtime host over its receive/send streams,
* reusing the same `vscode-jsonrpc` framing as the stdio transport.
*/
private connectViaFfi;
/**
* Resolves the CLI entrypoint used for in-process FFI hosting: `COPILOT_CLI_PATH`
* when set, otherwise the bundled platform-package entrypoint.
*/
private resolveCliPathForFfi;
/**
* Returns the napi prebuilds folder name for the current host — the
* `<node-platform>-<arch>` convention (e.g. `win32-x64`, `darwin-arm64`,
* `linux-x64`) under which the runtime ships `prebuilds/<folder>/runtime.node`.
*/
private static getNapiPrebuildsFolder;
/**
* Connect to child via stdio pipes

@@ -423,0 +472,0 @@ */

+3
-0

@@ -11,2 +11,5 @@ import type { LlmInferenceHeaders } from "./generated/rpc.js";

readonly sessionId?: string;
readonly agentId?: string;
readonly parentAgentId?: string;
readonly interactionType?: string;
readonly transport: "http" | "websocket";

@@ -13,0 +16,0 @@ url: string;

@@ -156,2 +156,5 @@ const sharedTextDecoder = new TextDecoder("utf-8", { fatal: false });

sessionId: exchange.sessionId,
agentId: exchange.agentId,
parentAgentId: exchange.parentAgentId,
interactionType: exchange.interactionType,
transport: exchange.transport,

@@ -282,2 +285,5 @@ url: exchange.url,

sessionId;
agentId;
parentAgentId;
interactionType;
method = "GET";

@@ -302,2 +308,5 @@ url = "";

this.sessionId = params.sessionId;
this.agentId = params.agentId;
this.parentAgentId = params.parentAgentId;
this.interactionType = params.interactionType;
this.method = params.method;

@@ -304,0 +313,0 @@ this.url = params.url;

+1
-1

@@ -13,2 +13,2 @@ /**

export type * from "./generated/session-events.js";
export type { CommandContext, CommandDefinition, CommandHandler, CloudSessionOptions, CloudSessionRepository, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, CopilotClientMode, CopilotClientOptions, StdioRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, InfiniteSessionConfig, LargeToolOutputConfig, MemoryConfiguration, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, BearerTokenProvider, MessageOptions, ModelBilling, ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, CapiSessionOptions, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, NamedProviderConfig, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, ProviderModelConfig, ProviderTokenArgs, RemoteSessionMode, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, CopilotRequestContext, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolTelemetry, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
export type { CommandContext, CommandDefinition, CommandHandler, CanvasProviderIdentity, CloudSessionOptions, CloudSessionRepository, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, CopilotClientMode, CopilotClientOptions, StdioRuntimeConnection, InProcessRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, InfiniteSessionConfig, LargeToolOutputConfig, MemoryConfiguration, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, BearerTokenProvider, MessageOptions, ModelBilling, ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, CapiSessionOptions, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, NamedProviderConfig, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, ProviderModelConfig, ProviderTokenArgs, RemoteSessionMode, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, CopilotRequestContext, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolTelemetry, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";

@@ -34,2 +34,14 @@ import { createSessionFsAdapter } from "./sessionFsProvider.js";

return { kind: "uri", url, connectionToken: opts.connectionToken };
},
/**
* Host the runtime in-process over the native runtime library's C ABI (FFI).
*
* @experimental Per-client options lowered to environment variables (`env`,
* `telemetry`, `gitHubToken`, `baseDirectory`) are **not** honored in-process;
* the worker inherits the host process's ambient environment. Set the
* corresponding environment variables on the host process instead. See
* https://github.com/github/copilot-sdk/issues/1934.
*/
forInProcess() {
return { kind: "inprocess" };
}

@@ -36,0 +48,0 @@ };

@@ -7,3 +7,3 @@ {

},
"version": "1.0.7-preview.0",
"version": "1.0.7-preview.1",
"description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC",

@@ -60,3 +60,4 @@ "main": "./dist/cjs/index.js",

"dependencies": {
"@github/copilot": "^1.0.70-0",
"@github/copilot": "^1.0.70",
"koffi": "^3.1.0",
"vscode-jsonrpc": "^8.2.1",

@@ -63,0 +64,0 @@ "zod": "^4.3.6"

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display