@github/copilot-sdk 1.0.6-preview.0 → 1.0.6-preview.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.
@@ -621,14 +621,6 @@ function createInternalServerRpc(connection) {
621
621
  * @returns Dynamic-context board entry count, when available.
622
622
  */
623
623
  getBoardEntryCount: async (params) => connection.sendRequest("sessions.getBoardEntryCount", params),
624
- /**
625
- * Cursor-based long-poll for sessions spawned by the runtime (e.g. in response to a Mission Control `start_session` command). The cursor is an opaque token; pass it back to receive only spawn events that occurred AFTER the cursor was issued. Omit the cursor on the first call to receive any events buffered since the runtime started. Internal: this is a CLI background-daemon plumbing primitive. SDK consumers that need to react to runtime-spawned sessions should subscribe to a higher-level event stream rather than driving a long-poll loop.
626
- *
627
- * @param params Cursor and optional long-poll wait for polling runtime-spawned sessions.
628
- *
629
- * @returns Batch of spawn events plus a cursor for follow-up polls.
630
- */
631
- pollSpawnedSessions: async (params) => connection.sendRequest("sessions.pollSpawnedSessions", params),
632
624
  /**
633
625
  * Registers extension-provided tools on the given session, gated by an optional `enabled` callback. Returns an opaque unsubscribe function the caller must invoke to deregister the tools when the extension is torn down. Marked internal because `loader`, `enabled`, and the returned `unsubscribe` are in-process handles that cannot cross the JSON-RPC boundary. Disappears once extension discovery / launch / tool registration are owned by the runtime: SDK consumers will pass pure config (search paths, disabled ids) via `SessionOptions` and the runtime will resolve, launch, register, and tear down extensions itself.
634
626
  *
@@ -1718,6 +1710,20 @@ function createSessionRpc(connection, sessionId) {
1718
1710
  * @returns Token breakdown for the session's current context window, or null if uninitialized.
1719
1711
  */
1720
1712
  contextInfo: async (params) => connection.sendRequest("session.metadata.contextInfo", { sessionId, ...params }),
1713
+ /**
1714
+ * Returns the experimental per-source attribution breakdown of the session's current context window as a flat list of entries (skills, subagents, MCP servers, built-in tools, plugin rollups, system/tool-definition costs, with nesting via parentId), plus the successful compaction count. The heaviest individual messages are available separately via `metadata.getContextHeaviestMessages`. Returns null until the session has initialized its system prompt and tool metadata.
1715
+ *
1716
+ * @returns Per-source attribution breakdown for the session's current context window, or null if uninitialized.
1717
+ */
1718
+ getContextAttribution: async () => connection.sendRequest("session.metadata.getContextAttribution", { sessionId }),
1719
+ /**
1720
+ * Returns the largest individual messages currently in the session's context window, most-expensive first. Companion to `metadata.getContextAttribution`. Returns an empty list until the session has initialized.
1721
+ *
1722
+ * @param params Parameters for the heaviest-messages query.
1723
+ *
1724
+ * @returns The heaviest individual messages in the session's context window, most-expensive first.
1725
+ */
1726
+ getContextHeaviestMessages: async (params) => connection.sendRequest("session.metadata.getContextHeaviestMessages", { sessionId, ...params }),
1721
1727
  /**
1722
1728
  * Records a working-directory/git context change and emits a `session.context_changed` event.
1723
1729
  *
@@ -756,6 +756,59 @@ export type McpSetEnvValueModeDetails =
756
756
  "direct"
757
757
  /** Treat MCP server environment values as host-side references to resolve before launch. */
758
758
  | "indirect";
759
+ /**
760
+ * Per-source context-window attribution, or null if the session has not yet been initialized (no system prompt or tool metadata cached).
761
+ *
762
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
763
+ * via the `definition` "SessionContextAttribution".
764
+ */
765
+ /** @experimental */
766
+ export type SessionContextAttribution = {
767
+ /**
768
+ * Total token count of the current context window the entries are measured against (system message + conversation messages + tool definitions — the same total reported by /context). Divide an entry's `tokens` by this to derive its share.
769
+ */
770
+ totalTokens: number;
771
+ /**
772
+ * Flat list of per-source attribution entries. Group by `kind` and render unrecognized kinds generically. Nesting and rollups are expressed via `parentId`.
773
+ */
774
+ entries: {
775
+ /**
776
+ * Source category for this entry. Not a closed set — tolerate unknown values. Known values today: `skill`, `subagent`, `mcpServer`, `tool`, `system`, `toolDefinition`, `plugin`.
777
+ */
778
+ kind: string;
779
+ /**
780
+ * Identifier for this entry, formed by joining its `kind` and source name (e.g. `tool:bash`, `skill:tmux`, `toolDefinition:bash`); unique within the snapshot. Use it to match the same entry across snapshots, to correlate with other APIs (skill/agent/MCP registries), and as the `parentId` target for nesting. Distinct from the human-facing `label`.
781
+ */
782
+ id: string;
783
+ /**
784
+ * Human-readable display label, e.g. `bash` or `skill: tmux`. Presentation-only; may be localized/reformatted without notice — do not key off it.
785
+ */
786
+ label: string;
787
+ /**
788
+ * Token count currently in context attributable to this entry.
789
+ */
790
+ tokens: number;
791
+ /**
792
+ * Optional `id` of the parent entry: e.g. a `plugin` entry parenting its `skill`/`mcpServer` entries, or the `system` entry parenting `toolDefinition` entries. Omitted for top-level entries.
793
+ */
794
+ parentId?: string;
795
+ /**
796
+ * Supplementary per-entry metadata (e.g. `messageCount`, `role`, `evictable`, `pluginSource`). Values are stringified; parse as needed and ignore unrecognized keys.
797
+ */
798
+ attributes?: {
799
+ [k: string]: string | undefined;
800
+ };
801
+ }[];
802
+ /**
803
+ * Successful compaction history for the session.
804
+ */
805
+ compactions: {
806
+ /**
807
+ * Number of successful compactions in this session.
808
+ */
809
+ count: number;
810
+ };
811
+ } | null;
759
812
  /**
760
813
  * Token breakdown for the current context window, or null if the session has not yet been initialized (no system prompt or tool metadata cached).
761
814
  *
@@ -3148,6 +3201,10 @@ export interface SlashCommandInput {
3148
3201
  * Hint to display when command input has not been provided
3149
3202
  */
3150
3203
  hint: string;
3204
+ /**
3205
+ * Optional literal choices the input accepts, each with a human-facing description; clients may render these as selectable options
3206
+ */
3207
+ choices?: SlashCommandInputChoice[];
3151
3208
  /**
3152
3209
  * When true, the command requires non-empty input; clients should render the input hint as required
3153
3210
  */
@@ -3158,6 +3215,23 @@ export interface SlashCommandInput {
3158
3215
  */
3159
3216
  preserveMultilineInput?: boolean;
3160
3217
  }
3218
+ /**
3219
+ * A literal choice the command input accepts, with a human-facing description
3220
+ *
3221
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
3222
+ * via the `definition` "SlashCommandInputChoice".
3223
+ */
3224
+ /** @experimental */
3225
+ export interface SlashCommandInputChoice {
3226
+ /**
3227
+ * The literal choice value (e.g. 'on', 'off', 'show')
3228
+ */
3229
+ name: string;
3230
+ /**
3231
+ * Human-readable description shown alongside the choice
3232
+ */
3233
+ description: string;
3234
+ }
3161
3235
  /**
3162
3236
  * Pending command request ID and an optional error if the client handler failed.
3163
3237
  *
@@ -3436,6 +3510,31 @@ export interface ConnectRemoteSessionParams {
3436
3510
  */
3437
3511
  sessionId: string;
3438
3512
  }
