@elizaos/plugin-xai 2.0.0-alpha.1
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 +47 -0
- package/dist/actions/post.d.ts +3 -0
- package/dist/actions/post.d.ts.map +1 -0
- package/dist/base.d.ts +55 -0
- package/dist/base.d.ts.map +1 -0
- package/dist/browser/index.browser.js +4 -0
- package/dist/browser/index.browser.js.map +11 -0
- package/dist/browser/index.d.ts +2 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.node.cjs +11176 -0
- package/dist/cjs/index.node.js.map +116 -0
- package/dist/client/api-types.d.ts +28 -0
- package/dist/client/api-types.d.ts.map +1 -0
- package/dist/client/auth-providers/broker.d.ts +19 -0
- package/dist/client/auth-providers/broker.d.ts.map +1 -0
- package/dist/client/auth-providers/env.d.ts +20 -0
- package/dist/client/auth-providers/env.d.ts.map +1 -0
- package/dist/client/auth-providers/factory.d.ts +5 -0
- package/dist/client/auth-providers/factory.d.ts.map +1 -0
- package/dist/client/auth-providers/interactive.d.ts +7 -0
- package/dist/client/auth-providers/interactive.d.ts.map +1 -0
- package/dist/client/auth-providers/oauth2-pkce.d.ts +24 -0
- package/dist/client/auth-providers/oauth2-pkce.d.ts.map +1 -0
- package/dist/client/auth-providers/pkce.d.ts +5 -0
- package/dist/client/auth-providers/pkce.d.ts.map +1 -0
- package/dist/client/auth-providers/token-store.d.ts +31 -0
- package/dist/client/auth-providers/token-store.d.ts.map +1 -0
- package/dist/client/auth-providers/types.d.ts +35 -0
- package/dist/client/auth-providers/types.d.ts.map +1 -0
- package/dist/client/auth.d.ts +38 -0
- package/dist/client/auth.d.ts.map +1 -0
- package/dist/client/client.d.ts +462 -0
- package/dist/client/client.d.ts.map +1 -0
- package/dist/client/errors.d.ts +72 -0
- package/dist/client/errors.d.ts.map +1 -0
- package/dist/client/index.d.ts +21 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/posts.d.ts +325 -0
- package/dist/client/posts.d.ts.map +1 -0
- package/dist/client/profile.d.ts +140 -0
- package/dist/client/profile.d.ts.map +1 -0
- package/dist/client/relationships.d.ts +47 -0
- package/dist/client/relationships.d.ts.map +1 -0
- package/dist/client/search.d.ts +48 -0
- package/dist/client/search.d.ts.map +1 -0
- package/dist/client/types.d.ts +24 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/discovery.d.ts +37 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/environment.d.ts +40 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/generated/prompts/typescript/prompts.d.ts +22 -0
- package/dist/generated/prompts/typescript/prompts.d.ts.map +1 -0
- package/dist/generated/specs/spec-helpers.d.ts +49 -0
- package/dist/generated/specs/spec-helpers.d.ts.map +1 -0
- package/dist/generated/specs/specs.d.ts +65 -0
- package/dist/generated/specs/specs.d.ts.map +1 -0
- package/dist/index.browser.d.ts +6 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.node.d.ts +3 -0
- package/dist/index.node.d.ts.map +1 -0
- package/dist/interactions.d.ts +129 -0
- package/dist/interactions.d.ts.map +1 -0
- package/dist/models/grok.d.ts +7 -0
- package/dist/models/grok.d.ts.map +1 -0
- package/dist/node/index.d.ts +2 -0
- package/dist/node/index.node.js +11191 -0
- package/dist/node/index.node.js.map +116 -0
- package/dist/post.d.ts +43 -0
- package/dist/post.d.ts.map +1 -0
- package/dist/services/x.service.d.ts +23 -0
- package/dist/services/x.service.d.ts.map +1 -0
- package/dist/templates.d.ts +6 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/timeline.d.ts +46 -0
- package/dist/timeline.d.ts.map +1 -0
- package/dist/types.d.ts +150 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/error-handler.d.ts +20 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/memory.d.ts +21 -0
- package/dist/utils/memory.d.ts.map +1 -0
- package/dist/utils/settings.d.ts +3 -0
- package/dist/utils/settings.d.ts.map +1 -0
- package/dist/utils/time.d.ts +2 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/dist/utils.d.ts +36 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +193 -0
package/dist/post.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ChannelType, 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}-${string}-${string}-${string}-${string}`;
|
|
21
|
+
formMessage(runtime: IAgentRuntime, post: Post): {
|
|
22
|
+
id: `${string}-${string}-${string}-${string}-${string}`;
|
|
23
|
+
agentId: `${string}-${string}-${string}-${string}-${string}`;
|
|
24
|
+
content: {
|
|
25
|
+
text: string | undefined;
|
|
26
|
+
url: string | undefined;
|
|
27
|
+
imageUrls: string[];
|
|
28
|
+
inReplyTo: `${string}-${string}-${string}-${string}-${string}` | undefined;
|
|
29
|
+
source: string;
|
|
30
|
+
channelType: ChannelType;
|
|
31
|
+
post: Record<string, string | number | boolean | null | undefined>;
|
|
32
|
+
};
|
|
33
|
+
entityId: `${string}-${string}-${string}-${string}-${string}`;
|
|
34
|
+
roomId: `${string}-${string}-${string}-${string}-${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
|
|
@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nC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,E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,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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,EACV,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvE,eAAO,MAAM,IAAI,GAAI,gBAAc,EAAE,gBAAc,qBAGlD,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,MAAM,IAAI,KAAG,OAOxC,CAAC;AAEF,wBAAsB,cAAc,CAAC,WAAW,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAoB/E;AAsBD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,SAAS,EAAE;;;;GAOxB;AAED,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,SAAS,EAAO,EAC3B,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAyD9B;AAED;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,IAAI,EACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,EAAE,CAAC,CA2DnB;AAmJD;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,GAAI,MAAM,MAAM,KAAG;IAAE,OAAO,EAAE,cAAc,CAAA;CA8BnF,CAAC;AAEF,cAAc,uBAAuB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@elizaos/plugin-xai",
|
|
3
|
+
"version": "2.0.0-alpha.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/node/index.node.js",
|
|
7
|
+
"module": "dist/node/index.node.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/elizaos-plugins/plugin-xai.git"
|
|
13
|
+
},
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": "./package.json",
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"browser": {
|
|
19
|
+
"types": "./dist/browser/index.d.ts",
|
|
20
|
+
"import": "./dist/browser/index.browser.js",
|
|
21
|
+
"default": "./dist/browser/index.browser.js"
|
|
22
|
+
},
|
|
23
|
+
"node": {
|
|
24
|
+
"types": "./dist/node/index.d.ts",
|
|
25
|
+
"import": "./dist/node/index.node.js",
|
|
26
|
+
"require": "./dist/cjs/index.node.cjs",
|
|
27
|
+
"default": "./dist/node/index.node.js"
|
|
28
|
+
},
|
|
29
|
+
"bun": {
|
|
30
|
+
"types": "./dist/node/index.d.ts",
|
|
31
|
+
"default": "./dist/node/index.node.js"
|
|
32
|
+
},
|
|
33
|
+
"require": "./dist/cjs/index.node.cjs",
|
|
34
|
+
"default": "./dist/node/index.node.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist"
|
|
39
|
+
],
|
|
40
|
+
"keywords": [],
|
|
41
|
+
"author": "elizaOS",
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "bun run build.ts",
|
|
45
|
+
"build:ts": "bun run build.ts",
|
|
46
|
+
"dev": "bun --hot build.ts",
|
|
47
|
+
"clean": "rm -rf dist .turbo node_modules",
|
|
48
|
+
"test": "vitest run",
|
|
49
|
+
"typecheck": "tsc --noEmit",
|
|
50
|
+
"lint": "bunx @biomejs/biome check --write --unsafe .",
|
|
51
|
+
"lint:check": "bunx @biomejs/biome check .",
|
|
52
|
+
"format": "bunx @biomejs/biome format --write .",
|
|
53
|
+
"format:check": "bunx @biomejs/biome format ."
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@elizaos/core": "workspace:*",
|
|
57
|
+
"twitter-api-v2": "^1.28.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@types/node": "^25.0.3",
|
|
61
|
+
"typescript": "^5.9.3",
|
|
62
|
+
"@biomejs/biome": "^2.3.11"
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"@elizaos/core": "workspace:*"
|
|
66
|
+
},
|
|
67
|
+
"publishConfig": {
|
|
68
|
+
"access": "public"
|
|
69
|
+
},
|
|
70
|
+
"agentConfig": {
|
|
71
|
+
"pluginType": "elizaos:plugin:1.0.0",
|
|
72
|
+
"pluginParameters": {
|
|
73
|
+
"XAI_API_KEY": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"description": "xAI API key for Grok model access and X (formerly Twitter) integration.",
|
|
76
|
+
"required": true,
|
|
77
|
+
"sensitive": true
|
|
78
|
+
},
|
|
79
|
+
"XAI_MODEL": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"description": "xAI Grok model for text generation (grok-3, grok-3-mini).",
|
|
82
|
+
"required": false,
|
|
83
|
+
"default": "grok-3",
|
|
84
|
+
"sensitive": false
|
|
85
|
+
},
|
|
86
|
+
"XAI_SMALL_MODEL": {
|
|
87
|
+
"type": "string",
|
|
88
|
+
"description": "xAI Grok model for faster/smaller tasks.",
|
|
89
|
+
"required": false,
|
|
90
|
+
"default": "grok-3-mini",
|
|
91
|
+
"sensitive": false
|
|
92
|
+
},
|
|
93
|
+
"XAI_EMBEDDING_MODEL": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"description": "xAI model for text embeddings.",
|
|
96
|
+
"required": false,
|
|
97
|
+
"default": "grok-embedding",
|
|
98
|
+
"sensitive": false
|
|
99
|
+
},
|
|
100
|
+
"XAI_BASE_URL": {
|
|
101
|
+
"type": "string",
|
|
102
|
+
"description": "xAI API base URL.",
|
|
103
|
+
"required": false,
|
|
104
|
+
"default": "https://api.x.ai/v1",
|
|
105
|
+
"sensitive": false
|
|
106
|
+
},
|
|
107
|
+
"X_AUTH_MODE": {
|
|
108
|
+
"type": "string",
|
|
109
|
+
"description": "X (formerly Twitter) auth mode: 'env' (API keys), 'oauth' (OAuth2 PKCE), or 'bearer'.",
|
|
110
|
+
"required": false,
|
|
111
|
+
"default": "env",
|
|
112
|
+
"sensitive": false
|
|
113
|
+
},
|
|
114
|
+
"X_API_KEY": {
|
|
115
|
+
"type": "string",
|
|
116
|
+
"description": "X (formerly Twitter) API key for OAuth 1.0a.",
|
|
117
|
+
"required": false,
|
|
118
|
+
"sensitive": true
|
|
119
|
+
},
|
|
120
|
+
"X_API_SECRET": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"description": "X (formerly Twitter) API secret key for OAuth 1.0a.",
|
|
123
|
+
"required": false,
|
|
124
|
+
"sensitive": true
|
|
125
|
+
},
|
|
126
|
+
"X_ACCESS_TOKEN": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"description": "X (formerly Twitter) access token for OAuth 1.0a.",
|
|
129
|
+
"required": false,
|
|
130
|
+
"sensitive": true
|
|
131
|
+
},
|
|
132
|
+
"X_ACCESS_TOKEN_SECRET": {
|
|
133
|
+
"type": "string",
|
|
134
|
+
"description": "X (formerly Twitter) access token secret for OAuth 1.0a.",
|
|
135
|
+
"required": false,
|
|
136
|
+
"sensitive": true
|
|
137
|
+
},
|
|
138
|
+
"X_BEARER_TOKEN": {
|
|
139
|
+
"type": "string",
|
|
140
|
+
"description": "X (formerly Twitter) Bearer token for app-only authentication.",
|
|
141
|
+
"required": false,
|
|
142
|
+
"sensitive": true
|
|
143
|
+
},
|
|
144
|
+
"X_CLIENT_ID": {
|
|
145
|
+
"type": "string",
|
|
146
|
+
"description": "X (formerly Twitter) OAuth2 client ID.",
|
|
147
|
+
"required": false,
|
|
148
|
+
"sensitive": false
|
|
149
|
+
},
|
|
150
|
+
"X_REDIRECT_URI": {
|
|
151
|
+
"type": "string",
|
|
152
|
+
"description": "OAuth2 redirect URI.",
|
|
153
|
+
"required": false,
|
|
154
|
+
"sensitive": false
|
|
155
|
+
},
|
|
156
|
+
"X_DRY_RUN": {
|
|
157
|
+
"type": "boolean",
|
|
158
|
+
"description": "When true, all X actions are simulated.",
|
|
159
|
+
"required": false,
|
|
160
|
+
"default": false,
|
|
161
|
+
"sensitive": false
|
|
162
|
+
},
|
|
163
|
+
"X_ENABLE_POST": {
|
|
164
|
+
"type": "boolean",
|
|
165
|
+
"description": "Enable autonomous posting.",
|
|
166
|
+
"required": false,
|
|
167
|
+
"default": false,
|
|
168
|
+
"sensitive": false
|
|
169
|
+
},
|
|
170
|
+
"X_ENABLE_REPLIES": {
|
|
171
|
+
"type": "boolean",
|
|
172
|
+
"description": "Enable reply handling.",
|
|
173
|
+
"required": false,
|
|
174
|
+
"default": true,
|
|
175
|
+
"sensitive": false
|
|
176
|
+
},
|
|
177
|
+
"X_ENABLE_ACTIONS": {
|
|
178
|
+
"type": "boolean",
|
|
179
|
+
"description": "Enable timeline actions (like, repost).",
|
|
180
|
+
"required": false,
|
|
181
|
+
"default": false,
|
|
182
|
+
"sensitive": false
|
|
183
|
+
},
|
|
184
|
+
"X_MAX_POST_LENGTH": {
|
|
185
|
+
"type": "number",
|
|
186
|
+
"description": "Maximum post length (up to 4000 for premium).",
|
|
187
|
+
"required": false,
|
|
188
|
+
"default": 280,
|
|
189
|
+
"sensitive": false
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|