@github/copilot-sdk 1.0.7-preview.2 → 1.0.7
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 +4 -2
- package/dist/cjs/client.js +78 -22
- package/dist/cjs/ffiRuntimeHost.js +8 -5
- package/dist/cjs/generated/rpc.js +13 -10
- package/dist/cjs/session.js +12 -1
- package/dist/cjs/types.js +3 -2
- package/dist/client.d.ts +4 -12
- package/dist/client.js +78 -22
- package/dist/ffiRuntimeHost.d.ts +3 -2
- package/dist/ffiRuntimeHost.js +8 -5
- package/dist/generated/rpc.d.ts +132 -26
- package/dist/generated/rpc.js +13 -10
- package/dist/generated/session-events.d.ts +183 -7
- package/dist/index.d.ts +1 -1
- package/dist/session.d.ts +6 -1
- package/dist/session.js +12 -1
- package/dist/types.d.ts +78 -10
- package/dist/types.js +3 -2
- package/package.json +2 -2
package/dist/generated/rpc.d.ts
CHANGED
|
@@ -784,6 +784,18 @@ export type McpHeadersHandlePendingHeadersRefreshRequest = {
|
|
|
784
784
|
} | {
|
|
785
785
|
kind: "none";
|
|
786
786
|
};
|
|
787
|
+
/**
|
|
788
|
+
* Consumer allowed to call an MCP tool.
|
|
789
|
+
*
|
|
790
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
791
|
+
* via the `definition` "McpToolUiVisibility".
|
|
792
|
+
*/
|
|
793
|
+
/** @experimental */
|
|
794
|
+
export type McpToolUiVisibility =
|
|
795
|
+
/** The model may call the tool. */
|
|
796
|
+
"model"
|
|
797
|
+
/** An MCP App view may call the tool. */
|
|
798
|
+
| "app";
|
|
787
799
|
/**
|
|
788
800
|
* Host response to the pending OAuth request.
|
|
789
801
|
*
|
|
@@ -3214,6 +3226,10 @@ export interface DiscoveredCanvas {
|
|
|
3214
3226
|
* Short, single-sentence description shown to the agent in canvas catalogs.
|
|
3215
3227
|
*/
|
|
3216
3228
|
description: string;
|
|
3229
|
+
/**
|
|
3230
|
+
* Host-local PNG path for the canvas icon, when supplied
|
|
3231
|
+
*/
|
|
3232
|
+
icon?: string;
|
|
3217
3233
|
inputSchema?: CanvasJsonSchema;
|
|
3218
3234
|
/**
|
|
3219
3235
|
* Actions the agent or host may invoke on an open instance
|
|
@@ -3269,6 +3285,10 @@ export interface OpenCanvasInstance {
|
|
|
3269
3285
|
* Provider-local canvas identifier
|
|
3270
3286
|
*/
|
|
3271
3287
|
canvasId: string;
|
|
3288
|
+
/**
|
|
3289
|
+
* Host-local PNG path for the canvas icon, when supplied
|
|
3290
|
+
*/
|
|
3291
|
+
icon?: string;
|
|
3272
3292
|
/**
|
|
3273
3293
|
* Rendered title
|
|
3274
3294
|
*/
|
|
@@ -5791,27 +5811,24 @@ export interface McpAppsListToolsResult {
|
|
|
5791
5811
|
}[];
|
|
5792
5812
|
}
|
|
5793
5813
|
/**
|
|
5794
|
-
*
|
|
5795
|
-
* Deprecated/obsolete MCP Apps alias for `McpResourcesReadRequest`; use `session.mcp.resources.read` instead.
|
|
5814
|
+
* MCP server and resource URI to fetch.
|
|
5796
5815
|
*
|
|
5797
5816
|
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
5798
5817
|
* via the `definition` "McpAppsReadResourceRequest".
|
|
5799
5818
|
*/
|
|
5800
5819
|
/** @experimental */
|
|
5801
|
-
/** @deprecated */
|
|
5802
5820
|
export interface McpAppsReadResourceRequest {
|
|
5803
5821
|
/**
|
|
5804
5822
|
* Name of the MCP server hosting the resource
|
|
5805
5823
|
*/
|
|
5806
5824
|
serverName: string;
|
|
5807
5825
|
/**
|
|
5808
|
-
* Resource URI
|
|
5826
|
+
* Resource URI (typically ui://...)
|
|
5809
5827
|
*/
|
|
5810
5828
|
uri: string;
|
|
5811
5829
|
}
|
|
5812
5830
|
/**
|
|
5813
|
-
*
|
|
5814
|
-
* Deprecated/obsolete MCP Apps alias for `McpResourcesReadResult`; use `session.mcp.resources.read` instead.
|
|
5831
|
+
* Resource contents returned by the MCP server.
|
|
5815
5832
|
*
|
|
5816
5833
|
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
5817
5834
|
* via the `definition` "McpAppsReadResourceResult".
|
|
@@ -5824,8 +5841,7 @@ export interface McpAppsReadResourceResult {
|
|
|
5824
5841
|
contents: McpAppsResourceContent[];
|
|
5825
5842
|
}
|
|
5826
5843
|
/**
|
|
5827
|
-
*
|
|
5828
|
-
* Deprecated/obsolete MCP Apps alias for `McpResourceContent`; use `session.mcp.resources.read` instead.
|
|
5844
|
+
* MCP Apps resource content with URI, optional MIME type, text or base64 blob, and resource metadata.
|
|
5829
5845
|
*
|
|
5830
5846
|
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
5831
5847
|
* via the `definition` "McpAppsResourceContent".
|
|
@@ -5833,7 +5849,7 @@ export interface McpAppsReadResourceResult {
|
|
|
5833
5849
|
/** @experimental */
|
|
5834
5850
|
export interface McpAppsResourceContent {
|
|
5835
5851
|
/**
|
|
5836
|
-
* The resource URI
|
|
5852
|
+
* The resource URI (typically ui://...)
|
|
5837
5853
|
*/
|
|
5838
5854
|
uri: string;
|
|
5839
5855
|
/**
|
|
@@ -5849,7 +5865,7 @@ export interface McpAppsResourceContent {
|
|
|
5849
5865
|
*/
|
|
5850
5866
|
blob?: string;
|
|
5851
5867
|
/**
|
|
5852
|
-
* Resource-level metadata
|
|
5868
|
+
* Resource-level metadata (CSP, permissions, etc.)
|
|
5853
5869
|
*/
|
|
5854
5870
|
_meta?: {
|
|
5855
5871
|
[k: string]: unknown | undefined;
|
|
@@ -6388,7 +6404,7 @@ export interface McpListToolsResult {
|
|
|
6388
6404
|
tools: McpTools[];
|
|
6389
6405
|
}
|
|
6390
6406
|
/**
|
|
6391
|
-
* MCP tool metadata with tool name and
|
|
6407
|
+
* MCP tool metadata with tool name, optional description, and normalized MCP Apps discovery metadata.
|
|
6392
6408
|
*
|
|
6393
6409
|
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
6394
6410
|
* via the `definition` "McpTools".
|
|
@@ -6403,6 +6419,24 @@ export interface McpTools {
|
|
|
6403
6419
|
* Tool description, when provided.
|
|
6404
6420
|
*/
|
|
6405
6421
|
description?: string;
|
|
6422
|
+
ui?: McpToolUi;
|
|
6423
|
+
}
|
|
6424
|
+
/**
|
|
6425
|
+
* Normalized MCP Apps discovery metadata from a tool's `_meta.ui` block.
|
|
6426
|
+
*
|
|
6427
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
6428
|
+
* via the `definition` "McpToolUi".
|
|
6429
|
+
*/
|
|
6430
|
+
/** @experimental */
|
|
6431
|
+
export interface McpToolUi {
|
|
6432
|
+
/**
|
|
6433
|
+
* URI of the tool's MCP App resource, typically a `ui://` resource identifier. Use `session.mcp.resources.read` to fetch its HTML and resource metadata.
|
|
6434
|
+
*/
|
|
6435
|
+
resourceUri?: string;
|
|
6436
|
+
/**
|
|
6437
|
+
* Tool visibility advertised by the server. When absent, MCP Apps defaults apply.
|
|
6438
|
+
*/
|
|
6439
|
+
visibility?: McpToolUiVisibility[];
|
|
6406
6440
|
}
|
|
6407
6441
|
/**
|
|
6408
6442
|
* Pending MCP OAuth request ID and host-provided token or cancellation response.
|
|
@@ -7107,7 +7141,7 @@ export interface SessionWorkingDirectoryContext {
|
|
|
7107
7141
|
export interface MetadataRecordContextChangeResult {
|
|
7108
7142
|
}
|
|
7109
7143
|
/**
|
|
7110
|
-
* Absolute path to set as the session's new working directory.
|
|
7144
|
+
* Absolute path to set as the session's new working directory. For local sessions the path must be absolute and exist on disk: it is validated before any session state changes, and a failing validation rejects the call with nothing mutated, persisted, or emitted. Remote sessions record the path as-is.
|
|
7111
7145
|
*
|
|
7112
7146
|
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
7113
7147
|
* via the `definition` "MetadataSetWorkingDirectoryRequest".
|
|
@@ -7120,7 +7154,7 @@ export interface MetadataSetWorkingDirectoryRequest {
|
|
|
7120
7154
|
workingDirectory: string;
|
|
7121
7155
|
}
|
|
7122
7156
|
/**
|
|
7123
|
-
* Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for
|
|
7157
|
+
* Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for any related side-effects (file index, etc.); it does NOT change the process working directory (a session's cwd is per-session, not process-global). For local sessions the runtime validates the target first (an absolute path that exists on disk) and re-bases the permission primary directory; a rejected validation fails the call before anything is mutated, persisted, or emitted. Location-scoped permission rules are then re-keyed to the new directory (best-effort). Remote sessions only record the path.
|
|
7124
7158
|
*
|
|
7125
7159
|
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
7126
7160
|
* via the `definition` "MetadataSetWorkingDirectoryResult".
|
|
@@ -7305,6 +7339,7 @@ export interface ModelBilling {
|
|
|
7305
7339
|
* Whole-number percentage discount (0-100) applied to usage billed through this model. Populated for the synthetic `auto` model, where requests routed by auto-mode are billed at a reduced rate; absent for concrete models.
|
|
7306
7340
|
*/
|
|
7307
7341
|
discountPercent?: number;
|
|
7342
|
+
promo?: ModelBillingPromo;
|
|
7308
7343
|
}
|
|
7309
7344
|
/**
|
|
7310
7345
|
* Token-level pricing information for this model
|
|
@@ -7389,6 +7424,31 @@ export interface ModelBillingTokenPricesLongContext {
|
|
|
7389
7424
|
*/
|
|
7390
7425
|
maxPromptTokens?: number;
|
|
7391
7426
|
}
|
|
7427
|
+
/**
|
|
7428
|
+
* Active server-driven promotion for a model, including its discount and expiry.
|
|
7429
|
+
*
|
|
7430
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
7431
|
+
* via the `definition` "ModelBillingPromo".
|
|
7432
|
+
*/
|
|
7433
|
+
/** @experimental */
|
|
7434
|
+
export interface ModelBillingPromo {
|
|
7435
|
+
/**
|
|
7436
|
+
* Stable identifier for the promotion campaign.
|
|
7437
|
+
*/
|
|
7438
|
+
id?: string;
|
|
7439
|
+
/**
|
|
7440
|
+
* Percentage discount (0-100) applied while the promotion is active. May be fractional.
|
|
7441
|
+
*/
|
|
7442
|
+
discountPercent?: number;
|
|
7443
|
+
/**
|
|
7444
|
+
* UTC ISO 8601 timestamp marking when the promotion ends. Always present: the API only surfaces a promo whose expiry parses and is in the future. Consumers should treat a past value as expired.
|
|
7445
|
+
*/
|
|
7446
|
+
endsAt: string;
|
|
7447
|
+
/**
|
|
7448
|
+
* Human-readable promotion message. Does not include the expiry timestamp; consumers may format endsAt and append it.
|
|
7449
|
+
*/
|
|
7450
|
+
message?: string;
|
|
7451
|
+
}
|
|
7392
7452
|
/**
|
|
7393
7453
|
* Optional capability overrides (vision, tool_calls, reasoning, etc.).
|
|
7394
7454
|
*
|
|
@@ -9272,7 +9332,7 @@ export interface PluginsInstallRequest {
|
|
|
9272
9332
|
workingDirectory?: string;
|
|
9273
9333
|
}
|
|
9274
9334
|
/**
|
|
9275
|
-
* Marketplace source
|
|
9335
|
+
* Marketplace source and optional working directory for relative-path resolution.
|
|
9276
9336
|
*
|
|
9277
9337
|
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
9278
9338
|
* via the `definition` "PluginsMarketplacesAddRequest".
|
|
@@ -9283,6 +9343,10 @@ export interface PluginsMarketplacesAddRequest {
|
|
|
9283
9343
|
* Marketplace source. Accepts the same forms as the CLI: "owner/repo" or "owner/repo#ref" (GitHub), an http/https/ssh URL (optionally with #ref), a git scp-style URL (user@host:path), or a local path. The marketplace's own name (from its manifest) is used as the registration key.
|
|
9284
9344
|
*/
|
|
9285
9345
|
source: string;
|
|
9346
|
+
/**
|
|
9347
|
+
* Working directory used to resolve relative local paths in `source`. Defaults to the server's current working directory.
|
|
9348
|
+
*/
|
|
9349
|
+
workingDirectory?: string;
|
|
9286
9350
|
}
|
|
9287
9351
|
/**
|
|
9288
9352
|
* Name of the marketplace whose plugin catalog to fetch.
|
|
@@ -10185,7 +10249,7 @@ export interface QueueRemoveMostRecentResult {
|
|
|
10185
10249
|
/** @experimental */
|
|
10186
10250
|
export interface RegisterEventInterestParams {
|
|
10187
10251
|
/**
|
|
10188
|
-
* The event type the consumer wants the runtime to treat as 'observed' for behavior-switching gating. Some runtime code paths inspect whether any consumer is interested in a specific event type and choose a different implementation accordingly (e.g. `mcp.oauth_required`: when interest is registered the runtime delegates OAuth token acquisition to the consumer; when no interest is registered
|
|
10252
|
+
* The event type the consumer wants the runtime to treat as 'observed' for behavior-switching gating. Some runtime code paths inspect whether any consumer is interested in a specific event type and choose a different implementation accordingly (e.g. `mcp.oauth_required`: when interest is registered the runtime delegates interactive OAuth token acquisition to the consumer via `mcp.oauth_required` events; when no interest is registered the runtime still attempts non-interactive reconnect from cached or refreshable tokens, and only marks the server `needs-auth` if usable credentials are unavailable — it does not open a browser or start interactive OAuth without a consumer). SDK clients that long-poll events do NOT automatically appear as listeners to these gating checks — they must explicitly call `registerInterest` for each event type they want the runtime to count as having a consumer. Multiple registrations for the same event type from the same or different consumers are tracked independently and must each be released. See: `mcp.oauth_required`, `sampling.requested`, `auto_mode_switch.requested`, `session_limits_exhausted.requested`, `user_input.requested`, `elicitation.requested`, `command.queued`, `exit_plan_mode.requested`.
|
|
10189
10253
|
*/
|
|
10190
10254
|
eventType: string;
|
|
10191
10255
|
}
|
|
@@ -11715,6 +11779,10 @@ export interface SessionModelList {
|
|
|
11715
11779
|
* Available models, ordered with the most preferred default first. Includes both Copilot (CAPI) models and any registry BYOK models; a BYOK model appears under its provider-qualified selection id (`provider/id`).
|
|
11716
11780
|
*/
|
|
11717
11781
|
list: unknown[];
|
|
11782
|
+
/**
|
|
11783
|
+
* Cost categories for the full CAPI catalog, including picker-disabled models that Auto may select. Metadata only; entries absent from `list` are not manually selectable.
|
|
11784
|
+
*/
|
|
11785
|
+
modelPriceCategories?: SessionModelPriceCategory[];
|
|
11718
11786
|
/**
|
|
11719
11787
|
* Per-quota snapshots returned alongside the model list, keyed by quota type.
|
|
11720
11788
|
*/
|
|
@@ -11722,6 +11790,17 @@ export interface SessionModelList {
|
|
|
11722
11790
|
[k: string]: unknown | undefined;
|
|
11723
11791
|
};
|
|
11724
11792
|
}
|
|
11793
|
+
/**
|
|
11794
|
+
* Cost-category metadata for a CAPI model.
|
|
11795
|
+
*
|
|
11796
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
11797
|
+
* via the `definition` "SessionModelPriceCategory".
|
|
11798
|
+
*/
|
|
11799
|
+
/** @experimental */
|
|
11800
|
+
export interface SessionModelPriceCategory {
|
|
11801
|
+
id: string;
|
|
11802
|
+
priceCategory: ModelPickerPriceCategory;
|
|
11803
|
+
}
|
|
11725
11804
|
/**
|
|
11726
11805
|
* Session construction options.
|
|
11727
11806
|
*
|
|
@@ -11826,6 +11905,10 @@ export interface SessionOpenOptions {
|
|
|
11826
11905
|
* Denylist of tool names.
|
|
11827
11906
|
*/
|
|
11828
11907
|
excludedTools?: string[];
|
|
11908
|
+
/**
|
|
11909
|
+
* Built-in subagent names to include in this session. When specified, only these built-ins are available, subject to runtime availability and exclusions. Custom agents with the same name remain available.
|
|
11910
|
+
*/
|
|
11911
|
+
includedBuiltinAgents?: string[];
|
|
11829
11912
|
/**
|
|
11830
11913
|
* Built-in subagent names to exclude from this session. Excluded built-ins are hidden from agent discovery and cannot be dispatched unless a custom agent with the same name is available.
|
|
11831
11914
|
*/
|
|
@@ -12896,6 +12979,10 @@ export interface SessionUpdateOptionsParams {
|
|
|
12896
12979
|
* Denylist of tool names for this session.
|
|
12897
12980
|
*/
|
|
12898
12981
|
excludedTools?: string[];
|
|
12982
|
+
/**
|
|
12983
|
+
* Built-in subagent names to include in this session. When specified, only these built-ins are available, subject to runtime availability and exclusions. Custom agents with the same name remain available. Set to null to remove the allowlist restriction.
|
|
12984
|
+
*/
|
|
12985
|
+
includedBuiltinAgents?: string[] | null;
|
|
12899
12986
|
/**
|
|
12900
12987
|
* Built-in subagent names to exclude from this session. Excluded built-ins are hidden from agent discovery and cannot be dispatched unless a custom agent with the same name is available.
|
|
12901
12988
|
*/
|
|
@@ -13055,6 +13142,10 @@ export interface SessionUpdateOptionsResult {
|
|
|
13055
13142
|
* Whether the operation succeeded
|
|
13056
13143
|
*/
|
|
13057
13144
|
success: boolean;
|
|
13145
|
+
/**
|
|
13146
|
+
* Number of hooks loaded from installed plugins, returned when installedPlugins is updated
|
|
13147
|
+
*/
|
|
13148
|
+
pluginHookCount?: number;
|
|
13058
13149
|
}
|
|
13059
13150
|
/**
|
|
13060
13151
|
* User-requested shell execution cancellation handle.
|
|
@@ -13384,7 +13475,7 @@ export interface SkillsLoadDiagnostics {
|
|
|
13384
13475
|
errors: string[];
|
|
13385
13476
|
}
|
|
13386
13477
|
/**
|
|
13387
|
-
* Slash-command invocation result that submits an agent prompt, with display prompt, optional mode, and settings-change flag.
|
|
13478
|
+
* Slash-command invocation result that submits an agent prompt, with display prompt, optional mode, optional user-facing notice, and settings-change flag.
|
|
13388
13479
|
*
|
|
13389
13480
|
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
13390
13481
|
* via the `definition` "SlashCommandAgentPromptResult".
|
|
@@ -13404,6 +13495,10 @@ export interface SlashCommandAgentPromptResult {
|
|
|
13404
13495
|
*/
|
|
13405
13496
|
displayPrompt: string;
|
|
13406
13497
|
mode?: SessionMode;
|
|
13498
|
+
/**
|
|
13499
|
+
* Optional user-facing notice to show before the prompt is submitted
|
|
13500
|
+
*/
|
|
13501
|
+
notice?: string;
|
|
13407
13502
|
/**
|
|
13408
13503
|
* True when the invocation mutated user runtime settings; consumers caching settings should refresh
|
|
13409
13504
|
*/
|
|
@@ -15435,7 +15530,7 @@ export declare function createServerRpc(connection: MessageConnection): {
|
|
|
15435
15530
|
/**
|
|
15436
15531
|
* Registers a new marketplace from a source (owner/repo, URL, or local path).
|
|
15437
15532
|
*
|
|
15438
|
-
* @param params Marketplace source
|
|
15533
|
+
* @param params Marketplace source and optional working directory for relative-path resolution.
|
|
15439
15534
|
*
|
|
15440
15535
|
* @returns Result of registering a new marketplace.
|
|
15441
15536
|
*/
|
|
@@ -16275,7 +16370,7 @@ export declare function createSessionRpc(connection: MessageConnection, sessionI
|
|
|
16275
16370
|
*/
|
|
16276
16371
|
list: () => Promise<McpServerList>;
|
|
16277
16372
|
/**
|
|
16278
|
-
* Lists the tools exposed by a connected MCP server on this session's host.
|
|
16373
|
+
* Lists the tools exposed by a connected MCP server on this session's host. This performs a live `tools/list` request. Tool UI metadata is returned independently of whether MCP Apps rendering is enabled for the session.
|
|
16279
16374
|
*
|
|
16280
16375
|
* @param params Server name whose tool list should be returned.
|
|
16281
16376
|
*
|
|
@@ -16387,13 +16482,11 @@ export declare function createSessionRpc(connection: MessageConnection, sessionI
|
|
|
16387
16482
|
/** @experimental */
|
|
16388
16483
|
apps: {
|
|
16389
16484
|
/**
|
|
16390
|
-
*
|
|
16485
|
+
* Fetch an MCP resource (typically a `ui://` MCP App bundle, per SEP-1865) from a connected server. Requires the `mcp-apps` session capability.
|
|
16391
16486
|
*
|
|
16392
|
-
* @param params
|
|
16393
|
-
*
|
|
16394
|
-
* @returns Deprecated/obsolete MCP Apps alias for `McpResourcesReadResult`; use `session.mcp.resources.read` instead.
|
|
16487
|
+
* @param params MCP server and resource URI to fetch.
|
|
16395
16488
|
*
|
|
16396
|
-
* @
|
|
16489
|
+
* @returns Resource contents returned by the MCP server.
|
|
16397
16490
|
*/
|
|
16398
16491
|
readResource: (params: McpAppsReadResourceRequest) => Promise<McpAppsReadResourceResult>;
|
|
16399
16492
|
/**
|
|
@@ -16960,11 +17053,11 @@ export declare function createSessionRpc(connection: MessageConnection, sessionI
|
|
|
16960
17053
|
*/
|
|
16961
17054
|
recordContextChange: (params: MetadataRecordContextChangeRequest) => Promise<MetadataRecordContextChangeResult>;
|
|
16962
17055
|
/**
|
|
16963
|
-
* Updates the session's
|
|
17056
|
+
* Updates the session's working directory. For local sessions the target is validated first (an absolute path that exists on disk) and the permission primary directory is re-based; a rejected validation fails the call before any session state changes.
|
|
16964
17057
|
*
|
|
16965
|
-
* @param params Absolute path to set as the session's new working directory.
|
|
17058
|
+
* @param params Absolute path to set as the session's new working directory. For local sessions the path must be absolute and exist on disk: it is validated before any session state changes, and a failing validation rejects the call with nothing mutated, persisted, or emitted. Remote sessions record the path as-is.
|
|
16966
17059
|
*
|
|
16967
|
-
* @returns Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for
|
|
17060
|
+
* @returns Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for any related side-effects (file index, etc.); it does NOT change the process working directory (a session's cwd is per-session, not process-global). For local sessions the runtime validates the target first (an absolute path that exists on disk) and re-bases the permission primary directory; a rejected validation fails the call before anything is mutated, persisted, or emitted. Location-scoped permission rules are then re-keyed to the new directory (best-effort). Remote sessions only record the path.
|
|
16968
17061
|
*/
|
|
16969
17062
|
setWorkingDirectory: (params: MetadataSetWorkingDirectoryRequest) => Promise<MetadataSetWorkingDirectoryResult>;
|
|
16970
17063
|
/**
|
|
@@ -17318,6 +17411,18 @@ export interface ClientSessionApiHandlers {
|
|
|
17318
17411
|
* function uses `getHandlers` to resolve the session's handlers.
|
|
17319
17412
|
*/
|
|
17320
17413
|
export declare function registerClientSessionApiHandlers(connection: MessageConnection, getHandlers: (sessionId: string) => ClientSessionApiHandlers): void;
|
|
17414
|
+
/** Handler for `hooks` client global API methods. */
|
|
17415
|
+
/** @experimental */
|
|
17416
|
+
export interface HooksHandler {
|
|
17417
|
+
/**
|
|
17418
|
+
* Dispatches one SDK callback hook from the runtime to the connection that registered it. Internal transport plumbing: clients opt in through session initialization and the Rust hook processor owns ordering, policy, timeout, and callback routing.
|
|
17419
|
+
*
|
|
17420
|
+
* @param params Runtime-owned wire payload for a server-to-client hook callback invocation.
|
|
17421
|
+
*
|
|
17422
|
+
* @returns Optional output returned by an SDK callback hook.
|
|
17423
|
+
*/
|
|
17424
|
+
invoke(params: HookInvokeRequest): Promise<HookInvokeResponse>;
|
|
17425
|
+
}
|
|
17321
17426
|
/** Handler for `llmInference` client global API methods. */
|
|
17322
17427
|
/** @experimental */
|
|
17323
17428
|
export interface LlmInferenceHandler {
|
|
@@ -17350,6 +17455,7 @@ export interface GitHubTelemetryHandler {
|
|
|
17350
17455
|
}
|
|
17351
17456
|
/** All client global API handler groups. */
|
|
17352
17457
|
export interface ClientGlobalApiHandlers {
|
|
17458
|
+
hooks?: HooksHandler;
|
|
17353
17459
|
llmInference?: LlmInferenceHandler;
|
|
17354
17460
|
gitHubTelemetry?: GitHubTelemetryHandler;
|
|
17355
17461
|
}
|
package/dist/generated/rpc.js
CHANGED
|
@@ -195,7 +195,7 @@ function createServerRpc(connection) {
|
|
|
195
195
|
/**
|
|
196
196
|
* Registers a new marketplace from a source (owner/repo, URL, or local path).
|
|
197
197
|
*
|
|
198
|
-
* @param params Marketplace source
|
|
198
|
+
* @param params Marketplace source and optional working directory for relative-path resolution.
|
|
199
199
|
*
|
|
200
200
|
* @returns Result of registering a new marketplace.
|
|
201
201
|
*/
|
|
@@ -1091,7 +1091,7 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1091
1091
|
*/
|
|
1092
1092
|
list: async () => connection.sendRequest("session.mcp.list", { sessionId }),
|
|
1093
1093
|
/**
|
|
1094
|
-
* Lists the tools exposed by a connected MCP server on this session's host.
|
|
1094
|
+
* Lists the tools exposed by a connected MCP server on this session's host. This performs a live `tools/list` request. Tool UI metadata is returned independently of whether MCP Apps rendering is enabled for the session.
|
|
1095
1095
|
*
|
|
1096
1096
|
* @param params Server name whose tool list should be returned.
|
|
1097
1097
|
*
|
|
@@ -1203,13 +1203,11 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1203
1203
|
/** @experimental */
|
|
1204
1204
|
apps: {
|
|
1205
1205
|
/**
|
|
1206
|
-
*
|
|
1206
|
+
* Fetch an MCP resource (typically a `ui://` MCP App bundle, per SEP-1865) from a connected server. Requires the `mcp-apps` session capability.
|
|
1207
1207
|
*
|
|
1208
|
-
* @param params
|
|
1209
|
-
*
|
|
1210
|
-
* @returns Deprecated/obsolete MCP Apps alias for `McpResourcesReadResult`; use `session.mcp.resources.read` instead.
|
|
1208
|
+
* @param params MCP server and resource URI to fetch.
|
|
1211
1209
|
*
|
|
1212
|
-
* @
|
|
1210
|
+
* @returns Resource contents returned by the MCP server.
|
|
1213
1211
|
*/
|
|
1214
1212
|
readResource: async (params) => connection.sendRequest("session.mcp.apps.readResource", { sessionId, ...params }),
|
|
1215
1213
|
/**
|
|
@@ -1776,11 +1774,11 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1776
1774
|
*/
|
|
1777
1775
|
recordContextChange: async (params) => connection.sendRequest("session.metadata.recordContextChange", { sessionId, ...params }),
|
|
1778
1776
|
/**
|
|
1779
|
-
* Updates the session's
|
|
1777
|
+
* Updates the session's working directory. For local sessions the target is validated first (an absolute path that exists on disk) and the permission primary directory is re-based; a rejected validation fails the call before any session state changes.
|
|
1780
1778
|
*
|
|
1781
|
-
* @param params Absolute path to set as the session's new working directory.
|
|
1779
|
+
* @param params Absolute path to set as the session's new working directory. For local sessions the path must be absolute and exist on disk: it is validated before any session state changes, and a failing validation rejects the call with nothing mutated, persisted, or emitted. Remote sessions record the path as-is.
|
|
1782
1780
|
*
|
|
1783
|
-
* @returns Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for
|
|
1781
|
+
* @returns Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for any related side-effects (file index, etc.); it does NOT change the process working directory (a session's cwd is per-session, not process-global). For local sessions the runtime validates the target first (an absolute path that exists on disk) and re-bases the permission primary directory; a rejected validation fails the call before anything is mutated, persisted, or emitted. Location-scoped permission rules are then re-keyed to the new directory (best-effort). Remote sessions only record the path.
|
|
1784
1782
|
*/
|
|
1785
1783
|
setWorkingDirectory: async (params) => connection.sendRequest("session.metadata.setWorkingDirectory", { sessionId, ...params }),
|
|
1786
1784
|
/**
|
|
@@ -2119,6 +2117,11 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
|
|
|
2119
2117
|
});
|
|
2120
2118
|
}
|
|
2121
2119
|
function registerClientGlobalApiHandlers(connection, handlers) {
|
|
2120
|
+
connection.onRequest("hooks.invoke", async (params) => {
|
|
2121
|
+
const handler = handlers.hooks;
|
|
2122
|
+
if (!handler) throw new Error("No hooks client-global handler registered");
|
|
2123
|
+
return handler.invoke(params);
|
|
2124
|
+
});
|
|
2122
2125
|
connection.onRequest("llmInference.httpRequestStart", async (params) => {
|
|
2123
2126
|
const handler = handlers.llmInference;
|
|
2124
2127
|
if (!handler) throw new Error("No llmInference client-global handler registered");
|