@github/copilot-sdk 1.0.17-preview.3 → 1.0.17-preview.4
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/README.md +49 -0
- package/dist/canvas.d.ts +6 -1
- package/dist/cjs/cliVersion.js +1 -1
- package/dist/cjs/client.js +25 -2
- package/dist/cjs/generated/rpc.js +128 -15
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/runtimeArtifacts.js +1 -0
- package/dist/cjs/session.js +17 -2
- package/dist/cjs/sessionFsProvider.js +57 -0
- package/dist/cjs/types.js +5 -2
- package/dist/cliVersion.d.ts +1 -1
- package/dist/cliVersion.js +1 -1
- package/dist/client.js +25 -2
- package/dist/generated/rpc.d.ts +1101 -408
- package/dist/generated/rpc.js +128 -15
- package/dist/generated/session-events.d.ts +239 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -0
- package/dist/runtimeArtifacts.js +1 -0
- package/dist/session.js +17 -2
- package/dist/sessionFsProvider.d.ts +9 -1
- package/dist/sessionFsProvider.js +56 -0
- package/dist/types.d.ts +67 -2
- package/dist/types.js +4 -2
- package/docs/agent-author.md +29 -2
- package/package.json +13 -12
package/dist/generated/rpc.js
CHANGED
|
@@ -99,7 +99,48 @@ function createServerRpc(connection) {
|
|
|
99
99
|
*
|
|
100
100
|
* @returns Whether the host running this runtime can run the command sandbox. The runtime checks `supported` once per process. A capability answer can change while the process runs, for example after the user installs a missing package.
|
|
101
101
|
*/
|
|
102
|
-
getHostSupport: async () => connection.sendRequest("sandbox.getHostSupport", {})
|
|
102
|
+
getHostSupport: async () => connection.sendRequest("sandbox.getHostSupport", {}),
|
|
103
|
+
/** @experimental */
|
|
104
|
+
proxyCa: {
|
|
105
|
+
/**
|
|
106
|
+
* Reports whether the persistent certificate authority of the sandbox credential proxy exists, whether OS trust includes it, and whether it must be rotated. Changes nothing.
|
|
107
|
+
*
|
|
108
|
+
* @param params Identifies the credential hosts that the persistent certificate authority of the sandbox credential proxy must cover. The runtime always adds the hosts from the saved user settings.
|
|
109
|
+
*
|
|
110
|
+
* @returns Status of the persistent certificate authority of the sandbox credential proxy.
|
|
111
|
+
*/
|
|
112
|
+
getStatus: async (params) => connection.sendRequest("sandbox.proxyCa.getStatus", params),
|
|
113
|
+
/**
|
|
114
|
+
* Creates the persistent certificate authority of the sandbox credential proxy if none is stored, without changing OS trust, and returns the path of its public certificate. Keeps an existing certificate authority, even one that must be rotated. Fails where OS trust is unsupported. Trust it with sandbox.proxyCa.trust: the CLI trusts only the hosts in the saved user settings, so it refuses a certificate authority that also covers hosts from sandboxConfig.
|
|
115
|
+
*
|
|
116
|
+
* @param params Identifies the credential hosts that the persistent certificate authority of the sandbox credential proxy must cover. The runtime always adds the hosts from the saved user settings.
|
|
117
|
+
*
|
|
118
|
+
* @returns Result of creating the persistent certificate authority of the sandbox credential proxy.
|
|
119
|
+
*/
|
|
120
|
+
create: async (params) => connection.sendRequest("sandbox.proxyCa.create", params),
|
|
121
|
+
/**
|
|
122
|
+
* Replaces the persistent certificate authority of the sandbox credential proxy with a new one for the current credential hosts. If OS trust included the old one, removes it and trusts the new one, which can show an OS authentication prompt. Running sandboxed tools keep the old certificate authority until they restart.
|
|
123
|
+
*
|
|
124
|
+
* @param params Identifies the credential hosts that the persistent certificate authority of the sandbox credential proxy must cover. The runtime always adds the hosts from the saved user settings.
|
|
125
|
+
*
|
|
126
|
+
* @returns Status of the persistent certificate authority of the sandbox credential proxy.
|
|
127
|
+
*/
|
|
128
|
+
rotate: async (params) => connection.sendRequest("sandbox.proxyCa.rotate", params),
|
|
129
|
+
/**
|
|
130
|
+
* Adds the persistent certificate authority of the sandbox credential proxy to OS trust, so sandboxed clients that read only OS trust accept the proxy. Call create first. Refuses a certificate authority that is not constrained to the current credential hosts. Can show an OS authentication prompt.
|
|
131
|
+
*
|
|
132
|
+
* @param params Identifies the credential hosts that the persistent certificate authority of the sandbox credential proxy must cover. The runtime always adds the hosts from the saved user settings.
|
|
133
|
+
*
|
|
134
|
+
* @returns Status of the persistent certificate authority of the sandbox credential proxy.
|
|
135
|
+
*/
|
|
136
|
+
trust: async (params) => connection.sendRequest("sandbox.proxyCa.trust", params),
|
|
137
|
+
/**
|
|
138
|
+
* Removes the persistent certificate authority of the sandbox credential proxy from OS trust. Keeps the stored certificate authority. Can show an OS authentication prompt. Sandboxed clients that read only OS trust then reject the proxy; clients that read the per-process certificate bundle continue to work.
|
|
139
|
+
*
|
|
140
|
+
* @returns Status of the persistent certificate authority of the sandbox credential proxy.
|
|
141
|
+
*/
|
|
142
|
+
remove: async () => connection.sendRequest("sandbox.proxyCa.remove", {})
|
|
143
|
+
}
|
|
103
144
|
},
|
|
104
145
|
/** @experimental */
|
|
105
146
|
tools: {
|
|
@@ -1019,22 +1060,55 @@ function createInternalServerRpc(connection) {
|
|
|
1019
1060
|
* @param params Params to attach or detach an in-process ExtensionController delegate.
|
|
1020
1061
|
*/
|
|
1021
1062
|
configureSessionExtensions: async (params) => connection.sendRequest("sessions.configureSessionExtensions", params)
|
|
1022
|
-
},
|
|
1023
|
-
/** @experimental */
|
|
1024
|
-
accounts: {
|
|
1025
|
-
/**
|
|
1026
|
-
* Acquire a Microsoft Entra access token through the runtime's OneAuth broker. Account-scoped because it uses the same native broker as the account stack: a trusted host application mints a scoped Entra token for its own use, most notably to authenticate to a remote MCP server whose authorization server is Entra ID (in place of the generic browser-OAuth flow).
|
|
1027
|
-
*
|
|
1028
|
-
* @param params OneAuth token request supplied by a trusted host application.
|
|
1029
|
-
*
|
|
1030
|
-
* @returns Result of a OneAuth token acquisition.
|
|
1031
|
-
*/
|
|
1032
|
-
acquireEntraToken: async (params) => connection.sendRequest("accounts.acquireEntraToken", params)
|
|
1033
1063
|
}
|
|
1034
1064
|
};
|
|
1035
1065
|
}
|
|
1036
1066
|
function createSessionRpc(connection, sessionId) {
|
|
1037
1067
|
return {
|
|
1068
|
+
/** @experimental */
|
|
1069
|
+
providers: {
|
|
1070
|
+
/**
|
|
1071
|
+
* Returns adapter definitions and supported operations in this session's effective provider catalog, without running discovery. Does not list provider instances or select inference models.
|
|
1072
|
+
*
|
|
1073
|
+
* @returns Normalized model-provider adapter definitions available to the session, not discovered instances.
|
|
1074
|
+
*/
|
|
1075
|
+
getCatalog: async () => connection.sendRequest("session.providers.getCatalog", { sessionId }),
|
|
1076
|
+
/**
|
|
1077
|
+
* Discovers reachable instances using an adapter from this session's effective provider catalog and provider-specific discovery input.
|
|
1078
|
+
*
|
|
1079
|
+
* @param params Provider discovery parameters.
|
|
1080
|
+
*
|
|
1081
|
+
* @returns Provider instances found by a discovery operation.
|
|
1082
|
+
*/
|
|
1083
|
+
discover: async (params) => connection.sendRequest("session.providers.discover", { ...params, sessionId }),
|
|
1084
|
+
/**
|
|
1085
|
+
* Gets current health and version information for a discovered model-provider instance.
|
|
1086
|
+
*
|
|
1087
|
+
* @param params Provider status request parameters.
|
|
1088
|
+
*
|
|
1089
|
+
* @returns Current health information for a provider instance.
|
|
1090
|
+
*/
|
|
1091
|
+
getStatus: async (params) => connection.sendRequest("session.providers.getStatus", { ...params, sessionId }),
|
|
1092
|
+
/** @experimental */
|
|
1093
|
+
models: {
|
|
1094
|
+
/**
|
|
1095
|
+
* Lists models installed or otherwise available from a discovered model-provider instance.
|
|
1096
|
+
*
|
|
1097
|
+
* @param params Provider model inventory request parameters.
|
|
1098
|
+
*
|
|
1099
|
+
* @returns Models offered for agent conversations by one provider instance. Adapters exclude known-incompatible models, but retain candidates with unknown capabilities. Listing does not guarantee compatibility.
|
|
1100
|
+
*/
|
|
1101
|
+
list: async (params) => connection.sendRequest("session.providers.models.list", { ...params, sessionId }),
|
|
1102
|
+
/**
|
|
1103
|
+
* Translates a discovered model into the provider and model configuration needed to use it, and reports whether each is already registered in this session. Prepares only: it registers nothing, writes nothing, and performs no provider requests.
|
|
1104
|
+
*
|
|
1105
|
+
* @param params A discovered instance and one of its models to translate into provider configuration. Pass back the instance and model as returned by `session.providers.discover` and `session.providers.models.list`.
|
|
1106
|
+
*
|
|
1107
|
+
* @returns Provider configuration prepared from a discovered model. Preparing a plan changes nothing: it neither registers the model with the session nor writes durable configuration. To apply it, pass `provider` and `model` to `session.provider.add`, omitting whichever the dispositions report as already configured.
|
|
1108
|
+
*/
|
|
1109
|
+
prepareConfiguration: async (params) => connection.sendRequest("session.providers.models.prepareConfiguration", { ...params, sessionId })
|
|
1110
|
+
}
|
|
1111
|
+
},
|
|
1038
1112
|
/**
|
|
1039
1113
|
* Suspends the session while preserving persisted state for later resume.
|
|
1040
1114
|
*
|
|
@@ -1642,16 +1716,18 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1642
1716
|
*/
|
|
1643
1717
|
getSources: async () => connection.sendRequest("session.instructions.getSources", { sessionId }),
|
|
1644
1718
|
/**
|
|
1645
|
-
*
|
|
1719
|
+
* For local sessions, invalidates instruction discovery and the model-facing prompt, then returns freshly discovered sources. The updated prompt takes effect on the next turn. Remote sessions must reload on their agent host instead.
|
|
1720
|
+
*
|
|
1721
|
+
* @returns Instruction sources loaded for the session, in merge order.
|
|
1646
1722
|
*/
|
|
1647
1723
|
reload: async () => connection.sendRequest("session.instructions.reload", { sessionId })
|
|
1648
1724
|
},
|
|
1649
1725
|
/** @experimental */
|
|
1650
1726
|
customizations: {
|
|
1651
1727
|
/**
|
|
1652
|
-
*
|
|
1728
|
+
* For local sessions, reconciles repository context and discovered instructions, plugins, skills, agents, hooks, MCP servers, and extensions after files appear or change under the working directory. Independent component failures are returned in outcomes and errors; a rejected call can have partially applied earlier steps. Remote sessions must reload on their agent host instead. The model-facing context is rebuilt on the next turn.
|
|
1653
1729
|
*
|
|
1654
|
-
* @returns
|
|
1730
|
+
* @returns Results of reloading discovered session customizations. Inspect outcomes for reloaded, skipped, or failed subsystems; a rejection may follow partial mutation. Changes to the model-facing prompt and tools apply on the next turn.
|
|
1655
1731
|
*/
|
|
1656
1732
|
reload: async () => connection.sendRequest("session.customizations.reload", { sessionId })
|
|
1657
1733
|
},
|
|
@@ -3355,6 +3431,33 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
3355
3431
|
finalizeInvocationEffect: async (params) => connection.sendRequest("session.commands.finalizeInvocationEffect", { ...params, sessionId })
|
|
3356
3432
|
},
|
|
3357
3433
|
/** @experimental */
|
|
3434
|
+
ui: {
|
|
3435
|
+
/**
|
|
3436
|
+
* Resolves a pending elicitation request after direct interaction in the trusted in-process client. Only an accepted response to the built-in ask_user tool can become trusted human evidence.
|
|
3437
|
+
*
|
|
3438
|
+
* @param params Pending elicitation request ID and the user's response (accept/decline/cancel + form values).
|
|
3439
|
+
*
|
|
3440
|
+
* @returns Indicates whether the elicitation response was accepted; false if it was already resolved by another client.
|
|
3441
|
+
*/
|
|
3442
|
+
handleHumanAskUser: async (params) => connection.sendRequest("session.ui.handleHumanAskUser", { ...params, sessionId }),
|
|
3443
|
+
/**
|
|
3444
|
+
* Resolves a pending `user_input.requested` event after direct interaction in the trusted in-process client.
|
|
3445
|
+
*
|
|
3446
|
+
* @param params Request ID of a pending `user_input.requested` event and the user's response.
|
|
3447
|
+
*
|
|
3448
|
+
* @returns Indicates whether the pending UI request was resolved by this call.
|
|
3449
|
+
*/
|
|
3450
|
+
handleHumanUserInput: async (params) => connection.sendRequest("session.ui.handleHumanUserInput", { ...params, sessionId }),
|
|
3451
|
+
/**
|
|
3452
|
+
* Resolves a pending `exit_plan_mode.requested` event after direct interaction in the trusted in-process client.
|
|
3453
|
+
*
|
|
3454
|
+
* @param params Request ID of a pending `exit_plan_mode.requested` event and the user's response.
|
|
3455
|
+
*
|
|
3456
|
+
* @returns Indicates whether the pending UI request was resolved by this call.
|
|
3457
|
+
*/
|
|
3458
|
+
handleHumanExitPlanMode: async (params) => connection.sendRequest("session.ui.handleHumanExitPlanMode", { ...params, sessionId })
|
|
3459
|
+
},
|
|
3460
|
+
/** @experimental */
|
|
3358
3461
|
settings: {
|
|
3359
3462
|
/**
|
|
3360
3463
|
* Returns a redacted snapshot of session runtime settings, with secrets and raw feature flags excluded. Internal: the runtime settings shape is a runtime-internal surface and is deliberately kept out of the public SDK, because consumers should not depend on the runtime's internal settings layout. It remains callable in-process and is expected to be reworked as the runtime internals are consolidated.
|
|
@@ -3507,11 +3610,21 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
|
|
|
3507
3610
|
if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
|
|
3508
3611
|
return handler.readFile(params);
|
|
3509
3612
|
});
|
|
3613
|
+
connection.onRequest("sessionFs.readFileBytes", async (params) => {
|
|
3614
|
+
const handler = getHandlers(params.sessionId).sessionFs;
|
|
3615
|
+
if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
|
|
3616
|
+
return handler.readFileBytes(params);
|
|
3617
|
+
});
|
|
3510
3618
|
connection.onRequest("sessionFs.writeFile", async (params) => {
|
|
3511
3619
|
const handler = getHandlers(params.sessionId).sessionFs;
|
|
3512
3620
|
if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
|
|
3513
3621
|
return handler.writeFile(params);
|
|
3514
3622
|
});
|
|
3623
|
+
connection.onRequest("sessionFs.writeFileBytes", async (params) => {
|
|
3624
|
+
const handler = getHandlers(params.sessionId).sessionFs;
|
|
3625
|
+
if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
|
|
3626
|
+
return handler.writeFileBytes(params);
|
|
3627
|
+
});
|
|
3515
3628
|
connection.onRequest("sessionFs.appendFile", async (params) => {
|
|
3516
3629
|
const handler = getHandlers(params.sessionId).sessionFs;
|
|
3517
3630
|
if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
|
|
@@ -9,7 +9,7 @@ export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
|
9
9
|
/**
|
|
10
10
|
* Union of all session event variants emitted by the Copilot CLI runtime.
|
|
11
11
|
*/
|
|
12
|
-
export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | ScheduleRearmedEvent | AutopilotObjectiveChangedEvent | InfoEvent | IndexedSearchEvent | WarningEvent | ModelChangeEvent | ModelDeselectedEvent | AutoTierRecommendationEvent | AutoTierSwitchFailedEvent | ModeChangedEvent | ModeNoticeDeliveredEvent | SessionLimitsChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | UsageCheckpointEvent | ContextChangedEvent | UsageInfoEvent | ContextClearedEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | CompletionReceiptEvent | FusionRouteStartedEvent | FusionRouteFailedEvent | FusionResolvedEvent | FusionCompletedEvent | PermissionRecoveryEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantFusionPhaseStartedEvent | AssistantFusionPhaseActivityEvent | AssistantFusionPhaseCompletedEvent | AssistantFusionPhaseFailedEvent | AssistantServerToolProgressEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantToolCallDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantIdleEvent | AssistantUsageEvent | ModelCallFailureEvent | ModelCallFinishedEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | ToolSearchActivatedEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentConfiguredEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | BinaryAssetEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | PermissionCarriedForwardEvent | PermissionMessageAuthorizationEvent | PermissionMessageAuthorizationReadEvent | PermissionMessageAuthorizationDegradedEvent | PermissionAssentDetectedEvent | PermissionContextualAuthorizationEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | McpHeadersRefreshRequiredEvent | McpHeadersRefreshCompletedEvent | CustomNotificationEvent | UIEphemeralQueryEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | SessionLimitsExhaustedRequestedEvent | SessionLimitsExhaustedCompletedEvent | AutoModeResolvedEvent | ManagedSettingsResolvedEvent | ManagedSettingsEnforcedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | WorkflowRunUpdatedEvent | WorkflowRunStartedEvent | WorkflowRunSettledEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | McpServerRemovedEvent | McpServerNeedsReconnectEvent | McpToolsListChangedEvent | McpResourcesListChangedEvent | McpPromptsListChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | CanvasClosedEvent | CanvasUnavailableEvent | CanvasRecordedEvent | CanvasRemovedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
|
|
12
|
+
export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | ScheduleRearmedEvent | AutopilotObjectiveChangedEvent | InfoEvent | IndexedSearchEvent | WarningEvent | ModelChangeEvent | ModelDeselectedEvent | AutoTierRecommendationEvent | AutoTierSwitchFailedEvent | ModeChangedEvent | ModeNoticeDeliveredEvent | SessionLimitsChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | UsageCheckpointEvent | ContextChangedEvent | UsageInfoEvent | ContextClearedEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | CompletionReceiptEvent | FusionRouteStartedEvent | FusionRouteFailedEvent | FusionResolvedEvent | FusionCompletedEvent | PermissionRecoveryEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantFusionPhaseStartedEvent | AssistantFusionPhaseActivityEvent | AssistantFusionPhaseCompletedEvent | AssistantFusionPhaseFailedEvent | AssistantServerToolProgressEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantToolCallDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantIdleEvent | AssistantUsageEvent | ModelCallFailureEvent | ModelCallFinishedEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolShellOutputEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | ToolSearchActivatedEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentConfiguredEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | BinaryAssetEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | PermissionCarriedForwardEvent | PermissionMessageAuthorizationEvent | PermissionMessageAuthorizationReadEvent | PermissionMessageAuthorizationDegradedEvent | PermissionAssentDetectedEvent | PermissionContextualAuthorizationEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | McpHeadersRefreshRequiredEvent | McpHeadersRefreshCompletedEvent | CustomNotificationEvent | UIEphemeralQueryEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | SessionLimitsExhaustedRequestedEvent | SessionLimitsExhaustedCompletedEvent | AutoModeResolvedEvent | ManagedSettingsResolvedEvent | ManagedSettingsEnforcedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | HumanResponseRecordedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | WorkflowRunUpdatedEvent | WorkflowRunStartedEvent | WorkflowRunSettledEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | McpServerRemovedEvent | McpServerNeedsReconnectEvent | McpToolsListChangedEvent | McpResourcesListChangedEvent | McpPromptsListChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | CanvasClosedEvent | CanvasUnavailableEvent | CanvasRecordedEvent | CanvasRemovedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
|
|
13
13
|
/**
|
|
14
14
|
* Routing preference used when the session model is `auto`. `fast` is an integrator-only latency preset and is not a first-party GitHub Copilot product preference.
|
|
15
15
|
*/
|
|
@@ -773,6 +773,27 @@ export type ToolExecutionStartToolDescriptionMetaUIVisibility =
|
|
|
773
773
|
"model"
|
|
774
774
|
/** Tool is callable by the MCP App view (iframe) via session.mcp.apps.callTool */
|
|
775
775
|
| "app";
|
|
776
|
+
/**
|
|
777
|
+
* Shell output source. Terminal output has no separate stdout/stderr attribution.
|
|
778
|
+
*/
|
|
779
|
+
export type ToolShellOutputStream =
|
|
780
|
+
/** Output from the shell command's standard output stream. This is the default when stream is omitted. */
|
|
781
|
+
"stdout"
|
|
782
|
+
/** Output from the shell command's standard error stream. */
|
|
783
|
+
| "stderr"
|
|
784
|
+
/** Inherently merged output that cannot be attributed separately to stdout or stderr. */
|
|
785
|
+
| "terminal";
|
|
786
|
+
/**
|
|
787
|
+
* Kind of file mutation committed by a built-in editing tool.
|
|
788
|
+
*/
|
|
789
|
+
/** @experimental */
|
|
790
|
+
export type ToolExecutionCompleteFileEditKind =
|
|
791
|
+
/** A file was created. */
|
|
792
|
+
"create"
|
|
793
|
+
/** A file was written by an edit operation. */
|
|
794
|
+
| "edit"
|
|
795
|
+
/** A file was deleted. */
|
|
796
|
+
| "delete" | (string & {});
|
|
776
797
|
/**
|
|
777
798
|
* A model-facing binary result as persisted: full inline data, a size-omitted marker, or a deduplicated asset reference
|
|
778
799
|
*/
|
|
@@ -1215,6 +1236,92 @@ export type ExitPlanModeAction =
|
|
|
1215
1236
|
| "autopilot"
|
|
1216
1237
|
/** Exit plan mode and continue with parallel autonomous workers. */
|
|
1217
1238
|
| "autopilot_fleet";
|
|
1239
|
+
/**
|
|
1240
|
+
* Controlled provenance for a typed runtime response. Only `human_response`, minted by a trusted direct-interaction ingress, is human authorization evidence.
|
|
1241
|
+
*/
|
|
1242
|
+
export type HumanResponseActor =
|
|
1243
|
+
/** A built-in trusted client submitted the response after direct human interaction. */
|
|
1244
|
+
"human_response"
|
|
1245
|
+
/** A host or SDK automation submitted the response without direct human interaction. */
|
|
1246
|
+
| "host_automation"
|
|
1247
|
+
/** The response came through a legacy or otherwise unattributed ingress. */
|
|
1248
|
+
| "unknown";
|
|
1249
|
+
/**
|
|
1250
|
+
* Exact runtime-owned question or reviewed plan paired with the typed response that settled it.
|
|
1251
|
+
*/
|
|
1252
|
+
export type HumanResponseRecordedResponse = {
|
|
1253
|
+
/**
|
|
1254
|
+
* Exact answer content accepted from the user.
|
|
1255
|
+
*/
|
|
1256
|
+
content: {
|
|
1257
|
+
[k: string]: ElicitationCompletedContent | undefined;
|
|
1258
|
+
};
|
|
1259
|
+
/**
|
|
1260
|
+
* Exact question displayed to the user.
|
|
1261
|
+
*/
|
|
1262
|
+
message: string;
|
|
1263
|
+
requestedSchema: ElicitationRequestedSchema;
|
|
1264
|
+
/**
|
|
1265
|
+
* Runtime-owned response kind discriminator.
|
|
1266
|
+
*/
|
|
1267
|
+
responseKind: "ask_user";
|
|
1268
|
+
} | {
|
|
1269
|
+
/**
|
|
1270
|
+
* Whether the displayed request allowed a free-form answer.
|
|
1271
|
+
*/
|
|
1272
|
+
allowFreeform?: boolean;
|
|
1273
|
+
/**
|
|
1274
|
+
* Exact selected or free-form answer submitted by the user.
|
|
1275
|
+
*/
|
|
1276
|
+
answer: string;
|
|
1277
|
+
/**
|
|
1278
|
+
* Exact choices displayed to the user, when the request offered choices.
|
|
1279
|
+
*/
|
|
1280
|
+
choices?: string[];
|
|
1281
|
+
/**
|
|
1282
|
+
* Exact question displayed to the user.
|
|
1283
|
+
*/
|
|
1284
|
+
question: string;
|
|
1285
|
+
/**
|
|
1286
|
+
* Runtime-owned response kind discriminator.
|
|
1287
|
+
*/
|
|
1288
|
+
responseKind: "user_input";
|
|
1289
|
+
/**
|
|
1290
|
+
* Whether the answer was typed as free-form text rather than selected from the displayed choices.
|
|
1291
|
+
*/
|
|
1292
|
+
wasFreeform: boolean;
|
|
1293
|
+
} | {
|
|
1294
|
+
/**
|
|
1295
|
+
* Actions offered by the plan review UI.
|
|
1296
|
+
*/
|
|
1297
|
+
actions: ExitPlanModeAction[];
|
|
1298
|
+
/**
|
|
1299
|
+
* Whether the user approved the reviewed plan.
|
|
1300
|
+
*/
|
|
1301
|
+
approved: boolean;
|
|
1302
|
+
/**
|
|
1303
|
+
* Whether the selected response requested edit auto-approval.
|
|
1304
|
+
*/
|
|
1305
|
+
autoApproveEdits?: boolean;
|
|
1306
|
+
/**
|
|
1307
|
+
* Exact feedback submitted with the plan decision, when present.
|
|
1308
|
+
*/
|
|
1309
|
+
feedback?: string;
|
|
1310
|
+
/**
|
|
1311
|
+
* Exact full plan content available from the review UI.
|
|
1312
|
+
*/
|
|
1313
|
+
planContent: string;
|
|
1314
|
+
recommendedAction: ExitPlanModeAction;
|
|
1315
|
+
/**
|
|
1316
|
+
* Runtime-owned response kind discriminator.
|
|
1317
|
+
*/
|
|
1318
|
+
responseKind: "exit_plan_mode";
|
|
1319
|
+
selectedAction?: ExitPlanModeAction;
|
|
1320
|
+
/**
|
|
1321
|
+
* Exact plan summary displayed to the user.
|
|
1322
|
+
*/
|
|
1323
|
+
summary: string;
|
|
1324
|
+
};
|
|
1218
1325
|
/**
|
|
1219
1326
|
* Terminal status a workflow run committed. A settled run is never `pending` or `running`, so those two members of the run-status domain are deliberately absent.
|
|
1220
1327
|
*/
|
|
@@ -1360,6 +1467,10 @@ export interface StartData {
|
|
|
1360
1467
|
* Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max")
|
|
1361
1468
|
*/
|
|
1362
1469
|
reasoningEffort?: string;
|
|
1470
|
+
/**
|
|
1471
|
+
* Model that owns effort embedded in an authored model selection. Omitted for independent reasoning-effort overrides and legacy events.
|
|
1472
|
+
*/
|
|
1473
|
+
reasoningEffortModel?: string;
|
|
1363
1474
|
reasoningSummary?: ReasoningSummary;
|
|
1364
1475
|
/**
|
|
1365
1476
|
* Whether this session supports remote steering via GitHub
|
|
@@ -1512,6 +1623,10 @@ export interface ResumeData {
|
|
|
1512
1623
|
* Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max")
|
|
1513
1624
|
*/
|
|
1514
1625
|
reasoningEffort?: string;
|
|
1626
|
+
/**
|
|
1627
|
+
* Model that owns effort embedded in an authored model selection. Omitted for independent reasoning-effort overrides and legacy events.
|
|
1628
|
+
*/
|
|
1629
|
+
reasoningEffortModel?: string;
|
|
1515
1630
|
reasoningSummary?: ReasoningSummary;
|
|
1516
1631
|
/**
|
|
1517
1632
|
* Whether this session supports remote steering via GitHub
|
|
@@ -2114,6 +2229,10 @@ export interface ModelChangeData {
|
|
|
2114
2229
|
* Reasoning effort level after the model change, if applicable
|
|
2115
2230
|
*/
|
|
2116
2231
|
reasoningEffort?: string | null;
|
|
2232
|
+
/**
|
|
2233
|
+
* Model that owns effort embedded in an authored model selection. Omitted for independent reasoning-effort overrides and legacy events.
|
|
2234
|
+
*/
|
|
2235
|
+
reasoningEffortModel?: string;
|
|
2117
2236
|
reasoningSummary?: ReasoningSummary;
|
|
2118
2237
|
source?: ModelChangeSource;
|
|
2119
2238
|
verbosity?: Verbosity;
|
|
@@ -5506,6 +5625,10 @@ export interface AssistantMessageReasoningBlocks {
|
|
|
5506
5625
|
* Provider-native reasoning items or content blocks preserved verbatim, in order. A single response can carry several, and provider signatures or identifiers may depend on their exact content and ordering.
|
|
5507
5626
|
*/
|
|
5508
5627
|
blocks?: JsonValue[];
|
|
5628
|
+
/**
|
|
5629
|
+
* Anthropic Messages assistant block ordering preserved when the legacy reasoning-only representation cannot reproduce it exactly. Thinking and text blocks remain verbatim; tool-use entries retain identity and a payload fingerprint when later signed reasoning depends on them, and are hydrated from the message's tool requests during replay.
|
|
5630
|
+
*/
|
|
5631
|
+
orderedBlocks?: JsonValue[];
|
|
5509
5632
|
/**
|
|
5510
5633
|
* Model provider that produced these reasoning blocks.
|
|
5511
5634
|
*/
|
|
@@ -6413,7 +6536,8 @@ export interface ToolExecutionStartToolDescriptionMetaUI {
|
|
|
6413
6536
|
visibility?: ToolExecutionStartToolDescriptionMetaUIVisibility[];
|
|
6414
6537
|
}
|
|
6415
6538
|
/**
|
|
6416
|
-
*
|
|
6539
|
+
* @deprecated
|
|
6540
|
+
* Session event "tool.execution_partial_result". Deprecated merged replacement snapshot of shell output. Use tool.shell_output for append-only, stream-tagged output instead.
|
|
6417
6541
|
*/
|
|
6418
6542
|
export interface ToolExecutionPartialResultEvent {
|
|
6419
6543
|
/**
|
|
@@ -6443,11 +6567,12 @@ export interface ToolExecutionPartialResultEvent {
|
|
|
6443
6567
|
type: "tool.execution_partial_result";
|
|
6444
6568
|
}
|
|
6445
6569
|
/**
|
|
6446
|
-
*
|
|
6570
|
+
* @deprecated
|
|
6571
|
+
* Deprecated merged replacement snapshot of shell output. Use tool.shell_output for append-only, stream-tagged output instead.
|
|
6447
6572
|
*/
|
|
6448
6573
|
export interface ToolExecutionPartialData {
|
|
6449
6574
|
/**
|
|
6450
|
-
*
|
|
6575
|
+
* Merged replacement snapshot from the running shell, not an append-only chunk
|
|
6451
6576
|
*/
|
|
6452
6577
|
partialOutput: string;
|
|
6453
6578
|
/**
|
|
@@ -6455,6 +6580,54 @@ export interface ToolExecutionPartialData {
|
|
|
6455
6580
|
*/
|
|
6456
6581
|
toolCallId: string;
|
|
6457
6582
|
}
|
|
6583
|
+
/**
|
|
6584
|
+
* Session event "tool.shell_output". Live, append-only shell output. Not persisted or replayed to late subscribers. Text is decoded and redacted per chunk; chunks need not contain complete lines.
|
|
6585
|
+
*/
|
|
6586
|
+
export interface ToolShellOutputEvent {
|
|
6587
|
+
/**
|
|
6588
|
+
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
|
|
6589
|
+
*/
|
|
6590
|
+
agentId?: string;
|
|
6591
|
+
data: ToolShellOutputData;
|
|
6592
|
+
/**
|
|
6593
|
+
* Always true for events that are transient and not persisted to the session event log on disk.
|
|
6594
|
+
*/
|
|
6595
|
+
ephemeral: true;
|
|
6596
|
+
/**
|
|
6597
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
6598
|
+
*/
|
|
6599
|
+
id: string;
|
|
6600
|
+
/**
|
|
6601
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
6602
|
+
*/
|
|
6603
|
+
parentId: string | null;
|
|
6604
|
+
/**
|
|
6605
|
+
* ISO 8601 timestamp when the event was created
|
|
6606
|
+
*/
|
|
6607
|
+
timestamp: string;
|
|
6608
|
+
/**
|
|
6609
|
+
* Type discriminator. Always "tool.shell_output".
|
|
6610
|
+
*/
|
|
6611
|
+
type: "tool.shell_output";
|
|
6612
|
+
}
|
|
6613
|
+
/**
|
|
6614
|
+
* Live, append-only shell output. Not persisted or replayed to late subscribers. Text is decoded and redacted per chunk; chunks need not contain complete lines.
|
|
6615
|
+
*/
|
|
6616
|
+
export interface ToolShellOutputData {
|
|
6617
|
+
/**
|
|
6618
|
+
* Zero-based publication sequence across all output streams for this tool call. Not a byte offset or an OS write-order guarantee.
|
|
6619
|
+
*/
|
|
6620
|
+
sequence: number;
|
|
6621
|
+
stream?: ToolShellOutputStream;
|
|
6622
|
+
/**
|
|
6623
|
+
* New output to append, without synthetic shell-result markers or stream-switch separators
|
|
6624
|
+
*/
|
|
6625
|
+
text: string;
|
|
6626
|
+
/**
|
|
6627
|
+
* Tool call ID that owns this shell output
|
|
6628
|
+
*/
|
|
6629
|
+
toolCallId: string;
|
|
6630
|
+
}
|
|
6458
6631
|
/**
|
|
6459
6632
|
* Session event "tool.execution_progress". Tool execution progress notification with status message
|
|
6460
6633
|
*/
|
|
@@ -6539,6 +6712,12 @@ export interface ToolExecutionCompleteEvent {
|
|
|
6539
6712
|
*/
|
|
6540
6713
|
export interface ToolExecutionCompleteData {
|
|
6541
6714
|
error?: ToolExecutionCompleteError;
|
|
6715
|
+
/**
|
|
6716
|
+
* Experimental. File mutations actually committed by a built-in file editing tool, in execution order. Present on successful edits and on partial failures when earlier mutations were committed. Paths are absolute in the session filesystem namespace.
|
|
6717
|
+
*
|
|
6718
|
+
* @experimental
|
|
6719
|
+
*/
|
|
6720
|
+
fileEdits?: ToolExecutionCompleteFileEdit[];
|
|
6542
6721
|
/**
|
|
6543
6722
|
* Experimental HydraFusion attribution for this tool completion.
|
|
6544
6723
|
*
|
|
@@ -6617,6 +6796,17 @@ export interface ToolExecutionCompleteError {
|
|
|
6617
6796
|
message: string;
|
|
6618
6797
|
remediation?: RemediationAction;
|
|
6619
6798
|
}
|
|
6799
|
+
/**
|
|
6800
|
+
* A file mutation that was actually committed by a built-in file editing tool.
|
|
6801
|
+
*/
|
|
6802
|
+
/** @experimental */
|
|
6803
|
+
export interface ToolExecutionCompleteFileEdit {
|
|
6804
|
+
kind: ToolExecutionCompleteFileEditKind;
|
|
6805
|
+
/**
|
|
6806
|
+
* Absolute path in the session filesystem namespace.
|
|
6807
|
+
*/
|
|
6808
|
+
path: string;
|
|
6809
|
+
}
|
|
6620
6810
|
/**
|
|
6621
6811
|
* Tool execution result on success
|
|
6622
6812
|
*/
|
|
@@ -11679,6 +11869,51 @@ export interface ExitPlanModeCompletedData {
|
|
|
11679
11869
|
requestId: string;
|
|
11680
11870
|
selectedAction?: ExitPlanModeAction;
|
|
11681
11871
|
}
|
|
11872
|
+
/**
|
|
11873
|
+
* Session event "human_response.recorded". Durable request-correlated evidence for a typed response to a runtime-owned question or plan review.
|
|
11874
|
+
*/
|
|
11875
|
+
export interface HumanResponseRecordedEvent {
|
|
11876
|
+
/**
|
|
11877
|
+
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
|
|
11878
|
+
*/
|
|
11879
|
+
agentId?: string;
|
|
11880
|
+
data: HumanResponseRecordedData;
|
|
11881
|
+
/**
|
|
11882
|
+
* When true, the event is transient and not persisted to the session event log on disk
|
|
11883
|
+
*/
|
|
11884
|
+
ephemeral?: boolean;
|
|
11885
|
+
/**
|
|
11886
|
+
* Unique event identifier (UUID v4), generated when the event is emitted
|
|
11887
|
+
*/
|
|
11888
|
+
id: string;
|
|
11889
|
+
/**
|
|
11890
|
+
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
|
|
11891
|
+
*/
|
|
11892
|
+
parentId: string | null;
|
|
11893
|
+
/**
|
|
11894
|
+
* ISO 8601 timestamp when the event was created
|
|
11895
|
+
*/
|
|
11896
|
+
timestamp: string;
|
|
11897
|
+
/**
|
|
11898
|
+
* Type discriminator. Always "human_response.recorded".
|
|
11899
|
+
*/
|
|
11900
|
+
type: "human_response.recorded";
|
|
11901
|
+
}
|
|
11902
|
+
/**
|
|
11903
|
+
* Durable request-correlated evidence for a typed response to a runtime-owned question or plan review.
|
|
11904
|
+
*/
|
|
11905
|
+
export interface HumanResponseRecordedData {
|
|
11906
|
+
actor: HumanResponseActor;
|
|
11907
|
+
/**
|
|
11908
|
+
* Request ID of the runtime-owned question or plan review.
|
|
11909
|
+
*/
|
|
11910
|
+
requestId: string;
|
|
11911
|
+
response: HumanResponseRecordedResponse;
|
|
11912
|
+
/**
|
|
11913
|
+
* Tool call ID that opened the request, when present.
|
|
11914
|
+
*/
|
|
11915
|
+
toolCallId?: string;
|
|
11916
|
+
}
|
|
11682
11917
|
/**
|
|
11683
11918
|
* Session event "session.tools_updated". Payload of `session.tools_updated` identifying the model whose resolved tools were updated.
|
|
11684
11919
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export { BuiltInTools, ToolSet } from "./toolSet.js";
|
|
|
11
11
|
export { CopilotSession, type AssistantMessageEvent } from "./session.js";
|
|
12
12
|
export { defineWorkflow, WorkflowResumeError, isWorkflowRunTerminal } from "./workflow.js";
|
|
13
13
|
export { Canvas, CanvasError, createCanvas, type CanvasAction, type CanvasDeclaration, type CanvasHostContext, type CanvasHostContextCapabilities, type CanvasJsonSchema, type CanvasOptions, } from "./canvas.js";
|
|
14
|
-
export { defineTool, approveAll, createAttributedPermissionResult, convertMcpCallToolResult, createSessionFsAdapter, CopilotRequestHandler, CopilotWebSocketHandler, CopilotWebSocketCloseStatus, CopilotWebSocketForwarder, SessionFsSqliteTransactionFailure, SYSTEM_MESSAGE_SECTIONS, } from "./types.js";
|
|
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, 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, 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/index.js
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
CopilotWebSocketCloseStatus,
|
|
23
23
|
CopilotWebSocketForwarder,
|
|
24
24
|
SessionFsSqliteTransactionFailure,
|
|
25
|
+
SessionFsWriteFailure,
|
|
25
26
|
SYSTEM_MESSAGE_SECTIONS
|
|
26
27
|
} from "./types.js";
|
|
27
28
|
export {
|
|
@@ -39,6 +40,7 @@ export {
|
|
|
39
40
|
RuntimeConnection,
|
|
40
41
|
SYSTEM_MESSAGE_SECTIONS,
|
|
41
42
|
SessionFsSqliteTransactionFailure,
|
|
43
|
+
SessionFsWriteFailure,
|
|
42
44
|
ToolSet,
|
|
43
45
|
WorkflowResumeError,
|
|
44
46
|
approveAll,
|
package/dist/runtimeArtifacts.js
CHANGED
package/dist/session.js
CHANGED
|
@@ -1065,7 +1065,20 @@ class CopilotSession {
|
|
|
1065
1065
|
}
|
|
1066
1066
|
for (const tool of tools) {
|
|
1067
1067
|
if (tool.handler) {
|
|
1068
|
-
|
|
1068
|
+
const handler = tool.handler;
|
|
1069
|
+
if (tool.name === "apply_patch" && tool.overridesBuiltInTool && toJsonSchema(tool.parameters)?.type === "string") {
|
|
1070
|
+
this.toolHandlers.set(tool.name, (args, invocation) => {
|
|
1071
|
+
if (typeof args === "string") {
|
|
1072
|
+
return handler(args, invocation);
|
|
1073
|
+
}
|
|
1074
|
+
if (typeof args === "object" && args !== null && "input" in args && typeof args.input === "string") {
|
|
1075
|
+
return handler(args.input, invocation);
|
|
1076
|
+
}
|
|
1077
|
+
throw new TypeError("apply_patch string override requires a string input");
|
|
1078
|
+
});
|
|
1079
|
+
} else {
|
|
1080
|
+
this.toolHandlers.set(tool.name, handler);
|
|
1081
|
+
}
|
|
1069
1082
|
}
|
|
1070
1083
|
}
|
|
1071
1084
|
}
|
|
@@ -1660,7 +1673,9 @@ class CopilotSession {
|
|
|
1660
1673
|
sessionStart: this.hooks.onSessionStart,
|
|
1661
1674
|
sessionEnd: this.hooks.onSessionEnd,
|
|
1662
1675
|
errorOccurred: this.hooks.onErrorOccurred,
|
|
1663
|
-
agentStop: this.hooks.onAgentStop
|
|
1676
|
+
agentStop: this.hooks.onAgentStop,
|
|
1677
|
+
subagentStart: this.hooks.onSubagentStart,
|
|
1678
|
+
subagentStop: this.hooks.onSubagentStop
|
|
1664
1679
|
};
|
|
1665
1680
|
const handler = handlerMap[hookType];
|
|
1666
1681
|
if (!handler) {
|
|
@@ -37,6 +37,10 @@ export declare class SessionFsSqliteTransactionFailure extends Error {
|
|
|
37
37
|
readonly errorClass: SessionFsSqliteTransactionErrorClass;
|
|
38
38
|
constructor(message: string, errorClass?: SessionFsSqliteTransactionErrorClass);
|
|
39
39
|
}
|
|
40
|
+
/** Throw from `writeFile` only when the provider changed the target before failing. */
|
|
41
|
+
export declare class SessionFsWriteFailure extends Error {
|
|
42
|
+
readonly writeChanged = true;
|
|
43
|
+
}
|
|
40
44
|
/**
|
|
41
45
|
* SQLite operations for the per-session database.
|
|
42
46
|
* Implementers provide query execution and existence checking.
|
|
@@ -78,7 +82,11 @@ export interface SessionFsSqliteProvider {
|
|
|
78
82
|
export interface SessionFsProvider {
|
|
79
83
|
/** Reads the full content of a file. Throw if the file does not exist. */
|
|
80
84
|
readFile(path: string): Promise<string>;
|
|
81
|
-
/**
|
|
85
|
+
/** Read exact file bytes. Required when capabilities.binary is enabled. */
|
|
86
|
+
readFileBytes?(path: string): Promise<Uint8Array>;
|
|
87
|
+
/** Write exact file bytes. Required when capabilities.binary is enabled. */
|
|
88
|
+
writeFileBytes?(path: string, content: Uint8Array, mode?: number): Promise<void>;
|
|
89
|
+
/** Writes content to a file, creating parent directories if needed. Throw {@link SessionFsWriteFailure} if a failed write changed the target. */
|
|
82
90
|
writeFile(path: string, content: string, mode?: number): Promise<void>;
|
|
83
91
|
/** Appends content to a file, creating parent directories if needed. */
|
|
84
92
|
appendFile(path: string, content: string, mode?: number): Promise<void>;
|