@elizaos/plugin-xai 2.0.0-alpha.6 → 2.0.3-beta.5

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.
Files changed (96) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +43 -21
  3. package/auto-enable.ts +17 -0
  4. package/package.json +44 -102
  5. package/registry-entry.json +75 -0
  6. package/dist/actions/post.d.ts +0 -3
  7. package/dist/actions/post.d.ts.map +0 -1
  8. package/dist/base.d.ts +0 -55
  9. package/dist/base.d.ts.map +0 -1
  10. package/dist/browser/index.browser.js +0 -4
  11. package/dist/browser/index.browser.js.map +0 -11
  12. package/dist/browser/index.d.ts +0 -2
  13. package/dist/cjs/index.d.ts +0 -2
  14. package/dist/cjs/index.node.cjs +0 -11197
  15. package/dist/cjs/index.node.js.map +0 -116
  16. package/dist/client/api-types.d.ts +0 -28
  17. package/dist/client/api-types.d.ts.map +0 -1
  18. package/dist/client/auth-providers/broker.d.ts +0 -19
  19. package/dist/client/auth-providers/broker.d.ts.map +0 -1
  20. package/dist/client/auth-providers/env.d.ts +0 -20
  21. package/dist/client/auth-providers/env.d.ts.map +0 -1
  22. package/dist/client/auth-providers/factory.d.ts +0 -5
  23. package/dist/client/auth-providers/factory.d.ts.map +0 -1
  24. package/dist/client/auth-providers/interactive.d.ts +0 -7
  25. package/dist/client/auth-providers/interactive.d.ts.map +0 -1
  26. package/dist/client/auth-providers/oauth2-pkce.d.ts +0 -24
  27. package/dist/client/auth-providers/oauth2-pkce.d.ts.map +0 -1
  28. package/dist/client/auth-providers/pkce.d.ts +0 -5
  29. package/dist/client/auth-providers/pkce.d.ts.map +0 -1
  30. package/dist/client/auth-providers/token-store.d.ts +0 -31
  31. package/dist/client/auth-providers/token-store.d.ts.map +0 -1
  32. package/dist/client/auth-providers/types.d.ts +0 -35
  33. package/dist/client/auth-providers/types.d.ts.map +0 -1
  34. package/dist/client/auth.d.ts +0 -38
  35. package/dist/client/auth.d.ts.map +0 -1
  36. package/dist/client/client.d.ts +0 -462
  37. package/dist/client/client.d.ts.map +0 -1
  38. package/dist/client/errors.d.ts +0 -72
  39. package/dist/client/errors.d.ts.map +0 -1
  40. package/dist/client/index.d.ts +0 -21
  41. package/dist/client/index.d.ts.map +0 -1
  42. package/dist/client/posts.d.ts +0 -325
  43. package/dist/client/posts.d.ts.map +0 -1
  44. package/dist/client/profile.d.ts +0 -140
  45. package/dist/client/profile.d.ts.map +0 -1
  46. package/dist/client/relationships.d.ts +0 -47
  47. package/dist/client/relationships.d.ts.map +0 -1
  48. package/dist/client/search.d.ts +0 -48
  49. package/dist/client/search.d.ts.map +0 -1
  50. package/dist/client/types.d.ts +0 -24
  51. package/dist/client/types.d.ts.map +0 -1
  52. package/dist/constants.d.ts +0 -5
  53. package/dist/constants.d.ts.map +0 -1
  54. package/dist/discovery.d.ts +0 -37
  55. package/dist/discovery.d.ts.map +0 -1
  56. package/dist/environment.d.ts +0 -40
  57. package/dist/environment.d.ts.map +0 -1
  58. package/dist/generated/prompts/typescript/prompts.d.ts +0 -22
  59. package/dist/generated/prompts/typescript/prompts.d.ts.map +0 -1
  60. package/dist/generated/specs/spec-helpers.d.ts +0 -49
  61. package/dist/generated/specs/spec-helpers.d.ts.map +0 -1
  62. package/dist/generated/specs/specs.d.ts +0 -65
  63. package/dist/generated/specs/specs.d.ts.map +0 -1
  64. package/dist/index.browser.d.ts +0 -6
  65. package/dist/index.browser.d.ts.map +0 -1
  66. package/dist/index.d.ts +0 -5
  67. package/dist/index.d.ts.map +0 -1
  68. package/dist/index.node.d.ts +0 -3
  69. package/dist/index.node.d.ts.map +0 -1
  70. package/dist/interactions.d.ts +0 -129
  71. package/dist/interactions.d.ts.map +0 -1
  72. package/dist/models/grok.d.ts +0 -7
  73. package/dist/models/grok.d.ts.map +0 -1
  74. package/dist/node/index.d.ts +0 -2
  75. package/dist/node/index.node.js +0 -11212
  76. package/dist/node/index.node.js.map +0 -116
  77. package/dist/post.d.ts +0 -43
  78. package/dist/post.d.ts.map +0 -1
  79. package/dist/services/x.service.d.ts +0 -23
  80. package/dist/services/x.service.d.ts.map +0 -1
  81. package/dist/templates.d.ts +0 -6
  82. package/dist/templates.d.ts.map +0 -1
  83. package/dist/timeline.d.ts +0 -46
  84. package/dist/timeline.d.ts.map +0 -1
  85. package/dist/types.d.ts +0 -150
  86. package/dist/types.d.ts.map +0 -1
  87. package/dist/utils/error-handler.d.ts +0 -20
  88. package/dist/utils/error-handler.d.ts.map +0 -1
  89. package/dist/utils/memory.d.ts +0 -21
  90. package/dist/utils/memory.d.ts.map +0 -1
  91. package/dist/utils/settings.d.ts +0 -3
  92. package/dist/utils/settings.d.ts.map +0 -1
  93. package/dist/utils/time.d.ts +0 -2
  94. package/dist/utils/time.d.ts.map +0 -1
  95. package/dist/utils.d.ts +0 -36
  96. package/dist/utils.d.ts.map +0 -1
