@github/copilot-sdk 1.0.0-beta.6 → 1.0.0-beta.8
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 +3 -7
- package/dist/canvas.d.ts +103 -0
- package/dist/canvas.js +49 -0
- package/dist/cjs/canvas.js +75 -0
- package/dist/cjs/client.js +16 -126
- package/dist/cjs/extension.js +7 -0
- package/dist/cjs/generated/rpc.js +109 -2
- package/dist/cjs/index.js +9 -2
- package/dist/cjs/session.js +84 -32
- package/dist/cjs/types.js +6 -3
- package/dist/client.d.ts +1 -26
- package/dist/client.js +17 -127
- package/dist/extension.d.ts +3 -1
- package/dist/extension.js +8 -0
- package/dist/generated/rpc.d.ts +1282 -248
- package/dist/generated/rpc.js +109 -2
- package/dist/generated/session-events.d.ts +485 -88
- package/dist/index.d.ts +3 -2
- package/dist/index.js +10 -2
- package/dist/session.d.ts +10 -0
- package/dist/session.js +84 -31
- package/dist/types.d.ts +52 -9
- package/dist/types.js +5 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
export { CopilotClient } from "./client.js";
|
|
7
7
|
export { RuntimeConnection } from "./types.js";
|
|
8
8
|
export { CopilotSession, type AssistantMessageEvent } from "./session.js";
|
|
9
|
-
export {
|
|
9
|
+
export { Canvas, CanvasError, createCanvas, type CanvasAction, type CanvasDeclaration, type CanvasHostContext, type CanvasJsonSchema, type CanvasOptions, } from "./canvas.js";
|
|
10
|
+
export { defineTool, approveAll, convertMcpCallToolResult, createSessionFsAdapter, SYSTEM_MESSAGE_SECTIONS, } from "./types.js";
|
|
10
11
|
export type * from "./generated/session-events.js";
|
|
11
|
-
export type { CommandContext, CommandDefinition, CommandHandler, CloudSessionOptions, CloudSessionRepository, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse,
|
|
12
|
+
export type { CommandContext, CommandDefinition, CommandHandler, CloudSessionOptions, CloudSessionRepository, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, CopilotClientOptions, StdioRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, InfiniteSessionConfig, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, MessageOptions, ModelBilling, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, RemoteSessionMode, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolTelemetry, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import { CopilotClient } from "./client.js";
|
|
2
2
|
import { RuntimeConnection } from "./types.js";
|
|
3
3
|
import { CopilotSession } from "./session.js";
|
|
4
|
+
import {
|
|
5
|
+
Canvas,
|
|
6
|
+
CanvasError,
|
|
7
|
+
createCanvas
|
|
8
|
+
} from "./canvas.js";
|
|
4
9
|
import {
|
|
5
10
|
defineTool,
|
|
6
11
|
approveAll,
|
|
7
12
|
convertMcpCallToolResult,
|
|
8
13
|
createSessionFsAdapter,
|
|
9
|
-
|
|
14
|
+
SYSTEM_MESSAGE_SECTIONS
|
|
10
15
|
} from "./types.js";
|
|
11
16
|
export {
|
|
17
|
+
Canvas,
|
|
18
|
+
CanvasError,
|
|
12
19
|
CopilotClient,
|
|
13
20
|
CopilotSession,
|
|
14
21
|
RuntimeConnection,
|
|
15
|
-
|
|
22
|
+
SYSTEM_MESSAGE_SECTIONS,
|
|
16
23
|
approveAll,
|
|
17
24
|
convertMcpCallToolResult,
|
|
25
|
+
createCanvas,
|
|
18
26
|
createSessionFsAdapter,
|
|
19
27
|
defineTool
|
|
20
28
|
};
|
package/dist/session.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createSessionRpc } from "./generated/rpc.js";
|
|
2
|
+
import type { OpenCanvasInstance } from "./generated/rpc.js";
|
|
2
3
|
import type { MessageOptions, ReasoningEffort, ModelCapabilitiesOverride, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionUiApi, TypedSessionEventHandler } from "./types.js";
|
|
3
4
|
/** Assistant message event - the final response from the assistant. */
|
|
4
5
|
export type AssistantMessageEvent = Extract<SessionEvent, {
|
|
@@ -36,6 +37,7 @@ export declare class CopilotSession {
|
|
|
36
37
|
private eventHandlers;
|
|
37
38
|
private typedEventHandlers;
|
|
38
39
|
private toolHandlers;
|
|
40
|
+
private canvases;
|
|
39
41
|
private commandHandlers;
|
|
40
42
|
private permissionHandler?;
|
|
41
43
|
private userInputHandler?;
|
|
@@ -47,6 +49,7 @@ export declare class CopilotSession {
|
|
|
47
49
|
private _rpc;
|
|
48
50
|
private traceContextProvider?;
|
|
49
51
|
private _capabilities;
|
|
52
|
+
private openCanvasInstances;
|
|
50
53
|
/**
|
|
51
54
|
* Typed session-scoped RPC methods.
|
|
52
55
|
*/
|
|
@@ -166,6 +169,13 @@ export declare class CopilotSession {
|
|
|
166
169
|
* ```
|
|
167
170
|
*/
|
|
168
171
|
on(handler: SessionEventHandler): () => void;
|
|
172
|
+
/**
|
|
173
|
+
* Snapshot of canvas instances that were already open when the session was
|
|
174
|
+
* resumed. Populated from the `session.resume` response; empty for freshly
|
|
175
|
+
* created sessions. Returns a defensive copy — mutating the returned array
|
|
176
|
+
* has no effect on the session.
|
|
177
|
+
*/
|
|
178
|
+
get openCanvases(): OpenCanvasInstance[];
|
|
169
179
|
private assertElicitation;
|
|
170
180
|
private _elicitation;
|
|
171
181
|
private _confirm;
|
package/dist/session.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ConnectionError, ResponseError } from "vscode-jsonrpc/node.js";
|
|
1
|
+
import { ConnectionError, ErrorCodes, ResponseError } from "vscode-jsonrpc/node.js";
|
|
2
2
|
import { createSessionRpc } from "./generated/rpc.js";
|
|
3
|
+
import { CanvasError } from "./canvas.js";
|
|
3
4
|
import { getTraceContext } from "./telemetry.js";
|
|
4
|
-
const NO_RESULT_PERMISSION_V2_ERROR = "Permission handlers cannot return 'no-result' when connected to a protocol v2 server.";
|
|
5
5
|
function deserializeHookInput(raw) {
|
|
6
6
|
if (!raw || typeof raw !== "object" || typeof raw.timestamp !== "number") {
|
|
7
7
|
return raw;
|
|
@@ -29,6 +29,7 @@ class CopilotSession {
|
|
|
29
29
|
eventHandlers = /* @__PURE__ */ new Set();
|
|
30
30
|
typedEventHandlers = /* @__PURE__ */ new Map();
|
|
31
31
|
toolHandlers = /* @__PURE__ */ new Map();
|
|
32
|
+
canvases = /* @__PURE__ */ new Map();
|
|
32
33
|
commandHandlers = /* @__PURE__ */ new Map();
|
|
33
34
|
permissionHandler;
|
|
34
35
|
userInputHandler;
|
|
@@ -40,6 +41,7 @@ class CopilotSession {
|
|
|
40
41
|
_rpc = null;
|
|
41
42
|
traceContextProvider;
|
|
42
43
|
_capabilities = {};
|
|
44
|
+
openCanvasInstances = [];
|
|
43
45
|
/** @internal Client session API handlers, populated by CopilotClient during create/resume. */
|
|
44
46
|
clientSessionApis = {};
|
|
45
47
|
/**
|
|
@@ -369,6 +371,61 @@ class CopilotSession {
|
|
|
369
371
|
getToolHandler(name) {
|
|
370
372
|
return this.toolHandlers.get(name);
|
|
371
373
|
}
|
|
374
|
+
/**
|
|
375
|
+
* Registers canvas declarations and handlers for this session.
|
|
376
|
+
*
|
|
377
|
+
* @param canvases - Canvases created via `createCanvas`, or undefined to clear all canvases
|
|
378
|
+
* @internal Called by the SDK when creating/resuming a session with `canvases`.
|
|
379
|
+
*/
|
|
380
|
+
registerCanvases(canvases) {
|
|
381
|
+
this.canvases.clear();
|
|
382
|
+
if (!canvases || canvases.length === 0) {
|
|
383
|
+
delete this.clientSessionApis.canvas;
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
for (const canvas of canvases) {
|
|
387
|
+
this.canvases.set(canvas.declaration.id, canvas);
|
|
388
|
+
}
|
|
389
|
+
const self = this;
|
|
390
|
+
this.clientSessionApis.canvas = {
|
|
391
|
+
async open(params) {
|
|
392
|
+
const canvas = self.canvases.get(params.canvasId);
|
|
393
|
+
if (!canvas) throw new Error(`No canvas registered with id "${params.canvasId}"`);
|
|
394
|
+
try {
|
|
395
|
+
return await canvas.open(params) ?? {};
|
|
396
|
+
} catch (error) {
|
|
397
|
+
throw toCanvasRpcError(error);
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
async close(params) {
|
|
401
|
+
const canvas = self.canvases.get(params.canvasId);
|
|
402
|
+
if (!canvas) throw new Error(`No canvas registered with id "${params.canvasId}"`);
|
|
403
|
+
try {
|
|
404
|
+
if (canvas.onClose) {
|
|
405
|
+
await canvas.onClose(params);
|
|
406
|
+
}
|
|
407
|
+
} catch (error) {
|
|
408
|
+
throw toCanvasRpcError(error);
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
async invokeAction(params) {
|
|
412
|
+
const canvas = self.canvases.get(params.canvasId);
|
|
413
|
+
if (!canvas) throw new Error(`No canvas registered with id "${params.canvasId}"`);
|
|
414
|
+
const handler = canvas.actionHandlers.get(params.actionName);
|
|
415
|
+
if (!handler) {
|
|
416
|
+
throw new CanvasError(
|
|
417
|
+
"canvas_action_no_handler",
|
|
418
|
+
"No handler implemented for this canvas action"
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
try {
|
|
422
|
+
return await handler(params);
|
|
423
|
+
} catch (error) {
|
|
424
|
+
throw toCanvasRpcError(error);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
}
|
|
372
429
|
/**
|
|
373
430
|
* Registers command handlers for this session.
|
|
374
431
|
*
|
|
@@ -465,6 +522,24 @@ class CopilotSession {
|
|
|
465
522
|
setCapabilities(capabilities) {
|
|
466
523
|
this._capabilities = capabilities ?? {};
|
|
467
524
|
}
|
|
525
|
+
/**
|
|
526
|
+
* Snapshot of canvas instances that were already open when the session was
|
|
527
|
+
* resumed. Populated from the `session.resume` response; empty for freshly
|
|
528
|
+
* created sessions. Returns a defensive copy — mutating the returned array
|
|
529
|
+
* has no effect on the session.
|
|
530
|
+
*/
|
|
531
|
+
get openCanvases() {
|
|
532
|
+
return [...this.openCanvasInstances];
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Sets the open-canvas snapshot for this session.
|
|
536
|
+
*
|
|
537
|
+
* @param instances - The `openCanvases` array from the `session.resume` response.
|
|
538
|
+
* @internal This method is typically called internally when resuming a session.
|
|
539
|
+
*/
|
|
540
|
+
setOpenCanvases(instances) {
|
|
541
|
+
this.openCanvasInstances = [...instances];
|
|
542
|
+
}
|
|
468
543
|
assertElicitation() {
|
|
469
544
|
if (!this._capabilities.ui?.elicitation) {
|
|
470
545
|
throw new Error(
|
|
@@ -604,33 +679,6 @@ class CopilotSession {
|
|
|
604
679
|
}
|
|
605
680
|
return { sections: result };
|
|
606
681
|
}
|
|
607
|
-
/**
|
|
608
|
-
* Handles a permission request in the v2 protocol format (synchronous RPC).
|
|
609
|
-
* Used as a back-compat adapter when connected to a v2 server.
|
|
610
|
-
*
|
|
611
|
-
* @param request - The permission request data from the CLI
|
|
612
|
-
* @returns A promise that resolves with the permission decision
|
|
613
|
-
* @internal This method is for internal use by the SDK.
|
|
614
|
-
*/
|
|
615
|
-
async _handlePermissionRequestV2(request) {
|
|
616
|
-
if (!this.permissionHandler) {
|
|
617
|
-
return { kind: "user-not-available" };
|
|
618
|
-
}
|
|
619
|
-
try {
|
|
620
|
-
const result = await this.permissionHandler(request, {
|
|
621
|
-
sessionId: this.sessionId
|
|
622
|
-
});
|
|
623
|
-
if (result.kind === "no-result") {
|
|
624
|
-
throw new Error(NO_RESULT_PERMISSION_V2_ERROR);
|
|
625
|
-
}
|
|
626
|
-
return result;
|
|
627
|
-
} catch (error) {
|
|
628
|
-
if (error instanceof Error && error.message === NO_RESULT_PERMISSION_V2_ERROR) {
|
|
629
|
-
throw error;
|
|
630
|
-
}
|
|
631
|
-
return { kind: "user-not-available" };
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
682
|
/**
|
|
635
683
|
* Handles a user input request from the Copilot CLI.
|
|
636
684
|
*
|
|
@@ -827,7 +875,12 @@ function isToolResultObject(value) {
|
|
|
827
875
|
];
|
|
828
876
|
return allowedResultTypes.includes(value.resultType);
|
|
829
877
|
}
|
|
878
|
+
function toCanvasRpcError(error) {
|
|
879
|
+
if (error instanceof ResponseError) return error;
|
|
880
|
+
const code = error instanceof CanvasError ? error.code : "canvas_handler_error";
|
|
881
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
882
|
+
return new ResponseError(ErrorCodes.InternalError, message, { code, message });
|
|
883
|
+
}
|
|
830
884
|
export {
|
|
831
|
-
CopilotSession
|
|
832
|
-
NO_RESULT_PERMISSION_V2_ERROR
|
|
885
|
+
CopilotSession
|
|
833
886
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type definitions for the Copilot SDK
|
|
3
3
|
*/
|
|
4
|
+
import type { Canvas } from "./canvas.js";
|
|
4
5
|
import type { SessionFsProvider } from "./sessionFsProvider.js";
|
|
5
6
|
import type { SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js";
|
|
6
7
|
import type { CopilotSession } from "./session.js";
|
|
7
8
|
import type { RemoteSessionMode } from "./generated/rpc.js";
|
|
9
|
+
import type { OpenCanvasInstance } from "./generated/rpc.js";
|
|
8
10
|
export type { RemoteSessionMode } from "./generated/rpc.js";
|
|
9
11
|
export type SessionEvent = GeneratedSessionEvent;
|
|
10
12
|
export type { SessionFsProvider } from "./sessionFsProvider.js";
|
|
@@ -389,6 +391,8 @@ export interface SessionCapabilities {
|
|
|
389
391
|
ui?: {
|
|
390
392
|
/** Whether the host supports interactive elicitation dialogs. */
|
|
391
393
|
elicitation?: boolean;
|
|
394
|
+
/** Whether the host supports canvas rendering. */
|
|
395
|
+
canvases?: boolean;
|
|
392
396
|
};
|
|
393
397
|
}
|
|
394
398
|
/**
|
|
@@ -566,12 +570,12 @@ export interface ToolCallResponsePayload {
|
|
|
566
570
|
result: ToolResult;
|
|
567
571
|
}
|
|
568
572
|
/**
|
|
569
|
-
* Known system
|
|
573
|
+
* Known system message section identifiers for the "customize" mode.
|
|
570
574
|
* Each section corresponds to a distinct part of the system prompt.
|
|
571
575
|
*/
|
|
572
|
-
export type
|
|
576
|
+
export type SystemMessageSection = "identity" | "tone" | "tool_efficiency" | "environment_context" | "code_change_rules" | "guidelines" | "safety" | "tool_instructions" | "custom_instructions" | "runtime_instructions" | "last_instructions";
|
|
573
577
|
/** Section metadata for documentation and tooling. */
|
|
574
|
-
export declare const
|
|
578
|
+
export declare const SYSTEM_MESSAGE_SECTIONS: Record<SystemMessageSection, {
|
|
575
579
|
description: string;
|
|
576
580
|
}>;
|
|
577
581
|
/**
|
|
@@ -589,7 +593,7 @@ export type SectionTransformFn = (currentContent: string) => string | Promise<st
|
|
|
589
593
|
*/
|
|
590
594
|
export type SectionOverrideAction = "replace" | "remove" | "append" | "prepend" | SectionTransformFn;
|
|
591
595
|
/**
|
|
592
|
-
* Override operation for a single system
|
|
596
|
+
* Override operation for a single system message section.
|
|
593
597
|
*/
|
|
594
598
|
export interface SectionOverride {
|
|
595
599
|
/**
|
|
@@ -638,7 +642,7 @@ export interface SystemMessageCustomizeConfig {
|
|
|
638
642
|
* Unknown section IDs gracefully fall back: content-bearing overrides are appended
|
|
639
643
|
* to additional instructions, and "remove" on unknown sections is a silent no-op.
|
|
640
644
|
*/
|
|
641
|
-
sections?: Partial<Record<
|
|
645
|
+
sections?: Partial<Record<SystemMessageSection, SectionOverride>>;
|
|
642
646
|
/**
|
|
643
647
|
* Additional content appended after all sections.
|
|
644
648
|
* Equivalent to append mode's content field — provided for convenience.
|
|
@@ -1108,6 +1112,15 @@ export interface InfiniteSessionConfig {
|
|
|
1108
1112
|
* Valid reasoning effort levels for models that support it.
|
|
1109
1113
|
*/
|
|
1110
1114
|
export type ReasoningEffort = "low" | "medium" | "high" | "xhigh";
|
|
1115
|
+
/**
|
|
1116
|
+
* Stable extension identity for session participants that provide canvases.
|
|
1117
|
+
*/
|
|
1118
|
+
export interface ExtensionInfo {
|
|
1119
|
+
/** Extension namespace/source, e.g. "github-app". */
|
|
1120
|
+
source: string;
|
|
1121
|
+
/** Stable provider name within the source namespace. */
|
|
1122
|
+
name: string;
|
|
1123
|
+
}
|
|
1111
1124
|
/**
|
|
1112
1125
|
* Shared configuration fields used by both {@link SessionConfig} (for
|
|
1113
1126
|
* creating a new session) and {@link ResumeSessionConfig} (for resuming
|
|
@@ -1153,6 +1166,34 @@ export interface SessionConfigBase {
|
|
|
1153
1166
|
* and must be resolved by the consumer via pending external tool request RPCs.
|
|
1154
1167
|
*/
|
|
1155
1168
|
tools?: Tool<any>[];
|
|
1169
|
+
/**
|
|
1170
|
+
* Canvases contributed by this session participant. The declaring
|
|
1171
|
+
* connection becomes the live provider for `canvas.open|focus|close|reload`
|
|
1172
|
+
* and `canvas.action.invoke` dispatches targeting each canvas's `id` for
|
|
1173
|
+
* the lifetime of the connection. Re-declaring the same id on resume
|
|
1174
|
+
* replaces the prior declaration.
|
|
1175
|
+
*/
|
|
1176
|
+
canvases?: Canvas[];
|
|
1177
|
+
/**
|
|
1178
|
+
* Renderer-side opt-in: when true, the runtime surfaces canvas agent tools
|
|
1179
|
+
* (`list_canvas_capabilities`, `open_canvas`, `invoke_canvas_action`) to
|
|
1180
|
+
* the model for this connection. Default off so SDK callers that cannot
|
|
1181
|
+
* display canvases stay clean.
|
|
1182
|
+
*/
|
|
1183
|
+
requestCanvasRenderer?: boolean;
|
|
1184
|
+
/**
|
|
1185
|
+
* Extension surface opt-in: when true, the runtime wires extension
|
|
1186
|
+
* management tools and per-extension tool dispatch onto the session for
|
|
1187
|
+
* this connection. Default off so callers that do not expose extensions
|
|
1188
|
+
* stay clean.
|
|
1189
|
+
*/
|
|
1190
|
+
requestExtensions?: boolean;
|
|
1191
|
+
/**
|
|
1192
|
+
* Stable extension identity for canvas providers on this connection. When
|
|
1193
|
+
* set, the runtime uses `${source}:${name}` as the agent-facing extension
|
|
1194
|
+
* id instead of a reconnect-specific connection id.
|
|
1195
|
+
*/
|
|
1196
|
+
extensionInfo?: ExtensionInfo;
|
|
1156
1197
|
/**
|
|
1157
1198
|
* Slash commands registered for this session.
|
|
1158
1199
|
* When the CLI has a TUI, each command appears as `/name` for the user to invoke.
|
|
@@ -1354,6 +1395,12 @@ export interface ResumeSessionConfig extends SessionConfigBase {
|
|
|
1354
1395
|
* @default false
|
|
1355
1396
|
*/
|
|
1356
1397
|
continuePendingWork?: boolean;
|
|
1398
|
+
/**
|
|
1399
|
+
* Snapshot of canvases that were already open when the session was suspended.
|
|
1400
|
+
* When provided on resume, the runtime can rehydrate canvas state so consumers
|
|
1401
|
+
* do not need to re-open canvases that were active before the previous shutdown.
|
|
1402
|
+
*/
|
|
1403
|
+
openCanvases?: OpenCanvasInstance[];
|
|
1357
1404
|
}
|
|
1358
1405
|
/**
|
|
1359
1406
|
* Configuration for a custom API provider.
|
|
@@ -1490,10 +1537,6 @@ export type TypedSessionEventHandler<T extends SessionEventType> = (event: Sessi
|
|
|
1490
1537
|
* Event handler callback type (for all events)
|
|
1491
1538
|
*/
|
|
1492
1539
|
export type SessionEventHandler = (event: SessionEvent) => void;
|
|
1493
|
-
/**
|
|
1494
|
-
* Connection state
|
|
1495
|
-
*/
|
|
1496
|
-
export type ConnectionState = "disconnected" | "connecting" | "connected" | "error";
|
|
1497
1540
|
/**
|
|
1498
1541
|
* Working directory context for a session
|
|
1499
1542
|
*/
|
package/dist/types.js
CHANGED
|
@@ -72,7 +72,7 @@ function convertMcpCallToolResult(callResult) {
|
|
|
72
72
|
function defineTool(name, config) {
|
|
73
73
|
return { name, ...config };
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const SYSTEM_MESSAGE_SECTIONS = {
|
|
76
76
|
identity: { description: "Agent identity preamble and mode statement" },
|
|
77
77
|
tone: { description: "Response style, conciseness rules, output formatting preferences" },
|
|
78
78
|
tool_efficiency: { description: "Tool usage patterns, parallel calling, batching guidelines" },
|
|
@@ -82,6 +82,9 @@ const SYSTEM_PROMPT_SECTIONS = {
|
|
|
82
82
|
safety: { description: "Environment limitations, prohibited actions, security policies" },
|
|
83
83
|
tool_instructions: { description: "Per-tool usage instructions" },
|
|
84
84
|
custom_instructions: { description: "Repository and organization custom instructions" },
|
|
85
|
+
runtime_instructions: {
|
|
86
|
+
description: "Runtime-provided context and instructions (e.g. system notifications, memories, workspace context, mode-specific instructions, content-exclusion policy)"
|
|
87
|
+
},
|
|
85
88
|
last_instructions: {
|
|
86
89
|
description: "End-of-prompt instructions: parallel tool calling, persistence, task completion"
|
|
87
90
|
}
|
|
@@ -92,7 +95,7 @@ const defaultJoinSessionPermissionHandler = () => ({
|
|
|
92
95
|
});
|
|
93
96
|
export {
|
|
94
97
|
RuntimeConnection,
|
|
95
|
-
|
|
98
|
+
SYSTEM_MESSAGE_SECTIONS,
|
|
96
99
|
approveAll,
|
|
97
100
|
convertMcpCallToolResult,
|
|
98
101
|
createSessionFsAdapter,
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"type": "git",
|
|
5
5
|
"url": "https://github.com/github/copilot-sdk.git"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.0.0-beta.
|
|
7
|
+
"version": "1.0.0-beta.8",
|
|
8
8
|
"description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC",
|
|
9
9
|
"main": "./dist/cjs/index.js",
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"author": "GitHub",
|
|
57
57
|
"license": "MIT",
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@github/copilot": "^1.0.
|
|
59
|
+
"@github/copilot": "^1.0.55-1",
|
|
60
60
|
"vscode-jsonrpc": "^8.2.1",
|
|
61
61
|
"zod": "^4.3.6"
|
|
62
62
|
},
|