@github/copilot-sdk 1.0.0-beta.9 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.d.ts CHANGED
@@ -3,13 +3,14 @@
3
3
  */
4
4
  import type { Canvas } from "./canvas.js";
5
5
  import type { SessionFsProvider } from "./sessionFsProvider.js";
6
- import type { SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js";
6
+ import type { ReasoningSummary, SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js";
7
7
  import type { CopilotSession } from "./session.js";
8
8
  import type { RemoteSessionMode } from "./generated/rpc.js";
9
9
  import type { OpenCanvasInstance } from "./generated/rpc.js";
10
10
  import type { ToolSet } from "./toolSet.js";
11
11
  export type { RemoteSessionMode } from "./generated/rpc.js";
12
12
  export type SessionEvent = GeneratedSessionEvent;
13
+ export type { ReasoningSummary } from "./generated/session-events.js";
13
14
  export type { SessionFsProvider } from "./sessionFsProvider.js";
14
15
  export { createSessionFsAdapter } from "./sessionFsProvider.js";
15
16
  export type { SessionFsFileInfo } from "./sessionFsProvider.js";
@@ -418,6 +419,17 @@ export interface SessionCapabilities {
418
419
  ui?: {
419
420
  /** Whether the host supports interactive elicitation dialogs. */
420
421
  elicitation?: boolean;
422
+ /**
423
+ * Whether the runtime has accepted the session's MCP Apps (SEP-1865)
424
+ * opt-in. `true` when the consumer set `enableMcpApps: true` on
425
+ * create/resume **and** the runtime's `MCP_APPS` feature flag (or
426
+ * `COPILOT_MCP_APPS=true` env override) is on. Otherwise absent or
427
+ * `false`, indicating the runtime silently dropped the opt-in.
428
+ *
429
+ * @experimental This property is part of an experimental wire-protocol surface
430
+ * (SEP-1865) and may change or be removed in a future release.
431
+ */
432
+ mcpApps?: boolean;
421
433
  /** Whether the host supports canvas rendering. */
422
434
  canvases?: boolean;
423
435
  };
@@ -1187,10 +1199,38 @@ export interface InfiniteSessionConfig {
1187
1199
  */
1188
1200
  bufferExhaustionThreshold?: number;
1189
1201
  }
1202
+ /**
1203
+ * Configuration for handling large tool outputs.
1204
+ *
1205
+ * When a tool produces output exceeding the configured size, the output is
1206
+ * written to a temp file and a reference is returned to the model instead of
1207
+ * the full payload.
1208
+ */
1209
+ export interface LargeToolOutputConfig {
1210
+ /**
1211
+ * Whether large output handling is enabled.
1212
+ * @default true
1213
+ */
1214
+ enabled?: boolean;
1215
+ /**
1216
+ * Maximum size in bytes before output is written to a temp file.
1217
+ * @default 51200
1218
+ */
1219
+ maxSizeBytes?: number;
1220
+ /**
1221
+ * Directory to write temp files to. Defaults to the OS temp directory.
1222
+ */
1223
+ outputDirectory?: string;
1224
+ }
1190
1225
  /**
1191
1226
  * Valid reasoning effort levels for models that support it.
1192
1227
  */
1193
1228
  export type ReasoningEffort = "low" | "medium" | "high" | "xhigh";
1229
+ /**
1230
+ * Context window tier for the session. "long_context" pins the session to the
1231
+ * long-context tier when the selected model supports it.
1232
+ */
1233
+ export type ContextTier = "default" | "long_context";
1194
1234
  /**
1195
1235
  * Stable extension identity for session participants that provide canvases.
1196
1236
  */
@@ -1221,13 +1261,30 @@ export interface SessionConfigBase {
1221
1261
  * Use client.listModels() to check supported values for each model.
1222
1262
  */
1223
1263
  reasoningEffort?: ReasoningEffort;
1264
+ /**
1265
+ * Reasoning summary mode for models that support configurable reasoning summaries.
1266
+ * Use "none" to suppress summary output regardless of whether reasoning is enabled.
1267
+ */
1268
+ reasoningSummary?: ReasoningSummary;
1269
+ /**
1270
+ * Context window tier for models that support it. Use "long_context" to pin
1271
+ * the session to the long-context tier; omit or use "default" otherwise.
1272
+ */
1273
+ contextTier?: ContextTier;
1224
1274
  /** Per-property overrides for model capabilities, deep-merged over runtime defaults. */
1225
1275
  modelCapabilities?: ModelCapabilitiesOverride;
1276
+ /**
1277
+ * Configuration for handling large tool outputs. When a tool produces
1278
+ * output exceeding the configured size, the output is written to a temp
1279
+ * file and a reference is returned to the model instead of the full
1280
+ * payload.
1281
+ */
1282
+ largeOutput?: LargeToolOutputConfig;
1226
1283
  /**
1227
1284
  * Override the default configuration directory location.
1228
1285
  * When specified, the session will use this directory for storing config and state.
1229
1286
  */
1230
- configDir?: string;
1287
+ configDirectory?: string;
1231
1288
  /**
1232
1289
  * When true, automatically discovers MCP server configurations (e.g. `.mcp.json`,
1233
1290
  * `.vscode/mcp.json`) and skill directories from the working directory and merges
@@ -1267,6 +1324,19 @@ export interface SessionConfigBase {
1267
1324
  * stay clean.
1268
1325
  */
1269
1326
  requestExtensions?: boolean;
1327
+ /**
1328
+ * Optional override path to a `copilot-sdk/` folder to inject into
1329
+ * extension subprocesses for this session in place of the bundled SDK.
1330
+ * When unset or invalid (missing folder or missing `index.js` /
1331
+ * `extension.js`), the runtime falls back to the bundled SDK without
1332
+ * throwing. Takes precedence over any server-level default.
1333
+ *
1334
+ * Only honored on session create and resume — extensions joining via
1335
+ * `joinSession` cannot override the SDK path, because the extension
1336
+ * subprocess has already been forked by the host with the SDK the host
1337
+ * chose. `JoinSessionConfig` omits this field for that reason.
1338
+ */
1339
+ extensionSdkPath?: string;
1270
1340
  /**
1271
1341
  * Stable extension identity for canvas providers on this connection. When
1272
1342
  * set, the runtime uses `${source}:${name}` as the agent-facing extension
@@ -1369,6 +1439,33 @@ export interface SessionConfigBase {
1369
1439
  * Also enables the `elicitation` capability on the session.
1370
1440
  */
1371
1441
  onElicitationRequest?: ElicitationHandler;
1442
+ /**
1443
+ * Enable MCP Apps (SEP-1865) UI passthrough on this session.
1444
+ *
1445
+ * When `true` **and** the runtime has MCP Apps enabled (via the
1446
+ * `MCP_APPS` feature flag or `COPILOT_MCP_APPS=true` environment
1447
+ * override), the runtime adds the `mcp-apps` capability to the session,
1448
+ * which causes it to advertise the `extensions.io.modelcontextprotocol/ui`
1449
+ * extension to MCP servers (so they expose `_meta.ui.resourceUri` on
1450
+ * tools) and to expose the `session.rpc.mcp.apps.{listTools,callTool,
1451
+ * readResource,setHostContext,getHostContext,diagnose}` JSON-RPC methods.
1452
+ *
1453
+ * If the runtime gate is off, the opt-in is silently dropped server-side
1454
+ * (the runtime logs a warning); the session is created normally but the
1455
+ * MCP Apps surface is unavailable. Inspect the runtime's
1456
+ * `capabilities.ui.mcpApps` on the create/resume response to detect this.
1457
+ *
1458
+ * SDK consumers MUST set this to `true` only when they have an iframe
1459
+ * renderer that can display `ui://` MCP App bundles. Setting it without a
1460
+ * renderer will cause MCP servers to register UI-enabled tool variants
1461
+ * the consumer cannot display.
1462
+ *
1463
+ * @experimental This option is part of an experimental wire-protocol surface
1464
+ * (SEP-1865) and may change or be removed in a future release.
1465
+ *
1466
+ * @default false
1467
+ */
1468
+ enableMcpApps?: boolean;
1372
1469
  /**
1373
1470
  * Handler for exit-plan-mode requests from the agent.
1374
1471
  * When provided, enables `exitPlanMode.request` callbacks.
@@ -1407,6 +1504,14 @@ export interface SessionConfigBase {
1407
1504
  * @default true
1408
1505
  */
1409
1506
  includeSubAgentStreamingEvents?: boolean;
1507
+ /**
1508
+ * Controls how MCP OAuth tokens are stored for this session.
1509
+ * - `"persistent"` — tokens are stored in the OS keychain (shared across sessions)
1510
+ * - `"in-memory"` — tokens are stored in memory and discarded when the session ends
1511
+ *
1512
+ * @default "in-memory"
1513
+ */
1514
+ mcpOAuthTokenStorage?: "persistent" | "in-memory";
1410
1515
  /**
1411
1516
  * MCP server configurations for the session.
1412
1517
  * Keys are server names, values are server configurations.
@@ -1433,6 +1538,20 @@ export interface SessionConfigBase {
1433
1538
  * Directories to load skills from.
1434
1539
  */
1435
1540
  skillDirectories?: string[];
1541
+ /**
1542
+ * Local filesystem paths to Open Plugins-format directories
1543
+ * (https://open-plugins.com/) to load for this session.
1544
+ *
1545
+ * Relative paths resolve against `workingDirectory` (or the runtime cwd if
1546
+ * unset); absolute paths are recommended. Invalid entries are logged and
1547
+ * skipped.
1548
+ *
1549
+ * Treated as an explicit opt-in: plugin agents and rules load even when
1550
+ * {@link SessionConfigBase.enableConfigDiscovery} is false. Loaded assets
1551
+ * slot between project (cwd) sources and personal/home sources in the
1552
+ * session-wide precedence order.
1553
+ */
1554
+ pluginDirectories?: string[];
1436
1555
  /**
1437
1556
  * Additional directories to search for custom instruction files.
1438
1557
  */
@@ -1458,6 +1577,53 @@ export interface SessionConfigBase {
1458
1577
  * the identity used for content exclusion, model routing, and quota checks.
1459
1578
  */
1460
1579
  gitHubToken?: string;
1580
+ /**
1581
+ * When true, skips embedding-based retrieval for this session.
1582
+ * Use in multitenant deployments to prevent cross-session information leakage
1583
+ * through the shared embedding cache.
1584
+ */
1585
+ skipEmbeddingRetrieval?: boolean;
1586
+ /**
1587
+ * Controls how the embedding cache is stored for this session.
1588
+ * - `"persistent"`: Embeddings are cached on disk and shared across sessions/restarts.
1589
+ * - `"in-memory"`: Embeddings are cached in memory only and discarded when the session ends.
1590
+ */
1591
+ embeddingCacheStorage?: "persistent" | "in-memory";
1592
+ /**
1593
+ * Organization-level custom instructions to include in the system prompt.
1594
+ * Allows hosts to inject organization-specific guidance without relying on
1595
+ * filesystem-based instruction discovery.
1596
+ */
1597
+ organizationCustomInstructions?: string;
1598
+ /**
1599
+ * When true, enables on-demand discovery of instruction files (AGENTS.md,
1600
+ * .github/copilot-instructions.md, etc.) after successful file views.
1601
+ */
1602
+ enableOnDemandInstructionDiscovery?: boolean;
1603
+ /**
1604
+ * When true, enables loading of file-based hooks from `.github/hooks/`.
1605
+ * This is separate from the `hooks` callback parameter which gates SDK
1606
+ * hook event registration.
1607
+ */
1608
+ enableFileHooks?: boolean;
1609
+ /**
1610
+ * When true, enables git operations on the host filesystem (branch detection,
1611
+ * file status, commit history). When false, no git context is surfaced in
1612
+ * the system prompt.
1613
+ */
1614
+ enableHostGitOperations?: boolean;
1615
+ /**
1616
+ * When true, enables the cross-session store for search and retrieval
1617
+ * across sessions. When false, session content is not written to or
1618
+ * read from the shared session store.
1619
+ */
1620
+ enableSessionStore?: boolean;
1621
+ /**
1622
+ * When true, enables skill loading (including builtin skills and discovered
1623
+ * skill directories). When false, no skills are loaded regardless of
1624
+ * `skillDirectories` or `enableConfigDiscovery` settings.
1625
+ */
1626
+ enableSkills?: boolean;
1461
1627
  /**
1462
1628
  * Per-session remote behavior control:
1463
1629
  * - `"off"` — local only, no remote export (default)
@@ -1646,6 +1812,10 @@ export interface MessageOptions {
1646
1812
  * Custom HTTP headers to include in outbound model requests for this turn.
1647
1813
  */
1648
1814
  requestHeaders?: Record<string, string>;
1815
+ /**
1816
+ * If provided, this is shown in the timeline instead of `prompt`.
1817
+ */
1818
+ displayPrompt?: string;
1649
1819
  }
1650
1820
  /**
1651
1821
  * All possible event type strings from SessionEvent
package/docs/examples.md CHANGED
@@ -158,7 +158,7 @@ Hooks intercept and modify behavior at key lifecycle points. Register them in th
158
158
  | `onPreToolUse` | Before a tool executes | Tool args, permission decision, add context |
159
159
  | `onPostToolUse` | After a tool executes successfully | Tool result, add context |
160
160
  | `onPostToolUseFailure` | After a tool execution returns a failure | Add hidden guidance to the model |
161
- | `onSessionStart` | Session starts or resumes | Add context, modify config |
161
+ | `onSessionStart` | Session starts or resumes | Add context |
162
162
  | `onSessionEnd` | Session ends | Cleanup actions, summary |
163
163
  | `onErrorOccurred` | An error occurs | Error handling strategy (retry/skip/abort) |
164
164
 
@@ -415,7 +415,7 @@ session.on("assistant.message", (event) => {
415
415
  | Event Type | Description | Key Data Fields |
416
416
  | --------------------------- | ------------------------------------------------ | ------------------------------------------------------ |
417
417
  | `assistant.message` | Agent's final response | `content`, `messageId`, `toolRequests` |
418
- | `assistant.streaming_delta` | Token-by-token streaming (ephemeral) | `totalResponseSizeBytes` |
418
+ | `assistant.message_delta` | Message content chunks (ephemeral) | `deltaContent` |
419
419
  | `tool.execution_start` | A tool is about to run | `toolCallId`, `toolName`, `arguments` |
420
420
  | `tool.execution_complete` | A tool finished running | `toolCallId`, `toolName`, `success`, `result`, `error` |
421
421
  | `user.message` | User sent a message | `content`, `attachments`, `source` |
@@ -629,8 +629,11 @@ const session = await joinSession({
629
629
  onPreToolUse: async (input) => {
630
630
  if (input.toolName === "bash") {
631
631
  const cmd = String(input.toolArgs?.command || "");
632
- if (/rm\\s+-rf\\s+\\/ / i.test(cmd) || /Remove-Item\\s+.*-Recurse/i.test(cmd)) {
633
- return { permissionDecision: "deny" };
632
+ if (/rm\\s+-rf\\s+\//i.test(cmd) || /Remove-Item\\s+.*-Recurse/i.test(cmd)) {
633
+ return {
634
+ permissionDecision: "deny",
635
+ permissionDecisionReason: "Destructive commands are not allowed.",
636
+ };
634
637
  }
635
638
  }
636
639
  },
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/github/copilot-sdk.git"
6
6
  },
7
- "version": "1.0.0-beta.9",
7
+ "version": "1.0.1",
8
8
  "description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC",
9
9
  "main": "./dist/cjs/index.js",
10
10
  "types": "./dist/index.d.ts",
@@ -44,7 +44,7 @@
44
44
  "generate": "cd ../scripts/codegen && npm run generate",
45
45
  "update:protocol-version": "tsx scripts/update-protocol-version.ts",
46
46
  "prepublishOnly": "npm run build",
47
- "package": "npm run clean && npm run build && node scripts/set-version.js && npm pack && npm version 0.1.0 --no-git-tag-version --allow-same-version"
47
+ "package": "npm run clean && npm run build && node scripts/set-version.js && npm pack && npm version 0.0.0-dev --no-git-tag-version --allow-same-version"
48
48
  },
49
49
  "keywords": [
50
50
  "github",
@@ -56,7 +56,7 @@
56
56
  "author": "GitHub",
57
57
  "license": "MIT",
58
58
  "dependencies": {
59
- "@github/copilot": "^1.0.55-5",
59
+ "@github/copilot": "^1.0.61",
60
60
  "vscode-jsonrpc": "^8.2.1",
61
61
  "zod": "^4.3.6"
62
62
  },
@@ -79,7 +79,7 @@
79
79
  "vitest": "^4.0.18"
80
80
  },
81
81
  "engines": {
82
- "node": ">=20.0.0"
82
+ "node": "^20.19.0 || >=22.12.0"
83
83
  },
84
84
  "files": [
85
85
  "dist/**/*",