agentxjs 2.7.0 → 2.8.0

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/index.d.ts CHANGED
@@ -1,12 +1,11 @@
1
1
  import { CreateDriver } from '@agentxjs/core/driver';
2
- import { AgentXRuntime, AgentXPlatform } from '@agentxjs/core/runtime';
2
+ import { AgentXPlatform } from '@agentxjs/core/runtime';
3
3
  import { Message } from '@agentxjs/core/agent';
4
4
  import { AgentXError } from '@agentxjs/core/error';
5
5
  export { AgentXError, AgentXErrorCategory, AgentXErrorCode, AgentXErrorContext } from '@agentxjs/core/error';
6
6
  import { Unsubscribe, BusEvent, EventBus, BusEventHandler } from '@agentxjs/core/event';
7
- import { PrototypeRecord, LLMProtocol, LLMProviderRecord } from '@agentxjs/core/persistence';
8
- import * as _agentxjs_core_network from '@agentxjs/core/network';
9
- import { RpcMethod } from '@agentxjs/core/network';
7
+ import { LLMProtocol, LLMProviderRecord } from '@agentxjs/core/persistence';
8
+ export { Capability, Context, ContextProvider } from '@agentxjs/core/context';
10
9
 
11
10
  /**
12
11
  * Presentation Types
@@ -230,15 +229,27 @@ interface InstanceInfo {
230
229
  lifecycle?: string;
231
230
  }
232
231
  /**
233
- * Embodiment — runtime configuration for an agent's "body".
232
+ * AgentConfigflat runtime configuration for creating an agent.
233
+ * AgentConfig IS the body — no wrapper needed.
234
234
  */
