@elizaos/api-client 1.4.4 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-client/src/client.d.ts +25 -0
- package/dist/api-client/src/client.d.ts.map +1 -0
- package/dist/api-client/src/index.d.ts +20 -0
- package/dist/api-client/src/index.d.ts.map +1 -0
- package/dist/api-client/src/lib/base-client.d.ts +31 -0
- package/dist/api-client/src/lib/base-client.d.ts.map +1 -0
- package/dist/api-client/src/services/agents.d.ts +107 -0
- package/dist/api-client/src/services/agents.d.ts.map +1 -0
- package/dist/api-client/src/services/audio.d.ts +48 -0
- package/dist/api-client/src/services/audio.d.ts.map +1 -0
- package/dist/api-client/src/services/media.d.ts +14 -0
- package/dist/api-client/src/services/media.d.ts.map +1 -0
- package/dist/api-client/src/services/memory.d.ts +107 -0
- package/dist/api-client/src/services/memory.d.ts.map +1 -0
- package/dist/api-client/src/services/messaging.d.ts +164 -0
- package/dist/api-client/src/services/messaging.d.ts.map +1 -0
- package/dist/api-client/src/services/server.d.ts +47 -0
- package/dist/api-client/src/services/server.d.ts.map +1 -0
- package/dist/api-client/src/services/sessions.d.ts +52 -0
- package/dist/api-client/src/services/sessions.d.ts.map +1 -0
- package/dist/api-client/src/services/system.d.ts +56 -0
- package/dist/api-client/src/services/system.d.ts.map +1 -0
- package/dist/api-client/src/types/agents.d.ts +67 -0
- package/dist/api-client/src/types/agents.d.ts.map +1 -0
- package/dist/api-client/src/types/audio.d.ts +42 -0
- package/dist/api-client/src/types/audio.d.ts.map +1 -0
- package/dist/api-client/src/types/base.d.ts +30 -0
- package/dist/api-client/src/types/base.d.ts.map +1 -0
- package/dist/api-client/src/types/media.d.ts +21 -0
- package/dist/api-client/src/types/media.d.ts.map +1 -0
- package/dist/api-client/src/types/memory.d.ts +43 -0
- package/dist/api-client/src/types/memory.d.ts.map +1 -0
- package/dist/api-client/src/types/messaging.d.ts +186 -0
- package/dist/api-client/src/types/messaging.d.ts.map +1 -0
- package/dist/api-client/src/types/server.d.ts +44 -0
- package/dist/api-client/src/types/server.d.ts.map +1 -0
- package/dist/api-client/src/types/sessions.d.ts +134 -0
- package/dist/api-client/src/types/sessions.d.ts.map +1 -0
- package/dist/api-client/src/types/system.d.ts +16 -0
- package/dist/api-client/src/types/system.d.ts.map +1 -0
- package/dist/core/src/actions.d.ts +23 -0
- package/dist/core/src/actions.d.ts.map +1 -0
- package/dist/core/src/database.d.ts +481 -0
- package/dist/core/src/database.d.ts.map +1 -0
- package/dist/core/src/entities.d.ts +49 -0
- package/dist/core/src/entities.d.ts.map +1 -0
- package/dist/core/src/index.d.ts +27 -0
- package/dist/core/src/index.d.ts.map +1 -0
- package/dist/core/src/logger.d.ts +46 -0
- package/dist/core/src/logger.d.ts.map +1 -0
- package/dist/core/src/prompts.d.ts +8 -0
- package/dist/core/src/prompts.d.ts.map +1 -0
- package/dist/core/src/roles.d.ts +30 -0
- package/dist/core/src/roles.d.ts.map +1 -0
- package/dist/core/src/runtime.d.ts +328 -0
- package/dist/core/src/runtime.d.ts.map +1 -0
- package/dist/core/src/schemas/character.d.ts +228 -0
- package/dist/core/src/schemas/character.d.ts.map +1 -0
- package/dist/core/src/search.d.ts +317 -0
- package/dist/core/src/search.d.ts.map +1 -0
- package/dist/core/src/sentry/instrument.d.ts +12 -0
- package/dist/core/src/sentry/instrument.d.ts.map +1 -0
- package/dist/core/src/services.d.ts +49 -0
- package/dist/core/src/services.d.ts.map +1 -0
- package/dist/core/src/settings.d.ts +87 -0
- package/dist/core/src/settings.d.ts.map +1 -0
- package/dist/core/src/types/agent.d.ts +98 -0
- package/dist/core/src/types/agent.d.ts.map +1 -0
- package/dist/core/src/types/browser.d.ts +127 -0
- package/dist/core/src/types/browser.d.ts.map +1 -0
- package/dist/core/src/types/components.d.ts +135 -0
- package/dist/core/src/types/components.d.ts.map +1 -0
- package/dist/core/src/types/database.d.ts +278 -0
- package/dist/core/src/types/database.d.ts.map +1 -0
- package/dist/core/src/types/email.d.ts +143 -0
- package/dist/core/src/types/email.d.ts.map +1 -0
- package/dist/core/src/types/environment.d.ts +109 -0
- package/dist/core/src/types/environment.d.ts.map +1 -0
- package/dist/core/src/types/events.d.ts +208 -0
- package/dist/core/src/types/events.d.ts.map +1 -0
- package/dist/core/src/types/index.d.ts +30 -0
- package/dist/core/src/types/index.d.ts.map +1 -0
- package/dist/core/src/types/knowledge.d.ts +60 -0
- package/dist/core/src/types/knowledge.d.ts.map +1 -0
- package/dist/core/src/types/lp.d.ts +115 -0
- package/dist/core/src/types/lp.d.ts.map +1 -0
- package/dist/core/src/types/memory.d.ts +165 -0
- package/dist/core/src/types/memory.d.ts.map +1 -0
- package/dist/core/src/types/message.d.ts +202 -0
- package/dist/core/src/types/message.d.ts.map +1 -0
- package/dist/core/src/types/messaging.d.ts +45 -0
- package/dist/core/src/types/messaging.d.ts.map +1 -0
- package/dist/core/src/types/model.d.ts +319 -0
- package/dist/core/src/types/model.d.ts.map +1 -0
- package/dist/core/src/types/pdf.d.ts +68 -0
- package/dist/core/src/types/pdf.d.ts.map +1 -0
- package/dist/core/src/types/plugin.d.ts +64 -0
- package/dist/core/src/types/plugin.d.ts.map +1 -0
- package/dist/core/src/types/post.d.ts +242 -0
- package/dist/core/src/types/post.d.ts.map +1 -0
- package/dist/core/src/types/primitives.d.ts +72 -0
- package/dist/core/src/types/primitives.d.ts.map +1 -0
- package/dist/core/src/types/runtime.d.ts +106 -0
- package/dist/core/src/types/runtime.d.ts.map +1 -0
- package/dist/core/src/types/service.d.ts +147 -0
- package/dist/core/src/types/service.d.ts.map +1 -0
- package/dist/core/src/types/settings.d.ts +30 -0
- package/dist/core/src/types/settings.d.ts.map +1 -0
- package/dist/core/src/types/state.d.ts +59 -0
- package/dist/core/src/types/state.d.ts.map +1 -0
- package/dist/core/src/types/task.d.ts +68 -0
- package/dist/core/src/types/task.d.ts.map +1 -0
- package/dist/core/src/types/tee.d.ts +97 -0
- package/dist/core/src/types/tee.d.ts.map +1 -0
- package/dist/core/src/types/testing.d.ts +29 -0
- package/dist/core/src/types/testing.d.ts.map +1 -0
- package/dist/core/src/types/token.d.ts +73 -0
- package/dist/core/src/types/token.d.ts.map +1 -0
- package/dist/core/src/types/transcription.d.ts +108 -0
- package/dist/core/src/types/transcription.d.ts.map +1 -0
- package/dist/core/src/types/video.d.ts +93 -0
- package/dist/core/src/types/video.d.ts.map +1 -0
- package/dist/core/src/types/wallet.d.ts +49 -0
- package/dist/core/src/types/wallet.d.ts.map +1 -0
- package/dist/core/src/types/web-search.d.ts +112 -0
- package/dist/core/src/types/web-search.d.ts.map +1 -0
- package/dist/core/src/utils/buffer.d.ts +105 -0
- package/dist/core/src/utils/buffer.d.ts.map +1 -0
- package/dist/core/src/utils/environment.d.ts +106 -0
- package/dist/core/src/utils/environment.d.ts.map +1 -0
- package/dist/core/src/utils/server-health.d.ts +23 -0
- package/dist/core/src/utils/server-health.d.ts.map +1 -0
- package/dist/core/src/utils.d.ts +177 -0
- package/dist/core/src/utils.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1102
- package/dist/index.js +144 -449
- package/dist/index.js.map +19 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +5 -6
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
export type Route = {
|
|
9
|
+
type: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'STATIC';
|
|
10
|
+
path: string;
|
|
11
|
+
filePath?: string;
|
|
12
|
+
public?: boolean;
|
|
13
|
+
name?: string extends {
|
|
14
|
+
public: true;
|
|
15
|
+
} ? string : string | undefined;
|
|
16
|
+
handler?: (req: any, res: any, runtime: IAgentRuntime) => Promise<void>;
|
|
17
|
+
isMultipart?: boolean;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Plugin for extending agent functionality
|
|
21
|
+
*/
|
|
22
|
+
export type PluginEvents = {
|
|
23
|
+
[K in keyof EventPayloadMap]?: EventHandler<K>[];
|
|
24
|
+
} & {
|
|
25
|
+
[key: string]: ((params: any) => Promise<any>)[];
|
|
26
|
+
};
|
|
27
|
+
export interface Plugin {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
init?: (config: Record<string, string>, runtime: IAgentRuntime) => Promise<void>;
|
|
31
|
+
config?: {
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
};
|
|
34
|
+
services?: (typeof Service)[];
|
|
35
|
+
componentTypes?: {
|
|
36
|
+
name: string;
|
|
37
|
+
schema: Record<string, unknown>;
|
|
38
|
+
validator?: (data: any) => boolean;
|
|
39
|
+
}[];
|
|
40
|
+
actions?: Action[];
|
|
41
|
+
providers?: Provider[];
|
|
42
|
+
evaluators?: Evaluator[];
|
|
43
|
+
adapter?: IDatabaseAdapter;
|
|
44
|
+
models?: {
|
|
45
|
+
[key: string]: (...args: any[]) => Promise<any>;
|
|
46
|
+
};
|
|
47
|
+
events?: PluginEvents;
|
|
48
|
+
routes?: Route[];
|
|
49
|
+
tests?: TestSuite[];
|
|
50
|
+
dependencies?: string[];
|
|
51
|
+
testDependencies?: string[];
|
|
52
|
+
priority?: number;
|
|
53
|
+
schema?: any;
|
|
54
|
+
}
|
|
55
|
+
export interface ProjectAgent {
|
|
56
|
+
character: Character;
|
|
57
|
+
init?: (runtime: IAgentRuntime) => Promise<void>;
|
|
58
|
+
plugins?: Plugin[];
|
|
59
|
+
tests?: TestSuite | TestSuite[];
|
|
60
|
+
}
|
|
61
|
+
export interface Project {
|
|
62
|
+
agents: ProjectAgent[];
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|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;IAC3B,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,YAAY,EAAE,CAAC;CACxB"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { Service } from './service';
|
|
2
|
+
import type { UUID } from './primitives';
|
|
3
|
+
export interface PostMedia {
|
|
4
|
+
id: UUID;
|
|
5
|
+
url: string;
|
|
6
|
+
type: 'image' | 'video' | 'audio' | 'document';
|
|
7
|
+
mimeType: string;
|
|
8
|
+
size: number;
|
|
9
|
+
width?: number;
|
|
10
|
+
height?: number;
|
|
11
|
+
duration?: number;
|
|
12
|
+
thumbnail?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
altText?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface PostLocation {
|
|
17
|
+
name: string;
|
|
18
|
+
address?: string;
|
|
19
|
+
coordinates?: {
|
|
20
|
+
latitude: number;
|
|
21
|
+
longitude: number;
|
|
22
|
+
};
|
|
23
|
+
placeId?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface PostAuthor {
|
|
26
|
+
id: UUID;
|
|
27
|
+
username: string;
|
|
28
|
+
displayName: string;
|
|
29
|
+
avatar?: string;
|
|
30
|
+
verified?: boolean;
|
|
31
|
+
followerCount?: number;
|
|
32
|
+
followingCount?: number;
|
|
33
|
+
bio?: string;
|
|
34
|
+
website?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface PostEngagement {
|
|
37
|
+
likes: number;
|
|
38
|
+
shares: number;
|
|
39
|
+
comments: number;
|
|
40
|
+
views?: number;
|
|
41
|
+
hasLiked: boolean;
|
|
42
|
+
hasShared: boolean;
|
|
43
|
+
hasCommented: boolean;
|
|
44
|
+
hasSaved: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface PostContent {
|
|
47
|
+
text?: string;
|
|
48
|
+
html?: string;
|
|
49
|
+
media?: PostMedia[];
|
|
50
|
+
location?: PostLocation;
|
|
51
|
+
tags?: string[];
|
|
52
|
+
mentions?: UUID[];
|
|
53
|
+
links?: Array<{
|
|
54
|
+
url: string;
|
|
55
|
+
title?: string;
|
|
56
|
+
description?: string;
|
|
57
|
+
image?: string;
|
|
58
|
+
}>;
|
|
59
|
+
poll?: {
|
|
60
|
+
question: string;
|
|
61
|
+
options: Array<{
|
|
62
|
+
text: string;
|
|
63
|
+
votes: number;
|
|
64
|
+
}>;
|
|
65
|
+
expiresAt?: Date;
|
|
66
|
+
multipleChoice?: boolean;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export interface PostInfo {
|
|
70
|
+
id: UUID;
|
|
71
|
+
author: PostAuthor;
|
|
72
|
+
content: PostContent;
|
|
73
|
+
platform: string;
|
|
74
|
+
platformId: string;
|
|
75
|
+
url: string;
|
|
76
|
+
createdAt: Date;
|
|
77
|
+
editedAt?: Date;
|
|
78
|
+
scheduledAt?: Date;
|
|
79
|
+
engagement: PostEngagement;
|
|
80
|
+
visibility: 'public' | 'private' | 'followers' | 'friends' | 'unlisted';
|
|
81
|
+
replyTo?: UUID;
|
|
82
|
+
thread?: {
|
|
83
|
+
id: UUID;
|
|
84
|
+
position: number;
|
|
85
|
+
total: number;
|
|
86
|
+
};
|
|
87
|
+
crossPosted?: Array<{
|
|
88
|
+
platform: string;
|
|
89
|
+
platformId: string;
|
|
90
|
+
url: string;
|
|
91
|
+
}>;
|
|
92
|
+
}
|
|
93
|
+
export interface PostCreateOptions {
|
|
94
|
+
platforms?: string[];
|
|
95
|
+
scheduledAt?: Date;
|
|
96
|
+
visibility?: PostInfo['visibility'];
|
|
97
|
+
replyTo?: UUID;
|
|
98
|
+
thread?: boolean;
|
|
99
|
+
location?: PostLocation;
|
|
100
|
+
tags?: string[];
|
|
101
|
+
mentions?: UUID[];
|
|
102
|
+
enableComments?: boolean;
|
|
103
|
+
enableSharing?: boolean;
|
|
104
|
+
contentWarning?: string;
|
|
105
|
+
sensitive?: boolean;
|
|
106
|
+
}
|
|
107
|
+
export interface PostSearchOptions {
|
|
108
|
+
query?: string;
|
|
109
|
+
author?: UUID;
|
|
110
|
+
platform?: string;
|
|
111
|
+
tags?: string[];
|
|
112
|
+
mentions?: UUID[];
|
|
113
|
+
since?: Date;
|
|
114
|
+
before?: Date;
|
|
115
|
+
limit?: number;
|
|
116
|
+
offset?: number;
|
|
117
|
+
hasMedia?: boolean;
|
|
118
|
+
hasLocation?: boolean;
|
|
119
|
+
visibility?: PostInfo['visibility'];
|
|
120
|
+
sortBy?: 'date' | 'engagement' | 'relevance';
|
|
121
|
+
}
|
|
122
|
+
export interface PostAnalytics {
|
|
123
|
+
postId: UUID;
|
|
124
|
+
platform: string;
|
|
125
|
+
impressions: number;
|
|
126
|
+
reach: number;
|
|
127
|
+
engagement: PostEngagement;
|
|
128
|
+
clicks: number;
|
|
129
|
+
shares: number;
|
|
130
|
+
saves: number;
|
|
131
|
+
demographics?: {
|
|
132
|
+
age?: Record<string, number>;
|
|
133
|
+
gender?: Record<string, number>;
|
|
134
|
+
location?: Record<string, number>;
|
|
135
|
+
};
|
|
136
|
+
topPerformingHours?: Array<{
|
|
137
|
+
hour: number;
|
|
138
|
+
engagement: number;
|
|
139
|
+
}>;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Interface for social media posting services
|
|
143
|
+
*/
|
|
144
|
+
export declare abstract class IPostService extends Service {
|
|
145
|
+
static readonly serviceType: "post";
|
|
146
|
+
readonly capabilityDescription = "Social media posting and content management capabilities";
|
|
147
|
+
/**
|
|
148
|
+
* Create and publish a new post
|
|
149
|
+
* @param content - Post content
|
|
150
|
+
* @param options - Publishing options
|
|
151
|
+
* @returns Promise resolving to post ID
|
|
152
|
+
*/
|
|
153
|
+
abstract createPost(content: PostContent, options?: PostCreateOptions): Promise<UUID>;
|
|
154
|
+
/**
|
|
155
|
+
* Get posts from timeline or specific user
|
|
156
|
+
* @param options - Search options
|
|
157
|
+
* @returns Promise resolving to array of posts
|
|
158
|
+
*/
|
|
159
|
+
abstract getPosts(options?: PostSearchOptions): Promise<PostInfo[]>;
|
|
160
|
+
/**
|
|
161
|
+
* Get a specific post by ID
|
|
162
|
+
* @param postId - Post ID
|
|
163
|
+
* @returns Promise resolving to post info
|
|
164
|
+
*/
|
|
165
|
+
abstract getPost(postId: UUID): Promise<PostInfo>;
|
|
166
|
+
/**
|
|
167
|
+
* Edit an existing post
|
|
168
|
+
* @param postId - Post ID
|
|
169
|
+
* @param content - New post content
|
|
170
|
+
* @returns Promise resolving when edit completes
|
|
171
|
+
*/
|
|
172
|
+
abstract editPost(postId: UUID, content: PostContent): Promise<void>;
|
|
173
|
+
/**
|
|
174
|
+
* Delete a post
|
|
175
|
+
* @param postId - Post ID
|
|
176
|
+
* @returns Promise resolving when deletion completes
|
|
177
|
+
*/
|
|
178
|
+
abstract deletePost(postId: UUID): Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* Like/unlike a post
|
|
181
|
+
* @param postId - Post ID
|
|
182
|
+
* @param like - True to like, false to unlike
|
|
183
|
+
* @returns Promise resolving when operation completes
|
|
184
|
+
*/
|
|
185
|
+
abstract likePost(postId: UUID, like: boolean): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Share/repost a post
|
|
188
|
+
* @param postId - Post ID
|
|
189
|
+
* @param comment - Optional comment when sharing
|
|
190
|
+
* @returns Promise resolving to share ID
|
|
191
|
+
*/
|
|
192
|
+
abstract sharePost(postId: UUID, comment?: string): Promise<UUID>;
|
|
193
|
+
/**
|
|
194
|
+
* Save/unsave a post
|
|
195
|
+
* @param postId - Post ID
|
|
196
|
+
* @param save - True to save, false to unsave
|
|
197
|
+
* @returns Promise resolving when operation completes
|
|
198
|
+
*/
|
|
199
|
+
abstract savePost(postId: UUID, save: boolean): Promise<void>;
|
|
200
|
+
/**
|
|
201
|
+
* Comment on a post
|
|
202
|
+
* @param postId - Post ID
|
|
203
|
+
* @param content - Comment content
|
|
204
|
+
* @returns Promise resolving to comment ID
|
|
205
|
+
*/
|
|
206
|
+
abstract commentOnPost(postId: UUID, content: PostContent): Promise<UUID>;
|
|
207
|
+
/**
|
|
208
|
+
* Get comments for a post
|
|
209
|
+
* @param postId - Post ID
|
|
210
|
+
* @param options - Search options
|
|
211
|
+
* @returns Promise resolving to array of comments
|
|
212
|
+
*/
|
|
213
|
+
abstract getComments(postId: UUID, options?: PostSearchOptions): Promise<PostInfo[]>;
|
|
214
|
+
/**
|
|
215
|
+
* Schedule a post for later publishing
|
|
216
|
+
* @param content - Post content
|
|
217
|
+
* @param scheduledAt - When to publish
|
|
218
|
+
* @param options - Publishing options
|
|
219
|
+
* @returns Promise resolving to scheduled post ID
|
|
220
|
+
*/
|
|
221
|
+
abstract schedulePost(content: PostContent, scheduledAt: Date, options?: PostCreateOptions): Promise<UUID>;
|
|
222
|
+
/**
|
|
223
|
+
* Get analytics for a post
|
|
224
|
+
* @param postId - Post ID
|
|
225
|
+
* @returns Promise resolving to post analytics
|
|
226
|
+
*/
|
|
227
|
+
abstract getPostAnalytics(postId: UUID): Promise<PostAnalytics>;
|
|
228
|
+
/**
|
|
229
|
+
* Get trending posts
|
|
230
|
+
* @param options - Search options
|
|
231
|
+
* @returns Promise resolving to trending posts
|
|
232
|
+
*/
|
|
233
|
+
abstract getTrendingPosts(options?: PostSearchOptions): Promise<PostInfo[]>;
|
|
234
|
+
/**
|
|
235
|
+
* Search posts across platforms
|
|
236
|
+
* @param query - Search query
|
|
237
|
+
* @param options - Search options
|
|
238
|
+
* @returns Promise resolving to search results
|
|
239
|
+
*/
|
|
240
|
+
abstract searchPosts(query: string, options?: PostSearchOptions): Promise<PostInfo[]>;
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=post.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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G,OAAO,CAAC,QAAQ,EAAE,CAAC;IAE3E;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;CACtF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines a custom type UUID representing a universally unique identifier
|
|
3
|
+
*/
|
|
4
|
+
export type UUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
5
|
+
/**
|
|
6
|
+
* Helper function to safely cast a string to strongly typed UUID
|
|
7
|
+
* @param id The string UUID to validate and cast
|
|
8
|
+
* @returns The same UUID with branded type information
|
|
9
|
+
*/
|
|
10
|
+
export declare function asUUID(id: string): UUID;
|
|
11
|
+
/**
|
|
12
|
+
* Represents the content of a memory, message, or other information
|
|
13
|
+
*/
|
|
14
|
+
export interface Content {
|
|
15
|
+
/** The agent's internal thought process */
|
|
16
|
+
thought?: string;
|
|
17
|
+
/** The main text content visible to users */
|
|
18
|
+
text?: string;
|
|
19
|
+
/** Optional actions to be performed */
|
|
20
|
+
actions?: string[];
|
|
21
|
+
/** Optional providers to use for context generation */
|
|
22
|
+
providers?: string[];
|
|
23
|
+
/** Optional source/origin of the content */
|
|
24
|
+
source?: string;
|
|
25
|
+
/** Optional target/destination for responses */
|
|
26
|
+
target?: string;
|
|
27
|
+
/** URL of the original message/post (e.g. tweet URL, Discord message link) */
|
|
28
|
+
url?: string;
|
|
29
|
+
/** UUID of parent message if this is a reply/thread */
|
|
30
|
+
inReplyTo?: UUID;
|
|
31
|
+
/** Array of media attachments */
|
|
32
|
+
attachments?: Media[];
|
|
33
|
+
/** room type */
|
|
34
|
+
channelType?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Additional dynamic properties
|
|
37
|
+
* Use specific properties above instead of this when possible
|
|
38
|
+
*/
|
|
39
|
+
[key: string]: unknown;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Represents a media attachment
|
|
43
|
+
*/
|
|
44
|
+
export type Media = {
|
|
45
|
+
/** Unique identifier */
|
|
46
|
+
id: string;
|
|
47
|
+
/** Media URL */
|
|
48
|
+
url: string;
|
|
49
|
+
/** Media title */
|
|
50
|
+
title?: string;
|
|
51
|
+
/** Media source */
|
|
52
|
+
source?: string;
|
|
53
|
+
/** Media description */
|
|
54
|
+
description?: string;
|
|
55
|
+
/** Text content */
|
|
56
|
+
text?: string;
|
|
57
|
+
/** Content type */
|
|
58
|
+
contentType?: ContentType;
|
|
59
|
+
};
|
|
60
|
+
export declare enum ContentType {
|
|
61
|
+
IMAGE = "image",
|
|
62
|
+
VIDEO = "video",
|
|
63
|
+
AUDIO = "audio",
|
|
64
|
+
DOCUMENT = "document",
|
|
65
|
+
LINK = "link"
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A generic type for metadata objects, allowing for arbitrary key-value pairs.
|
|
69
|
+
* This encourages consumers to perform type checking or casting.
|
|
70
|
+
*/
|
|
71
|
+
export type Metadata = Record<string, unknown>;
|
|
72
|
+
//# sourceMappingURL=primitives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../../../core/src/types/primitives.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;AAEvE;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAKvC;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAErB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,8EAA8E;IAC9E,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,uDAAuD;IACvD,SAAS,CAAC,EAAE,IAAI,CAAC;IAEjB,iCAAiC;IACjC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC;IAEtB,gBAAgB;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG;IAClB,wBAAwB;IACxB,EAAE,EAAE,MAAM,CAAC;IAEX,gBAAgB;IAChB,GAAG,EAAE,MAAM,CAAC;IAEZ,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,mBAAmB;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,wBAAwB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,mBAAmB;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,mBAAmB;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,IAAI,SAAS;CACd;AAED;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
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
|
+
* Represents the core runtime environment for an agent.
|
|
16
|
+
* Defines methods for database interaction, plugin management, event handling,
|
|
17
|
+
* state composition, model usage, and task management.
|
|
18
|
+
*/
|
|
19
|
+
export interface IAgentRuntime extends IDatabaseAdapter {
|
|
20
|
+
agentId: UUID;
|
|
21
|
+
character: Character;
|
|
22
|
+
providers: Provider[];
|
|
23
|
+
actions: Action[];
|
|
24
|
+
evaluators: Evaluator[];
|
|
25
|
+
plugins: Plugin[];
|
|
26
|
+
services: Map<ServiceTypeName, Service[]>;
|
|
27
|
+
events: Map<string, ((params: any) => Promise<void>)[]>;
|
|
28
|
+
fetch?: typeof fetch | null;
|
|
29
|
+
routes: Route[];
|
|
30
|
+
logger: any;
|
|
31
|
+
registerPlugin(plugin: Plugin): Promise<void>;
|
|
32
|
+
initialize(): Promise<void>;
|
|
33
|
+
getConnection(): Promise<any>;
|
|
34
|
+
getService<T extends Service>(service: ServiceTypeName | string): T | null;
|
|
35
|
+
getServicesByType<T extends Service>(service: ServiceTypeName | string): T[];
|
|
36
|
+
getAllServices(): Map<ServiceTypeName, Service[]>;
|
|
37
|
+
registerService(service: typeof Service): Promise<void>;
|
|
38
|
+
getServiceLoadPromise(serviceType: ServiceTypeName): Promise<Service>;
|
|
39
|
+
getRegisteredServiceTypes(): ServiceTypeName[];
|
|
40
|
+
hasService(serviceType: ServiceTypeName | string): boolean;
|
|
41
|
+
registerDatabaseAdapter(adapter: IDatabaseAdapter): void;
|
|
42
|
+
setSetting(key: string, value: string | boolean | null | any, secret?: boolean): void;
|
|
43
|
+
getSetting(key: string): string | boolean | null | any;
|
|
44
|
+
getConversationLength(): number;
|
|
45
|
+
processActions(message: Memory, responses: Memory[], state?: State, callback?: HandlerCallback): Promise<void>;
|
|
46
|
+
evaluate(message: Memory, state?: State, didRespond?: boolean, callback?: HandlerCallback, responses?: Memory[]): Promise<Evaluator[] | null>;
|
|
47
|
+
registerProvider(provider: Provider): void;
|
|
48
|
+
registerAction(action: Action): void;
|
|
49
|
+
registerEvaluator(evaluator: Evaluator): void;
|
|
50
|
+
ensureConnections(entities: Entity[], rooms: Room[], source: string, world: World): Promise<void>;
|
|
51
|
+
ensureConnection({ entityId, roomId, metadata, userName, worldName, name, source, channelId, serverId, type, worldId, userId, }: {
|
|
52
|
+
entityId: UUID;
|
|
53
|
+
roomId: UUID;
|
|
54
|
+
userName?: string;
|
|
55
|
+
name?: string;
|
|
56
|
+
worldName?: string;
|
|
57
|
+
source?: string;
|
|
58
|
+
channelId?: string;
|
|
59
|
+
serverId?: string;
|
|
60
|
+
type: any;
|
|
61
|
+
worldId: UUID;
|
|
62
|
+
userId?: UUID;
|
|
63
|
+
metadata?: Record<string, any>;
|
|
64
|
+
}): Promise<void>;
|
|
65
|
+
ensureParticipantInRoom(entityId: UUID, roomId: UUID): Promise<void>;
|
|
66
|
+
ensureWorldExists(world: World): Promise<void>;
|
|
67
|
+
ensureRoomExists(room: Room): Promise<void>;
|
|
68
|
+
composeState(message: Memory, includeList?: string[], onlyInclude?: boolean, skipCache?: boolean): Promise<State>;
|
|
69
|
+
useModel<T extends ModelTypeName, R = ModelResultMap[T]>(modelType: T, params: Omit<ModelParamsMap[T], 'runtime'> | any): Promise<R>;
|
|
70
|
+
registerModel(modelType: ModelTypeName | string, handler: (params: any) => Promise<any>, provider: string, priority?: number): void;
|
|
71
|
+
getModel(modelType: ModelTypeName | string): ((runtime: IAgentRuntime, params: any) => Promise<any>) | undefined;
|
|
72
|
+
registerEvent(event: string, handler: (params: any) => Promise<void>): void;
|
|
73
|
+
getEvent(event: string): ((params: any) => Promise<void>)[] | undefined;
|
|
74
|
+
emitEvent(event: string | string[], params: any): Promise<void>;
|
|
75
|
+
registerTaskWorker(taskHandler: TaskWorker): void;
|
|
76
|
+
getTaskWorker(name: string): TaskWorker | undefined;
|
|
77
|
+
stop(): Promise<void>;
|
|
78
|
+
addEmbeddingToMemory(memory: Memory): Promise<Memory>;
|
|
79
|
+
/**
|
|
80
|
+
* Queue a memory for async embedding generation.
|
|
81
|
+
* This method is non-blocking and returns immediately.
|
|
82
|
+
* The embedding will be generated asynchronously via event handlers.
|
|
83
|
+
* @param memory The memory to generate embeddings for
|
|
84
|
+
* @param priority Priority level for the embedding generation
|
|
85
|
+
*/
|
|
86
|
+
queueEmbeddingGeneration(memory: Memory, priority?: 'high' | 'normal' | 'low'): Promise<void>;
|
|
87
|
+
getAllMemories(): Promise<Memory[]>;
|
|
88
|
+
clearAllAgentMemories(): Promise<void>;
|
|
89
|
+
updateMemory(memory: Partial<Memory> & {
|
|
90
|
+
id: UUID;
|
|
91
|
+
metadata?: MemoryMetadata;
|
|
92
|
+
}): Promise<boolean>;
|
|
93
|
+
createRunId(): UUID;
|
|
94
|
+
startRun(): UUID;
|
|
95
|
+
endRun(): void;
|
|
96
|
+
getCurrentRunId(): UUID;
|
|
97
|
+
getEntityById(entityId: UUID): Promise<Entity | null>;
|
|
98
|
+
getRoom(roomId: UUID): Promise<Room | null>;
|
|
99
|
+
createEntity(entity: Entity): Promise<boolean>;
|
|
100
|
+
createRoom({ id, name, source, type, channelId, serverId, worldId }: Room): Promise<UUID>;
|
|
101
|
+
addParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
102
|
+
getRooms(worldId: UUID): Promise<Room[]>;
|
|
103
|
+
registerSendHandler(source: string, handler: SendHandlerFunction): void;
|
|
104
|
+
sendMessageToTarget(target: TargetInfo, content: Content): Promise<void>;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
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AO,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IAC5C,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,UAAU,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1F,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/D,QAAQ,CAAC,OAAO,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAEzC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAExE,mBAAmB,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1E"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { Metadata } from './primitives';
|
|
2
|
+
import type { IAgentRuntime } from './runtime';
|
|
3
|
+
/**
|
|
4
|
+
* Core service type registry that can be extended by plugins via module augmentation.
|
|
5
|
+
* Plugins can extend this interface to add their own service types:
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* declare module '@elizaos/core' {
|
|
10
|
+
* interface ServiceTypeRegistry {
|
|
11
|
+
* MY_CUSTOM_SERVICE: 'my_custom_service';
|
|
12
|
+
* }
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export interface ServiceTypeRegistry {
|
|
17
|
+
TRANSCRIPTION: 'transcription';
|
|
18
|
+
VIDEO: 'video';
|
|
19
|
+
BROWSER: 'browser';
|
|
20
|
+
PDF: 'pdf';
|
|
21
|
+
REMOTE_FILES: 'aws_s3';
|
|
22
|
+
WEB_SEARCH: 'web_search';
|
|
23
|
+
EMAIL: 'email';
|
|
24
|
+
TEE: 'tee';
|
|
25
|
+
TASK: 'task';
|
|
26
|
+
WALLET: 'wallet';
|
|
27
|
+
LP_POOL: 'lp_pool';
|
|
28
|
+
TOKEN_DATA: 'token_data';
|
|
29
|
+
MESSAGE: 'message';
|
|
30
|
+
POST: 'post';
|
|
31
|
+
UNKNOWN: 'unknown';
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Type for service names that includes both core services and any plugin-registered services
|
|
35
|
+
*/
|
|
36
|
+
export type ServiceTypeName = ServiceTypeRegistry[keyof ServiceTypeRegistry];
|
|
37
|
+
/**
|
|
38
|
+
* Helper type to extract service type values from the registry
|
|
39
|
+
*/
|
|
40
|
+
export type ServiceTypeValue<K extends keyof ServiceTypeRegistry> = ServiceTypeRegistry[K];
|
|
41
|
+
/**
|
|
42
|
+
* Helper type to check if a service type exists in the registry
|
|
43
|
+
*/
|
|
44
|
+
export type IsValidServiceType<T extends string> = T extends ServiceTypeName ? true : false;
|
|
45
|
+
/**
|
|
46
|
+
* Type-safe service class definition
|
|
47
|
+
*/
|
|
48
|
+
export type TypedServiceClass<T extends ServiceTypeName> = {
|
|
49
|
+
new (runtime?: IAgentRuntime): Service;
|
|
50
|
+
serviceType: T;
|
|
51
|
+
start(runtime: IAgentRuntime): Promise<Service>;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Map of service type names to their implementation classes
|
|
55
|
+
*/
|
|
56
|
+
export interface ServiceClassMap {
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Helper to infer service instance type from service type name
|
|
60
|
+
*/
|
|
61
|
+
export type ServiceInstance<T extends ServiceTypeName> = T extends keyof ServiceClassMap ? InstanceType<ServiceClassMap[T]> : Service;
|
|
62
|
+
/**
|
|
63
|
+
* Runtime service registry type
|
|
64
|
+
*/
|
|
65
|
+
export type ServiceRegistry<T extends ServiceTypeName = ServiceTypeName> = Map<T, Service>;
|
|
66
|
+
/**
|
|
67
|
+
* Enumerates the recognized types of services that can be registered and used by the agent runtime.
|
|
68
|
+
* Services provide specialized functionalities like audio transcription, video processing,
|
|
69
|
+
* web browsing, PDF handling, file storage (e.g., AWS S3), web search, email integration,
|
|
70
|
+
* secure execution via TEE (Trusted Execution Environment), and task management.
|
|
71
|
+
* This constant is used in `AgentRuntime` for service registration and retrieval (e.g., `getService`).
|
|
72
|
+
* Each service typically implements the `Service` abstract class or a more specific interface like `IVideoService`.
|
|
73
|
+
*/
|
|
74
|
+
export declare const ServiceType: {
|
|
75
|
+
readonly TRANSCRIPTION: "transcription";
|
|
76
|
+
readonly VIDEO: "video";
|
|
77
|
+
readonly BROWSER: "browser";
|
|
78
|
+
readonly PDF: "pdf";
|
|
79
|
+
readonly REMOTE_FILES: "aws_s3";
|
|
80
|
+
readonly WEB_SEARCH: "web_search";
|
|
81
|
+
readonly EMAIL: "email";
|
|
82
|
+
readonly TEE: "tee";
|
|
83
|
+
readonly TASK: "task";
|
|
84
|
+
readonly WALLET: "wallet";
|
|
85
|
+
readonly LP_POOL: "lp_pool";
|
|
86
|
+
readonly TOKEN_DATA: "token_data";
|
|
87
|
+
readonly MESSAGE: "message";
|
|
88
|
+
readonly POST: "post";
|
|
89
|
+
readonly UNKNOWN: "unknown";
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Client instance
|
|
93
|
+
*/
|
|
94
|
+
export declare abstract class Service {
|
|
95
|
+
/** Runtime instance */
|
|
96
|
+
protected runtime: IAgentRuntime;
|
|
97
|
+
constructor(runtime?: IAgentRuntime);
|
|
98
|
+
abstract stop(): Promise<void>;
|
|
99
|
+
/** Service type */
|
|
100
|
+
static serviceType: string;
|
|
101
|
+
/** Service name */
|
|
102
|
+
abstract capabilityDescription: string;
|
|
103
|
+
/** Service configuration */
|
|
104
|
+
config?: Metadata;
|
|
105
|
+
/** Start service connection */
|
|
106
|
+
static start(_runtime: IAgentRuntime): Promise<Service>;
|
|
107
|
+
/** Stop service connection */
|
|
108
|
+
static stop(_runtime: IAgentRuntime): Promise<unknown>;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Generic service interface that provides better type checking for services
|
|
112
|
+
* @template ConfigType The configuration type for this service
|
|
113
|
+
* @template ResultType The result type returned by the service operations
|
|
114
|
+
*/
|
|
115
|
+
export interface TypedService<ConfigType extends Metadata = Metadata, ResultType = unknown> extends Service {
|
|
116
|
+
/**
|
|
117
|
+
* The configuration for this service instance
|
|
118
|
+
*/
|
|
119
|
+
config?: ConfigType;
|
|
120
|
+
/**
|
|
121
|
+
* Process an input with this service
|
|
122
|
+
* @param input The input to process
|
|
123
|
+
* @returns A promise resolving to the result
|
|
124
|
+
*/
|
|
125
|
+
process(input: unknown): Promise<ResultType>;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Generic factory function to create a typed service instance
|
|
129
|
+
* @param runtime The agent runtime
|
|
130
|
+
* @param serviceType The type of service to get
|
|
131
|
+
* @returns The service instance or null if not available
|
|
132
|
+
*/
|
|
133
|
+
export declare function getTypedService<T extends TypedService<any, any>>(runtime: IAgentRuntime, serviceType: ServiceTypeName): T | null;
|
|
134
|
+
/**
|
|
135
|
+
* Standardized service error type for consistent error handling
|
|
136
|
+
*/
|
|
137
|
+
export interface ServiceError {
|
|
138
|
+
code: string;
|
|
139
|
+
message: string;
|
|
140
|
+
details?: unknown;
|
|
141
|
+
cause?: Error;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Safely create a ServiceError from any caught error
|
|
145
|
+
*/
|
|
146
|
+
export declare function createServiceError(error: unknown, code?: string): ServiceError;
|
|
147
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../../core/src/types/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAA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