Scan your whole stack
Are you using @microsoft/copilot-sdk?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v2.0.3-preview.4
@microsoft/copilot-sdk was last scanned on 25 Nov 2026 at version 2.0.3-preview.4. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 2.0.3-preview.4 LATEST | 25 Nov 2026 | No rules fired |
| 2.0.3-preview.3 | 25 Nov 2026 | No rules fired |
| 2.0.3-preview.2 | 25 Nov 2026 | No rules fired |
| 2.0.3-preview.1 | 24 Nov 2026 | Not shown |
| 2.0.3-preview.0 | 24 Nov 2026 | Not shown |
Findings for v2.0.3-preview.4. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 2.0.3-preview.4; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC.
To use the SDK, you'll need:
The SDK uses an optional @microsoft/copilot-sdk-<platform> package containing the
Copilot CLI runtime for the host platform. These packages contain the verified
runtime artifacts for that SDK release, so
starting the SDK performs no runtime download. Set COPILOT_CLI_PATH to use an
existing installation instead.
The checked-in copilotCliVersion in package.json and compiled metadata in
src/cliVersion.ts use a development placeholder. The public SDK snapshot
replaces both with the CLI version published for that snapshot.
npm run pack:release builds the main package and all platform packages. Set
COPILOT_CLI_DOWNLOAD_BASE_URL to use a release mirror while packaging.
Standalone source builds acquire stable/prerelease runtime assets from
github/copilot-cli at v<runtime-version>, and canonical unstable assets from
microsoft/copilot-sdk at runtime-<runtime-version>. Both checksum and package
downloads use that release location; mirror overrides retain the same tag scheme.
Release workflows instead set COPILOT_SDK_RUNTIME_PACKAGE_DIR to a directory
containing validated runtime npm package roots named for all eight platforms.
This keeps COPILOT_CLI_USE_NPM_PACKAGE false and embeds those runtime files in
the self-contained SDK platform packages.
In the runtime repository, packaging uses the prepared same-checkout runtime.
Set COPILOT_SDK_RUNTIME_PLATFORMS to the available target (for example,
linux-x64) for both pack:release and verify:release-packages. SDK CI checks
that target only; public release workflows leave this unset to package and
verify all eight platforms.
npm install @microsoft/copilot-sdk
client.listModels() and client.rpc.models.list() preserve the runtime's optional
provider reference on each model: { id, kind, label }. The existing Model
and ModelProviderRef types are available from the package root.
Native kinds remain copilot and loki; id is opaque and label is display text.
Configured BYOK and older, unattributed rows omit provider; do not infer Copilot
branding from a model ID or fill it from the active account. This metadata identifies
the model source, not the agent harness, an account, or a new routing/selection API.
Provide network in CopilotClientOptions when the SDK host should take over parts of the runtime's networking, for example when the runtime runs in WSL or a container and should use VS Code's proxy settings, proxy credentials and the host's Kerberos tickets. Registration happens during start(), before sessions can be created. Without this option, or for a callback you leave out, the runtime handles that part itself.
resolveProxy({ url }, signal) decides the proxies for every request the runtime would otherwise route by ambient proxy settings: proxy environment variables, NO_PROXY and operating-system proxy settings are not consulted unless it returns undefined. url is the request target as a PAC script sees it: without credentials or fragment, and for https and wss also without path and query. Return a PAC-style list such as PROXY proxy.example:8080; HTTPS proxy.example:443; DIRECT (the format of Electron's session.resolveProxy); return DIRECT for a direct connection, or undefined to let the runtime resolve the proxy itself, as if no callback were registered. Entry types the runtime doesn't support, such as SOCKS and QUIC, are skipped. If the callback fails, the request fails rather than connecting directly. Requests to loopback targets, and requests with an explicitly configured proxy, never consult it. The runtime caches answers, including undefined, for 5 seconds and waits at most 10 seconds for the callback.authenticateNegotiate({ spn }, signal) supplies the Kerberos token for a proxy's Negotiate challenge instead of the runtime's native credential lookup. spn is a service principal in the platform-independent service/host[@REALM] form; validate it before issuing credentials. Return a fresh base64 SPNEGO token without the Negotiate prefix, or undefined when credentials are unavailable, which fails the request unless the proxy also offers Basic and authenticateBasic supplies credentials. The runtime waits at most 30 seconds for the callback (less when the request's own deadline is sooner). Tokens are not cached and must not be logged or persisted. The callback supplies the initial SPNEGO token only; exchanges requiring continuation tokens are not supported. Proxies chosen by resolveProxy are authenticated the same way.authenticateBasic({ proxy, realm, previousRejected }, signal) supplies the credentials for a proxy's Basic challenge on requests the runtime tunnels through the proxy (https and wss). proxy is the proxy as http://host:port or https://host:port; realm comes from the proxy, so treat it as untrusted text. Return { username, password }, or undefined when credentials are unavailable, which fails the request with the proxy's challenge; an empty user name counts as unavailable, the user name must not contain a colon, neither the user name nor the password may contain control characters, and an omitted password means an empty one. The runtime remembers the answer for that proxy and uses it for later connections, until the proxy rejects it; then it calls again with previousRejected set, so return different credentials, for example by asking the user, or undefined. A later connection sends the answer without waiting for a challenge, unless the runtime may try Negotiate with that proxy first. A connection submits at most three sets of credentials. While a call is pending, other requests through that proxy wait for its answer. When a proxy offers both Negotiate and Basic, the runtime prefers Negotiate and answers with Basic when Negotiate is unavailable or the proxy rejects it. The runtime does not time the callback out: a request whose own deadline passes stops waiting, but the answer is still remembered. Credentials must not be logged or persisted.Each callback's signal aborts when the runtime stops waiting (it cancels the request, for example after its timeout, or the connection closes); the SDK then stops awaiting the callback and ignores any later result.
By default the callbacks serve only requests made for sessions this client creates or resumes. With scope: "runtime" they also serve the runtime's shared traffic, such as catalog refreshes, telemetry and remote MCP server connections; only one connection at a time can hold that scope, so startup fails if another client holds it. The registration ends when the connection closes.
const client = new CopilotClient({
mode: "coding-agent",
network: {
scope: "runtime",
resolveProxy: async ({ url }) => session.resolveProxy(url),
authenticateNegotiate: async ({ spn }, signal) => acquireToken(spn, signal),
authenticateBasic: async ({ proxy, realm }, signal) =>
promptForCredentials(proxy, realm, signal),
},
});
startAhpHost() requires authentication: github, or direct-only none / custom
(requireIdentity and a validator returning {identity,expiresAt} or null):
import { CopilotClient } from "@microsoft/copilot-sdk";
await using client = new CopilotClient({ mode: "coding-agent" });
await client.start();
const host = await client.startAhpHost({
localServer: {},
authentication: { mode: "github" },
onExit: (exit) => {
if (exit.error) console.error(exit.error);
},
});
// Connect an AHP client using host.url and host.token.
// Treat host.token as a secret; do not log it.
// Existing SDK sessions and AHP sessions share this runtime.
// Keep client alive while the listener is needed. Leaving this scope disposes
// client, and the runtime stops its listener without a separate host.dispose().
The runtime hosts the complete AHP server in-process; the SDK does not launch a
second runtime or relay the host's traffic. The host has its own SDK connection
and belongs to the client connection that started it. Explicit disposal,
connection loss, and runtime shutdown stop the listener and its hosting task
without deleting underlying sessions. Reconnecting does not reclaim a host.
The optional onExit callback reports exits at most once. If the owner connection
is lost, it reports that loss rather than claiming that listener cleanup was
acknowledged.
Call const { sessions } = await host.listSessions() to read the complete catalog
of live and dormant sessions advertised by the host. The method returns a
HostListSessionsResult containing sessions, not a session array directly.
host.pid is absent for in-process listeners. The optional field is retained
for separate host process IDs returned by legacy runtimes, never the runtime PID.
Use dispose() to stop the listener. reason: "exited" reports hosting-task
failure, not runtime process death, and exitCode is absent. Hosting no longer
provides process isolation from the runtime.
Select at least one transport explicitly: localServer: {} enables the local
listener, githubEnvironment: { name: "My app", computeId: "stable-installation-id" }
registers a Mission Control environment and enables remote WPS connections, and
both enables both transports. GitHub-only hosting opens no local listener;
host.url and host.token are undefined, while host.environmentId identifies
the environment. The application supplies a stable compute ID and configures
transports only at startup. Dispose and recreate the host to change them.
The runtime validates options inside localServer and applies their defaults:
hostname defaults to 127.0.0.1. Set it explicitly to request a non-loopback
listener, such as hostname: "0.0.0.0", and restrict network access appropriately.port defaults to 0, which selects an available port.requireConnectionToken defaults to true. The runtime generates a random
token unless you supply a nonempty token.requireConnectionToken: false to disable token authentication;
host.token is then undefined. A supplied token cannot be combined with
requireConnectionToken: false.The listener follows the owning client's lifetime. Call await host.dispose()
only when you want to stop it earlier; await using host also supports a shorter
scope. Each disposal call forwards to the runtime, which owns idempotent cleanup.
The AHP transport remains owned by the host.
Set top-level computeId to reuse the same durable catalog for local and Mission
Control hosting; it must agree with githubEnvironment.computeId when both are
supplied. Omitted local-only identities are persisted by the runtime, not generated
by the SDK. Published sessions remain discoverable after hosting stops.
Supply createSession to materialize fresh AHP sessions in your application:
import { approveAll, CopilotClient, defineTool } from "@microsoft/copilot-sdk";
await using client = new CopilotClient({ mode: "coding-agent" });
await using host = await client.startAhpHost({
localServer: {},
authentication: { mode: "github" },
createSession: ({ config, signal }) => {
signal.throwIfAborted();
return client.createSession({
...config,
permissions: {
...config.permissions,
onRequest: approveAll,
},
systemMessage: { mode: "append", content: "Use the app's greeting tool." },
tools: {
...config.tools?.definitions,
definitions: [
defineTool("greeting", {
description: "Get the application's greeting",
parameters: { type: "object", properties: {} },
handler: () => "Hello from the application!",
}),
],
},
});
},
onSessionReleased: async (originalSession) => {
// Optional: the app decides whether to disconnect, keep, or destroy it.
await originalSession.disconnect();
},
});
Preserve the supplied config, including its fresh session identity, workspace,
and selected host settings. Add your prompt and tools where the host has not
explicitly selected those settings; conflicting settings fail rather than
silently advertising configuration that was not applied. Return a normal session
created by this same client. The creation factory does not adopt an arbitrary existing
session or expose unrelated application sessions in the AHP catalog.
Only the session ID returns through ordinary SDK RPC. The host attaches to that same resident session, adding its own callback/tool registrations without replacing the application's prompt, tool filters, hooks, or tools. Application tool functions continue running in the app while their results stream through the existing AHP projector. No second application connection or function serialization is involved.
The SDK retains the original returned object until participation ends and invokes
onSessionReleased at most once per handoff, including attach failure, hosting-task exit,
and owner disconnection. The SDK never automatically disconnects or destroys the
app object. The creation callback receives an abort signal; materialization
is bounded to 30 seconds and cancellation also releases objects returned late.
Graceful host disposal waits for AHP detach before reporting release. Omitting
createSession preserves copilotd-owned creation.
To restore durable application-owned sessions, also supply resumeSession.
It receives { sessionId, config, signal } (AhpSessionResumeRequest).
Return the object from this client's resumeSession(sessionId, { ...config, onPermissionRequest, ... }), restoring your tools, hooks, and handlers.
Alternatively, return a retained original session from this client when it
still matches the requested identity and workspace.
Only catalog entries marked as application-owned invoke this callback.
If the callback is missing, restoring such an entry fails instead of falling
back to host-owned creation.
Currently resident published sessions attach directly, without invoking it or replacing
their current registrations. Dormant published application sessions require this
resume callback to restore their tools and handlers. Resumed sessions follow the same original-object
retention, cancellation, late-result release, and onSessionReleased rules.
The copilotd-hosting library runs inside the runtime provider.
Development integrations require a
source-built launcher and provider (COPILOT_RUNTIME_PROVIDER_LIB). Older
runtimes without these RPC operations cannot start a host.
Try the interactive chat sample (from the repo root):
cd nodejs
npm ci
npm run build
export COPILOT_CLI_PATH="$(npm run --silent prepare:runtime -- --print-path)"
cd samples
npm install
npm start
import { CopilotClient, approveAll } from "@microsoft/copilot-sdk";
// Create and start client
const client = new CopilotClient({ mode: "coding-agent" });
await client.start();
// approveAll is only valid when managed settings are disabled.
const session = await client.createSession({
model: "gpt-5",
permissions: {
onRequest: approveAll,
},
});
// Wait for the response using typed event handlers
const done = new Promise<void>((resolve) => {
session.on("assistant.message", (event) => {
console.log(event.data.content);
});
session.on("session.idle", () => {
resolve();
});
});
// Send a message and wait for completion
await session.send({ prompt: "What is 2+2?" });
await done;
// Clean up
await session.disconnect();
await client.stop();
Sessions also support Symbol.asyncDispose for use with await using (TypeScript 5.2+ / Node.js 20+):
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.