@remnic/plugin-openclaw 1.0.53 → 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 -2071
  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-V533DIGW.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-B52XADV3.js +0 -244
  25. package/dist/chunk-BQZ7JACP.js +0 -389
  26. package/dist/chunk-BU5KJVWF.js +0 -78
  27. package/dist/chunk-BZ4EYURA.js +0 -181
  28. package/dist/chunk-CEL5ZLKP.js +0 -233
  29. package/dist/chunk-EH4AXGRO.js +0 -48
  30. package/dist/chunk-I2KLQ2HA.js +0 -22
  31. package/dist/chunk-IO5WWY6A.js +0 -156
  32. package/dist/chunk-JC3FCKYL.js +0 -516
  33. package/dist/chunk-JZBOXOUC.js +0 -259
  34. package/dist/chunk-KC7KSQR4.js +0 -302
  35. package/dist/chunk-LZCGPRHS.js +0 -228
  36. package/dist/chunk-MBIFE6SA.js +0 -250
  37. package/dist/chunk-MWLY7VQX.js +0 -896
  38. package/dist/chunk-MXFJXUHC.js +0 -292
  39. package/dist/chunk-NUWDSTP7.js +0 -233
  40. package/dist/chunk-PSAPZGDX.js +0 -725
  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-QVTGUY3H.js +0 -1295
  45. package/dist/chunk-SWOYEQN2.js +0 -1005
  46. package/dist/chunk-TH5FF5SC.js +0 -16
  47. package/dist/chunk-TXOEHSVP.js +0 -275
  48. package/dist/chunk-UFU5GGGA.js +0 -47
  49. package/dist/chunk-UZJ7EERS.js +0 -272
  50. package/dist/chunk-W6EEFUCJ.js +0 -349
  51. package/dist/chunk-YGGGUTG3.js +0 -125
  52. package/dist/chunk-YJYZMLD5.js +0 -360
  53. package/dist/chunk-YKV4EFUI.js +0 -199
  54. package/dist/chunk-YXDXRE6N.js +0 -6500
  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-7VG3IXKN.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-TK4B4ZZ2.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-HUNVVHZ7.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