package/dist/post.d.ts DELETED
@@ -1,43 +0,0 @@
1
- import { type IAgentRuntime } from "@elizaos/core";
2
- import type { ClientBase } from "./base";
3
- /**
4
- * Class representing an X post client for generating and posting.
5
- */
6
- export declare class XPostClient {
7
- client: ClientBase;
8
- runtime: IAgentRuntime;
9
- xUsername: string;
10
- private isDryRun;
11
- private state;
12
- private isRunning;
13
- private isPosting;
14
- /**
15
- * Creates an instance of XPostClient.
16
- * @param {ClientBase} client - The client instance.
17
- * @param {IAgentRuntime} runtime - The runtime instance.
18
- * @param {Record<string, unknown>} state - The state object containing configuration settings
19
- */
20
- constructor(client: ClientBase, runtime: IAgentRuntime, state: Record<string, unknown>);
21
- /**
22
- * Stops the X post client
23
- */
24
- stop(): Promise<void>;
25
- /**
26
- * Starts the X post client, setting up a loop to periodically generate new posts.
27
- */
28
- start(): Promise<void>;
29
- /**
30
- * Handles the creation and posting of a post by emitting standardized events.
31
- * This approach aligns with our platform-independent architecture.
32
- * @returns {Promise<boolean>} true if post was posted successfully
33
- */
34
- generateNewPost(): Promise<boolean>;
35
- /**
36
- * Posts content to X
37
- * @param {string} text The post text to create
38
- * @param {MediaData[]} mediaData Optional media to attach to the post
39
- * @returns {Promise<PostResponse | null>} The result from the X API
40
- */
41
- private postToX;
42
- }
43
- //# sourceMappingURL=post.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../post.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EAMnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAWzC;;GAEG;AACH,qBAAa,WAAW;IACtB,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,aAAa,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,KAAK,CAA0B;IACvC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,SAAS,CAAkB;IAEnC;;;;;OAKG;gBACS,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAwCtF;;OAEG;IACG,IAAI;IAKV;;OAEG;IACG,KAAK;IA8DX;;;;OAIG;IACG,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IA2OzC;;;;;OAKG;YACW,OAAO;CA6BtB"}
@@ -1,23 +0,0 @@
1
- import { type IAgentRuntime, Service } from "@elizaos/core";
2
- import { ClientBase } from "../base";
3
- import { XDiscoveryClient } from "../discovery";
4
- import { XInteractionClient } from "../interactions";
5
- import { XPostClient } from "../post";
6
- import { XTimelineClient } from "../timeline";
7
- import type { IXClient } from "../types";
8
- export declare class XClientInstance implements IXClient {
9
- client: ClientBase;
10
- post?: XPostClient;
11
- interaction?: XInteractionClient;
12
- timeline?: XTimelineClient;
13
- discovery?: XDiscoveryClient;
14
- constructor(runtime: IAgentRuntime, state: Record<string, unknown>);
15
- }
16
- export declare class XService extends Service {
17
- static serviceType: string;
18
- capabilityDescription: string;
19
- xClient?: XClientInstance;
20
- static start(runtime: IAgentRuntime): Promise<XService>;
21
- stop(): Promise<void>;
22
- }
23
- //# sourceMappingURL=x.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"x.service.d.ts","sourceRoot":"","sources":["../../services/x.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAgC,OAAO,EAAE,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGzC,qBAAa,eAAgB,YAAW,QAAQ;IAC9C,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,SAAS,CAAC,EAAE,gBAAgB,CAAC;gBAEjB,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CA6BnE;AAED,qBAAa,QAAS,SAAQ,OAAO;IACnC,MAAM,CAAC,WAAW,SAAO;IACzB,qBAAqB,SAAoD;IAElE,OAAO,CAAC,EAAE,eAAe,CAAC;WAEpB,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC;IAkCvD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAO5B"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Re-export generated prompt templates
3
- * These are auto-generated from ./generated/prompts/typescript/prompts.ts
4
- */
5
- export { GENERATE_POST_TEMPLATE, generatePostTemplate, MESSAGE_HANDLER_TEMPLATE, messageHandlerTemplate, QUOTE_TWEET_TEMPLATE, quoteTweetTemplate, quoteTweetTemplate as quotePostTemplate, REPLY_TWEET_TEMPLATE, replyTweetTemplate, replyTweetTemplate as replyPostTemplate, X_ACTION_TEMPLATE, X_MESSAGE_HANDLER_TEMPLATE, xActionTemplate, xMessageHandlerTemplate, } from "./generated/prompts/typescript/prompts";
6
- //# sourceMappingURL=templates.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../templates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,IAAI,iBAAiB,EACvC,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,IAAI,iBAAiB,EACvC,iBAAiB,EACjB,0BAA0B,EAC1B,eAAe,EACf,uBAAuB,GACxB,MAAM,wCAAwC,CAAC"}
@@ -1,46 +0,0 @@
1
- import { type IAgentRuntime } from "@elizaos/core";
2
- import type { ClientBase } from "./base";
3
- import type { Client, Post } from "./client/index";
4
- declare enum TIMELINE_TYPE {
5
- ForYou = "foryou",
6
- Following = "following"
7
- }
8
- export declare class XTimelineClient {
9
- client: ClientBase;
10
- xClient: Client;
11
- runtime: IAgentRuntime;
12
- isDryRun: boolean;
13
- timelineType: TIMELINE_TYPE;
14
- private state;
15
- private isRunning;
16
- constructor(client: ClientBase, runtime: IAgentRuntime, state: Record<string, unknown>);
17
- start(): Promise<void>;
18
- stop(): Promise<void>;
19
- getTimeline(count: number): Promise<Post[]>;
20
- createPostId(runtime: IAgentRuntime, post: Post): string;
21
- formMessage(runtime: IAgentRuntime, post: Post): {
22
- id: string;
23
- agentId: string;
24
- content: {
25
- text: string | undefined;
26
- url: string | undefined;
27
- imageUrls: string[];
28
- inReplyTo: string | undefined;
29
- source: string;
30
- channelType: "GROUP";
31
- post: Record<string, string | number | boolean | null | undefined>;
32
- };
33
- entityId: string;
34
- roomId: string;
35
- createdAt: number;
36
- };
37
- handleTimeline(): Promise<void>;
38
- private processTimelineActions;
39
- private ensurePostWorldContext;
40
- handleLikeAction(post: Post): Promise<void>;
41
- handleRepostAction(post: Post): Promise<void>;
42
- handleQuoteAction(post: Post): Promise<void>;
43
- handleReplyAction(post: Post): Promise<void>;
44
- }
45
- export {};
46
- //# sourceMappingURL=timeline.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../timeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,aAAa,EAOnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAQnD,aAAK,aAAa;IAChB,MAAM,WAAW;IACjB,SAAS,cAAc;CACxB;AAED,qBAAa,eAAe;IAC1B,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,aAAa,CAAC;IAC5B,OAAO,CAAC,KAAK,CAA0B;IACvC,OAAO,CAAC,SAAS,CAAkB;gBAEvB,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAmBhF,KAAK;IAiCL,IAAI;IAKJ,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAWjD,YAAY,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI;IAO/C,WAAW,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI;;;;;;;;;;kBAuBnC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;;;;;;IAQjE,cAAc;YA+HN,sBAAsB;YA0GtB,sBAAsB;IAsB9B,gBAAgB,CAAC,IAAI,EAAE,IAAI;IAoB3B,kBAAkB,CAAC,IAAI,EAAE,IAAI;IAoB7B,iBAAiB,CAAC,IAAI,EAAE,IAAI;IA8E5B,iBAAiB,CAAC,IAAI,EAAE,IAAI;CA2DnC"}
package/dist/types.d.ts DELETED
@@ -1,150 +0,0 @@
1
- import type { IAgentRuntime, Memory } from "@elizaos/core";
2
- import type { Post as ClientPost } from "./client";
3
- export type { Post } from "./client";
4
- type Post = ClientPost;
5
- export type XServiceStatus = "idle" | "active" | "error";
6
- export interface XClientConfig {
7
- apiKey: string;
8
- apiSecret: string;
9
- accessToken: string;
10
- accessSecret: string;
11
- }
12
- export declare enum XEventTypes {
13
- MENTION_RECEIVED = "X_MENTION_RECEIVED",
14
- THREAD_CREATED = "X_THREAD_CREATED",
15
- THREAD_UPDATED = "X_THREAD_UPDATED",
16
- LIKE_RECEIVED = "X_LIKE_RECEIVED",
17
- REPOST_RECEIVED = "X_REPOST_RECEIVED",
18
- QUOTE_RECEIVED = "X_QUOTE_RECEIVED"
19
- }
20
- export interface XInteractionPayload {
21
- id: string;
22
- type: "like" | "repost" | "quote";
23
- userId: string;
24
- username: string;
25
- name: string;
26
- targetPostId?: string;
27
- targetPost: Post;
28
- quotePost?: Post;
29
- repostId?: string;
30
- }
31
- export interface XInteractionMemory extends Memory {
32
- content: {
33
- type: string;
34
- source: "x";
35
- };
36
- }
37
- export interface XMemory extends Memory {
38
- content: {
39
- text: string;
40
- source: "x";
41
- };
42
- }
43
- export interface XLikeReceivedPayload {
44
- runtime: IAgentRuntime;
45
- post: Post;
46
- user: {
47
- id: string;
48
- username: string;
49
- name: string;
50
- };
51
- source: "x";
52
- }
53
- export interface XRepostReceivedPayload {
54
- runtime: IAgentRuntime;
55
- post: Post;
56
- repostId: string;
57
- user: {
58
- id: string;
59
- username: string;
60
- name: string;
61
- };
62
- source: "x";
63
- }
64
- export interface XQuoteReceivedPayload {
65
- runtime: IAgentRuntime;
66
- quotedPost: Post;
67
- quotePost: Post;
68
- user: {
69
- id: string;
70
- username: string;
71
- name: string;
72
- };
73
- message: XMemory;
74
- callback: () => Promise<Memory[]>;
75
- reaction: {
76
- type: "quote";
77
- entityId: string;
78
- };
79
- source: "x";
80
- }
81
- export interface ActionResponse {
82
- text: string;
83
- actions: string[];
84
- like?: boolean;
85
- repost?: boolean;
86
- quote?: boolean;
87
- reply?: boolean;
88
- }
89
- export interface MediaData {
90
- data: Buffer | Uint8Array;
91
- type: string;
92
- filename?: string;
93
- }
94
- import type { ClientBase } from "./base";
95
- import type { XDiscoveryClient } from "./discovery";
96
- import type { XInteractionClient } from "./interactions";
97
- import type { XPostClient } from "./post";
98
- import type { XTimelineClient } from "./timeline";
99
- export interface IXClient {
100
- client: ClientBase;
101
- post?: XPostClient;
102
- interaction?: XInteractionClient;
103
- timeline?: XTimelineClient;
104
- discovery?: XDiscoveryClient;
105
- }
106
- export interface PostResponse {
107
- id?: string;
108
- rest_id?: string;
109
- data?: PostResponseData;
110
- }
111
- export interface PostResponseData {
112
- id?: string;
113
- data?: {
114
- id?: string;
115
- };
116
- create_post?: {
117
- post_results?: {
118
- result?: {
119
- rest_id?: string;
120
- };
121
- };
122
- };
123
- }
124
- export interface XApiResultShape {
125
- id?: string;
126
- rest_id?: string;
127
- data?: {
128
- id?: string;
129
- data?: {
130
- id?: string;
131
- };
132
- create_post?: {
133
- post_results?: {
134
- result?: {
135
- rest_id?: string;
136
- };
137
- };
138
- };
139
- };
140
- }
141
- export interface ResponseLike {
142
- json?: () => Promise<Record<string, unknown>>;
143
- clone?: () => ResponseLike;
144
- bodyUsed?: boolean;
145
- }
146
- export declare function isXApiResult(value: unknown): value is XApiResultShape;
147
- export declare function isResponseLike(value: unknown): value is ResponseLike;
148
- export declare function extractIdFromResult(result: unknown): string | undefined;
149
- export declare function extractRestId(result: unknown): string | undefined;
150
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,UAAU,CAAC;AAEnD,YAAY,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAErC,KAAK,IAAI,GAAG,UAAU,CAAC;AAEvB,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEzD,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,oBAAY,WAAW;IACrB,gBAAgB,uBAAuB;IACvC,cAAc,qBAAqB;IACnC,cAAc,qBAAqB;IACnC,aAAa,oBAAoB;IACjC,eAAe,sBAAsB;IACrC,cAAc,qBAAqB;CACpC;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAmB,SAAQ,MAAM;IAChD,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,GAAG,CAAC;KACb,CAAC;CACH;AAED,MAAM,WAAW,O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AC,EAAE;QACL,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,IAAI,CAAC,EAAE;YACL,EAAE,CAAC,EAAE,MAAM,CAAC;SACb,CAAC;QACF,WAAW,CAAC,EAAE;YACZ,YAAY,CAAC,EAAE;gBACb,MAAM,CAAC,EAAE;oBACP,OAAO,CAAC,EAAE,MAAM,CAAC;iBAClB,CAAC;aACH,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,YAAY,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAErE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAYvE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAUjE"}
@@ -1,20 +0,0 @@
1
- export declare enum XErrorType {
2
- AUTH = "AUTH",
3
- RATE_LIMIT = "RATE_LIMIT",
4
- API = "API",
5
- NETWORK = "NETWORK",
6
- MEDIA = "MEDIA",
7
- VALIDATION = "VALIDATION",
8
- UNKNOWN = "UNKNOWN"
9
- }
10
- export declare class XError extends Error {
11
- type: XErrorType;
12
- originalError?: unknown | undefined;
13
- details?: Record<string, unknown> | undefined;
14
- constructor(type: XErrorType, message: string, originalError?: unknown | undefined, details?: Record<string, unknown> | undefined);
15
- }
16
- export declare function getErrorType(error: unknown): XErrorType;
17
- export declare function handleXError(context: string, error: unknown, throwError?: boolean): XError | null;
18
- export declare function isRetryableError(error: XError | unknown): boolean;
19
- export declare function getRetryDelay(error: XError | unknown, attempt: number): number;
20
- //# sourceMappingURL=error-handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../utils/error-handler.ts"],"names":[],"mappings":"AAEA,oBAAY,UAAU;IACpB,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,UAAU,eAAe;IACzB,OAAO,YAAY;CACpB;AAED,qBAAa,MAAO,SAAQ,KAAK;IAEtB,IAAI,EAAE,UAAU;IAEhB,aAAa,CAAC,EAAE,OAAO;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBAHjC,IAAI,EAAE,UAAU,EACvB,OAAO,EAAE,MAAM,EACR,aAAa,CAAC,EAAE,OAAO,YAAA,EACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAA;CAK3C;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAkCvD;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,UAAQ,GAAG,MAAM,GAAG,IAAI,CAgC/F;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAOjE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAS9E"}
@@ -1,21 +0,0 @@
1
- import { type IAgentRuntime, type Memory, type UUID } from "@elizaos/core";
2
- import type { Post as ClientPost } from "../client";
3
- export interface XContextOptions {
4
- post?: ClientPost;
5
- userId: string;
6
- username: string;
7
- name?: string;
8
- conversationId?: string;
9
- }
10
- export interface XContextResult {
11
- worldId: UUID;
12
- roomId: UUID;
13
- entityId: UUID;
14
- }
15
- export declare function ensureXContext(runtime: IAgentRuntime, options: XContextOptions): Promise<XContextResult>;
16
- export declare function createMemorySafe(runtime: IAgentRuntime, memory: Memory, tableName?: string, maxRetries?: number): Promise<void>;
17
- export declare function isPostProcessed(runtime: IAgentRuntime, postId: string): Promise<boolean>;
18
- export declare function getRecentPosts(runtime: IAgentRuntime, username: string, _count?: number): Promise<string[]>;
19
- export declare function addToRecentPosts(runtime: IAgentRuntime, username: string, postText: string, maxRecent?: number): Promise<void>;
20
- export declare function isDuplicatePost(runtime: IAgentRuntime, username: string, postText: string, _similarityThreshold?: number): Promise<boolean>;
21
- //# sourceMappingURL=memory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../utils/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EAElB,KAAK,MAAM,EACX,KAAK,IAAI,EACV,MAAM,eAAe,CAAC;AAKvB,OAAO,KAAK,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,WAAW,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,IAAI,CAAC;IACb,QAAQ,EAAE,IAAI,CAAC;CAChB;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,CAAC,CAsDzB;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,MAAmB,EAC9B,UAAU,GAAE,MAAU,GACrB,OAAO,CAAC,IAAI,CAAC,CA8Bf;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAU9F;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,MAAW,GAClB,OAAO,CAAC,MAAM,EAAE,CAAC,CAenB;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,MAAW,GACrB,OAAO,CAAC,IAAI,CAAC,CAaf;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,oBAAoB,GAAE,MAAY,GACjC,OAAO,CAAC,OAAO,CAAC,CA2BlB"}
@@ -1,3 +0,0 @@
1
- import type { IAgentRuntime } from "@elizaos/core";
2
- export declare function getSetting(runtime: IAgentRuntime | null | undefined, key: string, defaultValue?: string): string | undefined;
3
- //# sourceMappingURL=settings.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../utils/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,wBAAgB,UAAU,CACxB,OAAO,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,EACzC,GAAG,EAAE,MAAM,EACX,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,GAAG,SAAS,CASpB"}
@@ -1,2 +0,0 @@
1
- export declare function getEpochMs(ts: number | undefined): number;
2
- //# sourceMappingURL=time.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../utils/time.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAoBzD"}
package/dist/utils.d.ts DELETED
@@ -1,36 +0,0 @@
1
- import type { Media } from "@elizaos/core";
2
- import { type Content, type Memory, type UUID } from "@elizaos/core";
3
- import type { ClientBase } from "./base";
4
- import type { Post } from "./client";
5
- import type { ActionResponse, MediaData, PostResponse } from "./types";
6
- export declare const wait: (minTime?: number, maxTime?: number) => Promise<unknown>;
7
- export declare const isValidPost: (post: Post) => boolean;
8
- export declare function fetchMediaData(attachments: Media[]): Promise<MediaData[]>;
9
- export declare function sendStandardPost(client: ClientBase, content: string, postId?: string, mediaData?: MediaData[]): Promise<{
10
- ok: boolean;
11
- json: () => Promise<import("twitter-api-v2").TweetV2PostTweetResult>;
12
- data: import("twitter-api-v2").TweetV2PostTweetResult;
13
- }>;
14
- export declare function sendPost(client: ClientBase, text: string, mediaData?: MediaData[], postToReplyTo?: string): Promise<PostResponse | null>;
15
- /**
16
- * Sends a post on X using the given client.
17
- *
18
- * @param {ClientBase} client The client used to send the post.
19
- * @param {Content} content The content of the post.
20
- * @param {UUID} roomId The ID of the room where the post will be sent.
21
- * @param {string} xUsername The X username of the sender.
22
- * @param {string} inReplyTo The ID of the post to which the new post will reply.
23
- * @returns {Promise<Memory[]>} An array of memories representing the sent posts.
24
- */
25
- export declare function sendChunkedPost(client: ClientBase, content: Content, roomId: UUID, xUsername: string, inReplyTo: string): Promise<Memory[]>;
26
- /**
27
- * Parses the action response from the given text.
28
- *
29
- * @param {string} text - The text to parse actions from.
30
- * @returns {{ actions: ActionResponse }} The parsed actions with boolean values indicating if each action is present in the text.
31
- */
32
- export declare const parseActionResponseFromText: (text: string) => {
33
- actions: ActionResponse;
34
- };
35
- export * from "./utils/error-handler";
36
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,KAAK,OAAO,EAGZ,KAAK,MAAM,EAEX,KAAK,IAAI,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