@moltium/core 0.1.20 → 0.1.22

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.cts CHANGED
@@ -133,6 +133,15 @@ interface AgentConfig {
133
133
  actions: string[];
134
134
  customActions?: Action[];
135
135
  scheduling?: ScheduledTask[];
136
+ /** World SDK integration — connect this agent to a world */
137
+ world?: {
138
+ /** URL of the world to join */
139
+ url: string;
140
+ /** Wallet address for blockchain-enabled worlds */
141
+ walletAddress?: string;
142
+ /** Auto-join the world when agent starts (default: true) */
143
+ autoJoin?: boolean;
144
+ };
136
145
  webhooks?: {
137
146
  onAction?: string | ((action: any, result: any) => Promise<void>);
138
147
  onError?: string;
@@ -538,6 +547,7 @@ declare class Agent {
538
547
  private scheduledPost;
539
548
  private executeScheduledTask;
540
549
  private logPlatformError;
550
+ private autoJoinWorld;
541
551
  private startAutonomousLoop;
542
552
  private isSleeping;
543
553
  private gatherContext;
@@ -585,6 +595,7 @@ declare class MarkdownParser {
585
595
  private parseSocial;
586
596
  private parseBehaviors;
587
597
  private parseMemory;
598
+ private parseWorld;
588
599
  private parseSleepSchedule;
589
600
  private parseKeyValueLines;
590
601
  private parseScheduling;
@@ -768,6 +779,48 @@ declare function createMarkdownAction(name: string, description: string, llmProv
768
779
  /** All Moltbook-specific actions */
769
780
  declare const moltbookActions: Action[];
770
781
 
782
+ /**
783
+ * ============================================================================
784
+ * WORLD SDK BUILT-IN ACTIONS
785
+ * ============================================================================
786
+ *
787
+ * Built-in actions for agents to interact with worlds created using
788
+ * @moltium/world-core. These use plain HTTP to call the world's REST endpoints.
789
+ */
790
+ /**
791
+ * Creates a join_world action that POSTs to a world's /world/join endpoint
792
+ */
793
+ declare function createJoinWorldAction(config?: {
794
+ defaultWorldUrl?: string;
795
+ }): Action;
796
+ /**
797
+ * Creates a leave_world action that DELETEs from a world's /world/agents endpoint
798
+ */
799
+ declare function createLeaveWorldAction(config?: {
800
+ defaultWorldUrl?: string;
801
+ }): Action;
802
+ /**
803
+ * Creates a query_world action that GETs world state and info
804
+ */
805
+ declare function createQueryWorldAction(config?: {
806
+ defaultWorldUrl?: string;
807
+ }): Action;
808
+ /**
809
+ * Creates a send_world_message action for agent-to-agent messaging through a world
810
+ */
811
+ declare function createSendWorldMessageAction(config?: {
812
+ defaultWorldUrl?: string;
813
+ }): Action;
814
+ /**
815
+ * All world actions as a convenience array
816
+ */
817
+ declare const worldActions: {
818
+ createJoinWorldAction: typeof createJoinWorldAction;
819
+ createLeaveWorldAction: typeof createLeaveWorldAction;
820
+ createQueryWorldAction: typeof createQueryWorldAction;
821
+ createSendWorldMessageAction: typeof createSendWorldMessageAction;
822
+ };
823
+
771
824
  declare const builtInActions: Action[];
772
825
 
773
826
  interface A2AConfig {
@@ -891,6 +944,126 @@ declare class A2AIntegration {
891
944
  */
892
945
  declare function createA2AIntegration(agent: Agent, options?: Partial<A2AServerOptions>): A2AIntegration;
893
946
 
947
+ /**
948
+ * Configuration for A2A client operations
949
+ */
950
+ interface A2AClientConfig {
951
+ /**
952
+ * The base URL of the target agent
953
+ * @example 'http://localhost:3001'
954
+ */
955
+ agentUrl: string;
956
+ /**
957
+ * Path to the agent card (defaults to '.well-known/agent-card.json')
958
+ */
959
+ agentCardPath?: string;
960
+ /**
961
+ * Timeout for requests in milliseconds (optional)
962
+ */
963
+ timeout?: number;
964
+ }
965
+ /**
966
+ * Options for sending messages via A2A
967
+ */
968
+ interface A2AMessageOptions {
969
+ /**
970
+ * The text message to send
971
+ */
972
+ text: string;
973
+ /**
974
+ * Optional context ID to group related messages
975
+ */
976
+ contextId?: string;
977
+ /**
978
+ * Optional metadata for extensions
979
+ */
980
+ metadata?: Record<string, unknown>;
981
+ }
982
+ /**
983
+ * Response from an A2A message
984
+ */
985
+ interface A2AMessageResponse {
986
+ /**
987
+ * Whether the message was successfully sent and received
988
+ */
989
+ success: boolean;
990
+ /**
991
+ * The reply text from the agent (if successful)
992
+ */
993
+ reply?: string;
994
+ /**
995
+ * The agent URL that responded
996
+ */
997
+ agentUrl?: string;
998
+ /**
999
+ * Error message (if failed)
1000
+ */
1001
+ error?: string;
1002
+ /**
1003
+ * Raw response from the A2A protocol (for advanced use)
1004
+ */
1005
+ raw?: any;
1006
+ }
1007
+ /**
1008
+ * Wrapper around A2A Client SDK with improved developer experience
1009
+ *
1010
+ * @example
1011
+ * ```typescript
1012
+ * const client = new A2AClient({ agentUrl: 'http://localhost:3001' });
1013
+ * const response = await client.sendMessage({ text: 'Hello!' });
1014
+ * console.log(response.reply);
1015
+ * ```
1016
+ */
1017
+ declare class A2AClient {
1018
+ private sdkClient;
1019
+ private config;
1020
+ constructor(config: A2AClientConfig);
1021
+ /**
1022
+ * Send a text message to the agent and get a response
1023
+ *
1024
+ * @param options Message options including text content
1025
+ * @returns Promise resolving to the agent's response
1026
+ *
1027
+ * @example
1028
+ * ```typescript
1029
+ * const response = await client.sendMessage({
1030
+ * text: 'What are your thoughts on AI?',
1031
+ * contextId: 'conversation-123'
1032
+ * });
1033
+ *
1034
+ * if (response.success) {
1035
+ * console.log('Agent replied:', response.reply);
1036
+ * }
1037
+ * ```
1038
+ */
1039
+ sendMessage(options: A2AMessageOptions): Promise<A2AMessageResponse>;
1040
+ /**
1041
+ * Extract text reply from A2A protocol response
1042
+ * Handles both Message and Task response types
1043
+ */
1044
+ private extractReply;
1045
+ /**
1046
+ * Get the agent card information
1047
+ *
1048
+ * @returns Promise resolving to the agent card
1049
+ */
1050
+ getAgentCard(): Promise<any>;
1051
+ /**
1052
+ * Get the base URL of the agent
1053
+ */
1054
+ getAgentUrl(): string;
1055
+ }
1056
+ /**
1057
+ * Factory function to create A2A clients easily
1058
+ *
1059
+ * @example
1060
+ * ```typescript
1061
+ * const client = createA2AClient('http://localhost:3001');
1062
+ * const response = await client.sendMessage({ text: 'Hello!' });
1063
+ * ```
1064
+ */
1065
+ declare function createA2AClient(agentUrlOrConfig: string | A2AClientConfig): A2AClient;
1066
+
894
1067
  interface ServerOptions {
895
1068
  port?: number;
896
1069
  host?: string;
@@ -904,4 +1077,4 @@ declare function createRoutes(agent: Agent): Router;
904
1077
 
905
1078
  declare function createLogger(label: string): winston.Logger;
906
1079
 
907
- export { type A2AConfig, A2AIntegration, type A2AServerOptions, type Action, type ActionContext, ActionHandler, ActionRegistry, type ActionResult, Agent, AgentCardBuilder, type AgentConfig, type AgentState, AnthropicProvider, type BehaviorTrigger, type Comment, ConfigLoader, type ConfigType, type Conversation, type ConversationDetail, type CustomAPIConfig, type CustomCLIConfig, type CustomDeploymentConfig, type CustomDockerConfig, type CustomSSHConfig, type DMCheckResult, type DMRequest, type Decision, type DeploymentConfig, type DeploymentResult, type DeploymentStatus, type DirectMessage, type Experience, type FeedOptions, type GenerateOptions, LLMProvider, type LifecycleEvent, type LifecycleHooks, LongTermMemory, MarkdownParser, Memory, type Mention, type Message, MoltbookAdapter, type MoltbookConfig, type MoltbookRegistration, type MoltbookStatus, MoltiumExecutor, OpenAIProvider, type Plugin, type Post, type PostResult, type PostgresConfig, type Profile, type RedisConfig, type ReplyResult, type ScheduledJob, type ScheduledTask, Scheduler, type SearchOptions, type SearchResult, type ServerOptions, ShortTermMemory, SocialAdapter, type SocialConfig, type SocialPlatformConfig, type StructuredSchema, type Submolt, type SubmoltSettings, type TimelineOptions, TwitterAdapter, type TwitterConfig, buildDecisionPrompt, buildSkillPrompt, buildSystemPrompt, builtInActions, createA2AIntegration, createApp, createLogger, createMarkdownAction, createRoutes, moltbookActions, startServer, validateConfig };
1080
+ export { A2AClient, type A2AClientConfig, type A2AConfig, A2AIntegration, type A2AMessageOptions, type A2AMessageResponse, type A2AServerOptions, type Action, type ActionContext, ActionHandler, ActionRegistry, type ActionResult, Agent, AgentCardBuilder, type AgentConfig, type AgentState, AnthropicProvider, type BehaviorTrigger, type Comment, ConfigLoader, type ConfigType, type Conversation, type ConversationDetail, type CustomAPIConfig, type CustomCLIConfig, type CustomDeploymentConfig, type CustomDockerConfig, type CustomSSHConfig, type DMCheckResult, type DMRequest, type Decision, type DeploymentConfig, type DeploymentResult, type DeploymentStatus, type DirectMessage, type Experience, type FeedOptions, type GenerateOptions, LLMProvider, type LifecycleEvent, type LifecycleHooks, LongTermMemory, MarkdownParser, Memory, type Mention, type Message, MoltbookAdapter, type MoltbookConfig, type MoltbookRegistration, type MoltbookStatus, MoltiumExecutor, OpenAIProvider, type Plugin, type Post, type PostResult, type PostgresConfig, type Profile, type RedisConfig, type ReplyResult, type ScheduledJob, type ScheduledTask, Scheduler, type SearchOptions, type SearchResult, type ServerOptions, ShortTermMemory, SocialAdapter, type SocialConfig, type SocialPlatformConfig, type StructuredSchema, type Submolt, type SubmoltSettings, type TimelineOptions, TwitterAdapter, type TwitterConfig, buildDecisionPrompt, buildSkillPrompt, buildSystemPrompt, builtInActions, createA2AClient, createA2AIntegration, createApp, createJoinWorldAction, createLeaveWorldAction, createLogger, createMarkdownAction, createQueryWorldAction, createRoutes, createSendWorldMessageAction, moltbookActions, startServer, validateConfig, worldActions };
package/dist/index.d.ts CHANGED
@@ -133,6 +133,15 @@ interface AgentConfig {
133
133
  actions: string[];
134
134
  customActions?: Action[];
135
135
  scheduling?: ScheduledTask[];
136
+ /** World SDK integration — connect this agent to a world */
137
+ world?: {
138
+ /** URL of the world to join */
139
+ url: string;
140
+ /** Wallet address for blockchain-enabled worlds */
141
+ walletAddress?: string;
142
+ /** Auto-join the world when agent starts (default: true) */
143
+ autoJoin?: boolean;
144
+ };
136
145
  webhooks?: {
137
146
  onAction?: string | ((action: any, result: any) => Promise<void>);
138
147
  onError?: string;
@@ -538,6 +547,7 @@ declare class Agent {
538
547
  private scheduledPost;
539
548
  private executeScheduledTask;
540
549
  private logPlatformError;
550
+ private autoJoinWorld;
541
551
  private startAutonomousLoop;
542
552
  private isSleeping;
543
553
  private gatherContext;
@@ -585,6 +595,7 @@ declare class MarkdownParser {
585
595
  private parseSocial;
586
596
  private parseBehaviors;
587
597
  private parseMemory;
598
+ private parseWorld;
588
599
  private parseSleepSchedule;
589
600
  private parseKeyValueLines;
590
601
  private parseScheduling;
@@ -768,6 +779,48 @@ declare function createMarkdownAction(name: string, description: string, llmProv
768
779
  /** All Moltbook-specific actions */
769
780
  declare const moltbookActions: Action[];
770
781
 
782
+ /**
783
+ * ============================================================================
784
+ * WORLD SDK BUILT-IN ACTIONS
785
+ * ============================================================================
786
+ *
787
+ * Built-in actions for agents to interact with worlds created using
788
+ * @moltium/world-core. These use plain HTTP to call the world's REST endpoints.
789
+ */
790
+ /**
791
+ * Creates a join_world action that POSTs to a world's /world/join endpoint
792
+ */
793
+ declare function createJoinWorldAction(config?: {
794
+ defaultWorldUrl?: string;
795
+ }): Action;
796
+ /**
797
+ * Creates a leave_world action that DELETEs from a world's /world/agents endpoint
798
+ */
799
+ declare function createLeaveWorldAction(config?: {
800
+ defaultWorldUrl?: string;
801
+ }): Action;
802
+ /**
803
+ * Creates a query_world action that GETs world state and info
804
+ */
805
+ declare function createQueryWorldAction(config?: {
806
+ defaultWorldUrl?: string;
807
+ }): Action;
808
+ /**
809
+ * Creates a send_world_message action for agent-to-agent messaging through a world
810
+ */
811
+ declare function createSendWorldMessageAction(config?: {
812
+ defaultWorldUrl?: string;
813
+ }): Action;
814
+ /**
815
+ * All world actions as a convenience array
816
+ */
817
+ declare const worldActions: {
818
+ createJoinWorldAction: typeof createJoinWorldAction;
819
+ createLeaveWorldAction: typeof createLeaveWorldAction;
820
+ createQueryWorldAction: typeof createQueryWorldAction;
821
+ createSendWorldMessageAction: typeof createSendWorldMessageAction;
822
+ };
823
+
771
824
  declare const builtInActions: Action[];
772
825
 
773
826
  interface A2AConfig {
@@ -891,6 +944,126 @@ declare class A2AIntegration {
891
944
  */
892
945
  declare function createA2AIntegration(agent: Agent, options?: Partial<A2AServerOptions>): A2AIntegration;
893
946
 
947
+ /**
948
+ * Configuration for A2A client operations
949
+ */
950
+ interface A2AClientConfig {
951
+ /**
952
+ * The base URL of the target agent
953
+ * @example 'http://localhost:3001'
954
+ */
955
+ agentUrl: string;
956
+ /**
957
+ * Path to the agent card (defaults to '.well-known/agent-card.json')
958
+ */
959
+ agentCardPath?: string;
960
+ /**
961
+ * Timeout for requests in milliseconds (optional)
962
+ */
963
+ timeout?: number;
964
+ }
965
+ /**
966
+ * Options for sending messages via A2A
967
+ */
968
+ interface A2AMessageOptions {
969
+ /**
970
+ * The text message to send
971
+ */
972
+ text: string;
973
+ /**
974
+ * Optional context ID to group related messages
975
+ */
976
+ contextId?: string;
977
+ /**
978
+ * Optional metadata for extensions
979
+ */
980
+ metadata?: Record<string, unknown>;
981
+ }
982
+ /**
983
+ * Response from an A2A message
984
+ */
985
+ interface A2AMessageResponse {
986
+ /**
987
+ * Whether the message was successfully sent and received
988
+ */
989
+ success: boolean;
990
+ /**
991
+ * The reply text from the agent (if successful)
992
+ */
993
+ reply?: string;
994
+ /**
995
+ * The agent URL that responded
996
+ */
997
+ agentUrl?: string;
998
+ /**
999
+ * Error message (if failed)
1000
+ */
1001
+ error?: string;
1002
+ /**
1003
+ * Raw response from the A2A protocol (for advanced use)
1004
+ */
1005
+ raw?: any;
1006
+ }
1007
+ /**
1008
+ * Wrapper around A2A Client SDK with improved developer experience
1009
+ *
1010
+ * @example
1011
+ * ```typescript
1012
+ * const client = new A2AClient({ agentUrl: 'http://localhost:3001' });
1013
+ * const response = await client.sendMessage({ text: 'Hello!' });
1014
+ * console.log(response.reply);
1015
+ * ```
1016
+ */
1017
+ declare class A2AClient {
1018
+ private sdkClient;
1019
+ private config;
1020
+ constructor(config: A2AClientConfig);
1021
+ /**
1022
+ * Send a text message to the agent and get a response
1023
+ *
1024
+ * @param options Message options including text content
1025
+ * @returns Promise resolving to the agent's response
1026
+ *
1027
+ * @example
1028
+ * ```typescript
1029
+ * const response = await client.sendMessage({
1030
+ * text: 'What are your thoughts on AI?',
1031
+ * contextId: 'conversation-123'
1032
+ * });
1033
+ *
1034
+ * if (response.success) {
1035
+ * console.log('Agent replied:', response.reply);
1036
+ * }
1037
+ * ```
1038
+ */
1039
+ sendMessage(options: A2AMessageOptions): Promise<A2AMessageResponse>;
1040
+ /**
1041
+ * Extract text reply from A2A protocol response
1042
+ * Handles both Message and Task response types
1043
+ */
1044
+ private extractReply;
1045
+ /**
1046
+ * Get the agent card information
1047
+ *
1048
+ * @returns Promise resolving to the agent card
1049
+ */
1050
+ getAgentCard(): Promise<any>;
1051
+ /**
1052
+ * Get the base URL of the agent
1053
+ */
1054
+ getAgentUrl(): string;
1055
+ }
1056
+ /**
1057
+ * Factory function to create A2A clients easily
1058
+ *
1059
+ * @example
1060
+ * ```typescript
1061
+ * const client = createA2AClient('http://localhost:3001');
1062
+ * const response = await client.sendMessage({ text: 'Hello!' });
1063
+ * ```
1064
+ */
1065
+ declare function createA2AClient(agentUrlOrConfig: string | A2AClientConfig): A2AClient;
1066
+
894
1067
  interface ServerOptions {
895
1068
  port?: number;
896
1069
  host?: string;
@@ -904,4 +1077,4 @@ declare function createRoutes(agent: Agent): Router;
904
1077
 
905
1078
  declare function createLogger(label: string): winston.Logger;
906
1079
 
907
- export { type A2AConfig, A2AIntegration, type A2AServerOptions, type Action, type ActionContext, ActionHandler, ActionRegistry, type ActionResult, Agent, AgentCardBuilder, type AgentConfig, type AgentState, AnthropicProvider, type BehaviorTrigger, type Comment, ConfigLoader, type ConfigType, type Conversation, type ConversationDetail, type CustomAPIConfig, type CustomCLIConfig, type CustomDeploymentConfig, type CustomDockerConfig, type CustomSSHConfig, type DMCheckResult, type DMRequest, type Decision, type DeploymentConfig, type DeploymentResult, type DeploymentStatus, type DirectMessage, type Experience, type FeedOptions, type GenerateOptions, LLMProvider, type LifecycleEvent, type LifecycleHooks, LongTermMemory, MarkdownParser, Memory, type Mention, type Message, MoltbookAdapter, type MoltbookConfig, type MoltbookRegistration, type MoltbookStatus, MoltiumExecutor, OpenAIProvider, type Plugin, type Post, type PostResult, type PostgresConfig, type Profile, type RedisConfig, type ReplyResult, type ScheduledJob, type ScheduledTask, Scheduler, type SearchOptions, type SearchResult, type ServerOptions, ShortTermMemory, SocialAdapter, type SocialConfig, type SocialPlatformConfig, type StructuredSchema, type Submolt, type SubmoltSettings, type TimelineOptions, TwitterAdapter, type TwitterConfig, buildDecisionPrompt, buildSkillPrompt, buildSystemPrompt, builtInActions, createA2AIntegration, createApp, createLogger, createMarkdownAction, createRoutes, moltbookActions, startServer, validateConfig };
1080
+ export { A2AClient, type A2AClientConfig, type A2AConfig, A2AIntegration, type A2AMessageOptions, type A2AMessageResponse, type A2AServerOptions, type Action, type ActionContext, ActionHandler, ActionRegistry, type ActionResult, Agent, AgentCardBuilder, type AgentConfig, type AgentState, AnthropicProvider, type BehaviorTrigger, type Comment, ConfigLoader, type ConfigType, type Conversation, type ConversationDetail, type CustomAPIConfig, type CustomCLIConfig, type CustomDeploymentConfig, type CustomDockerConfig, type CustomSSHConfig, type DMCheckResult, type DMRequest, type Decision, type DeploymentConfig, type DeploymentResult, type DeploymentStatus, type DirectMessage, type Experience, type FeedOptions, type GenerateOptions, LLMProvider, type LifecycleEvent, type LifecycleHooks, LongTermMemory, MarkdownParser, Memory, type Mention, type Message, MoltbookAdapter, type MoltbookConfig, type MoltbookRegistration, type MoltbookStatus, MoltiumExecutor, OpenAIProvider, type Plugin, type Post, type PostResult, type PostgresConfig, type Profile, type RedisConfig, type ReplyResult, type ScheduledJob, type ScheduledTask, Scheduler, type SearchOptions, type SearchResult, type ServerOptions, ShortTermMemory, SocialAdapter, type SocialConfig, type SocialPlatformConfig, type StructuredSchema, type Submolt, type SubmoltSettings, type TimelineOptions, TwitterAdapter, type TwitterConfig, buildDecisionPrompt, buildSkillPrompt, buildSystemPrompt, builtInActions, createA2AClient, createA2AIntegration, createApp, createJoinWorldAction, createLeaveWorldAction, createLogger, createMarkdownAction, createQueryWorldAction, createRoutes, createSendWorldMessageAction, moltbookActions, startServer, validateConfig, worldActions };