@elizaos/core 1.0.0-beta.50 → 1.0.0-beta.52

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/index.js CHANGED
@@ -1008,12 +1008,12 @@ var require_utils = __commonJS({
1008
1008
  "use strict";
1009
1009
  var defaults = require_defaults();
1010
1010
  function escapeElement(elementRepresentation) {
1011
- var escaped = elementRepresentation.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
1011
+ const escaped = elementRepresentation.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
1012
1012
  return '"' + escaped + '"';
1013
1013
  }
1014
1014
  function arrayString(val) {
1015
- var result = "{";
1016
- for (var i = 0; i < val.length; i++) {
1015
+ let result = "{";
1016
+ for (let i = 0; i < val.length; i++) {
1017
1017
  if (i > 0) {
1018
1018
  result = result + ",";
1019
1019
  }
@@ -1022,9 +1022,9 @@ var require_utils = __commonJS({
1022
1022
  } else if (Array.isArray(val[i])) {
1023
1023
  result = result + arrayString(val[i]);
1024
1024
  } else if (ArrayBuffer.isView(val[i])) {
1025
- var item = val[i];
1025
+ let item = val[i];
1026
1026
  if (!(item instanceof Buffer)) {
1027
- var buf = Buffer.from(item.buffer, item.byteOffset, item.byteLength);
1027
+ const buf = Buffer.from(item.buffer, item.byteOffset, item.byteLength);
1028
1028
  if (buf.length === item.byteLength) {
1029
1029
  item = buf;
1030
1030
  } else {
@@ -1048,7 +1048,7 @@ var require_utils = __commonJS({
1048
1048
  return val;
1049
1049
  }
1050
1050
  if (ArrayBuffer.isView(val)) {
1051
- var buf = Buffer.from(val.buffer, val.byteOffset, val.byteLength);
1051
+ const buf = Buffer.from(val.buffer, val.byteOffset, val.byteLength);
1052
1052
  if (buf.length === val.byteLength) {
1053
1053
  return buf;
1054
1054
  }
@@ -1080,11 +1080,11 @@ var require_utils = __commonJS({
1080
1080
  return JSON.stringify(val);
1081
1081
  }
1082
1082
  function dateToString(date) {
1083
- var offset = -date.getTimezoneOffset();
1084
- var year = date.getFullYear();
1085
- var isBCYear = year < 1;
1083
+ let offset = -date.getTimezoneOffset();
1084
+ let year = date.getFullYear();
1085
+ const isBCYear = year < 1;
1086
1086
  if (isBCYear) year = Math.abs(year) + 1;
1087
- var ret = String(year).padStart(4, "0") + "-" + String(date.getMonth() + 1).padStart(2, "0") + "-" + String(date.getDate()).padStart(2, "0") + "T" + String(date.getHours()).padStart(2, "0") + ":" + String(date.getMinutes()).padStart(2, "0") + ":" + String(date.getSeconds()).padStart(2, "0") + "." + String(date.getMilliseconds()).padStart(3, "0");
1087
+ let ret = String(year).padStart(4, "0") + "-" + String(date.getMonth() + 1).padStart(2, "0") + "-" + String(date.getDate()).padStart(2, "0") + "T" + String(date.getHours()).padStart(2, "0") + ":" + String(date.getMinutes()).padStart(2, "0") + ":" + String(date.getSeconds()).padStart(2, "0") + "." + String(date.getMilliseconds()).padStart(3, "0");
1088
1088
  if (offset < 0) {
1089
1089
  ret += "-";
1090
1090
  offset *= -1;
@@ -1096,10 +1096,10 @@ var require_utils = __commonJS({
1096
1096
  return ret;
1097
1097
  }
1098
1098
  function dateToStringUTC(date) {
1099
- var year = date.getUTCFullYear();
1100
- var isBCYear = year < 1;
1099
+ let year = date.getUTCFullYear();
1100
+ const isBCYear = year < 1;
1101
1101
  if (isBCYear) year = Math.abs(year) + 1;
1102
- var ret = String(year).padStart(4, "0") + "-" + String(date.getUTCMonth() + 1).padStart(2, "0") + "-" + String(date.getUTCDate()).padStart(2, "0") + "T" + String(date.getUTCHours()).padStart(2, "0") + ":" + String(date.getUTCMinutes()).padStart(2, "0") + ":" + String(date.getUTCSeconds()).padStart(2, "0") + "." + String(date.getUTCMilliseconds()).padStart(3, "0");
1102
+ let ret = String(year).padStart(4, "0") + "-" + String(date.getUTCMonth() + 1).padStart(2, "0") + "-" + String(date.getUTCDate()).padStart(2, "0") + "T" + String(date.getUTCHours()).padStart(2, "0") + ":" + String(date.getUTCMinutes()).padStart(2, "0") + ":" + String(date.getUTCSeconds()).padStart(2, "0") + "." + String(date.getUTCMilliseconds()).padStart(3, "0");
1103
1103
  ret += "+00:00";
1104
1104
  if (isBCYear) ret += " BC";
1105
1105
  return ret;
@@ -1122,10 +1122,10 @@ var require_utils = __commonJS({
1122
1122
  return '"' + str.replace(/"/g, '""') + '"';
1123
1123
  };
1124
1124
  var escapeLiteral = function(str) {
1125
- var hasBackslash = false;
1126
- var escaped = "'";
1127
- for (var i = 0; i < str.length; i++) {
1128
- var c = str[i];
1125
+ let hasBackslash = false;
1126
+ let escaped = "'";
1127
+ for (let i = 0; i < str.length; i++) {
1128
+ const c = str[i];
1129
1129
  if (c === "'") {
1130
1130
  escaped += c + c;
1131
1131
  } else if (c === "\\") {
@@ -1161,8 +1161,8 @@ var require_utils_legacy = __commonJS({
1161
1161
  return nodeCrypto.createHash("md5").update(string, "utf-8").digest("hex");
1162
1162
  }
1163
1163
  function postgresMd5PasswordHash(user, password, salt) {
1164
- var inner = md5(password + user);
1165
- var outer = md5(Buffer.concat([Buffer.from(inner), salt]));
1164
+ const inner = md5(password + user);
1165
+ const outer = md5(Buffer.concat([Buffer.from(inner), salt]));
1166
1166
  return "md5" + outer;
1167
1167
  }
1168
1168
  function sha256(text) {
@@ -1219,8 +1219,8 @@ var require_utils_webcrypto = __commonJS({
1219
1219
  }
1220
1220
  }
1221
1221
  async function postgresMd5PasswordHash(user, password, salt) {
1222
- var inner = await md5(password + user);
1223
- var outer = await md5(Buffer.concat([Buffer.from(inner), salt]));
1222
+ const inner = await md5(password + user);
1223
+ const outer = await md5(Buffer.concat([Buffer.from(inner), salt]));
1224
1224
  return "md5" + outer;
1225
1225
  }
1226
1226
  async function sha256(text) {
@@ -1275,7 +1275,7 @@ var require_cert_signatures = __commonJS({
1275
1275
  if (data[index++] !== 6) throw x509Error("non-OID data", data);
1276
1276
  const { length: OIDLength, index: indexAfterOIDLength } = readASN1Length(data, index);
1277
1277
  index = indexAfterOIDLength;
1278
- let lastIndex = index + OIDLength;
1278
+ const lastIndex = index + OIDLength;
1279
1279
  const byte1 = data[index++];
1280
1280
  let oid = (byte1 / 40 >> 0) + "." + byte1 % 40;
1281
1281
  while (index < lastIndex) {
@@ -1411,8 +1411,8 @@ var require_sasl = __commonJS({
1411
1411
  } else if (sv.nonce.length === session.clientNonce.length) {
1412
1412
  throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short");
1413
1413
  }
1414
- var clientFirstMessageBare = "n=*,r=" + session.clientNonce;
1415
- var serverFirstMessage = "r=" + sv.nonce + ",s=" + sv.salt + ",i=" + sv.iteration;
1414
+ const clientFirstMessageBare = "n=*,r=" + session.clientNonce;
1415
+ const serverFirstMessage = "r=" + sv.nonce + ",s=" + sv.salt + ",i=" + sv.iteration;
1416
1416
  let channelBinding = stream ? "eSws" : "biws";
1417
1417
  if (session.mechanism === "SCRAM-SHA-256-PLUS") {
1418
1418
  const peerCert = stream.getPeerCertificate().raw;
@@ -1422,16 +1422,16 @@ var require_sasl = __commonJS({
1422
1422
  const bindingData = Buffer.concat([Buffer.from("p=tls-server-end-point,,"), Buffer.from(certHash)]);
1423
1423
  channelBinding = bindingData.toString("base64");
1424
1424
  }
1425
- var clientFinalMessageWithoutProof = "c=" + channelBinding + ",r=" + sv.nonce;
1426
- var authMessage = clientFirstMessageBare + "," + serverFirstMessage + "," + clientFinalMessageWithoutProof;
1427
- var saltBytes = Buffer.from(sv.salt, "base64");
1428
- var saltedPassword = await crypto2.deriveKey(password, saltBytes, sv.iteration);
1429
- var clientKey = await crypto2.hmacSha256(saltedPassword, "Client Key");
1430
- var storedKey = await crypto2.sha256(clientKey);
1431
- var clientSignature = await crypto2.hmacSha256(storedKey, authMessage);
1432
- var clientProof = xorBuffers(Buffer.from(clientKey), Buffer.from(clientSignature)).toString("base64");
1433
- var serverKey = await crypto2.hmacSha256(saltedPassword, "Server Key");
1434
- var serverSignatureBytes = await crypto2.hmacSha256(serverKey, authMessage);
1425
+ const clientFinalMessageWithoutProof = "c=" + channelBinding + ",r=" + sv.nonce;
1426
+ const authMessage = clientFirstMessageBare + "," + serverFirstMessage + "," + clientFinalMessageWithoutProof;
1427
+ const saltBytes = Buffer.from(sv.salt, "base64");
1428
+ const saltedPassword = await crypto2.deriveKey(password, saltBytes, sv.iteration);
1429
+ const clientKey = await crypto2.hmacSha256(saltedPassword, "Client Key");
1430
+ const storedKey = await crypto2.sha256(clientKey);
1431
+ const clientSignature = await crypto2.hmacSha256(storedKey, authMessage);
1432
+ const clientProof = xorBuffers(Buffer.from(clientKey), Buffer.from(clientSignature)).toString("base64");
1433
+ const serverKey = await crypto2.hmacSha256(saltedPassword, "Server Key");
1434
+ const serverSignatureBytes = await crypto2.hmacSha256(serverKey, authMessage);
1435
1435
  session.message = "SASLResponse";
1436
1436
  session.serverSignature = Buffer.from(serverSignatureBytes).toString("base64");
1437
1437
  session.response = clientFinalMessageWithoutProof + ",p=" + clientProof;
@@ -1702,7 +1702,8 @@ var require_pg_connection_string = __commonJS({
1702
1702
  const sslConfig = value;
1703
1703
  if (typeof sslConfig === "boolean") {
1704
1704
  c[key] = sslConfig;
1705
- } else if (typeof sslConfig === "object") {
1705
+ }
1706
+ if (typeof sslConfig === "object") {
1706
1707
  c[key] = toConnectionOptions(sslConfig);
1707
1708
  }
1708
1709
  } else if (value !== void 0 && value !== null) {
@@ -1766,7 +1767,7 @@ var require_connection_parameters = __commonJS({
1766
1767
  return "'" + ("" + value).replace(/\\/g, "\\\\").replace(/'/g, "\\'") + "'";
1767
1768
  };
1768
1769
  var add = function(params, config, paramName) {
1769
- var value = config[paramName];
1770
+ const value = config[paramName];
1770
1771
  if (value !== void 0 && value !== null) {
1771
1772
  params.push(paramName + "=" + quoteParamValue(value));
1772
1773
  }
@@ -1830,7 +1831,7 @@ var require_connection_parameters = __commonJS({
1830
1831
  }
1831
1832
  }
1832
1833
  getLibpqConnectionString(cb) {
1833
- var params = [];
1834
+ const params = [];
1834
1835
  add(params, this, "user");
1835
1836
  add(params, this, "password");
1836
1837
  add(params, this, "port");
@@ -1838,7 +1839,7 @@ var require_connection_parameters = __commonJS({
1838
1839
  add(params, this, "fallback_application_name");
1839
1840
  add(params, this, "connect_timeout");
1840
1841
  add(params, this, "options");
1841
- var ssl = typeof this.ssl === "object" ? this.ssl : this.ssl ? { sslmode: this.ssl } : {};
1842
+ const ssl = typeof this.ssl === "object" ? this.ssl : this.ssl ? { sslmode: this.ssl } : {};
1842
1843
  add(params, ssl, "sslmode");
1843
1844
  add(params, ssl, "sslca");
1844
1845
  add(params, ssl, "sslkey");
@@ -1894,7 +1895,7 @@ var require_result = __commonJS({
1894
1895
  }
1895
1896
  // adds a command complete message
1896
1897
  addCommandComplete(msg) {
1897
- var match;
1898
+ let match;
1898
1899
  if (msg.text) {
1899
1900
  match = matchRegexp.exec(msg.text);
1900
1901
  } else {
@@ -1911,9 +1912,9 @@ var require_result = __commonJS({
1911
1912
  }
1912
1913
  }
1913
1914
  _parseRowAsArray(rowData) {
1914
- var row = new Array(rowData.length);
1915
- for (var i = 0, len = rowData.length; i < len; i++) {
1916
- var rawValue = rowData[i];
1915
+ const row = new Array(rowData.length);
1916
+ for (let i = 0, len = rowData.length; i < len; i++) {
1917
+ const rawValue = rowData[i];
1917
1918
  if (rawValue !== null) {
1918
1919
  row[i] = this._parsers[i](rawValue);
1919
1920
  } else {
@@ -1923,10 +1924,10 @@ var require_result = __commonJS({
1923
1924
  return row;
1924
1925
  }
1925
1926
  parseRow(rowData) {
1926
- var row = { ...this._prebuiltEmptyResultObject };
1927
- for (var i = 0, len = rowData.length; i < len; i++) {
1928
- var rawValue = rowData[i];
1929
- var field = this.fields[i].name;
1927
+ const row = { ...this._prebuiltEmptyResultObject };
1928
+ for (let i = 0, len = rowData.length; i < len; i++) {
1929
+ const rawValue = rowData[i];
1930
+ const field = this.fields[i].name;
1930
1931
  if (rawValue !== null) {
1931
1932
  row[field] = this._parsers[i](rawValue);
1932
1933
  } else {
@@ -1943,9 +1944,9 @@ var require_result = __commonJS({
1943
1944
  if (this.fields.length) {
1944
1945
  this._parsers = new Array(fieldDescriptions.length);
1945
1946
  }
1946
- var row = {};
1947
- for (var i = 0; i < fieldDescriptions.length; i++) {
1948
- var desc = fieldDescriptions[i];
1947
+ const row = {};
1948
+ for (let i = 0; i < fieldDescriptions.length; i++) {
1949
+ const desc = fieldDescriptions[i];
1949
1950
  row[desc.name] = null;
1950
1951
  if (this._types) {
1951
1952
  this._parsers[i] = this._types.getTypeParser(desc.dataTypeID, desc.format || "text");
@@ -2150,7 +2151,6 @@ var require_query = __commonJS({
2150
2151
  handleCopyInResponse(connection) {
2151
2152
  connection.sendCopyFail("No source stream defined");
2152
2153
  }
2153
- // eslint-disable-next-line no-unused-vars
2154
2154
  handleCopyData(msg, connection) {
2155
2155
  }
2156
2156
  };
@@ -2337,10 +2337,10 @@ var require_buffer_writer = __commonJS({
2337
2337
  this.buffer = Buffer.allocUnsafe(size);
2338
2338
  }
2339
2339
  ensure(size) {
2340
- var remaining = this.buffer.length - this.offset;
2340
+ const remaining = this.buffer.length - this.offset;
2341
2341
  if (remaining < size) {
2342
- var oldBuffer = this.buffer;
2343
- var newSize = oldBuffer.length + (oldBuffer.length >> 1) + size;
2342
+ const oldBuffer = this.buffer;
2343
+ const newSize = oldBuffer.length + (oldBuffer.length >> 1) + size;
2344
2344
  this.buffer = Buffer.allocUnsafe(newSize);
2345
2345
  oldBuffer.copy(this.buffer);
2346
2346
  }
@@ -2363,7 +2363,7 @@ var require_buffer_writer = __commonJS({
2363
2363
  if (!string) {
2364
2364
  this.ensure(1);
2365
2365
  } else {
2366
- var len = Buffer.byteLength(string);
2366
+ const len = Buffer.byteLength(string);
2367
2367
  this.ensure(len + 1);
2368
2368
  this.buffer.write(string, this.offset, "utf-8");
2369
2369
  this.offset += len;
@@ -2372,7 +2372,7 @@ var require_buffer_writer = __commonJS({
2372
2372
  return this;
2373
2373
  }
2374
2374
  addString(string = "") {
2375
- var len = Buffer.byteLength(string);
2375
+ const len = Buffer.byteLength(string);
2376
2376
  this.ensure(len);
2377
2377
  this.buffer.write(string, this.offset);
2378
2378
  this.offset += len;
@@ -2393,7 +2393,7 @@ var require_buffer_writer = __commonJS({
2393
2393
  return this.buffer.slice(code ? 0 : 5, this.offset);
2394
2394
  }
2395
2395
  flush(code) {
2396
- var result = this.join(code);
2396
+ const result = this.join(code);
2397
2397
  this.offset = 5;
2398
2398
  this.headerPosition = 0;
2399
2399
  this.buffer = Buffer.allocUnsafe(this.size);
@@ -2418,8 +2418,8 @@ var require_serializer = __commonJS({
2418
2418
  writer.addCString(key).addCString(opts[key]);
2419
2419
  }
2420
2420
  writer.addCString("client_encoding").addCString("UTF8");
2421
- var bodyBuffer = writer.addCString("").flush();
2422
- var length = bodyBuffer.length + 4;
2421
+ const bodyBuffer = writer.addCString("").flush();
2422
+ const length = bodyBuffer.length + 4;
2423
2423
  return new buffer_writer_1.Writer().addInt32(length).add(bodyBuffer).flush();
2424
2424
  };
2425
2425
  var requestSsl = () => {
@@ -2462,9 +2462,9 @@ var require_serializer = __commonJS({
2462
2462
  console.error("This can cause conflicts and silent errors executing queries");
2463
2463
  }
2464
2464
  const types = query2.types || emptyArray;
2465
- var len = types.length;
2466
- var buffer = writer.addCString(name).addCString(query2.text).addInt16(len);
2467
- for (var i = 0; i < len; i++) {
2465
+ const len = types.length;
2466
+ const buffer = writer.addCString(name).addCString(query2.text).addInt16(len);
2467
+ for (let i = 0; i < len; i++) {
2468
2468
  buffer.addInt32(types[i]);
2469
2469
  }
2470
2470
  return writer.flush(
@@ -3173,7 +3173,7 @@ var require_stream = __commonJS({
3173
3173
  return new net.Socket();
3174
3174
  }
3175
3175
  function getSecureStream2(options2) {
3176
- var tls = __require("tls");
3176
+ const tls = __require("tls");
3177
3177
  return tls.connect(options2);
3178
3178
  }
3179
3179
  return {
@@ -3241,7 +3241,7 @@ var require_connection = __commonJS({
3241
3241
  this.ssl = config.ssl || false;
3242
3242
  this._ending = false;
3243
3243
  this._emitMessage = false;
3244
- var self = this;
3244
+ const self = this;
3245
3245
  this.on("newListener", function(eventName) {
3246
3246
  if (eventName === "message") {
3247
3247
  self._emitMessage = true;
@@ -3249,7 +3249,7 @@ var require_connection = __commonJS({
3249
3249
  });
3250
3250
  }
3251
3251
  connect(port, host) {
3252
- var self = this;
3252
+ const self = this;
3253
3253
  this._connecting = true;
3254
3254
  this.stream.setNoDelay(true);
3255
3255
  this.stream.connect(port, host);
@@ -3273,7 +3273,7 @@ var require_connection = __commonJS({
3273
3273
  return this.attachListeners(this.stream);
3274
3274
  }
3275
3275
  this.stream.once("data", function(buffer) {
3276
- var responseCode = buffer.toString("utf8");
3276
+ const responseCode = buffer.toString("utf8");
3277
3277
  switch (responseCode) {
3278
3278
  case "S":
3279
3279
  break;
@@ -3293,7 +3293,7 @@ var require_connection = __commonJS({
3293
3293
  options2.key = self.ssl.key;
3294
3294
  }
3295
3295
  }
3296
- var net = __require("net");
3296
+ const net = __require("net");
3297
3297
  if (net.isIP && net.isIP(host) === 0) {
3298
3298
  options2.servername = host;
3299
3299
  }
@@ -3309,7 +3309,7 @@ var require_connection = __commonJS({
3309
3309
  }
3310
3310
  attachListeners(stream) {
3311
3311
  parse(stream, (msg) => {
3312
- var eventName = msg.name === "error" ? "errorMessage" : msg.name;
3312
+ const eventName = msg.name === "error" ? "errorMessage" : msg.name;
3313
3313
  if (this._emitMessage) {
3314
3314
  this.emit("message", msg);
3315
3315
  }
@@ -3721,7 +3721,7 @@ var require_client = __commonJS({
3721
3721
  value: this.connectionParameters.password
3722
3722
  });
3723
3723
  this.replication = this.connectionParameters.replication;
3724
- var c = config || {};
3724
+ const c = config || {};
3725
3725
  this._Promise = c.Promise || global.Promise;
3726
3726
  this._types = new TypeOverrides(c.types);
3727
3727
  this._ending = false;
@@ -3764,8 +3764,8 @@ var require_client = __commonJS({
3764
3764
  this.queryQueue.length = 0;
3765
3765
  }
3766
3766
  _connect(callback) {
3767
- var self = this;
3768
- var con = this.connection;
3767
+ const self = this;
3768
+ const con = this.connection;
3769
3769
  this._connectionCallback = callback;
3770
3770
  if (this._connecting || this._connected) {
3771
3771
  const err = new Error("Client has already been connected. You cannot reuse a client.");
@@ -4041,12 +4041,12 @@ var require_client = __commonJS({
4041
4041
  this.emit("notice", msg);
4042
4042
  }
4043
4043
  getStartupConf() {
4044
- var params = this.connectionParameters;
4045
- var data = {
4044
+ const params = this.connectionParameters;
4045
+ const data = {
4046
4046
  user: params.user,
4047
4047
  database: params.database
4048
4048
  };
4049
- var appName = params.application_name || params.fallback_application_name;
4049
+ const appName = params.application_name || params.fallback_application_name;
4050
4050
  if (appName) {
4051
4051
  data.application_name = appName;
4052
4052
  }
@@ -4069,7 +4069,7 @@ var require_client = __commonJS({
4069
4069
  }
4070
4070
  cancel(client, query) {
4071
4071
  if (client.activeQuery === query) {
4072
- var con = this.connection;
4072
+ const con = this.connection;
4073
4073
  if (this.host && this.host.indexOf("/") === 0) {
4074
4074
  con.connect(this.host + "/.s.PGSQL." + this.port);
4075
4075
  } else {
@@ -4118,11 +4118,11 @@ var require_client = __commonJS({
4118
4118
  }
4119
4119
  }
4120
4120
  query(config, values, callback) {
4121
- var query;
4122
- var result;
4123
- var readTimeout;
4124
- var readTimeoutTimer;
4125
- var queryCallback;
4121
+ let query;
4122
+ let result;
4123
+ let readTimeout;
4124
+ let readTimeoutTimer;
4125
+ let queryCallback;
4126
4126
  if (config === null || config === void 0) {
4127
4127
  throw new TypeError("Client was passed a null or undefined query");
4128
4128
  } else if (typeof config.submit === "function") {
@@ -4146,14 +4146,14 @@ var require_client = __commonJS({
4146
4146
  if (readTimeout) {
4147
4147
  queryCallback = query.callback;
4148
4148
  readTimeoutTimer = setTimeout(() => {
4149
- var error = new Error("Query read timeout");
4149
+ const error = new Error("Query read timeout");
4150
4150
  process.nextTick(() => {
4151
4151
  query.handleError(error, this.connection);
4152
4152
  });
4153
4153
  queryCallback(error);
4154
4154
  query.callback = () => {
4155
4155
  };
4156
- var index = this.queryQueue.indexOf(query);
4156
+ const index = this.queryQueue.indexOf(query);
4157
4157
  if (index > -1) {
4158
4158
  this.queryQueue.splice(index, 1);
4159
4159
  }
@@ -4293,6 +4293,7 @@ var require_pg_pool = __commonJS({
4293
4293
  });
4294
4294
  }
4295
4295
  this.options.max = this.options.max || this.options.poolSize || 10;
4296
+ this.options.min = this.options.min || 0;
4296
4297
  this.options.maxUses = this.options.maxUses || Infinity;
4297
4298
  this.options.allowExitOnIdle = this.options.allowExitOnIdle || false;
4298
4299
  this.options.maxLifetimeSeconds = this.options.maxLifetimeSeconds || 0;
@@ -4314,6 +4315,9 @@ var require_pg_pool = __commonJS({
4314
4315
  _isFull() {
4315
4316
  return this._clients.length >= this.options.max;
4316
4317
  }
4318
+ _isAboveMin() {
4319
+ return this._clients.length > this.options.min;
4320
+ }
4317
4321
  _pulseQueue() {
4318
4322
  this.log("pulse queue");
4319
4323
  if (this.ended) {
@@ -4512,7 +4516,7 @@ var require_pg_pool = __commonJS({
4512
4516
  return;
4513
4517
  }
4514
4518
  let tid;
4515
- if (this.options.idleTimeoutMillis) {
4519
+ if (this.options.idleTimeoutMillis && this._isAboveMin()) {
4516
4520
  tid = setTimeout(() => {
4517
4521
  this.log("remove idle client");
4518
4522
  this._remove(client);
@@ -4633,7 +4637,6 @@ var require_query2 = __commonJS({
4633
4637
  };
4634
4638
  util.inherits(NativeQuery, EventEmitter);
4635
4639
  var errorFieldMap = {
4636
- /* eslint-disable quote-props */
4637
4640
  sqlState: "code",
4638
4641
  statementPosition: "position",
4639
4642
  messagePrimary: "message",
@@ -4648,10 +4651,10 @@ var require_query2 = __commonJS({
4648
4651
  sourceFunction: "routine"
4649
4652
  };
4650
4653
  NativeQuery.prototype.handleError = function(err) {
4651
- var fields = this.native.pq.resultErrorFields();
4654
+ const fields = this.native.pq.resultErrorFields();
4652
4655
  if (fields) {
4653
- for (var key in fields) {
4654
- var normalizedFieldName = errorFieldMap[key] || key;
4656
+ for (const key in fields) {
4657
+ const normalizedFieldName = errorFieldMap[key] || key;
4655
4658
  err[normalizedFieldName] = fields[key];
4656
4659
  }
4657
4660
  }
@@ -4680,10 +4683,10 @@ var require_query2 = __commonJS({
4680
4683
  };
4681
4684
  NativeQuery.prototype.submit = function(client) {
4682
4685
  this.state = "running";
4683
- var self = this;
4686
+ const self = this;
4684
4687
  this.native = client.native;
4685
4688
  client.native.arrayMode = this._arrayMode;
4686
- var after = function(err, rows, results) {
4689
+ let after = function(err, rows, results) {
4687
4690
  client.native.arrayMode = false;
4688
4691
  setImmediate(function() {
4689
4692
  self.emit("_done");
@@ -4719,7 +4722,7 @@ var require_query2 = __commonJS({
4719
4722
  console.error("You supplied %s (%s)", this.name, this.name.length);
4720
4723
  console.error("This can cause conflicts and silent errors executing queries");
4721
4724
  }
4722
- var values = (this.values || []).map(utils.prepareValue);
4725
+ const values = (this.values || []).map(utils.prepareValue);
4723
4726
  if (client.namedQueries[this.name]) {
4724
4727
  if (this.text && client.namedQueries[this.name] !== this.text) {
4725
4728
  const err = new Error(`Prepared statements must be unique - '${this.name}' was used for a different statement`);
@@ -4737,7 +4740,7 @@ var require_query2 = __commonJS({
4737
4740
  const err = new Error("Query values must be an array");
4738
4741
  return after(err);
4739
4742
  }
4740
- var vals = this.values.map(utils.prepareValue);
4743
+ const vals = this.values.map(utils.prepareValue);
4741
4744
  client.native.query(this.text, vals, after);
4742
4745
  } else if (this.queryMode === "extended") {
4743
4746
  client.native.query(this.text, [], after);
@@ -4776,7 +4779,7 @@ var require_client2 = __commonJS({
4776
4779
  this._connecting = false;
4777
4780
  this._connected = false;
4778
4781
  this._queryable = true;
4779
- var cp = this.connectionParameters = new ConnectionParameters(config);
4782
+ const cp = this.connectionParameters = new ConnectionParameters(config);
4780
4783
  if (config.nativeConnectionString) cp.nativeConnectionString = config.nativeConnectionString;
4781
4784
  this.user = cp.user;
4782
4785
  Object.defineProperty(this, "password", {
@@ -4807,7 +4810,7 @@ var require_client2 = __commonJS({
4807
4810
  this._queryQueue.length = 0;
4808
4811
  };
4809
4812
  Client.prototype._connect = function(cb) {
4810
- var self = this;
4813
+ const self = this;
4811
4814
  if (this._connecting) {
4812
4815
  process.nextTick(() => cb(new Error("Client has already been connected. You cannot reuse a client.")));
4813
4816
  return;
@@ -4855,11 +4858,11 @@ var require_client2 = __commonJS({
4855
4858
  });
4856
4859
  };
4857
4860
  Client.prototype.query = function(config, values, callback) {
4858
- var query;
4859
- var result;
4860
- var readTimeout;
4861
- var readTimeoutTimer;
4862
- var queryCallback;
4861
+ let query;
4862
+ let result;
4863
+ let readTimeout;
4864
+ let readTimeoutTimer;
4865
+ let queryCallback;
4863
4866
  if (config === null || config === void 0) {
4864
4867
  throw new TypeError("Client was passed a null or undefined query");
4865
4868
  } else if (typeof config.submit === "function") {
@@ -4886,14 +4889,14 @@ var require_client2 = __commonJS({
4886
4889
  if (readTimeout) {
4887
4890
  queryCallback = query.callback;
4888
4891
  readTimeoutTimer = setTimeout(() => {
4889
- var error = new Error("Query read timeout");
4892
+ const error = new Error("Query read timeout");
4890
4893
  process.nextTick(() => {
4891
4894
  query.handleError(error, this.connection);
4892
4895
  });
4893
4896
  queryCallback(error);
4894
4897
  query.callback = () => {
4895
4898
  };
4896
- var index = this._queryQueue.indexOf(query);
4899
+ const index = this._queryQueue.indexOf(query);
4897
4900
  if (index > -1) {
4898
4901
  this._queryQueue.splice(index, 1);
4899
4902
  }
@@ -4923,12 +4926,12 @@ var require_client2 = __commonJS({
4923
4926
  return result;
4924
4927
  };
4925
4928
  Client.prototype.end = function(cb) {
4926
- var self = this;
4929
+ const self = this;
4927
4930
  this._ending = true;
4928
4931
  if (!this._connected) {
4929
4932
  this.once("connect", this.end.bind(this, cb));
4930
4933
  }
4931
- var result;
4934
+ let result;
4932
4935
  if (!cb) {
4933
4936
  result = new this._Promise(function(resolve, reject) {
4934
4937
  cb = (err) => err ? reject(err) : resolve();
@@ -4953,7 +4956,7 @@ var require_client2 = __commonJS({
4953
4956
  if (this._hasActiveQuery()) {
4954
4957
  return;
4955
4958
  }
4956
- var query = this._queryQueue.shift();
4959
+ const query = this._queryQueue.shift();
4957
4960
  if (!query) {
4958
4961
  if (!initialConnection) {
4959
4962
  this.emit("drain");
@@ -4962,7 +4965,7 @@ var require_client2 = __commonJS({
4962
4965
  }
4963
4966
  this._activeQuery = query;
4964
4967
  query.submit(this);
4965
- var self = this;
4968
+ const self = this;
4966
4969
  query.once("_done", function() {
4967
4970
  self._pulseQueryQueue();
4968
4971
  });
@@ -5039,7 +5042,7 @@ var require_lib2 = __commonJS({
5039
5042
  configurable: true,
5040
5043
  enumerable: false,
5041
5044
  get() {
5042
- var native = null;
5045
+ let native = null;
5043
5046
  try {
5044
5047
  native = new PG(require_native());
5045
5048
  } catch (err) {
@@ -7954,7 +7957,7 @@ var BM25 = class {
7954
7957
  /** Array storing the document frequency (number of docs containing the term) for each term index. */
7955
7958
  documentFrequency;
7956
7959
  // DF for each term index
7957
- /** Map from term index to another map storing { docIndex: termFrequencyInDoc }. */
7960
+ /** Map from term index to another map storing */
7958
7961
  termFrequencies;
7959
7962
  // TermIndex -> { DocIndex -> TF }
7960
7963
  /** Boost factors for different fields within documents. */
package/dist/search.d.ts CHANGED
@@ -210,7 +210,7 @@ export declare class BM25 {
210
210
  termToIndex: Map<string, number>;
211
211
  /** Array storing the document frequency (number of docs containing the term) for each term index. */
212
212
  documentFrequency: Uint32Array;
213
- /** Map from term index to another map storing { docIndex: termFrequencyInDoc }. */
213
+ /** Map from term index to another map storing */
214
214
  termFrequencies: Map<number, Map<number, number>>;
215
215
  /** Boost factors for different fields within documents. */
216
216
  readonly fieldBoosts: {
package/dist/types.d.ts CHANGED
@@ -920,7 +920,7 @@ export interface IAgentRuntime extends IDatabaseAdapter {
920
920
  ensureParticipantInRoom(entityId: UUID, roomId: UUID): Promise<void>;
921
921
  ensureWorldExists(world: World): Promise<void>;
922
922
  ensureRoomExists(room: Room): Promise<void>;
923
- composeState(message: Memory, includeList?: string[], skipCache?: boolean): Promise<State>;
923
+ composeState(message: Memory, includeList?: string[], onlyInclude?: boolean, skipCache?: boolean): Promise<State>;
924
924
  /**
925
925
  * Use a model with strongly typed parameters and return values based on model type
926
926
  * @template T - The model type to use
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elizaos/core",
3
- "version": "1.0.0-beta.50",
3
+ "version": "1.0.0-beta.52",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -80,5 +80,5 @@
80
80
  "publishConfig": {
81
81
  "access": "public"
82
82
  },
83
- "gitHead": "764c6bbaab227414854ddae91c8f4e512faa8fad"
83
+ "gitHead": "7b4755089da7af180eda974de2471dec8b1fa194"
84
84
  }