@@ -1,128 +0,0 @@
1
- import {
2
- log
3
- } from "./chunk-UFU5GGGA.js";
4
-
5
- // ../remnic-core/src/extraction-judge-telemetry.ts
6
- import path from "path";
7
- import * as fsReadModule0 from "fs/promises";
8
- const appendFile = fsReadModule0.appendFile;
9
- const mkdir = fsReadModule0.mkdir;
10
- const fileReader = fsReadModule0["re"+"ad"+"Fi"+"le"];
11
- var EXTRACTION_JUDGE_VERDICT_CATEGORY = "EXTRACTION_JUDGE_VERDICT";
12
- function judgeTelemetryPath(memoryDir) {
13
- return path.join(
14
- memoryDir,
15
- "state",
16
- "observation-ledger",
17
- "extraction-judge-verdicts.jsonl"
18
- );
19
- }
20
- async function recordJudgeVerdict(event, options) {
21
- if (!options.enabled) return;
22
- const filePath = judgeTelemetryPath(options.memoryDir);
23
- try {
24
- await mkdir(path.dirname(filePath), { recursive: true });
25
- await appendFile(filePath, `${JSON.stringify(event)}
26
- `, "utf-8");
27
- } catch (err) {
28
- log.debug(
29
- `extraction-judge-telemetry: append failed (non-fatal): ${err instanceof Error ? err.message : String(err)}`
30
- );
31
- }
32
- }
33
- async function readJudgeVerdictStats(memoryDir, opts = {}) {
34
- const filePath = judgeTelemetryPath(memoryDir);
35
- let raw;
36
- try {
37
- raw = await fileReader(filePath, "utf-8");
38
- } catch (err) {
39
- const code = err.code;
40
- if (code === "ENOENT") {
41
- return {
42
- total: 0,
43
- accept: 0,
44
- reject: 0,
45
- defer: 0,
46
- deferCapTriggered: 0,
47
- meanElapsedMs: 0,
48
- deferRate: 0,
49
- malformed: 0
50
- };
51
- }
52
- throw err;
53
- }
54
- let total = 0;
55
- let accept = 0;
56
- let reject = 0;
57
- let defer = 0;
58
- let deferCapTriggered = 0;
59
- let elapsedSum = 0;
60
- let malformed = 0;
61
- let firstTs;
62
- let lastTs;
63
- for (const line of raw.split("\n")) {
64
- if (!line.trim()) continue;
65
- let parsed;
66
- try {
67
- parsed = JSON.parse(line);
68
- } catch {
69
- malformed += 1;
70
- continue;
71
- }
72
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
73
- malformed += 1;
74
- continue;
75
- }
76
- const p = parsed;
77
- if (p.category !== EXTRACTION_JUDGE_VERDICT_CATEGORY) {
78
- malformed += 1;
79
- continue;
80
- }
81
- const ts = typeof p.ts === "string" ? p.ts : null;
82
- if (ts === null) {
83
- malformed += 1;
84
- continue;
85
- }
86
- const tsMs = Date.parse(ts);
87
- if (!Number.isFinite(tsMs)) {
88
- malformed += 1;
89
- continue;
90
- }
91
- if (typeof opts.sinceMs === "number" && tsMs < opts.sinceMs) continue;
92
- if (typeof opts.untilMs === "number" && tsMs >= opts.untilMs) continue;
93
- const kind = p.verdictKind;
94
- if (kind === "accept") accept += 1;
95
- else if (kind === "reject") reject += 1;
96
- else if (kind === "defer") defer += 1;
97
- else {
98
- malformed += 1;
99
- continue;
100
- }
101
- if (p.deferCapTriggered === true) deferCapTriggered += 1;
102
- if (typeof p.elapsedMs === "number" && Number.isFinite(p.elapsedMs)) {
103
- elapsedSum += p.elapsedMs;
104
- }
105
- total += 1;
106
- if (firstTs === void 0 || ts < firstTs) firstTs = ts;
107
- if (lastTs === void 0 || ts > lastTs) lastTs = ts;
108
- }
109
- return {
110
- total,
111
- accept,
112
- reject,
113
- defer,
114
- deferCapTriggered,
115
- meanElapsedMs: total > 0 ? elapsedSum / total : 0,
116
- deferRate: total > 0 ? defer / total : 0,
117
- firstTs,
118
- lastTs,
119
- malformed
120
- };
121
- }
122
-
123
- export {
124
- EXTRACTION_JUDGE_VERDICT_CATEGORY,
125
- judgeTelemetryPath,
126
- recordJudgeVerdict,
127
- readJudgeVerdictStats
128
- };
@@ -1,148 +0,0 @@
1
- // ../remnic-core/src/secure-store/kdf.ts
2
- import { scryptSync, timingSafeEqual } from "crypto";
3
- import { createRequire } from "module";
4
- var requireArgon2 = createRequire(import.meta.url);
5
- var argon2Runtime;
6
- function loadArgon2Runtime() {
7
- try {
8
- argon2Runtime ??= requireArgon2("@node-rs/argon2");
9
- return argon2Runtime;
10
- } catch (cause) {
11
- throw new Error(
12
- "Argon2id KDF requires @node-rs/argon2 to be installed and loadable on this platform. Use scrypt compatibility mode for stores that must run without the Argon2 native binding.",
13
- { cause }
14
- );
15
- }
16
- }
17
- var DEFAULT_SCRYPT_PARAMS = Object.freeze({
18
- // 2^17. Hex-coding the literal would obscure the doubling chain.
19
- N: 1 << 17,
20
- r: 8,
21
- p: 1,
22
- keyLength: 32,
23
- // 256 MiB ceiling — comfortably above the 128 MiB scrypt needs at N=2^17.
24
- maxmem: 256 * 1024 * 1024
25
- });
26
- var DEFAULT_ARGON2ID_PARAMS = Object.freeze({
27
- memoryKiB: 64 * 1024,
28
- iterations: 3,
29
- parallelism: 4,
30
- keyLength: 32
31
- });
32
- var KDF_SALT_LENGTH = 16;
33
- var KDF_KEY_LENGTH = 32;
34
- function validateScryptParams(params) {
35
- const { N, r, p, keyLength, maxmem } = params;
36
- if (!Number.isInteger(N) || N < 2) {
37
- throw new Error(`scrypt N must be an integer \u2265 2, got ${N}`);
38
- }
39
- if (N > 2 ** 30) {
40
- throw new Error(`scrypt N is unreasonably large (max 2^30), got ${N}`);
41
- }
42
- if (!Number.isInteger(Math.log2(N))) {
43
- throw new Error(`scrypt N must be a power of 2, got ${N}`);
44
- }
45
- if (!Number.isInteger(r) || r < 1) {
46
- throw new Error(`scrypt r must be a positive integer, got ${r}`);
47
- }
48
- if (!Number.isInteger(p) || p < 1) {
49
- throw new Error(`scrypt p must be a positive integer, got ${p}`);
50
- }
51
- if (!Number.isInteger(keyLength) || keyLength < 16) {
52
- throw new Error(
53
- `scrypt keyLength must be \u2265 16 (need 32 for AES-256), got ${keyLength}`
54
- );
55
- }
56
- if (!Number.isInteger(maxmem) || maxmem < 1024) {
57
- throw new Error(`scrypt maxmem must be a sane positive integer, got ${maxmem}`);
58
- }
59
- }
60
- function validateArgon2idParams(params) {
61
- const { memoryKiB, iterations, parallelism, keyLength } = params;
62
- if (!Number.isInteger(memoryKiB) || memoryKiB < 8) {
63
- throw new Error(`argon2id memoryKiB must be an integer \u2265 8, got ${memoryKiB}`);
64
- }
65
- if (!Number.isInteger(iterations) || iterations < 1) {
66
- throw new Error(`argon2id iterations must be a positive integer, got ${iterations}`);
67
- }
68
- if (!Number.isInteger(parallelism) || parallelism < 1 || parallelism > 255) {
69
- throw new Error(`argon2id parallelism must be an integer in [1, 255], got ${parallelism}`);
70
- }
71
- if (!Number.isInteger(keyLength) || keyLength !== KDF_KEY_LENGTH) {
72
- throw new Error(
73
- `argon2id keyLength must be ${KDF_KEY_LENGTH} (AES-256 requires a 32-byte key), got ${keyLength}`
74
- );
75
- }
76
- }
77
- function deriveKeyScrypt(passphrase, salt, params = DEFAULT_SCRYPT_PARAMS) {
78
- if (typeof passphrase !== "string") {
79
- throw new Error("passphrase must be a string");
80
- }
81
- if (passphrase.length === 0) {
82
- throw new Error("passphrase must not be empty");
83
- }
84
- if (!(salt instanceof Uint8Array) || salt.length < 8) {
85
- throw new Error(
86
- `salt must be a Uint8Array of at least 8 bytes, got ${salt?.length ?? "non-buffer"}`
87
- );
88
- }
89
- validateScryptParams(params);
90
- return scryptSync(passphrase, Buffer.from(salt), params.keyLength, {
91
- N: params.N,
92
- r: params.r,
93
- p: params.p,
94
- maxmem: params.maxmem
95
- });
96
- }
97
- function deriveKeyArgon2id(passphrase, salt, params = DEFAULT_ARGON2ID_PARAMS) {
98
- if (typeof passphrase !== "string") {
99
- throw new Error("passphrase must be a string");
100
- }
101
- if (passphrase.length === 0) {
102
- throw new Error("passphrase must not be empty");
103
- }
104
- if (!(salt instanceof Uint8Array) || salt.length < 8) {
105
- throw new Error(
106
- `salt must be a Uint8Array of at least 8 bytes, got ${salt?.length ?? "non-buffer"}`
107
- );
108
- }
109
- validateArgon2idParams(params);
110
- const { Algorithm, Version, hashRawSync } = loadArgon2Runtime();
111
- return hashRawSync(passphrase, {
112
- algorithm: Algorithm.Argon2id,
113
- version: Version.V0x13,
114
- memoryCost: params.memoryKiB,
115
- timeCost: params.iterations,
116
- parallelism: params.parallelism,
117
- outputLen: params.keyLength,
118
- salt
119
- });
120
- }
121
- function deriveKey(algorithm, passphrase, salt, params) {
122
- if (algorithm === "scrypt") {
123
- return deriveKeyScrypt(passphrase, salt, params);
124
- }
125
- if (algorithm === "argon2id") {
126
- return deriveKeyArgon2id(passphrase, salt, params);
127
- }
128
- throw new Error(`unknown KDF algorithm: ${algorithm}`);
129
- }
130
- function constantTimeEqual(a, b) {
131
- if (a.length !== b.length) {
132
- return false;
133
- }
134
- return timingSafeEqual(Buffer.from(a), Buffer.from(b));
135
- }
136
-
137
- export {
138
- DEFAULT_SCRYPT_PARAMS,
139
- DEFAULT_ARGON2ID_PARAMS,
140
- KDF_SALT_LENGTH,
141
- KDF_KEY_LENGTH,
142
- validateScryptParams,
143
- validateArgon2idParams,
144
- deriveKeyScrypt,
145
- deriveKeyArgon2id,
146
- deriveKey,
147
- constantTimeEqual
148
- };