@github/copilot-sdk-linuxmusl-x64 1.0.14-preview.1 → 1.0.14
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/cliVersion.d.ts +2 -0
- package/copilot-sdk/client.d.ts +5 -1
- package/copilot-sdk/docs/factories.md +36 -19
- package/copilot-sdk/extension.js +906 -185
- package/copilot-sdk/factory.d.ts +42 -16
- package/copilot-sdk/ffiRuntimeHost.d.ts +8 -2
- package/copilot-sdk/generated/rpc.d.ts +1683 -84
- package/copilot-sdk/generated/session-events.d.ts +987 -93
- package/copilot-sdk/index.d.ts +2 -2
- package/copilot-sdk/index.js +905 -184
- package/copilot-sdk/runtimeArtifacts.d.ts +13 -1
- package/copilot-sdk/session.d.ts +53 -1
- package/copilot-sdk/types.d.ts +78 -3
- package/package.json +1 -1
- package/prebuilds/linuxmusl-x64/runtime.node +0 -0
- package/schemas/api.schema.json +669 -107
- package/schemas/session-events.schema.json +560 -11
- package/sdk/index.js +256 -254
- package/tgrep/bin/linux-x64/tgrep +0 -0
- package/tgrep/bin/linuxmusl-x64/tgrep +0 -0
|
@@ -2,5 +2,17 @@ export interface RuntimeArtifactSources {
|
|
|
2
2
|
packageRoot: string;
|
|
3
3
|
platform: string;
|
|
4
4
|
}
|
|
5
|
+
export interface EnsureRuntimeBundleOptions {
|
|
6
|
+
cacheRoot?: string;
|
|
7
|
+
packageSearchPaths?: string[];
|
|
8
|
+
platform?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const RUNTIME_PLATFORMS: readonly ["darwin-arm64", "darwin-x64", "linux-arm64", "linux-x64", "linuxmusl-arm64", "linuxmusl-x64", "win32-arm64", "win32-x64"];
|
|
11
|
+
export declare function validateFile(path: string, label: string): void;
|
|
5
12
|
export declare function defaultRuntimeCacheRoot(platform?: NodeJS.Platform, home?: string, environment?: NodeJS.ProcessEnv): string;
|
|
6
|
-
export declare function materializeRuntimeBundle(sources: RuntimeArtifactSources, cacheRoot?: string): string;
|
|
13
|
+
export declare function materializeRuntimeBundle(sources: RuntimeArtifactSources, cacheRoot?: string, cacheKey?: string): string;
|
|
14
|
+
export declare function getRuntimePlatform(platform?: NodeJS.Platform, arch?: NodeJS.Architecture, musl?: boolean): string;
|
|
15
|
+
export declare function getRuntimeReleaseAssetName(version: string, platform: string): string;
|
|
16
|
+
export declare function getRuntimePackageName(platform: string): string;
|
|
17
|
+
export declare function resolvePackageRoot(packageName: string, searchPaths?: string[]): string | undefined;
|
|
18
|
+
export declare function ensureRuntimeBundle(version: string, options?: EnsureRuntimeBundleOptions): Promise<string>;
|
package/copilot-sdk/session.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createSessionRpc } from "./generated/rpc.js";
|
|
2
|
+
import type { ModelSwitchAutoTierResult } from "./generated/rpc.js";
|
|
2
3
|
import type { OpenCanvasInstance } from "./generated/rpc.js";
|
|
3
|
-
import type { MessageOptions, ContextTier, ReasoningEffort, ReasoningSummary, ModelCapabilitiesOverride, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionUiApi, TypedSessionEventHandler } from "./types.js";
|
|
4
|
+
import type { MessageOptions, ContextTier, ReasoningEffort, ReasoningSummary, AutoTier, ModelCapabilitiesOverride, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionUiApi, TypedSessionEventHandler } from "./types.js";
|
|
4
5
|
import { type SessionFactoryApi } from "./factory.js";
|
|
5
6
|
/** Assistant message event - the final response from the assistant. */
|
|
6
7
|
export type AssistantMessageEvent = Extract<SessionEvent, {
|
|
@@ -43,6 +44,7 @@ export declare class CopilotSession {
|
|
|
43
44
|
private eventHandlers;
|
|
44
45
|
private typedEventHandlers;
|
|
45
46
|
private toolHandlers;
|
|
47
|
+
private pendingExternalTools;
|
|
46
48
|
private canvases;
|
|
47
49
|
private bearerTokenProviders;
|
|
48
50
|
private commandHandlers;
|
|
@@ -57,11 +59,13 @@ export declare class CopilotSession {
|
|
|
57
59
|
private hooks?;
|
|
58
60
|
private transformCallbacks?;
|
|
59
61
|
private _rpc;
|
|
62
|
+
private _internalRpc;
|
|
60
63
|
private traceContextProvider?;
|
|
61
64
|
private readonly managedSettingsEnabled;
|
|
62
65
|
private _capabilities;
|
|
63
66
|
private openCanvasInstances;
|
|
64
67
|
private disconnected;
|
|
68
|
+
private disconnecting;
|
|
65
69
|
private onDisconnected?;
|
|
66
70
|
/**
|
|
67
71
|
* Friendly factory API for running registered factories by name or handle.
|
|
@@ -212,6 +216,7 @@ export declare class CopilotSession {
|
|
|
212
216
|
private removeOpenCanvasFromEvent;
|
|
213
217
|
private removeOpenCanvas;
|
|
214
218
|
private upsertOpenCanvas;
|
|
219
|
+
private _claimExternalTool;
|
|
215
220
|
/**
|
|
216
221
|
* Snapshot of canvas instances currently known to be open for this session.
|
|
217
222
|
* Populated from the `session.resume` response and live `session.canvas.opened`
|
|
@@ -300,6 +305,9 @@ export declare class CopilotSession {
|
|
|
300
305
|
* ```typescript
|
|
301
306
|
* await session.setModel("gpt-5.4");
|
|
302
307
|
* await session.setModel("claude-sonnet-4.6", { reasoningEffort: "high" });
|
|
308
|
+
*
|
|
309
|
+
* // Select the Auto model and its routing preference in one call.
|
|
310
|
+
* await session.setModel("auto", { autoTier: "intelligence" });
|
|
303
311
|
* ```
|
|
304
312
|
*/
|
|
305
313
|
setModel(model: string, options?: {
|
|
@@ -307,7 +315,51 @@ export declare class CopilotSession {
|
|
|
307
315
|
reasoningSummary?: ReasoningSummary;
|
|
308
316
|
contextTier?: ContextTier;
|
|
309
317
|
modelCapabilities?: ModelCapabilitiesOverride;
|
|
318
|
+
/**
|
|
319
|
+
* Routing preference to apply when `model` is `auto`.
|
|
320
|
+
*
|
|
321
|
+
* Pass `null` to return to the provider's default Auto routing. The
|
|
322
|
+
* runtime rejects this option when `model` is anything other than
|
|
323
|
+
* `auto`; use {@link setAutoTier} to change the preference without
|
|
324
|
+
* changing the selected model.
|
|
325
|
+
*
|
|
326
|
+
* @experimental Part of an experimental Auto routing surface and may
|
|
327
|
+
* change or be removed in a future release.
|
|
328
|
+
*/
|
|
329
|
+
autoTier?: AutoTier | null;
|
|
310
330
|
}): Promise<void>;
|
|
331
|
+
/**
|
|
332
|
+
* Change the Auto routing preference without changing the selected model.
|
|
333
|
+
*
|
|
334
|
+
* The runtime does not apply the preference immediately. It records the
|
|
335
|
+
* request and commits it only when a later user turn using the `auto` model
|
|
336
|
+
* successfully obtains a usable model from the provider. A `pending` status
|
|
337
|
+
* therefore confirms that the request was accepted, not that it took effect.
|
|
338
|
+
*
|
|
339
|
+
* Watch for the outcome through the `session.model_change` event on success,
|
|
340
|
+
* or the ephemeral `session.auto_tier_switch_failed` event on failure. You
|
|
341
|
+
* can also read the current committed and in-flight state at any time with
|
|
342
|
+
* `session.rpc.model.getCurrent()`.
|
|
343
|
+
*
|
|
344
|
+
* Only the most recent request survives: issuing a new request replaces any
|
|
345
|
+
* earlier one that has not yet been claimed by a turn.
|
|
346
|
+
*
|
|
347
|
+
* @param autoTier - Routing preference to activate, or `null` to return to
|
|
348
|
+
* the provider's default Auto routing
|
|
349
|
+
* @returns The runtime's immediate acknowledgement and Auto preference snapshot
|
|
350
|
+
*
|
|
351
|
+
* @experimental Part of an experimental Auto routing surface and may change
|
|
352
|
+
* or be removed in a future release.
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* ```typescript
|
|
356
|
+
* const result = await session.setAutoTier("intelligence");
|
|
357
|
+
* if (result.status === "pending") {
|
|
358
|
+
* // Takes effect on a later turn that uses the `auto` model.
|
|
359
|
+
* }
|
|
360
|
+
* ```
|
|
361
|
+
*/
|
|
362
|
+
setAutoTier(autoTier: AutoTier | null): Promise<ModelSwitchAutoTierResult>;
|
|
311
363
|
/**
|
|
312
364
|
* Log a message to the session timeline.
|
|
313
365
|
* The message appears in the session event stream and is visible to SDK consumers
|
package/copilot-sdk/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { Canvas } from "./canvas.js";
|
|
5
5
|
import type { SessionFsProvider } from "./sessionFsProvider.js";
|
|
6
6
|
import type { CopilotRequestHandler } from "./copilotRequestHandler.js";
|
|
7
|
-
import type { PermissionRequest as GeneratedPermissionRequest, PermissionRequestedData as GeneratedPermissionRequestedData, PermissionRequestedEvent as GeneratedPermissionRequestedEvent, ReasoningSummary, SessionLimitsConfig, SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js";
|
|
7
|
+
import type { AutoTier, PermissionRequest as GeneratedPermissionRequest, PermissionRequestedData as GeneratedPermissionRequestedData, PermissionRequestedEvent as GeneratedPermissionRequestedEvent, ReasoningSummary, SessionLimitsConfig, SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js";
|
|
8
8
|
import type { CopilotSession } from "./session.js";
|
|
9
9
|
import type { FactoryJsonSchema, JsonValue } from "./factory.js";
|
|
10
10
|
import type { GitHubTokenAcquireRequest, GitHubTokenAcquireResult, GitHubTelemetryNotification, ModelBillingTokenPrices, OpenCanvasInstance, RemoteSessionMode, CurrentToolMetadata } from "./generated/rpc.js";
|
|
@@ -34,7 +34,8 @@ export type { ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, } fro
|
|
|
34
34
|
export type SessionEvent = Exclude<GeneratedSessionEvent, {
|
|
35
35
|
type: "permission.requested";
|
|
36
36
|
}> | PermissionRequestedEvent;
|
|
37
|
-
export type { ReasoningSummary } from "./generated/session-events.js";
|
|
37
|
+
export type { AutoTier, ReasoningSummary } from "./generated/session-events.js";
|
|
38
|
+
export type { CurrentModel, ModelSwitchAutoTierResult, ModelSwitchAutoTierStatus, } from "./generated/rpc.js";
|
|
38
39
|
export type { SessionFsProvider } from "./sessionFsProvider.js";
|
|
39
40
|
export { createSessionFsAdapter } from "./sessionFsProvider.js";
|
|
40
41
|
export type { SessionFsFileInfo } from "./sessionFsProvider.js";
|
|
@@ -45,7 +46,8 @@ export type { SessionFsSqliteStatement } from "./sessionFsProvider.js";
|
|
|
45
46
|
export type { SessionFsSqliteTransactionErrorClass } from "./sessionFsProvider.js";
|
|
46
47
|
export { SessionFsSqliteTransactionFailure } from "./sessionFsProvider.js";
|
|
47
48
|
export type { LlmInferenceHeaders } from "./generated/rpc.js";
|
|
48
|
-
export type { PermissionDecisionContext, PermissionDecisionOutcome,
|
|
49
|
+
export type { PermissionDecisionContext, PermissionDecisionOutcome, PermissionDecisionSurface, PermissionResponseCapability, } from "./generated/rpc.js";
|
|
50
|
+
export type { PermissionDecisionSource } from "./generated/session-events.js";
|
|
49
51
|
export type { CopilotRequestContext } from "./copilotRequestHandler.js";
|
|
50
52
|
export { CopilotRequestHandler, CopilotWebSocketHandler, CopilotWebSocketCloseStatus, CopilotWebSocketForwarder, } from "./copilotRequestHandler.js";
|
|
51
53
|
/**
|
|
@@ -216,6 +218,33 @@ export declare const RuntimeConnection: {
|
|
|
216
218
|
* ambient behavior is unsafe (e.g. multi-user servers).
|
|
217
219
|
*/
|
|
218
220
|
export type CopilotClientMode = "empty" | "copilot-cli";
|
|
221
|
+
/**
|
|
222
|
+
* Identity of the integrating application, declared once on the `server.connect`
|
|
223
|
+
* handshake so the telemetry the runtime emits on this connection is attributed
|
|
224
|
+
* to a single, consistent surface rather than to the runtime's own build.
|
|
225
|
+
*
|
|
226
|
+
* All fields are optional; omit any of them (or the whole object) to keep the
|
|
227
|
+
* runtime's default attribution. Version fields are ignored by the runtime
|
|
228
|
+
* unless they look like a version string.
|
|
229
|
+
*/
|
|
230
|
+
export interface CopilotClientInfo {
|
|
231
|
+
/**
|
|
232
|
+
* Name of the application using the SDK, e.g. `"acme-developer-portal"`.
|
|
233
|
+
*/
|
|
234
|
+
applicationName?: string;
|
|
235
|
+
/**
|
|
236
|
+
* Version of the application using the SDK, e.g. `"2.4.0"`.
|
|
237
|
+
*/
|
|
238
|
+
applicationVersion?: string;
|
|
239
|
+
/**
|
|
240
|
+
* Optional name of a specific integration within the application, such as an extension or plugin.
|
|
241
|
+
*/
|
|
242
|
+
integrationName?: string;
|
|
243
|
+
/**
|
|
244
|
+
* Optional version of the integration identified by `integrationName`.
|
|
245
|
+
*/
|
|
246
|
+
integrationVersion?: string;
|
|
247
|
+
}
|
|
219
248
|
export interface CopilotClientOptions {
|
|
220
249
|
/**
|
|
221
250
|
* How to connect to the Copilot runtime. When omitted, defaults to
|
|
@@ -370,6 +399,15 @@ export interface CopilotClientOptions {
|
|
|
370
399
|
* @default false
|
|
371
400
|
*/
|
|
372
401
|
enableRemoteSessions?: boolean;
|
|
402
|
+
/**
|
|
403
|
+
* Identity of the integrating application, forwarded to the runtime on the
|
|
404
|
+
* `server.connect` handshake. Declaring it lets the telemetry the runtime
|
|
405
|
+
* emits on this connection be attributed to a single, consistent surface
|
|
406
|
+
* (e.g. the application and its Copilot integration) instead of the
|
|
407
|
+
* runtime's own build. All fields are optional; omit it to keep the default
|
|
408
|
+
* attribution.
|
|
409
|
+
*/
|
|
410
|
+
clientInfo?: CopilotClientInfo;
|
|
373
411
|
}
|
|
374
412
|
/**
|
|
375
413
|
* Configuration for creating a session
|
|
@@ -460,6 +498,8 @@ export interface ToolInvocation {
|
|
|
460
498
|
traceparent?: string;
|
|
461
499
|
/** W3C Trace Context tracestate from the CLI's execute_tool span. */
|
|
462
500
|
tracestate?: string;
|
|
501
|
+
/** Aborted when the runtime completes this request or the session disconnects. */
|
|
502
|
+
signal?: AbortSignal;
|
|
463
503
|
}
|
|
464
504
|
export type ToolHandler<TArgs = unknown> = (args: TArgs, invocation: ToolInvocation) => Promise<unknown> | unknown;
|
|
465
505
|
/**
|
|
@@ -1705,6 +1745,20 @@ export interface FactoryMeta {
|
|
|
1705
1745
|
* provider-level choices are conceptually per-provider rather than global.
|
|
1706
1746
|
*/
|
|
1707
1747
|
export interface CapiSessionOptions {
|
|
1748
|
+
/**
|
|
1749
|
+
* Routing preference used when the session model is `auto`.
|
|
1750
|
+
* Requires a runtime with Auto tier support and V2 Auto routing.
|
|
1751
|
+
*
|
|
1752
|
+
* When omitted on create, the runtime uses its default routing behavior.
|
|
1753
|
+
* The runtime persists this preference across cold resume; when omitted on
|
|
1754
|
+
* cold resume, it restores the last committed preference. On resident
|
|
1755
|
+
* resume, a different tier requests a safe switch that takes effect after
|
|
1756
|
+
* resume succeeds, and never disturbs a turn that is already running.
|
|
1757
|
+
*
|
|
1758
|
+
* To change the preference on a live session, call
|
|
1759
|
+
* {@link CopilotSession.setAutoTier} instead.
|
|
1760
|
+
*/
|
|
1761
|
+
autoTier?: AutoTier;
|
|
1708
1762
|
/**
|
|
1709
1763
|
* Whether to use the WebSocket transport for the CAPI Responses API.
|
|
1710
1764
|
*
|
|
@@ -2191,6 +2245,11 @@ export interface SessionConfigBase {
|
|
|
2191
2245
|
* @default "in-memory"
|
|
2192
2246
|
*/
|
|
2193
2247
|
mcpOAuthTokenStorage?: "persistent" | "in-memory";
|
|
2248
|
+
/**
|
|
2249
|
+
* OAuth Client ID Metadata Document URL identifying the host for MCP authorization.
|
|
2250
|
+
* When unset, no host identity is supplied.
|
|
2251
|
+
*/
|
|
2252
|
+
authClientIdMetadataUrl?: string;
|
|
2194
2253
|
/**
|
|
2195
2254
|
* MCP server configurations for the session.
|
|
2196
2255
|
* Keys are server names, values are server configurations.
|
|
@@ -2375,6 +2434,11 @@ export interface SessionConfigBase {
|
|
|
2375
2434
|
* only if {@link CopilotClientOptions.sessionFs} is configured.
|
|
2376
2435
|
*/
|
|
2377
2436
|
createSessionFsProvider?: (session: CopilotSession) => SessionFsProvider;
|
|
2437
|
+
/**
|
|
2438
|
+
* Feature-flag values resolved by the host for this session.
|
|
2439
|
+
* Re-supply them when resuming after a runtime restart.
|
|
2440
|
+
*/
|
|
2441
|
+
featureFlags?: Record<string, boolean>;
|
|
2378
2442
|
}
|
|
2379
2443
|
/**
|
|
2380
2444
|
* Configuration for creating a new session via {@link CopilotClient.createSession}.
|
|
@@ -2672,11 +2736,21 @@ export interface ProviderModelConfig {
|
|
|
2672
2736
|
*/
|
|
2673
2737
|
capabilities?: ModelCapabilitiesOverride;
|
|
2674
2738
|
}
|
|
2739
|
+
/**
|
|
2740
|
+
* Message provenance, independent of delivery mode.
|
|
2741
|
+
*/
|
|
2742
|
+
export type MessageSource = "user" | "system" | `agent-${string}`;
|
|
2675
2743
|
export interface MessageOptions {
|
|
2676
2744
|
/**
|
|
2677
2745
|
* The prompt/message to send
|
|
2678
2746
|
*/
|
|
2679
2747
|
prompt: string;
|
|
2748
|
+
/**
|
|
2749
|
+
* Optional message provenance. Omitted by default to preserve the runtime's
|
|
2750
|
+
* default for user messages. Use "system" for application-generated context
|
|
2751
|
+
* or `agent-${id}` for messages originating from an identified agent.
|
|
2752
|
+
*/
|
|
2753
|
+
source?: MessageSource;
|
|
2680
2754
|
/**
|
|
2681
2755
|
* File, directory, selection, or blob attachments
|
|
2682
2756
|
*/
|
|
@@ -2851,6 +2925,7 @@ export interface ModelCapabilities {
|
|
|
2851
2925
|
};
|
|
2852
2926
|
limits: {
|
|
2853
2927
|
max_prompt_tokens?: number;
|
|
2928
|
+
max_output_tokens?: number;
|
|
2854
2929
|
max_context_window_tokens: number;
|
|
2855
2930
|
vision?: {
|
|
2856
2931
|
supported_media_types: string[];
|
package/package.json
CHANGED
|
Binary file
|