@remnic/plugin-openclaw 1.0.34 → 1.0.36
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 +59 -10
- package/dist/{calibration-JD4AU7FB.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-YPDWRB3C.js +17 -0
- package/dist/capsule-import-SWPOFG6F.js +16 -0
- package/dist/{capsule-merge-IWOQ34KL.js → capsule-merge-YXAF7ZJW.js} +7 -7
- package/dist/{causal-chain-WYN5QOPS.js → causal-chain-BVTOWZKC.js} +4 -4
- package/dist/{causal-consolidation-DSLFN64P.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-FGTYFLL5.js → chunk-3IHGISUN.js} +29 -32
- package/dist/{chunk-6UFI73TJ.js → chunk-3IKMUNW5.js} +53 -46
- package/dist/{chunk-EXDYWXMB.js → chunk-4XDQ3KEC.js} +1 -2
- package/dist/{chunk-4UA6KMRO.js → chunk-6O3H3DPL.js} +2 -2
- package/dist/{chunk-7NMHI4IC.js → chunk-BLC3RQNV.js} +5 -555
- package/dist/{chunk-4G2XCSD2.js → chunk-BZ4EYURA.js} +0 -5
- package/dist/{chunk-4LYQ4ONL.js → chunk-E4RM7637.js} +1 -1
- package/dist/{chunk-TDRJVMUP.js → chunk-EH4AXGRO.js} +0 -12
- package/dist/{chunk-ZXLYEVOP.js → chunk-G3CZA4SD.js} +60 -362
- package/dist/chunk-I2KLQ2HA.js +22 -0
- package/dist/chunk-IO5WWY6A.js +156 -0
- package/dist/{contradiction-scan-U3QKHWQN.js → chunk-JC3FCKYL.js} +191 -87
- 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-L6I4MQKO.js → chunk-NNAN63QK.js} +6 -6
- package/dist/{chunk-VRGUUHBV.js → chunk-NUWDSTP7.js} +1 -1
- 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-NDZNURDM.js → chunk-SEGEX7W4.js} +73 -241
- package/dist/{chunk-7NUFIRM3.js → chunk-SWOYEQN2.js} +97 -21
- package/dist/chunk-TH5FF5SC.js +16 -0
- 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-57HLTQBN.js → engine-5P774HTZ.js} +6 -6
- package/dist/{extraction-judge-telemetry-GHOTVYMP.js → extraction-judge-telemetry-O4ZVGLTU.js} +1 -1
- package/dist/{fallback-llm-33SPYXQY.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 +7187 -71983
- 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-FEQCA35V.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-R3V6ZFQT.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-7L34HYDW.js} +3 -3
- package/openclaw.plugin.json +153 -20
- package/package.json +18 -9
- package/scripts/faiss_index.py +756 -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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @remnic/plugin-openclaw
|
|
2
2
|
|
|
3
|
-
OpenClaw plugin for Remnic memory. The package bundles the OpenClaw adapter plus the Remnic core runtime so it can run without a separate Remnic service; the adapter registers OpenClaw hooks/tools and delegates memory behavior to [`@remnic/core`](https://www.npmjs.com/package/@remnic/core).
|
|
3
|
+
OpenClaw plugin for Remnic memory and context. The package bundles the OpenClaw adapter plus the Remnic core runtime so it can run without a separate Remnic service; the adapter registers OpenClaw hooks/tools and delegates memory behavior to [`@remnic/core`](https://www.npmjs.com/package/@remnic/core).
|
|
4
4
|
|
|
5
|
-
Part of [Remnic](https://github.com/joshuaswarren/remnic),
|
|
5
|
+
Part of [Remnic](https://github.com/joshuaswarren/remnic), open-source memory and context for user-aware agents.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ openclaw plugins install clawhub:@remnic/plugin-openclaw
|
|
|
12
12
|
|
|
13
13
|
Or ask your OpenClaw agent:
|
|
14
14
|
|
|
15
|
-
> Install the @remnic/plugin-openclaw plugin and configure it as my memory system.
|
|
15
|
+
> Install the @remnic/plugin-openclaw ClawHub plugin and configure it as my memory system.
|
|
16
16
|
|
|
17
17
|
## Configure
|
|
18
18
|
|
|
@@ -86,7 +86,7 @@ This plugin hooks into the OpenClaw gateway lifecycle:
|
|
|
86
86
|
- **`agent_end`** -- buffers the conversation turn for extraction
|
|
87
87
|
- **`before_compaction`** / **`after_compaction`** -- saves checkpoints and triggers session reset on context compaction
|
|
88
88
|
- **`before_reset`** -- bounded flush of the in-flight buffer before OpenClaw discards a session
|
|
89
|
-
- **`
|
|
89
|
+
- **`api.registerCommand()`** -- exposes Remnic slash-command descriptors to the command palette
|
|
90
90
|
- **`session_start`** / **`session_end`** -- session lifecycle tracking
|
|
91
91
|
- **`before_tool_call`** / **`after_tool_call`** -- tool usage observation for analytics
|
|
92
92
|
- **`llm_output`** -- LLM token usage tracking
|
|
@@ -164,13 +164,62 @@ 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`,
|
|
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.
|
|
171
176
|
Keep the peer range broad unless an upstream release removes a runtime surface
|
|
172
177
|
Remnic actively uses.
|
|
173
178
|
|
|
179
|
+
OpenClaw 2026.5.16 package-entry discovery prefers explicit built runtime
|
|
180
|
+
entries for installed packages. The published Remnic adapter declares
|
|
181
|
+
`openclaw.runtimeExtensions: ["./dist/index.js"]` alongside the existing
|
|
182
|
+
extension entry, and its package install metadata advertises
|
|
183
|
+
`openclaw.install.clawhubSpec: "clawhub:@remnic/plugin-openclaw"`,
|
|
184
|
+
`openclaw.install.npmSpec: "@remnic/plugin-openclaw"`, and
|
|
185
|
+
`openclaw.install.defaultChoice: "clawhub"`. That keeps OpenClaw setup,
|
|
186
|
+
repair, and update flows ClawHub-first while preserving npm as the fallback
|
|
187
|
+
install surface and `>=2026.5.16-beta.1` as the minimum supported host range.
|
|
188
|
+
The manifest also declares `activation.onStartup: false`, leaves provider
|
|
189
|
+
ownership to the host, exposes the optional plugin-mode OpenAI key through
|
|
190
|
+
`providerAuthChoices`, and keeps `providerAuthEnvVars.openai` as compatibility
|
|
191
|
+
metadata for OpenClaw's pre-runtime env-var auth probes.
|
|
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
|
+
|
|
174
223
|
Native memory registrars are tracked separately in
|
|
175
224
|
[`docs/plugins/openclaw-native-memory-registrars.md`](../../docs/plugins/openclaw-native-memory-registrars.md).
|
|
176
225
|
That spike explains why Remnic currently uses `registerMemoryCapability()` as
|
|
@@ -254,7 +303,7 @@ private plugin state, transcript buffers, auth metadata, or artifact paths.
|
|
|
254
303
|
| `session_start` / `session_end` hooks | Supported | 2026.3.22 |
|
|
255
304
|
| `before_compaction` / `after_compaction` hooks | Supported | 2026.3.22 |
|
|
256
305
|
| `before_reset` hook | Supported | 2026.4.10 |
|
|
257
|
-
| `
|
|
306
|
+
| `api.registerCommand()` runtime discovery | Supported | 2026.5.16 |
|
|
258
307
|
| `api.resetSession()` (compaction reset) | Supported | 2026.3.22 |
|
|
259
308
|
| Checkpoint saves before compaction | Supported | 2026.3.22 |
|
|
260
309
|
|
|
@@ -285,8 +334,8 @@ registered as the `before_prompt_build` hook timeout on OpenClaw versions with
|
|
|
285
334
|
per-hook timeout support. Raise it if first-turn recall is timing out during
|
|
286
335
|
slow startup; older OpenClaw versions ignore the extra hook option safely.
|
|
287
336
|
|
|
288
|
-
Session-scoped recall controls are exposed through OpenClaw's
|
|
289
|
-
|
|
337
|
+
Session-scoped recall controls are exposed through OpenClaw's
|
|
338
|
+
`api.registerCommand()` surface when it is available:
|
|
290
339
|
|
|
291
340
|
- `remnic off` / `remnic on`
|
|
292
341
|
- `remnic status`
|
|
@@ -329,7 +378,7 @@ replays stay idempotent:
|
|
|
329
378
|
"maxEntries": 500,
|
|
330
379
|
"injectRecentCount": 3,
|
|
331
380
|
"minIntervalMinutes": 120,
|
|
332
|
-
"narrativeModel": "gpt-5.
|
|
381
|
+
"narrativeModel": "gpt-5.5",
|
|
333
382
|
"narrativePromptStyle": "reflective",
|
|
334
383
|
"watchFile": true
|
|
335
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-3IHGISUN.js";
|
|
5
|
+
import "./chunk-YKV4EFUI.js";
|
|
6
|
+
import "./chunk-E4RM7637.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-NNAN63QK.js";
|
|
4
|
+
import "./chunk-YKV4EFUI.js";
|
|
5
|
+
import "./chunk-E4RM7637.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-E4RM7637.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,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CAPSULE_ID_PATTERN,
|
|
3
|
-
CapsuleBlockSchema,
|
|
4
|
-
ExportBundleV2Schema,
|
|
5
|
-
ExportManifestV2Schema
|
|
6
|
-
} from "./chunk-4LYQ4ONL.js";
|
|
7
1
|
import {
|
|
8
2
|
listFilesRecursive,
|
|
9
3
|
sha256File,
|
|
10
4
|
toPosixRelPath,
|
|
11
5
|
writeJsonFile
|
|
12
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YKV4EFUI.js";
|
|
7
|
+
import {
|
|
8
|
+
CAPSULE_ID_PATTERN,
|
|
9
|
+
CapsuleBlockSchema,
|
|
10
|
+
ExportBundleV2Schema,
|
|
11
|
+
ExportManifestV2Schema
|
|
12
|
+
} from "./chunk-E4RM7637.js";
|
|
13
13
|
import {
|
|
14
14
|
encryptCapsuleFile
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ZS6VABML.js";
|
|
16
16
|
|
|
17
17
|
// ../remnic-core/src/transfer/capsule-export.ts
|
|
18
18
|
import * as fsReadModule0 from "fs/promises";
|
|
@@ -20,27 +20,33 @@ const mkdir = fsReadModule0.mkdir;
|
|
|
20
20
|
const fileReader = fsReadModule0["re"+"ad"+"Fi"+"le"];
|
|
21
21
|
const stat = fsReadModule0.stat;
|
|
22
22
|
const writeFile = fsReadModule0.writeFile;
|
|
23
|
-
import
|
|
23
|
+
import path2 from "path";
|
|
24
24
|
import { gzipSync } from "zlib";
|
|
25
25
|
|
|
26
26
|
// ../remnic-core/src/transfer/constants.ts
|
|
27
27
|
var EXPORT_FORMAT = "openclaw-engram-export";
|
|
28
|
-
var EXPORT_SCHEMA_VERSION = 1;
|
|
29
28
|
var CAPSULE_SCHEMA_VERSION = 2;
|
|
30
29
|
|
|
31
|
-
// ../remnic-core/src/transfer/
|
|
32
|
-
|
|
30
|
+
// ../remnic-core/src/transfer/exclusions.ts
|
|
31
|
+
import path from "path";
|
|
32
|
+
var DEFAULT_TRANSFER_EXCLUDE_DIRS = /* @__PURE__ */ new Set([
|
|
33
33
|
"node_modules",
|
|
34
34
|
".git",
|
|
35
|
-
// Never export the secure-store directory: it contains the encryption
|
|
36
|
-
// header (KDF params + verifier) which is security-sensitive and
|
|
37
|
-
// machine-specific. The passphrase is not stored here, but including
|
|
38
|
-
// the header in a capsule would let an attacker brute-force the
|
|
39
|
-
// passphrase offline if the capsule is intercepted.
|
|
40
35
|
".secure-store",
|
|
41
|
-
// Exclude .capsules to avoid recursive self-inclusion.
|
|
42
36
|
".capsules"
|
|
43
37
|
]);
|
|
38
|
+
function computeTransferOutputRel(rootAbs, outputAbs) {
|
|
39
|
+
const rel = path.relative(rootAbs, outputAbs);
|
|
40
|
+
if (rel === "") {
|
|
41
|
+
throw new Error("transfer export output path must not equal the memory directory");
|
|
42
|
+
}
|
|
43
|
+
if (rel === ".." || rel.startsWith(`..${path.sep}`)) return null;
|
|
44
|
+
if (path.isAbsolute(rel)) return null;
|
|
45
|
+
return rel.split(path.sep).join("/");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// ../remnic-core/src/transfer/capsule-export.ts
|
|
49
|
+
var DEFAULT_EXCLUDE_DIRS = DEFAULT_TRANSFER_EXCLUDE_DIRS;
|
|
44
50
|
var TRANSCRIPTS_DIR = "transcripts";
|
|
45
51
|
var PEERS_DIR = "peers";
|
|
46
52
|
async function exportCapsule(opts) {
|
|
@@ -49,16 +55,16 @@ async function exportCapsule(opts) {
|
|
|
49
55
|
const includeKinds = normalizeIncludeKinds(opts.includeKinds);
|
|
50
56
|
const peerFilter = normalizePeerIds(opts.peerIds);
|
|
51
57
|
const transcriptsOverride = opts.includeTranscripts === true;
|
|
52
|
-
const rootAbs =
|
|
58
|
+
const rootAbs = path2.resolve(opts.root);
|
|
53
59
|
await assertIsDirectory(rootAbs);
|
|
54
|
-
const outDirAbs =
|
|
60
|
+
const outDirAbs = path2.resolve(opts.outDir ?? path2.join(rootAbs, ".capsules"));
|
|
55
61
|
if (outDirAbs === rootAbs) {
|
|
56
62
|
throw new Error(
|
|
57
63
|
"exportCapsule: 'outDir' must not equal 'root'. Choose a separate directory (default: <root>/.capsules) so the export does not overwrite or shadow the source tree."
|
|
58
64
|
);
|
|
59
65
|
}
|
|
60
66
|
await mkdir(outDirAbs, { recursive: true });
|
|
61
|
-
const outDirRelPosix =
|
|
67
|
+
const outDirRelPosix = computeTransferOutputRel(rootAbs, outDirAbs);
|
|
62
68
|
const filesAbs = await listFilesRecursive(rootAbs);
|
|
63
69
|
const records = [];
|
|
64
70
|
const manifestFiles = [];
|
|
@@ -92,8 +98,8 @@ async function exportCapsule(opts) {
|
|
|
92
98
|
manifest,
|
|
93
99
|
records
|
|
94
100
|
});
|
|
95
|
-
const archivePath =
|
|
96
|
-
const manifestPath =
|
|
101
|
+
const archivePath = path2.join(outDirAbs, `${opts.name}.capsule.json.gz`);
|
|
102
|
+
const manifestPath = path2.join(outDirAbs, `${opts.name}.manifest.json`);
|
|
97
103
|
await writeJsonFile(manifestPath, manifest);
|
|
98
104
|
const json = JSON.stringify(bundle);
|
|
99
105
|
const gz = gzipSync(Buffer.from(json, "utf-8"));
|
|
@@ -209,13 +215,6 @@ function normalizePeerIds(peerIds) {
|
|
|
209
215
|
}
|
|
210
216
|
return set;
|
|
211
217
|
}
|
|
212
|
-
function computeOutDirRel(rootAbs, outDirAbs) {
|
|
213
|
-
const rel = path.relative(rootAbs, outDirAbs);
|
|
214
|
-
if (rel === "") return null;
|
|
215
|
-
if (rel === ".." || rel.startsWith(`..${path.sep}`)) return null;
|
|
216
|
-
if (path.isAbsolute(rel)) return null;
|
|
217
|
-
return rel.split(path.sep).join("/");
|
|
218
|
-
}
|
|
219
218
|
async function assertIsDirectory(absPath) {
|
|
220
219
|
const st = await stat(absPath).catch(() => null);
|
|
221
220
|
if (!st || !st.isDirectory()) {
|
|
@@ -271,8 +270,6 @@ function buildCapsuleBlock(name, override) {
|
|
|
271
270
|
}
|
|
272
271
|
|
|
273
272
|
export {
|
|
274
|
-
EXPORT_FORMAT,
|
|
275
|
-
EXPORT_SCHEMA_VERSION,
|
|
276
273
|
exportCapsule,
|
|
277
274
|
isValidCapsuleSince
|
|
278
275
|
};
|
|
@@ -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";
|