@github/copilot-sdk 0.1.10-preview.0 → 0.1.10

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/dist/client.d.ts DELETED
@@ -1,95 +0,0 @@
1
- import { CopilotSession } from "./session.js";
2
- import type { ConnectionState, CopilotClientOptions, ResumeSessionConfig, SessionConfig, SessionMetadata } from "./types.js";
3
- export declare class CopilotClient {
4
- private cliProcess;
5
- private connection;
6
- private socket;
7
- private actualPort;
8
- private actualHost;
9
- private state;
10
- private sessions;
11
- private options;
12
- private isExternalServer;
13
- private forceStopping;
14
- constructor(options?: CopilotClientOptions);
15
- /**
16
- * Parse CLI URL into host and port
17
- * Supports formats: "host:port", "http://host:port", "https://host:port", or just "port"
18
- */
19
- private parseCliUrl;
20
- /**
21
- * Start the CLI server and establish connection
22
- */
23
- start(): Promise<void>;
24
- /**
25
- * Stop the CLI server and close all sessions
26
- * Returns array of errors encountered during cleanup (empty if all succeeded)
27
- */
28
- stop(): Promise<Error[]>;
29
- /**
30
- * Force stop the CLI server without graceful cleanup
31
- * Use when normal stop() fails or takes too long
32
- */
33
- forceStop(): Promise<void>;
34
- /**
35
- * Create a new session
36
- */
37
- createSession(config?: SessionConfig): Promise<CopilotSession>;
38
- /**
39
- * Resume an existing session
40
- */
41
- resumeSession(sessionId: string, config?: ResumeSessionConfig): Promise<CopilotSession>;
42
- /**
43
- * Get connection state
44
- */
45
- getState(): ConnectionState;
46
- /**
47
- * Ping the server
48
- */
49
- ping(message?: string): Promise<{
50
- message: string;
51
- timestamp: number;
52
- }>;
53
- /**
54
- * Get the ID of the most recently updated session
55
- * @returns The session ID, or undefined if no sessions exist
56
- */
57
- getLastSessionId(): Promise<string | undefined>;
58
- /**
59
- * Delete a session and its data from disk
60
- * @param sessionId The ID of the session to delete
61
- */
62
- deleteSession(sessionId: string): Promise<void>;
63
- /**
64
- * List all available sessions
65
- * @returns Array of session metadata
66
- */
67
- listSessions(): Promise<SessionMetadata[]>;
68
- /**
69
- * Start the CLI server process
70
- */
71
- private startCLIServer;
72
- /**
73
- * Connect to the CLI server (via socket or stdio)
74
- */
75
- private connectToServer;
76
- /**
77
- * Connect via stdio pipes
78
- */
79
- private connectViaStdio;
80
- /**
81
- * Connect to the CLI server via TCP socket
82
- */
83
- private connectViaTcp;
84
- private attachConnectionHandlers;
85
- private handleSessionEventNotification;
86
- private handleToolCallRequest;
87
- private executeToolCall;
88
- private normalizeToolResult;
89
- private isToolResultObject;
90
- private buildUnsupportedToolResult;
91
- /**
92
- * Attempt to reconnect to the server
93
- */
94
- private reconnect;
95
- }
package/dist/index.d.ts DELETED
@@ -1,9 +0,0 @@
1
- /**
2
- * Copilot SDK - TypeScript/Node.js Client
3
- *
4
- * JSON-RPC based SDK for programmatic control of GitHub Copilot CLI
5
- */
6
- export { CopilotClient } from "./client.js";
7
- export { CopilotSession } from "./session.js";
8
- export { defineTool } from "./types.js";
9
- export type { ConnectionState, CopilotClientOptions, MessageOptions, ResumeSessionConfig, SessionConfig, SessionEvent, SessionEventHandler, SessionMetadata, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageReplaceConfig, Tool, ToolHandler, ToolInvocation, ToolResultObject, ZodSchema, } from "./types.js";
package/dist/session.d.ts DELETED
@@ -1,39 +0,0 @@
1
- /**
2
- * Copilot Session - represents a single conversation session with the CLI
3
- */
4
- import type { MessageConnection } from "vscode-jsonrpc/node";
5
- import type { MessageOptions, SessionEvent, SessionEventHandler, Tool, ToolHandler } from "./types.js";
6
- export declare class CopilotSession {
7
- readonly sessionId: string;
8
- private connection;
9
- private eventHandlers;
10
- private toolHandlers;
11
- constructor(sessionId: string, connection: MessageConnection);
12
- /**
13
- * Send a message to this session
14
- */
15
- send(options: MessageOptions): Promise<string>;
16
- /**
17
- * Subscribe to events from this session
18
- * @returns Unsubscribe function
19
- */
20
- on(handler: SessionEventHandler): () => void;
21
- /**
22
- * Internal: dispatch an event to all handlers
23
- */
24
- _dispatchEvent(event: SessionEvent): void;
25
- registerTools(tools?: Tool[]): void;
26
- getToolHandler(name: string): ToolHandler | undefined;
27
- /**
28
- * Get all events/messages from this session
29
- */
30
- getMessages(): Promise<SessionEvent[]>;
31
- /**
32
- * Destroy this session and free resources
33
- */
34
- destroy(): Promise<void>;
35
- /**
36
- * Abort the currently processing message in this session
37
- */
38
- abort(): Promise<void>;
39
- }