@github/copilot-sdk 1.0.28-preview.0 → 1.0.29-preview.0

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
@@ -4,7 +4,7 @@
4
4
  * JSON-RPC based SDK for programmatic control of GitHub Copilot CLI
5
5
  */
6
6
  export { CopilotClient } from "./client.js";
7
- export type { HostLocalServerOptions, HostGitHubEnvironmentOptions, ModelGetReasoningSummariesRequest, ModelGetReasoningSummariesResult, SandboxConfig, AutopilotOptions, } from "./generated/rpc.js";
7
+ export type { HostLocalServerOptions, HostGitHubEnvironmentOptions, Model, ModelGetReasoningSummariesRequest, ModelGetReasoningSummariesResult, SandboxConfig, AutopilotOptions, } from "./generated/rpc.js";
8
8
  export { AhpHost, type AhpHostExit, type AhpHostOptions, type AhpHostAuthentication, type AhpSessionAuthentication, type AhpSessionCreateRequest, type AhpSessionResumeRequest, } from "./host.js";
9
9
  export { DisableBypassPermissionsModes, RuntimeConnection } from "./types.js";
10
10
  export { BuiltInTools, ToolSet } from "./toolSet.js";
@@ -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, EntraAuthConfig, 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, WorkingDirectoryTrust, 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, ToolNamespace, CurrentToolMetadata, ToolTelemetry, ToolResultObject, ToolSearchConfig, ImageGenerationConfig, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
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";
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, EntraAuthConfig, EntraAuthOptions, EntraTokenProvider, EntraTokenProviderArgs, EntraTokenProviderResult, 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, KerberosAuthAcquireRequest, KerberosAuthConfig, KerberosAuthMode, KerberosAuthScope, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, HostDiagnostics, HostErrorReportingStatus, 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, WorkingDirectoryTrust, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionHooks, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsByteRange, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, SessionFsSqliteStatement, SessionFsSqliteTransactionErrorClass, SkillProvider, SkillProviderCallOptions, SkillProviderDescriptor, CopilotRequestContext, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolNamespace, CurrentToolMetadata, ToolTelemetry, ToolResultObject, ToolSearchConfig, ImageGenerationConfig, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
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, WorkflowAgentContextObservation, WorkflowAgentModelObservation, WorkflowAgentReasoningEffortObservation, WorkflowAgentSummary, } from "./workflow.js";
@@ -1,4 +1,4 @@
1
- import { type CancellationToken, type MessageConnection } from "vscode-jsonrpc/node.js";
1
+ import type { CancellationToken, MessageConnection } from "./jsonrpcTypes.js";
2
2
  import type { InstallationConfirmationRequest, InstallationDecision, InstallationsConfirmResult } from "./generated/rpc.js";
3
3
  /** The `installations.confirm` receiver, invoked with the transport's request cancellation. */
