@dexto/client-sdk 1.2.4 → 1.2.6
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 -4
- package/dist/client.d.ts +3022 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/index.cjs +115 -799
- package/dist/index.d.ts +8 -230
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +114 -800
- package/dist/streaming.d.ts +57 -0
- package/dist/streaming.d.ts.map +1 -0
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +12 -4
- package/dist/index.d.cts +0 -232
package/dist/index.d.ts
CHANGED
|
@@ -1,232 +1,10 @@
|
|
|
1
|
-
import { ImageData, FileData, ProviderInfo, LLMRouter, SupportedFileType, ModelInfo, McpServerConfig, ToolSet, AgentEventMap, SessionEventMap, SessionMetadata, LLMConfig, SearchOptions, SearchResponse, SessionSearchResponse } from '@dexto/core';
|
|
2
|
-
export { AgentEventMap, FileData, ImageData, InternalMessage, LLMConfig, LLMProvider, LLMRouter, McpServerConfig, ModelInfo, ProviderInfo, SearchOptions, SearchResponse, SearchResult, SessionEventMap, SessionMetadata, SessionSearchResponse, SessionSearchResult, SupportedFileType, ToolSet } from '@dexto/core';
|
|
3
|
-
|
|
4
|
-
interface ClientConfig {
|
|
5
|
-
baseUrl: string;
|
|
6
|
-
apiKey?: string | undefined;
|
|
7
|
-
timeout?: number | undefined;
|
|
8
|
-
retries?: number | undefined;
|
|
9
|
-
}
|
|
10
|
-
interface ClientOptions {
|
|
11
|
-
enableWebSocket?: boolean | undefined;
|
|
12
|
-
reconnect?: boolean | undefined;
|
|
13
|
-
reconnectInterval?: number | undefined;
|
|
14
|
-
debug?: boolean | undefined;
|
|
15
|
-
}
|
|
16
|
-
interface MessageInput {
|
|
17
|
-
content: string;
|
|
18
|
-
imageData?: ImageData;
|
|
19
|
-
fileData?: FileData;
|
|
20
|
-
sessionId?: string;
|
|
21
|
-
stream?: boolean;
|
|
22
|
-
}
|
|
23
|
-
interface MessageResponse {
|
|
24
|
-
response: string;
|
|
25
|
-
sessionId: string;
|
|
26
|
-
}
|
|
27
|
-
type ClientProviderInfo = ProviderInfo;
|
|
28
|
-
type McpServer = McpServerConfig;
|
|
29
|
-
type Tool = ToolSet;
|
|
30
|
-
type CatalogModel = ModelInfo;
|
|
31
|
-
type CatalogProvider = ProviderInfo;
|
|
32
|
-
interface CatalogOptions {
|
|
33
|
-
provider?: string;
|
|
34
|
-
hasKey?: boolean;
|
|
35
|
-
router?: LLMRouter;
|
|
36
|
-
fileType?: SupportedFileType;
|
|
37
|
-
defaultOnly?: boolean;
|
|
38
|
-
mode?: 'grouped' | 'flat';
|
|
39
|
-
}
|
|
40
|
-
interface CatalogResponse {
|
|
41
|
-
providers?: Record<string, CatalogProvider>;
|
|
42
|
-
models?: Array<CatalogModel & {
|
|
43
|
-
provider: string;
|
|
44
|
-
}>;
|
|
45
|
-
}
|
|
46
|
-
type DextoEvent = {
|
|
47
|
-
[K in keyof AgentEventMap as K extends string ? K : never]: {
|
|
48
|
-
type: K;
|
|
49
|
-
data: AgentEventMap[K];
|
|
50
|
-
};
|
|
51
|
-
}[keyof AgentEventMap] | {
|
|
52
|
-
[K in keyof SessionEventMap as K extends string ? K : never]: {
|
|
53
|
-
type: K;
|
|
54
|
-
data: SessionEventMap[K];
|
|
55
|
-
sessionId: string;
|
|
56
|
-
};
|
|
57
|
-
}[keyof SessionEventMap];
|
|
58
|
-
|
|
59
|
-
type EventHandler = (event: DextoEvent) => void;
|
|
60
|
-
|
|
61
1
|
/**
|
|
62
|
-
* Dexto Client SDK
|
|
63
|
-
*
|
|
64
|
-
* This SDK provides a thin interface for interacting with Dexto API.
|
|
65
|
-
* All validation is handled by the server - we just pass data through.
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* ```typescript
|
|
69
|
-
* const client = new DextoClient({
|
|
70
|
-
* baseUrl: 'https://your-dexto-server.com',
|
|
71
|
-
* apiKey: 'optional-api-key'
|
|
72
|
-
* });
|
|
73
|
-
*
|
|
74
|
-
* await client.connect();
|
|
75
|
-
*
|
|
76
|
-
* const response = await client.sendMessage({
|
|
77
|
-
* content: 'Hello, how can you help me?'
|
|
78
|
-
* });
|
|
79
|
-
*
|
|
80
|
-
* console.log(response.response);
|
|
81
|
-
* ```
|
|
2
|
+
* Dexto Client SDK
|
|
3
|
+
* Lightweight type-safe client for Dexto API built on Hono's typed client
|
|
82
4
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
private initializeWebSocket;
|
|
90
|
-
/**
|
|
91
|
-
* Establish connection to Dexto server (including WebSocket if enabled)
|
|
92
|
-
*/
|
|
93
|
-
connect(): Promise<void>;
|
|
94
|
-
/**
|
|
95
|
-
* Disconnect from Dexto server
|
|
96
|
-
*/
|
|
97
|
-
disconnect(): void;
|
|
98
|
-
/**
|
|
99
|
-
* Send a message to the Dexto agent
|
|
100
|
-
*/
|
|
101
|
-
sendMessage(input: MessageInput): Promise<MessageResponse>;
|
|
102
|
-
/**
|
|
103
|
-
* Send a message via WebSocket for streaming responses
|
|
104
|
-
*/
|
|
105
|
-
sendMessageStream(input: MessageInput): boolean;
|
|
106
|
-
/**
|
|
107
|
-
* List all sessions
|
|
108
|
-
*/
|
|
109
|
-
listSessions(): Promise<SessionMetadata[]>;
|
|
110
|
-
/**
|
|
111
|
-
* Create a new session
|
|
112
|
-
*/
|
|
113
|
-
createSession(sessionId?: string): Promise<SessionMetadata>;
|
|
114
|
-
/**
|
|
115
|
-
* Get session details
|
|
116
|
-
*/
|
|
117
|
-
getSession(sessionId: string): Promise<SessionMetadata>;
|
|
118
|
-
/**
|
|
119
|
-
* Get session conversation history
|
|
120
|
-
*/
|
|
121
|
-
getSessionHistory(sessionId: string): Promise<any[]>;
|
|
122
|
-
/**
|
|
123
|
-
* Delete a session permanently
|
|
124
|
-
*/
|
|
125
|
-
deleteSession(sessionId: string): Promise<void>;
|
|
126
|
-
/**
|
|
127
|
-
* Load a session as the current working session
|
|
128
|
-
*/
|
|
129
|
-
loadSession(sessionId: string | null): Promise<void>;
|
|
130
|
-
/**
|
|
131
|
-
* Get the current working session
|
|
132
|
-
*/
|
|
133
|
-
getCurrentSession(): Promise<string>;
|
|
134
|
-
/**
|
|
135
|
-
* Reset conversation (clear history while keeping session alive)
|
|
136
|
-
*/
|
|
137
|
-
resetConversation(sessionId?: string): Promise<void>;
|
|
138
|
-
/**
|
|
139
|
-
* Get current LLM configuration
|
|
140
|
-
*/
|
|
141
|
-
getCurrentLLMConfig(sessionId?: string): Promise<LLMConfig>;
|
|
142
|
-
/**
|
|
143
|
-
* Switch LLM configuration
|
|
144
|
-
*/
|
|
145
|
-
switchLLM(config: Partial<LLMConfig>, sessionId?: string): Promise<LLMConfig>;
|
|
146
|
-
/**
|
|
147
|
-
* Get available LLM providers and models
|
|
148
|
-
*/
|
|
149
|
-
getLLMProviders(): Promise<Record<string, ClientProviderInfo>>;
|
|
150
|
-
/**
|
|
151
|
-
* Get LLM catalog with filtering options
|
|
152
|
-
*/
|
|
153
|
-
getLLMCatalog(options?: CatalogOptions): Promise<CatalogResponse>;
|
|
154
|
-
/**
|
|
155
|
-
* List connected MCP servers
|
|
156
|
-
*/
|
|
157
|
-
listMCPServers(): Promise<McpServer[]>;
|
|
158
|
-
/**
|
|
159
|
-
* Connect to a new MCP server
|
|
160
|
-
*/
|
|
161
|
-
connectMCPServer(name: string, config: Record<string, unknown>): Promise<void>;
|
|
162
|
-
/**
|
|
163
|
-
* Disconnect from an MCP server
|
|
164
|
-
*/
|
|
165
|
-
disconnectMCPServer(serverId: string): Promise<void>;
|
|
166
|
-
/**
|
|
167
|
-
* Get tools from a specific MCP server
|
|
168
|
-
*/
|
|
169
|
-
getMCPServerTools(serverId: string): Promise<Tool[]>;
|
|
170
|
-
/**
|
|
171
|
-
* Execute a tool from an MCP server
|
|
172
|
-
*/
|
|
173
|
-
executeMCPTool(serverId: string, toolName: string, args: unknown): Promise<unknown>;
|
|
174
|
-
/**
|
|
175
|
-
* Search messages across sessions
|
|
176
|
-
*/
|
|
177
|
-
searchMessages(query: string, options?: SearchOptions): Promise<SearchResponse>;
|
|
178
|
-
/**
|
|
179
|
-
* Search sessions that contain the query
|
|
180
|
-
*/
|
|
181
|
-
searchSessions(query: string): Promise<SessionSearchResponse>;
|
|
182
|
-
/**
|
|
183
|
-
* Subscribe to real-time events
|
|
184
|
-
*/
|
|
185
|
-
on(eventType: string, handler: EventHandler): () => void;
|
|
186
|
-
/**
|
|
187
|
-
* Subscribe to connection state changes
|
|
188
|
-
*/
|
|
189
|
-
onConnectionState(handler: (state: 'connecting' | 'open' | 'closed' | 'error') => void): () => void;
|
|
190
|
-
/**
|
|
191
|
-
* Get agent greeting message
|
|
192
|
-
*/
|
|
193
|
-
getGreeting(sessionId?: string): Promise<string | null>;
|
|
194
|
-
/**
|
|
195
|
-
* Get connection status
|
|
196
|
-
*/
|
|
197
|
-
get connectionState(): 'connecting' | 'open' | 'closed' | 'error';
|
|
198
|
-
/**
|
|
199
|
-
* Check if client is connected
|
|
200
|
-
*/
|
|
201
|
-
get isConnected(): boolean;
|
|
202
|
-
/**
|
|
203
|
-
* Get client configuration
|
|
204
|
-
*/
|
|
205
|
-
get clientConfig(): Readonly<ClientConfig>;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Simple error factory for client SDK
|
|
210
|
-
* No complex validation - let server handle validation and return appropriate errors
|
|
211
|
-
*/
|
|
212
|
-
declare class ClientError {
|
|
213
|
-
/**
|
|
214
|
-
* Connection and Network Errors
|
|
215
|
-
*/
|
|
216
|
-
static connectionFailed(baseUrl: string, originalError?: Error): Error;
|
|
217
|
-
static networkError(message: string, originalError?: Error): Error;
|
|
218
|
-
static httpError(status: number, statusText: string, endpoint?: string, details?: unknown): Error;
|
|
219
|
-
static timeoutError(operation: string, timeout: number): Error;
|
|
220
|
-
/**
|
|
221
|
-
* WebSocket Errors
|
|
222
|
-
*/
|
|
223
|
-
static websocketConnectionFailed(url: string, originalError?: Error): Error;
|
|
224
|
-
static websocketSendFailed(originalError?: Error): Error;
|
|
225
|
-
/**
|
|
226
|
-
* Configuration Errors
|
|
227
|
-
*/
|
|
228
|
-
static invalidConfig(field: string, value: unknown, reason: string): Error;
|
|
229
|
-
static responseParseError(originalError?: Error): Error;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
export { type CatalogModel, type CatalogOptions, type CatalogProvider, type CatalogResponse, type ClientConfig, ClientError, type ClientOptions, type ClientProviderInfo, DextoClient, type DextoEvent, type McpServer, type MessageInput, type MessageResponse, type Tool };
|
|
5
|
+
export { createDextoClient } from './client.js';
|
|
6
|
+
export { stream, createStream, createMessageStream, SSEError } from './streaming.js';
|
|
7
|
+
export type { SSEEvent, MessageStreamEvent } from './streaming.js';
|
|
8
|
+
export type { ClientConfig } from './types.js';
|
|
9
|
+
export type { AppType } from '@dexto/server';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrF,YAAY,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGnE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,YAAY,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC"}
|