@elizaos/core 1.5.3-beta.3 → 1.5.5-alpha.10
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/actions.d.ts +23 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/browser/index.browser.js +172 -179
- package/dist/browser/index.browser.js.map +6 -197
- package/dist/browser/index.d.ts +2 -2
- package/dist/database.d.ts +481 -0
- package/dist/database.d.ts.map +1 -0
- package/dist/entities.d.ts +49 -0
- package/dist/entities.d.ts.map +1 -0
- package/{src/index.browser.ts → dist/index.browser.d.ts} +9 -21
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.d.ts +27 -3
- package/dist/index.d.ts.map +1 -0
- package/{src/index.node.ts → dist/index.node.d.ts} +3 -16
- package/dist/index.node.d.ts.map +1 -0
- package/dist/logger.d.ts +47 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.node.js +15514 -439
- package/dist/node/index.node.js.map +139 -8
- package/dist/prompts.d.ts +8 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/roles.d.ts +30 -0
- package/dist/roles.d.ts.map +1 -0
- package/dist/runtime.d.ts +328 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/schemas/character.d.ts +228 -0
- package/dist/schemas/character.d.ts.map +1 -0
- package/dist/search.d.ts +317 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/sentry/instrument.browser.d.ts +12 -0
- package/dist/sentry/instrument.browser.d.ts.map +1 -0
- package/dist/sentry/instrument.d.ts +12 -0
- package/dist/sentry/instrument.d.ts.map +1 -0
- package/dist/sentry/instrument.node.d.ts +11 -0
- package/dist/sentry/instrument.node.d.ts.map +1 -0
- package/dist/services.d.ts +49 -0
- package/dist/services.d.ts.map +1 -0
- package/dist/settings.d.ts +87 -0
- package/dist/settings.d.ts.map +1 -0
- package/{src/types/agent.ts → dist/types/agent.d.ts} +60 -74
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/browser.d.ts +127 -0
- package/dist/types/browser.d.ts.map +1 -0
- package/dist/types/components.d.ts +135 -0
- package/dist/types/components.d.ts.map +1 -0
- package/dist/types/database.d.ts +278 -0
- package/dist/types/database.d.ts.map +1 -0
- package/dist/types/email.d.ts +143 -0
- package/dist/types/email.d.ts.map +1 -0
- package/dist/types/environment.d.ts +109 -0
- package/dist/types/environment.d.ts.map +1 -0
- package/dist/types/events.d.ts +207 -0
- package/dist/types/events.d.ts.map +1 -0
- package/{src/types/index.ts → dist/types/index.d.ts} +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/{src/types/knowledge.ts → dist/types/knowledge.d.ts} +18 -23
- package/dist/types/knowledge.d.ts.map +1 -0
- package/dist/types/lp.d.ts +115 -0
- package/dist/types/lp.d.ts.map +1 -0
- package/{src/types/memory.ts → dist/types/memory.d.ts} +69 -132
- package/dist/types/memory.d.ts.map +1 -0
- package/dist/types/message.d.ts +202 -0
- package/dist/types/message.d.ts.map +1 -0
- package/dist/types/messaging.d.ts +45 -0
- package/dist/types/messaging.d.ts.map +1 -0
- package/dist/types/model.d.ts +319 -0
- package/dist/types/model.d.ts.map +1 -0
- package/dist/types/pdf.d.ts +68 -0
- package/dist/types/pdf.d.ts.map +1 -0
- package/dist/types/plugin.d.ts +64 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/post.d.ts +242 -0
- package/dist/types/post.d.ts.map +1 -0
- package/dist/types/primitives.d.ts +72 -0
- package/dist/types/primitives.d.ts.map +1 -0
- package/dist/types/runtime.d.ts +106 -0
- package/dist/types/runtime.d.ts.map +1 -0
- package/{src/types/service.ts → dist/types/service.d.ts} +69 -120
- package/dist/types/service.d.ts.map +1 -0
- package/dist/types/settings.d.ts +30 -0
- package/dist/types/settings.d.ts.map +1 -0
- package/{src/types/state.ts → dist/types/state.d.ts} +18 -19
- package/dist/types/state.d.ts.map +1 -0
- package/dist/types/task.d.ts +68 -0
- package/dist/types/task.d.ts.map +1 -0
- package/dist/types/tee.d.ts +97 -0
- package/dist/types/tee.d.ts.map +1 -0
- package/dist/types/testing.d.ts +29 -0
- package/dist/types/testing.d.ts.map +1 -0
- package/dist/types/token.d.ts +73 -0
- package/dist/types/token.d.ts.map +1 -0
- package/dist/types/transcription.d.ts +108 -0
- package/dist/types/transcription.d.ts.map +1 -0
- package/dist/types/video.d.ts +93 -0
- package/dist/types/video.d.ts.map +1 -0
- package/dist/types/wallet.d.ts +49 -0
- package/dist/types/wallet.d.ts.map +1 -0
- package/dist/types/web-search.d.ts +112 -0
- package/dist/types/web-search.d.ts.map +1 -0
- package/dist/utils/buffer.d.ts +105 -0
- package/dist/utils/buffer.d.ts.map +1 -0
- package/dist/utils/environment.d.ts +106 -0
- package/dist/utils/environment.d.ts.map +1 -0
- package/dist/utils/server-health.d.ts +23 -0
- package/dist/utils/server-health.d.ts.map +1 -0
- package/dist/utils.d.ts +177 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +5 -5
- package/src/__tests__/action-chaining-simple.test.ts +0 -203
- package/src/__tests__/actions.test.ts +0 -218
- package/src/__tests__/buffer.test.ts +0 -337
- package/src/__tests__/character-validation.test.ts +0 -309
- package/src/__tests__/database.test.ts +0 -750
- package/src/__tests__/entities.test.ts +0 -727
- package/src/__tests__/env.test.ts +0 -23
- package/src/__tests__/environment.test.ts +0 -285
- package/src/__tests__/logger-browser-node.test.ts +0 -716
- package/src/__tests__/logger.test.ts +0 -403
- package/src/__tests__/messages.test.ts +0 -196
- package/src/__tests__/mockCharacter.ts +0 -544
- package/src/__tests__/parsing.test.ts +0 -58
- package/src/__tests__/prompts.test.ts +0 -159
- package/src/__tests__/roles.test.ts +0 -331
- package/src/__tests__/runtime-embedding.test.ts +0 -343
- package/src/__tests__/runtime.test.ts +0 -978
- package/src/__tests__/search.test.ts +0 -15
- package/src/__tests__/services-by-type.test.ts +0 -204
- package/src/__tests__/services.test.ts +0 -136
- package/src/__tests__/settings.test.ts +0 -810
- package/src/__tests__/utils.test.ts +0 -1105
- package/src/__tests__/uuid.test.ts +0 -94
- package/src/actions.ts +0 -122
- package/src/database.ts +0 -579
- package/src/entities.ts +0 -406
- package/src/index.ts +0 -50
- package/src/logger.ts +0 -527
- package/src/prompts.ts +0 -243
- package/src/roles.ts +0 -85
- package/src/runtime.ts +0 -2514
- package/src/schemas/character.ts +0 -149
- package/src/search.ts +0 -1543
- package/src/sentry/instrument.browser.ts +0 -65
- package/src/sentry/instrument.node.ts +0 -57
- package/src/sentry/instrument.ts +0 -82
- package/src/services.ts +0 -105
- package/src/settings.ts +0 -409
- package/src/test_resources/constants.ts +0 -12
- package/src/test_resources/testSetup.ts +0 -21
- package/src/test_resources/types.ts +0 -22
- package/src/types/browser.ts +0 -145
- package/src/types/components.ts +0 -184
- package/src/types/database.ts +0 -348
- package/src/types/email.ts +0 -162
- package/src/types/environment.ts +0 -129
- package/src/types/events.ts +0 -249
- package/src/types/lp.ts +0 -124
- package/src/types/message.ts +0 -233
- package/src/types/messaging.ts +0 -57
- package/src/types/model.ts +0 -359
- package/src/types/pdf.ts +0 -77
- package/src/types/plugin.ts +0 -78
- package/src/types/post.ts +0 -271
- package/src/types/primitives.ts +0 -97
- package/src/types/runtime.ts +0 -190
- package/src/types/settings.ts +0 -30
- package/src/types/task.ts +0 -72
- package/src/types/tee.ts +0 -107
- package/src/types/testing.ts +0 -30
- package/src/types/token.ts +0 -96
- package/src/types/transcription.ts +0 -133
- package/src/types/video.ts +0 -108
- package/src/types/wallet.ts +0 -56
- package/src/types/web-search.ts +0 -146
- package/src/utils/__tests__/buffer.test.ts +0 -80
- package/src/utils/__tests__/environment.test.ts +0 -58
- package/src/utils/__tests__/stringToUuid.test.ts +0 -88
- package/src/utils/buffer.ts +0 -312
- package/src/utils/environment.ts +0 -316
- package/src/utils/server-health.ts +0 -117
- package/src/utils.ts +0 -1076
package/src/types/pdf.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { Service, ServiceType } from './service';
|
|
2
|
-
|
|
3
|
-
export interface PdfExtractionResult {
|
|
4
|
-
text: string;
|
|
5
|
-
pageCount: number;
|
|
6
|
-
metadata?: {
|
|
7
|
-
title?: string;
|
|
8
|
-
author?: string;
|
|
9
|
-
createdAt?: Date;
|
|
10
|
-
modifiedAt?: Date;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface PdfGenerationOptions {
|
|
15
|
-
format?: 'A4' | 'A3' | 'Letter';
|
|
16
|
-
orientation?: 'portrait' | 'landscape';
|
|
17
|
-
margins?: {
|
|
18
|
-
top?: number;
|
|
19
|
-
bottom?: number;
|
|
20
|
-
left?: number;
|
|
21
|
-
right?: number;
|
|
22
|
-
};
|
|
23
|
-
header?: string;
|
|
24
|
-
footer?: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface PdfConversionOptions {
|
|
28
|
-
quality?: 'high' | 'medium' | 'low';
|
|
29
|
-
outputFormat?: 'pdf' | 'pdf/a';
|
|
30
|
-
compression?: boolean;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Interface for PDF processing services
|
|
35
|
-
*/
|
|
36
|
-
export abstract class IPdfService extends Service {
|
|
37
|
-
static override readonly serviceType = ServiceType.PDF;
|
|
38
|
-
|
|
39
|
-
public readonly capabilityDescription = 'PDF processing, extraction, and generation capabilities';
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Extract text and metadata from a PDF file
|
|
43
|
-
* @param pdfPath - Path to the PDF file or buffer
|
|
44
|
-
* @returns Promise resolving to extracted text and metadata
|
|
45
|
-
*/
|
|
46
|
-
abstract extractText(pdfPath: string | Buffer): Promise<PdfExtractionResult>;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Generate a PDF from HTML content
|
|
50
|
-
* @param htmlContent - HTML content to convert to PDF
|
|
51
|
-
* @param options - PDF generation options
|
|
52
|
-
* @returns Promise resolving to PDF buffer
|
|
53
|
-
*/
|
|
54
|
-
abstract generatePdf(htmlContent: string, options?: PdfGenerationOptions): Promise<Buffer>;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Convert a document to PDF format
|
|
58
|
-
* @param filePath - Path to the document file
|
|
59
|
-
* @param options - Conversion options
|
|
60
|
-
* @returns Promise resolving to PDF buffer
|
|
61
|
-
*/
|
|
62
|
-
abstract convertToPdf(filePath: string, options?: PdfConversionOptions): Promise<Buffer>;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Merge multiple PDF files into one
|
|
66
|
-
* @param pdfPaths - Array of PDF file paths or buffers
|
|
67
|
-
* @returns Promise resolving to merged PDF buffer
|
|
68
|
-
*/
|
|
69
|
-
abstract mergePdfs(pdfPaths: (string | Buffer)[]): Promise<Buffer>;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Split a PDF into individual pages
|
|
73
|
-
* @param pdfPath - Path to the PDF file or buffer
|
|
74
|
-
* @returns Promise resolving to array of page buffers
|
|
75
|
-
*/
|
|
76
|
-
abstract splitPdf(pdfPath: string | Buffer): Promise<Buffer[]>;
|
|
77
|
-
}
|
package/src/types/plugin.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import type { Character } from './agent';
|
|
2
|
-
import type { Action, Evaluator, Provider } from './components';
|
|
3
|
-
import type { IDatabaseAdapter } from './database';
|
|
4
|
-
import type { EventHandler, EventPayloadMap } from './events';
|
|
5
|
-
import type { IAgentRuntime } from './runtime';
|
|
6
|
-
import type { Service } from './service';
|
|
7
|
-
import type { TestSuite } from './testing';
|
|
8
|
-
|
|
9
|
-
export type Route = {
|
|
10
|
-
type: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'STATIC';
|
|
11
|
-
path: string;
|
|
12
|
-
filePath?: string;
|
|
13
|
-
public?: boolean;
|
|
14
|
-
name?: string extends { public: true } ? string : string | undefined;
|
|
15
|
-
handler?: (req: any, res: any, runtime: IAgentRuntime) => Promise<void>;
|
|
16
|
-
isMultipart?: boolean; // Indicates if the route expects multipart/form-data (file uploads)
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Plugin for extending agent functionality
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
export type PluginEvents = {
|
|
24
|
-
[K in keyof EventPayloadMap]?: EventHandler<K>[];
|
|
25
|
-
} & {
|
|
26
|
-
[key: string]: ((params: any) => Promise<any>)[];
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export interface Plugin {
|
|
30
|
-
name: string;
|
|
31
|
-
description: string;
|
|
32
|
-
|
|
33
|
-
// Initialize plugin with runtime services
|
|
34
|
-
init?: (config: Record<string, string>, runtime: IAgentRuntime) => Promise<void>;
|
|
35
|
-
|
|
36
|
-
// Configuration
|
|
37
|
-
config?: { [key: string]: any };
|
|
38
|
-
|
|
39
|
-
services?: (typeof Service)[];
|
|
40
|
-
|
|
41
|
-
// Entity component definitions
|
|
42
|
-
componentTypes?: {
|
|
43
|
-
name: string;
|
|
44
|
-
schema: Record<string, unknown>;
|
|
45
|
-
validator?: (data: any) => boolean;
|
|
46
|
-
}[];
|
|
47
|
-
|
|
48
|
-
// Optional plugin features
|
|
49
|
-
actions?: Action[];
|
|
50
|
-
providers?: Provider[];
|
|
51
|
-
evaluators?: Evaluator[];
|
|
52
|
-
adapter?: IDatabaseAdapter;
|
|
53
|
-
models?: {
|
|
54
|
-
[key: string]: (...args: any[]) => Promise<any>;
|
|
55
|
-
};
|
|
56
|
-
events?: PluginEvents;
|
|
57
|
-
routes?: Route[];
|
|
58
|
-
tests?: TestSuite[];
|
|
59
|
-
|
|
60
|
-
dependencies?: string[];
|
|
61
|
-
|
|
62
|
-
testDependencies?: string[];
|
|
63
|
-
|
|
64
|
-
priority?: number;
|
|
65
|
-
|
|
66
|
-
schema?: any;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface ProjectAgent {
|
|
70
|
-
character: Character;
|
|
71
|
-
init?: (runtime: IAgentRuntime) => Promise<void>;
|
|
72
|
-
plugins?: Plugin[];
|
|
73
|
-
tests?: TestSuite | TestSuite[];
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface Project {
|
|
77
|
-
agents: ProjectAgent[];
|
|
78
|
-
}
|
package/src/types/post.ts
DELETED
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
import { Service, ServiceType } from './service';
|
|
2
|
-
import type { UUID } from './primitives';
|
|
3
|
-
|
|
4
|
-
export interface PostMedia {
|
|
5
|
-
id: UUID;
|
|
6
|
-
url: string;
|
|
7
|
-
type: 'image' | 'video' | 'audio' | 'document';
|
|
8
|
-
mimeType: string;
|
|
9
|
-
size: number;
|
|
10
|
-
width?: number;
|
|
11
|
-
height?: number;
|
|
12
|
-
duration?: number;
|
|
13
|
-
thumbnail?: string;
|
|
14
|
-
description?: string;
|
|
15
|
-
altText?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface PostLocation {
|
|
19
|
-
name: string;
|
|
20
|
-
address?: string;
|
|
21
|
-
coordinates?: {
|
|
22
|
-
latitude: number;
|
|
23
|
-
longitude: number;
|
|
24
|
-
};
|
|
25
|
-
placeId?: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface PostAuthor {
|
|
29
|
-
id: UUID;
|
|
30
|
-
username: string;
|
|
31
|
-
displayName: string;
|
|
32
|
-
avatar?: string;
|
|
33
|
-
verified?: boolean;
|
|
34
|
-
followerCount?: number;
|
|
35
|
-
followingCount?: number;
|
|
36
|
-
bio?: string;
|
|
37
|
-
website?: string;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface PostEngagement {
|
|
41
|
-
likes: number;
|
|
42
|
-
shares: number;
|
|
43
|
-
comments: number;
|
|
44
|
-
views?: number;
|
|
45
|
-
hasLiked: boolean;
|
|
46
|
-
hasShared: boolean;
|
|
47
|
-
hasCommented: boolean;
|
|
48
|
-
hasSaved: boolean;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface PostContent {
|
|
52
|
-
text?: string;
|
|
53
|
-
html?: string;
|
|
54
|
-
media?: PostMedia[];
|
|
55
|
-
location?: PostLocation;
|
|
56
|
-
tags?: string[];
|
|
57
|
-
mentions?: UUID[];
|
|
58
|
-
links?: Array<{
|
|
59
|
-
url: string;
|
|
60
|
-
title?: string;
|
|
61
|
-
description?: string;
|
|
62
|
-
image?: string;
|
|
63
|
-
}>;
|
|
64
|
-
poll?: {
|
|
65
|
-
question: string;
|
|
66
|
-
options: Array<{
|
|
67
|
-
text: string;
|
|
68
|
-
votes: number;
|
|
69
|
-
}>;
|
|
70
|
-
expiresAt?: Date;
|
|
71
|
-
multipleChoice?: boolean;
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface PostInfo {
|
|
76
|
-
id: UUID;
|
|
77
|
-
author: PostAuthor;
|
|
78
|
-
content: PostContent;
|
|
79
|
-
platform: string;
|
|
80
|
-
platformId: string;
|
|
81
|
-
url: string;
|
|
82
|
-
createdAt: Date;
|
|
83
|
-
editedAt?: Date;
|
|
84
|
-
scheduledAt?: Date;
|
|
85
|
-
engagement: PostEngagement;
|
|
86
|
-
visibility: 'public' | 'private' | 'followers' | 'friends' | 'unlisted';
|
|
87
|
-
replyTo?: UUID;
|
|
88
|
-
thread?: {
|
|
89
|
-
id: UUID;
|
|
90
|
-
position: number;
|
|
91
|
-
total: number;
|
|
92
|
-
};
|
|
93
|
-
crossPosted?: Array<{
|
|
94
|
-
platform: string;
|
|
95
|
-
platformId: string;
|
|
96
|
-
url: string;
|
|
97
|
-
}>;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export interface PostCreateOptions {
|
|
101
|
-
platforms?: string[];
|
|
102
|
-
scheduledAt?: Date;
|
|
103
|
-
visibility?: PostInfo['visibility'];
|
|
104
|
-
replyTo?: UUID;
|
|
105
|
-
thread?: boolean;
|
|
106
|
-
location?: PostLocation;
|
|
107
|
-
tags?: string[];
|
|
108
|
-
mentions?: UUID[];
|
|
109
|
-
enableComments?: boolean;
|
|
110
|
-
enableSharing?: boolean;
|
|
111
|
-
contentWarning?: string;
|
|
112
|
-
sensitive?: boolean;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface PostSearchOptions {
|
|
116
|
-
query?: string;
|
|
117
|
-
author?: UUID;
|
|
118
|
-
platform?: string;
|
|
119
|
-
tags?: string[];
|
|
120
|
-
mentions?: UUID[];
|
|
121
|
-
since?: Date;
|
|
122
|
-
before?: Date;
|
|
123
|
-
limit?: number;
|
|
124
|
-
offset?: number;
|
|
125
|
-
hasMedia?: boolean;
|
|
126
|
-
hasLocation?: boolean;
|
|
127
|
-
visibility?: PostInfo['visibility'];
|
|
128
|
-
sortBy?: 'date' | 'engagement' | 'relevance';
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export interface PostAnalytics {
|
|
132
|
-
postId: UUID;
|
|
133
|
-
platform: string;
|
|
134
|
-
impressions: number;
|
|
135
|
-
reach: number;
|
|
136
|
-
engagement: PostEngagement;
|
|
137
|
-
clicks: number;
|
|
138
|
-
shares: number;
|
|
139
|
-
saves: number;
|
|
140
|
-
demographics?: {
|
|
141
|
-
age?: Record<string, number>;
|
|
142
|
-
gender?: Record<string, number>;
|
|
143
|
-
location?: Record<string, number>;
|
|
144
|
-
};
|
|
145
|
-
topPerformingHours?: Array<{
|
|
146
|
-
hour: number;
|
|
147
|
-
engagement: number;
|
|
148
|
-
}>;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Interface for social media posting services
|
|
153
|
-
*/
|
|
154
|
-
export abstract class IPostService extends Service {
|
|
155
|
-
static override readonly serviceType = ServiceType.POST;
|
|
156
|
-
|
|
157
|
-
public readonly capabilityDescription =
|
|
158
|
-
'Social media posting and content management capabilities';
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Create and publish a new post
|
|
162
|
-
* @param content - Post content
|
|
163
|
-
* @param options - Publishing options
|
|
164
|
-
* @returns Promise resolving to post ID
|
|
165
|
-
*/
|
|
166
|
-
abstract createPost(content: PostContent, options?: PostCreateOptions): Promise<UUID>;
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Get posts from timeline or specific user
|
|
170
|
-
* @param options - Search options
|
|
171
|
-
* @returns Promise resolving to array of posts
|
|
172
|
-
*/
|
|
173
|
-
abstract getPosts(options?: PostSearchOptions): Promise<PostInfo[]>;
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Get a specific post by ID
|
|
177
|
-
* @param postId - Post ID
|
|
178
|
-
* @returns Promise resolving to post info
|
|
179
|
-
*/
|
|
180
|
-
abstract getPost(postId: UUID): Promise<PostInfo>;
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Edit an existing post
|
|
184
|
-
* @param postId - Post ID
|
|
185
|
-
* @param content - New post content
|
|
186
|
-
* @returns Promise resolving when edit completes
|
|
187
|
-
*/
|
|
188
|
-
abstract editPost(postId: UUID, content: PostContent): Promise<void>;
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Delete a post
|
|
192
|
-
* @param postId - Post ID
|
|
193
|
-
* @returns Promise resolving when deletion completes
|
|
194
|
-
*/
|
|
195
|
-
abstract deletePost(postId: UUID): Promise<void>;
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Like/unlike a post
|
|
199
|
-
* @param postId - Post ID
|
|
200
|
-
* @param like - True to like, false to unlike
|
|
201
|
-
* @returns Promise resolving when operation completes
|
|
202
|
-
*/
|
|
203
|
-
abstract likePost(postId: UUID, like: boolean): Promise<void>;
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Share/repost a post
|
|
207
|
-
* @param postId - Post ID
|
|
208
|
-
* @param comment - Optional comment when sharing
|
|
209
|
-
* @returns Promise resolving to share ID
|
|
210
|
-
*/
|
|
211
|
-
abstract sharePost(postId: UUID, comment?: string): Promise<UUID>;
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Save/unsave a post
|
|
215
|
-
* @param postId - Post ID
|
|
216
|
-
* @param save - True to save, false to unsave
|
|
217
|
-
* @returns Promise resolving when operation completes
|
|
218
|
-
*/
|
|
219
|
-
abstract savePost(postId: UUID, save: boolean): Promise<void>;
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Comment on a post
|
|
223
|
-
* @param postId - Post ID
|
|
224
|
-
* @param content - Comment content
|
|
225
|
-
* @returns Promise resolving to comment ID
|
|
226
|
-
*/
|
|
227
|
-
abstract commentOnPost(postId: UUID, content: PostContent): Promise<UUID>;
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Get comments for a post
|
|
231
|
-
* @param postId - Post ID
|
|
232
|
-
* @param options - Search options
|
|
233
|
-
* @returns Promise resolving to array of comments
|
|
234
|
-
*/
|
|
235
|
-
abstract getComments(postId: UUID, options?: PostSearchOptions): Promise<PostInfo[]>;
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Schedule a post for later publishing
|
|
239
|
-
* @param content - Post content
|
|
240
|
-
* @param scheduledAt - When to publish
|
|
241
|
-
* @param options - Publishing options
|
|
242
|
-
* @returns Promise resolving to scheduled post ID
|
|
243
|
-
*/
|
|
244
|
-
abstract schedulePost(
|
|
245
|
-
content: PostContent,
|
|
246
|
-
scheduledAt: Date,
|
|
247
|
-
options?: PostCreateOptions
|
|
248
|
-
): Promise<UUID>;
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Get analytics for a post
|
|
252
|
-
* @param postId - Post ID
|
|
253
|
-
* @returns Promise resolving to post analytics
|
|
254
|
-
*/
|
|
255
|
-
abstract getPostAnalytics(postId: UUID): Promise<PostAnalytics>;
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Get trending posts
|
|
259
|
-
* @param options - Search options
|
|
260
|
-
* @returns Promise resolving to trending posts
|
|
261
|
-
*/
|
|
262
|
-
abstract getTrendingPosts(options?: PostSearchOptions): Promise<PostInfo[]>;
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Search posts across platforms
|
|
266
|
-
* @param query - Search query
|
|
267
|
-
* @param options - Search options
|
|
268
|
-
* @returns Promise resolving to search results
|
|
269
|
-
*/
|
|
270
|
-
abstract searchPosts(query: string, options?: PostSearchOptions): Promise<PostInfo[]>;
|
|
271
|
-
}
|
package/src/types/primitives.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines a custom type UUID representing a universally unique identifier
|
|
3
|
-
*/
|
|
4
|
-
export type UUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Helper function to safely cast a string to strongly typed UUID
|
|
8
|
-
* @param id The string UUID to validate and cast
|
|
9
|
-
* @returns The same UUID with branded type information
|
|
10
|
-
*/
|
|
11
|
-
export function asUUID(id: string): UUID {
|
|
12
|
-
if (!id || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id)) {
|
|
13
|
-
throw new Error(`Invalid UUID format: ${id}`);
|
|
14
|
-
}
|
|
15
|
-
return id as UUID;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Represents the content of a memory, message, or other information
|
|
20
|
-
*/
|
|
21
|
-
export interface Content {
|
|
22
|
-
/** The agent's internal thought process */
|
|
23
|
-
thought?: string;
|
|
24
|
-
|
|
25
|
-
/** The main text content visible to users */
|
|
26
|
-
text?: string;
|
|
27
|
-
|
|
28
|
-
/** Optional actions to be performed */
|
|
29
|
-
actions?: string[];
|
|
30
|
-
|
|
31
|
-
/** Optional providers to use for context generation */
|
|
32
|
-
providers?: string[];
|
|
33
|
-
|
|
34
|
-
/** Optional source/origin of the content */
|
|
35
|
-
source?: string;
|
|
36
|
-
|
|
37
|
-
/** Optional target/destination for responses */
|
|
38
|
-
target?: string;
|
|
39
|
-
|
|
40
|
-
/** URL of the original message/post (e.g. tweet URL, Discord message link) */
|
|
41
|
-
url?: string;
|
|
42
|
-
|
|
43
|
-
/** UUID of parent message if this is a reply/thread */
|
|
44
|
-
inReplyTo?: UUID;
|
|
45
|
-
|
|
46
|
-
/** Array of media attachments */
|
|
47
|
-
attachments?: Media[];
|
|
48
|
-
|
|
49
|
-
/** room type */
|
|
50
|
-
channelType?: string;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Additional dynamic properties
|
|
54
|
-
* Use specific properties above instead of this when possible
|
|
55
|
-
*/
|
|
56
|
-
[key: string]: unknown;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Represents a media attachment
|
|
61
|
-
*/
|
|
62
|
-
export type Media = {
|
|
63
|
-
/** Unique identifier */
|
|
64
|
-
id: string;
|
|
65
|
-
|
|
66
|
-
/** Media URL */
|
|
67
|
-
url: string;
|
|
68
|
-
|
|
69
|
-
/** Media title */
|
|
70
|
-
title?: string;
|
|
71
|
-
|
|
72
|
-
/** Media source */
|
|
73
|
-
source?: string;
|
|
74
|
-
|
|
75
|
-
/** Media description */
|
|
76
|
-
description?: string;
|
|
77
|
-
|
|
78
|
-
/** Text content */
|
|
79
|
-
text?: string;
|
|
80
|
-
|
|
81
|
-
/** Content type */
|
|
82
|
-
contentType?: ContentType;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export enum ContentType {
|
|
86
|
-
IMAGE = 'image',
|
|
87
|
-
VIDEO = 'video',
|
|
88
|
-
AUDIO = 'audio',
|
|
89
|
-
DOCUMENT = 'document',
|
|
90
|
-
LINK = 'link',
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* A generic type for metadata objects, allowing for arbitrary key-value pairs.
|
|
95
|
-
* This encourages consumers to perform type checking or casting.
|
|
96
|
-
*/
|
|
97
|
-
export type Metadata = Record<string, unknown>;
|
package/src/types/runtime.ts
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import type { Character } from './agent';
|
|
2
|
-
import type { Action, Evaluator, Provider } from './components';
|
|
3
|
-
import { HandlerCallback } from './components';
|
|
4
|
-
import type { IDatabaseAdapter } from './database';
|
|
5
|
-
import type { Entity, Room, World } from './environment';
|
|
6
|
-
import { Memory, MemoryMetadata } from './memory';
|
|
7
|
-
import type { SendHandlerFunction, TargetInfo } from './messaging';
|
|
8
|
-
import type { ModelParamsMap, ModelResultMap, ModelTypeName } from './model';
|
|
9
|
-
import type { Plugin, Route } from './plugin';
|
|
10
|
-
import type { Content, UUID } from './primitives';
|
|
11
|
-
import type { Service, ServiceTypeName } from './service';
|
|
12
|
-
import type { State } from './state';
|
|
13
|
-
import type { TaskWorker } from './task';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Represents the core runtime environment for an agent.
|
|
17
|
-
* Defines methods for database interaction, plugin management, event handling,
|
|
18
|
-
* state composition, model usage, and task management.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
export interface IAgentRuntime extends IDatabaseAdapter {
|
|
22
|
-
// Properties
|
|
23
|
-
agentId: UUID;
|
|
24
|
-
character: Character;
|
|
25
|
-
providers: Provider[];
|
|
26
|
-
actions: Action[];
|
|
27
|
-
evaluators: Evaluator[];
|
|
28
|
-
plugins: Plugin[];
|
|
29
|
-
services: Map<ServiceTypeName, Service[]>;
|
|
30
|
-
events: Map<string, ((params: any) => Promise<void>)[]>;
|
|
31
|
-
fetch?: typeof fetch | null;
|
|
32
|
-
routes: Route[];
|
|
33
|
-
logger: any;
|
|
34
|
-
|
|
35
|
-
// Methods
|
|
36
|
-
registerPlugin(plugin: Plugin): Promise<void>;
|
|
37
|
-
|
|
38
|
-
initialize(): Promise<void>;
|
|
39
|
-
|
|
40
|
-
getConnection(): Promise<any>;
|
|
41
|
-
|
|
42
|
-
getService<T extends Service>(service: ServiceTypeName | string): T | null;
|
|
43
|
-
|
|
44
|
-
getServicesByType<T extends Service>(service: ServiceTypeName | string): T[];
|
|
45
|
-
|
|
46
|
-
getAllServices(): Map<ServiceTypeName, Service[]>;
|
|
47
|
-
|
|
48
|
-
registerService(service: typeof Service): Promise<void>;
|
|
49
|
-
|
|
50
|
-
getServiceLoadPromise(serviceType: ServiceTypeName): Promise<Service>;
|
|
51
|
-
|
|
52
|
-
getRegisteredServiceTypes(): ServiceTypeName[];
|
|
53
|
-
|
|
54
|
-
hasService(serviceType: ServiceTypeName | string): boolean;
|
|
55
|
-
|
|
56
|
-
// Keep these methods for backward compatibility
|
|
57
|
-
registerDatabaseAdapter(adapter: IDatabaseAdapter): void;
|
|
58
|
-
|
|
59
|
-
setSetting(key: string, value: string | boolean | null | any, secret?: boolean): void;
|
|
60
|
-
|
|
61
|
-
getSetting(key: string): string | boolean | null | any;
|
|
62
|
-
|
|
63
|
-
getConversationLength(): number;
|
|
64
|
-
|
|
65
|
-
processActions(
|
|
66
|
-
message: Memory,
|
|
67
|
-
responses: Memory[],
|
|
68
|
-
state?: State,
|
|
69
|
-
callback?: HandlerCallback
|
|
70
|
-
): Promise<void>;
|
|
71
|
-
|
|
72
|
-
evaluate(
|
|
73
|
-
message: Memory,
|
|
74
|
-
state?: State,
|
|
75
|
-
didRespond?: boolean,
|
|
76
|
-
callback?: HandlerCallback,
|
|
77
|
-
responses?: Memory[]
|
|
78
|
-
): Promise<Evaluator[] | null>;
|
|
79
|
-
|
|
80
|
-
registerProvider(provider: Provider): void;
|
|
81
|
-
|
|
82
|
-
registerAction(action: Action): void;
|
|
83
|
-
|
|
84
|
-
registerEvaluator(evaluator: Evaluator): void;
|
|
85
|
-
|
|
86
|
-
ensureConnections(entities: Entity[], rooms: Room[], source: string, world: World): Promise<void>;
|
|
87
|
-
ensureConnection({
|
|
88
|
-
entityId,
|
|
89
|
-
roomId,
|
|
90
|
-
metadata,
|
|
91
|
-
userName,
|
|
92
|
-
worldName,
|
|
93
|
-
name,
|
|
94
|
-
source,
|
|
95
|
-
channelId,
|
|
96
|
-
serverId,
|
|
97
|
-
type,
|
|
98
|
-
worldId,
|
|
99
|
-
userId,
|
|
100
|
-
}: {
|
|
101
|
-
entityId: UUID;
|
|
102
|
-
roomId: UUID;
|
|
103
|
-
userName?: string;
|
|
104
|
-
name?: string;
|
|
105
|
-
worldName?: string;
|
|
106
|
-
source?: string;
|
|
107
|
-
channelId?: string;
|
|
108
|
-
serverId?: string;
|
|
109
|
-
type: any;
|
|
110
|
-
worldId: UUID;
|
|
111
|
-
userId?: UUID;
|
|
112
|
-
metadata?: Record<string, any>;
|
|
113
|
-
}): Promise<void>;
|
|
114
|
-
|
|
115
|
-
ensureParticipantInRoom(entityId: UUID, roomId: UUID): Promise<void>;
|
|
116
|
-
|
|
117
|
-
ensureWorldExists(world: World): Promise<void>;
|
|
118
|
-
|
|
119
|
-
ensureRoomExists(room: Room): Promise<void>;
|
|
120
|
-
|
|
121
|
-
composeState(
|
|
122
|
-
message: Memory,
|
|
123
|
-
includeList?: string[],
|
|
124
|
-
onlyInclude?: boolean,
|
|
125
|
-
skipCache?: boolean
|
|
126
|
-
): Promise<State>;
|
|
127
|
-
|
|
128
|
-
useModel<T extends ModelTypeName, R = ModelResultMap[T]>(
|
|
129
|
-
modelType: T,
|
|
130
|
-
params: Omit<ModelParamsMap[T], 'runtime'> | any
|
|
131
|
-
): Promise<R>;
|
|
132
|
-
|
|
133
|
-
registerModel(
|
|
134
|
-
modelType: ModelTypeName | string,
|
|
135
|
-
handler: (params: any) => Promise<any>,
|
|
136
|
-
provider: string,
|
|
137
|
-
priority?: number
|
|
138
|
-
): void;
|
|
139
|
-
|
|
140
|
-
getModel(
|
|
141
|
-
modelType: ModelTypeName | string
|
|
142
|
-
): ((runtime: IAgentRuntime, params: any) => Promise<any>) | undefined;
|
|
143
|
-
|
|
144
|
-
registerEvent(event: string, handler: (params: any) => Promise<void>): void;
|
|
145
|
-
|
|
146
|
-
getEvent(event: string): ((params: any) => Promise<void>)[] | undefined;
|
|
147
|
-
|
|
148
|
-
emitEvent(event: string | string[], params: any): Promise<void>;
|
|
149
|
-
// In-memory task definition methods
|
|
150
|
-
registerTaskWorker(taskHandler: TaskWorker): void;
|
|
151
|
-
getTaskWorker(name: string): TaskWorker | undefined;
|
|
152
|
-
|
|
153
|
-
stop(): Promise<void>;
|
|
154
|
-
|
|
155
|
-
addEmbeddingToMemory(memory: Memory): Promise<Memory>;
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Queue a memory for async embedding generation.
|
|
159
|
-
* This method is non-blocking and returns immediately.
|
|
160
|
-
* The embedding will be generated asynchronously via event handlers.
|
|
161
|
-
* @param memory The memory to generate embeddings for
|
|
162
|
-
* @param priority Priority level for the embedding generation
|
|
163
|
-
*/
|
|
164
|
-
queueEmbeddingGeneration(memory: Memory, priority?: 'high' | 'normal' | 'low'): Promise<void>;
|
|
165
|
-
|
|
166
|
-
getAllMemories(): Promise<Memory[]>;
|
|
167
|
-
|
|
168
|
-
clearAllAgentMemories(): Promise<void>;
|
|
169
|
-
|
|
170
|
-
updateMemory(memory: Partial<Memory> & { id: UUID; metadata?: MemoryMetadata }): Promise<boolean>;
|
|
171
|
-
|
|
172
|
-
// Run tracking methods
|
|
173
|
-
createRunId(): UUID;
|
|
174
|
-
startRun(): UUID;
|
|
175
|
-
endRun(): void;
|
|
176
|
-
getCurrentRunId(): UUID;
|
|
177
|
-
|
|
178
|
-
// easy/compat wrappers
|
|
179
|
-
|
|
180
|
-
getEntityById(entityId: UUID): Promise<Entity | null>;
|
|
181
|
-
getRoom(roomId: UUID): Promise<Room | null>;
|
|
182
|
-
createEntity(entity: Entity): Promise<boolean>;
|
|
183
|
-
createRoom({ id, name, source, type, channelId, serverId, worldId }: Room): Promise<UUID>;
|
|
184
|
-
addParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
185
|
-
getRooms(worldId: UUID): Promise<Room[]>;
|
|
186
|
-
|
|
187
|
-
registerSendHandler(source: string, handler: SendHandlerFunction): void;
|
|
188
|
-
|
|
189
|
-
sendMessageToTarget(target: TargetInfo, content: Content): Promise<void>;
|
|
190
|
-
}
|