4
4
  export interface InstallationConfirmationReceiver {
@@ -1,7 +1,4 @@
1
- import {
2
- CancellationTokenSource,
3
- ResponseError
4
- } from "vscode-jsonrpc/node.js";
1
+ import { CancellationTokenSource, ResponseError } from "vscode-jsonrpc/node";
5
2
  function createInstallationConfirmationAdapter(connection, handler) {
6
3
  const closed = new CancellationTokenSource();
7
4
  const closeSubscription = connection.onClose(() => closed.cancel());
@@ -0,0 +1,14 @@
1
+ export interface Disposable {
2
+ dispose(): void;
3
+ }
4
+ export interface CancellationToken {
5
+ readonly isCancellationRequested: boolean;
6
+ readonly onCancellationRequested: <T>(listener: (event: T) => unknown, thisArgs?: unknown, disposables?: Disposable[]) => Disposable;
7
+ }
8
+ export interface MessageConnection {
9
+ sendRequest<R>(method: string, params?: unknown): Promise<R>;
10
+ onRequest<P, R>(method: string, handler: (params: P, token: CancellationToken) => R | Promise<R>): Disposable;
11
+ onNotification<P>(method: string, handler: (params: P) => void | Promise<void>): Disposable;
12
+ onClose(listener: () => void): Disposable;
13
+ onDispose(listener: () => void): Disposable;
14
+ }
File without changes
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The SDK protocol version.
3
- * This must match the version expected by the copilot-agent-runtime server.
3
+ * This must match the version expected by the Copilot runtime server.
4
4
  */
5
5
  export declare const SDK_PROTOCOL_VERSION = 3;
6
6
  /**
package/dist/session.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  ConnectionError,
5
5
  ErrorCodes,
6
6
  ResponseError
7
- } from "vscode-jsonrpc/node.js";
7
+ } from "vscode-jsonrpc/node";
8
8
  import { createInternalSessionRpc, createSessionRpc } from "./generated/rpc.js";
9
9
  import { CanvasError } from "./canvas.js";
10
10
  import { getTraceContext } from "./telemetry.js";
@@ -245,6 +245,15 @@ function isWorkflowAbortError(error) {
245
245
  function isWorkflowFatalError(error) {
246
246
  return isWorkflowAbortError(error) || error instanceof ResponseError || error instanceof ConnectionError;
247
247
  }
248
+ const MAX_TIMER_DELAY_MS = 2 ** 31 - 1;
249
+ function setLongTimeout(callback, delayMs) {
250
+ let timer;
251
+ const arm = (remainingMs) => {
252
+ timer = remainingMs > MAX_TIMER_DELAY_MS ? setTimeout(() => arm(remainingMs - MAX_TIMER_DELAY_MS), MAX_TIMER_DELAY_MS) : setTimeout(callback, remainingMs);
253
+ };
254
+ arm(delayMs);
255
+ return () => clearTimeout(timer);
256
+ }
248
257
  const TOOL_SEARCH_TOOL_NAME = "tool_search_tool";
249
258
  class CopilotSession {
250
259
  /**
@@ -655,11 +664,11 @@ class CopilotSession {
655
664
  else resolveOutcome({ kind: "error", error });
656
665
  };
657
666
  this.pendingResponseWaits.add(fail);
658
- let timeoutId;
667
+ let cancelTimeout;
659
668
  let waiting = true;
660
669
  try {
661
670
  const timeoutPromise = new Promise((_, reject) => {
662
- timeoutId = setTimeout(
671
+ cancelTimeout = setLongTimeout(
663
672
  () => reject(
664
673
  new Error(
665
674
  `Timeout after ${effectiveTimeout}ms waiting for response completion`
@@ -687,9 +696,7 @@ class CopilotSession {
687
696
  return outcome.message;
688
697
  } finally {
689
698
  waiting = false;
690
- if (timeoutId !== void 0) {
691
- clearTimeout(timeoutId);
692
- }
699
+ cancelTimeout?.();
693
700
  unsubscribe();
694
701
  buffered.length = 0;
695
702
  this.pendingResponseWaits.delete(fail);
@@ -723,7 +730,7 @@ class CopilotSession {
723
730
  fail = reject;
724
731
  });
725
732
  this.pendingResponseWaits.add(fail);
726
- const timer = setTimeout(
733
+ const cancelTimeout = setLongTimeout(
727
734
  () => fail(new Error(`Timeout after ${timeout}ms waiting for session.idle`)),
728
735
  timeout
729
736
  );
@@ -762,7 +769,7 @@ class CopilotSession {
762
769
  try {
763
770
  return await Promise.race([operation(), stopped]);
764
771
  } finally {
765
- clearTimeout(timer);
772
+ cancelTimeout();
766
773
  unsubscribe();
767
774
  this.pendingResponseWaits.delete(fail);
768
775
  resolveDispatched();
@@ -820,7 +827,7 @@ class CopilotSession {
820
827
  });
821
828
  this.pendingStructuredWaits.add(fail);
822
829
  let waiting = true;
823
- const timer = setTimeout(
830
+ const cancelTimeout = setLongTimeout(
824
831
  () => fail(new Error(`Timeout after ${timeout}ms waiting for the structured response`)),
825
832
  timeout
826
833
  );
@@ -847,7 +854,7 @@ class CopilotSession {
847
854
  return outcome.message;
848
855
  } finally {
849
856
  waiting = false;
850
- clearTimeout(timer);
857
+ cancelTimeout();
851
858
  buffered.length = 0;
852
859
  unsubscribe();
853
860
  this.pendingStructuredWaits.delete(fail);
@@ -1004,12 +1011,23 @@ class CopilotSession {
1004
1011
  }
1005
1012
  }
1006
1013
  } else if (event.type === "permission.requested") {
1007
- const { requestId, permissionRequest, promptRequest, resolvedByHook } = event.data;
1014
+ const {
1015
+ requestId,
1016
+ permissionRequest,
1017
+ promptRequest,
1018
+ assistedApprovalAssessment,
1019
+ resolvedByHook
1020
+ } = event.data;
1008
1021
  if (resolvedByHook) {
1009
1022
  return;
1010
1023
  }
1011
1024
  if (this.permissionHandler) {
1012
- void this._executePermissionAndRespond(requestId, permissionRequest, promptRequest);
1025
+ void this._executePermissionAndRespond(
1026
+ requestId,
1027
+ permissionRequest,
1028
+ promptRequest,
1029
+ assistedApprovalAssessment
1030
+ );
1013
1031
  }
1014
1032
  } else if (event.type === "mcp.oauth_required") {
1015
1033
  const data = event.data;
@@ -1028,15 +1046,7 @@ class CopilotSession {
1028
1046
  void this._executeCommandAndRespond(requestId, commandName, command, args);
1029
1047
  } else if (event.type === "elicitation.requested") {
1030
1048
  if (this.elicitationHandler) {
1031
- const {
1032
- message,
1033
- requestedSchema,
1034
- mode,
1035
- elicitationSource,
1036
- elicitationSourceDisplayName,
1037
- url,
1038
- requestId
1039
- } = event.data;
1049
+ const { message, requestedSchema, mode, elicitationSource, url, requestId } = event.data;
1040
1050
  void this._handleElicitationRequest(
1041
1051
  {
1042
1052
  sessionId: this.sessionId,
@@ -1044,14 +1054,17 @@ class CopilotSession {
1044
1054
  requestedSchema,
1045
1055
  mode,
1046
1056
  elicitationSource,
1047
- elicitationSourceDisplayName,
1048
1057
  url
1049
1058
  },
1050
1059
  requestId
1051
1060
  );
1052
1061
  }
1053
1062
  } else if (event.type === "capabilities.changed") {
1054
- this._capabilities = { ...this._capabilities, ...event.data };
1063
+ const { ui, ...changed } = event.data;
1064
+ this._capabilities = { ...this._capabilities, ...changed };
1065
+ if (ui) {
1066
+ this._capabilities.ui = { ...this._capabilities.ui, ...ui };
1067
+ }
1055
1068
  } else if (event.type === "session.canvas.opened") {
1056
1069
  this.upsertOpenCanvasFromEvent(event.data);
1057
1070
  } else if (event.type === "session.canvas.closed") {
@@ -1177,12 +1190,13 @@ class CopilotSession {
1177
1190
  * Executes a permission handler and sends the result back via RPC.
1178
1191
  * @internal
1179
1192
  */
1180
- async _executePermissionAndRespond(requestId, permissionRequest, promptRequest) {
1193
+ async _executePermissionAndRespond(requestId, permissionRequest, promptRequest, assistedApprovalAssessment) {
1181
1194
  try {
1182
1195
  const invocation = {
1183
1196
  sessionId: this.sessionId,
1184
1197
  managedSettingsEnabled: this.managedSettingsEnabled,
1185
- ...promptRequest === void 0 ? {} : { promptRequest }
1198
+ ...promptRequest === void 0 ? {} : { promptRequest },
1199
+ ...assistedApprovalAssessment === void 0 ? {} : { assistedApprovalAssessment }
1186
1200
  };
1187
1201
  const handlerResult = await this.permissionHandler(permissionRequest, invocation);
1188
1202
  const isAttributed = isAttributedPermissionResult(handlerResult);
@@ -6,6 +6,13 @@ export type { SessionFsSqliteQueryType, SessionFsSqliteTransactionErrorClass };
6
6
  * `error` field, since providers signal errors by throwing.
7
7
  */
8
8
  export type SessionFsFileInfo = Omit<SessionFsStatResult, "error">;
9
+ /** Raw bytes and the authoritative total file byte length captured by the same read. */
10
+ export interface SessionFsByteRange {
11
+ /** Requested bytes; boundaries may split UTF-8 characters. */
12
+ content: Uint8Array;
13
+ /** Total file byte length, independent of the requested range. */
14
+ byteLength: number;
15
+ }
9
16
  /**
10
17
  * Result of a SQLite query execution via {@link SessionFsSqliteProvider.query}.
11
18
  * Same shape as the generated {@link GeneratedSqliteQueryResult} but without the
@@ -84,6 +91,14 @@ export interface SessionFsProvider {
84
91
  readFile(path: string): Promise<string>;
85
92
  /** Read exact file bytes. Required when capabilities.binary is enabled. */
86
93
  readFileBytes?(path: string): Promise<Uint8Array>;
94
+ /**
95
+ * Reads raw bytes starting at a non-negative safe integer byte offset.
96
+ * Omit length to read through EOF; zero returns only byte length.
97
+ * At or beyond EOF, content is empty. Advertise capabilities.readFileRange
98
+ * only when every provider implements bounded reads without full-file downloads.
99
+ * This capability is independent of binary reads and writes.
100
+ */
101
+ readFileRange?(path: string, offset: number, length?: number): Promise<SessionFsByteRange>;
87
102
  /** Write exact file bytes. Required when capabilities.binary is enabled. */
88
103
  writeFileBytes?(path: string, content: Uint8Array, mode?: number): Promise<void>;
89
104
  /** Writes content to a file, creating parent directories if needed. Throw {@link SessionFsWriteFailure} if a failed write changed the target. */
@@ -26,6 +26,34 @@ function normalizeSqliteParams(params) {
26
26
  }
27
27
  function createSessionFsAdapter(provider) {
28
28
  return {
29
+ readFileRange: async ({ path, offset, length }) => {
30
+ try {
31
+ if (!Number.isSafeInteger(offset) || offset < 0 || length !== void 0 && (!Number.isSafeInteger(length) || length < 0)) {
32
+ throw new RangeError(
33
+ "SessionFs byte offset and length must be non-negative safe integers"
34
+ );
35
+ }
36
+ if (!provider.readFileRange) {
37
+ throw new Error(
38
+ "Byte-range reads are not supported by this SessionFs provider"
39
+ );
40
+ }
41
+ const result = await provider.readFileRange(path, offset, length);
42
+ if (!Number.isSafeInteger(result.byteLength) || result.byteLength < 0) {
43
+ throw new Error("SessionFs byte length must be a non-negative safe integer");
44
+ }
45
+ const available = Math.max(0, result.byteLength - offset);
46
+ if (result.content.byteLength !== Math.min(length ?? available, available)) {
47
+ throw new Error("SessionFs returned an incorrect byte range length");
48
+ }
49
+ return {
50
+ content: Buffer.from(result.content).toString("base64"),
51
+ byteLength: result.byteLength
52
+ };
53
+ } catch (err) {
54
+ return { content: "", byteLength: 0, error: toSessionFsError(err) };
55
+ }
56
+ },
29
57
  readFile: async ({ path }) => {
30
58
  try {
31
59
  const content = await provider.readFile(path);
package/dist/types.d.ts CHANGED
@@ -6,16 +6,17 @@ import type { SessionFsProvider } from "./sessionFsProvider.js";
6
6
  import type { CopilotRequestHandler } from "./copilotRequestHandler.js";
7
7
  import type { InstallationConfirmationHandler } from "./installationConfirmation.js";
8
8
  export type { InstallationConfirmationHandler } from "./installationConfirmation.js";
9
- import type { AgentModelPolicy, AttachmentExtensionContext as GeneratedExtensionContextAttachment, AutoTier, PermissionRequest as GeneratedPermissionRequest, PermissionRequestedData as GeneratedPermissionRequestedData, PermissionRequestedEvent as GeneratedPermissionRequestedEvent, ReasoningSummary, SessionLimitsConfig, SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js";
9
+ import type { AgentModelPolicy, AttachmentExtensionContext as GeneratedExtensionContextAttachment, AutoTier, ModelProviderRef, PermissionRequest as GeneratedPermissionRequest, PermissionRequestedData as GeneratedPermissionRequestedData, PermissionRequestedEvent as GeneratedPermissionRequestedEvent, ReasoningSummary, SessionLimitsConfig, SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js";
10
10
  import type { CopilotSession } from "./session.js";
11
11
  import type { JsonValue } from "./workflow.js";
12
- import type { ExtensionLaunchProviderHandler as GeneratedExtensionLaunchProvider, AutopilotOptions, GitHubTokenAcquireRequest, GitHubTokenAcquireResult, GitHubTelemetryNotification, ModelBillingTokenPrices, DiagnosticsConfiguration, OpenCanvasInstance, ProtocolExternalToolNamespace, CurrentToolMetadata, SandboxConfig } from "./generated/rpc.js";
12
+ import type { ExtensionLaunchProviderHandler as GeneratedExtensionLaunchProvider, AutopilotOptions, GitHubTokenAcquireRequest, GitHubTokenAcquireResult, GitHubTelemetryNotification, HostDiagnostics, ModelBillingTokenPrices, DiagnosticsConfiguration, OpenCanvasInstance, ProtocolExternalToolNamespace, CurrentToolMetadata, KerberosAuthAcquireRequest, KerberosAuthMode, KerberosAuthScope, SandboxConfig } from "./generated/rpc.js";
13
13
  import type { ToolSet } from "./toolSet.js";
14
+ export type { KerberosAuthAcquireRequest, KerberosAuthMode, KerberosAuthScope, } from "./generated/rpc.js";
14
15
  export type { RemoteSessionMode } from "./generated/rpc.js";
15
16
  export type { AutopilotOptions } from "./generated/rpc.js";
16
17
  export type { CurrentToolMetadata } from "./generated/rpc.js";
17
18
  export type { SandboxConfig, SandboxConfigSource } from "./generated/rpc.js";
18
- export type { AuthIdentityMetadata, AuthInfoType, ConnectorAccountRequest, ConnectorAvailability, ConnectorCapabilities, ConnectorCatalogEntry, ConnectorCatalogResult, ConnectorCatalogStatus, ConnectorConnectRequest, ConnectorConnectResult, ConnectorContinueRequest, ConnectorDisconnectResult, ConnectorMcpStatus, ConnectorReconcileRequest, ConnectorRuntimeStatus, ConnectorSessionAccount, ConnectorSessionAccountResult, ConnectorStatus, ExtensionLaunchProfile, ExtensionLaunchProviderResolveRequest, ExtensionLaunchProviderResolveResult, GitHubTokenAcquireReason, GitHubTokenAcquireResult, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, InstallationConfirmationRequest, InstallationConfirmationResponse, InstallationDecision, InstallationReview, McpInstallationReview, } from "./generated/rpc.js";
19
+ export type { AuthIdentityMetadata, AuthInfoType, ConnectorAccountRequest, ConnectorAvailability, ConnectorCapabilities, ConnectorCatalogEntry, ConnectorCatalogResult, ConnectorCatalogStatus, ConnectorConnectRequest, ConnectorConnectResult, ConnectorContinueRequest, ConnectorDisconnectResult, ConnectorMcpStatus, ConnectorReconcileRequest, ConnectorRuntimeStatus, ConnectorSessionAccount, ConnectorSessionAccountResult, ConnectorStatus, ExtensionLaunchProfile, ExtensionLaunchProviderResolveRequest, ExtensionLaunchProviderResolveResult, GitHubTokenAcquireReason, GitHubTokenAcquireResult, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, HostDiagnostics, HostErrorReportingStatus, InstallationConfirmationRequest, InstallationConfirmationResponse, InstallationDecision, InstallationReview, McpInstallationReview, } from "./generated/rpc.js";
19
20
  /**
20
21
  * Arguments passed to a session's {@link GitHubTokenProvider}.
21
22
  *
@@ -43,6 +44,7 @@ export type { CurrentModel, ModelSwitchAutoTierResult, ModelSwitchAutoTierStatus
43
44
  export type { SessionFsProvider } from "./sessionFsProvider.js";
44
45
  export { createSessionFsAdapter } from "./sessionFsProvider.js";
45
46
  export type { SessionFsFileInfo } from "./sessionFsProvider.js";
47
+ export type { SessionFsByteRange } from "./sessionFsProvider.js";
46
48
  export type { SessionFsSqliteQueryResult } from "./sessionFsProvider.js";
47
49
  export type { SessionFsSqliteQueryType } from "./sessionFsProvider.js";
48
50
  export type { SessionFsSqliteProvider } from "./sessionFsProvider.js";
@@ -91,7 +93,7 @@ export interface TelemetryConfig {
91
93
  exporterType?: string;
92
94
  /** Instrumentation scope name. Sets COPILOT_OTEL_SOURCE_NAME. */
93
95
  sourceName?: string;
94
- /** Whether to capture message content (prompts, responses). Sets OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT. */
96
+ /** Whether to capture span content. Sets OTEL_INSTRUMENTATION_GENAI_CAPTURE_CONTENT and its legacy boolean alias. */
95
97
  captureContent?: boolean;
96
98
  }
97
99
  /**
@@ -150,7 +152,6 @@ export interface InProcessRuntimeConnection {
150
152
  * Required for OneAuth interactive authentication on macOS. This general-purpose
151
153
  * scheduler may also be used for other runtime-owned native UI operations.
152
154
  * Temporary OneAuth workaround; this API may be removed if no longer needed.
153
- * See https://github.com/github/copilot-agent-runtime/issues/27032.
154
155
  * @experimental
155
156
  */
156
157
  readonly runOnUiThread?: (action: () => void) => void | Promise<void>;
@@ -265,14 +266,31 @@ export interface CopilotClientInfo {
265
266
  */
266
267
  integrationVersion?: string;
267
268
  }
268
- export type EntraAuthConfig = import("./generated/rpc.js").EntraAuthConfig;
269
+ /** Host application's Microsoft Entra registration. @experimental */
270
+ export type EntraAuthConfig = Pick<import("./generated/rpc.js").EntraAuthConfig, "clientId" | "matsAppName">;
271
+ /** Host-owned Entra identity or resource acquisition. @experimental */
272
+ export type EntraTokenProviderArgs = import("./generated/rpc.js").EntraTokenAcquireRequest;
273
+ /** Response matching the requested acquisition kind and pinned account. @experimental */
274
+ export type EntraTokenProviderResult = import("./generated/rpc.js").EntraTokenAcquireResult;
275
+ /**
276
+ * Selects/revalidates an identity or acquires its resource token. Renewal must be
277
+ * silent and account-pinned. Cancellation and unavailability never open runtime sign-in.
278
+ * The cancellation token fires when the request or original connection ends.
279
+ * @experimental
280
+ */
281
+ export type EntraTokenProvider = (request: EntraTokenProviderArgs, cancellation: import("./jsonrpcTypes.js").CancellationToken) => EntraTokenProviderResult | Promise<EntraTokenProviderResult>;
282
+ /** Entra application and optional host-owned acquisition. @experimental */
283
+ export interface EntraAuthOptions extends EntraAuthConfig {
284
+ /** Host-owned acquisition; omission retains built-in runtime authentication. @experimental */
285
+ tokenProvider?: EntraTokenProvider;
286
+ }
269
287
  export interface CopilotClientOptions {
270
288
  /**
271
289
  * Host application's Microsoft Entra registration, shared by its sessions.
272
290
  * Required for built-in Entra sign-in and token renewal; other authentication methods remain available.
273
291
  * @experimental
274
292
  */
275
- entra?: EntraAuthConfig;
293
+ entra?: EntraAuthOptions;
276
294
  /**
277
295
  * How to connect to the Copilot runtime. When omitted, defaults to
278
296
  * {@link RuntimeConnection.forStdio} with the bundled runtime.
@@ -317,6 +335,10 @@ export interface CopilotClientOptions {
317
335
  * @experimental
318
336
  */
319
337
  extensionLaunchProvider?: ExtensionLaunchProvider;
338
+ /**
339
+ * Supplies Kerberos credentials from the SDK host. Registered before sessions start.
340
+ */
341
+ kerberosAuth?: KerberosAuthConfig;
320
342
  /**
321
343
  * Connection-global human review for experimental installation operations.
322
344
  * Does not register or enable installation capabilities on the runtime.
@@ -444,6 +466,26 @@ export interface CopilotClientOptions {
444
466
  }
445
467
  /** Resolves launch profiles for extension entrypoints discovered by the runtime. */
446
468
  export type ExtensionLaunchProvider = GeneratedExtensionLaunchProvider;
469
+ /** Supplies Kerberos credentials from the SDK host for a requested service principal. */
470
+ export interface KerberosAuthConfig {
471
+ /** `fallback` uses the callback only when native lookup fails; `always` never attempts native lookup. */
472
+ mode: KerberosAuthMode;
473
+ /**
474
+ * `connection` (the default) authenticates only requests made for sessions this client creates or resumes;
475
+ * `runtime` also authenticates the runtime's shared background traffic. Only one connection at a time can
476
+ * hold `runtime` scope, so startup fails if another client holds it. The registration ends when the
477
+ * connection closes.
478
+ */
479
+ scope?: KerberosAuthScope;
480
+ /**
481
+ * Returns a fresh, single-use base64 SPNEGO token without the `Negotiate ` prefix, or `undefined` when unavailable.
482
+ * The SPN uses the platform-independent `service/host[@REALM]` form; validate it before issuing credentials.
483
+ * `signal` aborts when the runtime stops waiting: it cancels the request (for example when its wait times
484
+ * out) or the connection closes. The SDK then stops awaiting the callback and ignores any later result,
485
+ * so pass `signal` to credential lookups that support cancellation.
486
+ */
487
+ callback: (request: KerberosAuthAcquireRequest, signal: AbortSignal) => Promise<string | undefined>;
488
+ }
447
489
  /**
448
490
  * Configuration for creating a session
449
491
  */
@@ -854,7 +896,7 @@ export interface ElicitationResult {
854
896
  /** User action: "accept" (submitted), "decline" (rejected), or "cancel" (dismissed). */
855
897
  action: "accept" | "decline" | "cancel";
856
898
  /** Form values submitted by the user (present when action is "accept"). */
857
- content?: Record<string, ElicitationFieldValue>;
899
+ content?: Record<string, ElicitationFieldValue | undefined>;
858
900
  }
859
901
  /**
860
902
  * Parameters for a raw elicitation request.
@@ -880,8 +922,6 @@ export interface ElicitationContext {
880
922
  mode?: "form" | "url";
881
923
  /** The source that initiated the request (e.g. MCP server name). */
882
924
  elicitationSource?: string;
883
- /** Trusted display label of a Connector-owned MCP server that initiated the request, such as "Work IQ". */
884
- elicitationSourceDisplayName?: string;
885
925
  /** URL to open in the user's browser (url mode only). */
886
926
  url?: string;
887
927
  }
@@ -1098,6 +1138,16 @@ export declare function createAttributedPermissionResult(result: PermissionReque
1098
1138
  export interface PermissionHandlerInvocation {
1099
1139
  sessionId: string;
1100
1140
  managedSettingsEnabled?: boolean;
1141
+ /**
1142
+ * Canonical runtime-owned Assisted Permissions assessment.
1143
+ *
1144
+ * This explains the assisted review only; `permission.completed` remains
1145
+ * authoritative for the final permission result. It is absent with older
1146
+ * runtimes and legacy direct permission callbacks.
1147
+ *
1148
+ * @experimental
1149
+ */
1150
+ assistedApprovalAssessment?: PermissionRequestedData["assistedApprovalAssessment"];
1101
1151
  /**
1102
1152
  * Derived user-facing prompt context when supplied by the runtime.
1103
1153
  *
@@ -1210,9 +1260,13 @@ export interface BaseHookInput {
1210
1260
  agentType?: string;
1211
1261
  /** Immediate parent actor ID, when available. */
1212
1262
  parentAgentId?: string;
1263
+ /** W3C trace context for the runtime span associated with this hook, when available. */
1264
+ traceparent?: string;
1265
+ /** W3C vendor trace state associated with traceparent, when available. */
1266
+ tracestate?: string;
1213
1267
  /** The runtime session ID associated with the hook. Child tool hooks use
1214
1268
  * the child session ID; sub-agent lifecycle hooks use the parent session ID,
1215
- * matching `invocation.sessionId`. */
1269
+ * which can differ from `invocation.sessionId`. */
1216
1270
  sessionId: string;
1217
1271
  /** Time at which the hook event was emitted by the runtime. */
1218
1272
  timestamp: Date;
@@ -1222,6 +1276,8 @@ export interface BaseHookInput {
1222
1276
  * Input for pre-tool-use hook
1223
1277
  */
1224
1278
  export interface PreToolUseHookInput extends BaseHookInput {
1279
+ /** Existing tool-call ID; correlate using (sessionId, toolCallId). Absent on older runtimes. */
1280
+ toolCallId?: string;
1225
1281
  toolName: string;
1226
1282
  toolArgs: unknown;
1227
1283
  }
@@ -1273,6 +1329,8 @@ export type PreMcpToolCallHandler = (input: PreMcpToolCallHookInput, invocation:
1273
1329
  * Input for post-tool-use hook
1274
1330
  */
1275
1331
  export interface PostToolUseHookInput extends BaseHookInput {
1332
+ /** Existing tool-call ID; correlate using (sessionId, toolCallId). Absent on older runtimes. */
1333
+ toolCallId?: string;
1276
1334
  toolName: string;
1277
1335
  toolArgs: unknown;
1278
1336
  toolResult: ToolResultObject;
@@ -1300,6 +1358,8 @@ export type PostToolUseHandler = (input: PostToolUseHookInput, invocation: {
1300
1358
  * stringified failure message extracted from the tool's result, is provided.
1301
1359
  */
1302
1360
  export interface PostToolUseFailureHookInput extends BaseHookInput {
1361
+ /** Existing tool-call ID; correlate using (sessionId, toolCallId). Absent on older runtimes. */
1362
+ toolCallId?: string;
1303
1363
  toolName: string;
1304
1364
  toolArgs: unknown;
1305
1365
  /**
@@ -2312,10 +2372,10 @@ export interface SessionConfigBase {
2312
2372
  models?: ProviderModelConfig[];
2313
2373
  /**
2314
2374
  * Enables or disables internal session telemetry for this session.
2315
- * When `false`, disables session telemetry. When omitted (the default) or `true`,
2316
- * telemetry is enabled for GitHub-authenticated sessions.
2317
- * When a custom {@link provider} (BYOK) is configured, session telemetry is always
2318
- * disabled regardless of this setting.
2375
+ * `false` disables it; `true` enables it for eligible GitHub-authenticated sessions,
2376
+ * including custom {@link provider} (BYOK) sessions. Omission preserves a resident
2377
+ * session's choice; otherwise defaults to enabled. Host and account policies still
2378
+ * determine whether telemetry can be uploaded.
2319
2379
  * This is independent of the OpenTelemetry configuration in {@link CopilotClientOptions.telemetry}.
2320
2380
  */
2321
2381
  enableSessionTelemetry?: boolean;
@@ -2365,7 +2425,7 @@ export interface SessionConfigBase {
2365
2425
  customAgentsLocalOnly?: boolean;
2366
2426
  /**
2367
2427
  * When true, the runtime instructs the agent to include a `Co-authored-by`
2368
- * trailer in commit messages it composes.
2428
+ * trailer in commit messages it composes. Subagents inherit this setting.
2369
2429
  *
2370
2430
  * Defaults to `true`. Under {@link CopilotClientOptions.mode} = `"empty"`,
2371
2431
  * defaults to `false`; apps can pass `true` here to opt back in.
@@ -2822,10 +2882,10 @@ export interface ResumeSessionConfig extends SessionConfigBase {
2822
2882
  * runtime treats pending work as interrupted on resume. Completed tool results
2823
2883
  * already durably recorded by the runtime are preserved.
2824
2884
  *
2825
- * For permission requests, the runtime re-emits `permission.requested` so the
2826
- * registered `onPermissionRequest` handler can re-prompt; for external tool calls,
2827
- * the consumer is expected to supply the result via the corresponding low-level
2828
- * RPC method.
2885
+ * When true, pending permission requests and external tool calls wait for
2886
+ * caller-supplied results via the corresponding low-level RPC methods. Resuming
2887
+ * does not re-emit restored permission requests or re-invoke permission handlers
2888
+ * or already-dispatched external tool callbacks.
2829
2889
  * @default false
2830
2890
  */
2831
2891
  continuePendingWork?: boolean;
@@ -2913,7 +2973,9 @@ export interface ProviderConfig {
2913
2973
  transport?: "http" | "websockets";
2914
2974
  /**
2915
2975
  * Product serving the model, such as "ollama" or "lm_studio", reported in
2916
- * telemetry as `model_provider`. Only affects telemetry.
2976
+ * telemetry as `model_provider`. "azure_openai" also omits explicit
2977
+ * prompt-cache breakpoints, which limit cross-turn cache reuse on Azure; set
2978
+ * it for a proxy or custom domain in front of Azure OpenAI.
2917
2979
  */
2918
2980
  modelProvider?: ProviderConfigModelProvider;
2919
2981
  /**
@@ -3017,7 +3079,9 @@ export interface NamedProviderConfig {
3017
3079
  wireApi?: "completions" | "responses";
3018
3080
  /**
3019
3081
  * Product serving this provider's models, such as "ollama" or "lm_studio",
3020
- * reported in telemetry as `model_provider`. Only affects telemetry.
3082
+ * reported in telemetry as `model_provider`. "azure_openai" also omits
3083
+ * explicit prompt-cache breakpoints, which limit cross-turn cache reuse on
3084
+ * Azure; set it for a proxy or custom domain in front of Azure OpenAI.
3021
3085
  */
3022
3086
  modelProvider?: ProviderConfigModelProvider;
3023
3087
  /**
@@ -3267,6 +3331,8 @@ export interface SessionFsConfig {
3267
3331
  * @default false
3268
3332
  */
3269
3333
  binary?: boolean;
3334
+ /** Whether every session provider supports bounded byte-range reads, independently of binary support. */
3335
+ readFileRange?: boolean;
3270
3336
  };
3271
3337
  }
3272
3338
  /**
@@ -3302,6 +3368,8 @@ export interface GetStatusResponse {
3302
3368
  version: string;
3303
3369
  /** Protocol version for SDK compatibility */
3304
3370
  protocolVersion: number;
3371
+ /** Host diagnostics, when supplied by the runtime. */
3372
+ hostDiagnostics?: HostDiagnostics;
3305
3373
  }
3306
3374
  /**
3307
3375
  * Response from auth.getStatus
@@ -3368,6 +3436,8 @@ export interface ModelInfo {
3368
3436
  id: string;
3369
3437
  /** Display name */
3370
3438
  name: string;
3439
+ /** Native serving provider, when attributed by the runtime. Absent for configured BYOK models. */
3440
+ provider?: ModelProviderRef;
3371
3441
  /** Model capabilities and limits */
3372
3442
  capabilities: ModelCapabilities;
3373
3443
  /** Policy state */
@@ -6,7 +6,7 @@ export type { WorkflowRunResult };
6
6
  export type JsonValue = null | boolean | number | string | JsonValue[] | {
7
7
  [key: string]: JsonValue;
8
8
  };
9
- export type { WorkflowAgentSummary, WorkflowPhaseStatus, WorkflowPhaseObservation, WorkflowProgressLine, WorkflowProgressPage, WorkflowRunDetail, WorkflowRunStatus, WorkflowRunSummary, } from "./generated/rpc.js";
9
+ export type { WorkflowAgentContextObservation, WorkflowAgentModelObservation, WorkflowAgentReasoningEffortObservation, WorkflowAgentSummary, WorkflowPhaseStatus, WorkflowPhaseObservation, WorkflowProgressLine, WorkflowProgressPage, WorkflowRunDetail, WorkflowRunStatus, WorkflowRunSummary, } from "./generated/rpc.js";
10
10
  /**
11
11
  * Options for paging durable workflow runs.
12
12
  *
@@ -19,8 +19,8 @@ For user-scoped extensions (persist across all repos), add `location: "user"`.
19
19
 
20
20
  Modify the generated `extension.mjs` using `edit` or `create` tools. The file must:
21
21
 
22
- - Be named `extension.mjs` (only `.mjs` is supported)
23
- - Use ES module syntax (`import`/`export`)
22
+ - Be named `extension.mjs`, `extension.cjs` or `extension.js` (the scaffold creates `extension.mjs`)
23
+ - Use ES module syntax (`import`/`export`) in `.mjs` files, or CommonJS (`require`) in `.cjs` files
24
24
  - Call `joinSession({ ... })`
25
25
 
26
26
  ### Step 3: Reload extensions
@@ -53,7 +53,7 @@ Discovery rules:
53
53
  - The CLI scans `.github/extensions/` relative to the git root
54
54
  - It also scans the user's copilot config extensions directory
55
55
  - Only immediate subdirectories are checked (not recursive)
56
- - Each subdirectory must contain a file named `extension.mjs`
56
+ - Each subdirectory must contain a file named `extension.mjs`, `extension.cjs` or `extension.js`
57
57
  - Project extensions shadow user extensions on name collision
58
58
 
59
59
  ---
@@ -320,5 +320,5 @@ Low-level typed RPC access to all session APIs (model, mode, plan, workspace, et
320
320
  - **Tool name collisions are fatal.** If two extensions register the same tool name, the second extension fails to initialize.
321
321
  - **Don't call `session.send()` synchronously from `onUserPromptSubmitted`.** Use `setTimeout(() => session.send(...), 0)` to avoid infinite loops.
322
322
  - **Extensions are reloaded on `/clear`.** Any in-memory state is lost between sessions.
323
- - **Only `.mjs` is supported.** TypeScript (`.ts`) is not yet supported.
323
+ - **The entry file must be `.mjs`, `.cjs` or `.js`.** TypeScript (`.ts`) is not yet supported.
324
324
  - **The handler's return value is the tool result.** Returning `undefined` sends an empty success. Throwing sends a failure with the error message.