@github/copilot-sdk 1.0.17-preview.5 → 1.0.17-preview.6

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/index.d.ts CHANGED
@@ -13,5 +13,5 @@ export { defineWorkflow, WorkflowResumeError, isWorkflowRunTerminal } from "./wo
13
13
  export { Canvas, CanvasError, createCanvas, type CanvasAction, type CanvasDeclaration, type CanvasHostContext, type CanvasHostContextCapabilities, type CanvasJsonSchema, type CanvasOptions, } from "./canvas.js";
14
14
  export { defineTool, approveAll, createAttributedPermissionResult, convertMcpCallToolResult, createSessionFsAdapter, CopilotRequestHandler, CopilotWebSocketHandler, CopilotWebSocketCloseStatus, CopilotWebSocketForwarder, SessionFsSqliteTransactionFailure, SessionFsWriteFailure, SYSTEM_MESSAGE_SECTIONS, } from "./types.js";
15
15
  export type * from "./generated/session-events.js";
16
- export type { AskUserVariant, CommandContext, CommandDefinition, CommandHandler, CanvasProviderIdentity, CloudSessionOptions, CloudSessionRepository, AuthIdentityMetadata, AuthInfoType, ConnectorAccountRequest, ConnectorAvailability, ConnectorCapabilities, ConnectorCatalogEntry, ConnectorCatalogResult, ConnectorCatalogStatus, ConnectorConnectRequest, ConnectorConnectResult, ConnectorContinueRequest, ConnectorDisconnectResult, ConnectorMcpStatus, ConnectorReconcileRequest, ConnectorRuntimeStatus, ConnectorSessionAccount, ConnectorSessionAccountResult, ConnectorStatus, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, AgentStopHandler, AgentStopHookInput, AgentStopHookOutput, SubagentStartHandler, SubagentStartHookInput, SubagentStartHookOutput, SubagentStopHandler, SubagentStopHookInput, SubagentStopHookOutput, UserPromptTransformedHandler, UserPromptTransformedHookInput, UserPromptTransformedHookOutput, CopilotClientInfo, CopilotClientMode, CopilotClientOptions, InstallationConfirmationHandler, InstallationConfirmationRequest, InstallationConfirmationResponse, InstallationDecision, InstallationReview, McpInstallationReview, CopilotExpAssignmentResponse, StdioRuntimeConnection, InProcessRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, ChildProcessRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExpConfigEntry, ExpFlagValue, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionLaunchProfile, ExtensionLaunchProvider, ExtensionLaunchProviderResolveRequest, ExtensionLaunchProviderResolveResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, GitHubMcpToolConfig, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, GitHubTokenAcquireReason, GitHubTokenAcquireResult, GitHubTokenProvider, GitHubTokenProviderArgs, GitHubTokenProviderResult, InfiniteSessionConfig, LargeToolOutputConfig, MemoryConfiguration, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, BearerTokenProvider, ExtensionContextAttachment, MessageOptions, ResponseSchema, MessageSource, ManagedSettings, ManagedSettingsPermissions, ModelBilling, ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, AutoTier, CapiSessionOptions, CurrentModel, ModelSwitchAutoTierResult, ModelSwitchAutoTierStatus, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, NamedProviderConfig, PermissionHandler, PermissionRequest, PermissionRequestedData, PermissionRequestedEvent, PermissionRequestResult, AttributedPermissionResult, PermissionDecisionContext, PermissionDecisionOutcome, PermissionDecisionSource, PermissionDecisionSurface, PermissionResponseCapability, ProviderConfig, ProviderConfigModelProvider, ProviderModelConfig, ProviderTokenArgs, RemoteSessionMode, SandboxConfigSource, ResumeSessionConfig, TranscriptRecovery, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionHooks, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, SessionFsSqliteStatement, SessionFsSqliteTransactionErrorClass, CopilotRequestContext, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, CurrentToolMetadata, ToolTelemetry, ToolResultObject, ToolSearchConfig, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
16
+ export type { AskUserVariant, CommandContext, CommandDefinition, CommandHandler, CanvasProviderIdentity, CloudSessionOptions, CloudSessionRepository, AuthIdentityMetadata, AuthInfoType, ConnectorAccountRequest, ConnectorAvailability, ConnectorCapabilities, ConnectorCatalogEntry, ConnectorCatalogResult, ConnectorCatalogStatus, ConnectorConnectRequest, ConnectorConnectResult, ConnectorContinueRequest, ConnectorDisconnectResult, ConnectorMcpStatus, ConnectorReconcileRequest, ConnectorRuntimeStatus, ConnectorSessionAccount, ConnectorSessionAccountResult, ConnectorStatus, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, AgentStopHandler, AgentStopHookInput, AgentStopHookOutput, SubagentStartHandler, SubagentStartHookInput, SubagentStartHookOutput, SubagentStopHandler, SubagentStopHookInput, SubagentStopHookOutput, UserPromptTransformedHandler, UserPromptTransformedHookInput, UserPromptTransformedHookOutput, CopilotClientInfo, CopilotClientMode, CopilotClientOptions, InstallationConfirmationHandler, InstallationConfirmationRequest, InstallationConfirmationResponse, InstallationDecision, InstallationReview, McpInstallationReview, CopilotExpAssignmentResponse, StdioRuntimeConnection, InProcessRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, ChildProcessRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExpConfigEntry, ExpFlagValue, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionLaunchProfile, ExtensionLaunchProvider, ExtensionLaunchProviderResolveRequest, ExtensionLaunchProviderResolveResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, GitHubMcpToolConfig, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, GitHubTokenAcquireReason, GitHubTokenAcquireResult, GitHubTokenProvider, GitHubTokenProviderArgs, GitHubTokenProviderResult, InfiniteSessionConfig, LargeToolOutputConfig, MemoryConfiguration, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, BearerTokenProvider, ExtensionContextAttachment, MessageOptions, ResponseSchema, MessageSource, ManagedSettings, ManagedSettingsPermissions, ModelBilling, ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, AutoTier, CapiSessionOptions, CurrentModel, ModelSwitchAutoTierResult, ModelSwitchAutoTierStatus, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, NamedProviderConfig, PermissionHandler, PermissionRequest, PermissionRequestedData, PermissionRequestedEvent, PermissionRequestResult, AttributedPermissionResult, PermissionDecisionContext, PermissionDecisionOutcome, PermissionDecisionSource, PermissionDecisionSurface, PermissionResponseCapability, ProviderConfig, ProviderConfigModelProvider, ProviderModelConfig, ProviderTokenArgs, RemoteSessionMode, SandboxConfigSource, ResumeSessionConfig, TranscriptRecovery, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionHooks, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, SessionFsSqliteStatement, SessionFsSqliteTransactionErrorClass, SkillProvider, SkillProviderCallOptions, SkillProviderDescriptor, CopilotRequestContext, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, CurrentToolMetadata, ToolTelemetry, ToolResultObject, ToolSearchConfig, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
17
17
  export type { JsonValue, WorkflowRunOptions, WorkflowResumeOptions, WorkflowLimitOverrides, WorkflowResumeErrorCode, SessionWorkflowApi, WorkflowAgentOptions, WorkflowContext, WorkflowDefinition, WorkflowHandle, WorkflowJsonSchema, WorkflowLimits, WorkflowMeta, WorkflowPipelineStage, WorkflowStepOptions, WorkflowRunResult, WorkflowRunStatus, WorkflowRunSummary, WorkflowListRunsOptions, WorkflowRunsPage, WorkflowRunDetail, WorkflowProgressPage, WorkflowProgressLine, WorkflowPhaseObservation, WorkflowPhaseStatus, WorkflowAgentSummary, } from "./workflow.js";
package/dist/session.d.ts CHANGED
@@ -59,6 +59,7 @@ export declare class CopilotSession {
59
59
  private elicitationHandler?;
60
60
  private exitPlanModeHandler?;
61
61
  private autoModeSwitchHandler?;
62
+ private skillProvider?;
62
63
  private hooks?;
63
64
  private transformCallbacks?;
64
65
  private _rpc;
@@ -235,6 +236,12 @@ export declare class CopilotSession {
235
236
  private _confirm;
236
237
  private _select;
237
238
  private _input;
239
+ private requireSkillProvider;
240
+ /**
241
+ * Runs a provider call with an abort signal tied to the runtime's request
242
+ * cancellation. Failures are logged locally and reported generically.
243
+ */
244
+ private callSkillProvider;
238
245
  /**
239
246
  * Retrieves all events and messages from this session's history.
240
247
  *
package/dist/session.js CHANGED
@@ -266,6 +266,7 @@ class CopilotSession {
266
266
  elicitationHandler;
267
267
  exitPlanModeHandler;
268
268
  autoModeSwitchHandler;
269
+ skillProvider;
269
270
  hooks;
270
271
  transformCallbacks;
271
272
  _rpc = null;
@@ -678,6 +679,7 @@ class CopilotSession {
678
679
  this.elicitationHandler = void 0;
679
680
  this.exitPlanModeHandler = void 0;
680
681
  this.autoModeSwitchHandler = void 0;
682
+ this.skillProvider = void 0;
681
683
  this.commandHandlers.clear();
682
684
  this.canvases.clear();
683
685
  this.workflows.clear();
@@ -1584,6 +1586,68 @@ class CopilotSession {
1584
1586
  registerUserInputHandler(handler) {
1585
1587
  this.userInputHandler = handler;
1586
1588
  }
1589
+ /**
1590
+ * Registers the session's skill provider.
1591
+ *
1592
+ * @param provider - The skill provider, or undefined to remove it
1593
+ * @internal This method is typically called internally when creating a session.
1594
+ */
1595
+ registerSkillProvider(provider) {
1596
+ this.skillProvider = provider;
1597
+ }
1598
+ /**
1599
+ * Handles a `skillProvider.list` request from the runtime.
1600
+ *
1601
+ * @internal This method is for internal use by the SDK.
1602
+ */
1603
+ async _handleSkillProviderList(token) {
1604
+ const provider = this.requireSkillProvider();
1605
+ return await this.callSkillProvider("listSkills", token, async (options) => ({
1606
+ skills: await provider.listSkills(options) ?? []
1607
+ }));
1608
+ }
1609
+ /**
1610
+ * Handles a `skillProvider.read` request from the runtime.
1611
+ *
1612
+ * @internal This method is for internal use by the SDK.
1613
+ */
1614
+ async _handleSkillProviderRead(name, token) {
1615
+ const provider = this.requireSkillProvider();
1616
+ return await this.callSkillProvider("readSkill", token, async (options) => ({
1617
+ markdown: await provider.readSkill(name, options) ?? null
1618
+ }));
1619
+ }
1620
+ requireSkillProvider() {
1621
+ if (!this.skillProvider) {
1622
+ throw new Error(`No skill provider for session: ${this.sessionId}`);
1623
+ }
1624
+ return this.skillProvider;
1625
+ }
1626
+ /**
1627
+ * Runs a provider call with an abort signal tied to the runtime's request
1628
+ * cancellation. Failures are logged locally and reported generically.
1629
+ */
1630
+ async callSkillProvider(operation, token, call) {
1631
+ const controller = new AbortController();
1632
+ const subscription = token?.onCancellationRequested(() => controller.abort());
1633
+ if (token?.isCancellationRequested) {
1634
+ controller.abort();
1635
+ }
1636
+ try {
1637
+ return await call({ signal: controller.signal });
1638
+ } catch (error) {
1639
+ if (controller.signal.aborted) {
1640
+ throw new ResponseError(-32800, `Skill provider ${operation} cancelled`);
1641
+ }
1642
+ console.error(`Skill provider ${operation} failed`, {
1643
+ sessionId: this.sessionId,
1644
+ error
1645
+ });
1646
+ throw skillProviderFailure(operation);
1647
+ } finally {
1648
+ subscription?.dispose();
1649
+ }
1650
+ }
1587
1651
  /**
1588
1652
  * Registers hook handlers for session lifecycle events.
1589
1653
  *
@@ -1937,6 +2001,9 @@ function toCanvasRpcError(error) {
1937
2001
  const message = error instanceof Error ? error.message : String(error);
1938
2002
  return new ResponseError(ErrorCodes.InternalError, message, { code, message });
1939
2003
  }
2004
+ function skillProviderFailure(operation) {
2005
+ return new ResponseError(ErrorCodes.InternalError, `Skill provider ${operation} failed`);
2006
+ }
1940
2007
  function strictJsonValidationError(context, category, message, path) {
1941
2008
  return new ResponseError(ErrorCodes.InternalError, message, {
1942
2009
  code: context.code,
package/dist/types.d.ts CHANGED
@@ -50,6 +50,8 @@ export type { SessionFsSqliteTransactionErrorClass } from "./sessionFsProvider.j
50
50
  export { SessionFsSqliteTransactionFailure } from "./sessionFsProvider.js";
51
51
  export { SessionFsWriteFailure } from "./sessionFsProvider.js";
52
52
  export type { LlmInferenceHeaders } from "./generated/rpc.js";
53
+ import type { SkillProviderDescriptor } from "./generated/rpc.js";
54
+ export type { SkillProviderDescriptor };
53
55
  export type { PermissionDecisionContext, PermissionDecisionOutcome, PermissionDecisionSurface, PermissionResponseCapability, } from "./generated/rpc.js";
54
56
  export type { PermissionDecisionSource } from "./generated/session-events.js";
55
57
  export type { CopilotRequestContext } from "./copilotRequestHandler.js";
@@ -1893,6 +1895,57 @@ export interface ManagedSettings {
1893
1895
  }
1894
1896
  /** Selects the model-facing shape of the built-in `ask_user` tool. */
1895
1897
  export type AskUserVariant = "legacy" | "elicitation";
1898
+ /**
1899
+ * Supplies session-scoped skills from the host's own storage, such as a
1900
+ * database, instead of `SKILL.md` files on disk.
1901
+ *
1902
+ * The runtime calls {@link SkillProvider.listSkills} when it builds the
1903
+ * session's skill catalog, and {@link SkillProvider.readSkill} each time it
1904
+ * needs a skill's instructions: when the model loads the skill through the
1905
+ * `skill` tool, when a user runs `/skill-name`, or when a custom agent lists
1906
+ * the skill. Calls may run concurrently, including on behalf of sub-agents, and
1907
+ * each call must finish within 30 seconds. Errors thrown by a provider are
1908
+ * never shown to the model.
1909
+ *
1910
+ * Supply a provider with {@link SessionConfigBase.skillProvider}. Providers
1911
+ * aren't supported for cloud sessions.
1912
+ *
1913
+ * @experimental Session-scoped skill providers are experimental and may change
1914
+ * or be removed in future SDK or CLI releases.
1915
+ */
1916
+ export interface SkillProvider {
1917
+ /**
1918
+ * Returns catalog metadata for every skill the provider supplies. The
1919
+ * descriptors are authoritative: names must be unique ignoring case, and
1920
+ * the runtime validates their limits.
1921
+ */
1922
+ listSkills(options: SkillProviderCallOptions): SkillProviderDescriptor[] | Promise<SkillProviderDescriptor[]>;
1923
+ /**
1924
+ * Returns the `SKILL.md` text for the named skill, or `null`/`undefined`
1925
+ * when the skill no longer exists.
1926
+ *
1927
+ * YAML frontmatter is optional. Fields it omits come from the skill's
1928
+ * descriptor, fields it declares must match the descriptor, and
1929
+ * `allowed-tools` can only be set there. Text whose first line is `---` is
1930
+ * parsed as frontmatter.
1931
+ *
1932
+ * @param name - The skill's name, as listed by {@link SkillProvider.listSkills}.
1933
+ */
1934
+ readSkill(name: string, options: SkillProviderCallOptions): string | null | undefined | Promise<string | null | undefined>;
1935
+ }
1936
+ /**
1937
+ * Per-call options passed to {@link SkillProvider} methods.
1938
+ *
1939
+ * @experimental Session-scoped skill providers are experimental and may change
1940
+ * or be removed in future SDK or CLI releases.
1941
+ */
1942
+ export interface SkillProviderCallOptions {
1943
+ /**
1944
+ * Aborted when the runtime cancels the call, for example when it times out
1945
+ * or the session disconnects. The runtime ignores any later result.
1946
+ */
1947
+ signal: AbortSignal;
1948
+ }
1896
1949
  /**
1897
1950
  * Shared configuration fields used by both {@link SessionConfig} (for
1898
1951
  * creating a new session) and {@link ResumeSessionConfig} (for resuming
@@ -2312,6 +2365,22 @@ export interface SessionConfigBase {
2312
2365
  * Directories to load skills from.
2313
2366
  */
2314
2367
  skillDirectories?: string[];
2368
+ /**
2369
+ * Supplies skills from the host's own storage instead of `SKILL.md` files on
2370
+ * disk. Provider skills join the session's skill catalog alongside file-based
2371
+ * skills. See {@link SkillProvider}.
2372
+ *
2373
+ * Supplying a provider enables skills unless `enableSkills` is set explicitly,
2374
+ * so set `enableSkills: true` when the client runs in `"empty"` mode. With
2375
+ * `enableSkills: false` the provider stays bound but receives no calls.
2376
+ *
2377
+ * The provider isn't persisted. Pass it again when resuming the session;
2378
+ * resuming without one removes the provider's skills.
2379
+ *
2380
+ * @experimental Session-scoped skill providers are experimental and may change
2381
+ * or be removed in future SDK or CLI releases.
2382
+ */
2383
+ skillProvider?: SkillProvider;
2315
2384
  /**
2316
2385
  * Local filesystem paths to Open Plugins-format directories
2317
2386
  * (https://open-plugins.com/) to load for this session.
package/package.json CHANGED
@@ -5,8 +5,8 @@
5
5
  "url": "https://github.com/github/copilot-agent-runtime.git",
6
6
  "directory": "src/sdk/nodejs"
7
7
  },
8
- "version": "1.0.17-preview.5",
9
- "copilotCliVersion": "1.0.92-5",
8
+ "version": "1.0.17-preview.6",
9
+ "copilotCliVersion": "1.0.93-0",
10
10
  "description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC",
11
11
  "main": "./dist/cjs/index.js",
12
12
  "types": "./dist/index.d.ts",
@@ -103,18 +103,18 @@
103
103
  "README.md"
104
104
  ],
105
105
  "copilotRuntime": {
106
- "sourceSha": "6d9037e403e4fac0cc65be349f6ab0d9c9351564",
107
- "version": "1.0.92-5",
106
+ "sourceSha": "1ce52eda72a28d686f7bf6adf5d73b288e326e88",
107
+ "version": "1.0.93-0",
108
108
  "visibility": "public"
109
109
  },
110
110
  "optionalDependencies": {
111
- "@github/copilot-sdk-darwin-arm64": "1.0.17-preview.5",
112
- "@github/copilot-sdk-darwin-x64": "1.0.17-preview.5",
113
- "@github/copilot-sdk-linux-arm64": "1.0.17-preview.5",
114
- "@github/copilot-sdk-linux-x64": "1.0.17-preview.5",
115
- "@github/copilot-sdk-linuxmusl-arm64": "1.0.17-preview.5",
116
- "@github/copilot-sdk-linuxmusl-x64": "1.0.17-preview.5",
117
- "@github/copilot-sdk-win32-arm64": "1.0.17-preview.5",
118
- "@github/copilot-sdk-win32-x64": "1.0.17-preview.5"
111
+ "@github/copilot-sdk-darwin-arm64": "1.0.17-preview.6",
112
+ "@github/copilot-sdk-darwin-x64": "1.0.17-preview.6",
113
+ "@github/copilot-sdk-linux-arm64": "1.0.17-preview.6",
114
+ "@github/copilot-sdk-linux-x64": "1.0.17-preview.6",
115
+ "@github/copilot-sdk-linuxmusl-arm64": "1.0.17-preview.6",
116
+ "@github/copilot-sdk-linuxmusl-x64": "1.0.17-preview.6",
117
+ "@github/copilot-sdk-win32-arm64": "1.0.17-preview.6",
118
+ "@github/copilot-sdk-win32-x64": "1.0.17-preview.6"
119
119
  }
120
120
  }