@elizaos/server 1.5.4 → 1.5.5-alpha.3
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/messaging/core.d.ts.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +347 -152
- package/dist/services/message.d.ts +3 -1
- package/dist/services/message.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/api/messaging/core.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK/C;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/api/messaging/core.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK/C;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAiUrF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -132,6 +132,14 @@ export declare class AgentServer {
|
|
|
132
132
|
findOrCreateCentralDmChannel(user1Id: UUID, user2Id: UUID, messageServerId: UUID): Promise<MessageChannel>;
|
|
133
133
|
createMessage(data: Omit<CentralRootMessage, 'id' | 'createdAt' | 'updatedAt'>): Promise<CentralRootMessage>;
|
|
134
134
|
getMessagesForChannel(channelId: UUID, limit?: number, beforeTimestamp?: Date): Promise<CentralRootMessage[]>;
|
|
135
|
+
updateMessage(messageId: UUID, patch: {
|
|
136
|
+
content?: string;
|
|
137
|
+
rawMessage?: any;
|
|
138
|
+
sourceType?: string;
|
|
139
|
+
sourceId?: string;
|
|
140
|
+
metadata?: any;
|
|
141
|
+
inReplyToRootMessageId?: UUID;
|
|
142
|
+
}): Promise<CentralRootMessage | null>;
|
|
135
143
|
removeParticipantFromChannel(): Promise<void>;
|
|
136
144
|
/**
|
|
137
145
|
* Add an agent to a server
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,eAAe,EACf,KAAK,aAAa,EAElB,KAAK,IAAI,EAEV,MAAM,eAAe,CAAC;AAEvB,OAAO,OAA8B,MAAM,SAAS,CAAC;AAGrD,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,WAAW,CAAC;AAYrD,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,aAAa,EAEd,MAAM,YAAY,CAAC;AAKpB;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAoBxD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAqB3E;AAMD;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,GAAG,EAAE,OAAO,CAAC,OAAO,EACpB,GAAG,EAAE,OAAO,CAAC,QAAQ,EACrB,IAAI,EAAE,OAAO,CAAC,YAAY,KACvB,IAAI,CAAC;AAEV;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAWxC;AA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AAkB,EAClB,cAAc,GACf,MAAM,UAAU,CAAC;AAGlB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
21
21
|
// ../../node_modules/path-to-regexp/dist/index.js
|
|
22
22
|
var require_dist = __commonJS((exports) => {
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.TokenData = undefined;
|
|
24
|
+
exports.PathError = exports.TokenData = undefined;
|
|
25
25
|
exports.parse = parse;
|
|
26
26
|
exports.compile = compile;
|
|
27
27
|
exports.match = match;
|
|
@@ -31,7 +31,6 @@ var require_dist = __commonJS((exports) => {
|
|
|
31
31
|
var NOOP_VALUE = (value) => value;
|
|
32
32
|
var ID_START = /^[$_\p{ID_Start}]$/u;
|
|
33
33
|
var ID_CONTINUE = /^[$\u200c\u200d\p{ID_Continue}]$/u;
|
|
34
|
-
var DEBUG_URL = "https://git.new/pathToRegexpError";
|
|
35
34
|
var SIMPLE_TOKENS = {
|
|
36
35
|
"{": "{",
|
|
37
36
|
"}": "}",
|
|
@@ -44,151 +43,125 @@ var require_dist = __commonJS((exports) => {
|
|
|
44
43
|
"!": "!"
|
|
45
44
|
};
|
|
46
45
|
function escapeText(str) {
|
|
47
|
-
return str.replace(/[{}()\[\]
|
|
46
|
+
return str.replace(/[{}()\[\]+?!:*\\]/g, "\\$&");
|
|
48
47
|
}
|
|
49
48
|
function escape(str) {
|
|
50
49
|
return str.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
|
|
51
50
|
}
|
|
52
|
-
|
|
51
|
+
|
|
52
|
+
class TokenData {
|
|
53
|
+
constructor(tokens, originalPath) {
|
|
54
|
+
this.tokens = tokens;
|
|
55
|
+
this.originalPath = originalPath;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.TokenData = TokenData;
|
|
59
|
+
|
|
60
|
+
class PathError extends TypeError {
|
|
61
|
+
constructor(message, originalPath) {
|
|
62
|
+
let text = message;
|
|
63
|
+
if (originalPath)
|
|
64
|
+
text += `: ${originalPath}`;
|
|
65
|
+
text += `; visit https://git.new/pathToRegexpError for info`;
|
|
66
|
+
super(text);
|
|
67
|
+
this.originalPath = originalPath;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.PathError = PathError;
|
|
71
|
+
function parse(str, options = {}) {
|
|
72
|
+
const { encodePath = NOOP_VALUE } = options;
|
|
53
73
|
const chars = [...str];
|
|
54
|
-
|
|
74
|
+
const tokens = [];
|
|
75
|
+
let index = 0;
|
|
76
|
+
let pos = 0;
|
|
55
77
|
function name() {
|
|
56
78
|
let value = "";
|
|
57
|
-
if (ID_START.test(chars[
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
pos = 0;
|
|
79
|
+
if (ID_START.test(chars[index])) {
|
|
80
|
+
do {
|
|
81
|
+
value += chars[index++];
|
|
82
|
+
} while (ID_CONTINUE.test(chars[index]));
|
|
83
|
+
} else if (chars[index] === '"') {
|
|
84
|
+
let quoteStart = index;
|
|
85
|
+
while (index++ < chars.length) {
|
|
86
|
+
if (chars[index] === '"') {
|
|
87
|
+
index++;
|
|
88
|
+
quoteStart = 0;
|
|
68
89
|
break;
|
|
69
90
|
}
|
|
70
|
-
if (chars[
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
value += chars[i];
|
|
74
|
-
}
|
|
91
|
+
if (chars[index] === "\\")
|
|
92
|
+
index++;
|
|
93
|
+
value += chars[index];
|
|
75
94
|
}
|
|
76
|
-
if (
|
|
77
|
-
throw new
|
|
95
|
+
if (quoteStart) {
|
|
96
|
+
throw new PathError(`Unterminated quote at index ${quoteStart}`, str);
|
|
78
97
|
}
|
|
79
98
|
}
|
|
80
99
|
if (!value) {
|
|
81
|
-
throw new
|
|
100
|
+
throw new PathError(`Missing parameter name at index ${index}`, str);
|
|
82
101
|
}
|
|
83
102
|
return value;
|
|
84
103
|
}
|
|
85
|
-
while (
|
|
86
|
-
const value = chars[
|
|
104
|
+
while (index < chars.length) {
|
|
105
|
+
const value = chars[index];
|
|
87
106
|
const type = SIMPLE_TOKENS[value];
|
|
88
107
|
if (type) {
|
|
89
|
-
|
|
108
|
+
tokens.push({ type, index: index++, value });
|
|
90
109
|
} else if (value === "\\") {
|
|
91
|
-
|
|
110
|
+
tokens.push({ type: "escape", index: index++, value: chars[index++] });
|
|
92
111
|
} else if (value === ":") {
|
|
93
|
-
|
|
94
|
-
yield { type: "PARAM", index: i, value: value2 };
|
|
112
|
+
tokens.push({ type: "param", index: index++, value: name() });
|
|
95
113
|
} else if (value === "*") {
|
|
96
|
-
|
|
97
|
-
yield { type: "WILDCARD", index: i, value: value2 };
|
|
114
|
+
tokens.push({ type: "wildcard", index: index++, value: name() });
|
|
98
115
|
} else {
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return { type: "END", index: i, value: "" };
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
class Iter {
|
|
106
|
-
constructor(tokens) {
|
|
107
|
-
this.tokens = tokens;
|
|
108
|
-
}
|
|
109
|
-
peek() {
|
|
110
|
-
if (!this._peek) {
|
|
111
|
-
const next = this.tokens.next();
|
|
112
|
-
this._peek = next.value;
|
|
113
|
-
}
|
|
114
|
-
return this._peek;
|
|
115
|
-
}
|
|
116
|
-
tryConsume(type) {
|
|
117
|
-
const token = this.peek();
|
|
118
|
-
if (token.type !== type)
|
|
119
|
-
return;
|
|
120
|
-
this._peek = undefined;
|
|
121
|
-
return token.value;
|
|
122
|
-
}
|
|
123
|
-
consume(type) {
|
|
124
|
-
const value = this.tryConsume(type);
|
|
125
|
-
if (value !== undefined)
|
|
126
|
-
return value;
|
|
127
|
-
const { type: nextType, index } = this.peek();
|
|
128
|
-
throw new TypeError(`Unexpected ${nextType} at ${index}, expected ${type}: ${DEBUG_URL}`);
|
|
129
|
-
}
|
|
130
|
-
text() {
|
|
131
|
-
let result = "";
|
|
132
|
-
let value;
|
|
133
|
-
while (value = this.tryConsume("CHAR") || this.tryConsume("ESCAPED")) {
|
|
134
|
-
result += value;
|
|
116
|
+
tokens.push({ type: "char", index: index++, value });
|
|
135
117
|
}
|
|
136
|
-
return result;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
class TokenData {
|
|
141
|
-
constructor(tokens) {
|
|
142
|
-
this.tokens = tokens;
|
|
143
118
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const { encodePath = NOOP_VALUE } = options;
|
|
148
|
-
const it = new Iter(lexer(str));
|
|
149
|
-
function consume(endType) {
|
|
150
|
-
const tokens2 = [];
|
|
119
|
+
tokens.push({ type: "end", index, value: "" });
|
|
120
|
+
function consumeUntil(endType) {
|
|
121
|
+
const output = [];
|
|
151
122
|
while (true) {
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
123
|
+
const token = tokens[pos++];
|
|
124
|
+
if (token.type === endType)
|
|
125
|
+
break;
|
|
126
|
+
if (token.type === "char" || token.type === "escape") {
|
|
127
|
+
let path = token.value;
|
|
128
|
+
let cur = tokens[pos];
|
|
129
|
+
while (cur.type === "char" || cur.type === "escape") {
|
|
130
|
+
path += cur.value;
|
|
131
|
+
cur = tokens[++pos];
|
|
132
|
+
}
|
|
133
|
+
output.push({
|
|
134
|
+
type: "text",
|
|
135
|
+
value: encodePath(path)
|
|
160
136
|
});
|
|
161
137
|
continue;
|
|
162
138
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
name: wildcard
|
|
139
|
+
if (token.type === "param" || token.type === "wildcard") {
|
|
140
|
+
output.push({
|
|
141
|
+
type: token.type,
|
|
142
|
+
name: token.value
|
|
168
143
|
});
|
|
169
144
|
continue;
|
|
170
145
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
tokens2.push({
|
|
146
|
+
if (token.type === "{") {
|
|
147
|
+
output.push({
|
|
174
148
|
type: "group",
|
|
175
|
-
tokens:
|
|
149
|
+
tokens: consumeUntil("}")
|
|
176
150
|
});
|
|
177
151
|
continue;
|
|
178
152
|
}
|
|
179
|
-
|
|
180
|
-
return tokens2;
|
|
153
|
+
throw new PathError(`Unexpected ${token.type} at index ${token.index}, expected ${endType}`, str);
|
|
181
154
|
}
|
|
155
|
+
return output;
|
|
182
156
|
}
|
|
183
|
-
|
|
184
|
-
return new TokenData(tokens);
|
|
157
|
+
return new TokenData(consumeUntil("end"), str);
|
|
185
158
|
}
|
|
186
159
|
function compile(path, options = {}) {
|
|
187
160
|
const { encode = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
|
|
188
|
-
const data = path
|
|
161
|
+
const data = typeof path === "object" ? path : parse(path, options);
|
|
189
162
|
const fn = tokensToFunction(data.tokens, delimiter, encode);
|
|
190
|
-
return function path(
|
|
191
|
-
const [path2, ...missing] = fn(
|
|
163
|
+
return function path(params = {}) {
|
|
164
|
+
const [path2, ...missing] = fn(params);
|
|
192
165
|
if (missing.length) {
|
|
193
166
|
throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
|
|
194
167
|
}
|
|
@@ -277,14 +250,12 @@ var require_dist = __commonJS((exports) => {
|
|
|
277
250
|
function pathToRegexp(path, options = {}) {
|
|
278
251
|
const { delimiter = DEFAULT_DELIMITER, end = true, sensitive = false, trailing = true } = options;
|
|
279
252
|
const keys = [];
|
|
280
|
-
const sources = [];
|
|
281
253
|
const flags = sensitive ? "" : "i";
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
for (const
|
|
286
|
-
|
|
287
|
-
sources.push(regexp2);
|
|
254
|
+
const sources = [];
|
|
255
|
+
for (const input of pathsToArray(path, [])) {
|
|
256
|
+
const data = typeof input === "object" ? input : parse(input, options);
|
|
257
|
+
for (const tokens of flatten(data.tokens, 0, [])) {
|
|
258
|
+
sources.push(toRegExpSource(tokens, delimiter, keys, data.originalPath));
|
|
288
259
|
}
|
|
289
260
|
}
|
|
290
261
|
let pattern = `^(?:${sources.join("|")})`;
|
|
@@ -294,14 +265,22 @@ var require_dist = __commonJS((exports) => {
|
|
|
294
265
|
const regexp = new RegExp(pattern, flags);
|
|
295
266
|
return { regexp, keys };
|
|
296
267
|
}
|
|
268
|
+
function pathsToArray(paths, init) {
|
|
269
|
+
if (Array.isArray(paths)) {
|
|
270
|
+
for (const p of paths)
|
|
271
|
+
pathsToArray(p, init);
|
|
272
|
+
} else {
|
|
273
|
+
init.push(paths);
|
|
274
|
+
}
|
|
275
|
+
return init;
|
|
276
|
+
}
|
|
297
277
|
function* flatten(tokens, index, init) {
|
|
298
278
|
if (index === tokens.length) {
|
|
299
279
|
return yield init;
|
|
300
280
|
}
|
|
301
281
|
const token = tokens[index];
|
|
302
282
|
if (token.type === "group") {
|
|
303
|
-
const
|
|
304
|
-
for (const seq of flatten(token.tokens, 0, fork)) {
|
|
283
|
+
for (const seq of flatten(token.tokens, 0, init.slice())) {
|
|
305
284
|
yield* flatten(tokens, index + 1, seq);
|
|
306
285
|
}
|
|
307
286
|
} else {
|
|
@@ -309,12 +288,11 @@ var require_dist = __commonJS((exports) => {
|
|
|
309
288
|
}
|
|
310
289
|
yield* flatten(tokens, index + 1, init);
|
|
311
290
|
}
|
|
312
|
-
function
|
|
291
|
+
function toRegExpSource(tokens, delimiter, keys, originalPath) {
|
|
313
292
|
let result = "";
|
|
314
293
|
let backtrack = "";
|
|
315
294
|
let isSafeSegmentParam = true;
|
|
316
|
-
for (
|
|
317
|
-
const token = tokens[i];
|
|
295
|
+
for (const token of tokens) {
|
|
318
296
|
if (token.type === "text") {
|
|
319
297
|
result += escape(token.value);
|
|
320
298
|
backtrack += token.value;
|
|
@@ -323,7 +301,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
323
301
|
}
|
|
324
302
|
if (token.type === "param" || token.type === "wildcard") {
|
|
325
303
|
if (!isSafeSegmentParam && !backtrack) {
|
|
326
|
-
throw new
|
|
304
|
+
throw new PathError(`Missing text before "${token.name}" ${token.type}`, originalPath);
|
|
327
305
|
}
|
|
328
306
|
if (token.type === "param") {
|
|
329
307
|
result += `(${negate(delimiter, isSafeSegmentParam ? "" : backtrack)}+)`;
|
|
@@ -349,32 +327,46 @@ var require_dist = __commonJS((exports) => {
|
|
|
349
327
|
}
|
|
350
328
|
return `(?:(?!${escape(backtrack)}|${escape(delimiter)})[\\s\\S])`;
|
|
351
329
|
}
|
|
352
|
-
function
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
330
|
+
function stringifyTokens(tokens) {
|
|
331
|
+
let value = "";
|
|
332
|
+
let i = 0;
|
|
333
|
+
function name(value2) {
|
|
334
|
+
const isSafe = isNameSafe(value2) && isNextNameSafe(tokens[i]);
|
|
335
|
+
return isSafe ? value2 : JSON.stringify(value2);
|
|
336
|
+
}
|
|
337
|
+
while (i < tokens.length) {
|
|
338
|
+
const token = tokens[i++];
|
|
339
|
+
if (token.type === "text") {
|
|
340
|
+
value += escapeText(token.value);
|
|
341
|
+
continue;
|
|
342
|
+
}
|
|
356
343
|
if (token.type === "group") {
|
|
357
|
-
|
|
344
|
+
value += `{${stringifyTokens(token.tokens)}}`;
|
|
345
|
+
continue;
|
|
358
346
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
if (token.type === "wildcard")
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
347
|
+
if (token.type === "param") {
|
|
348
|
+
value += `:${name(token.name)}`;
|
|
349
|
+
continue;
|
|
350
|
+
}
|
|
351
|
+
if (token.type === "wildcard") {
|
|
352
|
+
value += `*${name(token.name)}`;
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
throw new TypeError(`Unknown token type: ${token.type}`);
|
|
356
|
+
}
|
|
357
|
+
return value;
|
|
358
|
+
}
|
|
359
|
+
function stringify(data) {
|
|
360
|
+
return stringifyTokens(data.tokens);
|
|
367
361
|
}
|
|
368
362
|
function isNameSafe(name) {
|
|
369
363
|
const [first, ...rest] = name;
|
|
370
|
-
|
|
371
|
-
return false;
|
|
372
|
-
return rest.every((char) => ID_CONTINUE.test(char));
|
|
364
|
+
return ID_START.test(first) && rest.every((char) => ID_CONTINUE.test(char));
|
|
373
365
|
}
|
|
374
366
|
function isNextNameSafe(token) {
|
|
375
|
-
if (
|
|
376
|
-
return
|
|
377
|
-
return
|
|
367
|
+
if (token && token.type === "text")
|
|
368
|
+
return !ID_CONTINUE.test(token.value[0]);
|
|
369
|
+
return true;
|
|
378
370
|
}
|
|
379
371
|
});
|
|
380
372
|
|
|
@@ -2267,25 +2259,121 @@ function createMessagingCoreRouter(serverInstance) {
|
|
|
2267
2259
|
res.status(500).json({ success: false, error: "Failed to submit agent message" });
|
|
2268
2260
|
}
|
|
2269
2261
|
});
|
|
2270
|
-
router.post("/
|
|
2271
|
-
const {
|
|
2272
|
-
|
|
2262
|
+
router.post("/action", async (req, res) => {
|
|
2263
|
+
const {
|
|
2264
|
+
messageId,
|
|
2265
|
+
channel_id,
|
|
2266
|
+
server_id,
|
|
2267
|
+
author_id,
|
|
2268
|
+
content,
|
|
2269
|
+
in_reply_to_message_id,
|
|
2270
|
+
source_type,
|
|
2271
|
+
raw_message,
|
|
2272
|
+
metadata
|
|
2273
|
+
} = req.body;
|
|
2274
|
+
const isValidServerId = server_id === DEFAULT_SERVER_ID || validateUuid8(server_id);
|
|
2275
|
+
if (!validateUuid8(channel_id) || !validateUuid8(author_id) || !content || !isValidServerId || !source_type || !raw_message) {
|
|
2273
2276
|
return res.status(400).json({
|
|
2274
2277
|
success: false,
|
|
2275
|
-
error: "Missing
|
|
2278
|
+
error: "Missing required fields: channel_id, server_id, author_id, content, source_type, raw_message"
|
|
2276
2279
|
});
|
|
2277
2280
|
}
|
|
2281
|
+
if (in_reply_to_message_id && !validateUuid8(in_reply_to_message_id)) {
|
|
2282
|
+
return res.status(400).json({ success: false, error: "Invalid in_reply_to_message_id format" });
|
|
2283
|
+
}
|
|
2284
|
+
if (messageId && !validateUuid8(messageId)) {
|
|
2285
|
+
return res.status(400).json({ success: false, error: "Invalid messageId format" });
|
|
2286
|
+
}
|
|
2287
|
+
try {
|
|
2288
|
+
const baseData = {
|
|
2289
|
+
messageId,
|
|
2290
|
+
channelId: validateUuid8(channel_id),
|
|
2291
|
+
authorId: validateUuid8(author_id),
|
|
2292
|
+
content,
|
|
2293
|
+
rawMessage: raw_message,
|
|
2294
|
+
sourceType: source_type || "agent_response",
|
|
2295
|
+
inReplyToRootMessageId: in_reply_to_message_id ? validateUuid8(in_reply_to_message_id) || undefined : undefined,
|
|
2296
|
+
metadata
|
|
2297
|
+
};
|
|
2298
|
+
const savedMessage = await serverInstance.createMessage(baseData);
|
|
2299
|
+
if (serverInstance.socketIO) {
|
|
2300
|
+
serverInstance.socketIO.to(channel_id).emit("messageBroadcast", {
|
|
2301
|
+
senderId: author_id,
|
|
2302
|
+
senderName: metadata?.agentName || "Agent",
|
|
2303
|
+
text: savedMessage.content,
|
|
2304
|
+
roomId: channel_id,
|
|
2305
|
+
serverId: server_id,
|
|
2306
|
+
createdAt: new Date(savedMessage.createdAt).getTime(),
|
|
2307
|
+
source: savedMessage.sourceType,
|
|
2308
|
+
id: savedMessage.id,
|
|
2309
|
+
thought: raw_message?.thought,
|
|
2310
|
+
actions: raw_message?.actions,
|
|
2311
|
+
attachments: metadata?.attachments,
|
|
2312
|
+
updatedAt: new Date(savedMessage.updatedAt).getTime(),
|
|
2313
|
+
rawMessage: raw_message
|
|
2314
|
+
});
|
|
2315
|
+
}
|
|
2316
|
+
return res.status(201).json({ success: true, data: savedMessage });
|
|
2317
|
+
} catch (error) {
|
|
2318
|
+
logger8.error("[POST /actions] Error creating action:", error instanceof Error ? error.message : String(error));
|
|
2319
|
+
return res.status(500).json({ success: false, error: "Failed to create action" });
|
|
2320
|
+
}
|
|
2321
|
+
});
|
|
2322
|
+
router.patch("/action/:id", async (req, res) => {
|
|
2323
|
+
const { id } = req.params;
|
|
2324
|
+
if (!validateUuid8(id)) {
|
|
2325
|
+
return res.status(400).json({ success: false, error: "Invalid message id" });
|
|
2326
|
+
}
|
|
2327
|
+
const {
|
|
2328
|
+
content,
|
|
2329
|
+
raw_message,
|
|
2330
|
+
source_type,
|
|
2331
|
+
in_reply_to_message_id,
|
|
2332
|
+
metadata,
|
|
2333
|
+
author_id,
|
|
2334
|
+
server_id
|
|
2335
|
+
} = req.body ?? {};
|
|
2336
|
+
if (in_reply_to_message_id && !validateUuid8(in_reply_to_message_id)) {
|
|
2337
|
+
return res.status(400).json({ success: false, error: "Invalid in_reply_to_message_id format" });
|
|
2338
|
+
}
|
|
2339
|
+
if (author_id && !validateUuid8(author_id)) {
|
|
2340
|
+
return res.status(400).json({ success: false, error: "Invalid author_id format" });
|
|
2341
|
+
}
|
|
2342
|
+
if (server_id && !(server_id === DEFAULT_SERVER_ID || validateUuid8(server_id))) {
|
|
2343
|
+
return res.status(400).json({ success: false, error: "Invalid server_id format" });
|
|
2344
|
+
}
|
|
2278
2345
|
try {
|
|
2346
|
+
const updated = await serverInstance.updateMessage(id, {
|
|
2347
|
+
content,
|
|
2348
|
+
rawMessage: raw_message,
|
|
2349
|
+
sourceType: source_type,
|
|
2350
|
+
inReplyToRootMessageId: in_reply_to_message_id ? validateUuid8(in_reply_to_message_id) || undefined : undefined,
|
|
2351
|
+
metadata
|
|
2352
|
+
});
|
|
2353
|
+
if (!updated) {
|
|
2354
|
+
return res.status(404).json({ success: false, error: "Message not found" });
|
|
2355
|
+
}
|
|
2279
2356
|
if (serverInstance.socketIO) {
|
|
2280
|
-
serverInstance.socketIO.to(
|
|
2281
|
-
|
|
2282
|
-
|
|
2357
|
+
serverInstance.socketIO.to(updated.channelId).emit("messageBroadcast", {
|
|
2358
|
+
senderId: author_id || updated.authorId,
|
|
2359
|
+
senderName: metadata?.agentName || "Agent",
|
|
2360
|
+
text: updated.content,
|
|
2361
|
+
roomId: updated.channelId,
|
|
2362
|
+
serverId: server_id,
|
|
2363
|
+
createdAt: new Date(updated.createdAt).getTime(),
|
|
2364
|
+
source: updated.sourceType,
|
|
2365
|
+
id: updated.id,
|
|
2366
|
+
thought: raw_message?.thought,
|
|
2367
|
+
actions: raw_message?.actions,
|
|
2368
|
+
attachments: metadata?.attachments,
|
|
2369
|
+
updatedAt: new Date(updated.updatedAt).getTime(),
|
|
2370
|
+
rawMessage: raw_message
|
|
2283
2371
|
});
|
|
2284
2372
|
}
|
|
2285
|
-
res.status(200).json({ success: true,
|
|
2373
|
+
return res.status(200).json({ success: true, data: updated });
|
|
2286
2374
|
} catch (error) {
|
|
2287
|
-
logger8.error("[
|
|
2288
|
-
res.status(500).json({ success: false, error: "Failed to
|
|
2375
|
+
logger8.error("[PATCH /action/:id] Error updating action:", error instanceof Error ? error.message : String(error));
|
|
2376
|
+
return res.status(500).json({ success: false, error: "Failed to update action" });
|
|
2289
2377
|
}
|
|
2290
2378
|
});
|
|
2291
2379
|
router.post("/ingest-external", async (req, res) => {
|
|
@@ -5738,7 +5826,7 @@ import express29 from "express";
|
|
|
5738
5826
|
// package.json
|
|
5739
5827
|
var package_default = {
|
|
5740
5828
|
name: "@elizaos/server",
|
|
5741
|
-
version: "1.5.
|
|
5829
|
+
version: "1.5.5-alpha.2",
|
|
5742
5830
|
description: "ElizaOS Server - Core server infrastructure for ElizaOS agents",
|
|
5743
5831
|
publishConfig: {
|
|
5744
5832
|
access: "public",
|
|
@@ -5789,10 +5877,10 @@ var package_default = {
|
|
|
5789
5877
|
which: "^4.0.0",
|
|
5790
5878
|
ws: "^8.18.0"
|
|
5791
5879
|
},
|
|
5792
|
-
gitHead: "
|
|
5880
|
+
gitHead: "f60dd270910361decc4d4e879e8b2f33c5ddfee2",
|
|
5793
5881
|
dependencies: {
|
|
5794
|
-
"@elizaos/core": "
|
|
5795
|
-
"@elizaos/plugin-sql": "
|
|
5882
|
+
"@elizaos/core": "workspace:*",
|
|
5883
|
+
"@elizaos/plugin-sql": "workspace:*",
|
|
5796
5884
|
"@types/express": "^5.0.2",
|
|
5797
5885
|
"@types/helmet": "^4.0.0",
|
|
5798
5886
|
"@types/multer": "^1.4.13",
|
|
@@ -6905,6 +6993,110 @@ class MessageBusService extends Service {
|
|
|
6905
6993
|
logger28.error(`[${this.runtime.character.name}] MessageBusService: Error sending agent response to bus:`, error instanceof Error ? error.message : String(error));
|
|
6906
6994
|
}
|
|
6907
6995
|
}
|
|
6996
|
+
async notifyActionStart(agentRoomId, agentWorldId, content, messageId, inReplyToAgentMemoryId, originalMessage) {
|
|
6997
|
+
try {
|
|
6998
|
+
const room = await this.runtime.getRoom(agentRoomId);
|
|
6999
|
+
const world = await this.runtime.getWorld(agentWorldId);
|
|
7000
|
+
const channelId = room?.channelId;
|
|
7001
|
+
const serverId = world?.serverId;
|
|
7002
|
+
if (!channelId || !serverId) {
|
|
7003
|
+
logger28.error(`[${this.runtime.character.name}] MessageBusService: Cannot map room/world -> central IDs. room=${agentRoomId}, world=${agentWorldId}`);
|
|
7004
|
+
return;
|
|
7005
|
+
}
|
|
7006
|
+
let centralInReplyToRootMessageId;
|
|
7007
|
+
if (inReplyToAgentMemoryId) {
|
|
7008
|
+
const m = await this.runtime.getMemoryById(inReplyToAgentMemoryId);
|
|
7009
|
+
if (m?.metadata?.sourceId)
|
|
7010
|
+
centralInReplyToRootMessageId = m.metadata.sourceId;
|
|
7011
|
+
}
|
|
7012
|
+
const payloadToServer = {
|
|
7013
|
+
messageId,
|
|
7014
|
+
channel_id: channelId,
|
|
7015
|
+
server_id: serverId,
|
|
7016
|
+
author_id: this.runtime.agentId,
|
|
7017
|
+
content: content.text,
|
|
7018
|
+
in_reply_to_message_id: centralInReplyToRootMessageId,
|
|
7019
|
+
source_type: "agent_action",
|
|
7020
|
+
raw_message: {
|
|
7021
|
+
text: content.text,
|
|
7022
|
+
thought: content.thought,
|
|
7023
|
+
actions: content.actions,
|
|
7024
|
+
...content
|
|
7025
|
+
},
|
|
7026
|
+
metadata: {
|
|
7027
|
+
agent_id: this.runtime.agentId,
|
|
7028
|
+
agentName: this.runtime.character.name,
|
|
7029
|
+
attachments: content.attachments,
|
|
7030
|
+
channelType: originalMessage?.metadata?.channelType || room?.type,
|
|
7031
|
+
isDm: originalMessage?.metadata?.isDm || (originalMessage?.metadata?.channelType || room?.type) === ChannelType7.DM
|
|
7032
|
+
}
|
|
7033
|
+
};
|
|
7034
|
+
const baseUrl = this.getCentralMessageServerUrl();
|
|
7035
|
+
const submitUrl = new URL("/api/messaging/action", baseUrl).toString();
|
|
7036
|
+
logger28.info(`[${this.runtime.character.name}] -> POST ${submitUrl} payload: ${JSON.stringify(payloadToServer)}`);
|
|
7037
|
+
const response = await fetch(submitUrl, {
|
|
7038
|
+
method: "POST",
|
|
7039
|
+
headers: this.getAuthHeaders(),
|
|
7040
|
+
body: JSON.stringify(payloadToServer)
|
|
7041
|
+
});
|
|
7042
|
+
if (!response.ok) {
|
|
7043
|
+
logger28.error(`[${this.runtime.character.name}] POST /action failed: ${response.status} ${await response.text()}`);
|
|
7044
|
+
}
|
|
7045
|
+
return response;
|
|
7046
|
+
} catch (error) {
|
|
7047
|
+
logger28.error(`[${this.runtime.character.name}] notifyActionStart error:`, error instanceof Error ? error.message : String(error));
|
|
7048
|
+
}
|
|
7049
|
+
}
|
|
7050
|
+
async notifyActionUpdate(agentRoomId, agentWorldId, content, messageId, inReplyToAgentMemoryId, originalMessage) {
|
|
7051
|
+
try {
|
|
7052
|
+
const room = await this.runtime.getRoom(agentRoomId);
|
|
7053
|
+
const world = await this.runtime.getWorld(agentWorldId);
|
|
7054
|
+
const channelId = room?.channelId;
|
|
7055
|
+
const serverId = world?.serverId;
|
|
7056
|
+
if (!channelId || !serverId) {
|
|
7057
|
+
logger28.error(`[${this.runtime.character.name}] MessageBusService: Cannot map room/world -> central IDs. room=${agentRoomId}, world=${agentWorldId}`);
|
|
7058
|
+
return;
|
|
7059
|
+
}
|
|
7060
|
+
let centralInReplyToRootMessageId;
|
|
7061
|
+
if (inReplyToAgentMemoryId) {
|
|
7062
|
+
const m = await this.runtime.getMemoryById(inReplyToAgentMemoryId);
|
|
7063
|
+
if (m?.metadata?.sourceId)
|
|
7064
|
+
centralInReplyToRootMessageId = m.metadata.sourceId;
|
|
7065
|
+
}
|
|
7066
|
+
const patchPayload = {
|
|
7067
|
+
content: content.text,
|
|
7068
|
+
raw_message: {
|
|
7069
|
+
text: content.text,
|
|
7070
|
+
thought: content.thought,
|
|
7071
|
+
actions: content.actions,
|
|
7072
|
+
...content
|
|
7073
|
+
},
|
|
7074
|
+
source_type: "agent_action",
|
|
7075
|
+
in_reply_to_message_id: centralInReplyToRootMessageId,
|
|
7076
|
+
metadata: {
|
|
7077
|
+
agent_id: this.runtime.agentId,
|
|
7078
|
+
agentName: this.runtime.character.name,
|
|
7079
|
+
attachments: content.attachments,
|
|
7080
|
+
channelType: originalMessage?.metadata?.channelType || room?.type,
|
|
7081
|
+
isDm: originalMessage?.metadata?.isDm || (originalMessage?.metadata?.channelType || room?.type) === ChannelType7.DM
|
|
7082
|
+
}
|
|
7083
|
+
};
|
|
7084
|
+
const baseUrl = this.getCentralMessageServerUrl();
|
|
7085
|
+
const patchUrl = new URL(`/api/messaging/action/${messageId}`, baseUrl).toString();
|
|
7086
|
+
logger28.info(`[${this.runtime.character.name}] -> PATCH ${patchUrl} payload: ${JSON.stringify(patchPayload)}`);
|
|
7087
|
+
const response = await fetch(patchUrl, {
|
|
7088
|
+
method: "PATCH",
|
|
7089
|
+
headers: this.getAuthHeaders(),
|
|
7090
|
+
body: JSON.stringify(patchPayload)
|
|
7091
|
+
});
|
|
7092
|
+
if (!response.ok) {
|
|
7093
|
+
logger28.error(`[${this.runtime.character.name}] PATCH /action/${messageId} failed: ${response.status} ${await response.text()}`);
|
|
7094
|
+
}
|
|
7095
|
+
return response;
|
|
7096
|
+
} catch (error) {
|
|
7097
|
+
logger28.error(`[${this.runtime.character.name}] notifyActionUpdate error:`, error instanceof Error ? error.message : String(error));
|
|
7098
|
+
}
|
|
7099
|
+
}
|
|
6908
7100
|
async notifyMessageComplete(channelId, serverId) {
|
|
6909
7101
|
if (!channelId || !serverId)
|
|
6910
7102
|
return;
|
|
@@ -7967,6 +8159,9 @@ class AgentServer {
|
|
|
7967
8159
|
async getMessagesForChannel(channelId, limit = 50, beforeTimestamp) {
|
|
7968
8160
|
return this.database.getMessagesForChannel(channelId, limit, beforeTimestamp);
|
|
7969
8161
|
}
|
|
8162
|
+
async updateMessage(messageId, patch) {
|
|
8163
|
+
return this.database.updateMessage(messageId, patch);
|
|
8164
|
+
}
|
|
7970
8165
|
async removeParticipantFromChannel() {
|
|
7971
8166
|
logger30.warn(`[AgentServer] Remove participant operation not directly supported in database adapter`);
|
|
7972
8167
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Service, type IAgentRuntime, type Plugin, type UUID } from '@elizaos/core';
|
|
1
|
+
import { Service, type Content, type IAgentRuntime, type Plugin, type UUID } from '@elizaos/core';
|
|
2
2
|
import type { MessageMetadata } from '@elizaos/api-client';
|
|
3
3
|
export interface MessageServiceMessage {
|
|
4
4
|
id: UUID;
|
|
@@ -40,6 +40,8 @@ export declare class MessageBusService extends Service {
|
|
|
40
40
|
private handleMessageDeleted;
|
|
41
41
|
private handleChannelCleared;
|
|
42
42
|
private sendAgentResponseToBus;
|
|
43
|
+
notifyActionStart(agentRoomId: UUID, agentWorldId: UUID, content: Content, messageId: UUID, inReplyToAgentMemoryId?: UUID, originalMessage?: MessageServiceMessage): Promise<Response | undefined>;
|
|
44
|
+
notifyActionUpdate(agentRoomId: UUID, agentWorldId: UUID, content: Content, messageId: UUID, inReplyToAgentMemoryId?: UUID, originalMessage?: MessageServiceMessage): Promise<Response | undefined>;
|
|
43
45
|
private notifyMessageComplete;
|
|
44
46
|
private getAuthHeaders;
|
|
45
47
|
getCentralMessageServerUrl(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/services/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,OAAO,
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/services/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,OAAO,EAIP,KAAK,OAAO,EACZ,KAAK,aAAa,EAElB,KAAK,MAAM,EACX,KAAK,IAAI,EACV,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAI3D,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,IAAI,CAAC;IACT,UAAU,EAAE,IAAI,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB,CAAC,EAAE,IAAI,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B;AAED,qBAAa,iBAAkB,SAAQ,OAAO;IAC5C,MAAM,CAAC,WAAW,SAAyB;IAC3C,qBAAqB,SAA6E;IAElG,OAAO,CAAC,0BAA0B,CAA0B;IAC5D,OAAO,CAAC,4BAA4B,CAA+B;IACnE,OAAO,CAAC,yBAAyB,CAA+B;IAChE,OAAO,CAAC,yBAAyB,CAA+B;IAChE,OAAO,CAAC,iBAAiB,CAAwB;gBAErC,OAAO,EAAE,aAAa;WAgBrB,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC;WAM/C,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;YAK1C,mBAAmB;IAejC,OAAO,CAAC,eAAe,CAAwB;YAEjC,oBAAoB;YA4DpB,sBAAsB;YA+DtB,iBAAiB;YA6CjB,uBAAuB;YAsBvB,0BAA0B;YAa1B,sBAAsB;YAUtB,uBAAuB;YAqDvB,wBAAwB;IAmBtC,OAAO,CAAC,iBAAiB;IAmDZ,qBAAqB,CAAC,IAAI,EAAE,OAAO;YA8HlC,oBAAoB;YAoCpB,oBAAoB;YAuCpB,sBAAsB;IA6F9B,iBAAiB,CACrB,WAAW,EAAE,IAAI,EACjB,YAAY,EAAE,IAAI,EAClB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,IAAI,EACf,sBAAsB,CAAC,EAAE,IAAI,EAC7B,eAAe,CAAC,EAAE,qBAAqB;IA2EnC,kBAAkB,CACtB,WAAW,EAAE,IAAI,EACjB,YAAY,EAAE,IAAI,EAClB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,IAAI,EACf,sBAAsB,CAAC,EAAE,IAAI,EAC7B,eAAe,CAAC,EAAE,qBAAqB;YAwE3B,qBAAqB;IAkBnC,OAAO,CAAC,cAAc;IActB,0BAA0B,IAAI,MAAM;IAkE9B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAO5B;AAGD,eAAO,MAAM,yBAAyB,EAAE,MAIvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/server",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.5-alpha.3",
|
|
4
4
|
"description": "ElizaOS Server - Core server infrastructure for ElizaOS agents",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
"which": "^4.0.0",
|
|
52
52
|
"ws": "^8.18.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "5d2bcc4b64b0ba71e5559c5f74f8af5d7e1833e8",
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@elizaos/core": "1.5.
|
|
57
|
-
"@elizaos/plugin-sql": "1.5.
|
|
56
|
+
"@elizaos/core": "1.5.5-alpha.3",
|
|
57
|
+
"@elizaos/plugin-sql": "1.5.5-alpha.3",
|
|
58
58
|
"@types/express": "^5.0.2",
|
|
59
59
|
"@types/helmet": "^4.0.0",
|
|
60
60
|
"@types/multer": "^1.4.13",
|