235
- interface Embodiment {
235
+ interface AgentConfig {
236
+ /** LLM model identifier */
236
237
  model?: string;
238
+ /** System prompt for the agent */
237
239
  systemPrompt?: string;
240
+ /** MCP server configurations for tool access */
238
241
  mcpServers?: Record<string, unknown>;
242
+ /** Context provider ID (e.g. RoleX individual) */
243
+ contextId?: string;
244
+ /** Display name */
245
+ name?: string;
246
+ /** Description */
247
+ description?: string;
248
+ /** Arbitrary custom data */
249
+ customData?: Record<string, unknown>;
239
250
  }
240
251
  /**
241
- * Image record from server
252
+ * Image record from server (internal persistence)
242
253
  */
243
254
  interface ImageRecord {
244
255
  imageId: string;
@@ -247,21 +258,13 @@ interface ImageRecord {
247
258
  name?: string;
248
259
  description?: string;
249
260
  contextId?: string;
250
- embody?: Embodiment;
251
- /** @deprecated Use `embody.systemPrompt` instead. */
261
+ model?: string;
252
262
  systemPrompt?: string;
253
- /** @deprecated Use `embody.mcpServers` instead. */
254
263
  mcpServers?: Record<string, unknown>;
255
264
  customData?: Record<string, unknown>;
256
265
  createdAt: number;
257
266
  updatedAt: number;
258
267
  }
259
- /**
260
- * Container info
261
- */
262
- interface ContainerInfo {
263
- containerId: string;
264
- }
265
268
  /**
266
269
  * Base response with requestId
267
270
  */
@@ -318,25 +321,6 @@ interface ImageListResponse extends BaseResponse {
318
321
  interface ImageUpdateResponse extends BaseResponse {
319
322
  record: ImageRecord;
320
323
  }
321
- /**
322
- * Container create response
323
- */
324
- interface ContainerCreateResponse extends BaseResponse {
325
- containerId: string;
326
- }
327
- /**
328
- * Container get response
329
- */
330
- interface ContainerGetResponse extends BaseResponse {
331
- containerId: string;
332
- exists: boolean;
333
- }
334
- /**
335
- * Container list response
336
- */
337
- interface ContainerListResponse extends BaseResponse {
338
- containerIds: string[];
339
- }
340
324
  /**
341
325
  * Message send response
342
326
  */
@@ -373,47 +357,6 @@ interface LLMProviderUpdateResponse extends BaseResponse {
373
357
  interface LLMProviderDefaultResponse extends BaseResponse {
374
358
  record: LLMProviderRecord | null;
375
359
  }
376
- /**
377
- * Prototype create response
378
- */
379
- interface PrototypeCreateResponse extends BaseResponse {
380
- record: PrototypeRecord;
381
- }
382
- /**
383
- * Prototype get response
384
- */
385
- interface PrototypeGetResponse extends BaseResponse {
386
- record: PrototypeRecord | null;
387
- }
388
- /**
389
- * Prototype list response
390
- */
391
- interface PrototypeListResponse extends BaseResponse {
392
- records: PrototypeRecord[];
393
- }
394
- /**
395
- * Prototype update response
396
- */
397
- interface PrototypeUpdateResponse extends BaseResponse {
398
- record: PrototypeRecord;
399
- }
400
- /**
401
- * Container operations namespace
402
- */
403
- interface ContainerNamespace {
404
- /**
405
- * Create or get container
406
- */
407
- create(containerId: string): Promise<ContainerCreateResponse>;
408
- /**
409
- * Get container
410
- */
411
- get(containerId: string): Promise<ContainerGetResponse>;
412
- /**
413
- * List containers
414
- */
415
- list(): Promise<ContainerListResponse>;
416
- }
417
360
  /**
418
361
  * Image operations namespace
419
362
  */
@@ -421,14 +364,7 @@ interface ImageNamespace {
421
364
  /**
422
365
  * Create a new image from an Agent blueprint
423
366
  */
424
- create(params: {
425
- containerId: string;
426
- name?: string;
427
- description?: string;
428
- contextId?: string;
429
- embody?: Embodiment;
430
- customData?: Record<string, unknown>;
431
- }): Promise<ImageCreateResponse>;
367
+ create(params: AgentConfig): Promise<ImageCreateResponse>;
432
368
  /**
433
369
  * Get image by ID
434
370
  */
@@ -436,16 +372,11 @@ interface ImageNamespace {
436
372
  /**
437
373
  * List images
438
374
  */
439
- list(containerId?: string): Promise<ImageListResponse>;
375
+ list(): Promise<ImageListResponse>;
440
376
  /**
441
377
  * Update image
442
378
  */
443
- update(imageId: string, updates: {
444
- name?: string;
445
- description?: string;
446
- embody?: Embodiment;
447
- customData?: Record<string, unknown>;
448
- }): Promise<ImageUpdateResponse>;
379
+ update(imageId: string, updates: Partial<Pick<AgentConfig, "name" | "description" | "model" | "systemPrompt" | "mcpServers" | "customData">>): Promise<ImageUpdateResponse>;
449
380
  /**
450
381
  * Delete image
451
382
  */
@@ -473,7 +404,7 @@ interface InstanceNamespace {
473
404
  /**
474
405
  * List agents
475
406
  */
476
- list(containerId?: string): Promise<InstanceListResponse>;
407
+ list(): Promise<InstanceListResponse>;
477
408
  /**
478
409
  * Destroy an agent
479
410
  */
@@ -504,7 +435,6 @@ interface LLMNamespace {
504
435
  * Create a new LLM provider configuration
505
436
  */
506
437
  create(params: {
507
- containerId: string;
508
438
  name: string;
509
439
  vendor: string;
510
440
  protocol: LLMProtocol;
@@ -517,9 +447,9 @@ interface LLMNamespace {
517
447
  */
518
448
  get(id: string): Promise<LLMProviderGetResponse>;
519
449
  /**
520
- * List LLM providers for a container
450
+ * List LLM providers
521
451
  */
522
- list(containerId: string): Promise<LLMProviderListResponse>;
452
+ list(): Promise<LLMProviderListResponse>;
523
453
  /**
524
454
  * Update LLM provider
525
455
  */
@@ -536,51 +466,13 @@ interface LLMNamespace {
536
466
  */
537
467
  delete(id: string): Promise<BaseResponse>;
538
468
  /**
539
- * Set default LLM provider for a container
469
+ * Set default LLM provider
540
470
  */
541
471
  setDefault(id: string): Promise<BaseResponse>;
542
472
  /**
543
- * Get default LLM provider for a container
473
+ * Get default LLM provider
544
474
  */
545
- getDefault(containerId: string): Promise<LLMProviderDefaultResponse>;
546
- }
547
- /**
548
- * Prototype operations namespace — manage reusable agent templates
549
- */
550
- interface PrototypeNamespace {
551
- /**
552
- * Register a new prototype
553
- */
554
- create(params: {
555
- containerId: string;
556
- name: string;
557
- description?: string;
558
- contextId?: string;
559
- embody?: Embodiment;
560
- customData?: Record<string, unknown>;
561
- }): Promise<PrototypeCreateResponse>;
562
- /**
563
- * Get prototype by ID
564
- */
565
- get(prototypeId: string): Promise<PrototypeGetResponse>;
566
- /**
567
- * List prototypes
568
- */
569
- list(containerId?: string): Promise<PrototypeListResponse>;
570
- /**
571
- * Update prototype
572
- */
573
- update(prototypeId: string, updates: {
574
- name?: string;
575
- description?: string;
576
- contextId?: string;
577
- embody?: Embodiment;
578
- customData?: Record<string, unknown>;
579
- }): Promise<PrototypeUpdateResponse>;
580
- /**
581
- * Delete prototype
582
- */
583
- delete(prototypeId: string): Promise<BaseResponse>;
475
+ getDefault(): Promise<LLMProviderDefaultResponse>;
584
476
  }
585
477
  /**
586
478
  * Presentation operations namespace
@@ -606,17 +498,15 @@ interface PresentationNamespace {
606
498
  * Instance — low-level access to internal subsystems.
607
499
  *
608
500
  * Most users should use the top-level Agent API (ax.create, ax.send, etc.).
609
- * Instance exposes the underlying image, agent, session, container, llm,
501
+ * Instance exposes the underlying image, agent, session, llm,
610
502
  * and presentation subsystems for advanced use cases.
611
503
  */
612
504
  interface RuntimeNamespace {
613
- readonly container: ContainerNamespace;
614
505
  readonly image: ImageNamespace;
615
506
  readonly instance: InstanceNamespace;
616
507
  readonly session: SessionNamespace;
617
508
  readonly present: PresentationNamespace;
618
509
  readonly llm: LLMNamespace;
619
- readonly prototype: PrototypeNamespace;
620
510
  }
621
511
  /**
622
512
  * AgentHandle — a live reference to a created agent.
@@ -626,7 +516,7 @@ interface RuntimeNamespace {
626
516
  *
627
517
  * @example
628
518
  * ```typescript
629
- * const agent = await ax.chat.create({ name: "Aristotle", embody: { model: "claude-sonnet-4-6" } });
519
+ * const agent = await ax.chat.create({ name: "Aristotle", model: "claude-sonnet-4-6" });
630
520
  * await agent.send("Hello!");
631
521
  * const messages = await agent.history();
632
522
  * ```
@@ -655,12 +545,7 @@ interface AgentHandle {
655
545
  /**
656
546
  * Update this agent's metadata
657
547
  */
658
- update(updates: {
659
- name?: string;
660
- description?: string;
661
- embody?: Embodiment;
662
- customData?: Record<string, unknown>;
663
- }): Promise<void>;
548
+ update(updates: Partial<Pick<AgentConfig, "name" | "description" | "model" | "systemPrompt" | "mcpServers" | "customData">>): Promise<void>;
664
549
  /**
665
550
  * Delete this agent
666
551
  */
@@ -675,18 +560,8 @@ interface AgentHandle {
675
560
  interface ChatNamespace {
676
561
  /**
677
562
  * Create a new conversation
678
- *
679
- * When `prototypeId` is provided, the conversation inherits the prototype's
680
- * configuration (contextId, embody, etc.). Inline params override prototype values.
681
563
  */
682
- create(params: {
683
- prototypeId?: string;
684
- name?: string;
685
- description?: string;
686
- contextId?: string;
687
- embody?: Embodiment;
688
- customData?: Record<string, unknown>;
689
- }): Promise<AgentHandle>;
564
+ create(params: AgentConfig): Promise<AgentHandle>;
690
565
  /**
691
566
  * List all conversations
692
567
  */
@@ -702,7 +577,7 @@ interface ChatNamespace {
702
577
  * @example
703
578
  * ```typescript
704
579
  * const ax = createAgentX(config);
705
- * const agent = await ax.chat.create({ name: "Aristotle", embody: { model: "claude-sonnet-4-6" } });
580
+ * const agent = await ax.chat.create({ name: "Aristotle", model: "claude-sonnet-4-6" });
706
581
  * await agent.send("Hello!");
707
582
  * ```
708
583
  *
@@ -722,11 +597,7 @@ interface AgentX {
722
597
  */
723
598
  readonly chat: ChatNamespace;
724
599
  /**
725
- * Prototype management register and manage reusable agent templates.
726
- */
727
- readonly prototype: PrototypeNamespace;
728
- /**
729
- * Low-level access to internal subsystems (image, agent, session, container, llm).
600
+ * Low-level access to internal subsystems (image, agent, session, llm).
730
601
  */
731
602
  readonly runtime: RuntimeNamespace;
732
603
  /**
@@ -813,107 +684,6 @@ interface AgentXBuilder extends AgentX {
813
684
  serve(config?: ServeConfig): Promise<AgentXServer>;
814
685
  }
815
686
 
816
- /**
817
- * CommandHandler - Handles JSON-RPC requests directly
818
- *
819
- * No longer uses EventBus for request/response. Instead:
820
- * - Receives RPC requests directly
821
- * - Returns RPC responses directly
822
- * - EventBus is only used for stream events (notifications)
823
- */
824
-
825
- /**
826
- * RPC Result type
827
- */
828
- interface RpcResult<T = unknown> {
829
- success: true;
830
- data: T;
831
- }
832
- interface RpcError {
833
- success: false;
834
- code: number;
835
- message: string;
836
- }
837
- type RpcResponse<T = unknown> = RpcResult<T> | RpcError;
838
- /**
839
- * CommandHandler - Processes RPC requests directly
840
- */
841
- declare class CommandHandler {
842
- private readonly runtime;
843
- constructor(runtime: AgentXRuntime);
844
- /**
845
- * Handle an RPC request and return response
846
- */
847
- handle(method: RpcMethod, params: unknown): Promise<RpcResponse>;
848
- private handleContainerCreate;
849
- private handleContainerGet;
850
- private handleContainerList;
851
- private handleImageCreate;
852
- private handleImageGet;
853
- private handleImageList;
854
- private handleImageDelete;
855
- private handleImageRun;
856
- private handleImageStop;
857
- private handleImageUpdate;
858
- private handleImageMessages;
859
- private handleAgentGet;
860
- private handleAgentList;
861
- private handleAgentDestroy;
862
- private handleAgentDestroyAll;
863
- private handleAgentInterrupt;
864
- private handleMessageSend;
865
- private handlePrototypeCreate;
866
- private handlePrototypeGet;
867
- private handlePrototypeList;
868
- private handlePrototypeUpdate;
869
- private handlePrototypeDelete;
870
- private handleLLMCreate;
871
- private handleLLMGet;
872
- private handleLLMList;
873
- private handleLLMUpdate;
874
- private handleLLMDelete;
875
- private handleLLMDefault;
876
- dispose(): void;
877
- }
878
-
879
- /**
880
- * Server configuration (supports both immediate and deferred platforms)
881
- */
882
- interface ServerConfig {
883
- /**
884
- * AgentX Platform — must provide `channelServer` for accepting WebSocket connections.
885
- */
886
- platform: AgentXPlatform;
887
- /**
888
- * LLM Driver factory function - creates Driver per Agent
889
- */
890
- createDriver: CreateDriver;
891
- /**
892
- * Port to listen on (standalone mode)
893
- */
894
- port?: number;
895
- /**
896
- * Host to bind to (default: "0.0.0.0")
897
- */
898
- host?: string;
899
- /**
900
- * Existing HTTP server to attach to (attached mode)
901
- */
902
- server?: _agentxjs_core_network.MinimalHTTPServer;
903
- /**
904
- * WebSocket path when attached (default: "/ws")
905
- */
906
- wsPath?: string;
907
- /**
908
- * Enable debug logging
909
- */
910
- debug?: boolean;
911
- }
912
- /**
913
- * Create an AgentX server
914
- */
915
- declare function createServer(config: ServerConfig): Promise<AgentXServer>;
916
-
917
687
  /**
918
688
  * agentxjs - AgentX Client SDK
919
689
  *
@@ -925,7 +695,7 @@ declare function createServer(config: ServerConfig): Promise<AgentXServer>;
925
695
  * import { nodePlatform } from "@agentxjs/node-platform";
926
696
  *
927
697
  * const ax = createAgentX(nodePlatform({ createDriver }));
928
- * const agent = await ax.chat.create({ name: "Aristotle", embody: { model: "claude-sonnet-4-6" } });
698
+ * const agent = await ax.chat.create({ name: "Aristotle", model: "claude-sonnet-4-6" });
929
699
  * await agent.send("Hello!");
930
700
  * ```
931
701
  *
@@ -957,4 +727,4 @@ interface PlatformConfig {
957
727
  */
958
728
  declare function createAgentX(config?: PlatformConfig): AgentXBuilder;
959
729
 
960
- export { type AgentHandle, type AgentX, type AgentXBuilder, type AgentXServer, type AssistantConversation, type BaseResponse, type Block, type ChatNamespace, CommandHandler, type ConnectOptions, type ContainerCreateResponse, type ContainerGetResponse, type ContainerInfo, type ContainerListResponse, type ContainerNamespace, type Conversation, type Embodiment, type ErrorConversation, type ImageBlock, type ImageCreateResponse, type ImageGetResponse, type ImageListResponse, type ImageNamespace, type ImageRecord, type InstanceCreateResponse, type InstanceGetResponse, type InstanceInfo, type InstanceListResponse, type InstanceNamespace, 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 PrototypeCreateResponse, type PrototypeGetResponse, type PrototypeListResponse, type PrototypeNamespace, type PrototypeUpdateResponse, type RuntimeNamespace, type ServeConfig, type ServerConfig, type SessionNamespace, type TextBlock, type ToolBlock, type UserConversation, addUserConversation, createAgentX, createInitialState, createServer, initialPresentationState, messagesToConversations, presentationReducer };
730
+ export { type AgentConfig, type AgentHandle, type AgentX, type AgentXBuilder, type AgentXServer, type AssistantConversation, type BaseResponse, type Block, type ChatNamespace, type ConnectOptions, type Conversation, type ErrorConversation, type ImageBlock, type ImageCreateResponse, type ImageGetResponse, type ImageListResponse, type ImageNamespace, type ImageRecord, type ImageUpdateResponse, type InstanceCreateResponse, type InstanceGetResponse, type InstanceInfo, type InstanceListResponse, type InstanceNamespace, 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 RuntimeNamespace, type ServeConfig, type SessionNamespace, type TextBlock, type ToolBlock, type UserConversation, addUserConversation, createAgentX, createInitialState, initialPresentationState, messagesToConversations, presentationReducer };