@github/copilot-sdk 1.0.0 → 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.
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Union of all session event variants emitted by the Copilot CLI runtime.
7
7
  */
8
- export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | AutopilotObjectiveChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | PermissionsChangedEvent | PlanChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | ContextChangedEvent | UsageInfoEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantUsageEvent | ModelCallFailureEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | CustomNotificationEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
8
+ export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | AutopilotObjectiveChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | PermissionsChangedEvent | PlanChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | ContextChangedEvent | UsageInfoEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantUsageEvent | ModelCallFailureEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | CustomNotificationEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | CanvasClosedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
9
9
  /**
10
10
  * Hosting platform type of the repository (github or ado)
11
11
  */
@@ -562,6 +562,10 @@ export interface ResumeData {
562
562
  * Total number of persisted events in the session at the time of resume
563
563
  */
564
564
  eventCount: number;
565
+ /**
566
+ * On-disk byte size of the session's persisted events.jsonl file at resume time; omitted when the file does not exist or cannot be stat'd
567
+ */
568
+ eventsFileSizeBytes?: number;
565
569
  /**
566
570
  * Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max")
567
571
  */
@@ -695,7 +699,7 @@ export interface ErrorData {
695
699
  url?: string;
696
700
  }
697
701
  /**
698
- * Session event "session.idle". Payload indicating the session is idle with no background agents in flight
702
+ * Session event "session.idle". Payload indicating the session is idle with no background agents or attached shell commands in flight
699
703
  */
700
704
  export interface IdleEvent {
701
705
  /**
@@ -725,7 +729,7 @@ export interface IdleEvent {
725
729
  type: "session.idle";
726
730
  }
727
731
  /**
728
- * Payload indicating the session is idle with no background agents in flight
732
+ * Payload indicating the session is idle with no background agents or attached shell commands in flight
729
733
  */
730
734
  export interface IdleData {
731
735
  /**
@@ -806,6 +810,14 @@ export interface ScheduleCreatedEvent {
806
810
  * Scheduled prompt registered via /every or /after
807
811
  */
808
812
  export interface ScheduleCreatedData {
813
+ /**
814
+ * Absolute fire time (epoch milliseconds) for a one-shot calendar schedule
815
+ */
816
+ at?: number;
817
+ /**
818
+ * 5-field cron expression for a recurring calendar schedule, evaluated in `tz`
819
+ */
820
+ cron?: string;
809
821
  /**
810
822
  * Optional user-facing label shown in the timeline instead of the actual prompt (e.g. `/skill-name args` when the prompt is a skill invocation expansion)
811
823
  */
@@ -815,9 +827,9 @@ export interface ScheduleCreatedData {
815
827
  */
816
828
  id: number;
817
829
  /**
818
- * Interval between ticks in milliseconds
830
+ * Interval between ticks in milliseconds (relative-interval schedules)
819
831
  */
820
- intervalMs: number;
832
+ intervalMs?: number;
821
833
  /**
822
834
  * Prompt text that gets enqueued on every tick
823
835
  */
@@ -826,6 +838,10 @@ export interface ScheduleCreatedData {
826
838
  * Whether the schedule re-arms after each tick (`/every`) or fires once (`/after`)
827
839
  */
828
840
  recurring?: boolean;
841
+ /**
842
+ * IANA timezone the `cron` expression is evaluated in
843
+ */
844
+ tz?: string;
829
845
  }
830
846
  /**
831
847
  * Session event "session.schedule_cancelled". Scheduled prompt cancelled from the schedule manager dialog
@@ -1457,6 +1473,10 @@ export interface ShutdownData {
1457
1473
  * Error description when shutdownType is "error"
1458
1474
  */
1459
1475
  errorReason?: string;
1476
+ /**
1477
+ * On-disk byte size of the session's persisted events.jsonl file at shutdown time; omitted when the file does not exist or cannot be stat'd
1478
+ */
1479
+ eventsFileSizeBytes?: number;
1460
1480
  /**
1461
1481
  * Per-model usage breakdown, keyed by model identifier
1462
1482
  */
@@ -2467,6 +2487,10 @@ export interface AssistantMessageData {
2467
2487
  * @experimental
2468
2488
  */
2469
2489
  anthropicAdvisorModel?: string;
2490
+ /**
2491
+ * Provider's completion / response identifier; shared across all chunks of a single API call. Used to group multi-chunk assistant utterances.
2492
+ */
2493
+ apiCallId?: string;
2470
2494
  /**
2471
2495
  * The assistant's text response content
2472
2496
  */
@@ -3630,7 +3654,7 @@ export interface SubagentStartedData {
3630
3654
  */
3631
3655
  agentName: string;
3632
3656
  /**
3633
- * Model the sub-agent will run with, when known at start. Surfaced in the timeline for auto-selected sub-agents (e.g. rubber-duck).
3657
+ * Model the sub-agent will run with, when known at start.
3634
3658
  */
3635
3659
  model?: string;
3636
3660
  /**
@@ -3752,7 +3776,7 @@ export interface SubagentFailedData {
3752
3776
  */
3753
3777
  error: string;
3754
3778
  /**
3755
- * Model used by the sub-agent (if any model calls succeeded before failure)
3779
+ * Model selected for the sub-agent, when known
3756
3780
  */
3757
3781
  model?: string;
3758
3782
  /**
@@ -3961,6 +3985,10 @@ export interface HookEndError {
3961
3985
  * Human-readable error message
3962
3986
  */
3963
3987
  message: string;
3988
+ /**
3989
+ * Source label of the hook that errored (e.g. the plugin it was loaded from), when known
3990
+ */
3991
+ source?: string;
3964
3992
  /**
3965
3993
  * Error stack trace, when available
3966
3994
  */
@@ -4004,6 +4032,10 @@ export interface HookProgressData {
4004
4032
  * Human-readable progress message from the hook process
4005
4033
  */
4006
4034
  message: string;
4035
+ /**
4036
+ * When true, this status message replaces the previous temporary one instead of accumulating
4037
+ */
4038
+ temporary?: boolean;
4007
4039
  }
4008
4040
  /**
4009
4041
  * Session event "system.message". System/developer instruction content with role and optional template metadata
@@ -6699,6 +6731,53 @@ export interface CanvasRegistryChangedCanvasAction {
6699
6731
  */
6700
6732
  name: string;
6701
6733
  }
6734
+ /**
6735
+ * Session event "session.canvas.closed".
6736
+ */
6737
+ export interface CanvasClosedEvent {
6738
+ /**
6739
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
6740
+ */
6741
+ agentId?: string;
6742
+ data: CanvasClosedData;
6743
+ /**
6744
+ * Always true for events that are transient and not persisted to the session event log on disk.
6745
+ */
6746
+ ephemeral: true;
6747
+ /**
6748
+ * Unique event identifier (UUID v4), generated when the event is emitted
6749
+ */
6750
+ id: string;
6751
+ /**
6752
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
6753
+ */
6754
+ parentId: string | null;
6755
+ /**
6756
+ * ISO 8601 timestamp when the event was created
6757
+ */
6758
+ timestamp: string;
6759
+ /**
6760
+ * Type discriminator. Always "session.canvas.closed".
6761
+ */
6762
+ type: "session.canvas.closed";
6763
+ }
6764
+ /**
6765
+ * Schema for the `CanvasClosedData` type.
6766
+ */
6767
+ export interface CanvasClosedData {
6768
+ /**
6769
+ * Provider-local canvas identifier
6770
+ */
6771
+ canvasId: string;
6772
+ /**
6773
+ * Owning provider identifier
6774
+ */
6775
+ extensionId: string;
6776
+ /**
6777
+ * Stable caller-supplied identifier of the canvas instance that was closed
6778
+ */
6779
+ instanceId: string;
6780
+ }
6702
6781
  /**
6703
6782
  * Session event "session.extensions.attachments_pushed".
6704
6783
  */
package/dist/session.d.ts CHANGED
@@ -170,12 +170,14 @@ export declare class CopilotSession {
170
170
  */
171
171
  on(handler: SessionEventHandler): () => void;
172
172
  private upsertOpenCanvasFromEvent;
173
+ private removeOpenCanvasFromEvent;
174
+ private removeOpenCanvas;
173
175
  private upsertOpenCanvas;
174
176
  /**
175
177
  * Snapshot of canvas instances currently known to be open for this session.
176
178
  * Populated from the `session.resume` response and live `session.canvas.opened`
177
- * events. Returns a defensive copy — mutating the returned array has no effect
178
- * on the session.
179
+ * and `session.canvas.closed` events. Returns a defensive copy — mutating the
180
+ * returned array has no effect on the session.
179
181
  */
180
182
  get openCanvases(): OpenCanvasInstance[];
181
183
  private assertElicitation;
package/dist/session.js CHANGED
@@ -253,6 +253,8 @@ class CopilotSession {
253
253
  this._capabilities = { ...this._capabilities, ...event.data };
254
254
  } else if (event.type === "session.canvas.opened") {
255
255
  this.upsertOpenCanvasFromEvent(event.data);
256
+ } else if (event.type === "session.canvas.closed") {
257
+ this.removeOpenCanvasFromEvent(event.data);
256
258
  }
257
259
  }
258
260
  upsertOpenCanvasFromEvent(data) {
@@ -262,6 +264,18 @@ class CopilotSession {
262
264
  }
263
265
  this.upsertOpenCanvas(data);
264
266
  }
267
+ removeOpenCanvasFromEvent(data) {
268
+ if (!data || typeof data !== "object" || typeof data.instanceId !== "string" || data.instanceId.length === 0) {
269
+ console.warn("failed to deserialize session.canvas.closed payload");
270
+ return;
271
+ }
272
+ this.removeOpenCanvas(data.instanceId);
273
+ }
274
+ removeOpenCanvas(instanceId) {
275
+ this.openCanvasInstances = this.openCanvasInstances.filter(
276
+ (open) => open.instanceId !== instanceId
277
+ );
278
+ }
265
279
  upsertOpenCanvas(instance) {
266
280
  const index = this.openCanvasInstances.findIndex(
267
281
  (open) => open.instanceId === instance.instanceId
@@ -553,8 +567,8 @@ class CopilotSession {
553
567
  /**
554
568
  * Snapshot of canvas instances currently known to be open for this session.
555
569
  * Populated from the `session.resume` response and live `session.canvas.opened`
556
- * events. Returns a defensive copy — mutating the returned array has no effect
557
- * on the session.
570
+ * and `session.canvas.closed` events. Returns a defensive copy — mutating the
571
+ * returned array has no effect on the session.
558
572
  */
559
573
  get openCanvases() {
560
574
  return [...this.openCanvasInstances];
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",
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",
@@ -56,7 +56,7 @@
56
56
  "author": "GitHub",
57
57
  "license": "MIT",
58
58
  "dependencies": {
59
- "@github/copilot": "^1.0.57",
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/**/*",