@joshuaswarren/openclaw-engram 9.2.3 → 9.2.4

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.
@@ -3,7 +3,7 @@ import {
3
3
  EngramAccessService,
4
4
  Orchestrator,
5
5
  parseConfig
6
- } from "./chunk-RITRBWEK.js";
6
+ } from "./chunk-JH4LLA7O.js";
7
7
  import "./chunk-YZG2OWZQ.js";
8
8
  import "./chunk-IMMYYNXG.js";
9
9
  import "./chunk-TUH5NNZ2.js";
@@ -32431,6 +32431,111 @@ var EngramAccessService = class {
32431
32431
  lcmEnabled: true
32432
32432
  };
32433
32433
  }
32434
+ // ── Parity tools (match OpenClaw plugin feature set) ──────────────────
32435
+ async memorySearch(request) {
32436
+ const { query, namespace, maxResults, collection, principal } = request;
32437
+ const resolvedNs = this.resolveReadableNamespace(namespace, principal);
32438
+ const namespaceFilter = resolvedNs !== this.orchestrator.config.defaultNamespace ? resolvedNs : void 0;
32439
+ const results = collection === "global" ? (await this.orchestrator.qmd.searchGlobal(query, maxResults)).filter(
32440
+ (r) => namespaceFilter ? r.path.includes(`/namespaces/${namespaceFilter}/`) || !r.path.includes("/namespaces/") && namespaceFilter === this.orchestrator.config.defaultNamespace : true
32441
+ ) : await this.orchestrator.searchAcrossNamespaces({
32442
+ query,
32443
+ namespaces: namespaceFilter ? [namespaceFilter] : void 0,
32444
+ maxResults,
32445
+ mode: "search"
32446
+ });
32447
+ return {
32448
+ query,
32449
+ results: results.map((r) => ({
32450
+ path: r.path,
32451
+ score: r.score,
32452
+ snippet: (r.snippet ?? "").slice(0, 800)
32453
+ })),
32454
+ count: results.length
32455
+ };
32456
+ }
32457
+ async memoryProfile(namespace, principal) {
32458
+ const resolvedNs = this.resolveReadableNamespace(namespace, principal);
32459
+ const storage = await this.orchestrator.getStorage(resolvedNs);
32460
+ const profile = await storage.readProfile();
32461
+ return {
32462
+ profile: profile || "No profile built yet. The profile builds automatically through conversations."
32463
+ };
32464
+ }
32465
+ async memoryEntitiesList(namespace, principal) {
32466
+ const resolvedNs = this.resolveReadableNamespace(namespace, principal);
32467
+ const storage = await this.orchestrator.getStorage(resolvedNs);
32468
+ const entities = await storage.readEntities();
32469
+ return { entities, count: entities.length };
32470
+ }
32471
+ async memoryQuestions(namespace, principal) {
32472
+ const resolvedNs = this.resolveReadableNamespace(namespace, principal);
32473
+ const storage = await this.orchestrator.getStorage(resolvedNs);
32474
+ const questions = await storage.readQuestions();
32475
+ return {
32476
+ questions: questions.map((q) => ({ id: q.id, question: q.question, resolved: q.resolved })),
32477
+ count: questions.length
32478
+ };
32479
+ }
32480
+ async lastRecallSnapshot(sessionKey) {
32481
+ const snapshot = sessionKey ? this.orchestrator.lastRecall.get(sessionKey) : this.orchestrator.lastRecall.getMostRecent();
32482
+ return snapshot ?? { message: "No recall snapshot available" };
32483
+ }
32484
+ async intentDebug(namespace) {
32485
+ const snapshot = await this.orchestrator.getLastIntentSnapshot(namespace);
32486
+ return snapshot ?? { message: "No intent debug snapshot available" };
32487
+ }
32488
+ async qmdDebug(namespace) {
32489
+ const snapshot = await this.orchestrator.getLastQmdRecallSnapshot(namespace);
32490
+ return snapshot ?? { message: "No QMD debug snapshot available" };
32491
+ }
32492
+ async graphExplainLastRecall(namespace) {
32493
+ const explanation = await this.orchestrator.explainLastGraphRecall({ namespace });
32494
+ return { explanation };
32495
+ }
32496
+ async memoryFeedback(request) {
32497
+ if (!this.orchestrator.config.feedbackEnabled) {
32498
+ return {
32499
+ recorded: false,
32500
+ enabled: false,
32501
+ reason: "Feedback is disabled. Enable `feedbackEnabled: true` in the Engram config to store feedback."
32502
+ };
32503
+ }
32504
+ await this.orchestrator.recordMemoryFeedback(
32505
+ request.memoryId,
32506
+ request.vote,
32507
+ request.note
32508
+ );
32509
+ return { recorded: true };
32510
+ }
32511
+ async memoryPromote(request) {
32512
+ const resolvedNs = this.resolveWritableNamespace(request.namespace, request.sessionKey, request.principal);
32513
+ const storage = await this.orchestrator.getStorage(resolvedNs);
32514
+ await storage.updateMemoryFrontmatter(request.memoryId, {
32515
+ lifecycleState: "active",
32516
+ updated: (/* @__PURE__ */ new Date()).toISOString()
32517
+ });
32518
+ return { promoted: true, memoryId: request.memoryId };
32519
+ }
32520
+ async contextCheckpoint(request) {
32521
+ const resolvedNs = this.resolveWritableNamespace(request.namespace, request.sessionKey, request.principal);
32522
+ const storage = await this.orchestrator.getStorage(resolvedNs);
32523
+ const storageDir = storage.dir;
32524
+ const { writeFile: writeFile31, mkdir: mkdir32 } = await import("fs/promises");
32525
+ const { join: join5, resolve } = await import("path");
32526
+ const safeKey = request.sessionKey.replace(/[^a-zA-Z0-9_-]/g, "_");
32527
+ if (!safeKey) throw new EngramAccessInputError("sessionKey is required");
32528
+ const checkpointDir = join5(storageDir, "checkpoints", safeKey);
32529
+ const resolved = resolve(checkpointDir);
32530
+ if (!resolved.startsWith(resolve(storageDir))) {
32531
+ throw new EngramAccessInputError("Invalid sessionKey");
32532
+ }
32533
+ await mkdir32(checkpointDir, { recursive: true });
32534
+ const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
32535
+ const filePath = join5(checkpointDir, `checkpoint-${ts}.md`);
32536
+ await writeFile31(filePath, request.context, "utf-8");
32537
+ return { saved: true };
32538
+ }
32434
32539
  async lcmStatus() {
32435
32540
  if (!this.orchestrator.lcmEngine || !this.orchestrator.lcmEngine.enabled) {
32436
32541
  return {
@@ -32535,4 +32640,4 @@ export {
32535
32640
  EngramAccessInputError,
32536
32641
  EngramAccessService
32537
32642
  };
32538
- //# sourceMappingURL=chunk-RITRBWEK.js.map
32643
+ //# sourceMappingURL=chunk-JH4LLA7O.js.map