3513
+ /**
3514
+ * A single large message currently in context.
3515
+ *
3516
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
3517
+ * via the `definition` "ContextHeaviestMessage".
3518
+ */
3519
+ /** @experimental */
3520
+ export interface ContextHeaviestMessage {
3521
+ /**
3522
+ * Stable identifier for this message within the snapshot.
3523
+ */
3524
+ id: string;
3525
+ /**
3526
+ * Human-readable source label, e.g. `tool: bash` or `skill: tmux`. Presentation-only.
3527
+ */
3528
+ label: string;
3529
+ /**
3530
+ * Role of the chat message (`user`, `assistant`, or `tool`).
3531
+ */
3532
+ role: string;
3533
+ /**
3534
+ * Token count currently in context for this individual message.
3535
+ */
3536
+ tokens: number;
3537
+ }
3439
3538
  /**
3440
3539
  * The currently selected model, reasoning effort, and context tier for the session. The context tier reflects `Session.getContextTier()`, restored from the session journal on resume.
3441
3540
  *
@@ -3770,6 +3869,10 @@ export interface ExternalToolTextResultForLlm {
3770
3869
  * Structured content blocks from the tool
3771
3870
  */
3772
3871
  contents?: ExternalToolTextResultForLlmContent[];
3872
+ /**
3873
+ * Tool references returned by a tool-search override: names of deferred tools to surface to the model. When set, the tool result is materialized as `tool_reference` content blocks (rather than plain text) so the model knows which deferred tools are now available.
3874
+ */
3875
+ toolReferences?: string[];
3773
3876
  }
3774
3877
  /**
3775
3878
  * Binary result returned by a tool for the model
@@ -6050,6 +6153,49 @@ export interface MemoryConfiguration {
6050
6153
  */
