@remnic/plugin-openclaw 1.0.54 → 9.3.515

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.
Files changed (84) hide show
  1. package/dist/index.js +510 -2106
  2. package/openclaw.plugin.json +3 -3
  3. package/package.json +4 -3
  4. package/scripts/faiss_index.py +141 -29
  5. package/dist/calibration-RKL2LRW4.js +0 -250
  6. package/dist/capsule-cli-EHZPMXBC.js +0 -33
  7. package/dist/capsule-crypto-JS67OSWM.js +0 -17
  8. package/dist/capsule-export-DX53CPIT.js +0 -17
  9. package/dist/capsule-import-4OXCPHOT.js +0 -16
  10. package/dist/capsule-merge-25AUN33Q.js +0 -195
  11. package/dist/causal-chain-BVTOWZKC.js +0 -23
  12. package/dist/causal-consolidation-IAIX53NV.js +0 -233
  13. package/dist/causal-retrieval-XAP6QKHZ.js +0 -182
  14. package/dist/causal-trajectory-graph-ZWQWZ7N5.js +0 -59
  15. package/dist/chunk-25J4PXDH.js +0 -30
  16. package/dist/chunk-2RQU6GVD.js +0 -453
  17. package/dist/chunk-3A5ELHTT.js +0 -61
  18. package/dist/chunk-3G7FAF6S.js +0 -60
  19. package/dist/chunk-3IKMUNW5.js +0 -177
  20. package/dist/chunk-4XDQ3KEC.js +0 -4048
  21. package/dist/chunk-5ZW5XJQ6.js +0 -128
  22. package/dist/chunk-6IWEAUN6.js +0 -148
  23. package/dist/chunk-7JOLBJJ5.js +0 -874
  24. package/dist/chunk-AJECKGY2.js +0 -896
  25. package/dist/chunk-B52XADV3.js +0 -244
  26. package/dist/chunk-BQZ7JACP.js +0 -389
  27. package/dist/chunk-BU5KJVWF.js +0 -78
  28. package/dist/chunk-BZ4EYURA.js +0 -181
  29. package/dist/chunk-CEL5ZLKP.js +0 -233
  30. package/dist/chunk-EH4AXGRO.js +0 -48
  31. package/dist/chunk-FDK3VJVE.js +0 -1295
  32. package/dist/chunk-I2KLQ2HA.js +0 -22
  33. package/dist/chunk-IO5WWY6A.js +0 -156
  34. package/dist/chunk-JC3FCKYL.js +0 -516
  35. package/dist/chunk-JZBOXOUC.js +0 -259
  36. package/dist/chunk-KC7KSQR4.js +0 -302
  37. package/dist/chunk-LZCGPRHS.js +0 -228
  38. package/dist/chunk-MBIFE6SA.js +0 -250
  39. package/dist/chunk-MXFJXUHC.js +0 -292
  40. package/dist/chunk-NUWDSTP7.js +0 -233
  41. package/dist/chunk-QCCP4RU5.js +0 -190
  42. package/dist/chunk-QMUQV5NP.js +0 -146
  43. package/dist/chunk-QQXJODFL.js +0 -328
  44. package/dist/chunk-SWOYEQN2.js +0 -1005
  45. package/dist/chunk-TH5FF5SC.js +0 -16
  46. package/dist/chunk-TXOEHSVP.js +0 -275
  47. package/dist/chunk-UFU5GGGA.js +0 -47
  48. package/dist/chunk-USSDZQKJ.js +0 -6533
  49. package/dist/chunk-UZJ7EERS.js +0 -272
  50. package/dist/chunk-VUZEEGP5.js +0 -725
  51. package/dist/chunk-W6EEFUCJ.js +0 -349
  52. package/dist/chunk-YGGGUTG3.js +0 -125
  53. package/dist/chunk-YJYZMLD5.js +0 -360
  54. package/dist/chunk-YKV4EFUI.js +0 -199
  55. package/dist/chunk-ZS6VABML.js +0 -185
  56. package/dist/cipher-E23BHBSO.js +0 -27
  57. package/dist/consolidation-undo-FKJZCJHS.js +0 -426
  58. package/dist/contradiction-review-WJRWNQ5N.js +0 -29
  59. package/dist/contradiction-scan-5X423QGT.js +0 -12
  60. package/dist/dreams-ledger-KDX44I7R.js +0 -290
  61. package/dist/engine-O46ZX4EZ.js +0 -16
  62. package/dist/extraction-judge-telemetry-O4ZVGLTU.js +0 -14
  63. package/dist/fallback-llm-43UMEXNJ.js +0 -10
  64. package/dist/first-start-migration-H2SAXAGR.js +0 -263
  65. package/dist/forget-ZECIDNL5.js +0 -68
  66. package/dist/fs-utils-OYXSZSVV.js +0 -39
  67. package/dist/graph-edge-decay-24ZKD5QL.js +0 -202
  68. package/dist/kdf-RXKIWHRU.js +0 -25
  69. package/dist/logger-XG7JKLPS.js +0 -9
  70. package/dist/memory-governance-6BCH6SZ5.js +0 -25
  71. package/dist/metadata-WK2TRPYZ.js +0 -20
  72. package/dist/migrate-from-identity-anchor-SNDNKHZD.js +0 -7
  73. package/dist/path-ZKO74XXC.js +0 -7
  74. package/dist/peers-W53WSDXG.js +0 -43
  75. package/dist/purge-IKJISXEQ.js +0 -204
  76. package/dist/resolution-BN35OXDS.js +0 -11
  77. package/dist/secure-store-6RWYM6GK.js +0 -155
  78. package/dist/state-4ITLYMAU.js +0 -7
  79. package/dist/state-store-ET3ADVY5.js +0 -14
  80. package/dist/storage-VEGU76NN.js +0 -27
  81. package/dist/tier-stats-ZRQBV6G2.js +0 -147
  82. package/dist/trace-IL2Y34EH.js +0 -289
  83. package/dist/tui-7KRDCMYK.js +0 -12
  84. package/dist/types-MBUINTB2.js +0 -30
package/dist/index.js CHANGED
@@ -1,54 +1,20 @@
1
- import "./chunk-UZJ7EERS.js";
2
- import "./chunk-CEL5ZLKP.js";
3
- import {
4
- isValidCapsuleSince
5
- } from "./chunk-TXOEHSVP.js";
6
- import {
7
- validateArchiveRelativePath
8
- } from "./chunk-YKV4EFUI.js";
9
- import {
10
- CAPSULE_ID_PATTERN
11
- } from "./chunk-QCCP4RU5.js";
12
- import "./chunk-ZS6VABML.js";
13
- import "./chunk-QQXJODFL.js";
14
- import "./chunk-BU5KJVWF.js";
15
- import "./chunk-LZCGPRHS.js";
16
- import "./chunk-VUZEEGP5.js";
17
- import "./chunk-BZ4EYURA.js";
18
- import "./chunk-W6EEFUCJ.js";
19
- import "./chunk-7JOLBJJ5.js";
20
- import "./chunk-JC3FCKYL.js";
21
- import "./chunk-YJYZMLD5.js";
22
- import "./chunk-IO5WWY6A.js";
23
- import "./chunk-AJECKGY2.js";
24
- import "./chunk-TH5FF5SC.js";
25
- import "./chunk-3IKMUNW5.js";
26
- import "./chunk-3G7FAF6S.js";
27
- import "./chunk-25J4PXDH.js";
28
- import "./chunk-FDK3VJVE.js";
29
- import {
30
- external_exports
31
- } from "./chunk-4XDQ3KEC.js";
32
- import "./chunk-2RQU6GVD.js";
33
- import "./chunk-MXFJXUHC.js";
34
- import "./chunk-JZBOXOUC.js";
35
- import "./chunk-6IWEAUN6.js";
36
- import "./chunk-SWOYEQN2.js";
37
- import "./chunk-3A5ELHTT.js";
38
- import "./chunk-5ZW5XJQ6.js";
39
- import "./chunk-USSDZQKJ.js";
40
- import "./chunk-QMUQV5NP.js";
41
- import "./chunk-BQZ7JACP.js";
42
- import "./chunk-UFU5GGGA.js";
43
- import "./chunk-YGGGUTG3.js";
44
- import "./chunk-NUWDSTP7.js";
45
- import {
46
- resolveHomeDir
47
- } from "./chunk-EH4AXGRO.js";
48
- import {
49
- __export,
50
- __reExport
51
- } from "./chunk-I2KLQ2HA.js";
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
52
18
 
53
19
  // ../../src/day-summary.ts
54
20
  var day_summary_exports = {};
@@ -56,8 +22,8 @@ __reExport(day_summary_exports, day_summary_star);
56
22
  import * as day_summary_star from "@remnic/core/day-summary";
57
23
 
58
24
  // ../../src/index.ts
59
- import OpenAI2 from "openai";
60
- import { createRequire as createRequire3 } from "module";
25
+ import OpenAI from "openai";
26
+ import { createRequire } from "module";
61
27
 
62
28
  // ../../src/config.ts
63
29
  var config_exports = {};
@@ -74,10 +40,8 @@ var sdk_compat_exports = {};
74
40
  __reExport(sdk_compat_exports, sdk_compat_star);
75
41
  import * as sdk_compat_star from "@remnic/core/sdk-compat";
76
42
 
77
- // ../../src/orchestrator.ts
78
- var orchestrator_exports = {};
79
- __reExport(orchestrator_exports, orchestrator_star);
80
- import * as orchestrator_star from "@remnic/core/orchestrator";
43
+ // ../../src/index.ts
44
+ import { Orchestrator, sanitizeSessionKeyForFilename, defaultWorkspaceDir } from "@remnic/core/orchestrator";
81
45
 
82
46
  // ../../src/tools.ts
83
47
  import { createHash } from "crypto";
@@ -2698,41 +2662,27 @@ var explicit_capture_exports = {};
2698
2662
  __reExport(explicit_capture_exports, explicit_capture_star);
2699
2663
  import * as explicit_capture_star from "@remnic/core/explicit-capture";
2700
2664
 
2701
- // ../../src/work/storage.ts
2702
- var storage_exports = {};
2703
- __reExport(storage_exports, storage_star);
2704
- import * as storage_star from "@remnic/core/work/storage";
2705
-
2706
- // ../../src/work/board.ts
2707
- var board_exports = {};
2708
- __reExport(board_exports, board_star);
2709
- import * as board_star from "@remnic/core/work/board";
2710
-
2711
- // ../../src/work/boundary.ts
2712
- var boundary_exports = {};
2713
- __reExport(boundary_exports, boundary_star);
2714
- import * as boundary_star from "@remnic/core/work/boundary";
2665
+ // ../../src/tools.ts
2666
+ import { WorkStorage } from "@remnic/core/work/storage";
2667
+ import { exportWorkBoardMarkdown, exportWorkBoardSnapshot, importWorkBoardSnapshot } from "@remnic/core/work/board";
2668
+ import { wrapWorkLayerContext } from "@remnic/core/work/boundary";
2715
2669
 
2716
2670
  // ../../src/profiling.ts
2717
2671
  var profiling_exports = {};
2718
2672
  __reExport(profiling_exports, profiling_star);
2719
2673
  import * as profiling_star from "@remnic/core/profiling";
2720
2674
 
2721
- // ../../src/maintenance/memory-governance.ts
2722
- var memory_governance_exports = {};
2723
- __reExport(memory_governance_exports, memory_governance_star);
2724
- import * as memory_governance_star from "@remnic/core/maintenance/memory-governance";
2725
-
2726
2675
  // ../../src/tools.ts
2676
+ import { runMemoryGovernance } from "@remnic/core/maintenance/memory-governance";
2727
2677
  function toolResult(text) {
2728
2678
  return { content: [{ type: "text", text }], details: void 0 };
2729
2679
  }
2730
2680
  function toolJsonResult(value, options) {
2731
2681
  const payload = JSON.stringify(value, null, 2);
2732
- return toolResult((0, boundary_exports.wrapWorkLayerContext)(payload, { linkToMemory: options?.linkToMemory === true }));
2682
+ return toolResult(wrapWorkLayerContext(payload, { linkToMemory: options?.linkToMemory === true }));
2733
2683
  }
2734
2684
  function workLayerTextResult(text, options) {
2735
- return toolResult((0, boundary_exports.wrapWorkLayerContext)(text, { linkToMemory: options?.linkToMemory === true }));
2685
+ return toolResult(wrapWorkLayerContext(text, { linkToMemory: options?.linkToMemory === true }));
2736
2686
  }
