agentxjs 0.0.0-dev-20260312143810

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.
@@ -0,0 +1,787 @@
1
+ import { CreateDriver } from '@agentxjs/core/driver';
2
+ import { AgentXRuntime, AgentXPlatform } from '@agentxjs/core/runtime';
3
+ import { Message } from '@agentxjs/core/agent';
4
+ import { AgentXError } from '@agentxjs/core/error';
5
+ export { AgentXError, AgentXErrorCategory, AgentXErrorCode, AgentXErrorContext } from '@agentxjs/core/error';
6
+ import { Unsubscribe, BusEvent, EventBus, BusEventHandler } from '@agentxjs/core/event';
7
+ import { LLMProtocol, LLMProviderRecord } from '@agentxjs/core/persistence';
8
+ import * as _agentxjs_core_network from '@agentxjs/core/network';
9
+ import { RpcMethod } from '@agentxjs/core/network';
10
+
11
+ /**
12
+ * Presentation Types
13
+ *
14
+ * UI-friendly data model aggregated from stream events.
15
+ * This implements the Presentation Model pattern.
16
+ */
17
+ /**
18
+ * Text block
19
+ */
20
+ interface TextBlock {
21
+ type: "text";
22
+ content: string;
23
+ }
24
+ /**
25
+ * Tool block - represents a tool call and its result
26
+ */
27
+ interface ToolBlock {
28
+ type: "tool";
29
+ toolUseId: string;
30
+ toolName: string;
31
+ toolInput: Record<string, unknown>;
32
+ toolResult?: string;
33
+ status: "pending" | "running" | "completed" | "error";
34
+ }
35
+ /**
36
+ * Image block
37
+ */
38
+ interface ImageBlock {
39
+ type: "image";
40
+ url: string;
41
+ alt?: string;
42
+ }
43
+ /**
44
+ * All block types
45
+ */
46
+ type Block = TextBlock | ToolBlock | ImageBlock;
47
+ /**
48
+ * User conversation
49
+ */
50
+ interface UserConversation {
51
+ role: "user";
52
+ blocks: Block[];
53
+ }
54
+ /**
55
+ * Token usage for a message (one LLM call / step)
56
+ */
57
+ interface TokenUsage {
58
+ inputTokens: number;
59
+ outputTokens: number;
60
+ }
61
+ /**
62
+ * Assistant conversation
63
+ */
64
+ interface AssistantConversation {
65
+ role: "assistant";
66
+ blocks: Block[];
67
+ isStreaming: boolean;
68
+ /** Accumulated token usage across all steps in this conversation */
69
+ usage?: TokenUsage;
70
+ }
71
+ /**
72
+ * Error conversation
73
+ */
74
+ interface ErrorConversation {
75
+ role: "error";
76
+ message: string;
77
+ }
78
+ /**
79
+ * All conversation types
80
+ */
81
+ type Conversation = UserConversation | AssistantConversation | ErrorConversation;
82
+ /**
83
+ * Presentation state - the complete UI state
84
+ */
85
+ interface PresentationState {
86
+ /**
87
+ * All completed conversations
88
+ */
89
+ conversations: Conversation[];
90
+ /**
91
+ * Current streaming conversation (null if not streaming)
92
+ */
93
+ streaming: AssistantConversation | null;
94
+ /**
95
+ * Current status
96
+ */
97
+ status: "idle" | "thinking" | "responding" | "executing";
98
+ }
99
+ /**
100
+ * Initial presentation state
101
+ */
102
+ declare const initialPresentationState: PresentationState;
103
+
104
+ /**
105
+ * Presentation Class
106
+ *
107
+ * High-level API for UI integration.
108
+ * Wraps AgentX client and provides presentation state management.
109
+ */
110
+
111
+ /**
112
+ * Presentation update handler
113
+ */
114
+ type PresentationUpdateHandler = (state: PresentationState) => void;
115
+ /**
116
+ * Presentation error handler
117
+ */
118
+ type PresentationErrorHandler = (error: Error) => void;
119
+ /**
120
+ * Presentation options
121
+ */
122
+ interface PresentationOptions {
123
+ /**
124
+ * Called on every state update
125
+ */
126
+ onUpdate?: PresentationUpdateHandler;
127
+ /**
128
+ * Called on errors
129
+ */
130
+ onError?: PresentationErrorHandler;
131
+ }
132
+ /**
133
+ * Presentation - UI-friendly wrapper for AgentX
134
+ */
135
+ declare class Presentation {
136
+ private agentx;
137
+ private agentId;
138
+ private state;
139
+ private updateHandlers;
140
+ private errorHandlers;
141
+ private eventUnsubscribe;
142
+ constructor(agentx: AgentX, agentId: string, options?: PresentationOptions, initialConversations?: Conversation[]);
143
+ /**
144
+ * Get current state
145
+ */
146
+ getState(): PresentationState;
147
+ /**
148
+ * Subscribe to state updates
149
+ */
150
+ onUpdate(handler: PresentationUpdateHandler): Unsubscribe;
151
+ /**
152
+ * Subscribe to errors
153
+ */
154
+ onError(handler: PresentationErrorHandler): Unsubscribe;
155
+ /**
156
+ * Send a message
157
+ */
158
+ send(content: string): Promise<void>;
159
+ /**
160
+ * Interrupt current response
161
+ */
162
+ interrupt(): Promise<void>;
163
+ /**
164
+ * Reset state
165
+ */
166
+ reset(): void;
167
+ /**
168
+ * Dispose and cleanup
169
+ */
170
+ dispose(): void;
171
+ private subscribeToEvents;
172
+ private notify;
173
+ private notifyError;
174
+ }
175
+
176
+ /**
177
+ * Presentation Reducer
178
+ *
179
+ * Aggregates events into PresentationState.
180
+ * Pure function: (state, event) => newState
181
+ *
182
+ * Event consumption strategy:
183
+ * - Stream layer: message_start, text_delta, tool_use_start, tool_use_stop, message_stop
184
+ * (for real-time streaming display)
185
+ * - Message layer: tool_result_message
186
+ * (for tool execution results — arrives after message_stop)
187
+ *
188
+ * Tool calls are stream-level blocks within the assistant turn,
189
+ * matching the mainstream API pattern (Anthropic, OpenAI).
190
+ */
191
+
192
+ /**
193
+ * Reduce an event into presentation state.
194
+ *
195
+ * Consumes:
196
+ * - Stream events: message_start, text_delta, tool_use_start, tool_use_stop, message_stop
197
+ * - Message events: tool_result_message
198
+ * - Error events: error
199
+ */
200
+ declare function presentationReducer(state: PresentationState, event: BusEvent): PresentationState;
201
+ declare function addUserConversation(state: PresentationState, content: string): PresentationState;
202
+ declare function createInitialState(): PresentationState;
203
+ /**
204
+ * Convert persisted Messages to Presentation Conversations.
205
+ *
206
+ * Groups consecutive assistant + tool-result messages
207
+ * into a single AssistantConversation.
208
+ *
209
+ * Tool calls are now part of AssistantMessage.content (as ToolCallPart),
210
+ * so we extract them directly from the assistant message.
211
+ */
212
+ declare function messagesToConversations(messages: Message[]): Conversation[];
213
+
214
+ /**
215
+ * AgentX Client SDK Types
216
+ */
217
+
218
+ /**
219
+ * Static or dynamic value
220
+ */
221
+ type MaybeAsync<T> = T | (() => T) | (() => Promise<T>);
222
+ /**
223
+ * Agent info returned from server
224
+ */
225
+ interface AgentInfo {
226
+ agentId: string;
227
+ imageId: string;
228
+ containerId: string;
229
+ sessionId: string;
230
+ lifecycle?: string;
231
+ }
232
+ /**
233
+ * Image record from server
234
+ */
235
+ interface ImageRecord {
236
+ imageId: string;
237
+ containerId: string;
238
+ sessionId: string;
239
+ name?: string;
240
+ description?: string;
241
+ systemPrompt?: string;
242
+ customData?: Record<string, unknown>;
243
+ createdAt: number;
244
+ updatedAt: number;
245
+ }
246
+ /**
247
+ * Container info
248
+ */
249
+ interface ContainerInfo {
250
+ containerId: string;
251
+ }
252
+ /**
253
+ * Base response with requestId
254
+ */
255
+ interface BaseResponse {
256
+ requestId: string;
257
+ error?: string;
258
+ }
259
+ /**
260
+ * Agent create response
261
+ */
262
+ interface AgentCreateResponse extends BaseResponse {
263
+ agentId: string;
264
+ imageId: string;
265
+ containerId: string;
266
+ sessionId: string;
267
+ }
268
+ /**
269
+ * Agent get response
270
+ */
271
+ interface AgentGetResponse extends BaseResponse {
272
+ agent: AgentInfo | null;
273
+ exists: boolean;
274
+ }
275
+ /**
276
+ * Agent list response
277
+ */
278
+ interface AgentListResponse extends BaseResponse {
279
+ agents: AgentInfo[];
280
+ }
281
+ /**
282
+ * Image create response
283
+ */
284
+ interface ImageCreateResponse extends BaseResponse {
285
+ record: ImageRecord;
286
+ __subscriptions?: string[];
287
+ }
288
+ /**
289
+ * Image get response
290
+ */
291
+ interface ImageGetResponse extends BaseResponse {
292
+ record: ImageRecord | null;
293
+ __subscriptions?: string[];
294
+ }
295
+ /**
296
+ * Image list response
297
+ */
298
+ interface ImageListResponse extends BaseResponse {
299
+ records: ImageRecord[];
300
+ __subscriptions?: string[];
301
+ }
302
+ /**
303
+ * Image update response
304
+ */
305
+ interface ImageUpdateResponse extends BaseResponse {
306
+ record: ImageRecord;
307
+ }
308
+ /**
309
+ * Container create response
310
+ */
311
+ interface ContainerCreateResponse extends BaseResponse {
312
+ containerId: string;
313
+ }
314
+ /**
315
+ * Container get response
316
+ */
317
+ interface ContainerGetResponse extends BaseResponse {
318
+ containerId: string;
319
+ exists: boolean;
320
+ }
321
+ /**
322
+ * Container list response
323
+ */
324
+ interface ContainerListResponse extends BaseResponse {
325
+ containerIds: string[];
326
+ }
327
+ /**
328
+ * Message send response
329
+ */
330
+ interface MessageSendResponse extends BaseResponse {
331
+ agentId: string;
332
+ }
333
+ /**
334
+ * LLM provider create response
335
+ */
336
+ interface LLMProviderCreateResponse extends BaseResponse {
337
+ record: LLMProviderRecord;
338
+ }
339
+ /**
340
+ * LLM provider get response
341
+ */
342
+ interface LLMProviderGetResponse extends BaseResponse {
343
+ record: LLMProviderRecord | null;
344
+ }
345
+ /**
346
+ * LLM provider list response
347
+ */
348
+ interface LLMProviderListResponse extends BaseResponse {
349
+ records: LLMProviderRecord[];
350
+ }
351
+ /**
352
+ * LLM provider update response
353
+ */
354
+ interface LLMProviderUpdateResponse extends BaseResponse {
355
+ record: LLMProviderRecord;
356
+ }
357
+ /**
358
+ * LLM provider default response
359
+ */
360
+ interface LLMProviderDefaultResponse extends BaseResponse {
361
+ record: LLMProviderRecord | null;
362
+ }
363
+ /**
364
+ * Container operations namespace
365
+ */
366
+ interface ContainerNamespace {
367
+ /**
368
+ * Create or get container
369
+ */
370
+ create(containerId: string): Promise<ContainerCreateResponse>;
371
+ /**
372
+ * Get container
373
+ */
374
+ get(containerId: string): Promise<ContainerGetResponse>;
375
+ /**
376
+ * List containers
377
+ */
378
+ list(): Promise<ContainerListResponse>;
379
+ }
380
+ /**
381
+ * Image operations namespace
382
+ */
383
+ interface ImageNamespace {
384
+ /**
385
+ * Create a new image
386
+ */
387
+ create(params: {
388
+ containerId: string;
389
+ name?: string;
390
+ description?: string;
391
+ systemPrompt?: string;
392
+ mcpServers?: Record<string, unknown>;
393
+ customData?: Record<string, unknown>;
394
+ }): Promise<ImageCreateResponse>;
395
+ /**
396
+ * Get image by ID
397
+ */
398
+ get(imageId: string): Promise<ImageGetResponse>;
399
+ /**
400
+ * List images
401
+ */
402
+ list(containerId?: string): Promise<ImageListResponse>;
403
+ /**
404
+ * Update image
405
+ */
406
+ update(imageId: string, updates: {
407
+ name?: string;
408
+ description?: string;
409
+ customData?: Record<string, unknown>;
410
+ }): Promise<ImageUpdateResponse>;
411
+ /**
412
+ * Delete image
413
+ */
414
+ delete(imageId: string): Promise<BaseResponse>;
415
+ /**
416
+ * Get message history for an image
417
+ */
418
+ getMessages(imageId: string): Promise<Message[]>;
419
+ }
420
+ /**
421
+ * Agent operations namespace
422
+ */
423
+ interface AgentNamespace {
424
+ /**
425
+ * Create a new agent
426
+ */
427
+ create(params: {
428
+ imageId: string;
429
+ agentId?: string;
430
+ }): Promise<AgentCreateResponse>;
431
+ /**
432
+ * Get agent by ID
433
+ */
434
+ get(agentId: string): Promise<AgentGetResponse>;
435
+ /**
436
+ * List agents
437
+ */
438
+ list(containerId?: string): Promise<AgentListResponse>;
439
+ /**
440
+ * Destroy an agent
441
+ */
442
+ destroy(agentId: string): Promise<BaseResponse>;
443
+ }
444
+ /**
445
+ * Session operations namespace (messaging)
446
+ */
447
+ interface SessionNamespace {
448
+ /**
449
+ * Send message to agent
450
+ */
451
+ send(agentId: string, content: string | unknown[]): Promise<MessageSendResponse>;
452
+ /**
453
+ * Interrupt agent
454
+ */
455
+ interrupt(agentId: string): Promise<BaseResponse>;
456
+ /**
457
+ * Get message history for an agent's session
458
+ */
459
+ getMessages(agentId: string): Promise<Message[]>;
460
+ }
461
+ /**
462
+ * LLM provider operations namespace
463
+ */
464
+ interface LLMNamespace {
465
+ /**
466
+ * Create a new LLM provider configuration
467
+ */
468
+ create(params: {
469
+ containerId: string;
470
+ name: string;
471
+ vendor: string;
472
+ protocol: LLMProtocol;
473
+ apiKey: string;
474
+ baseUrl?: string;
475
+ model?: string;
476
+ }): Promise<LLMProviderCreateResponse>;
477
+ /**
478
+ * Get LLM provider by ID
479
+ */
480
+ get(id: string): Promise<LLMProviderGetResponse>;
481
+ /**
482
+ * List LLM providers for a container
483
+ */
484
+ list(containerId: string): Promise<LLMProviderListResponse>;
485
+ /**
486
+ * Update LLM provider
487
+ */
488
+ update(id: string, updates: {
489
+ name?: string;
490
+ vendor?: string;
491
+ protocol?: LLMProtocol;
492
+ apiKey?: string;
493
+ baseUrl?: string;
494
+ model?: string;
495
+ }): Promise<LLMProviderUpdateResponse>;
496
+ /**
497
+ * Delete LLM provider
498
+ */
499
+ delete(id: string): Promise<BaseResponse>;
500
+ /**
501
+ * Set default LLM provider for a container
502
+ */
503
+ setDefault(id: string): Promise<BaseResponse>;
504
+ /**
505
+ * Get default LLM provider for a container
506
+ */
507
+ getDefault(containerId: string): Promise<LLMProviderDefaultResponse>;
508
+ }
509
+ /**
510
+ * Presentation operations namespace
511
+ */
512
+ interface PresentationNamespace {
513
+ /**
514
+ * Create a presentation for UI integration
515
+ *
516
+ * @example
517
+ * ```typescript
518
+ * const pres = agentx.presentation.create(agentId, {
519
+ * onUpdate: (state) => renderUI(state),
520
+ * onError: (error) => console.error(error),
521
+ * });
522
+ *
523
+ * await pres.send("Hello!");
524
+ * pres.dispose();
525
+ * ```
526
+ */
527
+ create(agentId: string, options?: PresentationOptions): Promise<Presentation>;
528
+ }
529
+ /**
530
+ * AgentX Client SDK — unified interface for local, remote, and server modes
531
+ */
532
+ interface AgentX {
533
+ /**
534
+ * Check if connected/active
535
+ */
536
+ readonly connected: boolean;
537
+ /**
538
+ * Event bus for subscribing to events
539
+ */
540
+ readonly events: EventBus;
541
+ readonly container: ContainerNamespace;
542
+ readonly image: ImageNamespace;
543
+ readonly agent: AgentNamespace;
544
+ readonly session: SessionNamespace;
545
+ readonly presentation: PresentationNamespace;
546
+ readonly llm: LLMNamespace;
547
+ on<T extends string>(type: T, handler: BusEventHandler<BusEvent & {
548
+ type: T;
549
+ }>): Unsubscribe;
550
+ onAny(handler: BusEventHandler): Unsubscribe;
551
+ subscribe(sessionId: string): void;
552
+ /**
553
+ * Top-level error handler — receives all AgentXError instances from any layer.
554
+ *
555
+ * Independent of `on("error", ...)` (stream events) and `presentation.onError` (UI errors).
556
+ *
557
+ * @example
558
+ * ```typescript
559
+ * ax.onError((error) => {
560
+ * console.error(`[${error.category}] ${error.code}: ${error.message}`);
561
+ * if (!error.recoverable) {
562
+ * // Circuit is open, stop sending requests
563
+ * }
564
+ * });
565
+ * ```
566
+ */
567
+ onError(handler: (error: AgentXError) => void): Unsubscribe;
568
+ /**
569
+ * Universal JSON-RPC entry point — works in all modes:
570
+ * - Local: dispatches to CommandHandler directly
571
+ * - Remote: forwards to the remote server via RPC client
572
+ *
573
+ * @example
574
+ * ```typescript
575
+ * const result = await ax.rpc("container.create", { containerId: "default" });
576
+ * const { records } = await ax.rpc<{ records: ImageRecord[] }>("image.list");
577
+ * ```
578
+ */
579
+ rpc<T = unknown>(method: string, params?: unknown): Promise<T>;
580
+ disconnect(): Promise<void>;
581
+ dispose(): Promise<void>;
582
+ }
583
+ /**
584
+ * Options for connecting to a remote AgentX server
585
+ */
586
+ interface ConnectOptions {
587
+ /** Authentication headers */
588
+ headers?: MaybeAsync<Record<string, string>>;
589
+ /** Business context injected into requests */
590
+ context?: MaybeAsync<Record<string, unknown>>;
591
+ /** Request timeout in ms (default: 30000) */
592
+ timeout?: number;
593
+ /** Auto reconnect on disconnect (default: true) */
594
+ autoReconnect?: boolean;
595
+ }
596
+ /**
597
+ * Configuration for serving as an AgentX server
598
+ */
599
+ interface ServeConfig {
600
+ /** Port to listen on (default: 5200) */
601
+ port?: number;
602
+ /** Host to bind to (default: "0.0.0.0") */
603
+ host?: string;
604
+ /** Existing HTTP server to attach to */
605
+ server?: unknown;
606
+ /** WebSocket path when attached (default: "/ws") */
607
+ wsPath?: string;
608
+ }
609
+ /**
610
+ * Server instance returned by serve()
611
+ */
612
+ interface AgentXServer {
613
+ listen(port?: number, host?: string): Promise<void>;
614
+ close(): Promise<void>;
615
+ dispose(): Promise<void>;
616
+ }
617
+ /**
618
+ * AgentXBuilder — fluent API entry point
619
+ *
620
+ * Created by `createAgentX(platform?)`. The builder itself is an AgentX
621
+ * instance (local mode). Call `.connect()` to get a remote client,
622
+ * or `.serve()` to start a server.
623
+ *
624
+ * @example
625
+ * ```typescript
626
+ * const ax = createAgentX(node({ createDriver }))
627
+ *
628
+ * // Local use
629
+ * await ax.agent.create({ imageId: "..." })
630
+ *
631
+ * // Connect to remote server
632
+ * const client = await ax.connect("wss://...")
633
+ *
634
+ * // Serve as server
635
+ * const server = await ax.serve({ port: 3100 })
636
+ * ```
637
+ */
638
+ interface AgentXBuilder extends AgentX {
639
+ /**
640
+ * Connect to a remote AgentX server
641
+ */
642
+ connect(serverUrl: string, options?: ConnectOptions): Promise<AgentX>;
643
+ /**
644
+ * Start serving as an AgentX server
645
+ */
646
+ serve(config?: ServeConfig): Promise<AgentXServer>;
647
+ }
648
+
649
+ /**
650
+ * CommandHandler - Handles JSON-RPC requests directly
651
+ *
652
+ * No longer uses EventBus for request/response. Instead:
653
+ * - Receives RPC requests directly
654
+ * - Returns RPC responses directly
655
+ * - EventBus is only used for stream events (notifications)
656
+ */
657
+
658
+ /**
659
+ * RPC Result type
660
+ */
661
+ interface RpcResult<T = unknown> {
662
+ success: true;
663
+ data: T;
664
+ }
665
+ interface RpcError {
666
+ success: false;
667
+ code: number;
668
+ message: string;
669
+ }
670
+ type RpcResponse<T = unknown> = RpcResult<T> | RpcError;
671
+ /**
672
+ * CommandHandler - Processes RPC requests directly
673
+ */
674
+ declare class CommandHandler {
675
+ private readonly runtime;
676
+ constructor(runtime: AgentXRuntime);
677
+ /**
678
+ * Handle an RPC request and return response
679
+ */
680
+ handle(method: RpcMethod, params: unknown): Promise<RpcResponse>;
681
+ private handleContainerCreate;
682
+ private handleContainerGet;
683
+ private handleContainerList;
684
+ private handleImageCreate;
685
+ private handleImageGet;
686
+ private handleImageList;
687
+ private handleImageDelete;
688
+ private handleImageRun;
689
+ private handleImageStop;
690
+ private handleImageUpdate;
691
+ private handleImageMessages;
692
+ private handleAgentGet;
693
+ private handleAgentList;
694
+ private handleAgentDestroy;
695
+ private handleAgentDestroyAll;
696
+ private handleAgentInterrupt;
697
+ private handleMessageSend;
698
+ private handleLLMCreate;
699
+ private handleLLMGet;
700
+ private handleLLMList;
701
+ private handleLLMUpdate;
702
+ private handleLLMDelete;
703
+ private handleLLMDefault;
704
+ dispose(): void;
705
+ }
706
+
707
+ /**
708
+ * Server configuration (supports both immediate and deferred platforms)
709
+ */
710
+ interface ServerConfig {
711
+ /**
712
+ * AgentX Platform — must provide `channelServer` for accepting WebSocket connections.
713
+ */
714
+ platform: AgentXPlatform;
715
+ /**
716
+ * LLM Driver factory function - creates Driver per Agent
717
+ */
718
+ createDriver: CreateDriver;
719
+ /**
720
+ * Port to listen on (standalone mode)
721
+ */
722
+ port?: number;
723
+ /**
724
+ * Host to bind to (default: "0.0.0.0")
725
+ */
726
+ host?: string;
727
+ /**
728
+ * Existing HTTP server to attach to (attached mode)
729
+ */
730
+ server?: _agentxjs_core_network.MinimalHTTPServer;
731
+ /**
732
+ * WebSocket path when attached (default: "/ws")
733
+ */
734
+ wsPath?: string;
735
+ /**
736
+ * Enable debug logging
737
+ */
738
+ debug?: boolean;
739
+ }
740
+ /**
741
+ * Create an AgentX server
742
+ */
743
+ declare function createServer(config: ServerConfig): Promise<AgentXServer>;
744
+
745
+ /**
746
+ * agentxjs - AgentX Client SDK
747
+ *
748
+ * Fluent API supporting local, remote, and server modes.
749
+ *
750
+ * @example Local mode
751
+ * ```typescript
752
+ * import { createAgentX } from "agentxjs";
753
+ * import { nodePlatform } from "@agentxjs/node-platform";
754
+ *
755
+ * const ax = createAgentX(nodePlatform({ createDriver }));
756
+ * await ax.agent.create({ imageId: "..." });
757
+ * ```
758
+ *
759
+ * @example Remote mode
760
+ * ```typescript
761
+ * const ax = createAgentX();
762
+ * const client = await ax.connect("ws://localhost:5200");
763
+ * ```
764
+ *
765
+ * @example Server mode
766
+ * ```typescript
767
+ * const ax = createAgentX(nodePlatform({ createDriver }));
768
+ * const server = await ax.serve({ port: 5200 });
769
+ * ```
770
+ */
771
+
772
+ /**
773
+ * Platform configuration for createAgentX
774
+ */
775
+ interface PlatformConfig {
776
+ platform: AgentXPlatform;
777
+ createDriver: CreateDriver;
778
+ }
779
+ /**
780
+ * Create an AgentX builder
781
+ *
782
+ * @param config - Platform configuration (optional). Without it, only connect() is available.
783
+ * @returns AgentXBuilder — local AgentX + connect() + serve()
784
+ */
785
+ declare function createAgentX(config?: PlatformConfig): AgentXBuilder;
786
+
787
+ export { type AgentCreateResponse, type AgentGetResponse, type AgentInfo, type AgentListResponse, type AgentNamespace, type AgentX, type AgentXBuilder, type AgentXServer, type AssistantConversation, type BaseResponse, type Block, CommandHandler, type ConnectOptions, type ContainerCreateResponse, type ContainerGetResponse, type ContainerInfo, type ContainerListResponse, type ContainerNamespace, type Conversation, type ErrorConversation, type ImageBlock, type ImageCreateResponse, type ImageGetResponse, type ImageListResponse, type ImageNamespace, type ImageRecord, type LLMNamespace, type LLMProviderCreateResponse, type LLMProviderDefaultResponse, type LLMProviderGetResponse, type LLMProviderListResponse, type LLMProviderUpdateResponse, type MaybeAsync, type MessageSendResponse, type PlatformConfig, Presentation, type PresentationErrorHandler, type PresentationNamespace, type PresentationOptions, type PresentationState, type PresentationUpdateHandler, type ServeConfig, type ServerConfig, type SessionNamespace, type TextBlock, type ToolBlock, type UserConversation, addUserConversation, createAgentX, createInitialState, createServer, initialPresentationState, messagesToConversations, presentationReducer };