6051
6154
  enabled: boolean;
6052
6155
  }
6156
+ /**
6157
+ * Per-source attribution breakdown for the session's current context window, or null if uninitialized.
6158
+ *
6159
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6160
+ * via the `definition` "MetadataContextAttributionResult".
6161
+ */
6162
+ /** @experimental */
6163
+ export interface MetadataContextAttributionResult {
6164
+ /**
6165
+ * Per-source context-window attribution, or null if the session has not yet been initialized (no system prompt or tool metadata cached).
6166
+ */
6167
+ contextAttribution?: SessionContextAttribution | null;
6168
+ }
6169
+ /**
6170
+ * Parameters for the heaviest-messages query.
6171
+ *
6172
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6173
+ * via the `definition` "MetadataContextHeaviestMessagesRequest".
6174
+ */
6175
+ /** @experimental */
6176
+ export interface MetadataContextHeaviestMessagesRequest {
6177
+ /**
6178
+ * Maximum number of messages to return, most-expensive first. Omit for the server default.
6179
+ */
6180
+ limit?: number;
6181
+ }
6182
+ /**
6183
+ * The heaviest individual messages in the session's context window, most-expensive first.
6184
+ *
6185
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
6186
+ * via the `definition` "MetadataContextHeaviestMessagesResult".
6187
+ */
6188
+ /** @experimental */
6189
+ export interface MetadataContextHeaviestMessagesResult {
6190
+ /**
6191
+ * Total token count of the current context window, so callers can compute each message's share without a second call.
6192
+ */
6193
+ totalTokens: number;
6194
+ /**
6195
+ * Heaviest messages, most-expensive first.
6196
+ */
6197
+ messages: ContextHeaviestMessage[];
6198
+ }
6053
6199
  /**
6054
6200
  * Model identifier and token limits used to compute the context-info breakdown.
6055
6201
  *
@@ -8523,36 +8669,6 @@ export interface PluginUpdateResult {
8523
8669
  */
8524
8670
  skillsInstalled: number;
8525
8671
  }
8526
- /**
8527
- * Batch of spawn events plus a cursor for follow-up polls.
8528
- *
8529
- * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
8530
- * via the `definition` "PollSpawnedSessionsResult".
8531
- */
8532
- /** @experimental */
8533
- export interface PollSpawnedSessionsResult {
8534
- /**
8535
- * Spawn events emitted since the supplied cursor.
8536
- */
8537
- events: SessionsPollSpawnedSessionsEvent[];
8538
- /**
8539
- * Opaque cursor to pass back to receive only events after this batch.
8540
- */
8541
- cursor: string;
8542
- }
8543
- /**
8544
- * Schema for the `SessionsPollSpawnedSessionsEvent` type.
8545
- *
8546
- * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
8547
- * via the `definition` "SessionsPollSpawnedSessionsEvent".
8548
- */
8549
- /** @experimental */
8550
- export interface SessionsPollSpawnedSessionsEvent {
8551
- /**
8552
- * Session id of the newly-spawned session.
8553
- */
8554
- sessionId: string;
8555
- }
8556
8672
  /**
8557
8673
  * BYOK providers and/or models to add to the session's registry at runtime. Both fields are optional; provide providers, models, or both.
8558
8674
  *
@@ -11558,17 +11674,6 @@ export interface SessionsLoadDeferredRepoHooksRequest {
11558
11674
  */
11559
11675
  sessionId: string;
11560
11676
  }
11561
- /** @experimental */
11562
- export interface SessionsPollSpawnedSessionsRequest {
11563
- /**
11564
- * Opaque cursor returned by a previous poll. Omit on the first call to receive any spawn events buffered since the runtime started.
11565
- */
11566
- cursor?: string;
11567
- /**
11568
- * Milliseconds to wait for new spawn events when the cursor is at the tail. 0 (default) returns immediately even if no events are buffered. Capped at 60000ms.
11569
- */
11570
- waitMs?: number;
11571
- }
11572
11677
  /**
11573
11678
  * Age threshold and optional flags controlling which old sessions are pruned (or simulated when dryRun is true).
11574
11679
  *
@@ -15778,6 +15883,20 @@ export declare function createSessionRpc(connection: MessageConnection, sessionI
15778
15883
  * @returns Token breakdown for the session's current context window, or null if uninitialized.
15779
15884
  */
15780
15885
  contextInfo: (params: MetadataContextInfoRequest) => Promise<MetadataContextInfoResult>;
