@github/copilot-sdk 0.1.33-preview.3 → 0.1.33-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 +39 -1
- package/dist/cjs/client.js +52 -2
- package/dist/cjs/generated/rpc.js +33 -1
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/session.js +35 -0
- package/dist/cjs/types.js +16 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +52 -2
- package/dist/generated/rpc.d.ts +431 -0
- package/dist/generated/rpc.js +33 -1
- package/dist/generated/session-events.d.ts +393 -14
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -1
- package/dist/session.d.ts +24 -1
- package/dist/session.js +35 -0
- package/dist/types.d.ts +60 -1
- package/dist/types.js +15 -0
- package/package.json +2 -2
package/dist/types.d.ts
CHANGED
|
@@ -227,6 +227,46 @@ export interface ToolCallRequestPayload {
|
|
|
227
227
|
export interface ToolCallResponsePayload {
|
|
228
228
|
result: ToolResult;
|
|
229
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* Known system prompt section identifiers for the "customize" mode.
|
|
232
|
+
* Each section corresponds to a distinct part of the system prompt.
|
|
233
|
+
*/
|
|
234
|
+
export type SystemPromptSection = "identity" | "tone" | "tool_efficiency" | "environment_context" | "code_change_rules" | "guidelines" | "safety" | "tool_instructions" | "custom_instructions" | "last_instructions";
|
|
235
|
+
/** Section metadata for documentation and tooling. */
|
|
236
|
+
export declare const SYSTEM_PROMPT_SECTIONS: Record<SystemPromptSection, {
|
|
237
|
+
description: string;
|
|
238
|
+
}>;
|
|
239
|
+
/**
|
|
240
|
+
* Transform callback for a single section: receives current content, returns new content.
|
|
241
|
+
*/
|
|
242
|
+
export type SectionTransformFn = (currentContent: string) => string | Promise<string>;
|
|
243
|
+
/**
|
|
244
|
+
* Override action: a string literal for static overrides, or a callback for transforms.
|
|
245
|
+
*
|
|
246
|
+
* - `"replace"`: Replace section content entirely
|
|
247
|
+
* - `"remove"`: Remove the section
|
|
248
|
+
* - `"append"`: Append to existing section content
|
|
249
|
+
* - `"prepend"`: Prepend to existing section content
|
|
250
|
+
* - `function`: Transform callback — receives current section content, returns new content
|
|
251
|
+
*/
|
|
252
|
+
export type SectionOverrideAction = "replace" | "remove" | "append" | "prepend" | SectionTransformFn;
|
|
253
|
+
/**
|
|
254
|
+
* Override operation for a single system prompt section.
|
|
255
|
+
*/
|
|
256
|
+
export interface SectionOverride {
|
|
257
|
+
/**
|
|
258
|
+
* The operation to perform on this section.
|
|
259
|
+
* Can be a string action or a transform callback function.
|
|
260
|
+
*/
|
|
261
|
+
action: SectionOverrideAction;
|
|
262
|
+
/**
|
|
263
|
+
* Content for the override. Optional for all actions.
|
|
264
|
+
* - For replace, omitting content replaces with an empty string.
|
|
265
|
+
* - For append/prepend, content is added before/after the existing section.
|
|
266
|
+
* - Ignored for the remove action.
|
|
267
|
+
*/
|
|
268
|
+
content?: string;
|
|
269
|
+
}
|
|
230
270
|
/**
|
|
231
271
|
* Append mode: Use CLI foundation with optional appended content (default).
|
|
232
272
|
*/
|
|
@@ -249,12 +289,31 @@ export interface SystemMessageReplaceConfig {
|
|
|
249
289
|
*/
|
|
250
290
|
content: string;
|
|
251
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* Customize mode: Override individual sections of the system prompt.
|
|
294
|
+
* Keeps the SDK-managed prompt structure while allowing targeted modifications.
|
|
295
|
+
*/
|
|
296
|
+
export interface SystemMessageCustomizeConfig {
|
|
297
|
+
mode: "customize";
|
|
298
|
+
/**
|
|
299
|
+
* Override specific sections of the system prompt by section ID.
|
|
300
|
+
* Unknown section IDs gracefully fall back: content-bearing overrides are appended
|
|
301
|
+
* to additional instructions, and "remove" on unknown sections is a silent no-op.
|
|
302
|
+
*/
|
|
303
|
+
sections?: Partial<Record<SystemPromptSection, SectionOverride>>;
|
|
304
|
+
/**
|
|
305
|
+
* Additional content appended after all sections.
|
|
306
|
+
* Equivalent to append mode's content field — provided for convenience.
|
|
307
|
+
*/
|
|
308
|
+
content?: string;
|
|
309
|
+
}
|
|
252
310
|
/**
|
|
253
311
|
* System message configuration for session creation.
|
|
254
312
|
* - Append mode (default): SDK foundation + optional custom content
|
|
255
313
|
* - Replace mode: Full control, caller provides entire system message
|
|
314
|
+
* - Customize mode: Section-level overrides with graceful fallback
|
|
256
315
|
*/
|
|
257
|
-
export type SystemMessageConfig = SystemMessageAppendConfig | SystemMessageReplaceConfig;
|
|
316
|
+
export type SystemMessageConfig = SystemMessageAppendConfig | SystemMessageReplaceConfig | SystemMessageCustomizeConfig;
|
|
258
317
|
/**
|
|
259
318
|
* Permission request types from the server
|
|
260
319
|
*/
|
package/dist/types.js
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
function defineTool(name, config) {
|
|
2
2
|
return { name, ...config };
|
|
3
3
|
}
|
|
4
|
+
const SYSTEM_PROMPT_SECTIONS = {
|
|
5
|
+
identity: { description: "Agent identity preamble and mode statement" },
|
|
6
|
+
tone: { description: "Response style, conciseness rules, output formatting preferences" },
|
|
7
|
+
tool_efficiency: { description: "Tool usage patterns, parallel calling, batching guidelines" },
|
|
8
|
+
environment_context: { description: "CWD, OS, git root, directory listing, available tools" },
|
|
9
|
+
code_change_rules: { description: "Coding rules, linting/testing, ecosystem tools, style" },
|
|
10
|
+
guidelines: { description: "Tips, behavioral best practices, behavioral guidelines" },
|
|
11
|
+
safety: { description: "Environment limitations, prohibited actions, security policies" },
|
|
12
|
+
tool_instructions: { description: "Per-tool usage instructions" },
|
|
13
|
+
custom_instructions: { description: "Repository and organization custom instructions" },
|
|
14
|
+
last_instructions: {
|
|
15
|
+
description: "End-of-prompt instructions: parallel tool calling, persistence, task completion"
|
|
16
|
+
}
|
|
17
|
+
};
|
|
4
18
|
const approveAll = () => ({ kind: "approved" });
|
|
5
19
|
export {
|
|
20
|
+
SYSTEM_PROMPT_SECTIONS,
|
|
6
21
|
approveAll,
|
|
7
22
|
defineTool
|
|
8
23
|
};
|
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": "0.1.33-preview.
|
|
7
|
+
"version": "0.1.33-preview.4",
|
|
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.10-0",
|
|
60
60
|
"vscode-jsonrpc": "^8.2.1",
|
|
61
61
|
"zod": "^4.3.6"
|
|
62
62
|
},
|