@xdarkicex/openclaw-memory-libravdb 1.6.25 → 1.6.27

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
@@ -5162,7 +5162,7 @@ var require_create_descriptor_set = __commonJS({
5162
5162
  return `enum ${this.typeName}`;
5163
5163
  },
5164
5164
  getComments() {
5165
- const path5 = this.parent ? [
5165
+ const path6 = this.parent ? [
5166
5166
  ...this.parent.getComments().sourcePath,
5167
5167
  FieldNumber.DescriptorProto_EnumType,
5168
5168
  this.parent.proto.enumType.indexOf(this.proto)
@@ -5170,7 +5170,7 @@ var require_create_descriptor_set = __commonJS({
5170
5170
  FieldNumber.FileDescriptorProto_EnumType,
5171
5171
  this.file.proto.enumType.indexOf(this.proto)
5172
5172
  ];
5173
- return findComments(file.proto.sourceCodeInfo, path5);
5173
+ return findComments(file.proto.sourceCodeInfo, path6);
5174
5174
  },
5175
5175
  getFeatures() {
5176
5176
  var _a2, _b2;
@@ -5201,12 +5201,12 @@ var require_create_descriptor_set = __commonJS({
5201
5201
  return str;
5202
5202
  },
5203
5203
  getComments() {
5204
- const path5 = [
5204
+ const path6 = [
5205
5205
  ...this.parent.getComments().sourcePath,
5206
5206
  FieldNumber.EnumDescriptorProto_Value,
5207
5207
  this.parent.proto.value.indexOf(this.proto)
5208
5208
  ];
5209
- return findComments(file.proto.sourceCodeInfo, path5);
5209
+ return findComments(file.proto.sourceCodeInfo, path6);
5210
5210
  },
5211
5211
  getFeatures() {
5212
5212
  var _a3;
@@ -5237,7 +5237,7 @@ var require_create_descriptor_set = __commonJS({
5237
5237
  return `message ${this.typeName}`;
5238
5238
  },
5239
5239
  getComments() {
5240
- const path5 = this.parent ? [
5240
+ const path6 = this.parent ? [
5241
5241
  ...this.parent.getComments().sourcePath,
5242
5242
  FieldNumber.DescriptorProto_NestedType,
5243
5243
  this.parent.proto.nestedType.indexOf(this.proto)
@@ -5245,7 +5245,7 @@ var require_create_descriptor_set = __commonJS({
5245
5245
  FieldNumber.FileDescriptorProto_MessageType,
5246
5246
  this.file.proto.messageType.indexOf(this.proto)
5247
5247
  ];
5248
- return findComments(file.proto.sourceCodeInfo, path5);
5248
+ return findComments(file.proto.sourceCodeInfo, path6);
5249
5249
  },
5250
5250
  getFeatures() {
5251
5251
  var _a2, _b2;
@@ -5280,11 +5280,11 @@ var require_create_descriptor_set = __commonJS({
5280
5280
  return `service ${this.typeName}`;
5281
5281
  },
5282
5282
  getComments() {
5283
- const path5 = [
5283
+ const path6 = [
5284
5284
  FieldNumber.FileDescriptorProto_Service,
5285
5285
  this.file.proto.service.indexOf(this.proto)
5286
5286
  ];
5287
- return findComments(file.proto.sourceCodeInfo, path5);
5287
+ return findComments(file.proto.sourceCodeInfo, path6);
5288
5288
  },
5289
5289
  getFeatures() {
5290
5290
  var _a2;
@@ -5344,12 +5344,12 @@ var require_create_descriptor_set = __commonJS({
5344
5344
  return `rpc ${parent.typeName}.${name}`;
5345
5345
  },
5346
5346
  getComments() {
5347
- const path5 = [
5347
+ const path6 = [
5348
5348
  ...this.parent.getComments().sourcePath,
5349
5349
  FieldNumber.ServiceDescriptorProto_Method,
5350
5350
  this.parent.proto.method.indexOf(this.proto)
5351
5351
  ];
5352
- return findComments(parent.file.proto.sourceCodeInfo, path5);
5352
+ return findComments(parent.file.proto.sourceCodeInfo, path6);
5353
5353
  },
5354
5354
  getFeatures() {
5355
5355
  var _a2;
@@ -5370,12 +5370,12 @@ var require_create_descriptor_set = __commonJS({
5370
5370
  return `oneof ${parent.typeName}.${this.name}`;
5371
5371
  },
5372
5372
  getComments() {
5373
- const path5 = [
5373
+ const path6 = [
5374
5374
  ...this.parent.getComments().sourcePath,
5375
5375
  FieldNumber.DescriptorProto_OneofDecl,
5376
5376
  this.parent.proto.oneofDecl.indexOf(this.proto)
5377
5377
  ];
5378
- return findComments(parent.file.proto.sourceCodeInfo, path5);
5378
+ return findComments(parent.file.proto.sourceCodeInfo, path6);
5379
5379
  },
5380
5380
  getFeatures() {
5381
5381
  var _a;
@@ -5411,12 +5411,12 @@ var require_create_descriptor_set = __commonJS({
5411
5411
  return `field ${this.parent.typeName}.${this.name}`;
5412
5412
  },
5413
5413
  getComments() {
5414
- const path5 = [
5414
+ const path6 = [
5415
5415
  ...this.parent.getComments().sourcePath,
5416
5416
  FieldNumber.DescriptorProto_Field,
5417
5417
  this.parent.proto.field.indexOf(this.proto)
5418
5418
  ];
5419
- return findComments(file.proto.sourceCodeInfo, path5);
5419
+ return findComments(file.proto.sourceCodeInfo, path6);
5420
5420
  },
5421
5421
  getFeatures() {
5422
5422
  var _a2;
@@ -5493,7 +5493,7 @@ var require_create_descriptor_set = __commonJS({
5493
5493
  return `extension ${this.typeName}`;
5494
5494
  },
5495
5495
  getComments() {
5496
- const path5 = this.parent ? [
5496
+ const path6 = this.parent ? [
5497
5497
  ...this.parent.getComments().sourcePath,
5498
5498
  FieldNumber.DescriptorProto_Extension,
5499
5499
  this.parent.proto.extension.indexOf(proto)
@@ -5501,7 +5501,7 @@ var require_create_descriptor_set = __commonJS({
5501
5501
  FieldNumber.FileDescriptorProto_Extension,
5502
5502
  this.file.proto.extension.indexOf(proto)
5503
5503
  ];
5504
- return findComments(file.proto.sourceCodeInfo, path5);
5504
+ return findComments(file.proto.sourceCodeInfo, path6);
5505
5505
  },
5506
5506
  getFeatures() {
5507
5507
  var _a;
@@ -8624,14 +8624,14 @@ var require_util = __commonJS({
8624
8624
  }
8625
8625
  const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
8626
8626
  let origin = url.origin != null ? url.origin : `${url.protocol}//${url.hostname}:${port}`;
8627
- let path5 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
8627
+ let path6 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
8628
8628
  if (origin.endsWith("/")) {
8629
8629
  origin = origin.substring(0, origin.length - 1);
8630
8630
  }
8631
- if (path5 && !path5.startsWith("/")) {
8632
- path5 = `/${path5}`;
8631
+ if (path6 && !path6.startsWith("/")) {
8632
+ path6 = `/${path6}`;
8633
8633
  }
8634
- url = new URL(origin + path5);
8634
+ url = new URL(origin + path6);
8635
8635
  }
8636
8636
  return url;
8637
8637
  }
@@ -10245,20 +10245,20 @@ var require_parseParams = __commonJS({
10245
10245
  var require_basename = __commonJS({
10246
10246
  "node_modules/.pnpm/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/basename.js"(exports, module) {
10247
10247
  "use strict";
10248
- module.exports = function basename(path5) {
10249
- if (typeof path5 !== "string") {
10248
+ module.exports = function basename(path6) {
10249
+ if (typeof path6 !== "string") {
10250
10250
  return "";
10251
10251
  }
10252
- for (var i = path5.length - 1; i >= 0; --i) {
10253
- switch (path5.charCodeAt(i)) {
10252
+ for (var i = path6.length - 1; i >= 0; --i) {
10253
+ switch (path6.charCodeAt(i)) {
10254
10254
  case 47:
10255
10255
  // '/'
10256
10256
  case 92:
10257
- path5 = path5.slice(i + 1);
10258
- return path5 === ".." || path5 === "." ? "" : path5;
10257
+ path6 = path6.slice(i + 1);
10258
+ return path6 === ".." || path6 === "." ? "" : path6;
10259
10259
  }
10260
10260
  }
10261
- return path5 === ".." || path5 === "." ? "" : path5;
10261
+ return path6 === ".." || path6 === "." ? "" : path6;
10262
10262
  };
10263
10263
  }
10264
10264
  });
@@ -11262,11 +11262,11 @@ var require_util2 = __commonJS({
11262
11262
  var assert = __require("assert");
11263
11263
  var { isUint8Array } = __require("util/types");
11264
11264
  var supportedHashes = [];
11265
- var crypto;
11265
+ var crypto2;
11266
11266
  try {
11267
- crypto = __require("crypto");
11267
+ crypto2 = __require("crypto");
11268
11268
  const possibleRelevantHashes = ["sha256", "sha384", "sha512"];
11269
- supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash));
11269
+ supportedHashes = crypto2.getHashes().filter((hash) => possibleRelevantHashes.includes(hash));
11270
11270
  } catch {
11271
11271
  }
11272
11272
  function responseURL(response) {
@@ -11543,7 +11543,7 @@ var require_util2 = __commonJS({
11543
11543
  }
11544
11544
  }
11545
11545
  function bytesMatch(bytes, metadataList) {
11546
- if (crypto === void 0) {
11546
+ if (crypto2 === void 0) {
11547
11547
  return true;
11548
11548
  }
11549
11549
  const parsedMetadata = parseMetadata(metadataList);
@@ -11558,7 +11558,7 @@ var require_util2 = __commonJS({
11558
11558
  for (const item of metadata) {
11559
11559
  const algorithm = item.algo;
11560
11560
  const expectedValue = item.hash;
11561
- let actualValue = crypto.createHash(algorithm).update(bytes).digest("base64");
11561
+ let actualValue = crypto2.createHash(algorithm).update(bytes).digest("base64");
11562
11562
  if (actualValue[actualValue.length - 1] === "=") {
11563
11563
  if (actualValue[actualValue.length - 2] === "=") {
11564
11564
  actualValue = actualValue.slice(0, -2);
@@ -12904,8 +12904,8 @@ var require_body = __commonJS({
12904
12904
  var { parseMIMEType, serializeAMimeType } = require_dataURL();
12905
12905
  var random;
12906
12906
  try {
12907
- const crypto = __require("node:crypto");
12908
- random = (max) => crypto.randomInt(0, max);
12907
+ const crypto2 = __require("node:crypto");
12908
+ random = (max) => crypto2.randomInt(0, max);
12909
12909
  } catch {
12910
12910
  random = (max) => Math.floor(Math.random(max));
12911
12911
  }
@@ -13288,7 +13288,7 @@ var require_request = __commonJS({
13288
13288
  }
13289
13289
  var Request = class _Request {
13290
13290
  constructor(origin, {
13291
- path: path5,
13291
+ path: path6,
13292
13292
  method,
13293
13293
  body,
13294
13294
  headers,
@@ -13302,11 +13302,11 @@ var require_request = __commonJS({
13302
13302
  throwOnError,
13303
13303
  expectContinue
13304
13304
  }, handler) {
13305
- if (typeof path5 !== "string") {
13305
+ if (typeof path6 !== "string") {
13306
13306
  throw new InvalidArgumentError("path must be a string");
13307
- } else if (path5[0] !== "/" && !(path5.startsWith("http://") || path5.startsWith("https://")) && method !== "CONNECT") {
13307
+ } else if (path6[0] !== "/" && !(path6.startsWith("http://") || path6.startsWith("https://")) && method !== "CONNECT") {
13308
13308
  throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
13309
- } else if (invalidPathRegex.exec(path5) !== null) {
13309
+ } else if (invalidPathRegex.exec(path6) !== null) {
13310
13310
  throw new InvalidArgumentError("invalid request path");
13311
13311
  }
13312
13312
  if (typeof method !== "string") {
@@ -13369,7 +13369,7 @@ var require_request = __commonJS({
13369
13369
  this.completed = false;
13370
13370
  this.aborted = false;
13371
13371
  this.upgrade = upgrade || null;
13372
- this.path = query ? util.buildURL(path5, query) : path5;
13372
+ this.path = query ? util.buildURL(path6, query) : path6;
13373
13373
  this.origin = origin;
13374
13374
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
13375
13375
  this.blocking = blocking == null ? false : blocking;
@@ -14377,9 +14377,9 @@ var require_RedirectHandler = __commonJS({
14377
14377
  return this.handler.onHeaders(statusCode, headers, resume, statusText);
14378
14378
  }
14379
14379
  const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
14380
- const path5 = search ? `${pathname}${search}` : pathname;
14380
+ const path6 = search ? `${pathname}${search}` : pathname;
14381
14381
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
14382
- this.opts.path = path5;
14382
+ this.opts.path = path6;
14383
14383
  this.opts.origin = origin;
14384
14384
  this.opts.maxRedirections = 0;
14385
14385
  this.opts.query = null;
@@ -15619,7 +15619,7 @@ var require_client = __commonJS({
15619
15619
  writeH2(client, client[kHTTP2Session], request3);
15620
15620
  return;
15621
15621
  }
15622
- const { body, method, path: path5, host, upgrade, headers, blocking, reset } = request3;
15622
+ const { body, method, path: path6, host, upgrade, headers, blocking, reset } = request3;
15623
15623
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
15624
15624
  if (body && typeof body.read === "function") {
15625
15625
  body.read(0);
@@ -15669,7 +15669,7 @@ var require_client = __commonJS({
15669
15669
  if (blocking) {
15670
15670
  socket[kBlocking] = true;
15671
15671
  }
15672
- let header = `${method} ${path5} HTTP/1.1\r
15672
+ let header = `${method} ${path6} HTTP/1.1\r
15673
15673
  `;
15674
15674
  if (typeof host === "string") {
15675
15675
  header += `host: ${host}\r
@@ -15732,7 +15732,7 @@ upgrade: ${upgrade}\r
15732
15732
  return true;
15733
15733
  }
15734
15734
  function writeH2(client, session, request3) {
15735
- const { body, method, path: path5, host, upgrade, expectContinue, signal, headers: reqHeaders } = request3;
15735
+ const { body, method, path: path6, host, upgrade, expectContinue, signal, headers: reqHeaders } = request3;
15736
15736
  let headers;
15737
15737
  if (typeof reqHeaders === "string") headers = Request[kHTTP2CopyHeaders](reqHeaders.trim());
15738
15738
  else headers = reqHeaders;
@@ -15775,7 +15775,7 @@ upgrade: ${upgrade}\r
15775
15775
  });
15776
15776
  return true;
15777
15777
  }
15778
- headers[HTTP2_HEADER_PATH] = path5;
15778
+ headers[HTTP2_HEADER_PATH] = path6;
15779
15779
  headers[HTTP2_HEADER_SCHEME] = "https";
15780
15780
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
15781
15781
  if (body && typeof body.read === "function") {
@@ -18015,20 +18015,20 @@ var require_mock_utils = __commonJS({
18015
18015
  }
18016
18016
  return true;
18017
18017
  }
18018
- function safeUrl(path5) {
18019
- if (typeof path5 !== "string") {
18020
- return path5;
18018
+ function safeUrl(path6) {
18019
+ if (typeof path6 !== "string") {
18020
+ return path6;
18021
18021
  }
18022
- const pathSegments = path5.split("?");
18022
+ const pathSegments = path6.split("?");
18023
18023
  if (pathSegments.length !== 2) {
18024
- return path5;
18024
+ return path6;
18025
18025
  }
18026
18026
  const qp = new URLSearchParams(pathSegments.pop());
18027
18027
  qp.sort();
18028
18028
  return [...pathSegments, qp.toString()].join("?");
18029
18029
  }
18030
- function matchKey(mockDispatch2, { path: path5, method, body, headers }) {
18031
- const pathMatch = matchValue(mockDispatch2.path, path5);
18030
+ function matchKey(mockDispatch2, { path: path6, method, body, headers }) {
18031
+ const pathMatch = matchValue(mockDispatch2.path, path6);
18032
18032
  const methodMatch = matchValue(mockDispatch2.method, method);
18033
18033
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
18034
18034
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -18046,7 +18046,7 @@ var require_mock_utils = __commonJS({
18046
18046
  function getMockDispatch(mockDispatches, key) {
18047
18047
  const basePath = key.query ? buildURL(key.path, key.query) : key.path;
18048
18048
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
18049
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path5 }) => matchValue(safeUrl(path5), resolvedPath));
18049
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path6 }) => matchValue(safeUrl(path6), resolvedPath));
18050
18050
  if (matchedMockDispatches.length === 0) {
18051
18051
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
18052
18052
  }
@@ -18083,9 +18083,9 @@ var require_mock_utils = __commonJS({
18083
18083
  }
18084
18084
  }
18085
18085
  function buildKey(opts) {
18086
- const { path: path5, method, body, headers, query } = opts;
18086
+ const { path: path6, method, body, headers, query } = opts;
18087
18087
  return {
18088
- path: path5,
18088
+ path: path6,
18089
18089
  method,
18090
18090
  body,
18091
18091
  headers,
@@ -18534,10 +18534,10 @@ var require_pending_interceptors_formatter = __commonJS({
18534
18534
  }
18535
18535
  format(pendingInterceptors) {
18536
18536
  const withPrettyHeaders = pendingInterceptors.map(
18537
- ({ method, path: path5, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
18537
+ ({ method, path: path6, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
18538
18538
  Method: method,
18539
18539
  Origin: origin,
18540
- Path: path5,
18540
+ Path: path6,
18541
18541
  "Status code": statusCode,
18542
18542
  Persistent: persist ? "\u2705" : "\u274C",
18543
18543
  Invocations: timesInvoked,
@@ -23157,8 +23157,8 @@ var require_util6 = __commonJS({
23157
23157
  }
23158
23158
  }
23159
23159
  }
23160
- function validateCookiePath(path5) {
23161
- for (const char of path5) {
23160
+ function validateCookiePath(path6) {
23161
+ for (const char of path6) {
23162
23162
  const code = char.charCodeAt(0);
23163
23163
  if (code < 33 || char === ";") {
23164
23164
  throw new Error("Invalid cookie path");
@@ -23955,9 +23955,9 @@ var require_connection = __commonJS({
23955
23955
  channels.open = diagnosticsChannel.channel("undici:websocket:open");
23956
23956
  channels.close = diagnosticsChannel.channel("undici:websocket:close");
23957
23957
  channels.socketError = diagnosticsChannel.channel("undici:websocket:socket_error");
23958
- var crypto;
23958
+ var crypto2;
23959
23959
  try {
23960
- crypto = __require("crypto");
23960
+ crypto2 = __require("crypto");
23961
23961
  } catch {
23962
23962
  }
23963
23963
  function establishWebSocketConnection(url, protocols, ws, onEstablish, options) {
@@ -23976,7 +23976,7 @@ var require_connection = __commonJS({
23976
23976
  const headersList = new Headers2(options.headers)[kHeadersList];
23977
23977
  request3.headersList = headersList;
23978
23978
  }
23979
- const keyValue = crypto.randomBytes(16).toString("base64");
23979
+ const keyValue = crypto2.randomBytes(16).toString("base64");
23980
23980
  request3.headersList.append("sec-websocket-key", keyValue);
23981
23981
  request3.headersList.append("sec-websocket-version", "13");
23982
23982
  for (const protocol of protocols) {
@@ -24005,7 +24005,7 @@ var require_connection = __commonJS({
24005
24005
  return;
24006
24006
  }
24007
24007
  const secWSAccept = response.headersList.get("Sec-WebSocket-Accept");
24008
- const digest = crypto.createHash("sha1").update(keyValue + uid).digest("base64");
24008
+ const digest = crypto2.createHash("sha1").update(keyValue + uid).digest("base64");
24009
24009
  if (secWSAccept !== digest) {
24010
24010
  failWebsocketConnection(ws, "Incorrect hash received in Sec-WebSocket-Accept header.");
24011
24011
  return;
@@ -24085,9 +24085,9 @@ var require_frame = __commonJS({
24085
24085
  "node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/frame.js"(exports, module) {
24086
24086
  "use strict";
24087
24087
  var { maxUnsigned16Bit } = require_constants5();
24088
- var crypto;
24088
+ var crypto2;
24089
24089
  try {
24090
- crypto = __require("crypto");
24090
+ crypto2 = __require("crypto");
24091
24091
  } catch {
24092
24092
  }
24093
24093
  var WebsocketFrameSend = class {
@@ -24096,7 +24096,7 @@ var require_frame = __commonJS({
24096
24096
  */
24097
24097
  constructor(data) {
24098
24098
  this.frameData = data;
24099
- this.maskKey = crypto.randomBytes(4);
24099
+ this.maskKey = crypto2.randomBytes(4);
24100
24100
  }
24101
24101
  createFrame(opcode) {
24102
24102
  const bodyLength = this.frameData?.byteLength ?? 0;
@@ -24838,11 +24838,11 @@ var require_undici = __commonJS({
24838
24838
  if (typeof opts.path !== "string") {
24839
24839
  throw new InvalidArgumentError("invalid opts.path");
24840
24840
  }
24841
- let path5 = opts.path;
24841
+ let path6 = opts.path;
24842
24842
  if (!opts.path.startsWith("/")) {
24843
- path5 = `/${path5}`;
24843
+ path6 = `/${path6}`;
24844
24844
  }
24845
- url = new URL(util.parseOrigin(url).origin + path5);
24845
+ url = new URL(util.parseOrigin(url).origin + path6);
24846
24846
  } else {
24847
24847
  if (!opts) {
24848
24848
  opts = typeof url === "object" ? url : {};
@@ -25030,7 +25030,7 @@ function deriveIdentityParts() {
25030
25030
  function deriveAutoId(parts) {
25031
25031
  return `${parts.username}@${parts.host}#${parts.homeHash}`;
25032
25032
  }
25033
- function writeIdentityFile(path5, userId, parts) {
25033
+ function writeIdentityFile(path6, userId, parts) {
25034
25034
  const identity = {
25035
25035
  userId,
25036
25036
  derivedFrom: {
@@ -25041,15 +25041,15 @@ function writeIdentityFile(path5, userId, parts) {
25041
25041
  },
25042
25042
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
25043
25043
  };
25044
- const dir = dirname(path5);
25044
+ const dir = dirname(path6);
25045
25045
  mkdirSync(dir, { recursive: true });
25046
- const tmp = `${path5}.${process.pid}.${Math.random().toString(36).slice(2, 8)}.tmp`;
25046
+ const tmp = `${path6}.${process.pid}.${Math.random().toString(36).slice(2, 8)}.tmp`;
25047
25047
  writeFileSync(tmp, JSON.stringify(identity, null, 2) + "\n", { mode: 384 });
25048
- renameSync(tmp, path5);
25048
+ renameSync(tmp, path6);
25049
25049
  if (process.platform === "win32") {
25050
25050
  try {
25051
25051
  execSync(
25052
- `icacls "${path5}" /inheritance:r /grant:r "%USERNAME%:(R,W)"`,
25052
+ `icacls "${path6}" /inheritance:r /grant:r "%USERNAME%:(R,W)"`,
25053
25053
  { stdio: "ignore", timeout: 5e3 }
25054
25054
  );
25055
25055
  } catch {
@@ -25104,6 +25104,16 @@ function resolveIdentity(params) {
25104
25104
  }
25105
25105
  return { userId: autoId, source: "auto" };
25106
25106
  }
25107
+ function resolveTenantKey(cfg) {
25108
+ const explicit = cfg.tenantId?.trim();
25109
+ if (explicit) return explicit;
25110
+ const envId = process.env.LIBRAVDB_AGENT_ID?.trim();
25111
+ if (envId) return envId;
25112
+ return resolveIdentity({
25113
+ configUserId: cfg.userId,
25114
+ identityPath: cfg.identityPath
25115
+ }).userId;
25116
+ }
25107
25117
 
25108
25118
  // src/format-error.ts
25109
25119
  function formatError(error2) {
@@ -25849,18 +25859,22 @@ function createMemorySearchManager(getClient, cfg, defaults, initialStatus) {
25849
25859
  k
25850
25860
  }) : await searchResolvedCollections(client, cfg, userId, sessionId, queryText, k);
25851
25861
  const filteredResults = minScore === void 0 ? result.results : result.results.filter((item) => item.score >= minScore);
25852
- const legacyResults = filteredResults.map((item) => ({
25853
- ...item,
25854
- content: item.text
25855
- }));
25862
+ const legacyResults = filteredResults.map((item) => {
25863
+ const meta = parseMetadataJson(item);
25864
+ return {
25865
+ ...item,
25866
+ content: item.text || (typeof meta.text === "string" ? meta.text : "")
25867
+ };
25868
+ });
25856
25869
  if (legacyCall) {
25857
25870
  return { results: legacyResults };
25858
25871
  }
25859
25872
  const memoryResults = filteredResults.map((item) => {
25860
25873
  const meta = parseMetadataJson(item);
25861
25874
  const collection = typeof meta.collection === "string" ? meta.collection : "memory";
25875
+ const effectiveText = item.text || (typeof meta.text === "string" ? meta.text : "") || "";
25862
25876
  const relPath = encodeSearchResultPath(collection, item.id);
25863
- returnedSearchPaths.set(relPath, item.text);
25877
+ returnedSearchPaths.set(relPath, effectiveText);
25864
25878
  return toMemorySearchResult(item);
25865
25879
  });
25866
25880
  return memoryResults;
@@ -25962,12 +25976,13 @@ function parseMetadataJson(item) {
25962
25976
  function toMemorySearchResult(item) {
25963
25977
  const meta = parseMetadataJson(item);
25964
25978
  const collection = typeof meta.collection === "string" ? meta.collection : "memory";
25979
+ const effectiveText = item.text || (typeof meta.text === "string" ? meta.text : "") || "";
25965
25980
  return {
25966
25981
  path: encodeSearchResultPath(collection, item.id),
25967
25982
  startLine: 1,
25968
- endLine: Math.max(1, item.text.split("\n").length),
25983
+ endLine: Math.max(1, effectiveText.split("\n").length),
25969
25984
  score: item.score,
25970
- snippet: item.text,
25985
+ snippet: effectiveText,
25971
25986
  source: collection.startsWith("session:") || collection.startsWith("session_") ? "sessions" : "memory",
25972
25987
  citation: `${collection}:${item.id}`
25973
25988
  };
@@ -26514,6 +26529,131 @@ function resolveCliMemoryOperationScope(opts) {
26514
26529
  };
26515
26530
  }
26516
26531
 
26532
+ // src/context-engine.ts
26533
+ import { randomUUID } from "node:crypto";
26534
+
26535
+ // src/manifest.ts
26536
+ import * as fs2 from "fs";
26537
+ import * as path2 from "path";
26538
+ import * as crypto from "crypto";
26539
+ import * as os2 from "os";
26540
+ var TurnManifestStore = class {
26541
+ manifestDir;
26542
+ constructor() {
26543
+ this.manifestDir = path2.join(os2.homedir(), ".openclaw", "libravdb-manifests");
26544
+ if (!fs2.existsSync(this.manifestDir)) {
26545
+ fs2.mkdirSync(this.manifestDir, { recursive: true });
26546
+ }
26547
+ }
26548
+ getManifestPath(sessionId) {
26549
+ const safe = sessionId.replace(/[^A-Za-z0-9._-]/g, "_");
26550
+ return path2.join(this.manifestDir, `${safe}.manifest.json`);
26551
+ }
26552
+ hashString(data) {
26553
+ return crypto.createHash("sha256").update(data).digest("hex");
26554
+ }
26555
+ createEmpty(sessionId) {
26556
+ return {
26557
+ sessionId,
26558
+ version: 0,
26559
+ turns: [],
26560
+ tailHash: "0000000000000000000000000000000000000000000000000000000000000000"
26561
+ };
26562
+ }
26563
+ load(sessionId, logger) {
26564
+ const filePath = this.getManifestPath(sessionId);
26565
+ if (!fs2.existsSync(filePath)) {
26566
+ return this.createEmpty(sessionId);
26567
+ }
26568
+ try {
26569
+ const raw = fs2.readFileSync(filePath, "utf8");
26570
+ const manifest = JSON.parse(raw);
26571
+ if (!this.verifyChain(manifest)) {
26572
+ logger?.warn?.(`[LibraVDB] Manifest chain broken for session ${sessionId}. Forcing re-sync.`);
26573
+ return this.createEmpty(sessionId);
26574
+ }
26575
+ return manifest;
26576
+ } catch (e) {
26577
+ logger?.error?.(`[LibraVDB] Failed to read manifest for ${sessionId}:`, e);
26578
+ return this.createEmpty(sessionId);
26579
+ }
26580
+ }
26581
+ save(manifest) {
26582
+ const filePath = this.getManifestPath(manifest.sessionId);
26583
+ const tempPath = `${filePath}.${process.pid}.tmp`;
26584
+ fs2.writeFileSync(tempPath, JSON.stringify(manifest, null, 2), "utf8");
26585
+ fs2.renameSync(tempPath, filePath);
26586
+ }
26587
+ verifyChain(manifest) {
26588
+ let currentHash = "0000000000000000000000000000000000000000000000000000000000000000";
26589
+ for (const turn of manifest.turns) {
26590
+ const expectedHash = this.hashString(`${turn.index}${turn.role}${turn.contentHash}${currentHash}`);
26591
+ if (turn.turnHash !== expectedHash) {
26592
+ return false;
26593
+ }
26594
+ currentHash = expectedHash;
26595
+ }
26596
+ return manifest.tailHash === currentHash;
26597
+ }
26598
+ /**
26599
+ * Finds the overlap point between incoming messages and our stored history.
26600
+ * Returns the index into incomingMessages where new (un-ACKed) messages begin.
26601
+ * Returns 0 if no overlap (full re-sync).
26602
+ */
26603
+ findOverlapIndex(manifest, incomingMessages) {
26604
+ if (manifest.turns.length === 0) {
26605
+ return 0;
26606
+ }
26607
+ const known = /* @__PURE__ */ new Map();
26608
+ for (const turn of manifest.turns) {
26609
+ known.set(turn.contentHash, turn.index);
26610
+ }
26611
+ for (let i = incomingMessages.length - 1; i >= 0; i--) {
26612
+ const contentHash = this.hashString(incomingMessages[i].content);
26613
+ if (known.has(contentHash)) {
26614
+ return i + 1;
26615
+ }
26616
+ }
26617
+ return 0;
26618
+ }
26619
+ appendACKedMessages(manifest, newMessages, startingIndex) {
26620
+ let currentHash = manifest.tailHash;
26621
+ const newTurns = [];
26622
+ for (let i = 0; i < newMessages.length; i++) {
26623
+ const msg = newMessages[i];
26624
+ const absoluteIndex = startingIndex + i;
26625
+ const contentHash = this.hashString(msg.content);
26626
+ currentHash = this.hashString(`${absoluteIndex}${msg.role}${contentHash}${currentHash}`);
26627
+ newTurns.push({
26628
+ index: absoluteIndex,
26629
+ role: msg.role,
26630
+ contentHash,
26631
+ turnHash: currentHash,
26632
+ ingestedAt: Date.now()
26633
+ });
26634
+ }
26635
+ return {
26636
+ sessionId: manifest.sessionId,
26637
+ version: manifest.version + 1,
26638
+ turns: [...manifest.turns, ...newTurns],
26639
+ tailHash: currentHash
26640
+ };
26641
+ }
26642
+ /**
26643
+ * Determines the absolute starting index for a set of new messages.
26644
+ * If we have stored turns, the next message's index is last_turn.index + 1.
26645
+ * If the manifest is empty, we infer from OpenClaw's prePromptMessageCount signal
26646
+ * (caller must provide this as a hint when available).
26647
+ */
26648
+ deriveStartingIndex(manifest, prePromptMessageCountHint) {
26649
+ if (manifest.turns.length > 0) {
26650
+ return manifest.turns[manifest.turns.length - 1].index + 1;
26651
+ }
26652
+ return typeof prePromptMessageCountHint === "number" && prePromptMessageCountHint >= 0 ? prePromptMessageCountHint : 0;
26653
+ }
26654
+ };
26655
+ var manifestStore = new TurnManifestStore();
26656
+
26517
26657
  // src/context-engine.ts
26518
26658
  var APPROX_CHARS_PER_TOKEN = 4;
26519
26659
  var PROMPT_AUTHORITY_PREASSEMBLY_MAY_OVERFLOW = "preassembly_may_overflow";
@@ -26843,7 +26983,7 @@ function normalizeKernelMessage(message) {
26843
26983
  return {
26844
26984
  role: message.role,
26845
26985
  content: normalizeKernelContent(message.content),
26846
- ...typeof message.id === "string" ? { id: message.id } : {}
26986
+ id: message.id || randomUUID()
26847
26987
  };
26848
26988
  }
26849
26989
  function normalizeKernelMessages(messages) {
@@ -26897,9 +27037,9 @@ function extractExactRecallFactText(text, token) {
26897
27037
  function escapeMemoryFactText(text) {
26898
27038
  return text.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;").replaceAll("\r", "&#13;").replaceAll("\n", "&#10;").replaceAll(" ", "&#9;");
26899
27039
  }
26900
- var TOOL_CALL_BRACKET_RE = /\[tool:([^\]]+)\]/gi;
26901
- var TOOL_CALL_JSON_RE = /\{\s*"name"\s*:\s*"([^"]+)"[^}]*\}/g;
26902
- var TOOL_RESULT_ANNOTATION_RE = /\[tool:[^\]]+\](?:\s*[^{\[]*)?/g;
27040
+ var TOOL_CALL_BRACKET_RE = /\[tool:([^\]]+)\](?:\s*(?:\{[\s\S]*?\}|\[[\s\S]*?\]|".*?"))?/gi;
27041
+ var TOOL_CALL_JSON_RE = /\{\s*"name"\s*:\s*"([^"]+)"[\s\S]*?\}/g;
27042
+ var TOOL_RESULT_ANNOTATION_RE = /\[tool:[^\]]+\][^\n]*/g;
26903
27043
  function sanitizeToolCallPatterns(text) {
26904
27044
  let sanitized = text;
26905
27045
  sanitized = sanitized.replace(TOOL_CALL_BRACKET_RE, (_match, toolName) => {
@@ -27094,7 +27234,7 @@ function normalizeAssembleResult(result, sourceMessages) {
27094
27234
  if (isRealTranscript) {
27095
27235
  messages.push({
27096
27236
  role: message.role === "user" ? "user" : "assistant",
27097
- content,
27237
+ content: sanitizeToolCallPatterns(content),
27098
27238
  ...typeof message.id === "string" ? { id: message.id } : {}
27099
27239
  });
27100
27240
  } else {
@@ -27121,6 +27261,18 @@ ${extractedMemoryItems.join("\n")}
27121
27261
  ...result.debug != null ? { debug: result.debug } : {}
27122
27262
  };
27123
27263
  }
27264
+ function extractCursorFromResult(result) {
27265
+ if (result && typeof result === "object" && "cursor" in result) {
27266
+ const cursor = result.cursor;
27267
+ if (cursor && typeof cursor === "object") {
27268
+ const c = cursor;
27269
+ if (typeof c.lastProcessedIndex === "number" && typeof c.sessionVersion === "number" && typeof c.manifestTailHash === "string") {
27270
+ return c;
27271
+ }
27272
+ }
27273
+ }
27274
+ return void 0;
27275
+ }
27124
27276
  function buildContextEngineFactory(runtime, cfg, logger = console) {
27125
27277
  const predictiveContextCache = /* @__PURE__ */ new Map();
27126
27278
  const PREDICTIVE_CACHE_MAX_SIZE = 100;
@@ -27526,12 +27678,20 @@ function buildContextEngineFactory(runtime, cfg, logger = console) {
27526
27678
  userIdOverride: args.userId,
27527
27679
  sessionKey: args.sessionKey
27528
27680
  });
27681
+ const manifest = manifestStore.load(sessionId, logger);
27529
27682
  const afterTurnMessages = selectAfterTurnMessages(args.messages, args.prePromptMessageCount, logger);
27530
27683
  const messages = normalizeKernelMessages(afterTurnMessages);
27531
- const ingestMessages = boundAfterTurnMessagesForIngest(messages, logger, sessionId);
27532
- const msgCount = messages.length;
27684
+ const overlapIndex = manifestStore.findOverlapIndex(manifest, messages);
27685
+ const newMessages = messages.slice(overlapIndex);
27686
+ const ingestMessages = boundAfterTurnMessagesForIngest(newMessages, logger, sessionId);
27687
+ const startIndex = manifestStore.deriveStartingIndex(manifest, args.prePromptMessageCount);
27688
+ const cursor = {
27689
+ lastProcessedIndex: startIndex > 0 ? startIndex - 1 : 0,
27690
+ sessionVersion: manifest.version,
27691
+ manifestTailHash: manifest.tailHash
27692
+ };
27533
27693
  logger.info?.(
27534
- `LibraVDB afterTurn sessionId=${sessionId} userId=${userId} messageCount=${msgCount} totalMessages=${args.messages.length} prePromptMessageCount=${args.prePromptMessageCount ?? "unknown"} heartbeat=${args.isHeartbeat ?? false}`
27694
+ `LibraVDB afterTurn sessionId=${sessionId} userId=${userId} messageCount=${messages.length} newMessages=${newMessages.length} overlapIndex=${overlapIndex} startIndex=${startIndex} prePromptMessageCount=${args.prePromptMessageCount ?? "unknown"} heartbeat=${args.isHeartbeat ?? false}`
27535
27695
  );
27536
27696
  try {
27537
27697
  const client = await runtime.getClient();
@@ -27543,8 +27703,38 @@ function buildContextEngineFactory(runtime, cfg, logger = console) {
27543
27703
  sessionKey: args.sessionKey,
27544
27704
  userId,
27545
27705
  messages: ingestMessages,
27546
- isHeartbeat: args.isHeartbeat
27706
+ prePromptMessageCount: args.prePromptMessageCount,
27707
+ isHeartbeat: args.isHeartbeat,
27708
+ cursor
27547
27709
  });
27710
+ const daemonCursor = extractCursorFromResult(result);
27711
+ if (daemonCursor) {
27712
+ if (!daemonCursor.manifestTailHash) {
27713
+ logger.warn?.(
27714
+ `[LibraVDB] Daemon reported cursor gap for session ${sessionId}. Resetting manifest for full re-sync next turn.`
27715
+ );
27716
+ manifestStore.save(manifestStore.createEmpty(sessionId));
27717
+ } else if (ingestMessages.length > 0) {
27718
+ const confirmedIndex = daemonCursor.lastProcessedIndex;
27719
+ const ackCount = Math.max(0, confirmedIndex - startIndex + 1);
27720
+ if (ackCount > 0) {
27721
+ const ackedMessages = ingestMessages.slice(0, ackCount);
27722
+ const updatedManifest = manifestStore.appendACKedMessages(
27723
+ manifest,
27724
+ ackedMessages,
27725
+ startIndex
27726
+ );
27727
+ manifestStore.save(updatedManifest);
27728
+ }
27729
+ }
27730
+ } else if (ingestMessages.length > 0) {
27731
+ const updatedManifest = manifestStore.appendACKedMessages(
27732
+ manifest,
27733
+ ingestMessages,
27734
+ startIndex
27735
+ );
27736
+ manifestStore.save(updatedManifest);
27737
+ }
27548
27738
  await performAfterTurnPredictiveCompaction({
27549
27739
  sessionId,
27550
27740
  messages,
@@ -27637,16 +27827,16 @@ function isRecord(value) {
27637
27827
  }
27638
27828
 
27639
27829
  // src/markdown-ingest.ts
27640
- import fs2 from "node:fs";
27830
+ import fs3 from "node:fs";
27641
27831
  import fsp2 from "node:fs/promises";
27642
- import os2 from "node:os";
27643
- import path2 from "node:path";
27832
+ import os3 from "node:os";
27833
+ import path3 from "node:path";
27644
27834
 
27645
27835
  // node_modules/.pnpm/@bufbuild+protobuf@1.7.2/node_modules/@bufbuild/protobuf/dist/proxy/index.js
27646
27836
  var proxy_exports = {};
27647
27837
  __reExport(proxy_exports, __toESM(require_cjs(), 1));
27648
27838
 
27649
- // node_modules/.pnpm/@xdarkicex+libravdb-contracts@2.0.8/node_modules/@xdarkicex/libravdb-contracts/gen/js/libravdb/ipc/v1/rpc_pb.js
27839
+ // node_modules/.pnpm/@xdarkicex+libravdb-contracts@2.0.12/node_modules/@xdarkicex/libravdb-contracts/gen/js/libravdb/ipc/v1/rpc_pb.js
27650
27840
  var IngestMode;
27651
27841
  (function(IngestMode2) {
27652
27842
  IngestMode2[IngestMode2["REPLACE"] = 0] = "REPLACE";
@@ -28415,6 +28605,61 @@ var KernelMessage = class _KernelMessage extends proxy_exports.Message {
28415
28605
  return proxy_exports.proto3.util.equals(_KernelMessage, a, b);
28416
28606
  }
28417
28607
  };
28608
+ var SessionSyncCursor = class _SessionSyncCursor extends proxy_exports.Message {
28609
+ /**
28610
+ * @generated from field: int64 last_processed_index = 1;
28611
+ */
28612
+ lastProcessedIndex = proxy_exports.protoInt64.zero;
28613
+ /**
28614
+ * @generated from field: int64 session_version = 2;
28615
+ */
28616
+ sessionVersion = proxy_exports.protoInt64.zero;
28617
+ /**
28618
+ * @generated from field: string manifest_tail_hash = 3;
28619
+ */
28620
+ manifestTailHash = "";
28621
+ constructor(data) {
28622
+ super();
28623
+ proxy_exports.proto3.util.initPartial(data, this);
28624
+ }
28625
+ static runtime = proxy_exports.proto3;
28626
+ static typeName = "libravdb.ipc.v1.SessionSyncCursor";
28627
+ static fields = proxy_exports.proto3.util.newFieldList(() => [
28628
+ {
28629
+ no: 1,
28630
+ name: "last_processed_index",
28631
+ kind: "scalar",
28632
+ T: 3
28633
+ /* ScalarType.INT64 */
28634
+ },
28635
+ {
28636
+ no: 2,
28637
+ name: "session_version",
28638
+ kind: "scalar",
28639
+ T: 3
28640
+ /* ScalarType.INT64 */
28641
+ },
28642
+ {
28643
+ no: 3,
28644
+ name: "manifest_tail_hash",
28645
+ kind: "scalar",
28646
+ T: 9
28647
+ /* ScalarType.STRING */
28648
+ }
28649
+ ]);
28650
+ static fromBinary(bytes, options) {
28651
+ return new _SessionSyncCursor().fromBinary(bytes, options);
28652
+ }
28653
+ static fromJson(jsonValue, options) {
28654
+ return new _SessionSyncCursor().fromJson(jsonValue, options);
28655
+ }
28656
+ static fromJsonString(jsonString, options) {
28657
+ return new _SessionSyncCursor().fromJsonString(jsonString, options);
28658
+ }
28659
+ static equals(a, b) {
28660
+ return proxy_exports.proto3.util.equals(_SessionSyncCursor, a, b);
28661
+ }
28662
+ };
28418
28663
  var AssembleContextInternalResponse = class _AssembleContextInternalResponse extends proxy_exports.Message {
28419
28664
  /**
28420
28665
  * @generated from field: repeated libravdb.ipc.v1.KernelMessage messages = 1;
@@ -30976,6 +31221,10 @@ var MemoryStatusResponse = class _MemoryStatusResponse extends proxy_exports.Mes
30976
31221
  * @generated from field: string embedding_profile = 8;
30977
31222
  */
30978
31223
  embeddingProfile = "";
31224
+ /**
31225
+ * @generated from field: string embedding_backend = 9;
31226
+ */
31227
+ embeddingBackend = "";
30979
31228
  constructor(data) {
30980
31229
  super();
30981
31230
  proxy_exports.proto3.util.initPartial(data, this);
@@ -31038,6 +31287,13 @@ var MemoryStatusResponse = class _MemoryStatusResponse extends proxy_exports.Mes
31038
31287
  kind: "scalar",
31039
31288
  T: 9
31040
31289
  /* ScalarType.STRING */
31290
+ },
31291
+ {
31292
+ no: 9,
31293
+ name: "embedding_backend",
31294
+ kind: "scalar",
31295
+ T: 9
31296
+ /* ScalarType.STRING */
31041
31297
  }
31042
31298
  ]);
31043
31299
  static fromBinary(bytes, options) {
@@ -31418,6 +31674,10 @@ var AfterTurnKernelRequest = class _AfterTurnKernelRequest extends proxy_exports
31418
31674
  * @generated from field: bool is_heartbeat = 6;
31419
31675
  */
31420
31676
  isHeartbeat = false;
31677
+ /**
31678
+ * @generated from field: libravdb.ipc.v1.SessionSyncCursor cursor = 7;
31679
+ */
31680
+ cursor;
31421
31681
  constructor(data) {
31422
31682
  super();
31423
31683
  proxy_exports.proto3.util.initPartial(data, this);
@@ -31460,7 +31720,8 @@ var AfterTurnKernelRequest = class _AfterTurnKernelRequest extends proxy_exports
31460
31720
  kind: "scalar",
31461
31721
  T: 8
31462
31722
  /* ScalarType.BOOL */
31463
- }
31723
+ },
31724
+ { no: 7, name: "cursor", kind: "message", T: SessionSyncCursor }
31464
31725
  ]);
31465
31726
  static fromBinary(bytes, options) {
31466
31727
  return new _AfterTurnKernelRequest().fromBinary(bytes, options);
@@ -31484,6 +31745,10 @@ var AfterTurnKernelResponse = class _AfterTurnKernelResponse extends proxy_expor
31484
31745
  * @generated from field: repeated libravdb.ipc.v1.PredictedContext predictions = 2;
31485
31746
  */
31486
31747
  predictions = [];
31748
+ /**
31749
+ * @generated from field: libravdb.ipc.v1.SessionSyncCursor cursor = 3;
31750
+ */
31751
+ cursor;
31487
31752
  constructor(data) {
31488
31753
  super();
31489
31754
  proxy_exports.proto3.util.initPartial(data, this);
@@ -31498,7 +31763,8 @@ var AfterTurnKernelResponse = class _AfterTurnKernelResponse extends proxy_expor
31498
31763
  T: 8
31499
31764
  /* ScalarType.BOOL */
31500
31765
  },
31501
- { no: 2, name: "predictions", kind: "message", T: PredictedContext, repeated: true }
31766
+ { no: 2, name: "predictions", kind: "message", T: PredictedContext, repeated: true },
31767
+ { no: 3, name: "cursor", kind: "message", T: SessionSyncCursor }
31502
31768
  ]);
31503
31769
  static fromBinary(bytes, options) {
31504
31770
  return new _AfterTurnKernelResponse().fromBinary(bytes, options);
@@ -31839,6 +32105,375 @@ var CognitiveMetricsRequest = class _CognitiveMetricsRequest extends proxy_expor
31839
32105
  return proxy_exports.proto3.util.equals(_CognitiveMetricsRequest, a, b);
31840
32106
  }
31841
32107
  };
32108
+ var TenantStatus = class _TenantStatus extends proxy_exports.Message {
32109
+ /**
32110
+ * @generated from field: string tenant_key = 1;
32111
+ */
32112
+ tenantKey = "";
32113
+ /**
32114
+ * "active", "idle"
32115
+ *
32116
+ * @generated from field: string status = 2;
32117
+ */
32118
+ status = "";
32119
+ /**
32120
+ * @generated from field: int64 size_bytes = 3;
32121
+ */
32122
+ sizeBytes = proxy_exports.protoInt64.zero;
32123
+ /**
32124
+ * @generated from field: int64 last_active_ms = 4;
32125
+ */
32126
+ lastActiveMs = proxy_exports.protoInt64.zero;
32127
+ /**
32128
+ * @generated from field: int32 open_sessions = 5;
32129
+ */
32130
+ openSessions = 0;
32131
+ /**
32132
+ * @generated from field: bool unregistered = 6;
32133
+ */
32134
+ unregistered = false;
32135
+ constructor(data) {
32136
+ super();
32137
+ proxy_exports.proto3.util.initPartial(data, this);
32138
+ }
32139
+ static runtime = proxy_exports.proto3;
32140
+ static typeName = "libravdb.ipc.v1.TenantStatus";
32141
+ static fields = proxy_exports.proto3.util.newFieldList(() => [
32142
+ {
32143
+ no: 1,
32144
+ name: "tenant_key",
32145
+ kind: "scalar",
32146
+ T: 9
32147
+ /* ScalarType.STRING */
32148
+ },
32149
+ {
32150
+ no: 2,
32151
+ name: "status",
32152
+ kind: "scalar",
32153
+ T: 9
32154
+ /* ScalarType.STRING */
32155
+ },
32156
+ {
32157
+ no: 3,
32158
+ name: "size_bytes",
32159
+ kind: "scalar",
32160
+ T: 3
32161
+ /* ScalarType.INT64 */
32162
+ },
32163
+ {
32164
+ no: 4,
32165
+ name: "last_active_ms",
32166
+ kind: "scalar",
32167
+ T: 3
32168
+ /* ScalarType.INT64 */
32169
+ },
32170
+ {
32171
+ no: 5,
32172
+ name: "open_sessions",
32173
+ kind: "scalar",
32174
+ T: 5
32175
+ /* ScalarType.INT32 */
32176
+ },
32177
+ {
32178
+ no: 6,
32179
+ name: "unregistered",
32180
+ kind: "scalar",
32181
+ T: 8
32182
+ /* ScalarType.BOOL */
32183
+ }
32184
+ ]);
32185
+ static fromBinary(bytes, options) {
32186
+ return new _TenantStatus().fromBinary(bytes, options);
32187
+ }
32188
+ static fromJson(jsonValue, options) {
32189
+ return new _TenantStatus().fromJson(jsonValue, options);
32190
+ }
32191
+ static fromJsonString(jsonString, options) {
32192
+ return new _TenantStatus().fromJsonString(jsonString, options);
32193
+ }
32194
+ static equals(a, b) {
32195
+ return proxy_exports.proto3.util.equals(_TenantStatus, a, b);
32196
+ }
32197
+ };
32198
+ var DaemonStatusRequest = class _DaemonStatusRequest extends proxy_exports.Message {
32199
+ constructor(data) {
32200
+ super();
32201
+ proxy_exports.proto3.util.initPartial(data, this);
32202
+ }
32203
+ static runtime = proxy_exports.proto3;
32204
+ static typeName = "libravdb.ipc.v1.DaemonStatusRequest";
32205
+ static fields = proxy_exports.proto3.util.newFieldList(() => []);
32206
+ static fromBinary(bytes, options) {
32207
+ return new _DaemonStatusRequest().fromBinary(bytes, options);
32208
+ }
32209
+ static fromJson(jsonValue, options) {
32210
+ return new _DaemonStatusRequest().fromJson(jsonValue, options);
32211
+ }
32212
+ static fromJsonString(jsonString, options) {
32213
+ return new _DaemonStatusRequest().fromJsonString(jsonString, options);
32214
+ }
32215
+ static equals(a, b) {
32216
+ return proxy_exports.proto3.util.equals(_DaemonStatusRequest, a, b);
32217
+ }
32218
+ };
32219
+ var DaemonStatusResponse = class _DaemonStatusResponse extends proxy_exports.Message {
32220
+ /**
32221
+ * @generated from field: bool ok = 1;
32222
+ */
32223
+ ok = false;
32224
+ /**
32225
+ * @generated from field: string version = 2;
32226
+ */
32227
+ version = "";
32228
+ /**
32229
+ * @generated from field: string uptime = 3;
32230
+ */
32231
+ uptime = "";
32232
+ /**
32233
+ * @generated from field: string backend = 4;
32234
+ */
32235
+ backend = "";
32236
+ /**
32237
+ * @generated from field: int64 global_db_size = 5;
32238
+ */
32239
+ globalDbSize = proxy_exports.protoInt64.zero;
32240
+ /**
32241
+ * @generated from field: bool global_db_healthy = 6;
32242
+ */
32243
+ globalDbHealthy = false;
32244
+ /**
32245
+ * @generated from field: repeated libravdb.ipc.v1.TenantStatus tenants = 7;
32246
+ */
32247
+ tenants = [];
32248
+ /**
32249
+ * @generated from field: int64 cache_size = 8;
32250
+ */
32251
+ cacheSize = proxy_exports.protoInt64.zero;
32252
+ /**
32253
+ * @generated from field: int64 cache_max_size = 9;
32254
+ */
32255
+ cacheMaxSize = proxy_exports.protoInt64.zero;
32256
+ /**
32257
+ * @generated from field: int32 cache_entries = 10;
32258
+ */
32259
+ cacheEntries = 0;
32260
+ /**
32261
+ * @generated from field: double cache_hit_rate = 11;
32262
+ */
32263
+ cacheHitRate = 0;
32264
+ /**
32265
+ * @generated from field: int64 cache_savings = 12;
32266
+ */
32267
+ cacheSavings = proxy_exports.protoInt64.zero;
32268
+ /**
32269
+ * @generated from field: string tenant_mode = 13;
32270
+ */
32271
+ tenantMode = "";
32272
+ /**
32273
+ * @generated from field: int32 max_open_tenants = 14;
32274
+ */
32275
+ maxOpenTenants = 0;
32276
+ /**
32277
+ * @generated from field: int32 current_open_tenants = 15;
32278
+ */
32279
+ currentOpenTenants = 0;
32280
+ constructor(data) {
32281
+ super();
32282
+ proxy_exports.proto3.util.initPartial(data, this);
32283
+ }
32284
+ static runtime = proxy_exports.proto3;
32285
+ static typeName = "libravdb.ipc.v1.DaemonStatusResponse";
32286
+ static fields = proxy_exports.proto3.util.newFieldList(() => [
32287
+ {
32288
+ no: 1,
32289
+ name: "ok",
32290
+ kind: "scalar",
32291
+ T: 8
32292
+ /* ScalarType.BOOL */
32293
+ },
32294
+ {
32295
+ no: 2,
32296
+ name: "version",
32297
+ kind: "scalar",
32298
+ T: 9
32299
+ /* ScalarType.STRING */
32300
+ },
32301
+ {
32302
+ no: 3,
32303
+ name: "uptime",
32304
+ kind: "scalar",
32305
+ T: 9
32306
+ /* ScalarType.STRING */
32307
+ },
32308
+ {
32309
+ no: 4,
32310
+ name: "backend",
32311
+ kind: "scalar",
32312
+ T: 9
32313
+ /* ScalarType.STRING */
32314
+ },
32315
+ {
32316
+ no: 5,
32317
+ name: "global_db_size",
32318
+ kind: "scalar",
32319
+ T: 3
32320
+ /* ScalarType.INT64 */
32321
+ },
32322
+ {
32323
+ no: 6,
32324
+ name: "global_db_healthy",
32325
+ kind: "scalar",
32326
+ T: 8
32327
+ /* ScalarType.BOOL */
32328
+ },
32329
+ { no: 7, name: "tenants", kind: "message", T: TenantStatus, repeated: true },
32330
+ {
32331
+ no: 8,
32332
+ name: "cache_size",
32333
+ kind: "scalar",
32334
+ T: 3
32335
+ /* ScalarType.INT64 */
32336
+ },
32337
+ {
32338
+ no: 9,
32339
+ name: "cache_max_size",
32340
+ kind: "scalar",
32341
+ T: 3
32342
+ /* ScalarType.INT64 */
32343
+ },
32344
+ {
32345
+ no: 10,
32346
+ name: "cache_entries",
32347
+ kind: "scalar",
32348
+ T: 5
32349
+ /* ScalarType.INT32 */
32350
+ },
32351
+ {
32352
+ no: 11,
32353
+ name: "cache_hit_rate",
32354
+ kind: "scalar",
32355
+ T: 1
32356
+ /* ScalarType.DOUBLE */
32357
+ },
32358
+ {
32359
+ no: 12,
32360
+ name: "cache_savings",
32361
+ kind: "scalar",
32362
+ T: 3
32363
+ /* ScalarType.INT64 */
32364
+ },
32365
+ {
32366
+ no: 13,
32367
+ name: "tenant_mode",
32368
+ kind: "scalar",
32369
+ T: 9
32370
+ /* ScalarType.STRING */
32371
+ },
32372
+ {
32373
+ no: 14,
32374
+ name: "max_open_tenants",
32375
+ kind: "scalar",
32376
+ T: 5
32377
+ /* ScalarType.INT32 */
32378
+ },
32379
+ {
32380
+ no: 15,
32381
+ name: "current_open_tenants",
32382
+ kind: "scalar",
32383
+ T: 5
32384
+ /* ScalarType.INT32 */
32385
+ }
32386
+ ]);
32387
+ static fromBinary(bytes, options) {
32388
+ return new _DaemonStatusResponse().fromBinary(bytes, options);
32389
+ }
32390
+ static fromJson(jsonValue, options) {
32391
+ return new _DaemonStatusResponse().fromJson(jsonValue, options);
32392
+ }
32393
+ static fromJsonString(jsonString, options) {
32394
+ return new _DaemonStatusResponse().fromJsonString(jsonString, options);
32395
+ }
32396
+ static equals(a, b) {
32397
+ return proxy_exports.proto3.util.equals(_DaemonStatusResponse, a, b);
32398
+ }
32399
+ };
32400
+ var EvictTenantRequest = class _EvictTenantRequest extends proxy_exports.Message {
32401
+ /**
32402
+ * @generated from field: string tenant_key = 1;
32403
+ */
32404
+ tenantKey = "";
32405
+ constructor(data) {
32406
+ super();
32407
+ proxy_exports.proto3.util.initPartial(data, this);
32408
+ }
32409
+ static runtime = proxy_exports.proto3;
32410
+ static typeName = "libravdb.ipc.v1.EvictTenantRequest";
32411
+ static fields = proxy_exports.proto3.util.newFieldList(() => [
32412
+ {
32413
+ no: 1,
32414
+ name: "tenant_key",
32415
+ kind: "scalar",
32416
+ T: 9
32417
+ /* ScalarType.STRING */
32418
+ }
32419
+ ]);
32420
+ static fromBinary(bytes, options) {
32421
+ return new _EvictTenantRequest().fromBinary(bytes, options);
32422
+ }
32423
+ static fromJson(jsonValue, options) {
32424
+ return new _EvictTenantRequest().fromJson(jsonValue, options);
32425
+ }
32426
+ static fromJsonString(jsonString, options) {
32427
+ return new _EvictTenantRequest().fromJsonString(jsonString, options);
32428
+ }
32429
+ static equals(a, b) {
32430
+ return proxy_exports.proto3.util.equals(_EvictTenantRequest, a, b);
32431
+ }
32432
+ };
32433
+ var EvictTenantResponse = class _EvictTenantResponse extends proxy_exports.Message {
32434
+ /**
32435
+ * @generated from field: bool ok = 1;
32436
+ */
32437
+ ok = false;
32438
+ /**
32439
+ * @generated from field: string message = 2;
32440
+ */
32441
+ message = "";
32442
+ constructor(data) {
32443
+ super();
32444
+ proxy_exports.proto3.util.initPartial(data, this);
32445
+ }
32446
+ static runtime = proxy_exports.proto3;
32447
+ static typeName = "libravdb.ipc.v1.EvictTenantResponse";
32448
+ static fields = proxy_exports.proto3.util.newFieldList(() => [
32449
+ {
32450
+ no: 1,
32451
+ name: "ok",
32452
+ kind: "scalar",
32453
+ T: 8
32454
+ /* ScalarType.BOOL */
32455
+ },
32456
+ {
32457
+ no: 2,
32458
+ name: "message",
32459
+ kind: "scalar",
32460
+ T: 9
32461
+ /* ScalarType.STRING */
32462
+ }
32463
+ ]);
32464
+ static fromBinary(bytes, options) {
32465
+ return new _EvictTenantResponse().fromBinary(bytes, options);
32466
+ }
32467
+ static fromJson(jsonValue, options) {
32468
+ return new _EvictTenantResponse().fromJson(jsonValue, options);
32469
+ }
32470
+ static fromJsonString(jsonString, options) {
32471
+ return new _EvictTenantResponse().fromJsonString(jsonString, options);
32472
+ }
32473
+ static equals(a, b) {
32474
+ return proxy_exports.proto3.util.equals(_EvictTenantResponse, a, b);
32475
+ }
32476
+ };
31842
32477
  var CognitiveMetricsResponse = class _CognitiveMetricsResponse extends proxy_exports.Message {
31843
32478
  /**
31844
32479
  * @generated from field: int64 total_nodes = 1;
@@ -33130,7 +33765,7 @@ var DirectoryMarkdownSourceAdapter = class {
33130
33765
  this.started = false;
33131
33766
  }
33132
33767
  getRootState(root) {
33133
- const resolved = path2.resolve(root);
33768
+ const resolved = path3.resolve(root);
33134
33769
  const existing = this.states.get(resolved);
33135
33770
  if (existing) {
33136
33771
  return existing;
@@ -33231,7 +33866,7 @@ var DirectoryMarkdownSourceAdapter = class {
33231
33866
  if (this.stopping) {
33232
33867
  return;
33233
33868
  }
33234
- const child = path2.join(dir, entry.name);
33869
+ const child = path3.join(dir, entry.name);
33235
33870
  if (entry.isDirectory()) {
33236
33871
  await this.walkDirectory(rootState, child, currentFiles, stats, candidates);
33237
33872
  continue;
@@ -33315,7 +33950,7 @@ var DirectoryMarkdownSourceAdapter = class {
33315
33950
  rootState.scanState.resumeFromPath = null;
33316
33951
  }
33317
33952
  shouldPruneDirectory(root, dir) {
33318
- const relative = toPosixPath(path2.relative(root, dir));
33953
+ const relative = toPosixPath(path3.relative(root, dir));
33319
33954
  if (!relative || relative === "." || relative.startsWith("..")) {
33320
33955
  return false;
33321
33956
  }
@@ -33353,7 +33988,7 @@ var DirectoryMarkdownSourceAdapter = class {
33353
33988
  if (isOpenClawMemoryFile(filePath)) {
33354
33989
  return true;
33355
33990
  }
33356
- const relative = toPosixPath(path2.relative(root, filePath));
33991
+ const relative = toPosixPath(path3.relative(root, filePath));
33357
33992
  if (this.excludePatterns.length > 0) {
33358
33993
  for (const pattern of this.excludePatterns) {
33359
33994
  if (matchesGlob(relative, pattern)) {
@@ -33390,7 +34025,7 @@ var DirectoryMarkdownSourceAdapter = class {
33390
34025
  }
33391
34026
  async syncMarkdownFile(rootState, filePath, initialStat) {
33392
34027
  const sourceDoc = filePath;
33393
- const relativePath = toPosixPath(path2.relative(rootState.root, filePath));
34028
+ const relativePath = toPosixPath(path3.relative(rootState.root, filePath));
33394
34029
  const stat = initialStat ?? await this.safeStatWithCtime(filePath);
33395
34030
  if (!stat) {
33396
34031
  await this.deleteSourceDocument(sourceDoc);
@@ -33628,9 +34263,9 @@ var DirectoryMarkdownSourceAdapter = class {
33628
34263
  if (parsed.ingestVersion !== MARKDOWN_INGEST_VERSION || parsed.hashBackend !== HASH_BACKEND || !parsed.files) {
33629
34264
  return;
33630
34265
  }
33631
- const configuredRoots = new Set(this.roots.map((root) => path2.resolve(root)));
34266
+ const configuredRoots = new Set(this.roots.map((root) => path3.resolve(root)));
33632
34267
  for (const [sourceDoc, state] of Object.entries(parsed.files)) {
33633
- if (isValidSnapshotState(sourceDoc, state) && configuredRoots.has(path2.resolve(state.root))) {
34268
+ if (isValidSnapshotState(sourceDoc, state) && configuredRoots.has(path3.resolve(state.root))) {
33634
34269
  this.fileStates.set(sourceDoc, state);
33635
34270
  }
33636
34271
  }
@@ -33650,7 +34285,7 @@ var DirectoryMarkdownSourceAdapter = class {
33650
34285
  files: Object.fromEntries([...this.fileStates.entries()].sort(([left], [right]) => left.localeCompare(right)))
33651
34286
  };
33652
34287
  try {
33653
- await fsp2.mkdir(path2.dirname(this.snapshotPath), { recursive: true });
34288
+ await fsp2.mkdir(path3.dirname(this.snapshotPath), { recursive: true });
33654
34289
  const tmp = `${this.snapshotPath}.${process.pid}.${Math.random().toString(36).slice(2, 8)}.tmp`;
33655
34290
  await fsp2.writeFile(tmp, `${JSON.stringify(payload, null, 2)}
33656
34291
  `);
@@ -33709,7 +34344,7 @@ function recordSyncResult(stats, result) {
33709
34344
  }
33710
34345
  }
33711
34346
  function toPosixPath(value) {
33712
- return value.split(path2.sep).join("/");
34347
+ return value.split(path3.sep).join("/");
33713
34348
  }
33714
34349
  function normalizeMarkdownRoots(roots) {
33715
34350
  if (!roots?.length) {
@@ -33721,7 +34356,7 @@ function normalizeMarkdownRoots(roots) {
33721
34356
  if (!trimmed) {
33722
34357
  continue;
33723
34358
  }
33724
- resolved.add(path2.resolve(trimmed));
34359
+ resolved.add(path3.resolve(trimmed));
33725
34360
  }
33726
34361
  return [...resolved];
33727
34362
  }
@@ -33737,10 +34372,10 @@ function updateFnv1a64(seed, bytes) {
33737
34372
  function resolveMarkdownSnapshotPath(kind, configuredPath) {
33738
34373
  const trimmed = configuredPath?.trim();
33739
34374
  if (trimmed) {
33740
- return path2.resolve(trimmed);
34375
+ return path3.resolve(trimmed);
33741
34376
  }
33742
- const stateDir = process.env.OPENCLAW_STATE_DIR?.trim() || path2.join(os2.homedir(), ".openclaw");
33743
- return path2.join(stateDir, `libravdb-markdown-ingest-${kind}.json`);
34377
+ const stateDir = process.env.OPENCLAW_STATE_DIR?.trim() || path3.join(os3.homedir(), ".openclaw");
34378
+ return path3.join(stateDir, `libravdb-markdown-ingest-${kind}.json`);
33744
34379
  }
33745
34380
  function isMarkdownIngestionEnabled(cfg, roots) {
33746
34381
  return cfg.markdownIngestionEnabled === true && roots.length > 0;
@@ -33753,7 +34388,7 @@ function createRealFsApi2() {
33753
34388
  const s = await fsp2.stat(file);
33754
34389
  return { size: s.size, mtimeMs: s.mtimeMs, ctimeMs: s.ctimeMs };
33755
34390
  },
33756
- watch: (dir, onChange) => fs2.watch(dir, onChange),
34391
+ watch: (dir, onChange) => fs3.watch(dir, onChange),
33757
34392
  openReadStream: async (file) => {
33758
34393
  const handle = await fsp2.open(file, "r");
33759
34394
  return {
@@ -33921,7 +34556,7 @@ function hasInlineObsidianTag(text) {
33921
34556
  return false;
33922
34557
  }
33923
34558
  function isOpenClawMemoryFile(filePath) {
33924
- return path2.basename(filePath).toLowerCase() === "memory.md";
34559
+ return path3.basename(filePath).toLowerCase() === "memory.md";
33925
34560
  }
33926
34561
 
33927
34562
  // src/memory-provider.ts
@@ -35731,11 +36366,11 @@ var Http2SessionManager = class {
35731
36366
  * Clients must call notifyResponseByteRead() whenever they successfully read
35732
36367
  * data from the http2.ClientHttp2Stream.
35733
36368
  */
35734
- async request(method, path5, headers, options) {
36369
+ async request(method, path6, headers, options) {
35735
36370
  for (; ; ) {
35736
36371
  const ready2 = await this.gotoReady();
35737
36372
  try {
35738
- const stream = ready2.conn.request(Object.assign(Object.assign({}, headers), { ":method": method, ":path": path5 }), options);
36373
+ const stream = ready2.conn.request(Object.assign(Object.assign({}, headers), { ":method": method, ":path": path6 }), options);
35739
36374
  ready2.registerRequest(stream);
35740
36375
  return stream;
35741
36376
  } catch (e) {
@@ -36373,7 +37008,7 @@ function createGrpcTransport(options) {
36373
37008
  return createTransport(validateNodeTransportOptions(options));
36374
37009
  }
36375
37010
 
36376
- // node_modules/.pnpm/@xdarkicex+libravdb-contracts@2.0.8/node_modules/@xdarkicex/libravdb-contracts/gen/js/libravdb/ipc/v1/rpc_connect.js
37011
+ // node_modules/.pnpm/@xdarkicex+libravdb-contracts@2.0.12/node_modules/@xdarkicex/libravdb-contracts/gen/js/libravdb/ipc/v1/rpc_connect.js
36377
37012
  var LibravDB = {
36378
37013
  typeName: "libravdb.ipc.v1.LibravDB",
36379
37014
  methods: {
@@ -36397,6 +37032,24 @@ var LibravDB = {
36397
37032
  O: MemoryStatusResponse,
36398
37033
  kind: proxy_exports.MethodKind.Unary
36399
37034
  },
37035
+ /**
37036
+ * @generated from rpc libravdb.ipc.v1.LibravDB.DaemonStatus
37037
+ */
37038
+ daemonStatus: {
37039
+ name: "DaemonStatus",
37040
+ I: DaemonStatusRequest,
37041
+ O: DaemonStatusResponse,
37042
+ kind: proxy_exports.MethodKind.Unary
37043
+ },
37044
+ /**
37045
+ * @generated from rpc libravdb.ipc.v1.LibravDB.EvictTenant
37046
+ */
37047
+ evictTenant: {
37048
+ name: "EvictTenant",
37049
+ I: EvictTenantRequest,
37050
+ O: EvictTenantResponse,
37051
+ kind: proxy_exports.MethodKind.Unary
37052
+ },
36400
37053
  /**
36401
37054
  * @generated from rpc libravdb.ipc.v1.LibravDB.Flush
36402
37055
  */
@@ -36705,25 +37358,27 @@ var LibravDB = {
36705
37358
 
36706
37359
  // src/libravdb-client.ts
36707
37360
  import { createHmac } from "node:crypto";
36708
- import fs3 from "node:fs";
37361
+ import fs4 from "node:fs";
36709
37362
  import net from "node:net";
36710
- import os3 from "node:os";
36711
- import path3 from "node:path";
37363
+ import os4 from "node:os";
37364
+ import path4 from "node:path";
36712
37365
  function resolveClientEndpoint(configuredEndpoint) {
36713
37366
  if (configuredEndpoint && configuredEndpoint !== "auto") return configuredEndpoint;
36714
37367
  if (process.env.LIBRAVDB_GRPC_ENDPOINT) return process.env.LIBRAVDB_GRPC_ENDPOINT;
36715
37368
  if (process.platform === "win32") return "tcp:127.0.0.1:37421";
36716
37369
  const sockName = "libravdb.sock";
36717
37370
  const candidateDirs = [
36718
- path3.join(os3.homedir(), ".libravdbd", "run"),
37371
+ path4.join(os4.homedir(), ".libravdbd", "run"),
36719
37372
  "/opt/homebrew/var/libravdbd/run",
36720
- "/usr/local/var/libravdbd/run"
37373
+ "/usr/local/var/libravdbd/run",
37374
+ "/var/run/libravdbd",
37375
+ "/run/libravdbd"
36721
37376
  ];
36722
37377
  for (const dir of candidateDirs) {
36723
- const fullPath = path3.join(dir, sockName);
36724
- if (fs3.existsSync(fullPath)) return `unix:${fullPath}`;
37378
+ const fullPath = path4.join(dir, sockName);
37379
+ if (fs4.existsSync(fullPath)) return `unix:${fullPath}`;
36725
37380
  }
36726
- return `unix:${path3.join(os3.homedir(), ".libravdbd", "run", sockName)}`;
37381
+ return `unix:${path4.join(os4.homedir(), ".libravdbd", "run", sockName)}`;
36727
37382
  }
36728
37383
  function isLegacyJsonRpcHealthResponse(payload) {
36729
37384
  try {
@@ -36850,11 +37505,11 @@ var LibravDBClient = class {
36850
37505
  let clientKey = null;
36851
37506
  let clientCert = null;
36852
37507
  if (!isInsecure && options.tlsCaPath) {
36853
- rootCerts = fs3.readFileSync(options.tlsCaPath);
37508
+ rootCerts = fs4.readFileSync(options.tlsCaPath);
36854
37509
  }
36855
37510
  if (options.tlsClientCertPath && options.tlsClientKeyPath) {
36856
- clientCert = fs3.readFileSync(options.tlsClientCertPath);
36857
- clientKey = fs3.readFileSync(options.tlsClientKeyPath);
37511
+ clientCert = fs4.readFileSync(options.tlsClientCertPath);
37512
+ clientKey = fs4.readFileSync(options.tlsClientKeyPath);
36858
37513
  }
36859
37514
  const rpcMutex = createRpcMutex();
36860
37515
  const self = this;
@@ -36869,6 +37524,15 @@ var LibravDBClient = class {
36869
37524
  bootstrap: () => self.bootstrapHandshake(),
36870
37525
  rpcMutex
36871
37526
  });
37527
+ const interceptors = [];
37528
+ if (options.tenantKey) {
37529
+ const tenantKey = options.tenantKey;
37530
+ interceptors.push((next) => async (req) => {
37531
+ req.header.set("libravdb-tenant-key", tenantKey);
37532
+ return next(req);
37533
+ });
37534
+ }
37535
+ interceptors.push(authInterceptor);
36872
37536
  const transport = createGrpcTransport({
36873
37537
  baseUrl: targetUrl,
36874
37538
  httpVersion: "2",
@@ -36879,7 +37543,7 @@ var LibravDBClient = class {
36879
37543
  ...isInsecure ? { rejectUnauthorized: false } : {}
36880
37544
  },
36881
37545
  defaultTimeoutMs: options.timeoutMs ?? 3e4,
36882
- interceptors: [authInterceptor]
37546
+ interceptors
36883
37547
  });
36884
37548
  this.client = createPromiseClient(LibravDB, transport);
36885
37549
  }
@@ -37034,7 +37698,7 @@ function loadSecretFromEnv(logger) {
37034
37698
  const secretPath = process.env.LIBRAVDB_AUTH_SECRET_FILE;
37035
37699
  if (secretPath) {
37036
37700
  try {
37037
- return fs3.readFileSync(secretPath, "utf8").trim() || void 0;
37701
+ return fs4.readFileSync(secretPath, "utf8").trim() || void 0;
37038
37702
  } catch (error2) {
37039
37703
  logger?.warn?.(`LibraVDB: failed to read auth secret file "${secretPath}": ${formatError(error2)}`);
37040
37704
  return void 0;
@@ -37044,9 +37708,13 @@ function loadSecretFromEnv(logger) {
37044
37708
  }
37045
37709
 
37046
37710
  // src/plugin-runtime.ts
37047
- import { existsSync as existsSync2, statSync } from "node:fs";
37048
- import path4 from "node:path";
37049
- var DEFAULT_RPC_TIMEOUT_MS = 3e4;
37711
+ import { existsSync as existsSync3, statSync } from "node:fs";
37712
+ import path5 from "node:path";
37713
+ var DEFAULT_RPC_TIMEOUT_MS = 12e4;
37714
+ var ENV_RPC_TIMEOUT_MS = (() => {
37715
+ const raw = Number(process.env.LIBRAVDB_RPC_TIMEOUT_MS);
37716
+ return Number.isFinite(raw) && raw > 0 ? raw : 0;
37717
+ })();
37050
37718
  var VALID_TLS_MODES = ["auto", "tls", "insecure"];
37051
37719
  var isTlsModeValid = (m) => VALID_TLS_MODES.includes(m);
37052
37720
  function daemonProvisioningHint() {
@@ -37071,7 +37739,7 @@ function validateEmbeddingConfig(cfg) {
37071
37739
  `LibraVDB: embeddingRuntimePath must point to a readable ONNX Runtime library: ${runtimePath}`
37072
37740
  );
37073
37741
  }
37074
- if (!pathExistsAsDirectory(modelPath) || !pathExistsAsFile(path4.join(modelPath, "embedding.json"))) {
37742
+ if (!pathExistsAsDirectory(modelPath) || !pathExistsAsFile(path5.join(modelPath, "embedding.json"))) {
37075
37743
  throw new Error(
37076
37744
  `LibraVDB: embeddingModelPath must point to a directory containing embedding.json: ${modelPath}`
37077
37745
  );
@@ -37093,11 +37761,12 @@ function createPluginRuntime(cfg, logger = console) {
37093
37761
  validateTlsConfig(cfg, logger);
37094
37762
  client = new LibravDBClient({
37095
37763
  endpoint: cfg.grpcEndpoint || cfg.sidecarPath,
37096
- timeoutMs: cfg.rpcTimeoutMs ?? DEFAULT_RPC_TIMEOUT_MS,
37764
+ timeoutMs: cfg.rpcTimeoutMs ?? (ENV_RPC_TIMEOUT_MS || DEFAULT_RPC_TIMEOUT_MS),
37097
37765
  tlsCaPath: cfg.grpcEndpointTlsCa,
37098
37766
  tlsMode: cfg.grpcEndpointTlsMode,
37099
37767
  tlsClientCertPath: cfg.grpcEndpointTlsClientCert,
37100
- tlsClientKeyPath: cfg.grpcEndpointTlsClientKey
37768
+ tlsClientKeyPath: cfg.grpcEndpointTlsClientKey,
37769
+ tenantKey: resolveTenantKey(cfg)
37101
37770
  });
37102
37771
  await client.bootstrapHandshake();
37103
37772
  return client;
@@ -37173,14 +37842,14 @@ function shouldValidateLocalEmbeddingPaths(cfg) {
37173
37842
  }
37174
37843
  function pathExistsAsFile(filePath) {
37175
37844
  try {
37176
- return existsSync2(filePath) && statSync(filePath).isFile();
37845
+ return existsSync3(filePath) && statSync(filePath).isFile();
37177
37846
  } catch {
37178
37847
  return false;
37179
37848
  }
37180
37849
  }
37181
37850
  function pathExistsAsDirectory(dirPath) {
37182
37851
  try {
37183
- return existsSync2(dirPath) && statSync(dirPath).isDirectory();
37852
+ return existsSync3(dirPath) && statSync(dirPath).isDirectory();
37184
37853
  } catch {
37185
37854
  return false;
37186
37855
  }