15886
+ /**
15887
+ * Returns the experimental per-source attribution breakdown of the session's current context window as a flat list of entries (skills, subagents, MCP servers, built-in tools, plugin rollups, system/tool-definition costs, with nesting via parentId), plus the successful compaction count. The heaviest individual messages are available separately via `metadata.getContextHeaviestMessages`. Returns null until the session has initialized its system prompt and tool metadata.
15888
+ *
15889
+ * @returns Per-source attribution breakdown for the session's current context window, or null if uninitialized.
15890
+ */
15891
+ getContextAttribution: () => Promise<MetadataContextAttributionResult>;
15892
+ /**
15893
+ * Returns the largest individual messages currently in the session's context window, most-expensive first. Companion to `metadata.getContextAttribution`. Returns an empty list until the session has initialized.
15894
+ *
15895
+ * @param params Parameters for the heaviest-messages query.
15896
+ *
15897
+ * @returns The heaviest individual messages in the session's context window, most-expensive first.
15898
+ */
15899
+ getContextHeaviestMessages: (params: MetadataContextHeaviestMessagesRequest) => Promise<MetadataContextHeaviestMessagesResult>;
15781
15900
  /**
15782
15901
  * Records a working-directory/git context change and emits a `session.context_changed` event.
15783
15902
  *
@@ -593,14 +593,6 @@ function createInternalServerRpc(connection) {
593
593
  * @returns Dynamic-context board entry count, when available.
594
594
  */
595
595
  getBoardEntryCount: async (params) => connection.sendRequest("sessions.getBoardEntryCount", params),
596
- /**
597
- * Cursor-based long-poll for sessions spawned by the runtime (e.g. in response to a Mission Control `start_session` command). The cursor is an opaque token; pass it back to receive only spawn events that occurred AFTER the cursor was issued. Omit the cursor on the first call to receive any events buffered since the runtime started. Internal: this is a CLI background-daemon plumbing primitive. SDK consumers that need to react to runtime-spawned sessions should subscribe to a higher-level event stream rather than driving a long-poll loop.
598
- *
599
- * @param params Cursor and optional long-poll wait for polling runtime-spawned sessions.
600
- *
601
- * @returns Batch of spawn events plus a cursor for follow-up polls.
602
- */
603
- pollSpawnedSessions: async (params) => connection.sendRequest("sessions.pollSpawnedSessions", params),
604
596
  /**
605
597
  * Registers extension-provided tools on the given session, gated by an optional `enabled` callback. Returns an opaque unsubscribe function the caller must invoke to deregister the tools when the extension is torn down. Marked internal because `loader`, `enabled`, and the returned `unsubscribe` are in-process handles that cannot cross the JSON-RPC boundary. Disappears once extension discovery / launch / tool registration are owned by the runtime: SDK consumers will pass pure config (search paths, disabled ids) via `SessionOptions` and the runtime will resolve, launch, register, and tear down extensions itself.
606
598
  *
@@ -1690,6 +1682,20 @@ function createSessionRpc(connection, sessionId) {
1690
1682
  * @returns Token breakdown for the session's current context window, or null if uninitialized.
1691
1683
  */
1692
1684
  contextInfo: async (params) => connection.sendRequest("session.metadata.contextInfo", { sessionId, ...params }),
1685
+ /**
1686
+ * Returns the experimental per-source attribution breakdown of the session's current context window as a flat list of entries (skills, subagents, MCP servers, built-in tools, plugin rollups, system/tool-definition costs, with nesting via parentId), plus the successful compaction count. The heaviest individual messages are available separately via `metadata.getContextHeaviestMessages`. Returns null until the session has initialized its system prompt and tool metadata.
1687
+ *
1688
+ * @returns Per-source attribution breakdown for the session's current context window, or null if uninitialized.
1689
+ */
1690
+ getContextAttribution: async () => connection.sendRequest("session.metadata.getContextAttribution", { sessionId }),
1691
+ /**
1692
+ * Returns the largest individual messages currently in the session's context window, most-expensive first. Companion to `metadata.getContextAttribution`. Returns an empty list until the session has initialized.
1693
+ *
1694
+ * @param params Parameters for the heaviest-messages query.
1695
+ *
1696
+ * @returns The heaviest individual messages in the session's context window, most-expensive first.
1697
+ */
1698
+ getContextHeaviestMessages: async (params) => connection.sendRequest("session.metadata.getContextHeaviestMessages", { sessionId, ...params }),
1693
1699
  /**
1694
1700
  * Records a working-directory/git context change and emits a `session.context_changed` event.
1695
1701
  *
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.6-preview.0",
7
+ "version": "1.0.6-preview.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",
@@ -56,7 +56,7 @@
56
56
  "author": "GitHub",
57
57
  "license": "MIT",
58
58
  "dependencies": {
59
- "@github/copilot": "^1.0.67",
59
+ "@github/copilot": "^1.0.69-0",
60
60
  "vscode-jsonrpc": "^8.2.1",
61
61
  "zod": "^4.3.6"
62
62
  },