2737
2687
  function asNonEmptyString(value) {
2738
2688
  if (typeof value !== "string") return void 0;
@@ -2748,6 +2698,20 @@ function clampUnitInterval(value, fallback) {
2748
2698
  if (value > 1) return 1;
2749
2699
  return value;
2750
2700
  }
2701
+ function normalizeProfilingReportLimit(value) {
2702
+ if (value === void 0) return 5;
2703
+ if (typeof value !== "number" || !Number.isFinite(value) || !Number.isInteger(value)) {
2704
+ return 5;
2705
+ }
2706
+ return Math.min(Math.max(value, 1), 20);
2707
+ }
2708
+ function normalizeMemorySearchResultLimit(value) {
2709
+ if (value === void 0) return 8;
2710
+ if (typeof value !== "number" || !Number.isFinite(value) || !Number.isInteger(value)) {
2711
+ return 8;
2712
+ }
2713
+ return Math.min(Math.max(value, 1), 50);
2714
+ }
2751
2715
  function normalizeMemoryActionEligibilitySource(value) {
2752
2716
  switch (value) {
2753
2717
  case "extraction":
@@ -2793,15 +2757,15 @@ function asTaskStatus(value) {
2793
2757
  if (!normalized || !WORK_TASK_STATUSES.has(normalized)) return void 0;
2794
2758
  return normalized;
2795
2759
  }
2796
- function asTaskPriority(value) {
2797
- const normalized = asNonEmptyString(value);
2798
- if (!normalized || !WORK_TASK_PRIORITIES.has(normalized)) return void 0;
2799
- return normalized;
2800
- }
2801
- function asProjectStatus(value) {
2802
- const normalized = asNonEmptyString(value);
2803
- if (!normalized || !WORK_PROJECT_STATUSES.has(normalized)) return void 0;
2804
- return normalized;
2760
+ function parseEnumParam(params, key, allowed) {
2761
+ if (!Object.prototype.hasOwnProperty.call(params, key) || params[key] === void 0) {
2762
+ return { ok: true, value: void 0 };
2763
+ }
2764
+ const normalized = asNonEmptyString(params[key]);
2765
+ if (!normalized || !allowed.has(normalized)) {
2766
+ return { ok: false, message: `invalid \`${key}\`: expected one of ${[...allowed].join(", ")}.` };
2767
+ }
2768
+ return { ok: true, value: normalized };
2805
2769
  }
2806
2770
  function asNullablePatchString(params, key) {
2807
2771
  if (!Object.prototype.hasOwnProperty.call(params, key)) return void 0;
@@ -3055,12 +3019,11 @@ Best for:
3055
3019
  async execute(_toolCallId, params) {
3056
3020
  const { query, maxResults, collection, namespace } = params;
3057
3021
  const namespaceFilter = namespace && namespace.length > 0 ? namespace : void 0;
3058
- const filtered = collection === "global" ? (await orchestrator.qmd.searchGlobal(query, maxResults)).filter(
3059
- (result) => namespaceFilter ? result.path.includes(`/namespaces/${namespaceFilter}/`) || !result.path.includes("/namespaces/") && namespaceFilter === orchestrator.config.defaultNamespace : true
3060
- ) : await orchestrator.searchAcrossNamespaces({
3022
+ const resultLimit = normalizeMemorySearchResultLimit(maxResults);
3023
+ const filtered = collection === "global" && !namespaceFilter ? (await orchestrator.qmd.searchGlobal(query, resultLimit)).slice(0, resultLimit) : await orchestrator.searchAcrossNamespaces({
3061
3024
  query,
3062
3025
  namespaces: namespaceFilter ? [namespaceFilter] : void 0,
3063
- maxResults,
3026
+ maxResults: resultLimit,
3064
3027
  mode: "search"
3065
3028
  });
3066
3029
  if (filtered.length === 0) {
@@ -4770,7 +4733,7 @@ Best for:
4770
4733
  const recentDays = typeof params.recentDays === "number" && Number.isFinite(params.recentDays) ? Math.max(1, Math.floor(params.recentDays)) : void 0;
4771
4734
  const maxMemories = typeof params.maxMemories === "number" && Number.isFinite(params.maxMemories) ? Math.max(1, Math.floor(params.maxMemories)) : void 0;
4772
4735
  const batchSize = typeof params.batchSize === "number" && Number.isFinite(params.batchSize) ? Math.max(1, Math.floor(params.batchSize)) : void 0;
4773
- const result = await (0, memory_governance_exports.runMemoryGovernance)({
4736
+ const result = await runMemoryGovernance({
4774
4737
  memoryDir: storage.dir,
4775
4738
  mode,
4776
4739
  recentDays,
@@ -4913,18 +4876,22 @@ Best for:
4913
4876
  async execute(_toolCallId, params) {
4914
4877
  const p = params;
4915
4878
  const action = String(p.action ?? "");
4916
- const storage = new storage_exports.WorkStorage(orchestrator.config.memoryDir);
4879
+ const storage = new WorkStorage(orchestrator.config.memoryDir);
4917
4880
  try {
4918
4881
  await storage.ensureDirectories();
4919
4882
  if (action === "create") {
4920
4883
  if (typeof p.title !== "string" || p.title.trim().length === 0) {
4921
4884
  return workLayerTextResult("work_task.create requires non-empty `title`.");
4922
4885
  }
4886
+ const status = parseEnumParam(p, "status", WORK_TASK_STATUSES);
4887
+ if (!status.ok) return workLayerTextResult(`work_task.create received ${status.message}`);
4888
+ const priority = parseEnumParam(p, "priority", WORK_TASK_PRIORITIES);
4889
+ if (!priority.ok) return workLayerTextResult(`work_task.create received ${priority.message}`);
4923
4890
  const created = await storage.createTask({
4924
4891
  title: p.title,
4925
4892
  description: typeof p.description === "string" ? p.description : void 0,
4926
- status: asTaskStatus(p.status),
4927
- priority: asTaskPriority(p.priority),
4893
+ status: status.value,
4894
+ priority: priority.value,
4928
4895
  owner: asNonEmptyString(p.owner),
4929
4896
  assignee: asNonEmptyString(p.assignee),
4930
4897
  projectId: asNonEmptyString(p.projectId),
@@ -4942,8 +4909,10 @@ Best for:
4942
4909
  return toolJsonResult({ action, task });
4943
4910
  }
4944
4911
  if (action === "list") {
4912
+ const status = parseEnumParam(p, "status", WORK_TASK_STATUSES);
4913
+ if (!status.ok) return workLayerTextResult(`work_task.list received ${status.message}`);
4945
4914
  const tasks = await storage.listTasks({
4946
- status: asTaskStatus(p.status),
4915
+ status: status.value,
4947
4916
  owner: asNonEmptyString(p.owner),
4948
4917
  assignee: asNonEmptyString(p.assignee),
4949
4918
  projectId: asNonEmptyString(p.projectId)
@@ -4958,10 +4927,12 @@ Best for:
4958
4927
  const patch = {};
4959
4928
  if (typeof p.title === "string") patch.title = p.title;
4960
4929
  if (typeof p.description === "string") patch.description = p.description;
4961
- const status = asTaskStatus(p.status);
4962
- if (status) patch.status = status;
4963
- const priority = asTaskPriority(p.priority);
4964
- if (priority) patch.priority = priority;
4930
+ const status = parseEnumParam(p, "status", WORK_TASK_STATUSES);
4931
+ if (!status.ok) return workLayerTextResult(`work_task.update received ${status.message}`);
4932
+ if (status.value) patch.status = status.value;
4933
+ const priority = parseEnumParam(p, "priority", WORK_TASK_PRIORITIES);
4934
+ if (!priority.ok) return workLayerTextResult(`work_task.update received ${priority.message}`);
4935
+ if (priority.value) patch.priority = priority.value;
4965
4936
  const owner = asNullablePatchString(p, "owner");
4966
4937
  if (owner !== void 0) patch.owner = owner;
4967
4938
  const assignee = asNullablePatchString(p, "assignee");
@@ -5025,17 +4996,19 @@ Best for:
5025
4996
  async execute(_toolCallId, params) {
5026
4997
  const p = params;
5027
4998
  const action = String(p.action ?? "");
5028
- const storage = new storage_exports.WorkStorage(orchestrator.config.memoryDir);
4999
+ const storage = new WorkStorage(orchestrator.config.memoryDir);
5029
5000
  try {
5030
5001
  await storage.ensureDirectories();
5031
5002
  if (action === "create") {
5032
5003
  if (typeof p.name !== "string" || p.name.trim().length === 0) {
5033
5004
  return workLayerTextResult("work_project.create requires non-empty `name`.");
5034
5005
  }
5006
+ const status = parseEnumParam(p, "status", WORK_PROJECT_STATUSES);
5007
+ if (!status.ok) return workLayerTextResult(`work_project.create received ${status.message}`);
5035
5008
  const project = await storage.createProject({
5036
5009
  name: p.name,
5037
5010
  description: typeof p.description === "string" ? p.description : void 0,
5038
- status: asProjectStatus(p.status),
5011
+ status: status.value,
5039
5012
  owner: asNonEmptyString(p.owner),
5040
5013
  tags: Array.isArray(p.tags) ? p.tags.filter((x) => typeof x === "string") : void 0
5041
5014
  });
@@ -5061,8 +5034,9 @@ Best for:
5061
5034
  const patch = {};
5062
5035
  if (typeof p.name === "string") patch.name = p.name;
5063
5036
  if (typeof p.description === "string") patch.description = p.description;
5064
- const status = asProjectStatus(p.status);
5065
- if (status) patch.status = status;
5037
+ const status = parseEnumParam(p, "status", WORK_PROJECT_STATUSES);
5038
+ if (!status.ok) return workLayerTextResult(`work_project.update received ${status.message}`);
5039
+ if (status.value) patch.status = status.value;
5066
5040
  const owner = asNullablePatchString(p, "owner");
5067
5041
  if (owner !== void 0) patch.owner = owner;
5068
5042
  if (Array.isArray(p.tags)) patch.tags = p.tags.filter((x) => typeof x === "string");
@@ -5118,13 +5092,13 @@ Best for:
5118
5092
  const projectId = asNonEmptyString(p.projectId);
5119
5093
  const linkToMemory = p.linkToMemory === true;
5120
5094
  try {
5121
- await new storage_exports.WorkStorage(orchestrator.config.memoryDir).ensureDirectories();
5095
+ await new WorkStorage(orchestrator.config.memoryDir).ensureDirectories();
5122
5096
  if (action === "export_markdown") {
5123
- const markdown = await (0, board_exports.exportWorkBoardMarkdown)({ memoryDir: orchestrator.config.memoryDir, projectId });
5124
- return toolResult((0, boundary_exports.wrapWorkLayerContext)(markdown, { linkToMemory }));
5097
+ const markdown = await exportWorkBoardMarkdown({ memoryDir: orchestrator.config.memoryDir, projectId });
5098
+ return toolResult(wrapWorkLayerContext(markdown, { linkToMemory }));
5125
5099
  }
5126
5100
  if (action === "export_snapshot") {
5127
- const snapshot = await (0, board_exports.exportWorkBoardSnapshot)({ memoryDir: orchestrator.config.memoryDir, projectId });
5101
+ const snapshot = await exportWorkBoardSnapshot({ memoryDir: orchestrator.config.memoryDir, projectId });
5128
5102
  return toolJsonResult(snapshot, { linkToMemory });
5129
5103
  }
5130
5104
  if (action === "import_snapshot") {
@@ -5132,7 +5106,7 @@ Best for:
5132
5106
  return workLayerTextResult("work_board.import_snapshot requires `snapshotJson`.", { linkToMemory });
5133
5107
  }
5134
5108
  const snapshot = JSON.parse(p.snapshotJson);
5135
- const result = await (0, board_exports.importWorkBoardSnapshot)({
5109
+ const result = await importWorkBoardSnapshot({
5136
5110
  memoryDir: orchestrator.config.memoryDir,
5137
5111
  snapshot,
5138
5112
  projectId: asNonEmptyString(p.projectId)
@@ -5402,7 +5376,7 @@ Returns: Performance trace data with timing breakdown`,
5402
5376
  );
5403
5377
  }
5404
5378
  const format = asNonEmptyString(params.format) ?? "ascii";
5405
- const limit = Math.min(typeof params.limit === "number" ? params.limit : 5, 20);
5379
+ const limit = normalizeProfilingReportLimit(params.limit);
5406
5380
  const traces = profiler.getRecentTraces(limit);
5407
5381
  const stats = profiler.getStats();
5408
5382
  const bottleneck = profiler.identifyBottleneck();
@@ -5473,7 +5447,7 @@ Returns: Performance trace data with timing breakdown`,
5473
5447
  );
5474
5448
  }
5475
5449
  const format = asNonEmptyString(params.format) ?? "ascii";
5476
- const limit = Math.min(typeof params.limit === "number" ? params.limit : 5, 20);
5450
+ const limit = normalizeProfilingReportLimit(params.limit);
5477
5451
  const traces = profiler.getRecentTraces(limit);
5478
5452
  const stats = profiler.getStats();
5479
5453
  const bottleneck = profiler.identifyBottleneck();
@@ -5519,17 +5493,9 @@ Returns: Performance trace data with timing breakdown`,
5519
5493
  );
5520
5494
  }
5521
5495
 
5522
- // ../../src/lcm/index.ts
5523
- var lcm_exports = {};
5524
- __reExport(lcm_exports, lcm_star);
5525
- import * as lcm_star from "@remnic/core/lcm/index";
5526
-
5527
- // ../../src/lcm/archive.ts
5528
- var archive_exports = {};
5529
- __reExport(archive_exports, archive_star);
5530
- import * as archive_star from "@remnic/core/lcm/archive";
5531
-
5532
5496
  // ../../src/index.ts
5497
+ import { registerLcmTools } from "@remnic/core/lcm/index";
5498
+ import { estimateTokens as estimateLcmTokens } from "@remnic/core/lcm/archive";
5533
5499
  import { registerCli } from "@remnic/core/cli";
5534
5500
 
5535
5501
  // ../../src/objective-state.ts
@@ -5567,23 +5533,19 @@ __reExport(access_http_exports, access_http_star);
5567
5533
  import * as access_http_star from "@remnic/core/access-http";
5568
5534
 
5569
5535
  // ../../src/index.ts
5570
- import path92 from "path";
5571
- import os7 from "os";
5536
+ import path3 from "path";
5537
+ import os from "os";
5572
5538
 
5573
5539
  // ../../src/opik-exporter.ts
5574
5540
  var opik_exporter_exports = {};
5575
5541
  __reExport(opik_exporter_exports, opik_exporter_star);
5576
5542
  import * as opik_exporter_star from "@remnic/core/opik-exporter";
5577
5543
 
5578
- // ../../src/runtime/env.ts
5579
- var env_exports = {};
5580
- __reExport(env_exports, env_star);
5581
- import * as env_star from "@remnic/core/runtime/env";
5544
+ // ../../src/index.ts
5545
+ import { readEnvVar, resolveHomeDir } from "@remnic/core/runtime/env";
5582
5546
 
5583
5547
  // ../../src/migrate/from-engram.ts
5584
- var from_engram_exports = {};
5585
- __reExport(from_engram_exports, from_engram_star);
5586
- import * as from_engram_star from "@remnic/core/migrate/from-engram";
5548
+ import { migrateFromEngram, rollbackFromEngramMigration } from "@remnic/core/migrate/from-engram";
5587
5549
 
5588
5550
  // ../../src/user-message-cleaning.ts
5589
5551
  function cleanUserMessage(content) {
@@ -5592,12 +5554,18 @@ function cleanUserMessage(content) {
5592
5554
  /<supermemory-context[^>]*>[\s\S]*?<\/supermemory-context>\s*/gi,
5593
5555
  ""
5594
5556
  );
5557
+ const platformHeader = cleaned.match(/^\[\w+\s+.+?\s+id:\d+\s+[^\]]+\]\s*/);
5558
+ const hasPlatformHeader = platformHeader !== null;
5559
+ if (platformHeader) {
5560
+ cleaned = cleaned.slice(platformHeader[0].length);
5561
+ }
5595
5562
  cleaned = cleaned.replace(
5596
- /## Memory Context \((?:Engram|Remnic)\)[\s\S]*?(?=\n## |\n$)/gi,
5563
+ /^\s*## Memory Context \((?:Engram|Remnic)\)[\s\S]*?(?=\n## |\n$)/i,
5597
5564
  ""
5598
5565
  );
5599
- cleaned = cleaned.replace(/^\[\w+\s+.+?\s+id:\d+\s+[^\]]+\]\s*/, "");
5600
- cleaned = cleaned.replace(/\s*\[message_id:\s*[^\]]+\]\s*$/, "");
5566
+ if (hasPlatformHeader) {
5567
+ cleaned = cleaned.replace(/\s*\[message_id:\s*[^\]]+\]\s*$/i, "");
5568
+ }
5601
5569
  return cleaned.trim();
5602
5570
  }
5603
5571
 
@@ -5745,1813 +5713,8 @@ async function listRemnicPublicArtifacts(params) {
5745
5713
  return [...deduped.values()];
5746
5714
  }
5747
5715
 
5748
- // ../remnic-core/src/config.ts
5749
- import path2 from "path";
5750
- var DEFAULT_MEMORY_DIR = path2.join(
5751
- resolveHomeDir(),
5752
- ".openclaw",
5753
- "workspace",
5754
- "memory",
5755
- "local"
5756
- );
5757
- var DEFAULT_WORKSPACE_DIR = path2.join(
5758
- resolveHomeDir(),
5759
- ".openclaw",
5760
- "workspace"
5761
- );
5762
- var CLIENT_SECRET_FIELD = ["client", "Secret"].join("");
5763
- var REFRESH_TOKEN_FIELD = ["refresh", "Token"].join("");
5764
- var LEGACY_ACTIVE_RECALL_CUSTOM_FIELD = [
5765
- "activeRecall",
5766
- "Prompt",
5767
- "Override"
5768
- ].join("");
5769
-
5770
- // ../remnic-core/src/migrate/from-engram.ts
5771
- import { createHash as createHash2 } from "crypto";
5772
- import path3 from "path";
5773
- import * as fsReadModule0 from "fs/promises";
5774
- const chmod = fsReadModule0.chmod;
5775
- const copyFile = fsReadModule0.copyFile;
5776
- const lstat2 = fsReadModule0.lstat;
5777
- const mkdir = fsReadModule0.mkdir;
5778
- const open = fsReadModule0.open;
5779
- const fileReader = fsReadModule0["re"+"ad"+"Fi"+"le"];
5780
- const readdir2 = fsReadModule0.readdir;
5781
- const rm = fsReadModule0.rm;
5782
- const stat2 = fsReadModule0.stat;
5783
- const unlink = fsReadModule0.unlink;
5784
- const writeFile = fsReadModule0.writeFile;
5785
- import { existsSync } from "fs";
5786
-
5787
- // ../remnic-core/src/runtime/child-process.ts
5788
- import { createRequire } from "module";
5789
- var require2 = createRequire(import.meta.url);
5790
-
5791
- // ../remnic-core/src/orchestrator.ts
5792
- import path42 from "path";
5793
- import os3 from "os";
5794
- import { createHash as createHash11, randomBytes } from "crypto";
5795
- import { existsSync as existsSync3 } from "fs";
5796
- import * as fsReadModule1 from "fs/promises";
5797
- const mkdir29 = fsReadModule1.mkdir;
5798
- const readdir16 = fsReadModule1.readdir;
5799
- const fileReader25 = fsReadModule1["re"+"ad"+"Fi"+"le"];
5800
- const stat12 = fsReadModule1.stat;
5801
- const unlink7 = fsReadModule1.unlink;
5802
- const writeFile28 = fsReadModule1.writeFile;
5803
-
5804
- // ../remnic-core/src/day-summary.ts
5805
- import path4 from "path";
5806
- import { fileURLToPath } from "url";
5807
- var PROMPT_RELATIVE_PATH = path4.join("prompts", "day_summary.prompt.md");
5808
-
5809
- // ../remnic-core/src/extraction.ts
5810
- import OpenAI from "openai";
5811
-
5812
- // ../remnic-core/src/local-llm.ts
5813
- import fs from "fs";
5814
- import os from "os";
5815
-
5816
- // ../remnic-core/src/schemas.ts
5817
- var MemoryActionTypeSchema = external_exports.enum([
5818
- "store_episode",
5819
- "store_note",
5820
- "update_note",
5821
- "create_artifact",
5822
- "summarize_node",
5823
- "discard",
5824
- "link_graph"
5825
- ]);
5826
- var MemoryActionEligibilityContextSchema = external_exports.object({
5827
- confidence: external_exports.number().min(0).max(1),
5828
- lifecycleState: external_exports.enum(["active", "validated", "candidate", "stale", "archived"]),
5829
- importance: external_exports.number().min(0).max(1),
5830
- source: external_exports.enum(["extraction", "consolidation", "replay", "manual", "unknown"])
5831
- }).strict();
5832
- var ProcedureStepExtractSchema = external_exports.object({
5833
- order: external_exports.number(),
5834
- intent: external_exports.string(),
5835
- toolCall: external_exports.object({
5836
- kind: external_exports.string(),
5837
- signature: external_exports.string()
5838
- }).optional().nullable(),
5839
- expectedOutcome: external_exports.string().optional().nullable(),
5840
- optional: external_exports.boolean().optional().nullable()
5841
- });
5842
- var ExtractedFactSchema = external_exports.object({
5843
- category: external_exports.enum([
5844
- "fact",
5845
- "preference",
5846
- "correction",
5847
- "entity",
5848
- "decision",
5849
- "relationship",
5850
- "principle",
5851
- "commitment",
5852
- "moment",
5853
- "skill",
5854
- "rule",
5855
- "procedure",
5856
- "reasoning_trace"
5857
- ]),
5858
- content: external_exports.string().describe("The memory content \u2014 a clear, standalone statement"),
5859
- confidence: external_exports.number().min(0).max(1).describe("How confident are you this is correct (0-1)"),
5860
- tags: external_exports.array(external_exports.string()).describe("Relevant tags for categorization"),
5861
- entityRef: external_exports.string().optional().nullable().describe("If about an entity, its normalized name (e.g. person-jane-doe)"),
5862
- promptedByQuestion: external_exports.string().optional().nullable().describe("Optional proactive follow-up question that surfaced this fact."),
5863
- scope: external_exports.enum(["project", "global"]).optional().nullable().describe(
5864
- 'Scope classification: "global" for cross-project knowledge (framework bugs, library behavior, API patterns, user preferences, tool configs, general coding patterns); "project" for project-specific knowledge (file paths, env configs, deployment details, project workarounds). Defaults to "project" when a coding context is active.'
5865
- ),
5866
- structuredAttributes: external_exports.record(external_exports.string(), external_exports.string()).optional().nullable().describe('Structured key-value attributes when the fact contains measurable or categorical data (e.g., {"price": "29.99", "color": "blue", "date": "2024-03-15"}).'),
5867
- procedureSteps: external_exports.array(ProcedureStepExtractSchema).optional().nullable().describe(
5868
- 'For category "procedure" only: ordered steps (intent per step). At least two steps; include explicit trigger phrasing in content (e.g. "When you deploy\u2026").'
5869
- ),
5870
- reasoningTrace: external_exports.object({
5871
- steps: external_exports.array(
5872
- external_exports.object({
5873
- order: external_exports.number(),
5874
- description: external_exports.string()
5875
- })
5876
- ).min(2).describe("Ordered reasoning steps the user walked through (require >=2)."),
5877
- // Accept snake_case aliases so a loose gateway model using
5878
- // `final_answer` / `observed_outcome` does not fail schema parsing
5879
- // and drop the entire extraction result. Local/direct-client
5880
- // normalization already tolerates these keys; the gateway path must
5881
- // too. Zod's `union` keeps the parse successful either way.
5882
- finalAnswer: external_exports.string().optional().nullable().describe("The conclusion, decision, or answer the chain arrived at."),
5883
- final_answer: external_exports.string().optional().nullable().describe("Alias for finalAnswer (snake_case). Gateway-tolerance shim."),
5884
- observedOutcome: external_exports.string().optional().nullable().describe("Optional note about how the answer actually played out."),
5885
- observed_outcome: external_exports.string().optional().nullable().describe("Alias for observedOutcome (snake_case). Gateway-tolerance shim.")
5886
- }).refine(
5887
- (v) => typeof v.finalAnswer === "string" && v.finalAnswer.trim().length > 0 || typeof v.final_answer === "string" && v.final_answer.trim().length > 0,
5888
- { message: "reasoningTrace requires finalAnswer (or final_answer)" }
5889
- ).optional().nullable().describe(
5890
- 'For category "reasoning_trace" only: a stored solution chain with ordered steps, a final answer, and an optional observed outcome. Require at least two steps.'
5891
- )
5892
- });
5893
- var EntityMentionSchema = external_exports.object({
5894
- name: external_exports.string().describe("Normalized entity name (e.g. jane-doe, acme-corp, my-project)"),
5895
- type: external_exports.enum(["person", "project", "tool", "company", "place", "other"]),
5896
- facts: external_exports.array(external_exports.string()).describe("New facts learned about this entity in this conversation"),
5897
- promptedByQuestion: external_exports.string().optional().nullable().describe("Optional proactive follow-up question that surfaced this entity."),
5898
- structuredSections: external_exports.array(external_exports.object({
5899
- key: external_exports.string(),
5900
- title: external_exports.string(),
5901
- facts: external_exports.array(external_exports.string())
5902
- })).optional().nullable().describe("Optional named sections for entity-specific facts. Use when facts clearly belong under a durable heading such as Beliefs or Building / Working On.")
5903
- });
5904
- var ExtractedQuestionSchema = external_exports.object({
5905
- question: external_exports.string().describe("A genuine question the AI is curious about based on this conversation"),
5906
- context: external_exports.string().describe("Why this question matters or what prompted it"),
5907
- priority: external_exports.number().min(0).max(1).describe("How important/urgent this question is (0-1)")
5908
- });
5909
- var ProactiveQuestionsResultSchema = external_exports.object({
5910
- questions: external_exports.array(ExtractedQuestionSchema).describe("Additional follow-up questions discovered in a proactive second-pass extraction.")
5911
- });
5912
- var ExtractedRelationshipSchema = external_exports.object({
5913
- source: external_exports.string().describe("Source entity name (normalized, e.g. person-jane-doe)"),
5914
- target: external_exports.string().describe("Target entity name (normalized, e.g. company-acme-corp)"),
5915
- label: external_exports.string().describe("Relationship label (e.g. 'works at', 'created', 'manages')"),
5916
- promptedByQuestion: external_exports.string().optional().nullable().describe("Optional proactive follow-up question that surfaced this relationship.")
5917
- });
5918
- var ProactiveExtractionResultSchema = external_exports.object({
5919
- facts: external_exports.array(ExtractedFactSchema).describe(
5920
- "Additional high-confidence memories recovered only after answering proactive follow-up questions from the same buffered conversation."
5921
- ),
5922
- profileUpdates: external_exports.array(external_exports.string()).describe(
5923
- "Additional profile updates directly supported by the buffered conversation. Omit anything speculative."
5924
- ),
5925
- entities: external_exports.array(EntityMentionSchema).describe(
5926
- "Additional entities or entity facts surfaced by the proactive follow-up pass."
5927
- ),
5928
- relationships: external_exports.array(ExtractedRelationshipSchema).optional().nullable().describe(
5929
- "Additional relationships surfaced by the proactive follow-up pass."
5930
- )
5931
- });
5932
- var ExtractionResultSchema = external_exports.object({
5933
- facts: external_exports.array(ExtractedFactSchema).describe(
5934
- "Extracted memories from the conversation. Include facts, preferences, corrections, and decisions. Only extract genuinely new, durable information \u2014 skip transient task state."
5935
- ),
5936
- profileUpdates: external_exports.array(external_exports.string()).describe(
5937
- "Updates to the user's behavioral profile. Each string is a standalone statement about the user's preferences, habits, or personality. Only include genuinely new insights."
5938
- ),
5939
- entities: external_exports.array(EntityMentionSchema).describe(
5940
- "Entities mentioned in the conversation with new facts about them."
5941
- ),
5942
- questions: external_exports.array(ExtractedQuestionSchema).describe(
5943
- "1-3 genuine questions you're curious about from this conversation. These should be things you'd actually want to know the answer to in future sessions."
5944
- ),
5945
- identityReflection: external_exports.string().optional().nullable().describe(
5946
- "A brief reflection on what you learned about yourself as an agent in this interaction \u2014 patterns in your behavior, growth, things you did well or could improve."
5947
- ),
5948
- relationships: external_exports.array(ExtractedRelationshipSchema).optional().nullable().describe(
5949
- "Relationships between entities discovered in this conversation. Max 5 per extraction. Format: {source, target, label}."
5950
- )
5951
- });
5952
- var ConsolidationItemSchema = external_exports.object({
5953
- existingId: external_exports.string().describe("The ID of the existing memory being evaluated"),
5954
- action: external_exports.enum(["ADD", "MERGE", "UPDATE", "INVALIDATE", "SKIP"]),
5955
- mergeWith: external_exports.string().optional().nullable().describe("If MERGE, the ID of the memory to merge with"),
5956
- updatedContent: external_exports.string().optional().nullable().describe("If UPDATE or MERGE, the new content"),
5957
- reason: external_exports.string().describe("Brief reason for this decision")
5958
- });
5959
- var ConsolidationResultSchema = external_exports.object({
5960
- items: external_exports.array(ConsolidationItemSchema).describe(
5961
- "Decisions for each existing memory: ADD (keep as-is), MERGE (combine with another), UPDATE (revise content), INVALIDATE (mark as outdated/wrong), SKIP (no action needed)"
5962
- ),
5963
- profileUpdates: external_exports.array(external_exports.string()).describe("New profile statements to add or update"),
5964
- entityUpdates: external_exports.array(EntityMentionSchema).describe("Entity updates from consolidation analysis")
5965
- });
5966
- function buildProfileConsolidationResultSchema(targetLines) {
5967
- return external_exports.object({
5968
- consolidatedProfile: external_exports.string().describe(
5969
- `The full consolidated profile as markdown. Preserve all ## section headers. Merge duplicate or near-duplicate bullets into single clear statements. Remove stale or superseded information. Keep the most important and durable observations. Target roughly ${targetLines} lines.`
5970
- ),
5971
- removedCount: external_exports.number().describe("Number of bullets removed or merged during consolidation"),
5972
- summary: external_exports.string().describe("Brief summary of what was consolidated")
5973
- });
5974
- }
5975
- var ProfileConsolidationResultSchema = buildProfileConsolidationResultSchema(50);
5976
- var IdentityConsolidationResultSchema = external_exports.object({
5977
- learnedPatterns: external_exports.array(external_exports.string()).describe(
5978
- "Consolidated behavioral patterns and lessons learned, each a concise standalone statement"
5979
- ),
5980
- summary: external_exports.string().describe(
5981
- "A brief paragraph summarizing the agent's core identity insights"
5982
- )
5983
- });
5984
- var ContradictionVerificationSchema = external_exports.object({
5985
- isContradiction: external_exports.boolean().describe("Whether the two memories truly contradict each other"),
5986
- confidence: external_exports.number().min(0).max(1).describe("How confident are you in this assessment (0-1)"),
5987
- reasoning: external_exports.string().describe("Explanation of why these are or are not contradictory"),
5988
- whichIsNewer: external_exports.enum(["first", "second", "unclear"]).describe("Which memory represents the more recent/current state")
5989
- });
5990
- var MemoryLinkSchema = external_exports.object({
5991
- targetId: external_exports.string().describe("The ID of the memory this links to"),
5992
- linkType: external_exports.enum(["follows", "references", "contradicts", "supports", "related"]).describe("The type of relationship"),
5993
- strength: external_exports.number().min(0).max(1).describe("How strong is this relationship (0-1)"),
5994
- reason: external_exports.string().optional().nullable().describe("Why this link exists")
5995
- });
5996
- var SuggestedLinksSchema = external_exports.object({
5997
- links: external_exports.array(MemoryLinkSchema).describe("Suggested links between memories based on semantic analysis")
5998
- });
5999
- var MemorySummarySchema = external_exports.object({
6000
- summaryText: external_exports.string().describe("A concise summary of the batch of memories"),
6001
- keyFacts: external_exports.array(external_exports.string()).describe("The most important facts extracted from these memories"),
6002
- keyEntities: external_exports.array(external_exports.string()).describe("Key entities mentioned across these memories")
6003
- });
6004
- var DaySummaryResultSchema = external_exports.object({
6005
- summary: external_exports.string().min(1).describe("A concise end-of-day summary paragraph."),
6006
- bullets: external_exports.array(external_exports.string()).default([]).describe("The most important moments from the day."),
6007
- next_actions: external_exports.array(external_exports.string()).default([]).describe("Concrete next actions for tomorrow."),
6008
- risks_or_open_loops: external_exports.array(external_exports.string()).default([]).describe("Open loops, blockers, or fragile assumptions still needing attention.")
6009
- });
6010
- var BehaviorLoopAdjustmentSchema = external_exports.object({
6011
- parameter: external_exports.string().min(1),
6012
- previousValue: external_exports.number(),
6013
- nextValue: external_exports.number(),
6014
- delta: external_exports.number(),
6015
- evidenceCount: external_exports.number().int().min(0),
6016
- confidence: external_exports.number().min(0).max(1),
6017
- reason: external_exports.string(),
6018
- appliedAt: external_exports.string()
6019
- });
6020
- var BehaviorLoopPolicyStateSchema = external_exports.object({
6021
- version: external_exports.number().int().min(0),
6022
- windowDays: external_exports.number().int().min(0),
6023
- minSignalCount: external_exports.number().int().min(0),
6024
- maxDeltaPerCycle: external_exports.number().min(0).max(1),
6025
- protectedParams: external_exports.array(external_exports.string()),
6026
- adjustments: external_exports.array(BehaviorLoopAdjustmentSchema),
6027
- updatedAt: external_exports.string()
6028
- });
6029
-
6030
- // ../remnic-core/src/model-registry.ts
6031
- import fs2 from "fs";
6032
- import { join } from "path";
6033
- var DEFAULT_CAPABILITIES = {
6034
- modelId: "default",
6035
- maxPositionEmbeddings: 32768,
6036
- contextWindow: 32768,
6037
- supportsExtendedContext: false,
6038
- typicalOutputTokens: 8192,
6039
- source: "default",
6040
- fetchedAt: (/* @__PURE__ */ new Date()).toISOString()
6041
- };
6042
-
6043
- // ../remnic-core/src/profiling.ts
6044
- import {
6045
- existsSync as existsSync2,
6046
- mkdirSync,
6047
- writeFileSync,
6048
- promises as fsp
6049
- } from "fs";
6050
- import { join as join2 } from "path";
6051
-
6052
- // ../remnic-core/src/extraction-judge.ts
6053
- import { createHash as createHash3 } from "crypto";
6054
-
6055
- // ../remnic-core/src/extraction-judge-training.ts
6056
- import path5 from "path";
6057
- import { homedir } from "os";
6058
- import * as fsReadModule2 from "fs/promises";
6059
- const appendFile = fsReadModule2.appendFile;
6060
- const chmod2 = fsReadModule2.chmod;
6061
- const mkdir2 = fsReadModule2.mkdir;
6062
- const fileReader2 = fsReadModule2["re"+"ad"+"Fi"+"le"];
6063
- const readdir3 = fsReadModule2.readdir;
6064
-
6065
- // ../remnic-core/src/search/factory.ts
6066
- import path11 from "path";
6067
-
6068
- // ../remnic-core/src/search/document-scanner.ts
6069
- import path6 from "path";
6070
- import * as fsReadModule3 from "fs/promises";
6071
- const readdir4 = fsReadModule3.readdir;
6072
- const fileReader3 = fsReadModule3["re"+"ad"+"Fi"+"le"];
6073
-
6074
- // ../remnic-core/src/search/orama-backend.ts
6075
- import path7 from "path";
6076
- import * as fsReadModule4 from "fs/promises";
6077
- const mkdir3 = fsReadModule4.mkdir;
6078
- const readdir5 = fsReadModule4.readdir;
6079
- const fileReader4 = fsReadModule4["re"+"ad"+"Fi"+"le"];
6080
- const writeFile2 = fsReadModule4.writeFile;
6081
-
6082
- // ../remnic-core/src/qmd.ts
6083
- import { createHash as createHash4 } from "crypto";
6084
- import os2 from "os";
6085
- import path8 from "path";
6086
-
6087
- // ../remnic-core/src/abort-error.ts
6088
- function abortError(message) {
6089
- const err = new Error(message);
6090
- Object.defineProperty(err, "name", { value: "AbortError" });
6091
- return err;
6092
- }
6093
- function throwIfAborted(signal, message = "operation aborted") {
6094
- if (signal?.aborted) {
6095
- throw abortError(message);
6096
- }
6097
- }
6098
-
6099
- // ../remnic-core/src/qmd.ts
6100
- var QMD_UPDATE_BACKOFF_MS = 15 * 60 * 1e3;
6101
- var QMD_EMBED_BACKOFF_MS = 60 * 60 * 1e3;
6102
- var QMD_CLI_WARN_THROTTLE_MS = 15 * 60 * 1e3;
6103
- var QMD_AUTO_UPGRADE_CHECK_INTERVAL_MS = 24 * 60 * 6e4;
6104
- var QMD_FALLBACK_PATHS = [
6105
- path8.join(os2.homedir(), ".bun", "bin", "qmd"),
6106
- "/usr/local/bin/qmd",
6107
- "/opt/homebrew/bin/qmd"
6108
- ];
6109
- var AsyncMutex = class {
6110
- locked = false;
6111
- queue = [];
6112
- async runExclusive(fn, signal) {
6113
- const release = await this.acquire(signal);
6114
- try {
6115
- throwIfAborted(signal);
6116
- return await fn();
6117
- } finally {
6118
- release();
6119
- }
6120
- }
6121
- acquire(signal) {
6122
- throwIfAborted(signal);
6123
- if (!this.locked) {
6124
- this.locked = true;
6125
- return Promise.resolve(() => this.release());
6126
- }
6127
- return new Promise((resolve2, reject) => {
6128
- const waiter = {
6129
- resolve: (release) => {
6130
- signal?.removeEventListener("abort", waiter.onAbort);
6131
- resolve2(release);
6132
- },
6133
- reject: (reason) => {
6134
- signal?.removeEventListener("abort", waiter.onAbort);
6135
- reject(reason);
6136
- },
6137
- signal,
6138
- onAbort: () => {
6139
- this.queue = this.queue.filter((entry) => entry !== waiter);
6140
- reject(abortError("operation aborted while waiting for qmd mutex"));
6141
- }
6142
- };
6143
- signal?.addEventListener("abort", waiter.onAbort, { once: true });
6144
- this.queue.push(waiter);
6145
- });
6146
- }
6147
- release() {
6148
- while (this.queue.length > 0) {
6149
- const next = this.queue.shift();
6150
- if (!next) break;
6151
- if (next.signal?.aborted) {
6152
- next.reject(abortError("operation aborted while waiting for qmd mutex"));
6153
- continue;
6154
- }
6155
- this.locked = true;
6156
- next.resolve(() => this.release());
6157
- return;
6158
- }
6159
- this.locked = false;
6160
- }
6161
- };
6162
- var QMD_MUTEX = new AsyncMutex();
6163
-
6164
- // ../remnic-core/src/conversation-index/faiss-adapter.ts
6165
- import { fileURLToPath as fileURLToPath2 } from "url";
6166
- import path9 from "path";
6167
-
6168
- // ../remnic-core/src/conversation-index/indexer.ts
6169
- import { lstat as lstat3, mkdir as mkdir4, writeFile as writeFile3 } from "fs/promises";
6170
- import path10 from "path";
6171
-
6172
- // ../remnic-core/src/threading.ts
6173
- import * as fsReadModule5 from "fs/promises";
6174
- const readdir6 = fsReadModule5.readdir;
6175
- const fileReader5 = fsReadModule5["re"+"ad"+"Fi"+"le"];
6176
- const writeFile4 = fsReadModule5.writeFile;
6177
- const mkdir5 = fsReadModule5.mkdir;
6178
- const stat3 = fsReadModule5.stat;
6179
-
6180
- // ../remnic-core/src/storage-paths.ts
6181
- import { createHash as createHash5 } from "crypto";
6182
- import { lstat as lstat4, realpath as realpath2 } from "fs/promises";
6183
- import path12 from "path";
6184
-
6185
- // ../remnic-core/src/transcript.ts
6186
- import * as fsReadModule6 from "fs/promises";
6187
- const appendFile2 = fsReadModule6.appendFile;
6188
- const mkdir6 = fsReadModule6.mkdir;
6189
- const readdir8 = fsReadModule6.readdir;
6190
- const fileReader7 = fsReadModule6["re"+"ad"+"Fi"+"le"];
6191
- const stat4 = fsReadModule6.stat;
6192
- const unlink3 = fsReadModule6.unlink;
6193
- const writeFile6 = fsReadModule6.writeFile;
6194
- import path14 from "path";
6195
-
6196
- // ../remnic-core/src/session-integrity.ts
6197
- import path13 from "path";
6198
- import * as fsReadModule7 from "fs/promises";
6199
- const fileReader6 = fsReadModule7["re"+"ad"+"Fi"+"le"];
6200
- const readdir7 = fsReadModule7.readdir;
6201
- const unlink2 = fsReadModule7.unlink;
6202
- const writeFile5 = fsReadModule7.writeFile;
6203
-
6204
- // ../remnic-core/src/summarizer.ts
6205
- import * as fsReadModule8 from "fs/promises";
6206
- const mkdir8 = fsReadModule8.mkdir;
6207
- const fileReader9 = fsReadModule8["re"+"ad"+"Fi"+"le"];
6208
- const writeFile8 = fsReadModule8.writeFile;
6209
- const readdir9 = fsReadModule8.readdir;
6210
- import path16 from "path";
6211
-
6212
- // ../remnic-core/src/summary-snapshot.ts
6213
- import * as fsReadModule9 from "fs/promises";
6214
- const mkdir7 = fsReadModule9.mkdir;
6215
- const open2 = fsReadModule9.open;
6216
- const fileReader8 = fsReadModule9["re"+"ad"+"Fi"+"le"];
6217
- const stat5 = fsReadModule9.stat;
6218
- const unlink4 = fsReadModule9.unlink;
6219
- const utimes = fsReadModule9.utimes;
6220
- const writeFile7 = fsReadModule9.writeFile;
6221
- import path15 from "path";
6222
- var summarySnapshotSchemaVersion = 1;
6223
- var SummarySnapshotItemSchema = external_exports.object({
6224
- hour: external_exports.string(),
6225
- sessionKey: external_exports.string(),
6226
- bullets: external_exports.array(external_exports.string()),
6227
- turnCount: external_exports.number().int().nonnegative(),
6228
- generatedAt: external_exports.string()
6229
- });
6230
- var SummarySnapshotSchema = external_exports.object({
6231
- schemaVersion: external_exports.number().default(summarySnapshotSchemaVersion),
6232
- sessionKey: external_exports.string(),
6233
- generatedAt: external_exports.string().datetime({ offset: true }),
6234
- summaries: external_exports.array(SummarySnapshotItemSchema)
6235
- });
6236
- var summarySnapshotLockStaleMs = 3e4;
6237
- var summarySnapshotLockHeartbeatMs = Math.max(
6238
- 1e3,
6239
- Math.floor(summarySnapshotLockStaleMs / 3)
6240
- );
6241
-
6242
- // ../remnic-core/src/summarizer.ts
6243
- var HourlySummarySchema = external_exports.object({
6244
- bullets: external_exports.array(external_exports.string()).describe("3-5 bullet points summarizing the hour's activity")
6245
- });
6246
- var HourlySummaryExtendedSchema = external_exports.object({
6247
- topics: external_exports.array(external_exports.string()).default([]),
6248
- decisions: external_exports.array(external_exports.string()).default([]),
6249
- actionItems: external_exports.array(external_exports.string()).default([]),
6250
- rejected: external_exports.array(external_exports.string()).default([])
6251
- });
6252
-
6253
- // ../remnic-core/src/maintenance/memory-governance-cron.ts
6254
- import * as fsReadModule10 from "fs/promises";
6255
- const mkdir9 = fsReadModule10.mkdir;
6256
- const fileReader10 = fsReadModule10["re"+"ad"+"Fi"+"le"];
6257
- const rename = fsReadModule10.rename;
6258
- const rm2 = fsReadModule10.rm;
6259
- const stat6 = fsReadModule10.stat;
6260
- const writeFile9 = fsReadModule10.writeFile;
6261
- import path17 from "path";
6262
-
6263
- // ../remnic-core/src/connectors/live/google-drive.ts
6264
- var DEFAULT_POLL_INTERVAL_MS = 5 * 60 * 1e3;
6265
- var MAX_POLL_INTERVAL_MS = 24 * 60 * 60 * 1e3;
6266
- var MAX_TEXT_BYTES = 5 * 1024 * 1024;
6267
- var CLIENT_SECRET_FIELD2 = ["client", "Secret"].join("");
6268
- var REFRESH_TOKEN_FIELD2 = ["refresh", "Token"].join("");
6269
- var GOOGLE_NATIVE_EXPORT_MIME = Object.freeze({
6270
- "application/vnd.google-apps.document": "text/plain",
6271
- "application/vnd.google-apps.spreadsheet": "text/csv",
6272
- "application/vnd.google-apps.presentation": "text/plain"
6273
- });
6274
-
6275
- // ../remnic-core/src/connectors/live/notion.ts
6276
- var NOTION_DEFAULT_POLL_INTERVAL_MS = 5 * 60 * 1e3;
6277
- var NOTION_MAX_POLL_INTERVAL_MS = 24 * 60 * 60 * 1e3;
6278
- var MAX_TEXT_BYTES2 = 5 * 1024 * 1024;
6279
-
6280
- // ../remnic-core/src/connectors/live/gmail.ts
6281
- var GMAIL_DEFAULT_POLL_INTERVAL_MS = 5 * 60 * 1e3;
6282
- var GMAIL_MAX_POLL_INTERVAL_MS = 24 * 60 * 60 * 1e3;
6283
- var MAX_TEXT_BYTES3 = 2 * 1024 * 1024;
6284
- var CLIENT_SECRET_FIELD3 = ["client", "Secret"].join("");
6285
- var REFRESH_TOKEN_FIELD3 = ["refresh", "Token"].join("");
6286
-
6287
- // ../remnic-core/src/connectors/live/github.ts
6288
- var GITHUB_DEFAULT_POLL_INTERVAL_MS = 5 * 60 * 1e3;
6289
- var GITHUB_MAX_POLL_INTERVAL_MS = 24 * 60 * 60 * 1e3;
6290
- var MAX_BODY_BYTES = 5 * 1024 * 1024;
6291
-
6292
- // ../remnic-core/src/retrieval-agents.ts
6293
- import path18 from "path";
6294
- import * as fsReadModule11 from "fs/promises";
6295
- const readdir10 = fsReadModule11.readdir;
6296
- const fileReader11 = fsReadModule11["re"+"ad"+"Fi"+"le"];
6297
- const stat7 = fsReadModule11.stat;
6298
-
6299
- // ../remnic-core/src/relevance.ts
6300
- import * as fsReadModule12 from "fs/promises";
6301
- const mkdir10 = fsReadModule12.mkdir;
6302
- const fileReader12 = fsReadModule12["re"+"ad"+"Fi"+"le"];
6303
- const writeFile10 = fsReadModule12.writeFile;
6304
- import path19 from "path";
6305
-
6306
- // ../remnic-core/src/negative.ts
6307
- import * as fsReadModule13 from "fs/promises";
6308
- const mkdir11 = fsReadModule13.mkdir;
6309
- const fileReader13 = fsReadModule13["re"+"ad"+"Fi"+"le"];
6310
- const writeFile11 = fsReadModule13.writeFile;
6311
- import path20 from "path";
6312
-
6313
- // ../remnic-core/src/recall-state.ts
6314
- import * as fsReadModule14 from "fs/promises";
6315
- const appendFile3 = fsReadModule14.appendFile;
6316
- const mkdir12 = fsReadModule14.mkdir;
6317
- const fileReader14 = fsReadModule14["re"+"ad"+"Fi"+"le"];
6318
- const writeFile12 = fsReadModule14.writeFile;
6319
- import path21 from "path";
6320
- import { createHash as createHash6, randomUUID } from "crypto";
6321
- var DEFAULT_TIER_MIGRATION_STATUS = {
6322
- updatedAt: (/* @__PURE__ */ new Date(0)).toISOString(),
6323
- lastCycle: null,
6324
- totals: {
6325
- cycles: 0,
6326
- scanned: 0,
6327
- migrated: 0,
6328
- promoted: 0,
6329
- demoted: 0,
6330
- errors: 0
6331
- }
6332
- };
6333
-
6334
- // ../remnic-core/src/recall-xray.ts
6335
- import { randomUUID as randomUUID2 } from "crypto";
6336
-
6337
- // ../remnic-core/src/evals.ts
6338
- import path22 from "path";
6339
- import { cp, mkdir as mkdir13, rm as rm3, stat as stat8, writeFile as writeFile13 } from "fs/promises";
6340
-
6341
- // ../remnic-core/src/session-observer-state.ts
6342
- import path23 from "path";
6343
- import * as fsReadModule15 from "fs/promises";
6344
- const mkdir14 = fsReadModule15.mkdir;
6345
- const open3 = fsReadModule15.open;
6346
- const fileReader16 = fsReadModule15["re"+"ad"+"Fi"+"le"];
6347
- const stat9 = fsReadModule15.stat;
6348
- const unlink5 = fsReadModule15.unlink;
6349
- const writeFile14 = fsReadModule15.writeFile;
6350
-
6351
- // ../remnic-core/src/embedding-fallback.ts
6352
- import path24 from "path";
6353
- import * as fsReadModule16 from "fs/promises";
6354
- const mkdir15 = fsReadModule16.mkdir;
6355
- const fileReader17 = fsReadModule16["re"+"ad"+"Fi"+"le"];
6356
- const writeFile15 = fsReadModule16.writeFile;
6357
-
6358
- // ../remnic-core/src/bootstrap.ts
6359
- import path25 from "path";
6360
- import * as fsReadModule17 from "fs/promises";
6361
- const readdir12 = fsReadModule17.readdir;
6362
- const fileReader18 = fsReadModule17["re"+"ad"+"Fi"+"le"];
6363
-
6364
- // ../remnic-core/src/entity-retrieval.ts
6365
- import { createHash as createHash8 } from "crypto";
6366
- import * as fsReadModule18 from "fs/promises";
6367
- const mkdir17 = fsReadModule18.mkdir;
6368
- const fileReader20 = fsReadModule18["re"+"ad"+"Fi"+"le"];
6369
- const writeFile17 = fsReadModule18.writeFile;
6370
- import path27 from "path";
6371
-
6372
- // ../remnic-core/src/native-knowledge.ts
6373
- import { createHash as createHash7 } from "crypto";
6374
- import path26 from "path";
6375
- import * as fsReadModule19 from "fs/promises";
6376
- const mkdir16 = fsReadModule19.mkdir;
6377
- const fileReader19 = fsReadModule19["re"+"ad"+"Fi"+"le"];
6378
- const readdir13 = fsReadModule19.readdir;
6379
- const stat10 = fsReadModule19.stat;
6380
- const writeFile16 = fsReadModule19.writeFile;
6381
-
6382
- // ../remnic-core/src/explicit-cue-recall.ts
6383
- var CONTENT_LEXICAL_CUE_STOPWORDS = /* @__PURE__ */ new Set([
6384
- "about",
6385
- "across",
6386
- "after",
6387
- "again",
6388
- "also",
6389
- "and",
6390
- "answer",
6391
- "answers",
6392
- "are",
6393
- "before",
6394
- "between",
6395
- "can",
6396
- "could",
6397
- "different",
6398
- "did",
6399
- "does",
6400
- "during",
6401
- "feature",
6402
- "features",
6403
- "from",
6404
- "have",
6405
- "help",
6406
- "how",
6407
- "implement",
6408
- "into",
6409
- "made",
6410
- "many",
6411
- "me",
6412
- "mention",
6413
- "my",
6414
- "need",
6415
- "only",
6416
- "order",
6417
- "over",
6418
- "project",
6419
- "question",
6420
- "questions",
6421
- "request",
6422
- "requests",
6423
- "show",
6424
- "tell",
6425
- "that",
6426
- "the",
6427
- "there",
6428
- "these",
6429
- "through",
6430
- "throughout",
6431
- "trying",
6432
- "want",
6433
- "were",
6434
- "what",
6435
- "when",
6436
- "which",
6437
- "with",
6438
- "would",
6439
- "you"
6440
- ]);
6441
- var CONTENT_LEXICAL_PHRASE_STOPWORDS = new Set(
6442
- [...CONTENT_LEXICAL_CUE_STOPWORDS].filter(
6443
- (word) => word !== "feature" && word !== "features" && word !== "implement"
6444
- )
6445
- );
6446
-
6447
- // ../remnic-core/src/tmt.ts
6448
- import * as fsReadModule20 from "fs/promises";
6449
- const mkdir18 = fsReadModule20.mkdir;
6450
- const fileReader21 = fsReadModule20["re"+"ad"+"Fi"+"le"];
6451
- const writeFile18 = fsReadModule20.writeFile;
6452
- const readdir14 = fsReadModule20.readdir;
6453
-
6454
- // ../remnic-core/src/objective-state.ts
6455
- import path28 from "path";
6456
- import { mkdir as mkdir19, writeFile as writeFile19 } from "fs/promises";
6457
-
6458
- // ../remnic-core/src/trust-zones.ts
6459
- import path29 from "path";
6460
- import { mkdir as mkdir20, writeFile as writeFile20 } from "fs/promises";
6461
-
6462
- // ../remnic-core/src/taxonomy/taxonomy-loader.ts
6463
- import * as fsReadModule21 from "fs/promises";
6464
- const fileReader22 = fsReadModule21["re"+"ad"+"Fi"+"le"];
6465
- const mkdir21 = fsReadModule21.mkdir;
6466
- const writeFile21 = fsReadModule21.writeFile;
6467
- import path30 from "path";
6468
-
6469
- // ../remnic-core/src/harmonic-retrieval.ts
6470
- import path33 from "path";
6471
-
6472
- // ../remnic-core/src/abstraction-nodes.ts
6473
- import path31 from "path";
6474
- import { mkdir as mkdir22, writeFile as writeFile22 } from "fs/promises";
6475
-
6476
- // ../remnic-core/src/cue-anchors.ts
6477
- import path32 from "path";
6478
- import { mkdir as mkdir23, writeFile as writeFile23 } from "fs/promises";
6479
-
6480
- // ../remnic-core/src/commitment-ledger.ts
6481
- import path34 from "path";
6482
- import { mkdir as mkdir24, unlink as unlink6, writeFile as writeFile24 } from "fs/promises";
6483
-
6484
- // ../remnic-core/src/work-product-ledger.ts
6485
- import path35 from "path";
6486
- import { mkdir as mkdir25, writeFile as writeFile25 } from "fs/promises";
6487
-
6488
- // ../remnic-core/src/lcm/schema.ts
6489
- import path36 from "path";
6490
- import { mkdir as mkdir26 } from "fs/promises";
6491
-
6492
- // ../remnic-core/src/explicit-capture.ts
6493
- import { randomUUID as randomUUID3 } from "crypto";
6494
-
6495
- // ../remnic-core/src/conversation-index/cleanup.ts
6496
- import { readdir as readdir15, rm as rm4 } from "fs/promises";
6497
- import path37 from "path";
6498
-
6499
- // ../remnic-core/src/namespaces/storage.ts
6500
- import path38 from "path";
6501
- import { access as access2 } from "fs/promises";
6502
-
6503
- // ../remnic-core/src/namespaces/principal.ts
6504
- function resolvePrincipal(sessionKey, config) {
6505
- if (!config.namespacesEnabled) return "default";
6506
- const sk = sessionKey ?? "";
6507
- const mode = config.principalFromSessionKeyMode;
6508
- const rules = config.principalFromSessionKeyRules ?? [];
6509
- if (!sk) return "default";
6510
- if (mode === "prefix") {
6511
- for (const r of rules) {
6512
- if (sk.startsWith(r.match)) return r.principal;
6513
- }
6514
- } else if (mode === "map") {
6515
- for (const r of rules) {
6516
- if (sk === r.match) return r.principal;
6517
- }
6518
- } else if (mode === "regex") {
6519
- for (const r of rules) {
6520
- try {
6521
- const re = new RegExp(r.match);
6522
- if (re.test(sk)) return r.principal;
6523
- } catch {
6524
- }
6525
- }
6526
- }
6527
- const parts = sk.split(":");
6528
- if (parts.length >= 2 && parts[0] === "agent") {
6529
- const agentId = parts[1];
6530
- if (agentId && agentId.length > 0) return agentId;
6531
- }
6532
- return "default";
6533
- }
6534
- function canReadNamespace(principal, namespace, config) {
6535
- if (!config.namespacesEnabled) return true;
6536
- const policy = config.namespacePolicies.find((p) => p.name === namespace);
6537
- if (!policy) return namespace === config.defaultNamespace || namespace === config.sharedNamespace;
6538
- return policy.readPrincipals.includes(principal) || policy.readPrincipals.includes("*");
6539
- }
6540
- function defaultNamespaceForPrincipal(principal, config) {
6541
- if (!config.namespacesEnabled) return config.defaultNamespace;
6542
- const exists = config.namespacePolicies.some((p) => p.name === principal);
6543
- return exists ? principal : config.defaultNamespace;
6544
- }
6545
-
6546
- // ../remnic-core/src/coding/git-context.ts
6547
- import path39 from "path";
6548
-
6549
- // ../remnic-core/src/routing/store.ts
6550
- import * as fsReadModule22 from "fs/promises";
6551
- const lstat5 = fsReadModule22.lstat;
6552
- const mkdir27 = fsReadModule22.mkdir;
6553
- const fileReader23 = fsReadModule22["re"+"ad"+"Fi"+"le"];
6554
- const realpath3 = fsReadModule22.realpath;
6555
- const rename2 = fsReadModule22.rename;
6556
- const rm5 = fsReadModule22.rm;
6557
- const stat11 = fsReadModule22.stat;
6558
- const writeFile26 = fsReadModule22.writeFile;
6559
- import path40 from "path";
6560
- import { createHash as createHash9 } from "crypto";
6561
-
6562
- // ../remnic-core/src/policy-runtime.ts
6563
- import path41 from "path";
6564
- import * as fsReadModule23 from "fs/promises";
6565
- const mkdir28 = fsReadModule23.mkdir;
6566
- const fileReader24 = fsReadModule23["re"+"ad"+"Fi"+"le"];
6567
- const rename3 = fsReadModule23.rename;
6568
- const writeFile27 = fsReadModule23.writeFile;
6569
-
6570
- // ../remnic-core/src/behavior-signals.ts
6571
- import { createHash as createHash10 } from "crypto";
6572
-
6573
- // ../remnic-core/src/orchestrator.ts
6574
- var COMPACTION_SIGNAL_MAX_AGE_MS = 60 * 60 * 1e3;
6575
-
6576
- // ../remnic-core/src/access-service.ts
6577
- import { stat as stat15 } from "fs/promises";
6578
- import * as nodeFs from "fs/promises";
6579
- import { constants as fsConstants } from "fs";
6580
- import { createHash as createHash14 } from "crypto";
6581
-
6582
- // ../remnic-core/src/access-idempotency.ts
6583
- import * as fsReadModule24 from "fs/promises";
6584
- const mkdir30 = fsReadModule24.mkdir;
6585
- const open4 = fsReadModule24.open;
6586
- const fileReader26 = fsReadModule24["re"+"ad"+"Fi"+"le"];
6587
- const rename4 = fsReadModule24.rename;
6588
- const stat13 = fsReadModule24.stat;
6589
- const unlink8 = fsReadModule24.unlink;
6590
- const utimes2 = fsReadModule24.utimes;
6591
- const writeFile29 = fsReadModule24.writeFile;
6592
- import path43 from "path";
6593
- import { createHash as createHash12 } from "crypto";
6594
-
6595
- // ../remnic-core/src/recall-audit.ts
6596
- import { appendFile as appendFile4, mkdir as mkdir31, readdir as readdir17, rm as rm6 } from "fs/promises";
6597
- import path44 from "path";
6598
-
6599
- // ../remnic-core/src/recall-audit-anomaly.ts
6600
- var DEFAULT_ANOMALY_DETECTOR_CONFIG = Object.freeze({
6601
- enabled: false,
6602
- windowMs: 5 * 6e4,
6603
- repeatQueryLimit: 5,
6604
- namespaceWalkLimit: 3,
6605
- highCardinalityReturnLimit: 50,
6606
- rapidFireLimit: 30
6607
- });
6608
-
6609
- // ../remnic-core/src/work/storage.ts
6610
- import path45 from "path";
6611
- import { randomUUID as randomUUID4 } from "crypto";
6612
- import * as fsReadModule25 from "fs/promises";
6613
- const mkdir32 = fsReadModule25.mkdir;
6614
- const readdir18 = fsReadModule25.readdir;
6615
- const fileReader27 = fsReadModule25["re"+"ad"+"Fi"+"le"];
6616
- const rm7 = fsReadModule25.rm;
6617
- const writeFile30 = fsReadModule25.writeFile;
6618
-
6619
- // ../remnic-core/src/cross-namespace-budget.ts
6620
- var DEFAULT_CROSS_NAMESPACE_BUDGET = Object.freeze({
6621
- enabled: false,
6622
- windowMs: 6e4,
6623
- softLimit: 10,
6624
- hardLimit: 30
6625
- });
6626
-
6627
- // ../remnic-core/src/access-service.ts
6628
- import * as nodePath from "path";
6629
-
6630
- // ../remnic-core/src/briefing.ts
6631
- import * as fsReadModule26 from "fs/promises";
6632
- const fileReader28 = fsReadModule26["re"+"ad"+"Fi"+"le"];
6633
- import os4 from "os";
6634
- import path46 from "path";
6635
- var DAY_MS = 24 * 60 * 60 * 1e3;
6636
- var MAX_WINDOW_MS = 100 * 365 * DAY_MS;
6637
-
6638
- // ../remnic-core/src/memory-worth-outcomes.ts
6639
- import path47 from "path";
6640
-
6641
- // ../remnic-core/src/objective-state-writers.ts
6642
- import crypto2 from "crypto";
6643
-
6644
- // ../remnic-core/src/offline-sync.ts
6645
- import { createHash as createHash13, randomUUID as randomUUID5 } from "crypto";
6646
- import { createReadStream } from "fs";
6647
- import * as fsReadModule27 from "fs/promises";
6648
- const lstat6 = fsReadModule27.lstat;
6649
- const mkdir33 = fsReadModule27.mkdir;
6650
- const open5 = fsReadModule27.open;
6651
- const readdir19 = fsReadModule27.readdir;
6652
- const fileReader29 = fsReadModule27["re"+"ad"+"Fi"+"le"];
6653
- const rename5 = fsReadModule27.rename;
6654
- const rm8 = fsReadModule27.rm;
6655
- const stat14 = fsReadModule27.stat;
6656
- const unlink9 = fsReadModule27.unlink;
6657
- const utimes3 = fsReadModule27.utimes;
6658
- const writeFile31 = fsReadModule27.writeFile;
6659
- import path48 from "path";
6660
- var OFFLINE_SYNC_FILE_CONTENT_MAX_CHUNK_BYTES = 64 * 1024 * 1024;
6661
- var OFFLINE_SYNC_FILE_CONTENT_TRANSFER_CHUNK_BYTES = 8 * 1024 * 1024;
6662
- var OFFLINE_SYNC_APPLY_MAX_BODY_BYTES = 16 * 1024 * 1024;
6663
- var OFFLINE_SYNC_SNAPSHOT_BASE_MAX_BODY_BYTES = 64 * 1024 * 1024;
6664
- var OFFLINE_SYNC_MAX_MTIME_MS = 864e13;
6665
- var OFFLINE_SYNC_UPLOAD_STAGING_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
6666
-
6667
- // ../remnic-core/src/action-confidence.ts
6668
- var ACTION_CONFIDENCE_RISK_CATEGORIES = [
6669
- "low",
6670
- "medium",
6671
- "high",
6672
- "irreversible",
6673
- "restricted"
6674
- ];
6675
- var ACTION_CONFIDENCE_CONTEXT_READINESS = [
6676
- "none",
6677
- "partial",
6678
- "sufficient"
6679
- ];
6680
- var ACTION_CONFIDENCE_RULE_KINDS = [
6681
- "ask-before",
6682
- "do-not-use-outside-this-context",
6683
- "never",
6684
- "requires-escalation"
6685
- ];
6686
-
6687
- // ../remnic-core/src/access-http.ts
6688
- import { createServer } from "http";
6689
- import { randomUUID as randomUUID7, timingSafeEqual } from "crypto";
6690
- import { AsyncLocalStorage } from "async_hooks";
6691
- import { existsSync as existsSync4 } from "fs";
6692
- import * as fsReadModule28 from "fs/promises";
6693
- const fileReader32 = fsReadModule28["re"+"ad"+"Fi"+"le"];
6694
- import path49 from "path";
6695
- import { fileURLToPath as fileURLToPath3, URL as URL2 } from "url";
6696
-
6697
- // ../remnic-core/src/access-mcp.ts
6698
- import * as fsReadModule29 from "fs/promises";
6699
- const fileReader31 = fsReadModule29["re"+"ad"+"Fi"+"le"];
6700
- import { randomUUID as randomUUID6 } from "crypto";
6701
-
6702
- // ../remnic-core/src/access-schema.ts
6703
- var namespaceSchema = external_exports.string().trim().max(256).optional();
6704
- var sessionKeySchema = external_exports.string().trim().min(1).max(512).optional();
6705
- var idempotencyKeySchema = external_exports.string().trim().min(1).max(256).optional();
6706
- var dryRunSchema = external_exports.boolean().optional();
6707
- var schemaVersionSchema = external_exports.number().int().optional();
6708
- var codingContextSchema = external_exports.object({
6709
- projectId: external_exports.string().trim().min(1, "codingContext.projectId is required").max(128),
6710
- branch: external_exports.string().trim().max(256).nullable(),
6711
- rootPath: external_exports.string().trim().min(1, "codingContext.rootPath is required").max(1024),
6712
- defaultBranch: external_exports.string().trim().max(256).nullable()
6713
- }).nullable();
6714
- var recallDisclosureSchema = external_exports.enum(["chunk", "section", "raw"]);
6715
- var tagMatchSchema = external_exports.enum(["any", "all"]);
6716
- var recallRequestSchema = external_exports.object({
6717
- query: external_exports.string().min(1, "query is required"),
6718
- sessionKey: sessionKeySchema,
6719
- namespace: namespaceSchema,
6720
- topK: external_exports.number().int().min(0).max(200).optional(),
6721
- mode: external_exports.enum(["auto", "no_recall", "minimal", "full", "graph_mode"]).optional(),
6722
- includeDebug: external_exports.boolean().optional(),
6723
- idempotencyKey: idempotencyKeySchema,
6724
- disclosure: recallDisclosureSchema.optional(),
6725
- codingContext: codingContextSchema.optional(),
6726
- /** Working directory for auto git-context resolution (issue #569). */
6727
- cwd: external_exports.string().trim().min(1, "cwd must be non-empty when provided").max(2048).optional(),
6728
- /**
6729
- * Arbitrary project tag for non-git-based project scoping (issue #569).
6730
- * Creates a coding context with `projectId: "tag:<projectTag>"`.
6731
- */
6732
- projectTag: external_exports.string().trim().min(1, "projectTag must be non-empty when provided").max(256).optional(),
6733
- /**
6734
- * Historical recall pin (issue #680). ISO 8601 timestamp. The
6735
- * schema only enforces the basic shape; the access service runs
6736
- * `Date.parse` and emits a structured 400 on malformed input
6737
- * (CLAUDE.md rule 51).
6738
- */
6739
- asOf: external_exports.string().trim().min(1, "asOf must be a non-empty ISO 8601 timestamp").max(64).optional(),
6740
- /**
6741
- * Free-form recall tag filter (issue #689). When provided, recall results
6742
- * whose frontmatter `tags` do not match the filter are removed before the
6743
- * response is returned. Comparison is case-sensitive exact match.
6744
- */
6745
- tags: external_exports.array(external_exports.string().trim().min(1).max(256)).max(50).optional(),
6746
- /**
6747
- * Match mode for `tags` (issue #689). Defaults to `"any"` when `tags` is
6748
- * provided and `tagMatch` is omitted. Ignored when `tags` is absent.
6749
- */
6750
- tagMatch: tagMatchSchema.optional(),
6751
- /**
6752
- * Include graph edges below `graphTraversalConfidenceFloor` for diagnostic
6753
- * recall traversal (issue #681). Defaults to false.
6754
- */
6755
- includeLowConfidence: external_exports.boolean().optional()
6756
- });
6757
- var recallExplainRequestSchema = external_exports.object({
6758
- sessionKey: sessionKeySchema,
6759
- namespace: namespaceSchema
6760
- });
6761
- var setCodingContextRequestSchema = external_exports.object({
6762
- sessionKey: external_exports.string().trim().min(1, "sessionKey is required").max(512),
6763
- codingContext: codingContextSchema
6764
- });
6765
- var messageSchema = external_exports.object({
6766
- role: external_exports.enum(["user", "assistant"]),
6767
- content: external_exports.string().min(1, "message content must be non-empty"),
6768
- sourceFormat: external_exports.enum(["openai", "anthropic", "openclaw", "pi", "lossless-claw", "remnic"]).nullable().optional(),
6769
- rawContent: external_exports.unknown().nullable().optional(),
6770
- parts: external_exports.array(
6771
- external_exports.object({
6772
- ordinal: external_exports.number().int().min(0).nullable().optional(),
6773
- kind: external_exports.enum([
6774
- "text",
6775
- "tool_call",
6776
- "tool_result",
6777
- "patch",
6778
- "file_read",
6779
- "file_write",
6780
- "step_start",
6781
- "step_finish",
6782
- "snapshot",
6783
- "retry"
6784
- ]),
6785
- payload: external_exports.record(external_exports.string(), external_exports.unknown()),
6786
- toolName: external_exports.string().nullable().optional(),
6787
- tool_name: external_exports.string().nullable().optional(),
6788
- filePath: external_exports.string().nullable().optional(),
6789
- file_path: external_exports.string().nullable().optional(),
6790
- createdAt: external_exports.string().nullable().optional(),
6791
- created_at: external_exports.string().nullable().optional()
6792
- })
6793
- ).nullable().optional()
6794
- });
6795
- var observeRequestSchema = external_exports.object({
6796
- sessionKey: external_exports.string().trim().min(1, "sessionKey is required").max(512),
6797
- messages: external_exports.array(messageSchema).min(1, "messages must be a non-empty array"),
6798
- namespace: namespaceSchema,
6799
- skipExtraction: external_exports.boolean().optional(),
6800
- /** Working directory for auto git-context resolution (issue #569). */
6801
- cwd: external_exports.string().trim().min(1, "cwd must be non-empty when provided").max(2048).optional(),
6802
- /**
6803
- * Arbitrary project tag for non-git-based project scoping (issue #569).
6804
- * Creates a coding context with `projectId: "tag:<projectTag>"`.
6805
- */
6806
- projectTag: external_exports.string().trim().min(1, "projectTag must be non-empty when provided").max(256).optional()
6807
- });
6808
- var writeContentSchema = external_exports.string().min(1, "content is required").max(5e4);
6809
- var categorySchema = external_exports.enum([
6810
- "fact",
6811
- "preference",
6812
- "correction",
6813
- "entity",
6814
- "decision",
6815
- "relationship",
6816
- "principle",
6817
- "commitment",
6818
- "moment",
6819
- "skill",
6820
- "rule",
6821
- "procedure",
6822
- "reasoning_trace"
6823
- ]).optional();
6824
- var confidenceSchema = external_exports.number().min(0).max(1).optional();
6825
- var tagsSchema = external_exports.array(external_exports.string().max(256)).max(50).optional();
6826
- var entityRefSchema = external_exports.string().trim().max(512).optional();
6827
- var ttlSchema = external_exports.string().trim().max(128).optional();
6828
- var sourceReasonSchema = external_exports.string().trim().max(2e3).optional();
6829
- var memoryStoreRequestSchema = external_exports.object({
6830
- schemaVersion: schemaVersionSchema,
6831
- idempotencyKey: idempotencyKeySchema,
6832
- dryRun: dryRunSchema,
6833
- sessionKey: sessionKeySchema,
6834
- content: writeContentSchema,
6835
- category: categorySchema,
6836
- confidence: confidenceSchema,
6837
- namespace: namespaceSchema,
6838
- tags: tagsSchema,
6839
- entityRef: entityRefSchema,
6840
- ttl: ttlSchema,
6841
- sourceReason: sourceReasonSchema
6842
- });
6843
- var reviewDispositionRequestSchema = external_exports.object({
6844
- memoryId: external_exports.string().trim().min(1, "memoryId is required"),
6845
- status: external_exports.enum([
6846
- "active",
6847
- "pending_review",
6848
- "quarantined",
6849
- "rejected",
6850
- "superseded",
6851
- "archived"
6852
- ]),
6853
- reasonCode: external_exports.string().trim().min(1, "reasonCode is required"),
6854
- namespace: namespaceSchema
6855
- });
6856
- var trustZonePromoteRequestSchema = external_exports.object({
6857
- recordId: external_exports.string().trim().min(1, "recordId is required"),
6858
- targetZone: external_exports.enum(["working", "trusted"], {
6859
- errorMap: () => ({ message: "targetZone must be 'working' or 'trusted'" })
6860
- }),
6861
- promotionReason: external_exports.string().trim().min(1, "promotionReason is required"),
6862
- recordedAt: external_exports.string().trim().optional(),
6863
- summary: external_exports.string().trim().max(5e3).optional(),
6864
- dryRun: dryRunSchema,
6865
- namespace: namespaceSchema
6866
- });
6867
- var trustZoneDemoSeedRequestSchema = external_exports.object({
6868
- scenario: external_exports.string().trim().max(256).optional(),
6869
- recordedAt: external_exports.string().trim().optional(),
6870
- dryRun: dryRunSchema,
6871
- namespace: namespaceSchema
6872
- });
6873
- var lcmSearchRequestSchema = external_exports.object({
6874
- query: external_exports.string().min(1, "query is required"),
6875
- sessionKey: sessionKeySchema,
6876
- namespace: namespaceSchema,
6877
- limit: external_exports.number().int().min(1).max(100).optional()
6878
- });
6879
- var lcmCompactionFlushRequestSchema = external_exports.object({
6880
- sessionKey: external_exports.string().trim().min(1, "sessionKey is required").max(512),
6881
- namespace: namespaceSchema
6882
- });
6883
- var lcmCompactionRecordRequestSchema = external_exports.object({
6884
- sessionKey: external_exports.string().trim().min(1, "sessionKey is required").max(512),
6885
- namespace: namespaceSchema,
6886
- tokensBefore: external_exports.number().int().min(0, "tokensBefore must be a non-negative integer"),
6887
- tokensAfter: external_exports.number().int().min(0, "tokensAfter must be a non-negative integer")
6888
- });
6889
- var daySummaryRequestSchema = external_exports.object({
6890
- memories: external_exports.string().max(1e5).optional(),
6891
- sessionKey: sessionKeySchema,
6892
- namespace: namespaceSchema
6893
- });
6894
- var capsuleTopLevelSegmentSchema = external_exports.string().trim().min(1).max(128).refine(
6895
- (value) => !value.includes("/") && !value.includes("\\"),
6896
- "must be a top-level directory name without path separators"
6897
- );
6898
- var capsulePeerIdSchema = external_exports.string().trim().min(1).max(256).refine(
6899
- (value) => value !== "." && value !== ".." && !value.includes("/") && !value.includes("\\"),
6900
- "must be a plain peer id without path separators"
6901
- );
6902
- var capsuleIsoSinceSchema = external_exports.string().trim().min(1, "since must be a non-empty ISO 8601 timestamp").max(128).refine(
6903
- isValidCapsuleSince,
6904
- "since must be a valid ISO 8601 timestamp with no calendar overflow"
6905
- );
6906
- var capsuleExportRequestSchema = external_exports.object({
6907
- name: external_exports.string().trim().min(1, "name is required").max(64, "name must be 64 characters or fewer").regex(
6908
- CAPSULE_ID_PATTERN,
6909
- "name must be alphanumeric with single dashes (no spaces, no leading/trailing dashes)"
6910
- ),
6911
- namespace: namespaceSchema,
6912
- since: capsuleIsoSinceSchema.optional(),
6913
- includeKinds: external_exports.array(capsuleTopLevelSegmentSchema).max(50).optional(),
6914
- peerIds: external_exports.array(capsulePeerIdSchema).max(100).optional(),
6915
- includeTranscripts: external_exports.boolean().optional(),
6916
- encrypt: external_exports.boolean().optional()
6917
- });
6918
- var capsuleImportRequestSchema = external_exports.object({
6919
- archivePath: external_exports.string().trim().min(1, "archivePath is required").max(4096),
6920
- namespace: namespaceSchema,
6921
- mode: external_exports.enum(["skip", "overwrite", "fork"]).optional()
6922
- });
6923
- var capsuleListRequestSchema = external_exports.object({
6924
- namespace: namespaceSchema
6925
- });
6926
- function isValidOfflineSyncPath(value) {
6927
- try {
6928
- validateArchiveRelativePath(value, "path");
6929
- return true;
6930
- } catch {
6931
- return false;
6932
- }
6933
- }
6934
- var offlineSyncPathSchema = external_exports.string().trim().min(1, "path must be non-empty").max(4096).refine(
6935
- isValidOfflineSyncPath,
6936
- "path must be a POSIX relative path without unsafe segments"
6937
- );
6938
- var offlineSyncFileStateSchema = external_exports.object({
6939
- path: offlineSyncPathSchema,
6940
- sha256: external_exports.string().regex(/^[a-f0-9]{64}$/i, "sha256 must be a 64-character hex digest"),
6941
- bytes: external_exports.number().int().min(0),
6942
- mtimeMs: external_exports.number().finite().min(0).max(OFFLINE_SYNC_MAX_MTIME_MS)
6943
- });
6944
- var offlineSyncBaseCapturedAtSchema = external_exports.string().trim().min(1, "baseCapturedAt must be non-empty when provided").max(64).refine((value) => Number.isFinite(Date.parse(value)), {
6945
- message: "baseCapturedAt must be a valid ISO 8601 timestamp"
6946
- });
6947
- var offlineSyncSnapshotRequestSchema = external_exports.object({
6948
- namespace: namespaceSchema,
6949
- includeTranscripts: external_exports.boolean().optional(),
6950
- includeContent: external_exports.boolean().optional(),
6951
- baseCapturedAt: offlineSyncBaseCapturedAtSchema.optional(),
6952
- baseFiles: external_exports.array(offlineSyncFileStateSchema).max(3e5, "baseFiles must contain 300000 or fewer entries").optional()
6953
- });
6954
- var offlineSyncApplyRequestSchema = external_exports.object({
6955
- namespace: namespaceSchema,
6956
- changeset: external_exports.unknown(),
6957
- returnCurrentFiles: external_exports.boolean().optional()
6958
- }).refine((value) => value.changeset !== void 0 && value.changeset !== null, {
6959
- message: "changeset is required",
6960
- path: ["changeset"]
6961
- });
6962
- var offlineSyncFilesRequestSchema = external_exports.object({
6963
- namespace: namespaceSchema,
6964
- includeTranscripts: external_exports.boolean().optional(),
6965
- paths: external_exports.array(offlineSyncPathSchema).max(5e3, "paths must contain 5000 or fewer entries")
6966
- });
6967
- var offlineSyncFileContentRequestSchema = external_exports.object({
6968
- namespace: namespaceSchema,
6969
- includeTranscripts: external_exports.boolean().optional(),
6970
- path: offlineSyncPathSchema,
6971
- offset: external_exports.number().int().min(0).optional(),
6972
- length: external_exports.number().int().min(1).max(OFFLINE_SYNC_FILE_CONTENT_MAX_CHUNK_BYTES).optional()
6973
- });
6974
- var nullableOptional = (schema) => schema.optional().nullable().transform((value) => value ?? void 0);
6975
- var actionConfidenceRuleSchema = external_exports.object({
6976
- kind: external_exports.enum(ACTION_CONFIDENCE_RULE_KINDS),
6977
- description: nullableOptional(external_exports.string().trim().min(1).max(2e3)),
6978
- matched: nullableOptional(external_exports.boolean())
6979
- }).strict();
6980
- var actionConfidenceMemorySchema = external_exports.object({
6981
- source: nullableOptional(external_exports.string().trim().min(1).max(256)),
6982
- created: nullableOptional(external_exports.string().trim().min(1).max(128)),
6983
- updated: nullableOptional(external_exports.string().trim().min(1).max(128)),
6984
- scope: nullableOptional(external_exports.string().trim().min(1).max(512)),
6985
- userContextScopes: nullableOptional(external_exports.array(external_exports.string().trim().min(1).max(128)).max(50)),
6986
- retrievalReason: nullableOptional(external_exports.string().trim().min(1).max(2e3)),
6987
- confidence: nullableOptional(external_exports.number().min(0).max(1)),
6988
- stale: nullableOptional(external_exports.boolean()),
6989
- corrected: nullableOptional(external_exports.boolean()),
6990
- correctionState: nullableOptional(external_exports.enum(["none", "correction", "superseded", "disputed", "forgotten"])),
6991
- safeToUse: nullableOptional(external_exports.boolean()),
6992
- safety: nullableOptional(external_exports.enum(["safe", "requires-review", "blocked"])),
6993
- safetyReasons: nullableOptional(external_exports.array(external_exports.string().trim().min(1).max(1e3)).max(50))
6994
- }).strict();
6995
- var actionConfidenceRequestSchema = external_exports.object({
6996
- intendedAction: nullableOptional(external_exports.string().trim().min(1).max(1e3)),
6997
- confidence: nullableOptional(external_exports.number().min(0).max(1)),
6998
- risk: nullableOptional(external_exports.enum(ACTION_CONFIDENCE_RISK_CATEGORIES)),
6999
- contextReadiness: nullableOptional(external_exports.enum(ACTION_CONFIDENCE_CONTEXT_READINESS)),
7000
- currentContextScopes: nullableOptional(external_exports.array(external_exports.string().trim().min(1).max(128)).max(50)),
7001
- userRules: nullableOptional(external_exports.array(actionConfidenceRuleSchema).max(100)),
7002
- retrievedMemories: nullableOptional(external_exports.array(actionConfidenceMemorySchema).max(200))
7003
- }).strict();
7004
-
7005
- // ../remnic-core/src/mcp-memory-inspector-app.ts
7006
- var REMNIC_CHATGPT_MEMORY_INSPECTOR_WIDGET_HTML = `
7007
- <div id="root" class="remnic-app">Loading Remnic memory inspector...</div>
7008
- <style>
7009
- :root {
7010
- color-scheme: light dark;
7011
- --bg: #f8faf8;
7012
- --panel: #ffffff;
7013
- --text: #17201b;
7014
- --muted: #56635b;
7015
- --line: #d8e0da;
7016
- --accent: #2f7d57;
7017
- --warn: #9a5b14;
7018
- --bad: #9c2b2b;
7019
- }
7020
- @media (prefers-color-scheme: dark) {
7021
- :root {
7022
- --bg: #101512;
7023
- --panel: #18201b;
7024
- --text: #edf4ef;
7025
- --muted: #a8b6ad;
7026
- --line: #304036;
7027
- --accent: #75c79a;
7028
- --warn: #e0ad63;
7029
- --bad: #f08a8a;
7030
- }
7031
- }
7032
- body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
7033
- .remnic-app { padding: 14px; display: grid; gap: 12px; }
7034
- .header, .section, .memory { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
7035
- .title { font-size: 16px; font-weight: 650; margin: 0; }
7036
- .muted { color: var(--muted); }
7037
- .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
7038
- .pill { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; margin: 2px 4px 2px 0; color: var(--muted); }
7039
- .safe { color: var(--accent); }
7040
- .review { color: var(--warn); }
7041
- .blocked { color: var(--bad); }
7042
- .memory { display: grid; gap: 8px; }
7043
- .memory-title { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-weight: 650; }
7044
- .preview { white-space: pre-wrap; overflow-wrap: anywhere; }
7045
- .actions { display: flex; flex-wrap: wrap; gap: 8px; }
7046
- button { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 6px; padding: 6px 9px; font: inherit; cursor: pointer; }
7047
- button:hover { border-color: var(--accent); }
7048
- pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; color: var(--muted); }
7049
- </style>
7050
- <script>
7051
- const root = document.getElementById("root");
7052
-
7053
- function escapeHtml(value) {
7054
- return String(value ?? "").replace(/[&<>"']/g, (char) => ({
7055
- "&": "&amp;",
7056
- "<": "&lt;",
7057
- ">": "&gt;",
7058
- '"': "&quot;",
7059
- "'": "&#39;",
7060
- }[char]));
7061
- }
7062
-
7063
- function statusClass(value) {
7064
- if (value === "blocked" || value === false) return "blocked";
7065
- if (value === "requires-review") return "review";
7066
- return "safe";
7067
- }
7068
-
7069
- function followUp(prompt) {
7070
- if (window.openai?.sendFollowUpMessage) {
7071
- window.openai.sendFollowUpMessage({ prompt, scrollToBottom: true });
7072
- return;
7073
- }
7074
- window.parent.postMessage({
7075
- jsonrpc: "2.0",
7076
- method: "ui/message",
7077
- params: {
7078
- role: "user",
7079
- content: [{ type: "text", text: prompt }],
7080
- },
7081
- }, "*");
7082
- }
7083
-
7084
- function actionButtons(actions) {
7085
- return (actions ?? []).map((action) =>
7086
- '<button type="button" data-prompt="' + escapeHtml(action.followUpPrompt) + '">' +
7087
- escapeHtml(action.label) +
7088
- '</button>'
7089
- ).join("");
7090
- }
7091
-
7092
- function render(payload) {
7093
- const data = payload?.structuredContent ?? payload ?? window.openai?.toolOutput ?? {};
7094
- const confidence = data.actionConfidence ?? {};
7095
- const memories = Array.isArray(data.memories) ? data.memories : [];
7096
- root.innerHTML = [
7097
- '<section class="header">',
7098
- '<p class="title">Remnic Memory Inspector</p>',
7099
- '<div class="muted">' + escapeHtml(data.query ?? "No query") + '</div>',
7100
- '<div class="grid">',
7101
- '<div><strong>Namespace</strong><br><span class="muted">' + escapeHtml(data.namespace ?? "default") + '</span></div>',
7102
- '<div><strong>Decision</strong><br><span class="' + statusClass(confidence.decision) + '">' + escapeHtml(confidence.decision ?? "unknown") + '</span></div>',
7103
- '<div><strong>Memories</strong><br><span class="muted">' + escapeHtml(data.memoryCount ?? memories.length) + '</span></div>',
7104
- '</div>',
7105
- '</section>',
7106
- '<section class="section">',
7107
- '<strong>Safe recall preview</strong>',
7108
- '<pre>' + escapeHtml(data.safeRecallPreview ?? "") + '</pre>',
7109
- '</section>',
7110
- '<section class="section actions">',
7111
- actionButtons(data.affordances),
7112
- '</section>',
7113
- memories.map((memory) => [
7114
- '<article class="memory">',
7115
- '<div class="memory-title"><span>' + escapeHtml(memory.id) + '</span><span class="' + statusClass(memory.safety) + '">' + escapeHtml(memory.safety ?? "safe") + '</span></div>',
7116
- '<div class="preview">' + escapeHtml(memory.preview ?? "") + '</div>',
7117
- '<div>',
7118
- '<span class="pill">source ' + escapeHtml(memory.source ?? "unknown") + '</span>',
7119
- '<span class="pill">scope ' + escapeHtml(memory.scope ?? "unknown") + '</span>',
7120
- '<span class="pill">reason ' + escapeHtml(memory.retrievalReason ?? memory.servedBy ?? "unknown") + '</span>',
7121
- '<span class="pill">confidence ' + escapeHtml(memory.confidence ?? "n/a") + '</span>',
7122
- '</div>',
7123
- '<div class="muted">' + escapeHtml((memory.safetyReasons ?? []).join("; ")) + '</div>',
7124
- '</article>',
7125
- ].join("")).join(""),
7126
- ].join("");
7127
-
7128
- root.querySelectorAll("button[data-prompt]").forEach((button) => {
7129
- button.addEventListener("click", () => followUp(button.getAttribute("data-prompt") ?? ""));
7130
- });
7131
- }
7132
-
7133
- render(window.openai?.toolOutput);
7134
-
7135
- window.addEventListener("message", (event) => {
7136
- if (event.source !== window.parent) return;
7137
- const message = event.data;
7138
- if (!message || message.jsonrpc !== "2.0") return;
7139
- if (message.method === "ui/notifications/tool-result") {
7140
- render(message.params);
7141
- }
7142
- }, { passive: true });
7143
-
7144
- window.addEventListener("openai:set_globals", (event) => {
7145
- render(event.detail?.globals?.toolOutput ?? window.openai?.toolOutput);
7146
- }, { passive: true });
7147
- </script>
7148
- `.trim();
7149
-
7150
- // ../remnic-core/src/access-http.ts
7151
- function resolveDefaultAdminConsolePublicDir() {
7152
- const thisDir = path49.dirname(fileURLToPath3(import.meta.url));
7153
- const candidates = [
7154
- // Standard: admin-console sibling to src/ (development layout)
7155
- path49.resolve(thisDir, "../admin-console/public"),
7156
- // Bundled: admin-console inside dist/ alongside the bundle
7157
- path49.resolve(thisDir, "./admin-console/public"),
7158
- // Package root: walk up from dist/ to the package root
7159
- path49.resolve(thisDir, "../../admin-console/public")
7160
- ];
7161
- return candidates.find((candidate) => existsSync4(candidate)) ?? candidates[0];
7162
- }
7163
- var defaultAdminConsolePublicDir = resolveDefaultAdminConsolePublicDir();
7164
- var correlationIdStore = new AsyncLocalStorage();
7165
-
7166
- // ../remnic-core/src/whitespace.ts
7167
- function collapseWhitespace(value) {
7168
- return value.replace(/\s+/g, " ").trim();
7169
- }
7170
- function truncateCodePointSafe(value, maxChars) {
7171
- const glyphs = Array.from(value);
7172
- if (maxChars <= 0) return "";
7173
- if (glyphs.length <= maxChars) return value;
7174
- return glyphs.slice(0, Math.max(1, maxChars)).join("").trimEnd();
7175
- }
7176
-
7177
- // ../remnic-core/src/active-memory-bridge.ts
7178
- function isArtifactPath(value) {
7179
- return typeof value === "string" && /(?:^|[\\/])artifacts(?:[\\/]|$)/i.test(value);
7180
- }
7181
- function clampLimit(value) {
7182
- if (typeof value !== "number" || !Number.isFinite(value)) return 8;
7183
- return Math.max(1, Math.min(50, Math.floor(value)));
7184
- }
7185
- function truncateSnippet(value, maxChars) {
7186
- const compact = collapseWhitespace(value);
7187
- return truncateCodePointSafe(compact, maxChars);
7188
- }
7189
- function pickMetadata(value) {
7190
- if (!value) return void 0;
7191
- const metadata = {};
7192
- if (typeof value.type === "string") metadata.type = value.type;
7193
- if (typeof value.topic === "string") metadata.topic = value.topic;
7194
- if (typeof value.updatedAt === "string") metadata.updatedAt = value.updatedAt;
7195
- if (typeof value.sourceUri === "string") metadata.sourceUri = value.sourceUri;
7196
- return Object.keys(metadata).length > 0 ? metadata : void 0;
7197
- }
7198
- function resolveActiveMemoryNamespace(orchestrator, sessionKey, requestedNamespace) {
7199
- const explicitNamespace = typeof requestedNamespace === "string" && requestedNamespace.trim().length > 0 ? requestedNamespace.trim() : void 0;
7200
- const config = orchestrator.config;
7201
- if (config?.namespacesEnabled === false) {
7202
- if (typeof orchestrator.resolveSelfNamespace === "function") {
7203
- return orchestrator.resolveSelfNamespace(sessionKey);
7204
- }
7205
- return "default";
7206
- }
7207
- if (!config) {
7208
- if (explicitNamespace) return explicitNamespace;
7209
- if (typeof orchestrator.resolveSelfNamespace === "function") {
7210
- return orchestrator.resolveSelfNamespace(sessionKey);
7211
- }
7212
- return "default";
7213
- }
7214
- const principal = typeof orchestrator.resolvePrincipal === "function" ? orchestrator.resolvePrincipal(sessionKey) : resolvePrincipal(sessionKey, config);
7215
- if (explicitNamespace) {
7216
- if (!canReadNamespace(principal, explicitNamespace, config)) {
7217
- throw new Error(`namespace ${explicitNamespace} is not readable for principal ${principal}`);
7218
- }
7219
- return explicitNamespace;
7220
- }
7221
- if (typeof orchestrator.resolveSelfNamespace === "function") {
7222
- return orchestrator.resolveSelfNamespace(sessionKey);
7223
- }
7224
- return defaultNamespaceForPrincipal(principal, config);
7225
- }
7226
- async function recallForActiveMemory(orchestrator, params) {
7227
- const limit = clampLimit(params.limit);
7228
- const requestedResults = Math.min(200, limit + 20);
7229
- const snippetMaxChars = typeof params.snippetMaxChars === "number" && Number.isFinite(params.snippetMaxChars) ? Math.max(1, Math.min(4e3, Math.floor(params.snippetMaxChars))) : 600;
7230
- const namespace = resolveActiveMemoryNamespace(
7231
- orchestrator,
7232
- params.sessionKey,
7233
- typeof params.filters?.namespace === "string" ? params.filters.namespace : void 0
7234
- );
7235
- const raw = await orchestrator.searchAcrossNamespaces({
7236
- query: params.query,
7237
- maxResults: requestedResults,
7238
- namespaces: [namespace],
7239
- mode: "search"
7240
- });
7241
- const visible = raw.filter((candidate) => !isArtifactPath(candidate.path));
7242
- return {
7243
- results: visible.slice(0, limit).map((candidate, index) => ({
7244
- id: candidate.id ?? candidate.path ?? `memory-${index + 1}`,
7245
- score: typeof candidate.score === "number" ? candidate.score : 0,
7246
- text: truncateSnippet(candidate.snippet ?? candidate.text ?? "", snippetMaxChars),
7247
- metadata: pickMetadata(candidate.metadata)
7248
- })),
7249
- truncated: visible.length > limit
7250
- };
7251
- }
7252
- function buildActiveMemoryMetadataFromMemory(memory) {
7253
- const metadata = {};
7254
- if (typeof memory.frontmatter.category === "string") {
7255
- const category = memory.frontmatter.category;
7256
- if (category === "fact" || category === "preference") {
7257
- metadata.type = category;
7258
- }
7259
- }
7260
- if (Array.isArray(memory.frontmatter.tags) && memory.frontmatter.tags.length > 0) {
7261
- metadata.topic = memory.frontmatter.tags[0];
7262
- }
7263
- if (typeof memory.frontmatter.updated === "string") metadata.updatedAt = memory.frontmatter.updated;
7264
- if (typeof memory.frontmatter.source === "string") metadata.sourceUri = memory.frontmatter.source;
7265
- return Object.keys(metadata).length > 0 ? metadata : void 0;
7266
- }
7267
- async function getMemoryForActiveMemory(orchestrator, id, options = {}) {
7268
- const namespace = resolveActiveMemoryNamespace(
7269
- orchestrator,
7270
- options.sessionKey,
7271
- options.namespace
7272
- );
7273
- const storage = typeof orchestrator.getStorageForNamespace === "function" ? await orchestrator.getStorageForNamespace(namespace) : orchestrator.storage;
7274
- const memory = await storage?.getMemoryById?.(id);
7275
- if (!memory) return { error: "not_found" };
7276
- return {
7277
- id,
7278
- text: collapseWhitespace(memory.content),
7279
- metadata: buildActiveMemoryMetadataFromMemory(memory)
7280
- };
7281
- }
7282
-
7283
- // ../remnic-core/src/binary-lifecycle/types.ts
7284
- var DEFAULT_MAX_BINARY_SIZE_BYTES = 50 * 1024 * 1024;
7285
-
7286
- // ../remnic-core/src/binary-lifecycle/backend.ts
7287
- import fs3 from "fs";
7288
- import fsp2 from "fs/promises";
7289
- import path50 from "path";
7290
-
7291
- // ../remnic-core/src/binary-lifecycle/scanner.ts
7292
- import fsp3 from "fs/promises";
7293
- import path51 from "path";
7294
-
7295
- // ../remnic-core/src/binary-lifecycle/manifest.ts
7296
- import fsp4 from "fs/promises";
7297
- import path52 from "path";
7298
- import crypto3 from "crypto";
7299
-
7300
- // ../remnic-core/src/binary-lifecycle/pipeline.ts
7301
- import fsp5 from "fs/promises";
7302
- import path53 from "path";
7303
- import crypto4 from "crypto";
7304
-
7305
- // ../remnic-core/src/projection/index.ts
7306
- import fs4 from "fs";
7307
- import path55 from "path";
7308
-
7309
- // ../remnic-core/src/utils/category-dir.ts
7310
- import path54 from "path";
7311
- var CATEGORY_DIR_MAP = {
7312
- correction: "corrections",
7313
- question: "questions",
7314
- preference: "preferences",
7315
- decision: "decisions",
7316
- moment: "moments",
7317
- commitment: "commitments",
7318
- principle: "principles",
7319
- rule: "rules",
7320
- skill: "skills",
7321
- relationship: "relationships",
7322
- procedure: "procedures",
7323
- reasoning_trace: "reasoning-traces"
7324
- };
7325
- var ALL_CATEGORY_DIRS = [
7326
- "facts",
7327
- ...Object.values(CATEGORY_DIR_MAP)
7328
- ];
7329
- var ALL_CATEGORY_KEYS = [
7330
- "fact",
7331
- ...Object.keys(CATEGORY_DIR_MAP)
7332
- ];
7333
-
7334
- // ../remnic-core/src/onboarding/index.ts
7335
- import fs5 from "fs";
7336
- import path56 from "path";
7337
-
7338
- // ../remnic-core/src/curation/index.ts
7339
- import fs6 from "fs";
7340
- import path57 from "path";
7341
- import crypto5 from "crypto";
7342
-
7343
- // ../remnic-core/src/dedup/index.ts
7344
- import fs7 from "fs";
7345
- import path58 from "path";
7346
- import crypto6 from "crypto";
7347
-
7348
- // ../remnic-core/src/review/index.ts
7349
- import fs8 from "fs";
7350
- import path59 from "path";
7351
-
7352
- // ../remnic-core/src/sync/index.ts
7353
- import fs9 from "fs";
7354
- import path60 from "path";
7355
- import crypto7 from "crypto";
7356
-
7357
- // ../remnic-core/src/connectors/index.ts
7358
- import fs12 from "fs";
7359
- import path63 from "path";
7360
- import os5 from "os";
7361
- import { createRequire as createRequire2 } from "module";
7362
- import { fileURLToPath as fileURLToPath4 } from "url";
7363
-
7364
- // ../remnic-core/src/tokens.ts
7365
- import fs10 from "fs";
7366
- import path61 from "path";
7367
- import { randomBytes as randomBytes2, randomUUID as randomUUID8 } from "crypto";
7368
-
7369
- // ../remnic-core/src/connectors/codex-marketplace.ts
7370
- import fs11 from "fs";
7371
- import path62 from "path";
7372
-
7373
- // ../remnic-core/src/spaces/index.ts
7374
- import fs13 from "fs";
7375
- import path64 from "path";
7376
- import crypto8 from "crypto";
7377
-
7378
- // ../remnic-core/src/memory-extension/codex-publisher.ts
7379
- import fs14 from "fs";
7380
- import os6 from "os";
7381
- import path65 from "path";
7382
-
7383
- // ../remnic-core/src/enrichment/audit.ts
7384
- import * as fsReadModule30 from "fs/promises";
7385
- const mkdir34 = fsReadModule30.mkdir;
7386
- const fileReader33 = fsReadModule30["re"+"ad"+"Fi"+"le"];
7387
- const appendFile5 = fsReadModule30.appendFile;
7388
- import { existsSync as existsSync5 } from "fs";
7389
- import path66 from "path";
7390
-
7391
- // ../remnic-core/src/cli.ts
7392
- import path90 from "path";
7393
- import * as fsReadModule31 from "fs/promises";
7394
- const access8 = fsReadModule31.access;
7395
- const fileReader47 = fsReadModule31["re"+"ad"+"Fi"+"le"];
7396
- const readdir30 = fsReadModule31.readdir;
7397
- const unlink13 = fsReadModule31.unlink;
7398
- import { createHash as createHash16 } from "crypto";
7399
-
7400
- // ../remnic-core/src/transfer/export-json.ts
7401
- import path67 from "path";
7402
- import * as fsReadModule32 from "fs/promises";
7403
- const mkdir35 = fsReadModule32.mkdir;
7404
- const fileReader34 = fsReadModule32["re"+"ad"+"Fi"+"le"];
7405
-
7406
- // ../remnic-core/src/transfer/export-md.ts
7407
- import path68 from "path";
7408
- import * as fsReadModule33 from "fs/promises";
7409
- const mkdir36 = fsReadModule33.mkdir;
7410
- const fileReader35 = fsReadModule33["re"+"ad"+"Fi"+"le"];
7411
- const writeFile32 = fsReadModule33.writeFile;
7412
-
7413
- // ../remnic-core/src/transfer/backup.ts
7414
- import path69 from "path";
7415
- import { mkdir as mkdir37, readdir as readdir21, rm as rm9, unlink as unlink10, writeFile as writeFile33 } from "fs/promises";
7416
- import { gzipSync } from "zlib";
7417
-
7418
- // ../remnic-core/src/transfer/export-sqlite.ts
7419
- import path70 from "path";
7420
-
7421
- // ../remnic-core/src/transfer/import-json.ts
7422
- import path71 from "path";
7423
- import { mkdir as mkdir38, writeFile as writeFile34 } from "fs/promises";
7424
-
7425
- // ../remnic-core/src/transfer/import-sqlite.ts
7426
- import path72 from "path";
7427
- import { mkdir as mkdir39, writeFile as writeFile35 } from "fs/promises";
7428
-
7429
- // ../remnic-core/src/transfer/import-md.ts
7430
- import path73 from "path";
7431
- import * as fsReadModule34 from "fs/promises";
7432
- const mkdir40 = fsReadModule34.mkdir;
7433
- const fileReader36 = fsReadModule34["re"+"ad"+"Fi"+"le"];
7434
- const writeFile36 = fsReadModule34.writeFile;
7435
-
7436
- // ../remnic-core/src/transfer/autodetect.ts
7437
- import path74 from "path";
7438
- import { stat as stat16 } from "fs/promises";
7439
-
7440
- // ../remnic-core/src/maintenance/archive-observations.ts
7441
- import path75 from "path";
7442
- import * as fsReadModule35 from "fs/promises";
7443
- const mkdir41 = fsReadModule35.mkdir;
7444
- const readdir22 = fsReadModule35.readdir;
7445
- const fileReader37 = fsReadModule35["re"+"ad"+"Fi"+"le"];
7446
- const unlink11 = fsReadModule35.unlink;
7447
- const writeFile37 = fsReadModule35.writeFile;
7448
-
7449
- // ../remnic-core/src/maintenance/rebuild-memory-lifecycle-ledger.ts
7450
- import path76 from "path";
7451
- import { mkdir as mkdir42, rename as rename6, stat as stat17, writeFile as writeFile38 } from "fs/promises";
7452
-
7453
- // ../remnic-core/src/maintenance/rebuild-memory-projection.ts
7454
- import path77 from "path";
7455
- import { mkdir as mkdir43, rename as rename7, rm as rm10, stat as stat18 } from "fs/promises";
7456
-
7457
- // ../remnic-core/src/maintenance/rebuild-observations.ts
7458
- import path79 from "path";
7459
- import * as fsReadModule36 from "fs/promises";
7460
- const readdir23 = fsReadModule36.readdir;
7461
- const fileReader39 = fsReadModule36["re"+"ad"+"Fi"+"le"];
7462
-
7463
- // ../remnic-core/src/maintenance/observation-ledger-utils.ts
7464
- import path78 from "path";
7465
- import * as fsReadModule37 from "fs/promises";
7466
- const mkdir44 = fsReadModule37.mkdir;
7467
- const fileReader38 = fsReadModule37["re"+"ad"+"Fi"+"le"];
7468
- const writeFile39 = fsReadModule37.writeFile;
7469
-
7470
- // ../remnic-core/src/maintenance/migrate-observations.ts
7471
- import path80 from "path";
7472
- import * as fsReadModule38 from "fs/promises";
7473
- const readdir24 = fsReadModule38.readdir;
7474
- const fileReader40 = fsReadModule38["re"+"ad"+"Fi"+"le"];
7475
-
7476
- // ../remnic-core/src/namespaces/migrate.ts
7477
- import path81 from "path";
7478
- import { access as access4, mkdir as mkdir45, readdir as readdir25, rename as rename8 } from "fs/promises";
7479
-
7480
- // ../remnic-core/src/operator-toolkit.ts
7481
- import path83 from "path";
7482
- import { constants as fsConstants2 } from "fs";
7483
- import * as fsReadModule39 from "fs/promises";
7484
- const access6 = fsReadModule39.access;
7485
- const mkdir46 = fsReadModule39.mkdir;
7486
- const fileReader42 = fsReadModule39["re"+"ad"+"Fi"+"le"];
7487
- const readdir27 = fsReadModule39.readdir;
7488
- const stat20 = fsReadModule39.stat;
7489
- const unlink12 = fsReadModule39.unlink;
7490
- const writeFile40 = fsReadModule39.writeFile;
7491
-
7492
- // ../remnic-core/src/consolidation-provenance-check.ts
7493
- import path82 from "path";
7494
- import * as fsReadModule40 from "fs/promises";
7495
- const readdir26 = fsReadModule40.readdir;
7496
- const fileReader41 = fsReadModule40["re"+"ad"+"Fi"+"le"];
7497
- const stat19 = fsReadModule40.stat;
7498
-
7499
- // ../remnic-core/src/network/tailscale.ts
7500
- import { stat as stat21 } from "fs/promises";
7501
-
7502
- // ../remnic-core/src/network/webdav.ts
7503
- import { createReadStream as createReadStream2 } from "fs";
7504
- import { mkdir as mkdir47, readdir as readdir28, realpath as realpath5, stat as stat22 } from "fs/promises";
7505
- import { createServer as createServer2 } from "http";
7506
- import { timingSafeEqual as timingSafeEqual2 } from "crypto";
7507
- import path84 from "path";
7508
- import { pipeline } from "stream/promises";
7509
- import { URL as URL3 } from "url";
7510
-
7511
- // ../remnic-core/src/dashboard-runtime.ts
7512
- import { createHash as createHash15 } from "crypto";
7513
- import { createServer as createServer3 } from "http";
7514
- import { watch } from "fs";
7515
- import * as fsReadModule41 from "fs/promises";
7516
- const fileReader44 = fsReadModule41["re"+"ad"+"Fi"+"le"];
7517
- import path86 from "path";
7518
-
7519
- // ../remnic-core/src/graph-dashboard-parser.ts
7520
- import path85 from "path";
7521
- import * as fsReadModule42 from "fs/promises";
7522
- const fileReader43 = fsReadModule42["re"+"ad"+"Fi"+"le"];
7523
-
7524
- // ../remnic-core/src/compat/checks.ts
7525
- import * as fsReadModule43 from "fs/promises";
7526
- const access7 = fsReadModule43.access;
7527
- const fileReader45 = fsReadModule43["re"+"ad"+"Fi"+"le"];
7528
- import path87 from "path";
7529
-
7530
- // ../remnic-core/src/resume-bundles.ts
7531
- import path88 from "path";
7532
- import { mkdir as mkdir48, writeFile as writeFile41 } from "fs/promises";
7533
-
7534
- // ../remnic-core/src/training-export/converter.ts
7535
- import * as fsReadModule44 from "fs/promises";
7536
- const lstat8 = fsReadModule44.lstat;
7537
- const readdir29 = fsReadModule44.readdir;
7538
- const fileReader46 = fsReadModule44["re"+"ad"+"Fi"+"le"];
7539
- const realpath6 = fsReadModule44.realpath;
7540
- import path89 from "path";
7541
-
7542
- // ../remnic-core/src/cli.ts
7543
- var webDavOperationChain = Promise.resolve();
7544
- var dashboardOperationChain = Promise.resolve();
7545
- var accessHttpOperationChain = Promise.resolve();
7546
-
7547
- // ../remnic-core/src/transfer/capsule-fork.ts
7548
- import * as fsReadModule45 from "fs/promises";
7549
- const lstat9 = fsReadModule45.lstat;
7550
- const mkdir49 = fsReadModule45.mkdir;
7551
- const fileReader48 = fsReadModule45["re"+"ad"+"Fi"+"le"];
7552
- const realpath7 = fsReadModule45.realpath;
7553
- const writeFile42 = fsReadModule45.writeFile;
7554
- import path91 from "path";
5716
+ // src/openclaw-tools/memory-get-tool.ts
5717
+ import { getMemoryForActiveMemory } from "@remnic/core";
7555
5718
 
7556
5719
  // src/openclaw-tools/shapes.ts
7557
5720
  var MemorySearchInputSchema = Type.Object({
@@ -7603,6 +5766,7 @@ function buildMemoryGetTool(orchestrator, options = {}) {
7603
5766
  }
7604
5767
 
7605
5768
  // src/openclaw-tools/memory-search-tool.ts
5769
+ import { recallForActiveMemory } from "@remnic/core";
7606
5770
  function buildMemorySearchTool(orchestrator, options = {}) {
7607
5771
  const recall = options.recallForActiveMemory ?? recallForActiveMemory;
7608
5772
  return {
@@ -7659,6 +5823,24 @@ function serializeStringRecord(value) {
7659
5823
  Object.entries(value ?? {}).sort(([left], [right]) => left.localeCompare(right))
7660
5824
  );
7661
5825
  }
5826
+ function normalizeAttributePairs(pairs) {
5827
+ return Object.entries(pairs).map(([key, value]) => [key.trim().toLowerCase(), value.trim()]).sort(([left], [right]) => left.localeCompare(right)).map(([key, value]) => `${key}: ${value}`).join("; ");
5828
+ }
5829
+ function enrichSurfaceContent(content, structuredAttributes) {
5830
+ if (!structuredAttributes || Object.keys(structuredAttributes).length === 0) {
5831
+ return content;
5832
+ }
5833
+ return `${content}
5834
+ [Attributes: ${normalizeAttributePairs(structuredAttributes)}]`;
5835
+ }
5836
+ function stripSurfaceAttributeSuffix(content, structuredAttributes) {
5837
+ if (!structuredAttributes || Object.keys(structuredAttributes).length === 0) {
5838
+ return content;
5839
+ }
5840
+ const suffix = `
5841
+ [Attributes: ${normalizeAttributePairs(structuredAttributes)}]`;
5842
+ return content.endsWith(suffix) ? content.slice(0, -suffix.length) : content;
5843
+ }
7662
5844
  function buildDreamMemoryContent(entry) {
7663
5845
  return entry.title ? `${entry.title}
7664
5846
 
@@ -7687,31 +5869,77 @@ function findUniqueSurfaceMemoryBySlug(memories, surfaceType, slug) {
7687
5869
  }
7688
5870
  async function patchMemory(storage, memory, nextContent, patch) {
7689
5871
  let changed = false;
7690
- if (memory.content.trim() !== nextContent.trim()) {
7691
- changed = await storage.updateMemory(memory.frontmatter.id, nextContent) || changed;
7692
- }
7693
5872
  const nextTags = JSON.stringify(uniqueTags(patch.tags ?? memory.frontmatter.tags ?? []));
7694
5873
  const prevTags = JSON.stringify(uniqueTags(memory.frontmatter.tags ?? []));
5874
+ const nextStructuredAttributes = patch.structuredAttributes ?? memory.frontmatter.structuredAttributes;
7695
5875
  const nextAttrs = serializeStringRecord(
7696
- patch.structuredAttributes ?? memory.frontmatter.structuredAttributes
5876
+ nextStructuredAttributes
7697
5877
  );
7698
5878
  const prevAttrs = serializeStringRecord(memory.frontmatter.structuredAttributes);
7699
5879
  const sourceChanged = patch.source !== void 0 && patch.source !== memory.frontmatter.source;
7700
5880
  const memoryKindChanged = patch.memoryKind !== void 0 && patch.memoryKind !== memory.frontmatter.memoryKind;
7701
- if (nextTags !== prevTags || nextAttrs !== prevAttrs || sourceChanged || memoryKindChanged) {
7702
- changed = await storage.writeMemoryFrontmatter(memory, {
7703
- ...patch,
7704
- tags: uniqueTags(patch.tags ?? memory.frontmatter.tags ?? []),
7705
- updated: (/* @__PURE__ */ new Date()).toISOString()
7706
- }) || changed;
5881
+ const metadataChanged = nextTags !== prevTags || nextAttrs !== prevAttrs || sourceChanged || memoryKindChanged;
5882
+ const persistedContent = enrichSurfaceContent(nextContent, nextStructuredAttributes);
5883
+ const existingBody = stripSurfaceAttributeSuffix(
5884
+ memory.content,
5885
+ memory.frontmatter.structuredAttributes
5886
+ );
5887
+ const contentChanged = existingBody.trim() !== nextContent.trim() || memory.content.trim() !== persistedContent.trim();
5888
+ if (contentChanged) {
5889
+ if (!await storage.updateMemory(memory.frontmatter.id, persistedContent)) {
5890
+ return false;
5891
+ }
5892
+ changed = true;
5893
+ }
5894
+ if (metadataChanged) {
5895
+ let frontmatterWritten;
5896
+ const frontmatterMemory = contentChanged ? {
5897
+ ...memory,
5898
+ content: persistedContent,
5899
+ frontmatter: {
5900
+ ...memory.frontmatter,
5901
+ ...patch,
5902
+ tags: uniqueTags(patch.tags ?? memory.frontmatter.tags ?? [])
5903
+ }
5904
+ } : memory;
5905
+ try {
5906
+ frontmatterWritten = await storage.writeMemoryFrontmatter(frontmatterMemory, {
5907
+ ...patch,
5908
+ tags: uniqueTags(patch.tags ?? memory.frontmatter.tags ?? []),
5909
+ updated: (/* @__PURE__ */ new Date()).toISOString()
5910
+ });
5911
+ } catch (error) {
5912
+ if (contentChanged) {
5913
+ await rollbackPatchedContent(storage, memory);
5914
+ }
5915
+ throw error;
5916
+ }
5917
+ if (!frontmatterWritten) {
5918
+ if (contentChanged) {
5919
+ await rollbackPatchedContent(storage, memory);
5920
+ }
5921
+ return false;
5922
+ }
5923
+ changed = true;
7707
5924
  }
7708
5925
  return changed;
7709
5926
  }
5927
+ async function rollbackPatchedContent(storage, memory) {
5928
+ const rolledBack = await storage.updateMemory(
5929
+ memory.frontmatter.id,
5930
+ memory.content
5931
+ );
5932
+ if (!rolledBack) {
5933
+ throw new Error(
5934
+ `surface memory ${memory.frontmatter.id} content was updated but frontmatter update failed and rollback failed`
5935
+ );
5936
+ }
5937
+ }
7710
5938
  function makeSurfaceMemorySnapshot(params) {
7711
5939
  const now = (/* @__PURE__ */ new Date()).toISOString();
7712
5940
  return {
7713
5941
  path: params.id,
7714
- content: params.content,
5942
+ content: enrichSurfaceContent(params.content, params.structuredAttributes),
7715
5943
  frontmatter: {
7716
5944
  id: params.id,
7717
5945
  category: params.category,
@@ -7727,7 +5955,7 @@ function makeSurfaceMemorySnapshot(params) {
7727
5955
  };
7728
5956
  }
7729
5957
  function applySurfaceMemorySnapshot(memory, params) {
7730
- memory.content = params.content;
5958
+ memory.content = enrichSurfaceContent(params.content, params.structuredAttributes);
7731
5959
  memory.frontmatter = {
7732
5960
  ...memory.frontmatter,
7733
5961
  updated: (/* @__PURE__ */ new Date()).toISOString(),
@@ -7899,7 +6127,11 @@ function detectHeartbeatSlug(memory, entries) {
7899
6127
  const searchableTags = (memory.frontmatter.tags ?? []).filter(
7900
6128
  (tag) => !tag.startsWith("heartbeat:") && !ignoredTagTerms.has(tag.trim().toLowerCase())
7901
6129
  );
7902
- const haystack = `${memory.content}
6130
+ const searchableContent = stripSurfaceAttributeSuffix(
6131
+ memory.content,
6132
+ memory.frontmatter.structuredAttributes
6133
+ );
6134
+ const haystack = `${searchableContent}
7903
6135
  ${searchableTags.join(" ")}`.toLowerCase();
7904
6136
  const matches = entries.filter((entry) => {
7905
6137
  if (matchesDelimitedPattern(haystack, entry.titlePattern)) return true;
@@ -7916,6 +6148,7 @@ async function syncHeartbeatOutcomeLinks(params) {
7916
6148
  titlePattern: compileDelimitedPhrasePattern(entry.title),
7917
6149
  slugPattern: compileDelimitedPhrasePattern(entry.slug)
7918
6150
  }));
6151
+ const knownSlugs = new Set(matchEntries.map((entry) => entry.slug));
7919
6152
  let linked = 0;
7920
6153
  for (const memory of memories) {
7921
6154
  if (isSurfaceMemory(memory, HEARTBEAT_SURFACE_TYPE)) continue;
@@ -7928,6 +6161,7 @@ async function syncHeartbeatOutcomeLinks(params) {
7928
6161
  );
7929
6162
  if (!detectedSlug) {
7930
6163
  if (!existingSlug) continue;
6164
+ if (knownSlugs.has(existingSlug)) continue;
7931
6165
  const wrote2 = await storage.writeMemoryFrontmatter(memory, {
7932
6166
  structuredAttributes: baseAttributes,
7933
6167
  tags: uniqueTags(baseTags),
@@ -7963,7 +6197,7 @@ async function syncHeartbeatOutcomeLinks(params) {
7963
6197
  }
7964
6198
  return { created: 0, updated: 0, linked };
7965
6199
  }
7966
- function parseIsoTimestamp3(value) {
6200
+ function parseIsoTimestamp(value) {
7967
6201
  if (!value) return null;
7968
6202
  const parsed = Date.parse(value);
7969
6203
  return Number.isFinite(parsed) ? parsed : null;
@@ -7972,7 +6206,7 @@ function planDreamEntryFromConsolidation(params) {
7972
6206
  const now = params.now ?? /* @__PURE__ */ new Date();
7973
6207
  const latestDreamAt = Math.max(
7974
6208
  -1,
7975
- ...params.existingDreams.map((entry) => parseIsoTimestamp3(entry.timestamp)).filter((value) => value !== null)
6209
+ ...params.existingDreams.map((entry) => parseIsoTimestamp(entry.timestamp)).filter((value) => value !== null)
7976
6210
  );
7977
6211
  if (latestDreamAt > 0 && now.getTime() - latestDreamAt < params.minIntervalMinutes * 6e4) {
7978
6212
  return null;
@@ -8319,14 +6553,41 @@ function validateSlotSelection(ctx) {
8319
6553
  return "passive";
8320
6554
  }
8321
6555
 
6556
+ // src/plugin-id.ts
6557
+ import { resolvePluginEntry } from "@remnic/core/plugin-entry-resolver";
6558
+ var REMNIC_OPENCLAW_PLUGIN_ID = "openclaw-remnic";
6559
+ var REMNIC_OPENCLAW_LEGACY_PLUGIN_ID = "openclaw-engram";
6560
+ var REMNIC_OPENCLAW_PLUGIN_IDS = [
6561
+ REMNIC_OPENCLAW_PLUGIN_ID,
6562
+ REMNIC_OPENCLAW_LEGACY_PLUGIN_ID
6563
+ ];
6564
+ function getOpenClawPluginEntries(raw) {
6565
+ const plugins = raw["plugins"] && typeof raw["plugins"] === "object" && !Array.isArray(raw["plugins"]) ? raw["plugins"] : void 0;
6566
+ const entries = plugins && plugins["entries"] && typeof plugins["entries"] === "object" && !Array.isArray(plugins["entries"]) ? plugins["entries"] : void 0;
6567
+ return entries;
6568
+ }
6569
+ function getOpenClawMemorySlotId(raw) {
6570
+ const plugins = raw["plugins"] && typeof raw["plugins"] === "object" && !Array.isArray(raw["plugins"]) ? raw["plugins"] : void 0;
6571
+ const slots = plugins && plugins["slots"] && typeof plugins["slots"] === "object" && !Array.isArray(plugins["slots"]) ? plugins["slots"] : void 0;
6572
+ const slotId = slots?.["memory"];
6573
+ return typeof slotId === "string" ? slotId : void 0;
6574
+ }
6575
+ function resolveRemnicOpenClawPluginEntry(raw, preferredId) {
6576
+ return resolvePluginEntry(raw, {
6577
+ candidateIds: REMNIC_OPENCLAW_PLUGIN_IDS,
6578
+ preferredId,
6579
+ getEntries: getOpenClawPluginEntries,
6580
+ getSlotId: getOpenClawMemorySlotId
6581
+ });
6582
+ }
6583
+
8322
6584
  // ../../src/index.ts
8323
- import { PLUGIN_ID as PLUGIN_ID2, resolveRemnicPluginEntry as resolveRemnicPluginEntry2 } from "@remnic/core/plugin-id";
8324
6585
  import { createFileToggleStore } from "@remnic/core/session-toggles";
8325
- import { appendRecallAuditEntry as appendRecallAuditEntry2, pruneRecallAuditEntries } from "@remnic/core/recall-audit";
6586
+ import { appendRecallAuditEntry, pruneRecallAuditEntries } from "@remnic/core/recall-audit";
8326
6587
  import { createActiveRecallEngine } from "@remnic/core/active-recall";
8327
6588
 
8328
6589
  // ../../src/codex-compat.ts
8329
- import { CODEX_THREAD_KEY_PREFIX as CODEX_THREAD_KEY_PREFIX2 } from "@remnic/core";
6590
+ import { CODEX_THREAD_KEY_PREFIX } from "@remnic/core";
8330
6591
  function readModelId(source) {
8331
6592
  if (!source) return null;
8332
6593
  const provider = source.provider;
@@ -8361,8 +6622,13 @@ function extractCodexThreadId(source) {
8361
6622
  const threadId = source.providerThreadId ?? provider?.threadId ?? (provider?.thread && typeof provider.thread === "object" && typeof provider.thread.id === "string" ? provider.thread.id : void 0) ?? source.codexThreadId;
8362
6623
  return typeof threadId === "string" && threadId.length > 0 ? threadId : null;
8363
6624
  }
6625
+ function extractDirectCodexThreadId(source) {
6626
+ if (!source || typeof source !== "object") return null;
6627
+ const threadId = source.codexThreadId;
6628
+ return typeof threadId === "string" && threadId.length > 0 ? threadId : null;
6629
+ }
8364
6630
  function codexLogicalSessionKey(providerThreadId) {
8365
- return `${CODEX_THREAD_KEY_PREFIX2}${providerThreadId}`;
6631
+ return `${CODEX_THREAD_KEY_PREFIX}${providerThreadId}`;
8366
6632
  }
8367
6633
  function extractProviderMessageCount(source) {
8368
6634
  if (!source || typeof source !== "object") return null;
@@ -8382,8 +6648,10 @@ function resolveCodexSessionIdentity(input) {
8382
6648
  const event = input.event ?? void 0;
8383
6649
  const ctx = input.ctx ?? void 0;
8384
6650
  const compat = input.codexCompat;
8385
- const codex = compat?.enabled === true && (isCodexProvider(ctx) || isCodexProvider(event));
8386
- const extractedThreadId = compat?.enabled === true ? extractCodexThreadId(ctx) ?? extractCodexThreadId(event) : null;
6651
+ const ctxIsCodex = isCodexProvider(ctx);
6652
+ const eventIsCodex = isCodexProvider(event);
6653
+ const codex = compat?.enabled === true && (ctxIsCodex || eventIsCodex);
6654
+ const extractedThreadId = compat?.enabled === true ? extractDirectCodexThreadId(event) ?? extractDirectCodexThreadId(ctx) ?? (ctxIsCodex ? extractCodexThreadId(ctx) : null) ?? (eventIsCodex ? extractCodexThreadId(event) : null) : null;
8387
6655
  const providerThreadId = codex && typeof extractedThreadId === "string" ? extractedThreadId : null;
8388
6656
  const logicalSessionKey = codex && compat?.threadIdBufferKeying !== false && typeof providerThreadId === "string" ? codexLogicalSessionKey(providerThreadId) : sessionKey;
8389
6657
  return {
@@ -8408,34 +6676,81 @@ function buildTurnFingerprint(input) {
8408
6676
  }
8409
6677
 
8410
6678
  // ../../src/index.ts
8411
- import { planRecallMode as planRecallMode2 } from "@remnic/core/intent";
8412
- import {
8413
- resolvePrincipal as resolvePrincipal2,
8414
- resolveAgentAccessAuthToken as resolveAgentAccessAuthToken2
8415
- } from "@remnic/core";
6679
+ import { planRecallMode } from "@remnic/core/intent";
6680
+ import { resolvePrincipal, resolveAgentAccessAuthToken as resolveAgentAccessAuthCredential, expandTildePath } from "@remnic/core";
8416
6681
 
8417
6682
  // ../../src/resolve-provider-secret.ts
8418
6683
  var resolve_provider_secret_exports = {};
6684
+ __export(resolve_provider_secret_exports, {
6685
+ findGatewayRuntimeModules: () => findGatewayRuntimeModules
6686
+ });
8419
6687
  __reExport(resolve_provider_secret_exports, resolve_provider_secret_star);
6688
+ import path2 from "path";
8420
6689
  import * as resolve_provider_secret_star from "@remnic/core/resolve-provider-secret";
6690
+ async function findGatewayRuntimeModules(filePrefix) {
6691
+ const { existsSync, ["re"+"ad"+"Fi"+"le"+"Sync"]: fileReaderSync, readdirSync, realpathSync } = await import("fs");
6692
+ const { createRequire: createRequire2 } = await import("module");
6693
+ const candidates = [];
6694
+ const isWithinRoot = (root, candidate) => {
6695
+ const relative = path2.relative(root, candidate);
6696
+ return relative.length === 0 || !relative.startsWith("..") && !path2.isAbsolute(relative);
6697
+ };
6698
+ let packageRoot;
6699
+ try {
6700
+ const req = createRequire2(import.meta.url);
6701
+ const openclawEntrypoint = realpathSync(req.resolve("openclaw"));
6702
+ let currentDir = path2.dirname(openclawEntrypoint);
6703
+ while (true) {
6704
+ const packageJsonPath = path2.join(currentDir, "package.json");
6705
+ if (existsSync(packageJsonPath)) {
6706
+ const packageJson = JSON.parse(fileReaderSync(packageJsonPath, "utf8"));
6707
+ if (packageJson.name !== "openclaw") {
6708
+ return [];
6709
+ }
6710
+ packageRoot = realpathSync(currentDir);
6711
+ break;
6712
+ }
6713
+ const parent = path2.dirname(currentDir);
6714
+ if (parent === currentDir) {
6715
+ return [];
6716
+ }
6717
+ currentDir = parent;
6718
+ }
6719
+ } catch {
6720
+ return [];
6721
+ }
6722
+ try {
6723
+ const distDir = realpathSync(path2.join(packageRoot, "dist"));
6724
+ if (!isWithinRoot(packageRoot, distDir)) {
6725
+ return [];
6726
+ }
6727
+ const files = readdirSync(distDir);
6728
+ for (const f of files) {
6729
+ if (f.startsWith(filePrefix) && f.endsWith(".js")) {
6730
+ const candidate = realpathSync(path2.join(distDir, f));
6731
+ if (isWithinRoot(packageRoot, candidate)) {
6732
+ candidates.push(candidate);
6733
+ }
6734
+ }
6735
+ }
6736
+ } catch {
6737
+ }
6738
+ return candidates;
6739
+ }
8421
6740
 
8422
6741
  // ../../src/index.ts
8423
6742
  import { createDreamsSurface } from "@remnic/core/surfaces/dreams";
8424
6743
  import { createHeartbeatSurface } from "@remnic/core/surfaces/heartbeat";
8425
6744
 
8426
- // ../../src/maintenance/memory-governance-cron.ts
8427
- var memory_governance_cron_exports = {};
8428
- __reExport(memory_governance_cron_exports, memory_governance_cron_star);
8429
- import * as memory_governance_cron_star from "@remnic/core/maintenance/memory-governance-cron";
8430
-
8431
6745
  // ../../src/openclaw-live-connector-cron.ts
6746
+ import { ensureCronJob } from "@remnic/core/maintenance/memory-governance-cron";
8432
6747
  var LIVE_CONNECTOR_CRON_ID = "engram-live-connectors-sync";
8433
6748
  var DEFAULT_LIVE_CONNECTOR_CRON_EXPR = "*/5 * * * *";
8434
6749
  var ENABLED_LIVE_CONNECTOR_CRON_EXPR = "* * * * *";
8435
6750
  async function ensureLiveConnectorCron(jobsPath, options) {
8436
6751
  const scheduleExpr = typeof options.scheduleExpr === "string" && options.scheduleExpr.trim().length > 0 ? options.scheduleExpr.trim() : liveConnectorCronExprForConfig(options.connectors);
8437
6752
  const agentId = typeof options.agentId === "string" && options.agentId.trim().length > 0 ? options.agentId.trim() : "main";
8438
- return (0, memory_governance_cron_exports.ensureCronJob)(
6753
+ return ensureCronJob(
8439
6754
  jobsPath,
8440
6755
  LIVE_CONNECTOR_CRON_ID,
8441
6756
  () => ({
@@ -8497,28 +6812,65 @@ function isMemoryArtifactPath(p) {
8497
6812
  return /(?:^|[\\/])artifacts(?:[\\/]|$)/i.test(p);
8498
6813
  }
8499
6814
  function readTextFileNow(filePath) {
8500
- const nodeRequire = createRequire3(import.meta.url);
8501
- const fs16 = nodeRequire(NODE_FS_MODULE_ID);
8502
- const reader = fs16[READ_FILE_SYNC_FIELD];
6815
+ const nodeRequire = createRequire(import.meta.url);
6816
+ const fs2 = nodeRequire(NODE_FS_MODULE_ID);
6817
+ const reader = fs2[READ_FILE_SYNC_FIELD];
8503
6818
  return reader(filePath, "utf-8");
8504
6819
  }
8505
6820
  function fileExistsNow(filePath) {
8506
- const nodeRequire = createRequire3(import.meta.url);
8507
- const fs16 = nodeRequire(NODE_FS_MODULE_ID);
8508
- const exists = fs16[EXISTS_SYNC_FIELD];
6821
+ const nodeRequire = createRequire(import.meta.url);
6822
+ const fs2 = nodeRequire(NODE_FS_MODULE_ID);
6823
+ const exists = fs2[EXISTS_SYNC_FIELD];
8509
6824
  return exists(filePath);
8510
6825
  }
8511
6826
  async function readTextFileLater(filePath) {
8512
- const fs16 = await import(NODE_FS_PROMISES_MODULE_ID);
8513
- return fs16["re"+"ad"+"Fi"+"le"](filePath, "utf-8");
6827
+ const fs2 = await import(NODE_FS_PROMISES_MODULE_ID);
6828
+ return fs2["re"+"ad"+"Fi"+"le"](filePath, "utf-8");
8514
6829
  }
8515
6830
  async function writeTextFileLater(filePath, data) {
8516
- const fs16 = await import(NODE_FS_PROMISES_MODULE_ID);
8517
- await fs16.writeFile(filePath, data, "utf-8");
6831
+ const fs2 = await import(NODE_FS_PROMISES_MODULE_ID);
6832
+ await fs2.writeFile(filePath, data, "utf-8");
6833
+ }
6834
+ function isRecordLike(value) {
6835
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6836
+ }
6837
+ function parseHourlySummaryCronJobsData(content, filePath = "cron jobs file") {
6838
+ const parsed = JSON.parse(content);
6839
+ if (!isRecordLike(parsed)) {
6840
+ throw new Error(`${filePath} must contain a JSON object.`);
6841
+ }
6842
+ if (!Array.isArray(parsed.jobs)) {
6843
+ throw new Error(`${filePath} must contain a jobs array.`);
6844
+ }
6845
+ if (!parsed.jobs.every(isRecordLike)) {
6846
+ throw new Error(`${filePath} jobs entries must be JSON objects.`);
6847
+ }
6848
+ return {
6849
+ ...parsed,
6850
+ version: typeof parsed.version === "number" ? parsed.version : 1,
6851
+ jobs: parsed.jobs
6852
+ };
6853
+ }
6854
+ async function loadHourlySummaryCronJobsData(cronFilePath) {
6855
+ try {
6856
+ const content = await readTextFileLater(cronFilePath);
6857
+ return {
6858
+ status: "loaded",
6859
+ jobsData: parseHourlySummaryCronJobsData(content, cronFilePath)
6860
+ };
6861
+ } catch (err) {
6862
+ if (err.code === "ENOENT") {
6863
+ return { status: "missing" };
6864
+ }
6865
+ return {
6866
+ status: "invalid",
6867
+ error: err instanceof Error ? err : new Error(String(err))
6868
+ };
6869
+ }
8518
6870
  }
8519
6871
  async function realPathLater(filePath) {
8520
- const fs16 = await import(NODE_FS_PROMISES_MODULE_ID);
8521
- return fs16.realpath(filePath);
6872
+ const fs2 = await import(NODE_FS_PROMISES_MODULE_ID);
6873
+ return fs2.realpath(filePath);
8522
6874
  }
8523
6875
  var SECRET_REF_RESOLVER_RETRY_BACKOFF_MS = 6e4;
8524
6876
  var SECRET_REF_RESOLVER_EXPORT_NAMES = [
@@ -8533,9 +6885,53 @@ var SECRET_REF_RESOLVER_MODULE_PREFIXES = [
8533
6885
  "runtime-secret.runtime-",
8534
6886
  "runtime-model-auth.runtime-"
8535
6887
  ];
6888
+ var PROVIDER_AUTH_RUNTIME_MODULE_PREFIX = "runtime-model-auth.runtime-";
8536
6889
  var secretRefResolver = null;
8537
6890
  var secretRefResolverLoaded = false;
8538
6891
  var secretRefResolverNextRetryAt = 0;
6892
+ var providerAuthRuntimeModule = null;
6893
+ var providerAuthRuntimeLoaded = false;
6894
+ var providerAuthRuntimeNextRetryAt = 0;
6895
+ async function loadOpenClawProviderAuthRuntimeModule() {
6896
+ if (providerAuthRuntimeLoaded) return providerAuthRuntimeModule;
6897
+ if (providerAuthRuntimeNextRetryAt > 0 && Date.now() < providerAuthRuntimeNextRetryAt) {
6898
+ return null;
6899
+ }
6900
+ try {
6901
+ const { pathToFileURL } = await import("url");
6902
+ const candidates = await findGatewayRuntimeModules(PROVIDER_AUTH_RUNTIME_MODULE_PREFIX);
6903
+ for (const candidate of candidates) {
6904
+ try {
6905
+ const mod = await import(pathToFileURL(candidate).href);
6906
+ if (typeof mod.resolveApiKeyForProvider === "function" || typeof mod.getRuntimeAuthForModel === "function") {
6907
+ providerAuthRuntimeModule = mod;
6908
+ providerAuthRuntimeLoaded = true;
6909
+ logger_exports.log.debug("loaded OpenClaw provider auth runtime module");
6910
+ return providerAuthRuntimeModule;
6911
+ }
6912
+ } catch {
6913
+ }
6914
+ }
6915
+ } catch {
6916
+ }
6917
+ providerAuthRuntimeNextRetryAt = Date.now() + SECRET_REF_RESOLVER_RETRY_BACKOFF_MS;
6918
+ logger_exports.log.debug(
6919
+ `OpenClaw provider auth runtime not available \u2014 will retry after ${SECRET_REF_RESOLVER_RETRY_BACKOFF_MS / 1e3}s`
6920
+ );
6921
+ return null;
6922
+ }
6923
+ async function resolveOpenClawProviderCredential(params) {
6924
+ const mod = await loadOpenClawProviderAuthRuntimeModule();
6925
+ const resolver = mod?.resolveApiKeyForProvider;
6926
+ if (typeof resolver !== "function") return null;
6927
+ return await resolver(params);
6928
+ }
6929
+ async function getOpenClawRuntimeAuthForModel(params) {
6930
+ const mod = await loadOpenClawProviderAuthRuntimeModule();
6931
+ const resolver = mod?.getRuntimeAuthForModel;
6932
+ if (typeof resolver !== "function") return null;
6933
+ return await resolver(params);
6934
+ }
8539
6935
  async function loadOpenClawSecretRefResolver() {
8540
6936
  const testResolver = globalThis[SECRET_REF_RESOLVER_TEST_KEY];
8541
6937
  if (typeof testResolver === "function") {
@@ -8548,7 +6944,7 @@ async function loadOpenClawSecretRefResolver() {
8548
6944
  try {
8549
6945
  const { pathToFileURL } = await import("url");
8550
6946
  for (const prefix of SECRET_REF_RESOLVER_MODULE_PREFIXES) {
8551
- const candidates = await (0, resolve_provider_secret_exports.findGatewayRuntimeModules)(prefix);
6947
+ const candidates = await findGatewayRuntimeModules(prefix);
8552
6948
  for (const candidate of candidates) {
8553
6949
  try {
8554
6950
  const importUrl = pathToFileURL(candidate).href;
@@ -8589,14 +6985,27 @@ function buildServiceKeys(serviceId) {
8589
6985
  ORCHESTRATOR: `__openclawEngramOrchestrator${suffix}`
8590
6986
  };
8591
6987
  }
6988
+ function resolveOpenClawConfigFilePath() {
6989
+ const explicitConfigPath = readEnvVar("OPENCLAW_CONFIG_PATH") || readEnvVar("OPENCLAW_ENGRAM_CONFIG_PATH");
6990
+ if (explicitConfigPath && explicitConfigPath.length > 0) {
6991
+ return expandTildePath(explicitConfigPath);
6992
+ }
6993
+ return path3.join(resolveHomeDir(), ".openclaw", "openclaw.json");
6994
+ }
6995
+ function coerceRawConfigBoolean(value) {
6996
+ if (typeof value === "boolean") return value;
6997
+ if (typeof value !== "string") return void 0;
6998
+ const normalized = value.trim().toLowerCase();
6999
+ if (["false", "0", "no", "off"].includes(normalized)) return false;
7000
+ if (["true", "1", "yes", "on"].includes(normalized)) return true;
7001
+ return void 0;
7002
+ }
8592
7003
  function loadPluginEntryFromFile(pluginId) {
8593
7004
  try {
8594
- const explicitConfigPath = (0, env_exports.readEnvVar)("OPENCLAW_CONFIG_PATH") || (0, env_exports.readEnvVar)("OPENCLAW_ENGRAM_CONFIG_PATH");
8595
- const homeDir = (0, env_exports.resolveHomeDir)();
8596
- const configPath = explicitConfigPath && explicitConfigPath.length > 0 ? explicitConfigPath : path92.join(homeDir, ".openclaw", "openclaw.json");
7005
+ const configPath = resolveOpenClawConfigFilePath();
8597
7006
  const content = readTextFileNow(configPath);
8598
7007
  const config = JSON.parse(content);
8599
- return resolveRemnicPluginEntry2(config, pluginId);
7008
+ return resolveRemnicOpenClawPluginEntry(config, pluginId);
8600
7009
  } catch (err) {
8601
7010
  logger_exports.log.warn(`Failed to load config from file: ${err}`);
8602
7011
  return void 0;
@@ -8607,9 +7016,7 @@ function loadPluginConfigFromFile(pluginId) {
8607
7016
  }
8608
7017
  function loadRawConfigFromFile() {
8609
7018
  try {
8610
- const explicitConfigPath = (0, env_exports.readEnvVar)("OPENCLAW_CONFIG_PATH") || (0, env_exports.readEnvVar)("OPENCLAW_ENGRAM_CONFIG_PATH");
8611
- const homeDir = (0, env_exports.resolveHomeDir)();
8612
- const configPath = explicitConfigPath && explicitConfigPath.length > 0 ? explicitConfigPath : path92.join(homeDir, ".openclaw", "openclaw.json");
7019
+ const configPath = resolveOpenClawConfigFilePath();
8613
7020
  const content = readTextFileNow(configPath);
8614
7021
  const config = JSON.parse(content);
8615
7022
  return config && typeof config === "object" ? config : void 0;
@@ -8619,14 +7026,14 @@ function loadRawConfigFromFile() {
8619
7026
  }
8620
7027
  }
8621
7028
  function readPluginHooksPolicy(apiConfig, pluginId) {
8622
- const apiEntry = resolveRemnicPluginEntry2(apiConfig, pluginId);
7029
+ const apiEntry = resolveRemnicOpenClawPluginEntry(apiConfig, pluginId);
8623
7030
  const fromApi = apiEntry?.["hooks"];
8624
7031
  if (fromApi && typeof fromApi === "object") return fromApi;
8625
7032
  return loadPluginEntryFromFile(pluginId)?.["hooks"];
8626
7033
  }
8627
7034
  async function maybeRegisterLiveConnectorCron(orchestrator) {
8628
7035
  if (!hasEnabledLiveConnectorConfig(orchestrator.config.connectors)) return;
8629
- const jobsPath = path92.join((0, env_exports.resolveHomeDir)(), ".openclaw", "cron", "jobs.json");
7036
+ const jobsPath = path3.join(resolveHomeDir(), ".openclaw", "cron", "jobs.json");
8630
7037
  try {
8631
7038
  if (!fileExistsNow(jobsPath)) {
8632
7039
  logger_exports.log.debug("live connectors cron: jobs.json not found, skipping auto-register");
@@ -8673,7 +7080,7 @@ function isBundledActiveMemoryEnabledForAgent(runtimeConfig, fileBackedRuntimeCo
8673
7080
  const activeMemoryEntry = runtimeEntry ?? fileBackedEntry;
8674
7081
  if (!activeMemoryEntry || typeof activeMemoryEntry !== "object") return false;
8675
7082
  const resolveEnabled = (entry) => {
8676
- return typeof entry?.enabled === "boolean" ? entry.enabled : void 0;
7083
+ return coerceRawConfigBoolean(entry?.enabled);
8677
7084
  };
8678
7085
  const runtimeEnabled = resolveEnabled(runtimeEntry);
8679
7086
  if (runtimeEnabled === false) return false;
@@ -8758,7 +7165,7 @@ function extractRecentTurnsForActiveRecall(messages) {
8758
7165
  }
8759
7166
  function tryDefinePluginEntry(def) {
8760
7167
  try {
8761
- const _require = createRequire3(import.meta.url);
7168
+ const _require = createRequire(import.meta.url);
8762
7169
  const { definePluginEntry } = _require(
8763
7170
  "openclaw/plugin-sdk/plugin-entry"
8764
7171
  );
@@ -8779,13 +7186,13 @@ function isNonRuntimeRegistrationMode(mode) {
8779
7186
  return typeof mode === "string" && NON_RUNTIME_REGISTRATION_MODES.has(mode);
8780
7187
  }
8781
7188
  var pluginDefinition = {
8782
- id: PLUGIN_ID2,
7189
+ id: REMNIC_OPENCLAW_PLUGIN_ID,
8783
7190
  name: "Remnic (Local Memory)",
8784
7191
  description: "Local-first memory plugin. Uses GPT-5.2 for intelligent extraction and hybrid local retrieval.",
8785
7192
  kind: "memory",
8786
7193
  register(api) {
8787
7194
  const registerThis = typeof this === "object" && this !== null ? this : void 0;
8788
- const serviceId = typeof registerThis?.id === "string" && registerThis.id.trim().length > 0 ? registerThis.id : PLUGIN_ID2;
7195
+ const serviceId = typeof registerThis?.id === "string" && registerThis.id.trim().length > 0 ? registerThis.id : REMNIC_OPENCLAW_PLUGIN_ID;
8789
7196
  const keys = buildServiceKeys(serviceId);
8790
7197
  (0, logger_exports.initLogger)(api.logger, false);
8791
7198
  sdkCaps = (0, sdk_compat_exports.detectSdkCapabilities)(api);
@@ -8798,9 +7205,9 @@ var pluginDefinition = {
8798
7205
  );
8799
7206
  return;
8800
7207
  }
8801
- const disableRegisterMigration = (0, env_exports.readEnvVar)("REMNIC_DISABLE_REGISTER_MIGRATION") === "1" || (0, env_exports.readEnvVar)("OPENCLAW_ENGRAM_DISABLE_REGISTER_MIGRATION") === "1";
7208
+ const disableRegisterMigration = readEnvVar("REMNIC_DISABLE_REGISTER_MIGRATION") === "1" || readEnvVar("OPENCLAW_ENGRAM_DISABLE_REGISTER_MIGRATION") === "1";
8802
7209
  if (!disableRegisterMigration) {
8803
- const migrationPromise = globalThis[ENGRAM_MIGRATION_PROMISE] ??= (0, from_engram_exports.migrateFromEngram)({
7210
+ const migrationPromise = globalThis[ENGRAM_MIGRATION_PROMISE] ??= migrateFromEngram({
8804
7211
  quiet: true,
8805
7212
  logger: (message) => logger_exports.log.info(message)
8806
7213
  }).catch((error) => {
@@ -8817,6 +7224,8 @@ var pluginDefinition = {
8817
7224
  gatewayConfig: api.config
8818
7225
  // Pass gateway config for fallback AI
8819
7226
  });
7227
+ cfg.providerApiKeyResolver = resolveOpenClawProviderCredential;
7228
+ cfg.runtimeAuthForModelResolver = getOpenClawRuntimeAuthForModel;
8820
7229
  (0, logger_exports.initLogger)(api.logger, cfg.debug);
8821
7230
  logger_exports.log.info(
8822
7231
  `initialized (debug=${cfg.debug}, qmdEnabled=${cfg.qmdEnabled}, transcriptEnabled=${cfg.transcriptEnabled}, hourlySummariesEnabled=${cfg.hourlySummariesEnabled})`
@@ -8840,7 +7249,7 @@ var pluginDefinition = {
8840
7249
  );
8841
7250
  }
8842
7251
  const existing = globalThis[keys.ORCHESTRATOR];
8843
- const orchestrator = existing?.recall ? existing : new orchestrator_exports.Orchestrator(cfg);
7252
+ const orchestrator = existing?.recall ? existing : new Orchestrator(cfg);
8844
7253
  const isFirstRegistration = !globalThis[keys.REGISTERED_GUARD];
8845
7254
  globalThis[keys.REGISTERED_GUARD] = true;
8846
7255
  const hookApis = globalThis[keys.HOOK_APIS] ??= /* @__PURE__ */ new WeakSet();
@@ -8883,15 +7292,15 @@ var pluginDefinition = {
8883
7292
  citationsAutoDetect: cfg.citationsAutoDetect
8884
7293
  });
8885
7294
  globalThis[keys.ACCESS_HTTP_SERVER] = accessHttpServer;
8886
- const pluginStateDir = path92.join(cfg.memoryDir, "state", "plugins", serviceId);
8887
- const togglePrimaryPath = path92.join(pluginStateDir, "session-toggles.json");
8888
- const toggleSecondaryPath = cfg.respectBundledActiveMemoryToggle ? path92.join(cfg.memoryDir, "state", "plugins", "active-memory", "session-toggles.json") : void 0;
7295
+ const pluginStateDir = path3.join(cfg.memoryDir, "state", "plugins", serviceId);
7296
+ const togglePrimaryPath = path3.join(pluginStateDir, "session-toggles.json");
7297
+ const toggleSecondaryPath = cfg.respectBundledActiveMemoryToggle ? path3.join(cfg.memoryDir, "state", "plugins", "active-memory", "session-toggles.json") : void 0;
8889
7298
  const sessionToggleStore = createFileToggleStore(togglePrimaryPath, {
8890
7299
  secondaryReadOnlyPath: toggleSecondaryPath
8891
7300
  });
8892
7301
  const dreamsSurface = createDreamsSurface();
8893
7302
  const heartbeatSurface = createHeartbeatSurface();
8894
- const dreamNarrativeClient = cfg.openaiApiKey ? new OpenAI2({
7303
+ const dreamNarrativeClient = cfg.openaiApiKey ? new OpenAI({
8895
7304
  ["api"+"Key"]: cfg.openaiApiKey,
8896
7305
  ...cfg.openaiBaseUrl ? { baseURL: cfg.openaiBaseUrl } : {}
8897
7306
  }) : null;
@@ -8907,11 +7316,11 @@ var pluginDefinition = {
8907
7316
  }
8908
7317
  function resolveDreamJournalPath(runtimeWorkspaceDir) {
8909
7318
  const workspaceRoot = resolveWorkspaceRoot(runtimeWorkspaceDir);
8910
- return path92.isAbsolute(cfg.dreaming.journalPath) ? cfg.dreaming.journalPath : path92.join(workspaceRoot, cfg.dreaming.journalPath);
7319
+ return path3.isAbsolute(cfg.dreaming.journalPath) ? cfg.dreaming.journalPath : path3.join(workspaceRoot, cfg.dreaming.journalPath);
8911
7320
  }
8912
7321
  function resolveHeartbeatJournalPath(runtimeWorkspaceDir) {
8913
7322
  const workspaceRoot = resolveWorkspaceRoot(runtimeWorkspaceDir);
8914
- return path92.isAbsolute(cfg.heartbeat.journalPath) ? cfg.heartbeat.journalPath : path92.join(workspaceRoot, cfg.heartbeat.journalPath);
7323
+ return path3.isAbsolute(cfg.heartbeat.journalPath) ? cfg.heartbeat.journalPath : path3.join(workspaceRoot, cfg.heartbeat.journalPath);
8915
7324
  }
8916
7325
  function queueDreamSurfaceSync(runtimeWorkspaceDir) {
8917
7326
  if (!cfg.dreaming.enabled) return Promise.resolve();
@@ -9069,7 +7478,7 @@ Keep the reflection grounded in the evidence below.
9069
7478
  timeoutMs: cfg.activeRecallTimeoutMs,
9070
7479
  cacheTtlMs: cfg.activeRecallCacheTtlMs,
9071
7480
  persistTranscripts: cfg.activeRecallPersistTranscripts,
9072
- transcriptDir: path92.isAbsolute(cfg.activeRecallTranscriptDir) ? cfg.activeRecallTranscriptDir : path92.join(pluginStateDir, cfg.activeRecallTranscriptDir),
7481
+ transcriptDir: path3.isAbsolute(cfg.activeRecallTranscriptDir) ? cfg.activeRecallTranscriptDir : path3.join(pluginStateDir, cfg.activeRecallTranscriptDir),
9073
7482
  entityGraphDepth: cfg.activeRecallEntityGraphDepth,
9074
7483
  includeCausalTrajectories: cfg.activeRecallIncludeCausalTrajectories,
9075
7484
  includeDaySummary: cfg.activeRecallIncludeDaySummary,
@@ -9115,7 +7524,7 @@ Keep the reflection grounded in the evidence below.
9115
7524
  codexLogicalSessionKey(resolvedThreadId)
9116
7525
  );
9117
7526
  }
9118
- const principal = resolvePrincipal2(sessionKey, cfg);
7527
+ const principal = resolvePrincipal(sessionKey, cfg);
9119
7528
  return `${resolvedThreadId}::principal:${principal}`;
9120
7529
  }, rememberCodexThread2 = function(sessionKey, providerThreadId) {
9121
7530
  if (!providerThreadId) return;
@@ -9316,10 +7725,10 @@ Keep the reflection grounded in the evidence below.
9316
7725
  return false;
9317
7726
  }
9318
7727
  }, resolveExtractionBufferKey2 = function(sessionKey, logicalSessionKey) {
9319
- if (!cfg.namespacesEnabled || !logicalSessionKey.startsWith(CODEX_THREAD_KEY_PREFIX2)) {
7728
+ if (!cfg.namespacesEnabled || !logicalSessionKey.startsWith(CODEX_THREAD_KEY_PREFIX)) {
9320
7729
  return logicalSessionKey;
9321
7730
  }
9322
- const principal = resolvePrincipal2(sessionKey, cfg);
7731
+ const principal = resolvePrincipal(sessionKey, cfg);
9323
7732
  return `${logicalSessionKey}::principal:${principal}`;
9324
7733
  }, buildMemoryContextLines2 = function(trimmed) {
9325
7734
  return [
@@ -9368,7 +7777,7 @@ Keep the reflection grounded in the evidence below.
9368
7777
  };
9369
7778
  var resolveStoredCodexThreadId = resolveStoredCodexThreadId2, resolveStoredCodexBufferKey = resolveStoredCodexBufferKey2, addSessionToCodexIndex = addSessionToCodexIndex2, removeSessionFromCodexIndex = removeSessionFromCodexIndex2, resolveCodexCompactionBaselineKey = resolveCodexCompactionBaselineKey2, resolveCodexPromptCacheKey = resolveCodexPromptCacheKey2, rememberCodexThread = rememberCodexThread2, forgetCodexThread = forgetCodexThread2, clearCodexCompatCaches = clearCodexCompatCaches2, hasExplicitProviderIdentity = hasExplicitProviderIdentity2, cachePromptMemoryLines = cachePromptMemoryLines2, consumePromptMemoryLines = consumePromptMemoryLines2, resolveSessionIdentity = resolveSessionIdentity2, hasBufferedTurns = hasBufferedTurns2, resolveExtractionBufferKey = resolveExtractionBufferKey2, buildMemoryContextLines = buildMemoryContextLines2, renderMemoryContextPrompt = renderMemoryContextPrompt2, isHeartbeatTrigger = isHeartbeatTrigger2, resolveHeartbeatPromptCandidates = resolveHeartbeatPromptCandidates2, matchHeartbeatEntry = matchHeartbeatEntry2, looksLikeHeartbeatPrompt = looksLikeHeartbeatPrompt2;
9370
7779
  const hooksPolicy = readPluginHooksPolicy(api.config, serviceId);
9371
- const promptInjectionAllowed = hooksPolicy?.allowPromptInjection !== false;
7780
+ const promptInjectionAllowed = coerceRawConfigBoolean(hooksPolicy?.allowPromptInjection) !== false;
9372
7781
  const useMemoryPromptSection = sdkCaps.hasRegisterMemoryPromptSection && typeof api.registerMemoryPromptSection === "function" && promptInjectionAllowed;
9373
7782
  const warnedBundledActiveMemoryCollisionAgents = /* @__PURE__ */ new Set();
9374
7783
  const cachedMemoryBySession = /* @__PURE__ */ new Map();
@@ -9623,7 +8032,7 @@ Keep the reflection grounded in the evidence below.
9623
8032
  if (toggleState.disabled) {
9624
8033
  lastRecallSummaryBySession.set(sessionKey, null);
9625
8034
  if (cfg.recallTranscriptsEnabled) {
9626
- await appendRecallAuditEntry2(recallAuditDir, {
8035
+ await appendRecallAuditEntry(recallAuditDir, {
9627
8036
  ts: (/* @__PURE__ */ new Date()).toISOString(),
9628
8037
  sessionKey,
9629
8038
  agentId,
@@ -9693,7 +8102,7 @@ Keep the reflection grounded in the evidence below.
9693
8102
  orchestrator.setRecallWorkspaceOverride(sessionKey, agentWorkspace);
9694
8103
  }
9695
8104
  }
9696
- const plannerPreflightMode = planRecallMode2(prompt);
8105
+ const plannerPreflightMode = planRecallMode(prompt);
9697
8106
  const bundledActiveMemoryEnabledForAgent = isBundledActiveMemoryEnabledForAgent(
9698
8107
  rawRuntimeConfig,
9699
8108
  fileBackedRawRuntimeConfig,
@@ -9756,7 +8165,7 @@ Keep the reflection grounded in the evidence below.
9756
8165
  auxiliarySummary
9757
8166
  );
9758
8167
  if (cfg.recallTranscriptsEnabled) {
9759
- await appendRecallAuditEntry2(recallAuditDir, {
8168
+ await appendRecallAuditEntry(recallAuditDir, {
9760
8169
  ts: (/* @__PURE__ */ new Date()).toISOString(),
9761
8170
  sessionKey,
9762
8171
  agentId,
@@ -9790,7 +8199,7 @@ Keep the reflection grounded in the evidence below.
9790
8199
  const summaryText = summarizeRecallTextForStatus(activeRecallResult?.summary ?? null) ?? summarizeRecallTextForStatus(trimmed);
9791
8200
  lastRecallSummaryBySession.set(sessionKey, summaryText);
9792
8201
  if (cfg.recallTranscriptsEnabled) {
9793
- await appendRecallAuditEntry2(recallAuditDir, {
8202
+ await appendRecallAuditEntry(recallAuditDir, {
9794
8203
  ts: (/* @__PURE__ */ new Date()).toISOString(),
9795
8204
  sessionKey,
9796
8205
  agentId,
@@ -9940,25 +8349,25 @@ Keep the reflection grounded in the evidence below.
9940
8349
  const runtimeAgent = api.runtime?.agent;
9941
8350
  const runtimeAgentId = typeof runtimeAgent?.id === "string" && runtimeAgent.id.length > 0 ? runtimeAgent.id : void 0;
9942
8351
  const capabilityAgentIds = runtimeAgentId ? [runtimeAgentId] : ["generalist"];
9943
- const capabilityWorkspaceDir = (typeof runtimeAgent?.workspaceDir === "string" && runtimeAgent.workspaceDir.length > 0 ? runtimeAgent.workspaceDir : void 0) ?? orchestrator.config.workspaceDir ?? (0, orchestrator_exports.defaultWorkspaceDir)();
8352
+ const capabilityWorkspaceDir = (typeof runtimeAgent?.workspaceDir === "string" && runtimeAgent.workspaceDir.length > 0 ? runtimeAgent.workspaceDir : void 0) ?? orchestrator.config.workspaceDir ?? defaultWorkspaceDir();
9944
8353
  const remnicUsesQmd = (orchestrator.config.searchBackend ?? "qmd") === "qmd" && orchestrator.config.qmdEnabled !== false;
9945
8354
  const remnicQmdCommand = typeof orchestrator.config.qmdPath === "string" && orchestrator.config.qmdPath.trim().length > 0 ? orchestrator.config.qmdPath.trim() : "qmd";
9946
8355
  const readAllowedRoots = [
9947
8356
  orchestrator.config.memoryDir,
9948
- capabilityWorkspaceDir ? path92.join(capabilityWorkspaceDir, "memory") : void 0
8357
+ capabilityWorkspaceDir ? path3.join(capabilityWorkspaceDir, "memory") : void 0
9949
8358
  ].filter((root) => typeof root === "string" && root.length > 0);
9950
8359
  const canonicalizeRootForContainment = async (rawPath) => {
9951
- const resolved = path92.resolve(rawPath);
8360
+ const resolved = path3.resolve(rawPath);
9952
8361
  try {
9953
- return path92.normalize(await realPathLater(resolved));
8362
+ return path3.normalize(await realPathLater(resolved));
9954
8363
  } catch {
9955
- return path92.normalize(resolved);
8364
+ return path3.normalize(resolved);
9956
8365
  }
9957
8366
  };
9958
8367
  const canonicalizeForRead = async (rawPath) => {
9959
- const resolved = path92.resolve(rawPath);
8368
+ const resolved = path3.resolve(rawPath);
9960
8369
  const real = await realPathLater(resolved);
9961
- return path92.normalize(real);
8370
+ return path3.normalize(real);
9962
8371
  };
9963
8372
  const readAllowedCanonicalRootsPromise = Promise.all(
9964
8373
  readAllowedRoots.map((root) => canonicalizeRootForContainment(root))
@@ -9972,29 +8381,29 @@ Keep the reflection grounded in the evidence below.
9972
8381
  }
9973
8382
  const canonicalRoots = await readAllowedCanonicalRootsPromise;
9974
8383
  return canonicalRoots.some((root) => {
9975
- const relative = path92.relative(root, canonicalCandidatePath);
9976
- return relative === "" || !relative.startsWith("..") && !path92.isAbsolute(relative);
8384
+ const relative = path3.relative(root, canonicalCandidatePath);
8385
+ return relative === "" || !relative.startsWith("..") && !path3.isAbsolute(relative);
9977
8386
  });
9978
8387
  };
9979
8388
  const normalizeWorkspacePath = (rawPath) => {
9980
8389
  if (!rawPath || typeof rawPath !== "string") return "memory";
9981
- const resolved = path92.isAbsolute(rawPath) ? path92.resolve(rawPath) : path92.resolve(capabilityWorkspaceDir, rawPath);
9982
- const relative = path92.relative(capabilityWorkspaceDir, resolved);
9983
- return relative && !relative.startsWith("..") && !path92.isAbsolute(relative) ? relative : rawPath;
8390
+ const resolved = path3.isAbsolute(rawPath) ? path3.resolve(rawPath) : path3.resolve(capabilityWorkspaceDir, rawPath);
8391
+ const relative = path3.relative(capabilityWorkspaceDir, resolved);
8392
+ return relative && !relative.startsWith("..") && !path3.isAbsolute(relative) ? relative : rawPath;
9984
8393
  };
9985
8394
  const relativizeToMemoryRoot = (rawPath) => {
9986
8395
  if (!rawPath || typeof rawPath !== "string") return "memory";
9987
- const resolved = path92.isAbsolute(rawPath) ? path92.resolve(rawPath) : path92.resolve(capabilityWorkspaceDir, rawPath);
8396
+ const resolved = path3.isAbsolute(rawPath) ? path3.resolve(rawPath) : path3.resolve(capabilityWorkspaceDir, rawPath);
9988
8397
  for (const root of readAllowedRoots) {
9989
- const relative = path92.relative(root, resolved);
9990
- if (relative !== "" && !relative.startsWith("..") && !path92.isAbsolute(relative)) {
8398
+ const relative = path3.relative(root, resolved);
8399
+ if (relative !== "" && !relative.startsWith("..") && !path3.isAbsolute(relative)) {
9991
8400
  return relative;
9992
8401
  }
9993
8402
  }
9994
8403
  return normalizeWorkspacePath(rawPath);
9995
8404
  };
9996
8405
  const resolveReadablePath = async (requestedPath) => {
9997
- const candidateAbsolutePaths = path92.isAbsolute(requestedPath) ? [path92.resolve(requestedPath)] : readAllowedRoots.map((root) => path92.resolve(root, requestedPath));
8406
+ const candidateAbsolutePaths = path3.isAbsolute(requestedPath) ? [path3.resolve(requestedPath)] : readAllowedRoots.map((root) => path3.resolve(root, requestedPath));
9998
8407
  let canonicalPath;
9999
8408
  let lastError;
10000
8409
  for (const absolutePath of candidateAbsolutePaths) {
@@ -10012,8 +8421,8 @@ Keep the reflection grounded in the evidence below.
10012
8421
  }
10013
8422
  const canonicalRoots = await readAllowedCanonicalRootsPromise;
10014
8423
  const contained = canonicalRoots.some((root) => {
10015
- const relative = path92.relative(root, canonicalPath);
10016
- return relative === "" || !relative.startsWith("..") && !path92.isAbsolute(relative);
8424
+ const relative = path3.relative(root, canonicalPath);
8425
+ return relative === "" || !relative.startsWith("..") && !path3.isAbsolute(relative);
10017
8426
  });
10018
8427
  if (!contained) {
10019
8428
  throw new Error(`memory read outside allowed roots: ${requestedPath}`);
@@ -10045,15 +8454,15 @@ Keep the reflection grounded in the evidence below.
10045
8454
  }).map((result, index) => {
10046
8455
  const candidate = result;
10047
8456
  const rawPath = typeof candidate.path === "string" ? candidate.path : typeof candidate.id === "string" ? candidate.id : `memory-${index + 1}`;
10048
- const absolutePath = path92.isAbsolute(rawPath) ? path92.resolve(rawPath) : (() => {
8457
+ const absolutePath = path3.isAbsolute(rawPath) ? path3.resolve(rawPath) : (() => {
10049
8458
  for (const root of readAllowedRoots) {
10050
- const candidateAbs = path92.resolve(root, rawPath);
10051
- const relative = path92.relative(root, candidateAbs);
10052
- if (!relative.startsWith("..") && !path92.isAbsolute(relative)) {
8459
+ const candidateAbs = path3.resolve(root, rawPath);
8460
+ const relative = path3.relative(root, candidateAbs);
8461
+ if (!relative.startsWith("..") && !path3.isAbsolute(relative)) {
10053
8462
  return candidateAbs;
10054
8463
  }
10055
8464
  }
10056
- return path92.resolve(capabilityWorkspaceDir, rawPath);
8465
+ return path3.resolve(capabilityWorkspaceDir, rawPath);
10057
8466
  })();
10058
8467
  const normalizedPath = relativizeToMemoryRoot(rawPath);
10059
8468
  const startLine = typeof candidate.startLine === "number" && Number.isFinite(candidate.startLine) ? Math.max(1, Math.floor(candidate.startLine)) : 1;
@@ -10409,13 +8818,13 @@ Keep the reflection grounded in the evidence below.
10409
8818
  } else if (Array.isArray(event.messages)) {
10410
8819
  for (const msg of event.messages) {
10411
8820
  if (typeof msg.content === "string") {
10412
- tokensBefore += (0, archive_exports.estimateTokens)(msg.content);
8821
+ tokensBefore += estimateLcmTokens(msg.content);
10413
8822
  } else if (Array.isArray(msg.content)) {
10414
8823
  for (const block of msg.content) {
10415
8824
  if (typeof block === "string")
10416
- tokensBefore += (0, archive_exports.estimateTokens)(block);
8825
+ tokensBefore += estimateLcmTokens(block);
10417
8826
  else if (block && typeof block === "object" && typeof block.text === "string")
10418
- tokensBefore += (0, archive_exports.estimateTokens)(block.text);
8827
+ tokensBefore += estimateLcmTokens(block.text);
10419
8828
  }
10420
8829
  }
10421
8830
  }
@@ -10500,7 +8909,7 @@ Keep the reflection grounded in the evidence below.
10500
8909
  logger_exports.log.info(
10501
8910
  `compaction completed for ${sessionKey}, triggering session reset`
10502
8911
  );
10503
- const workspaceDir = ctx?.workspaceDir || event?.workspaceDir || orchestrator.config.workspaceDir || (0, orchestrator_exports.defaultWorkspaceDir)();
8912
+ const workspaceDir = ctx?.workspaceDir || event?.workspaceDir || orchestrator.config.workspaceDir || defaultWorkspaceDir();
10504
8913
  const apiAny = api;
10505
8914
  if (typeof apiAny.resetSession === "function") {
10506
8915
  const result = await apiAny.resetSession(sessionKey, "new");
@@ -10508,8 +8917,8 @@ Keep the reflection grounded in the evidence below.
10508
8917
  logger_exports.log.info(
10509
8918
  `session reset via API for ${sessionKey}, new sessionId=${result.sessionId}`
10510
8919
  );
10511
- const safeSessionKey = (0, orchestrator_exports.sanitizeSessionKeyForFilename)(sessionKey);
10512
- const signalPath = path92.join(
8920
+ const safeSessionKey = sanitizeSessionKeyForFilename(sessionKey);
8921
+ const signalPath = path3.join(
10513
8922
  workspaceDir,
10514
8923
  `.compaction-reset-signal-${safeSessionKey}`
10515
8924
  );
@@ -10576,11 +8985,11 @@ Keep the reflection grounded in the evidence below.
10576
8985
  })() : Promise.resolve();
10577
8986
  const boundedFlush = flushEnabled ? Promise.race([
10578
8987
  flushPromise,
10579
- new Promise((resolve2) => {
8988
+ new Promise((resolve) => {
10580
8989
  timeoutId = setTimeout(() => {
10581
8990
  flushTimedOut = true;
10582
8991
  flushAbort.abort();
10583
- resolve2();
8992
+ resolve();
10584
8993
  }, cfg.beforeResetTimeoutMs);
10585
8994
  })
10586
8995
  ]) : flushPromise;
@@ -10723,7 +9132,7 @@ Keep the reflection grounded in the evidence below.
10723
9132
  description: "Observe legacy heartbeat events for session observation."
10724
9133
  }
10725
9134
  );
10726
- const runtimeVersion = runtimeApi.runtime?.version || (0, env_exports.readEnvVar)("OPENCLAW_SERVICE_VERSION") || "unknown";
9135
+ const runtimeVersion = runtimeApi.runtime?.version || readEnvVar("OPENCLAW_SERVICE_VERSION") || "unknown";
10727
9136
  void import("./legacy-hook-compat-QHHKF4GK.js").then(({ shouldRegisterTypedAgentHeartbeat }) => {
10728
9137
  if (shouldRegisterTypedAgentHeartbeat(runtimeVersion)) {
10729
9138
  api.on(
@@ -10751,22 +9160,22 @@ Keep the reflection grounded in the evidence below.
10751
9160
  }
10752
9161
  async function ensureHourlySummaryCron(api2) {
10753
9162
  const jobId = "engram-hourly-summary";
10754
- const cronFilePath = path92.join(
10755
- os7.homedir(),
9163
+ const cronFilePath = path3.join(
9164
+ os.homedir(),
10756
9165
  ".openclaw",
10757
9166
  "cron",
10758
9167
  "jobs.json"
10759
9168
  );
10760
9169
  try {
10761
- let jobsData = {
10762
- version: 1,
10763
- jobs: []
10764
- };
10765
- try {
10766
- const content = await readTextFileLater(cronFilePath);
10767
- jobsData = JSON.parse(content);
10768
- } catch {
9170
+ const loadedJobs = await loadHourlySummaryCronJobsData(cronFilePath);
9171
+ if (loadedJobs.status === "invalid") {
9172
+ logger_exports.log.error(
9173
+ `hourly summary cron auto-registration skipped: existing jobs file is invalid at ${cronFilePath}`,
9174
+ loadedJobs.error
9175
+ );
9176
+ return;
10769
9177
  }
9178
+ const jobsData = loadedJobs.status === "loaded" ? loadedJobs.jobsData : { version: 1, jobs: [] };
10770
9179
  const exists = jobsData.jobs.some((j) => j.id === jobId);
10771
9180
  if (exists) {
10772
9181
  logger_exports.log.debug("hourly summary cron job already exists");
@@ -10817,32 +9226,32 @@ Keep the reflection grounded in the evidence below.
10817
9226
  };
10818
9227
  const normalizeCorpusPath = (value) => value.trim().replace(/\\/g, "/").replace(/^\.\//, "");
10819
9228
  const pathIsInside = (root, candidate) => {
10820
- const relative = path92.relative(root, candidate);
10821
- return relative === "" || !relative.startsWith("..") && !path92.isAbsolute(relative);
9229
+ const relative = path3.relative(root, candidate);
9230
+ return relative === "" || !relative.startsWith("..") && !path3.isAbsolute(relative);
10822
9231
  };
10823
9232
  const corpusPathCandidates = (rawPath, storageDir) => {
10824
9233
  const candidates = /* @__PURE__ */ new Set();
10825
9234
  const trimmed = rawPath.trim();
10826
9235
  if (!trimmed) return [];
10827
9236
  candidates.add(normalizeCorpusPath(trimmed));
10828
- if (path92.isAbsolute(trimmed)) {
10829
- const absolutePath = path92.resolve(trimmed);
10830
- const absoluteStorageDir = path92.resolve(storageDir);
9237
+ if (path3.isAbsolute(trimmed)) {
9238
+ const absolutePath = path3.resolve(trimmed);
9239
+ const absoluteStorageDir = path3.resolve(storageDir);
10831
9240
  if (pathIsInside(absoluteStorageDir, absolutePath)) {
10832
- candidates.add(normalizeCorpusPath(path92.relative(absoluteStorageDir, absolutePath)));
9241
+ candidates.add(normalizeCorpusPath(path3.relative(absoluteStorageDir, absolutePath)));
10833
9242
  }
10834
9243
  }
10835
- candidates.add(path92.basename(trimmed));
9244
+ candidates.add(path3.basename(trimmed));
10836
9245
  return [...candidates].filter((candidate) => candidate.length > 0);
10837
9246
  };
10838
9247
  const displayCorpusPath = (rawPath, storageDir) => {
10839
9248
  const trimmed = rawPath.trim();
10840
9249
  if (!trimmed) return "";
10841
- if (path92.isAbsolute(trimmed)) {
10842
- const absolutePath = path92.resolve(trimmed);
10843
- const absoluteStorageDir = path92.resolve(storageDir);
9250
+ if (path3.isAbsolute(trimmed)) {
9251
+ const absolutePath = path3.resolve(trimmed);
9252
+ const absoluteStorageDir = path3.resolve(storageDir);
10844
9253
  if (pathIsInside(absoluteStorageDir, absolutePath)) {
10845
- return normalizeCorpusPath(path92.relative(absoluteStorageDir, absolutePath));
9254
+ return normalizeCorpusPath(path3.relative(absoluteStorageDir, absolutePath));
10846
9255
  }
10847
9256
  }
10848
9257
  return normalizeCorpusPath(trimmed);
@@ -10980,7 +9389,7 @@ Keep the reflection grounded in the evidence below.
10980
9389
  orchestrator
10981
9390
  );
10982
9391
  if (orchestrator.lcmEngine?.enabled) {
10983
- (0, lcm_exports.registerLcmTools)(
9392
+ registerLcmTools(
10984
9393
  api,
10985
9394
  orchestrator.lcmEngine
10986
9395
  );
@@ -11079,7 +9488,7 @@ Keep the reflection grounded in the evidence below.
11079
9488
  if (cfg.agentAccessHttp.enabled) {
11080
9489
  if (!didCountStart) return;
11081
9490
  if (authCredentialIsSecretRef) {
11082
- const resolved = await resolveAgentAccessAuthCredential2(rawAuthCredential, {
9491
+ const resolved = await resolveAgentAccessAuthCredential(rawAuthCredential, {
11083
9492
  resolveSecretRef: await loadOpenClawSecretRefResolver()
11084
9493
  });
11085
9494
  if (!resolved) {
@@ -11162,7 +9571,7 @@ Keep the reflection grounded in the evidence below.
11162
9571
  await currentInitPromise;
11163
9572
  } catch {
11164
9573
  }
11165
- await new Promise((resolve2) => queueMicrotask(resolve2));
9574
+ await new Promise((resolve) => queueMicrotask(resolve));
11166
9575
  if (globalThis[keys.INIT_PROMISE] || globalThis[keys.SERVICE_STARTED]) {
11167
9576
  secondaryTookOver = true;
11168
9577
  }
@@ -11222,9 +9631,10 @@ function extractTextContent(msg) {
11222
9631
  }
11223
9632
 
11224
9633
  // src/bridge.ts
11225
- import fs15 from "fs";
11226
- import path93 from "path";
9634
+ import fs from "fs";
9635
+ import path4 from "path";
11227
9636
  import { Worker } from "worker_threads";
9637
+ import { expandTildePath as expandTildePath2 } from "@remnic/core";
11228
9638
  var DEFAULT_HOST = "127.0.0.1";
11229
9639
  var DEFAULT_PORT = 4318;
11230
9640
  var LEGACY_HEALTH_PATH = "/engram/v1/health";
@@ -11283,7 +9693,7 @@ function readEnv(name) {
11283
9693
  const env = globalThis.process?.["env"];
11284
9694
  return env?.[name];
11285
9695
  }
11286
- function resolveHomeDir3() {
9696
+ function resolveHomeDir2() {
11287
9697
  return readEnv("HOME") ?? readEnv("USERPROFILE") ?? "~";
11288
9698
  }
11289
9699
  function readCompatEnv(primary, legacy) {
@@ -11292,27 +9702,27 @@ function readCompatEnv(primary, legacy) {
11292
9702
  function configPathCandidates() {
11293
9703
  const envPath = readCompatEnv("REMNIC_CONFIG_PATH", "ENGRAM_CONFIG_PATH");
11294
9704
  return [
11295
- ...envPath ? [path93.resolve(envPath)] : [],
11296
- path93.join(resolveHomeDir3(), ".config", "remnic", "config.json"),
11297
- path93.join(resolveHomeDir3(), ".config", "engram", "config.json"),
11298
- path93.join(process.cwd(), "remnic.config.json"),
11299
- path93.join(process.cwd(), "engram.config.json")
9705
+ ...envPath ? [path4.resolve(expandTildePath2(envPath))] : [],
9706
+ path4.join(resolveHomeDir2(), ".config", "remnic", "config.json"),
9707
+ path4.join(resolveHomeDir2(), ".config", "engram", "config.json"),
9708
+ path4.join(process.cwd(), "remnic.config.json"),
9709
+ path4.join(process.cwd(), "engram.config.json")
11300
9710
  ];
11301
9711
  }
11302
- function fileExists2(filePath) {
9712
+ function fileExists(filePath) {
11303
9713
  try {
11304
- return fs15.statSync(filePath).isFile();
9714
+ return fs.statSync(filePath).isFile();
11305
9715
  } catch {
11306
9716
  return false;
11307
9717
  }
11308
9718
  }
11309
9719
  function isDaemonRunning() {
11310
9720
  for (const pidFile of [
11311
- path93.join(resolveHomeDir3(), ".remnic", "server.pid"),
11312
- path93.join(resolveHomeDir3(), ".engram", "server.pid")
9721
+ path4.join(resolveHomeDir2(), ".remnic", "server.pid"),
9722
+ path4.join(resolveHomeDir2(), ".engram", "server.pid")
11313
9723
  ]) {
11314
9724
  try {
11315
- const pid = parseInt(fs15["re"+"ad"+"Fi"+"le"+"Sync"](pidFile, "utf8").trim(), 10);
9725
+ const pid = parseInt(fs["re"+"ad"+"Fi"+"le"+"Sync"](pidFile, "utf8").trim(), 10);
11316
9726
  process.kill(pid, 0);
11317
9727
  return true;
11318
9728
  } catch {
@@ -11321,9 +9731,9 @@ function isDaemonRunning() {
11321
9731
  return false;
11322
9732
  }
11323
9733
  function isDaemonServiceConfigured() {
11324
- const homeDir = resolveHomeDir3();
9734
+ const homeDir = resolveHomeDir2();
11325
9735
  for (const segments of [...LAUNCHD_SERVICE_PATHS, ...SYSTEMD_SERVICE_PATHS]) {
11326
- if (fileExists2(path93.join(homeDir, ...segments))) return true;
9736
+ if (fileExists(path4.join(homeDir, ...segments))) return true;
11327
9737
  }
11328
9738
  return false;
11329
9739
  }
@@ -11367,9 +9777,9 @@ function readDaemonPort() {
11367
9777
  const envPort = coerceDaemonPort(readCompatEnv("REMNIC_PORT", "ENGRAM_PORT"));
11368
9778
  if (envPort !== void 0) return envPort;
11369
9779
  for (const p of configPathCandidates()) {
11370
- if (!fs15.existsSync(p)) continue;
9780
+ if (!fs.existsSync(p)) continue;
11371
9781
  try {
11372
- const raw = JSON.parse(fs15["re"+"ad"+"Fi"+"le"+"Sync"](p, "utf8"));
9782
+ const raw = JSON.parse(fs["re"+"ad"+"Fi"+"le"+"Sync"](p, "utf8"));
11373
9783
  const configPort = coerceDaemonPort(raw.server?.port);
11374
9784
  if (configPort !== void 0) return configPort;
11375
9785
  } catch {
@@ -11411,13 +9821,13 @@ function detectBridgeMode() {
11411
9821
  }
11412
9822
  function loadAnyToken() {
11413
9823
  const tokenPaths = [
11414
- path93.join(resolveHomeDir3(), ".remnic", "tokens.json"),
11415
- path93.join(resolveHomeDir3(), ".engram", "tokens.json")
9824
+ path4.join(resolveHomeDir2(), ".remnic", "tokens.json"),
9825
+ path4.join(resolveHomeDir2(), ".engram", "tokens.json")
11416
9826
  ];
11417
9827
  for (const tokensPath of tokenPaths) {
11418
- if (!fs15.existsSync(tokensPath)) continue;
9828
+ if (!fs.existsSync(tokensPath)) continue;
11419
9829
  try {
11420
- const store = JSON.parse(fs15["re"+"ad"+"Fi"+"le"+"Sync"](tokensPath, "utf8"));
9830
+ const store = JSON.parse(fs["re"+"ad"+"Fi"+"le"+"Sync"](tokensPath, "utf8"));
11421
9831
  const tokens = Array.isArray(store.tokens) ? store.tokens : [];
11422
9832
  if (tokens.length > 0 && tokens[0].token) return tokens[0].token;
11423
9833
  if (typeof store === "object" && store !== null) {
@@ -11432,8 +9842,8 @@ function loadAnyToken() {
11432
9842
  }
11433
9843
  try {
11434
9844
  for (const p of configPathCandidates()) {
11435
- if (fs15.existsSync(p)) {
11436
- const raw = JSON.parse(fs15["re"+"ad"+"Fi"+"le"+"Sync"](p, "utf8"));
9845
+ if (fs.existsSync(p)) {
9846
+ const raw = JSON.parse(fs["re"+"ad"+"Fi"+"le"+"Sync"](p, "utf8"));
11437
9847
  if (raw.server?.["auth"+"Token"]) return raw.server["auth"+"Token"];
11438
9848
  }
11439
9849
  }
@@ -11447,18 +9857,18 @@ async function checkDaemonHealth(host, port) {
11447
9857
  const token = loadAnyToken();
11448
9858
  const headers = {};
11449
9859
  if (token) headers["Authorization"] = `Bearer ${token}`;
11450
- return new Promise((resolve2) => {
9860
+ return new Promise((resolve) => {
11451
9861
  const req = request(
11452
9862
  { hostname: host, port, path: LEGACY_HEALTH_PATH, method: "GET", timeout: 2e3, headers },
11453
9863
  (res) => {
11454
- resolve2(res.statusCode === 200);
9864
+ resolve(res.statusCode === 200);
11455
9865
  res.resume();
11456
9866
  }
11457
9867
  );
11458
- req.on("error", () => resolve2(false));
9868
+ req.on("error", () => resolve(false));
11459
9869
  req.on("timeout", () => {
11460
9870
  req.destroy();
11461
- resolve2(false);
9871
+ resolve(false);
11462
9872
  });
11463
9873
  req.end();
11464
9874
  });
@@ -11467,10 +9877,4 @@ async function checkDaemonHealth(host, port) {
11467
9877
  }
11468
9878
  }
11469
9879
  var export_loadDaySummaryPrompt = day_summary_exports.loadDaySummaryPrompt;
11470
- export {
11471
- checkDaemonHealth,
11472
- src_default as default,
11473
- detectBridgeMode,
11474
- listRemnicPublicArtifacts,
11475
- export_loadDaySummaryPrompt as loadDaySummaryPrompt
11476
- };
9880
+ export { checkDaemonHealth, src_default as default, detectBridgeMode, listRemnicPublicArtifacts, export_loadDaySummaryPrompt as loadDaySummaryPrompt, loadHourlySummaryCronJobsData, parseHourlySummaryCronJobsData };