@github/copilot-sdk-darwin-arm64 1.0.17-preview.2 → 1.0.17-preview.3
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/copilot-sdk/extension.js +67 -0
- package/copilot-sdk/generated/rpc.d.ts +24 -0
- package/copilot-sdk/generated/session-events.d.ts +16 -0
- package/copilot-sdk/index.d.ts +1 -1
- package/copilot-sdk/index.js +67 -0
- package/copilot-sdk/session.d.ts +45 -1
- package/copilot-sdk/types.d.ts +16 -0
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/copilot-runtime +0 -0
- package/prebuilds/darwin-arm64/runtime.node +2 -2
- package/ripgrep/bin/darwin-arm64/rg +0 -0
- package/schemas/api.schema.json +31 -0
- package/schemas/session-events.schema.json +16 -0
- package/tgrep/bin/darwin-arm64/tgrep +0 -0
package/copilot-sdk/extension.js
CHANGED
|
@@ -8782,6 +8782,18 @@ function copyDefinedWorkflowAgentOption(source, target, key) {
|
|
|
8782
8782
|
target[key] = value;
|
|
8783
8783
|
}
|
|
8784
8784
|
}
|
|
8785
|
+
function toToolDefinition(tool) {
|
|
8786
|
+
return {
|
|
8787
|
+
name: tool.name,
|
|
8788
|
+
description: tool.description ?? "",
|
|
8789
|
+
parameters: toJsonSchema(tool.parameters),
|
|
8790
|
+
overridesBuiltInTool: tool.overridesBuiltInTool,
|
|
8791
|
+
skipPermission: tool.skipPermission,
|
|
8792
|
+
defer: tool.defer,
|
|
8793
|
+
metadata: tool.metadata,
|
|
8794
|
+
isTerminal: tool.isTerminal
|
|
8795
|
+
};
|
|
8796
|
+
}
|
|
8785
8797
|
var workflowExecutionStore = new AsyncLocalStorage();
|
|
8786
8798
|
function throwIfWorkflowExecutionIsActive() {
|
|
8787
8799
|
if (workflowExecutionStore.getStore()?.active) {
|
|
@@ -9002,6 +9014,8 @@ var CopilotSession = class {
|
|
|
9002
9014
|
eventHandlers = /* @__PURE__ */ new Set();
|
|
9003
9015
|
typedEventHandlers = /* @__PURE__ */ new Map();
|
|
9004
9016
|
toolHandlers = /* @__PURE__ */ new Map();
|
|
9017
|
+
/** Settles once every earlier `setTools` call has finished. */
|
|
9018
|
+
setToolsQueue = Promise.resolve();
|
|
9005
9019
|
pendingExternalTools = /* @__PURE__ */ new Map();
|
|
9006
9020
|
canvases = /* @__PURE__ */ new Map();
|
|
9007
9021
|
bearerTokenProviders = /* @__PURE__ */ new Map();
|
|
@@ -10572,6 +10586,59 @@ var CopilotSession = class {
|
|
|
10572
10586
|
async setAutoTier(autoTier) {
|
|
10573
10587
|
return await this.rpc.model.switchAutoTier({ autoTier });
|
|
10574
10588
|
}
|
|
10589
|
+
/**
|
|
10590
|
+
* Replace the tools this client supplies to the session.
|
|
10591
|
+
*
|
|
10592
|
+
* `tools` becomes the complete set of tools this client implements,
|
|
10593
|
+
* replacing the ones it supplied when the session was created or resumed,
|
|
10594
|
+
* or in an earlier call. Built-in, MCP, and plugin tools, and tools other
|
|
10595
|
+
* connected clients supply, are unaffected. Pass an empty array to remove
|
|
10596
|
+
* all of this client's tools.
|
|
10597
|
+
*
|
|
10598
|
+
* Tools are defined the same way as for `createSession`: calls to tools
|
|
10599
|
+
* with a `handler` are dispatched to it, and tools without one are
|
|
10600
|
+
* declaration-only. Once the runtime accepts the replacement, every tool
|
|
10601
|
+
* call this session dispatches uses the new handlers; calls already
|
|
10602
|
+
* running finish on their original handlers. If the runtime rejects the
|
|
10603
|
+
* replacement, this rejects and the previous tools and handlers stay in
|
|
10604
|
+
* place. Concurrent calls on the same session are applied one at a time,
|
|
10605
|
+
* in the order they are made.
|
|
10606
|
+
*
|
|
10607
|
+
* The agent sees the new tools from its next model request, which can fall
|
|
10608
|
+
* within a turn in progress. A model request already in flight was made
|
|
10609
|
+
* with the previous tools, so the agent can still call a tool you removed.
|
|
10610
|
+
* This session doesn't answer that call, and it can stay pending until the
|
|
10611
|
+
* turn is aborted. If a running turn might still call a tool you remove,
|
|
10612
|
+
* replace tools while the session is idle.
|
|
10613
|
+
*
|
|
10614
|
+
* @param tools - The complete set of tools this client supplies
|
|
10615
|
+
*
|
|
10616
|
+
* @experimental Wraps the experimental `session.tools.set` RPC and may change
|
|
10617
|
+
* or be removed in a future release.
|
|
10618
|
+
*
|
|
10619
|
+
* @example
|
|
10620
|
+
* ```typescript
|
|
10621
|
+
* await session.setTools([
|
|
10622
|
+
* defineTool("search_issues", {
|
|
10623
|
+
* description: "Search the issues shown on the current page",
|
|
10624
|
+
* parameters: z.object({ query: z.string() }),
|
|
10625
|
+
* handler: async ({ query }) => searchIssues(query),
|
|
10626
|
+
* }),
|
|
10627
|
+
* ]);
|
|
10628
|
+
* ```
|
|
10629
|
+
*/
|
|
10630
|
+
async setTools(tools) {
|
|
10631
|
+
const definitions = tools.map(toToolDefinition);
|
|
10632
|
+
const replacement = this.setToolsQueue.then(async () => {
|
|
10633
|
+
await this.rpc.tools.set({ tools: definitions });
|
|
10634
|
+
this.registerTools(tools);
|
|
10635
|
+
});
|
|
10636
|
+
this.setToolsQueue = replacement.then(
|
|
10637
|
+
() => void 0,
|
|
10638
|
+
() => void 0
|
|
10639
|
+
);
|
|
10640
|
+
await replacement;
|
|
10641
|
+
}
|
|
10575
10642
|
/**
|
|
10576
10643
|
* Log a message to the session timeline.
|
|
10577
10644
|
* The message appears in the session event stream and is visible to SDK consumers
|
|
@@ -3653,6 +3653,28 @@ export type ProviderConfigTransport =
|
|
|
3653
3653
|
"http"
|
|
3654
3654
|
/** WebSocket transport. */
|
|
3655
3655
|
| "websockets";
|
|
3656
|
+
/**
|
|
3657
|
+
* The product serving the model, reported in telemetry as `model_provider`.
|
|
3658
|
+
*
|
|
3659
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
3660
|
+
* via the `definition` "ProviderConfigModelProvider".
|
|
3661
|
+
*/
|
|
3662
|
+
/** @experimental */
|
|
3663
|
+
export type ProviderConfigModelProvider =
|
|
3664
|
+
/** OpenAI API. */
|
|
3665
|
+
"openai"
|
|
3666
|
+
/** Anthropic API. */
|
|
3667
|
+
| "anthropic"
|
|
3668
|
+
/** Azure OpenAI Service. */
|
|
3669
|
+
| "azure_openai"
|
|
3670
|
+
/** Ollama. */
|
|
3671
|
+
| "ollama"
|
|
3672
|
+
/** LM Studio. */
|
|
3673
|
+
| "lm_studio"
|
|
3674
|
+
/** Foundry Local. */
|
|
3675
|
+
| "foundry_local"
|
|
3676
|
+
/** llama.cpp server. */
|
|
3677
|
+
| "llama_cpp";
|
|
3656
3678
|
/**
|
|
3657
3679
|
* Allowed values for the `OptionsUpdateAdditionalContentExclusionPolicyScope` enumeration.
|
|
3658
3680
|
*
|
|
@@ -16710,6 +16732,7 @@ export interface NamedProviderConfig {
|
|
|
16710
16732
|
headers?: {
|
|
16711
16733
|
[k: string]: string | undefined;
|
|
16712
16734
|
};
|
|
16735
|
+
modelProvider?: ProviderConfigModelProvider;
|
|
16713
16736
|
/**
|
|
16714
16737
|
* Whether the host supplies bearer tokens dynamically.
|
|
16715
16738
|
*/
|
|
@@ -19036,6 +19059,7 @@ export interface ProviderConfig {
|
|
|
19036
19059
|
* Provider name used for model and telemetry attribution.
|
|
19037
19060
|
*/
|
|
19038
19061
|
providerName?: string;
|
|
19062
|
+
modelProvider?: ProviderConfigModelProvider;
|
|
19039
19063
|
/**
|
|
19040
19064
|
* The model identifier sent to the provider API for inference (the "wire" model), as opposed to modelId which is the well-known base.
|
|
19041
19065
|
*/
|
|
@@ -5804,6 +5804,10 @@ export interface AssistantUsageData {
|
|
|
5804
5804
|
*/
|
|
5805
5805
|
apiCallId?: string;
|
|
5806
5806
|
apiEndpoint?: AssistantUsageApiEndpoint;
|
|
5807
|
+
/**
|
|
5808
|
+
* Where the bring-your-own-key model runs and who manages it: "local_managed" (on the device, managed by Copilot), "local_user" (on the device, managed by the user), or "remote_user" (off the device, managed by the user). Absent for Copilot-served models.
|
|
5809
|
+
*/
|
|
5810
|
+
byokKind?: string;
|
|
5807
5811
|
/**
|
|
5808
5812
|
* Updated prompt-cache expiration for this model call. Present only when the call establishes or refreshes known cache state.
|
|
5809
5813
|
*/
|
|
@@ -5877,6 +5881,10 @@ export interface AssistantUsageData {
|
|
|
5877
5881
|
* Model identifier used for this API call
|
|
5878
5882
|
*/
|
|
5879
5883
|
model: string;
|
|
5884
|
+
/**
|
|
5885
|
+
* Fixed-set provider family serving the bring-your-own-key model (for example "openai", "anthropic", "azure_openai", "ollama", "llama_cpp", or "other"). Never the caller-supplied provider name. Absent for Copilot-served models.
|
|
5886
|
+
*/
|
|
5887
|
+
modelProvider?: string;
|
|
5880
5888
|
/**
|
|
5881
5889
|
* Number of output tokens produced
|
|
5882
5890
|
*/
|
|
@@ -5999,6 +6007,10 @@ export interface ModelCallFailureData {
|
|
|
5999
6007
|
apiCallId?: string;
|
|
6000
6008
|
apiEndpoint?: AssistantUsageApiEndpoint;
|
|
6001
6009
|
badRequestKind?: ModelCallFailureBadRequestKind;
|
|
6010
|
+
/**
|
|
6011
|
+
* Where the bring-your-own-key model for the failed call runs and who manages it: "local_managed" (on the device, managed by Copilot), "local_user" (on the device, managed by the user), or "remote_user" (off the device, managed by the user). Absent for Copilot-served models.
|
|
6012
|
+
*/
|
|
6013
|
+
byokKind?: string;
|
|
6002
6014
|
/**
|
|
6003
6015
|
* Duration of the failed API call in milliseconds
|
|
6004
6016
|
*/
|
|
@@ -6050,6 +6062,10 @@ export interface ModelCallFailureData {
|
|
|
6050
6062
|
* Model identifier used for the failed API call
|
|
6051
6063
|
*/
|
|
6052
6064
|
model?: string;
|
|
6065
|
+
/**
|
|
6066
|
+
* Fixed-set provider family serving the bring-your-own-key model for the failed call (for example "openai", "anthropic", "azure_openai", "ollama", "llama_cpp", or "other"). Never the caller-supplied provider name. Absent for Copilot-served models.
|
|
6067
|
+
*/
|
|
6068
|
+
modelProvider?: string;
|
|
6053
6069
|
/**
|
|
6054
6070
|
* Parent task tool call ID when this failed model call belongs to a sub-agent
|
|
6055
6071
|
*/
|
package/copilot-sdk/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, 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, 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, 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, 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";
|
|
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/copilot-sdk/index.js
CHANGED
|
@@ -8910,6 +8910,18 @@ function copyDefinedWorkflowAgentOption(source, target, key) {
|
|
|
8910
8910
|
target[key] = value;
|
|
8911
8911
|
}
|
|
8912
8912
|
}
|
|
8913
|
+
function toToolDefinition(tool) {
|
|
8914
|
+
return {
|
|
8915
|
+
name: tool.name,
|
|
8916
|
+
description: tool.description ?? "",
|
|
8917
|
+
parameters: toJsonSchema(tool.parameters),
|
|
8918
|
+
overridesBuiltInTool: tool.overridesBuiltInTool,
|
|
8919
|
+
skipPermission: tool.skipPermission,
|
|
8920
|
+
defer: tool.defer,
|
|
8921
|
+
metadata: tool.metadata,
|
|
8922
|
+
isTerminal: tool.isTerminal
|
|
8923
|
+
};
|
|
8924
|
+
}
|
|
8913
8925
|
var workflowExecutionStore = new AsyncLocalStorage();
|
|
8914
8926
|
function throwIfWorkflowExecutionIsActive() {
|
|
8915
8927
|
if (workflowExecutionStore.getStore()?.active) {
|
|
@@ -9130,6 +9142,8 @@ var CopilotSession = class {
|
|
|
9130
9142
|
eventHandlers = /* @__PURE__ */ new Set();
|
|
9131
9143
|
typedEventHandlers = /* @__PURE__ */ new Map();
|
|
9132
9144
|
toolHandlers = /* @__PURE__ */ new Map();
|
|
9145
|
+
/** Settles once every earlier `setTools` call has finished. */
|
|
9146
|
+
setToolsQueue = Promise.resolve();
|
|
9133
9147
|
pendingExternalTools = /* @__PURE__ */ new Map();
|
|
9134
9148
|
canvases = /* @__PURE__ */ new Map();
|
|
9135
9149
|
bearerTokenProviders = /* @__PURE__ */ new Map();
|
|
@@ -10700,6 +10714,59 @@ var CopilotSession = class {
|
|
|
10700
10714
|
async setAutoTier(autoTier) {
|
|
10701
10715
|
return await this.rpc.model.switchAutoTier({ autoTier });
|
|
10702
10716
|
}
|
|
10717
|
+
/**
|
|
10718
|
+
* Replace the tools this client supplies to the session.
|
|
10719
|
+
*
|
|
10720
|
+
* `tools` becomes the complete set of tools this client implements,
|
|
10721
|
+
* replacing the ones it supplied when the session was created or resumed,
|
|
10722
|
+
* or in an earlier call. Built-in, MCP, and plugin tools, and tools other
|
|
10723
|
+
* connected clients supply, are unaffected. Pass an empty array to remove
|
|
10724
|
+
* all of this client's tools.
|
|
10725
|
+
*
|
|
10726
|
+
* Tools are defined the same way as for `createSession`: calls to tools
|
|
10727
|
+
* with a `handler` are dispatched to it, and tools without one are
|
|
10728
|
+
* declaration-only. Once the runtime accepts the replacement, every tool
|
|
10729
|
+
* call this session dispatches uses the new handlers; calls already
|
|
10730
|
+
* running finish on their original handlers. If the runtime rejects the
|
|
10731
|
+
* replacement, this rejects and the previous tools and handlers stay in
|
|
10732
|
+
* place. Concurrent calls on the same session are applied one at a time,
|
|
10733
|
+
* in the order they are made.
|
|
10734
|
+
*
|
|
10735
|
+
* The agent sees the new tools from its next model request, which can fall
|
|
10736
|
+
* within a turn in progress. A model request already in flight was made
|
|
10737
|
+
* with the previous tools, so the agent can still call a tool you removed.
|
|
10738
|
+
* This session doesn't answer that call, and it can stay pending until the
|
|
10739
|
+
* turn is aborted. If a running turn might still call a tool you remove,
|
|
10740
|
+
* replace tools while the session is idle.
|
|
10741
|
+
*
|
|
10742
|
+
* @param tools - The complete set of tools this client supplies
|
|
10743
|
+
*
|
|
10744
|
+
* @experimental Wraps the experimental `session.tools.set` RPC and may change
|
|
10745
|
+
* or be removed in a future release.
|
|
10746
|
+
*
|
|
10747
|
+
* @example
|
|
10748
|
+
* ```typescript
|
|
10749
|
+
* await session.setTools([
|
|
10750
|
+
* defineTool("search_issues", {
|
|
10751
|
+
* description: "Search the issues shown on the current page",
|
|
10752
|
+
* parameters: z.object({ query: z.string() }),
|
|
10753
|
+
* handler: async ({ query }) => searchIssues(query),
|
|
10754
|
+
* }),
|
|
10755
|
+
* ]);
|
|
10756
|
+
* ```
|
|
10757
|
+
*/
|
|
10758
|
+
async setTools(tools) {
|
|
10759
|
+
const definitions = tools.map(toToolDefinition);
|
|
10760
|
+
const replacement = this.setToolsQueue.then(async () => {
|
|
10761
|
+
await this.rpc.tools.set({ tools: definitions });
|
|
10762
|
+
this.registerTools(tools);
|
|
10763
|
+
});
|
|
10764
|
+
this.setToolsQueue = replacement.then(
|
|
10765
|
+
() => void 0,
|
|
10766
|
+
() => void 0
|
|
10767
|
+
);
|
|
10768
|
+
await replacement;
|
|
10769
|
+
}
|
|
10703
10770
|
/**
|
|
10704
10771
|
* Log a message to the session timeline.
|
|
10705
10772
|
* The message appears in the session event stream and is visible to SDK consumers
|
package/copilot-sdk/session.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createSessionRpc } from "./generated/rpc.js";
|
|
2
2
|
import type { ModelSwitchAutoTierResult } from "./generated/rpc.js";
|
|
3
3
|
import type { OpenCanvasInstance } from "./generated/rpc.js";
|
|
4
|
-
import type { MessageOptions, ResponseSchema, ContextTier, ReasoningEffort, ReasoningSummary, AutoTier, ModelCapabilitiesOverride, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionUiApi, TranscriptRecovery, TypedSessionEventHandler } from "./types.js";
|
|
4
|
+
import type { MessageOptions, ResponseSchema, ContextTier, ReasoningEffort, ReasoningSummary, AutoTier, ModelCapabilitiesOverride, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionUiApi, Tool, TranscriptRecovery, TypedSessionEventHandler } from "./types.js";
|
|
5
5
|
import { type SessionWorkflowApi } from "./workflow.js";
|
|
6
6
|
/** Assistant message event - the final response from the assistant. */
|
|
7
7
|
export type AssistantMessageEvent = Extract<SessionEvent, {
|
|
@@ -45,6 +45,8 @@ export declare class CopilotSession {
|
|
|
45
45
|
private eventHandlers;
|
|
46
46
|
private typedEventHandlers;
|
|
47
47
|
private toolHandlers;
|
|
48
|
+
/** Settles once every earlier `setTools` call has finished. */
|
|
49
|
+
private setToolsQueue;
|
|
48
50
|
private pendingExternalTools;
|
|
49
51
|
private canvases;
|
|
50
52
|
private bearerTokenProviders;
|
|
@@ -364,6 +366,48 @@ export declare class CopilotSession {
|
|
|
364
366
|
* ```
|
|
365
367
|
*/
|
|
366
368
|
setAutoTier(autoTier: AutoTier | null): Promise<ModelSwitchAutoTierResult>;
|
|
369
|
+
/**
|
|
370
|
+
* Replace the tools this client supplies to the session.
|
|
371
|
+
*
|
|
372
|
+
* `tools` becomes the complete set of tools this client implements,
|
|
373
|
+
* replacing the ones it supplied when the session was created or resumed,
|
|
374
|
+
* or in an earlier call. Built-in, MCP, and plugin tools, and tools other
|
|
375
|
+
* connected clients supply, are unaffected. Pass an empty array to remove
|
|
376
|
+
* all of this client's tools.
|
|
377
|
+
*
|
|
378
|
+
* Tools are defined the same way as for `createSession`: calls to tools
|
|
379
|
+
* with a `handler` are dispatched to it, and tools without one are
|
|
380
|
+
* declaration-only. Once the runtime accepts the replacement, every tool
|
|
381
|
+
* call this session dispatches uses the new handlers; calls already
|
|
382
|
+
* running finish on their original handlers. If the runtime rejects the
|
|
383
|
+
* replacement, this rejects and the previous tools and handlers stay in
|
|
384
|
+
* place. Concurrent calls on the same session are applied one at a time,
|
|
385
|
+
* in the order they are made.
|
|
386
|
+
*
|
|
387
|
+
* The agent sees the new tools from its next model request, which can fall
|
|
388
|
+
* within a turn in progress. A model request already in flight was made
|
|
389
|
+
* with the previous tools, so the agent can still call a tool you removed.
|
|
390
|
+
* This session doesn't answer that call, and it can stay pending until the
|
|
391
|
+
* turn is aborted. If a running turn might still call a tool you remove,
|
|
392
|
+
* replace tools while the session is idle.
|
|
393
|
+
*
|
|
394
|
+
* @param tools - The complete set of tools this client supplies
|
|
395
|
+
*
|
|
396
|
+
* @experimental Wraps the experimental `session.tools.set` RPC and may change
|
|
397
|
+
* or be removed in a future release.
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* ```typescript
|
|
401
|
+
* await session.setTools([
|
|
402
|
+
* defineTool("search_issues", {
|
|
403
|
+
* description: "Search the issues shown on the current page",
|
|
404
|
+
* parameters: z.object({ query: z.string() }),
|
|
405
|
+
* handler: async ({ query }) => searchIssues(query),
|
|
406
|
+
* }),
|
|
407
|
+
* ]);
|
|
408
|
+
* ```
|
|
409
|
+
*/
|
|
410
|
+
setTools(tools: Tool[]): Promise<void>;
|
|
367
411
|
/**
|
|
368
412
|
* Log a message to the session timeline.
|
|
369
413
|
* The message appears in the session event stream and is visible to SDK consumers
|
package/copilot-sdk/types.d.ts
CHANGED
|
@@ -2522,6 +2522,12 @@ export interface ProviderTokenArgs {
|
|
|
2522
2522
|
* surface and may change or be removed in future SDK or CLI releases.
|
|
2523
2523
|
*/
|
|
2524
2524
|
export type BearerTokenProvider = (args: ProviderTokenArgs) => Promise<string>;
|
|
2525
|
+
/**
|
|
2526
|
+
* Product serving a configured provider's model. Allowed values are
|
|
2527
|
+
* "openai", "anthropic", "azure_openai", "ollama", "lm_studio",
|
|
2528
|
+
* "foundry_local", and "llama_cpp".
|
|
2529
|
+
*/
|
|
2530
|
+
export type ProviderConfigModelProvider = "openai" | "anthropic" | "azure_openai" | "ollama" | "lm_studio" | "foundry_local" | "llama_cpp";
|
|
2525
2531
|
/**
|
|
2526
2532
|
* Configuration for a custom API provider.
|
|
2527
2533
|
*/
|
|
@@ -2544,6 +2550,11 @@ export interface ProviderConfig {
|
|
|
2544
2550
|
* providers using `wireApi: "responses"`.
|
|
2545
2551
|
*/
|
|
2546
2552
|
transport?: "http" | "websockets";
|
|
2553
|
+
/**
|
|
2554
|
+
* Product serving the model, such as "ollama" or "lm_studio", reported in
|
|
2555
|
+
* telemetry as `model_provider`. Only affects telemetry.
|
|
2556
|
+
*/
|
|
2557
|
+
modelProvider?: ProviderConfigModelProvider;
|
|
2547
2558
|
/**
|
|
2548
2559
|
* API endpoint URL
|
|
2549
2560
|
*/
|
|
@@ -2637,6 +2648,11 @@ export interface NamedProviderConfig {
|
|
|
2637
2648
|
* Wire API format (openai/azure only). Defaults to "completions".
|
|
2638
2649
|
*/
|
|
2639
2650
|
wireApi?: "completions" | "responses";
|
|
2651
|
+
/**
|
|
2652
|
+
* Product serving this provider's models, such as "ollama" or "lm_studio",
|
|
2653
|
+
* reported in telemetry as `model_provider`. Only affects telemetry.
|
|
2654
|
+
*/
|
|
2655
|
+
modelProvider?: ProviderConfigModelProvider;
|
|
2640
2656
|
/**
|
|
2641
2657
|
* API endpoint URL.
|
|
2642
2658
|
*/
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/prebuilds/darwin-arm64/runtime.node
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 87151776 bytes
|
|
4
|
+
sha256: 4c23ad0f1fd13bbe211640aad2210c8d717eae977b4b7d154a113e50ee5cf7e6
|
|
Binary file
|
package/schemas/api.schema.json
CHANGED
|
@@ -33983,6 +33983,10 @@
|
|
|
33983
33983
|
},
|
|
33984
33984
|
"description": "Additional HTTP headers included with provider requests."
|
|
33985
33985
|
},
|
|
33986
|
+
"modelProvider": {
|
|
33987
|
+
"$ref": "#/definitions/ProviderConfigModelProvider",
|
|
33988
|
+
"description": "The product serving the provider's models, reported in telemetry as `model_provider`. Only affects telemetry."
|
|
33989
|
+
},
|
|
33986
33990
|
"hasBearerTokenProvider": {
|
|
33987
33991
|
"type": "boolean",
|
|
33988
33992
|
"description": "Whether the host supplies bearer tokens dynamically."
|
|
@@ -37808,6 +37812,10 @@
|
|
|
37808
37812
|
"type": "string",
|
|
37809
37813
|
"description": "Provider name used for model and telemetry attribution."
|
|
37810
37814
|
},
|
|
37815
|
+
"modelProvider": {
|
|
37816
|
+
"$ref": "#/definitions/ProviderConfigModelProvider",
|
|
37817
|
+
"description": "The product serving the model, reported in telemetry as `model_provider`. Set it when `type` alone cannot identify the product, such as Ollama or LM Studio behind an OpenAI-compatible endpoint. Only affects telemetry."
|
|
37818
|
+
},
|
|
37811
37819
|
"wireModel": {
|
|
37812
37820
|
"type": "string",
|
|
37813
37821
|
"description": "The model identifier sent to the provider API for inference (the \"wire\" model), as opposed to modelId which is the well-known base."
|
|
@@ -37856,6 +37864,29 @@
|
|
|
37856
37864
|
"description": "Azure-specific provider options.",
|
|
37857
37865
|
"title": "ProviderConfigAzure"
|
|
37858
37866
|
},
|
|
37867
|
+
"ProviderConfigModelProvider": {
|
|
37868
|
+
"type": "string",
|
|
37869
|
+
"enum": [
|
|
37870
|
+
"openai",
|
|
37871
|
+
"anthropic",
|
|
37872
|
+
"azure_openai",
|
|
37873
|
+
"ollama",
|
|
37874
|
+
"lm_studio",
|
|
37875
|
+
"foundry_local",
|
|
37876
|
+
"llama_cpp"
|
|
37877
|
+
],
|
|
37878
|
+
"description": "The product serving the model, reported in telemetry as `model_provider`.",
|
|
37879
|
+
"title": "ProviderConfigModelProvider",
|
|
37880
|
+
"x-enumDescriptions": {
|
|
37881
|
+
"openai": "OpenAI API.",
|
|
37882
|
+
"anthropic": "Anthropic API.",
|
|
37883
|
+
"azure_openai": "Azure OpenAI Service.",
|
|
37884
|
+
"ollama": "Ollama.",
|
|
37885
|
+
"lm_studio": "LM Studio.",
|
|
37886
|
+
"foundry_local": "Foundry Local.",
|
|
37887
|
+
"llama_cpp": "llama.cpp server."
|
|
37888
|
+
}
|
|
37889
|
+
},
|
|
37859
37890
|
"ProviderConfigTransport": {
|
|
37860
37891
|
"type": "string",
|
|
37861
37892
|
"enum": [
|
|
@@ -1922,6 +1922,14 @@
|
|
|
1922
1922
|
"type": "boolean",
|
|
1923
1923
|
"description": "Whether this model call used a bring-your-own-key provider"
|
|
1924
1924
|
},
|
|
1925
|
+
"byokKind": {
|
|
1926
|
+
"type": "string",
|
|
1927
|
+
"description": "Where the bring-your-own-key model runs and who manages it: \"local_managed\" (on the device, managed by Copilot), \"local_user\" (on the device, managed by the user), or \"remote_user\" (off the device, managed by the user). Absent for Copilot-served models."
|
|
1928
|
+
},
|
|
1929
|
+
"modelProvider": {
|
|
1930
|
+
"type": "string",
|
|
1931
|
+
"description": "Fixed-set provider family serving the bring-your-own-key model (for example \"openai\", \"anthropic\", \"azure_openai\", \"ollama\", \"llama_cpp\", or \"other\"). Never the caller-supplied provider name. Absent for Copilot-served models."
|
|
1932
|
+
},
|
|
1925
1933
|
"isAuto": {
|
|
1926
1934
|
"type": "boolean",
|
|
1927
1935
|
"description": "Whether Auto mode was selected for this model call"
|
|
@@ -11331,6 +11339,14 @@
|
|
|
11331
11339
|
"type": "boolean",
|
|
11332
11340
|
"description": "Whether the failed call used a bring-your-own-key provider"
|
|
11333
11341
|
},
|
|
11342
|
+
"byokKind": {
|
|
11343
|
+
"type": "string",
|
|
11344
|
+
"description": "Where the bring-your-own-key model for the failed call runs and who manages it: \"local_managed\" (on the device, managed by Copilot), \"local_user\" (on the device, managed by the user), or \"remote_user\" (off the device, managed by the user). Absent for Copilot-served models."
|
|
11345
|
+
},
|
|
11346
|
+
"modelProvider": {
|
|
11347
|
+
"type": "string",
|
|
11348
|
+
"description": "Fixed-set provider family serving the bring-your-own-key model for the failed call (for example \"openai\", \"anthropic\", \"azure_openai\", \"ollama\", \"llama_cpp\", or \"other\"). Never the caller-supplied provider name. Absent for Copilot-served models."
|
|
11349
|
+
},
|
|
11334
11350
|
"isAuto": {
|
|
11335
11351
|
"type": "boolean",
|
|
11336
11352
|
"description": "Whether the session selected Auto mode for the failed call"
|
|
Binary file
|