@remnic/plugin-openclaw 1.0.35 → 1.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -4
- package/dist/{calibration-Z5WWNV7U.js → calibration-RKL2LRW4.js} +4 -4
- package/dist/{capsule-cli-GBM3WPAM.js → capsule-cli-EHZPMXBC.js} +2 -2
- package/dist/{capsule-crypto-K3IRTKRH.js → capsule-crypto-JS67OSWM.js} +3 -3
- package/dist/capsule-export-DX53CPIT.js +17 -0
- package/dist/capsule-import-4OXCPHOT.js +16 -0
- package/dist/{capsule-merge-IWOQ34KL.js → capsule-merge-25AUN33Q.js} +7 -7
- package/dist/{causal-chain-WYN5QOPS.js → causal-chain-BVTOWZKC.js} +4 -4
- package/dist/{causal-consolidation-C64NNE4T.js → causal-consolidation-DRPM2KOE.js} +13 -10
- package/dist/{causal-retrieval-NZHQOZOE.js → causal-retrieval-XAP6QKHZ.js} +4 -5
- package/dist/{causal-trajectory-graph-VBPE2WPM.js → causal-trajectory-graph-ZWQWZ7N5.js} +2 -2
- package/dist/{chunk-5LE4HTVL.js → chunk-25J4PXDH.js} +0 -18
- package/dist/{chunk-6UFI73TJ.js → chunk-3IKMUNW5.js} +53 -46
- package/dist/{chunk-EXDYWXMB.js → chunk-4XDQ3KEC.js} +1 -2
- package/dist/{chunk-JGIUTWZS.js → chunk-6O3H3DPL.js} +2 -2
- package/dist/{chunk-UTDLHBBV.js → chunk-BLC3RQNV.js} +5 -555
- package/dist/{chunk-4G2XCSD2.js → chunk-BZ4EYURA.js} +0 -5
- package/dist/{chunk-L6I4MQKO.js → chunk-CEL5ZLKP.js} +6 -6
- package/dist/{chunk-TDRJVMUP.js → chunk-EH4AXGRO.js} +0 -12
- package/dist/{chunk-EYCLXMIV.js → chunk-G3CZA4SD.js} +9 -427
- package/dist/chunk-I2KLQ2HA.js +22 -0
- package/dist/chunk-IO5WWY6A.js +156 -0
- package/dist/{contradiction-scan-A5NOTZPN.js → chunk-JC3FCKYL.js} +189 -86
- package/dist/{chunk-SVSQAG6M.js → chunk-KC7KSQR4.js} +47 -28
- package/dist/chunk-LZCGPRHS.js +228 -0
- package/dist/{chunk-CXM7EBAO.js → chunk-MXFJXUHC.js} +1 -1
- package/dist/{chunk-VRGUUHBV.js → chunk-NUWDSTP7.js} +1 -1
- package/dist/{chunk-4LYQ4ONL.js → chunk-QCCP4RU5.js} +8 -3
- package/dist/{chunk-6OJAU466.js → chunk-QMUQV5NP.js} +0 -1
- package/dist/{chunk-LLUROTZJ.js → chunk-QQXJODFL.js} +9 -9
- package/dist/{chunk-6F6EKSVP.js → chunk-QXXEF7VI.js} +1 -1
- package/dist/{chunk-CMKR6NDQ.js → chunk-SEGEX7W4.js} +73 -241
- package/dist/{chunk-VFULKFKI.js → chunk-SWOYEQN2.js} +42 -17
- package/dist/chunk-TH5FF5SC.js +16 -0
- package/dist/{chunk-FGTYFLL5.js → chunk-TXOEHSVP.js} +29 -32
- package/dist/chunk-UZJ7EERS.js +272 -0
- package/dist/chunk-YJYZMLD5.js +360 -0
- package/dist/{chunk-NKVIN6RD.js → chunk-YKV4EFUI.js} +84 -2
- package/dist/{chunk-SSFTU6LP.js → chunk-ZS6VABML.js} +4 -4
- package/dist/{cipher-VHAFCG7Z.js → cipher-E23BHBSO.js} +1 -1
- package/dist/{consolidation-undo-5ZSX4MWO.js → consolidation-undo-FKJZCJHS.js} +2 -2
- package/dist/contradiction-review-WJRWNQ5N.js +29 -0
- package/dist/contradiction-scan-5X423QGT.js +12 -0
- package/dist/{dreams-ledger-3I52ISYR.js → dreams-ledger-KDX44I7R.js} +1 -1
- package/dist/{engine-47AKKYJ4.js → engine-5P774HTZ.js} +6 -6
- package/dist/{extraction-judge-telemetry-GHOTVYMP.js → extraction-judge-telemetry-O4ZVGLTU.js} +1 -1
- package/dist/{fallback-llm-45A755XP.js → fallback-llm-43UMEXNJ.js} +3 -3
- package/dist/{first-start-migration-I24M2JEE.js → first-start-migration-H2SAXAGR.js} +4 -4
- package/dist/{forget-NI4RBDPB.js → forget-ZECIDNL5.js} +1 -1
- package/dist/{fs-utils-PZRI2HDZ.js → fs-utils-OYXSZSVV.js} +12 -2
- package/dist/{graph-edge-decay-5CVKWBYH.js → graph-edge-decay-24ZKD5QL.js} +5 -5
- package/dist/index.js +7098 -84293
- package/dist/{kdf-H5B23ZM2.js → kdf-RXKIWHRU.js} +1 -1
- package/dist/legacy-hook-compat-QHHKF4GK.js +2 -0
- package/dist/{logger-TNOKCH7X.js → logger-XG7JKLPS.js} +1 -1
- package/dist/{memory-governance-QS7Z425Y.js → memory-governance-6K4M4YXD.js} +5 -5
- package/dist/{metadata-JAGIWHEA.js → metadata-WK2TRPYZ.js} +1 -1
- package/dist/{migrate-from-identity-anchor-7MMSPEUM.js → migrate-from-identity-anchor-SNDNKHZD.js} +1 -1
- package/dist/path-ZKO74XXC.js +7 -0
- package/dist/{peers-KRFXWRQ6.js → peers-W53WSDXG.js} +1 -1
- package/dist/{purge-XN2VSPZ2.js → purge-IKJISXEQ.js} +1 -1
- package/dist/resolution-BN35OXDS.js +11 -0
- package/dist/{secure-store-A4NGCNXV.js → secure-store-F75I54O5.js} +3 -3
- package/dist/{state-PVISYXRH.js → state-4ITLYMAU.js} +1 -1
- package/dist/{state-store-N6TFBFSP.js → state-store-ET3ADVY5.js} +3 -3
- package/dist/{storage-DDYQGLXA.js → storage-5EY6T7ON.js} +3 -3
- package/dist/{tier-stats-IZNW66NC.js → tier-stats-ZRQBV6G2.js} +4 -4
- package/dist/{trace-NJESSGH7.js → trace-IL2Y34EH.js} +1 -1
- package/dist/{tui-MGK2LYJY.js → tui-7KRDCMYK.js} +1 -1
- package/dist/{types-R4DO7AKM.js → types-MBUINTB2.js} +3 -3
- package/openclaw.plugin.json +164 -8
- package/package.json +9 -6
- package/scripts/faiss_index.py +816 -0
- package/scripts/faiss_requirements.txt +3 -0
- package/dist/capsule-export-IXVERCQG.js +0 -17
- package/dist/capsule-import-IA6VIOPQ.js +0 -16
- package/dist/chunk-3GUF7RQI.js +0 -559
- package/dist/chunk-7OQEPGQF.js +0 -533
- package/dist/chunk-DIZW6H5J.js +0 -136
- package/dist/chunk-FQRSVYY4.js +0 -110
- package/dist/chunk-GUSMRW4H.js +0 -12
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-WPINX4MF.js +0 -380
- package/dist/contradiction-review-SVGBS3V5.js +0 -21
- package/dist/legacy-hook-compat-XQ7FP6FV.js +0 -35
- package/dist/path-JIEGNWFL.js +0 -7
- package/dist/resolution-YITUVUTH.js +0 -100
package/README.md
CHANGED
|
@@ -164,11 +164,15 @@ CI jobs that provision OpenClaw should use
|
|
|
164
164
|
`npm run check:openclaw-sdk-surface:required` or pass
|
|
165
165
|
`-- --require --package-root <path>` so a missing SDK fails instead of skipping.
|
|
166
166
|
|
|
167
|
-
Last compatibility sweep: May
|
|
167
|
+
Last compatibility sweep: May 19, 2026. The SDK surface check passed against
|
|
168
168
|
`openclaw@2026.5.3`, `openclaw@2026.5.3-1`, `openclaw@2026.5.4-beta.1`,
|
|
169
169
|
`openclaw@2026.5.4-beta.2`, `openclaw@2026.5.4-beta.3`,
|
|
170
|
-
`openclaw@2026.5.4`, `openclaw@2026.5.5`, `openclaw@2026.5.6`,
|
|
171
|
-
`openclaw@2026.5.16-beta.2
|
|
170
|
+
`openclaw@2026.5.4`, `openclaw@2026.5.5`, `openclaw@2026.5.6`,
|
|
171
|
+
`openclaw@2026.5.16-beta.2`, `openclaw@2026.5.16-beta.3`, and
|
|
172
|
+
`openclaw@2026.5.16-beta.4`. The May 19 sweep also checked the source SDK
|
|
173
|
+
surface for `openclaw@2026.5.19-beta.1`, which covers the intervening
|
|
174
|
+
`2026.5.16-beta.6`, `2026.5.16-beta.7`, and `2026.5.18-beta.1` release line
|
|
175
|
+
for the Remnic adapter surfaces.
|
|
172
176
|
Keep the peer range broad unless an upstream release removes a runtime surface
|
|
173
177
|
Remnic actively uses.
|
|
174
178
|
|
|
@@ -186,6 +190,36 @@ ownership to the host, exposes the optional plugin-mode OpenAI key through
|
|
|
186
190
|
`providerAuthChoices`, and keeps `providerAuthEnvVars.openai` as compatibility
|
|
187
191
|
metadata for OpenClaw's pre-runtime env-var auth probes.
|
|
188
192
|
|
|
193
|
+
OpenClaw 2026.5.16-beta.3 keeps those install and auth ownership contracts
|
|
194
|
+
intact. The sweep confirmed that Remnic still relies on host-owned gateway
|
|
195
|
+
restart/reload behavior after plugin install changes, uses `gateway_stop`
|
|
196
|
+
instead of the deprecated `deactivate` cleanup alias, and should not claim
|
|
197
|
+
OpenAI `setup.providers` ownership because gateway/provider configuration
|
|
198
|
+
remains host-owned.
|
|
199
|
+
|
|
200
|
+
OpenClaw 2026.5.16-beta.4 treats `setup.providers[].id` as provider ownership
|
|
201
|
+
metadata with globally unique ids. Remnic does not own the `openai` provider,
|
|
202
|
+
so the canonical manifest keeps OpenAI API-key metadata on `providerAuthChoices`
|
|
203
|
+
and the compatibility `providerAuthEnvVars.openai` surface instead of declaring
|
|
204
|
+
`setup.providers`.
|
|
205
|
+
|
|
206
|
+
OpenClaw 2026.5.16-beta.6 added `defineToolPlugin` and the authoring CLI for
|
|
207
|
+
simple typed tool-only plugins. Remnic intentionally stays on `definePluginEntry`
|
|
208
|
+
because the adapter owns mixed memory-slot hooks, lifecycle handlers, slash
|
|
209
|
+
command metadata, public artifacts, and runtime tools rather than only static
|
|
210
|
+
tools.
|
|
211
|
+
|
|
212
|
+
OpenClaw 2026.5.16-beta.7 through 2026.5.19-beta.1 keep the Remnic-required
|
|
213
|
+
plugin install, ClawHub fallback, manifest contract, hook, memory-slot, gateway
|
|
214
|
+
LLM, and plugin security-scan surfaces compatible. Those newer OpenClaw hosts
|
|
215
|
+
raise their runtime floor to Node.js `>=22.19.0`, but the Remnic adapter package
|
|
216
|
+
keeps its broad host peer range so older advertised 2026.5.16 hosts do not
|
|
217
|
+
select a package with an incompatible package-level engine gate. The manifest
|
|
218
|
+
continues to avoid `setup.providers.openai`; OpenClaw still treats provider ids
|
|
219
|
+
there as ownership metadata, while Remnic only advertises an optional
|
|
220
|
+
plugin-mode OpenAI key through `providerAuthChoices` and the deprecated
|
|
221
|
+
`providerAuthEnvVars.openai` compatibility probe.
|
|
222
|
+
|
|
189
223
|
Native memory registrars are tracked separately in
|
|
190
224
|
[`docs/plugins/openclaw-native-memory-registrars.md`](../../docs/plugins/openclaw-native-memory-registrars.md).
|
|
191
225
|
That spike explains why Remnic currently uses `registerMemoryCapability()` as
|
|
@@ -344,7 +378,7 @@ replays stay idempotent:
|
|
|
344
378
|
"maxEntries": 500,
|
|
345
379
|
"injectRecentCount": 3,
|
|
346
380
|
"minIntervalMinutes": 120,
|
|
347
|
-
"narrativeModel": "gpt-5.
|
|
381
|
+
"narrativeModel": "gpt-5.5",
|
|
348
382
|
"narrativePromptStyle": "reflective",
|
|
349
383
|
"watchFile": true
|
|
350
384
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listJsonFiles
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-25J4PXDH.js";
|
|
4
4
|
import {
|
|
5
5
|
FallbackLlmClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SWOYEQN2.js";
|
|
7
7
|
import "./chunk-3A5ELHTT.js";
|
|
8
8
|
import {
|
|
9
9
|
log
|
|
10
10
|
} from "./chunk-UFU5GGGA.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-EH4AXGRO.js";
|
|
12
|
+
import "./chunk-I2KLQ2HA.js";
|
|
13
13
|
|
|
14
14
|
// ../remnic-core/src/calibration.ts
|
|
15
15
|
import { createHash } from "crypto";
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
parseCapsuleSince,
|
|
14
14
|
renderCapsuleInspect,
|
|
15
15
|
renderCapsuleList
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-QQXJODFL.js";
|
|
17
|
+
import "./chunk-I2KLQ2HA.js";
|
|
18
18
|
export {
|
|
19
19
|
defaultCapsulesDir,
|
|
20
20
|
parseCapsuleConflictMode,
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
decryptCapsuleFileInMemory,
|
|
4
4
|
encryptCapsuleFile,
|
|
5
5
|
isEncryptedCapsuleFile
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-ZS6VABML.js";
|
|
7
|
+
import "./chunk-MXFJXUHC.js";
|
|
8
8
|
import "./chunk-JZBOXOUC.js";
|
|
9
9
|
import "./chunk-6IWEAUN6.js";
|
|
10
10
|
import "./chunk-YGGGUTG3.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-I2KLQ2HA.js";
|
|
12
12
|
export {
|
|
13
13
|
decryptCapsuleFile,
|
|
14
14
|
decryptCapsuleFileInMemory,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
exportCapsule,
|
|
3
|
+
isValidCapsuleSince
|
|
4
|
+
} from "./chunk-TXOEHSVP.js";
|
|
5
|
+
import "./chunk-YKV4EFUI.js";
|
|
6
|
+
import "./chunk-QCCP4RU5.js";
|
|
7
|
+
import "./chunk-ZS6VABML.js";
|
|
8
|
+
import "./chunk-4XDQ3KEC.js";
|
|
9
|
+
import "./chunk-MXFJXUHC.js";
|
|
10
|
+
import "./chunk-JZBOXOUC.js";
|
|
11
|
+
import "./chunk-6IWEAUN6.js";
|
|
12
|
+
import "./chunk-YGGGUTG3.js";
|
|
13
|
+
import "./chunk-I2KLQ2HA.js";
|
|
14
|
+
export {
|
|
15
|
+
exportCapsule,
|
|
16
|
+
isValidCapsuleSince
|
|
17
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
importCapsule
|
|
3
|
+
} from "./chunk-CEL5ZLKP.js";
|
|
4
|
+
import "./chunk-YKV4EFUI.js";
|
|
5
|
+
import "./chunk-QCCP4RU5.js";
|
|
6
|
+
import "./chunk-ZS6VABML.js";
|
|
7
|
+
import "./chunk-4XDQ3KEC.js";
|
|
8
|
+
import "./chunk-MXFJXUHC.js";
|
|
9
|
+
import "./chunk-JZBOXOUC.js";
|
|
10
|
+
import "./chunk-6IWEAUN6.js";
|
|
11
|
+
import "./chunk-QMUQV5NP.js";
|
|
12
|
+
import "./chunk-YGGGUTG3.js";
|
|
13
|
+
import "./chunk-I2KLQ2HA.js";
|
|
14
|
+
export {
|
|
15
|
+
importCapsule
|
|
16
|
+
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
parseExportBundle
|
|
3
|
-
} from "./chunk-4LYQ4ONL.js";
|
|
4
1
|
import {
|
|
5
2
|
assertIsDirectoryNotSymlink,
|
|
6
3
|
assertRealpathInsideRoot,
|
|
7
4
|
fromPosixRelPath,
|
|
8
5
|
isPathInsideRoot,
|
|
9
6
|
sha256String
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import
|
|
7
|
+
} from "./chunk-YKV4EFUI.js";
|
|
8
|
+
import {
|
|
9
|
+
parseExportBundle
|
|
10
|
+
} from "./chunk-QCCP4RU5.js";
|
|
11
|
+
import "./chunk-4XDQ3KEC.js";
|
|
12
12
|
import {
|
|
13
13
|
createVersion
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-QMUQV5NP.js";
|
|
15
|
+
import "./chunk-I2KLQ2HA.js";
|
|
16
16
|
|
|
17
17
|
// ../remnic-core/src/transfer/capsule-merge.ts
|
|
18
18
|
import * as fsReadModule0 from "fs/promises";
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
stitchCausalChain,
|
|
7
7
|
validateCausalEdge,
|
|
8
8
|
writeChainIndex
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-KC7KSQR4.js";
|
|
10
|
+
import "./chunk-3IKMUNW5.js";
|
|
11
11
|
import "./chunk-3G7FAF6S.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-25J4PXDH.js";
|
|
13
13
|
import "./chunk-UFU5GGGA.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-I2KLQ2HA.js";
|
|
15
15
|
export {
|
|
16
16
|
makeEdgeId,
|
|
17
17
|
readChainIndex,
|
|
@@ -1,38 +1,41 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readChainIndex,
|
|
3
3
|
resolveChainsDir
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KC7KSQR4.js";
|
|
5
5
|
import {
|
|
6
6
|
buildExtensionsBlockForConsolidation,
|
|
7
7
|
runPostConsolidationMaterialize
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-SEGEX7W4.js";
|
|
9
|
+
import "./chunk-TH5FF5SC.js";
|
|
10
|
+
import {
|
|
11
|
+
resolveCausalTrajectoryStoreDir
|
|
12
|
+
} from "./chunk-3IKMUNW5.js";
|
|
10
13
|
import {
|
|
11
14
|
isRecord
|
|
12
15
|
} from "./chunk-3G7FAF6S.js";
|
|
13
16
|
import {
|
|
14
17
|
listJsonFiles,
|
|
15
18
|
readJsonFile
|
|
16
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-25J4PXDH.js";
|
|
17
20
|
import {
|
|
18
21
|
FallbackLlmClient
|
|
19
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-SWOYEQN2.js";
|
|
20
23
|
import "./chunk-3A5ELHTT.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-G3CZA4SD.js";
|
|
25
|
+
import "./chunk-QMUQV5NP.js";
|
|
23
26
|
import "./chunk-RKR6PTPA.js";
|
|
24
27
|
import {
|
|
25
28
|
log
|
|
26
29
|
} from "./chunk-UFU5GGGA.js";
|
|
27
30
|
import "./chunk-YGGGUTG3.js";
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-EH4AXGRO.js";
|
|
32
|
+
import "./chunk-I2KLQ2HA.js";
|
|
30
33
|
|
|
31
34
|
// ../remnic-core/src/causal-consolidation.ts
|
|
32
35
|
import { createHash } from "crypto";
|
|
33
36
|
import path from "path";
|
|
34
37
|
async function readAllTrajectories(memoryDir, causalTrajectoryStoreDir) {
|
|
35
|
-
const root =
|
|
38
|
+
const root = resolveCausalTrajectoryStoreDir(memoryDir, causalTrajectoryStoreDir);
|
|
36
39
|
const trajectoriesDir = path.join(root, "trajectories");
|
|
37
40
|
const files = await listJsonFiles(trajectoriesDir).catch(() => []);
|
|
38
41
|
const results = [];
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readChainIndex,
|
|
3
3
|
resolveChainsDir
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KC7KSQR4.js";
|
|
5
5
|
import {
|
|
6
6
|
searchCausalTrajectories
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-WPINX4MF.js";
|
|
7
|
+
} from "./chunk-3IKMUNW5.js";
|
|
9
8
|
import "./chunk-3G7FAF6S.js";
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-25J4PXDH.js";
|
|
11
10
|
import {
|
|
12
11
|
log
|
|
13
12
|
} from "./chunk-UFU5GGGA.js";
|
|
14
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-I2KLQ2HA.js";
|
|
15
14
|
|
|
16
15
|
// ../remnic-core/src/causal-retrieval.ts
|
|
17
16
|
function walkUpstream(seedId, index, maxDepth, counterfactualBoost) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
appendEdge
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-IO5WWY6A.js";
|
|
4
|
+
import "./chunk-I2KLQ2HA.js";
|
|
5
5
|
|
|
6
6
|
// ../remnic-core/src/causal-trajectory-graph.ts
|
|
7
7
|
function causalTrajectoryGraphNodeId(trajectoryId, stage) {
|
|
@@ -20,29 +20,11 @@ async function listJsonFiles(dir) {
|
|
|
20
20
|
return [];
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
async function listNamedFiles(dir, fileName) {
|
|
24
|
-
try {
|
|
25
|
-
const entries = await readdir(dir, { withFileTypes: true });
|
|
26
|
-
const out = [];
|
|
27
|
-
for (const entry of entries) {
|
|
28
|
-
const fullPath = path.join(dir, entry.name);
|
|
29
|
-
if (entry.isDirectory()) {
|
|
30
|
-
out.push(...await listNamedFiles(fullPath, fileName));
|
|
31
|
-
} else if (entry.isFile() && entry.name === fileName) {
|
|
32
|
-
out.push(fullPath);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return out.sort();
|
|
36
|
-
} catch {
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
23
|
async function readJsonFile(filePath) {
|
|
41
24
|
return JSON.parse(await fileReader(filePath, "utf8"));
|
|
42
25
|
}
|
|
43
26
|
|
|
44
27
|
export {
|
|
45
28
|
listJsonFiles,
|
|
46
|
-
listNamedFiles,
|
|
47
29
|
readJsonFile
|
|
48
30
|
};
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
countRecallTokenOverlap,
|
|
3
|
-
normalizeRecallTokens
|
|
4
|
-
} from "./chunk-WPINX4MF.js";
|
|
5
1
|
import {
|
|
6
2
|
assertIsoRecordedAt,
|
|
7
3
|
assertSafePathSegment,
|
|
@@ -14,11 +10,55 @@ import {
|
|
|
14
10
|
import {
|
|
15
11
|
listJsonFiles,
|
|
16
12
|
readJsonFile
|
|
17
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-25J4PXDH.js";
|
|
18
14
|
|
|
19
|
-
// ../remnic-core/src/
|
|
15
|
+
// ../remnic-core/src/boxes.ts
|
|
16
|
+
import * as fsReadModule0 from "fs/promises";
|
|
17
|
+
const mkdir = fsReadModule0.mkdir;
|
|
18
|
+
const writeFile = fsReadModule0.writeFile;
|
|
19
|
+
const fileReader = fsReadModule0["re"+"ad"+"Fi"+"le"];
|
|
20
|
+
const readdir = fsReadModule0.readdir;
|
|
20
21
|
import path from "path";
|
|
21
|
-
import {
|
|
22
|
+
import { createHash } from "crypto";
|
|
23
|
+
function topicOverlapScore(a, b) {
|
|
24
|
+
if (a.length === 0 || b.length === 0) return 0;
|
|
25
|
+
const setA = new Set(a.map((t) => t.toLowerCase()));
|
|
26
|
+
const setB = new Set(b.map((t) => t.toLowerCase()));
|
|
27
|
+
const intersection = [...setA].filter((t) => setB.has(t)).length;
|
|
28
|
+
const union = (/* @__PURE__ */ new Set([...setA, ...setB])).size;
|
|
29
|
+
return union === 0 ? 0 : intersection / union;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// ../remnic-core/src/recall-tokenization.ts
|
|
33
|
+
function normalizeRecallTokens(value, extraStopWords = []) {
|
|
34
|
+
const stopWords = /* @__PURE__ */ new Set([
|
|
35
|
+
"the",
|
|
36
|
+
"and",
|
|
37
|
+
"for",
|
|
38
|
+
"with",
|
|
39
|
+
"from",
|
|
40
|
+
"into",
|
|
41
|
+
"that",
|
|
42
|
+
"this",
|
|
43
|
+
"why",
|
|
44
|
+
"did",
|
|
45
|
+
...extraStopWords
|
|
46
|
+
]);
|
|
47
|
+
return value.toLowerCase().split(/[^a-z0-9]+/).map((token) => token.trim()).filter((token) => token.length >= 3 && !stopWords.has(token));
|
|
48
|
+
}
|
|
49
|
+
function countRecallTokenOverlap(queryTokens, value, extraStopWords = []) {
|
|
50
|
+
if (!value) return 0;
|
|
51
|
+
const tokens = new Set(normalizeRecallTokens(value, extraStopWords));
|
|
52
|
+
let matches = 0;
|
|
53
|
+
for (const token of queryTokens) {
|
|
54
|
+
if (tokens.has(token)) matches += 1;
|
|
55
|
+
}
|
|
56
|
+
return matches;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// ../remnic-core/src/causal-trajectory.ts
|
|
60
|
+
import path2 from "path";
|
|
61
|
+
import { mkdir as mkdir2, writeFile as writeFile2 } from "fs/promises";
|
|
22
62
|
function validateMetadata(raw) {
|
|
23
63
|
return validateStringRecord(raw, "metadata");
|
|
24
64
|
}
|
|
@@ -26,7 +66,7 @@ function resolveCausalTrajectoryStoreDir(memoryDir, overrideDir) {
|
|
|
26
66
|
if (typeof overrideDir === "string" && overrideDir.trim().length > 0) {
|
|
27
67
|
return overrideDir.trim();
|
|
28
68
|
}
|
|
29
|
-
return
|
|
69
|
+
return path2.join(memoryDir, "state", "causal-trajectories");
|
|
30
70
|
}
|
|
31
71
|
function validateCausalTrajectoryRecord(raw) {
|
|
32
72
|
if (!isRecord(raw)) throw new Error("causal trajectory record must be an object");
|
|
@@ -54,7 +94,7 @@ function validateCausalTrajectoryRecord(raw) {
|
|
|
54
94
|
}
|
|
55
95
|
async function readCausalTrajectoryRecords(options) {
|
|
56
96
|
const rootDir = resolveCausalTrajectoryStoreDir(options.memoryDir, options.causalTrajectoryStoreDir);
|
|
57
|
-
const files = await listJsonFiles(
|
|
97
|
+
const files = await listJsonFiles(path2.join(rootDir, "trajectories"));
|
|
58
98
|
const trajectories = [];
|
|
59
99
|
const invalidTrajectories = [];
|
|
60
100
|
for (const filePath of files) {
|
|
@@ -69,40 +109,6 @@ async function readCausalTrajectoryRecords(options) {
|
|
|
69
109
|
}
|
|
70
110
|
return { files, trajectories, invalidTrajectories };
|
|
71
111
|
}
|
|
72
|
-
function filterTrajectoriesByLookbackDays(trajectories, lookbackDays, nowMs = Date.now()) {
|
|
73
|
-
const days = Math.max(1, Math.floor(lookbackDays));
|
|
74
|
-
const cutoff = nowMs - days * 864e5;
|
|
75
|
-
return trajectories.filter((t) => {
|
|
76
|
-
const ms = Date.parse(t.recordedAt);
|
|
77
|
-
return Number.isFinite(ms) && ms >= cutoff;
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
async function getCausalTrajectoryStoreStatus(options) {
|
|
81
|
-
const rootDir = resolveCausalTrajectoryStoreDir(options.memoryDir, options.causalTrajectoryStoreDir);
|
|
82
|
-
const trajectoriesDir = path.join(rootDir, "trajectories");
|
|
83
|
-
const { files, trajectories, invalidTrajectories } = await readCausalTrajectoryRecords(options);
|
|
84
|
-
trajectories.sort((a, b) => b.recordedAt.localeCompare(a.recordedAt));
|
|
85
|
-
const byOutcome = {};
|
|
86
|
-
for (const trajectory of trajectories) {
|
|
87
|
-
byOutcome[trajectory.outcomeKind] = (byOutcome[trajectory.outcomeKind] ?? 0) + 1;
|
|
88
|
-
}
|
|
89
|
-
return {
|
|
90
|
-
enabled: options.enabled,
|
|
91
|
-
rootDir,
|
|
92
|
-
trajectoriesDir,
|
|
93
|
-
trajectories: {
|
|
94
|
-
total: files.length,
|
|
95
|
-
valid: trajectories.length,
|
|
96
|
-
invalid: invalidTrajectories.length,
|
|
97
|
-
byOutcome,
|
|
98
|
-
latestTrajectoryId: trajectories[0]?.trajectoryId,
|
|
99
|
-
latestRecordedAt: trajectories[0]?.recordedAt,
|
|
100
|
-
latestSessionKey: trajectories[0]?.sessionKey
|
|
101
|
-
},
|
|
102
|
-
latestTrajectory: trajectories[0],
|
|
103
|
-
invalidTrajectories
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
112
|
function lexicalScoreCausalTrajectoryRecord(record, queryTokens) {
|
|
107
113
|
const weightedFields = [
|
|
108
114
|
["goal", record.goal, 4],
|
|
@@ -163,8 +169,9 @@ async function searchCausalTrajectories(options) {
|
|
|
163
169
|
}
|
|
164
170
|
|
|
165
171
|
export {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
172
|
+
topicOverlapScore,
|
|
173
|
+
normalizeRecallTokens,
|
|
174
|
+
countRecallTokenOverlap,
|
|
175
|
+
resolveCausalTrajectoryStoreDir,
|
|
169
176
|
searchCausalTrajectories
|
|
170
177
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-I2KLQ2HA.js";
|
|
4
4
|
|
|
5
5
|
// ../../node_modules/zod/v3/external.js
|
|
6
6
|
var external_exports = {};
|
|
@@ -4044,6 +4044,5 @@ var coerce = {
|
|
|
4044
4044
|
var NEVER = INVALID;
|
|
4045
4045
|
|
|
4046
4046
|
export {
|
|
4047
|
-
ZodError,
|
|
4048
4047
|
external_exports
|
|
4049
4048
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decideLifecycleTransition
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BZ4EYURA.js";
|
|
4
4
|
import {
|
|
5
5
|
StorageManager
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-G3CZA4SD.js";
|
|
7
7
|
|
|
8
8
|
// ../remnic-core/src/maintenance/memory-governance.ts
|
|
9
9
|
import path from "path";
|