shieldcortex 4.12.14 → 4.13.0
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/dashboard/.next/standalone/dashboard/.next/BUILD_ID +1 -1
- package/dashboard/.next/standalone/dashboard/.next/build-manifest.json +2 -2
- package/dashboard/.next/standalone/dashboard/.next/prerender-manifest.json +3 -3
- package/dashboard/.next/standalone/dashboard/.next/required-server-files.json +4 -4
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/admin/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/admin/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/admin/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/cloud/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/cloud/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/cloud/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/capture/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/capture/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/capture/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/graph/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/graph/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/graph/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/recall/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/recall/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/recall/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/review/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/review/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/review/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/timeline/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/timeline/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/timeline/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/overview/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/overview/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/overview/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/audit/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/audit/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/audit/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/intercepts/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/intercepts/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/intercepts/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/iron-dome/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/iron-dome/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/iron-dome/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/policies/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/policies/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/policies/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/quarantine/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/quarantine/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/quarantine/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/settings/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/settings/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/supply-chain/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/supply-chain/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/supply-chain/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/supply-chain/xray/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/supply-chain/xray/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/supply-chain/xray/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/xray/page.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/xray/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/xray/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.html +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/admin.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/admin.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/!KGRhc2hib2FyZCk/admin/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/!KGRhc2hib2FyZCk/admin.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/_full.segment.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/!KGRhc2hib2FyZCk/cloud/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/!KGRhc2hib2FyZCk/cloud.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/_full.segment.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/!KGRhc2hib2FyZCk/memory/capture/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/!KGRhc2hib2FyZCk/memory/capture.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/_full.segment.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/!KGRhc2hib2FyZCk/memory/graph/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/!KGRhc2hib2FyZCk/memory/graph.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/_full.segment.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/!KGRhc2hib2FyZCk/memory/recall/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/!KGRhc2hib2FyZCk/memory/recall.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/_full.segment.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/!KGRhc2hib2FyZCk/memory/review/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/!KGRhc2hib2FyZCk/memory/review.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/_full.segment.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/!KGRhc2hib2FyZCk/memory/timeline/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/!KGRhc2hib2FyZCk/memory/timeline.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/_full.segment.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory.rsc +21 -18
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/!KGRhc2hib2FyZCk/memory/__PAGE__.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/_full.segment.rsc +21 -18
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/overview.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/overview.rsc +20 -18
- package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/!KGRhc2hib2FyZCk/overview/__PAGE__.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/!KGRhc2hib2FyZCk/overview.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/_full.segment.rsc +20 -18
- package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/page.js.nft.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/!KGRhc2hib2FyZCk/protection/audit/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/!KGRhc2hib2FyZCk/protection/audit.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/_full.segment.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/!KGRhc2hib2FyZCk/protection/intercepts/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/!KGRhc2hib2FyZCk/protection/intercepts.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/_full.segment.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/!KGRhc2hib2FyZCk/protection/iron-dome/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/!KGRhc2hib2FyZCk/protection/iron-dome.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/_full.segment.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/!KGRhc2hib2FyZCk/protection/policies/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/!KGRhc2hib2FyZCk/protection/policies.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/_full.segment.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/!KGRhc2hib2FyZCk/protection/quarantine/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/!KGRhc2hib2FyZCk/protection/quarantine.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/_full.segment.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/!KGRhc2hib2FyZCk/protection/__PAGE__.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/_full.segment.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/settings.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/settings.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/!KGRhc2hib2FyZCk/settings/__PAGE__.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/!KGRhc2hib2FyZCk/settings.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/_full.segment.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/!KGRhc2hib2FyZCk/supply-chain/xray/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/!KGRhc2hib2FyZCk/supply-chain/xray.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/!KGRhc2hib2FyZCk/supply-chain.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/_full.segment.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/!KGRhc2hib2FyZCk/supply-chain/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/!KGRhc2hib2FyZCk/supply-chain.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/_full.segment.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/xray.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/xray.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/!KGRhc2hib2FyZCk/xray/__PAGE__.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/!KGRhc2hib2FyZCk/xray.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
- package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/_full.segment.rsc +17 -15
- package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/9f1d4_@tanstack_68dcbde9._.js +3 -0
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__fb5796ae._.js → [root-of-the-server]__2de25d56._.js} +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/[root-of-the-server]__52bd7a9f._.js +3 -0
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__b789489c._.js → [root-of-the-server]__6f881a23._.js} +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_01f6ceb0._.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_20c6acea._.js +3 -0
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/{9f1d4_next_c9fe89e1._.js → dashboard_25b568c3._.js} +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_2a8eef6b._.js +3 -0
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_35a9932a._.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_37f17371._.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_77cb2b63._.js +3 -0
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_91003e6d._.js +3 -0
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_9b8695d8._.js +3 -0
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_a16ef10a._.js +3 -0
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_c219bf07._.js +4 -4
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_f9cd1dc2._.js +3 -0
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_fefd3b85._.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_44a9f72c._.js +3 -0
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_components_de7ac4f9._.js +3 -0
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_components_protection_ProtectionOverview_tsx_54554a97._.js +3 -3
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_components_settings_SettingsView_tsx_16dc83a7._.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_components_xray_XRayOverview_tsx_ceba698e._.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/pages/404.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/pages/500.html +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/server-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/server-reference-manifest.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/015dc64369f26b7d.css +3 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/2fe84829530e61a3.js +1 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/34d0309a4e34b084.js +1 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/3729c748a4361c1f.js +1 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/3b7fdf1ee828254c.js +1 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/{3d53807a9a943ce7.js → 4c90ebd2c08cd656.js} +4 -4
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/4d4af0cecaef56f2.js +1 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/4eb86dc2f379d3ca.js +1 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/6aba18b7aac42ccd.js +1 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/{b4b3fb5729bead7e.js → 6ea97c8dc9e30ea5.js} +1 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/74ea1a87751e93a3.js +1 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/910628c23329a773.js +1 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/{c288964c4c00982a.js → b308a787e8cbc2a9.js} +3 -3
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/bdb50889a1c1ab37.js +1 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/d0bf5ccba09917dd.js +1 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/e804a1fda2839550.js +1 -0
- package/dashboard/.next/standalone/dashboard/server.js +1 -1
- package/dist/api/routes/digest.d.ts +59 -0
- package/dist/api/routes/digest.js +305 -0
- package/dist/api/routes/memories.js +84 -15
- package/dist/api/routes/system.js +10 -2
- package/dist/api/visualization-server.js +2 -0
- package/dist/cli/doctor.d.ts +27 -0
- package/dist/cli/doctor.js +88 -0
- package/dist/cli/migrate-legacy.d.ts +28 -0
- package/dist/cli/migrate-legacy.js +291 -0
- package/dist/cloud/cli.js +2 -2
- package/dist/database/init.js +26 -1
- package/dist/index.js +8 -1
- package/dist/memory/backup.d.ts +19 -0
- package/dist/memory/backup.js +47 -0
- package/dist/memory/dedupe-runner.d.ts +33 -0
- package/dist/memory/dedupe-runner.js +103 -0
- package/dist/memory/fts.d.ts +26 -0
- package/dist/memory/fts.js +59 -0
- package/dist/memory/lifecycle.d.ts +83 -0
- package/dist/memory/lifecycle.js +274 -0
- package/dist/memory/links.d.ts +63 -0
- package/dist/memory/links.js +232 -0
- package/dist/memory/prune.d.ts +34 -0
- package/dist/memory/prune.js +76 -0
- package/dist/memory/search-recall.d.ts +48 -0
- package/dist/memory/search-recall.js +367 -0
- package/dist/memory/store.d.ts +6 -121
- package/dist/memory/store.js +45 -854
- package/dist/setup/claude-md.d.ts +1 -0
- package/dist/setup/deep-clean.d.ts +33 -0
- package/dist/setup/deep-clean.js +26 -0
- package/dist/setup/doctor.js +7 -2
- package/dist/setup/settings-hooks.d.ts +1 -0
- package/dist/setup/settings-hooks.js +30 -5
- package/dist/setup/status.js +39 -0
- package/hooks/openclaw/cortex-memory/runtime.mjs +18 -4
- package/package.json +1 -1
- package/plugins/openclaw/dist/index.js +12 -6
- package/plugins/openclaw/dist/openclaw.plugin.json +1 -1
- package/scripts/lib/auto-memory-config.mjs +45 -0
- package/scripts/lib/telemetry.mjs +58 -0
- package/scripts/lib/transcript-reader.mjs +123 -0
- package/scripts/postinstall.mjs +47 -1
- package/scripts/pre-compact-hook.mjs +76 -124
- package/scripts/session-end-hook.mjs +102 -97
- package/scripts/stop-hook.mjs +346 -116
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/9f1d4_@tanstack_785e068c._.js +0 -3
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/[root-of-the-server]__c2b92077._.js +0 -3
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_11878109._.js +0 -3
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_35c9f22e._.js +0 -3
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_836b4a04._.js +0 -3
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_9770c429._.js +0 -3
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_9dd626ed._.js +0 -3
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_e94d2da2._.js +0 -3
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_564ea5ae._.js +0 -3
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_lib_3f1490a1._.js +0 -3
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/079a5be036130e37.js +0 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/1770a8ce7abb2437.js +0 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/1a074f8ddc7cd385.js +0 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/24da99d1341bd573.css +0 -3
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/2aa8afb655c1c2e5.js +0 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/302ad459a0e5c4ba.js +0 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/385ec610bad1acc5.js +0 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/4f57582c2d186438.js +0 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/52843253e4b833a5.js +0 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/7fca141efba9d353.js +0 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/8593e1796c9d043d.js +0 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/cbc2e6ffcad6e91c.js +0 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/fced7dd3c9874ed1.js +0 -1
- /package/dashboard/.next/standalone/dashboard/.next/static/{P2sW3M-qHaW9VS9YwCEg3 → kiA_iEHG_1wWOEYFsD0Tj}/_buildManifest.js +0 -0
- /package/dashboard/.next/standalone/dashboard/.next/static/{P2sW3M-qHaW9VS9YwCEg3 → kiA_iEHG_1wWOEYFsD0Tj}/_clientMiddlewareManifest.json +0 -0
- /package/dashboard/.next/standalone/dashboard/.next/static/{P2sW3M-qHaW9VS9YwCEg3 → kiA_iEHG_1wWOEYFsD0Tj}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory lifecycle operations.
|
|
3
|
+
*
|
|
4
|
+
* Phase 2 of the audit-recommended store.ts split. The "lifecycle"
|
|
5
|
+
* group is the set of functions that mutate a memory's state over
|
|
6
|
+
* time *without* being CRUD: access reinforcement, search
|
|
7
|
+
* reinforcement, enrichment, decay-score persistence, STM→LTM
|
|
8
|
+
* promotion, and bulk decay cleanup. Lifted out of store.ts (still
|
|
9
|
+
* 1,800+ lines after phase 1) so each concern can be read on its
|
|
10
|
+
* own. No behaviour change vs the original implementation — exports
|
|
11
|
+
* re-emerge from store.ts via a barrel re-export so existing import
|
|
12
|
+
* paths keep working.
|
|
13
|
+
*
|
|
14
|
+
* Imports from store.ts (getMemoryById, rowToMemory, getMemoriesByType,
|
|
15
|
+
* MAX_CONTENT_SIZE) form a module cycle. Both directions only invoke
|
|
16
|
+
* the imported symbols inside function bodies — ESM live bindings
|
|
17
|
+
* handle this correctly at runtime. As of phase 3, reinforceFromSearch
|
|
18
|
+
* and enrichMemory are consumed by search-recall.ts (not store.ts);
|
|
19
|
+
* that import is non-cyclic since search-recall.ts is a leaf consumer
|
|
20
|
+
* of lifecycle.ts.
|
|
21
|
+
*/
|
|
22
|
+
import { Memory, MemoryConfig } from './types.js';
|
|
23
|
+
import type { DefenceSource } from '../defence/types.js';
|
|
24
|
+
/**
|
|
25
|
+
* Access a memory (updates access count and timestamp, returns reinforced memory)
|
|
26
|
+
*/
|
|
27
|
+
export declare function accessMemory(id: number, config?: MemoryConfig, source?: DefenceSource): Memory | null;
|
|
28
|
+
/**
|
|
29
|
+
* Reinforce a memory that appeared in search results
|
|
30
|
+
* Gives a small salience boost with diminishing returns based on access count.
|
|
31
|
+
* ORGANIC FEATURE: Searched memories get reinforced, closing the feedback loop
|
|
32
|
+
* so frequently-found memories grow stronger over time.
|
|
33
|
+
*/
|
|
34
|
+
export declare function reinforceFromSearch(memoryId: number): void;
|
|
35
|
+
/**
|
|
36
|
+
* Enrichment result indicating what happened
|
|
37
|
+
*/
|
|
38
|
+
export interface EnrichmentResult {
|
|
39
|
+
enriched: boolean;
|
|
40
|
+
reason: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Enrich a memory with additional context
|
|
44
|
+
*
|
|
45
|
+
* This adds timestamped context to a memory when:
|
|
46
|
+
* 1. The new context is sufficiently related but different (new information)
|
|
47
|
+
* 2. The memory hasn't been enriched recently (cooldown)
|
|
48
|
+
* 3. The content won't exceed the size limit
|
|
49
|
+
*
|
|
50
|
+
* ORGANIC FEATURE: Memories grow with new context over time,
|
|
51
|
+
* mimicking how human memories are reconsolidated with new information
|
|
52
|
+
*
|
|
53
|
+
* @param memoryId - ID of the memory to enrich
|
|
54
|
+
* @param newContext - New context to add
|
|
55
|
+
* @param contextType - Type of context ('search' | 'access' | 'related')
|
|
56
|
+
* @returns EnrichmentResult indicating success or failure with reason
|
|
57
|
+
*/
|
|
58
|
+
export declare function enrichMemory(memoryId: number, newContext: string, contextType?: 'search' | 'access' | 'related'): EnrichmentResult;
|
|
59
|
+
/**
|
|
60
|
+
* Clear enrichment cooldown for a memory (for testing)
|
|
61
|
+
*/
|
|
62
|
+
export declare function clearEnrichmentCooldown(memoryId: number): void;
|
|
63
|
+
/**
|
|
64
|
+
* Get enrichment cooldown status for a memory
|
|
65
|
+
*/
|
|
66
|
+
export declare function getEnrichmentCooldownStatus(memoryId: number): {
|
|
67
|
+
onCooldown: boolean;
|
|
68
|
+
remainingMs: number;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Update persisted decay scores for all memories
|
|
72
|
+
* Called during consolidation and periodically by the API server
|
|
73
|
+
* Returns the number of memories updated
|
|
74
|
+
*/
|
|
75
|
+
export declare function updateDecayScores(): number;
|
|
76
|
+
/**
|
|
77
|
+
* Promote a memory from short-term to long-term
|
|
78
|
+
*/
|
|
79
|
+
export declare function promoteMemory(id: number): Memory | null;
|
|
80
|
+
/**
|
|
81
|
+
* Bulk delete decayed memories
|
|
82
|
+
*/
|
|
83
|
+
export declare function cleanupDecayedMemories(config?: MemoryConfig): number;
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory lifecycle operations.
|
|
3
|
+
*
|
|
4
|
+
* Phase 2 of the audit-recommended store.ts split. The "lifecycle"
|
|
5
|
+
* group is the set of functions that mutate a memory's state over
|
|
6
|
+
* time *without* being CRUD: access reinforcement, search
|
|
7
|
+
* reinforcement, enrichment, decay-score persistence, STM→LTM
|
|
8
|
+
* promotion, and bulk decay cleanup. Lifted out of store.ts (still
|
|
9
|
+
* 1,800+ lines after phase 1) so each concern can be read on its
|
|
10
|
+
* own. No behaviour change vs the original implementation — exports
|
|
11
|
+
* re-emerge from store.ts via a barrel re-export so existing import
|
|
12
|
+
* paths keep working.
|
|
13
|
+
*
|
|
14
|
+
* Imports from store.ts (getMemoryById, rowToMemory, getMemoriesByType,
|
|
15
|
+
* MAX_CONTENT_SIZE) form a module cycle. Both directions only invoke
|
|
16
|
+
* the imported symbols inside function bodies — ESM live bindings
|
|
17
|
+
* handle this correctly at runtime. As of phase 3, reinforceFromSearch
|
|
18
|
+
* and enrichMemory are consumed by search-recall.ts (not store.ts);
|
|
19
|
+
* that import is non-cyclic since search-recall.ts is a leaf consumer
|
|
20
|
+
* of lifecycle.ts.
|
|
21
|
+
*/
|
|
22
|
+
import { getDatabase } from '../database/init.js';
|
|
23
|
+
import { DEFAULT_CONFIG, } from './types.js';
|
|
24
|
+
import { calculateReinforcementBoost, calculateDecayedScore, } from './decay.js';
|
|
25
|
+
import { activateMemory as spreadActivation } from './activation.js';
|
|
26
|
+
import { jaccardSimilarity } from './similarity.js';
|
|
27
|
+
import { emitMemoryAccessed, emitMemoryUpdated, persistEvent, } from '../api/events.js';
|
|
28
|
+
import { createMemoryLink } from './links.js';
|
|
29
|
+
// Cyclic import — see header. getMemoryById/rowToMemory/getMemoriesByType
|
|
30
|
+
// live in store.ts; MAX_CONTENT_SIZE is the per-memory content budget
|
|
31
|
+
// that both truncateContent (store.ts) and enrichMemory (here) honour.
|
|
32
|
+
import { getMemoryById, rowToMemory, getMemoriesByType, MAX_CONTENT_SIZE, } from './store.js';
|
|
33
|
+
/**
|
|
34
|
+
* Access a memory (updates access count and timestamp, returns reinforced memory)
|
|
35
|
+
*/
|
|
36
|
+
export function accessMemory(id, config = DEFAULT_CONFIG, source) {
|
|
37
|
+
const db = getDatabase();
|
|
38
|
+
const memory = getMemoryById(id, source);
|
|
39
|
+
if (!memory)
|
|
40
|
+
return null;
|
|
41
|
+
// Calculate new salience with reinforcement
|
|
42
|
+
const newSalience = calculateReinforcementBoost(memory, config);
|
|
43
|
+
db.prepare(`
|
|
44
|
+
UPDATE memories
|
|
45
|
+
SET access_count = access_count + 1,
|
|
46
|
+
last_accessed = CURRENT_TIMESTAMP,
|
|
47
|
+
salience = ?
|
|
48
|
+
WHERE id = ?
|
|
49
|
+
`).run(newSalience, id);
|
|
50
|
+
const updatedMemory = getMemoryById(id);
|
|
51
|
+
// Emit event for real-time dashboard (in-process)
|
|
52
|
+
emitMemoryAccessed(updatedMemory, newSalience);
|
|
53
|
+
// Persist event for cross-process IPC (MCP → Dashboard)
|
|
54
|
+
persistEvent('memory_accessed', { memoryId: id, memory: updatedMemory, newSalience });
|
|
55
|
+
// ORGANIC FEATURE: Link strengthening on co-access
|
|
56
|
+
// If memory A and B are both accessed within 5 minutes, strengthen their link
|
|
57
|
+
// This mimics Hebbian learning: "neurons that fire together, wire together"
|
|
58
|
+
try {
|
|
59
|
+
const recentlyAccessed = db.prepare(`
|
|
60
|
+
SELECT id FROM memories
|
|
61
|
+
WHERE last_accessed > datetime('now', '-5 minutes')
|
|
62
|
+
AND id != ?
|
|
63
|
+
LIMIT 10
|
|
64
|
+
`).all(id);
|
|
65
|
+
for (const recent of recentlyAccessed) {
|
|
66
|
+
// Check if link exists in either direction
|
|
67
|
+
const existingLink = db.prepare(`
|
|
68
|
+
SELECT id, strength FROM memory_links
|
|
69
|
+
WHERE (source_id = ? AND target_id = ?) OR (source_id = ? AND target_id = ?)
|
|
70
|
+
`).get(id, recent.id, recent.id, id);
|
|
71
|
+
if (existingLink) {
|
|
72
|
+
// Strengthen existing link (cap at 1.0)
|
|
73
|
+
const newStrength = Math.min(1.0, existingLink.strength + 0.05);
|
|
74
|
+
db.prepare('UPDATE memory_links SET strength = ? WHERE id = ?')
|
|
75
|
+
.run(newStrength, existingLink.id);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
// Create new weak link for co-accessed memories
|
|
79
|
+
createMemoryLink(id, recent.id, 'related', 0.2);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch (e) {
|
|
84
|
+
// Don't fail memory access if link strengthening fails
|
|
85
|
+
console.error('[shieldcortex] Link strengthening failed:', e);
|
|
86
|
+
}
|
|
87
|
+
// ORGANIC FEATURE: Spreading Activation (Phase 2)
|
|
88
|
+
// Activate this memory and spread activation to linked memories
|
|
89
|
+
// This makes related memories easier to recall in subsequent searches
|
|
90
|
+
spreadActivation(id);
|
|
91
|
+
return updatedMemory;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Reinforce a memory that appeared in search results
|
|
95
|
+
* Gives a small salience boost with diminishing returns based on access count.
|
|
96
|
+
* ORGANIC FEATURE: Searched memories get reinforced, closing the feedback loop
|
|
97
|
+
* so frequently-found memories grow stronger over time.
|
|
98
|
+
*/
|
|
99
|
+
export function reinforceFromSearch(memoryId) {
|
|
100
|
+
const db = getDatabase();
|
|
101
|
+
const memory = db.prepare('SELECT salience, access_count FROM memories WHERE id = ?').get(memoryId);
|
|
102
|
+
if (!memory)
|
|
103
|
+
return;
|
|
104
|
+
// Small salience boost per search appearance (diminishing returns)
|
|
105
|
+
const boost = Math.max(0.005, 0.02 / (1 + memory.access_count * 0.1));
|
|
106
|
+
const newSalience = Math.min(1.0, memory.salience + boost);
|
|
107
|
+
db.prepare(`
|
|
108
|
+
UPDATE memories
|
|
109
|
+
SET last_accessed = CURRENT_TIMESTAMP,
|
|
110
|
+
access_count = access_count + 1,
|
|
111
|
+
salience = ?
|
|
112
|
+
WHERE id = ?
|
|
113
|
+
`).run(newSalience, memoryId);
|
|
114
|
+
}
|
|
115
|
+
// ============================================
|
|
116
|
+
// ORGANIC FEATURE: Memory Enrichment (Phase 3)
|
|
117
|
+
// ============================================
|
|
118
|
+
// Enrichment configuration
|
|
119
|
+
const ENRICHMENT_SIMILARITY_THRESHOLD = 0.3; // Min similarity to trigger enrichment
|
|
120
|
+
const ENRICHMENT_COOLDOWN_HOURS = 1; // Don't enrich same memory within 1 hour
|
|
121
|
+
const MAX_ENRICHMENT_SIZE = 2000; // Max chars to add per enrichment
|
|
122
|
+
// Track last enrichment times (in-memory, ephemeral like activation cache)
|
|
123
|
+
const enrichmentTimestamps = new Map();
|
|
124
|
+
let enrichmentCallCount = 0;
|
|
125
|
+
function pruneEnrichmentTimestamps() {
|
|
126
|
+
const now = Date.now();
|
|
127
|
+
const cooldownMs = ENRICHMENT_COOLDOWN_HOURS * 60 * 60 * 1000;
|
|
128
|
+
for (const [memoryId, timestamp] of enrichmentTimestamps) {
|
|
129
|
+
if (now - timestamp > cooldownMs) {
|
|
130
|
+
enrichmentTimestamps.delete(memoryId);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Enrich a memory with additional context
|
|
136
|
+
*
|
|
137
|
+
* This adds timestamped context to a memory when:
|
|
138
|
+
* 1. The new context is sufficiently related but different (new information)
|
|
139
|
+
* 2. The memory hasn't been enriched recently (cooldown)
|
|
140
|
+
* 3. The content won't exceed the size limit
|
|
141
|
+
*
|
|
142
|
+
* ORGANIC FEATURE: Memories grow with new context over time,
|
|
143
|
+
* mimicking how human memories are reconsolidated with new information
|
|
144
|
+
*
|
|
145
|
+
* @param memoryId - ID of the memory to enrich
|
|
146
|
+
* @param newContext - New context to add
|
|
147
|
+
* @param contextType - Type of context ('search' | 'access' | 'related')
|
|
148
|
+
* @returns EnrichmentResult indicating success or failure with reason
|
|
149
|
+
*/
|
|
150
|
+
export function enrichMemory(memoryId, newContext, contextType = 'access') {
|
|
151
|
+
// Prune stale cooldown entries every 100 calls
|
|
152
|
+
if (++enrichmentCallCount % 100 === 0) {
|
|
153
|
+
pruneEnrichmentTimestamps();
|
|
154
|
+
}
|
|
155
|
+
const db = getDatabase();
|
|
156
|
+
const memory = getMemoryById(memoryId);
|
|
157
|
+
if (!memory) {
|
|
158
|
+
return { enriched: false, reason: 'Memory not found' };
|
|
159
|
+
}
|
|
160
|
+
// Check cooldown
|
|
161
|
+
const lastEnrichment = enrichmentTimestamps.get(memoryId);
|
|
162
|
+
const now = Date.now();
|
|
163
|
+
if (lastEnrichment && (now - lastEnrichment) < ENRICHMENT_COOLDOWN_HOURS * 60 * 60 * 1000) {
|
|
164
|
+
return { enriched: false, reason: 'Enrichment cooldown active' };
|
|
165
|
+
}
|
|
166
|
+
// Check similarity - should be related but not too similar (new info)
|
|
167
|
+
const similarity = jaccardSimilarity(memory.content, newContext);
|
|
168
|
+
if (similarity > 0.8) {
|
|
169
|
+
return { enriched: false, reason: 'Context too similar (no new information)' };
|
|
170
|
+
}
|
|
171
|
+
if (similarity < ENRICHMENT_SIMILARITY_THRESHOLD) {
|
|
172
|
+
return { enriched: false, reason: 'Context not sufficiently related' };
|
|
173
|
+
}
|
|
174
|
+
// Truncate context if needed
|
|
175
|
+
const truncatedContext = newContext.slice(0, MAX_ENRICHMENT_SIZE);
|
|
176
|
+
// Build enrichment block with timestamp
|
|
177
|
+
const timestamp = new Date().toISOString().split('T')[0]; // YYYY-MM-DD
|
|
178
|
+
const enrichmentBlock = `\n\n---\n[${timestamp}] ${contextType}: ${truncatedContext}`;
|
|
179
|
+
// Check size limit (leave 500 char buffer for future enrichments)
|
|
180
|
+
const newContent = memory.content + enrichmentBlock;
|
|
181
|
+
if (newContent.length > MAX_CONTENT_SIZE - 500) {
|
|
182
|
+
return { enriched: false, reason: 'Content size limit reached' };
|
|
183
|
+
}
|
|
184
|
+
// Update memory
|
|
185
|
+
db.prepare(`
|
|
186
|
+
UPDATE memories
|
|
187
|
+
SET content = ?,
|
|
188
|
+
last_accessed = CURRENT_TIMESTAMP
|
|
189
|
+
WHERE id = ?
|
|
190
|
+
`).run(newContent, memoryId);
|
|
191
|
+
// Update cooldown timestamp
|
|
192
|
+
enrichmentTimestamps.set(memoryId, now);
|
|
193
|
+
// Emit update event for dashboard
|
|
194
|
+
const updatedMemory = getMemoryById(memoryId);
|
|
195
|
+
emitMemoryUpdated(updatedMemory);
|
|
196
|
+
return { enriched: true, reason: `Added ${contextType} context (${truncatedContext.length} chars)` };
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Clear enrichment cooldown for a memory (for testing)
|
|
200
|
+
*/
|
|
201
|
+
export function clearEnrichmentCooldown(memoryId) {
|
|
202
|
+
enrichmentTimestamps.delete(memoryId);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Get enrichment cooldown status for a memory
|
|
206
|
+
*/
|
|
207
|
+
export function getEnrichmentCooldownStatus(memoryId) {
|
|
208
|
+
const lastEnrichment = enrichmentTimestamps.get(memoryId);
|
|
209
|
+
if (!lastEnrichment) {
|
|
210
|
+
return { onCooldown: false, remainingMs: 0 };
|
|
211
|
+
}
|
|
212
|
+
const cooldownMs = ENRICHMENT_COOLDOWN_HOURS * 60 * 60 * 1000;
|
|
213
|
+
const elapsed = Date.now() - lastEnrichment;
|
|
214
|
+
const remaining = Math.max(0, cooldownMs - elapsed);
|
|
215
|
+
return {
|
|
216
|
+
onCooldown: remaining > 0,
|
|
217
|
+
remainingMs: remaining,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Update persisted decay scores for all memories
|
|
222
|
+
* Called during consolidation and periodically by the API server
|
|
223
|
+
* Returns the number of memories updated
|
|
224
|
+
*/
|
|
225
|
+
export function updateDecayScores() {
|
|
226
|
+
const db = getDatabase();
|
|
227
|
+
// Get all memories
|
|
228
|
+
const memories = db.prepare('SELECT * FROM memories').all();
|
|
229
|
+
let updated = 0;
|
|
230
|
+
const updateStmt = db.prepare('UPDATE memories SET decayed_score = ? WHERE id = ?');
|
|
231
|
+
for (const row of memories) {
|
|
232
|
+
const memory = rowToMemory(row);
|
|
233
|
+
const decayedScore = calculateDecayedScore(memory);
|
|
234
|
+
// Only update if score has changed significantly (saves writes)
|
|
235
|
+
const currentScore = row.decayed_score;
|
|
236
|
+
if (currentScore === null || Math.abs(currentScore - decayedScore) > 0.01) {
|
|
237
|
+
updateStmt.run(decayedScore, memory.id);
|
|
238
|
+
updated++;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return updated;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Promote a memory from short-term to long-term
|
|
245
|
+
*/
|
|
246
|
+
export function promoteMemory(id) {
|
|
247
|
+
const db = getDatabase();
|
|
248
|
+
db.prepare(`
|
|
249
|
+
UPDATE memories
|
|
250
|
+
SET type = 'long_term'
|
|
251
|
+
WHERE id = ? AND type = 'short_term'
|
|
252
|
+
`).run(id);
|
|
253
|
+
return getMemoryById(id);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Bulk delete decayed memories
|
|
257
|
+
*/
|
|
258
|
+
export function cleanupDecayedMemories(config = DEFAULT_CONFIG) {
|
|
259
|
+
const db = getDatabase();
|
|
260
|
+
// Get all short-term memories and check decay
|
|
261
|
+
const shortTerm = getMemoriesByType('short_term', 1000);
|
|
262
|
+
const toDelete = [];
|
|
263
|
+
for (const memory of shortTerm) {
|
|
264
|
+
const decayedScore = calculateDecayedScore(memory, config);
|
|
265
|
+
if (decayedScore < config.salienceThreshold) {
|
|
266
|
+
toDelete.push(memory.id);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (toDelete.length > 0) {
|
|
270
|
+
const placeholders = toDelete.map(() => '?').join(',');
|
|
271
|
+
db.prepare(`DELETE FROM memories WHERE id IN (${placeholders})`).run(...toDelete);
|
|
272
|
+
}
|
|
273
|
+
return toDelete.length;
|
|
274
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory relationships (links).
|
|
3
|
+
*
|
|
4
|
+
* Lifted out of the 2,166-line store.ts so the linking surface can be
|
|
5
|
+
* read, tested, and modified without scrolling past every CRUD/search
|
|
6
|
+
* helper in the memory module. No behaviour change vs the original
|
|
7
|
+
* implementation in store.ts — exports re-emerge from store.ts via
|
|
8
|
+
* a barrel re-export so existing import paths keep working.
|
|
9
|
+
*
|
|
10
|
+
* Imports from store.ts (getMemoryById, rowToMemory) form a module
|
|
11
|
+
* cycle, but both are only invoked inside function bodies — ESM live
|
|
12
|
+
* bindings handle this correctly at runtime.
|
|
13
|
+
*/
|
|
14
|
+
import type { Memory } from './types.js';
|
|
15
|
+
export type RelationshipType = 'references' | 'extends' | 'contradicts' | 'related';
|
|
16
|
+
export interface MemoryLink {
|
|
17
|
+
id: number;
|
|
18
|
+
sourceId: number;
|
|
19
|
+
targetId: number;
|
|
20
|
+
relationship: RelationshipType;
|
|
21
|
+
strength: number;
|
|
22
|
+
createdAt: Date;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a link between two memories.
|
|
26
|
+
*
|
|
27
|
+
* Returns null if either memory id doesn't exist, the source equals
|
|
28
|
+
* the target, or the link already exists (UNIQUE constraint).
|
|
29
|
+
*/
|
|
30
|
+
export declare function createMemoryLink(sourceId: number, targetId: number, relationship: RelationshipType, strength?: number): MemoryLink | null;
|
|
31
|
+
/**
|
|
32
|
+
* Get all memories related to a given memory (incoming + outgoing links).
|
|
33
|
+
*/
|
|
34
|
+
export declare function getRelatedMemories(memoryId: number): {
|
|
35
|
+
memory: Memory;
|
|
36
|
+
relationship: RelationshipType;
|
|
37
|
+
strength: number;
|
|
38
|
+
direction: 'outgoing' | 'incoming';
|
|
39
|
+
}[];
|
|
40
|
+
/**
|
|
41
|
+
* Delete a memory link by source/target id pair. Returns true if a row was removed.
|
|
42
|
+
*/
|
|
43
|
+
export declare function deleteMemoryLink(sourceId: number, targetId: number): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Get every memory link in the database, newest first.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getAllMemoryLinks(): MemoryLink[];
|
|
48
|
+
/**
|
|
49
|
+
* Detect potential relationships for a new memory.
|
|
50
|
+
*
|
|
51
|
+
* Three strategies in priority order:
|
|
52
|
+
* 1. Tag-based linking (shared tags)
|
|
53
|
+
* 2. Embedding-based semantic linking (cosine similarity >= 0.6)
|
|
54
|
+
* 3. FTS content similarity fallback (Jaccard similarity >= 0.3)
|
|
55
|
+
*
|
|
56
|
+
* Returns deduped results sorted by strength descending, capped at
|
|
57
|
+
* maxResults.
|
|
58
|
+
*/
|
|
59
|
+
export declare function detectRelationships(memory: Memory, maxResults?: number): {
|
|
60
|
+
targetId: number;
|
|
61
|
+
relationship: RelationshipType;
|
|
62
|
+
strength: number;
|
|
63
|
+
}[];
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory relationships (links).
|
|
3
|
+
*
|
|
4
|
+
* Lifted out of the 2,166-line store.ts so the linking surface can be
|
|
5
|
+
* read, tested, and modified without scrolling past every CRUD/search
|
|
6
|
+
* helper in the memory module. No behaviour change vs the original
|
|
7
|
+
* implementation in store.ts — exports re-emerge from store.ts via
|
|
8
|
+
* a barrel re-export so existing import paths keep working.
|
|
9
|
+
*
|
|
10
|
+
* Imports from store.ts (getMemoryById, rowToMemory) form a module
|
|
11
|
+
* cycle, but both are only invoked inside function bodies — ESM live
|
|
12
|
+
* bindings handle this correctly at runtime.
|
|
13
|
+
*/
|
|
14
|
+
import { getDatabase } from '../database/init.js';
|
|
15
|
+
import { cosineSimilarity } from '../embeddings/index.js';
|
|
16
|
+
import { jaccardSimilarity } from './similarity.js';
|
|
17
|
+
import { escapeFts5Query } from './fts.js';
|
|
18
|
+
import { getMemoryById, rowToMemory } from './store.js';
|
|
19
|
+
/**
|
|
20
|
+
* Create a link between two memories.
|
|
21
|
+
*
|
|
22
|
+
* Returns null if either memory id doesn't exist, the source equals
|
|
23
|
+
* the target, or the link already exists (UNIQUE constraint).
|
|
24
|
+
*/
|
|
25
|
+
export function createMemoryLink(sourceId, targetId, relationship, strength = 0.5) {
|
|
26
|
+
const db = getDatabase();
|
|
27
|
+
const source = getMemoryById(sourceId);
|
|
28
|
+
const target = getMemoryById(targetId);
|
|
29
|
+
if (!source || !target)
|
|
30
|
+
return null;
|
|
31
|
+
if (sourceId === targetId)
|
|
32
|
+
return null;
|
|
33
|
+
try {
|
|
34
|
+
const result = db.prepare(`
|
|
35
|
+
INSERT INTO memory_links (source_id, target_id, relationship, strength)
|
|
36
|
+
VALUES (?, ?, ?, ?)
|
|
37
|
+
`).run(sourceId, targetId, relationship, strength);
|
|
38
|
+
return {
|
|
39
|
+
id: result.lastInsertRowid,
|
|
40
|
+
sourceId,
|
|
41
|
+
targetId,
|
|
42
|
+
relationship,
|
|
43
|
+
strength,
|
|
44
|
+
createdAt: new Date(),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get all memories related to a given memory (incoming + outgoing links).
|
|
53
|
+
*/
|
|
54
|
+
export function getRelatedMemories(memoryId) {
|
|
55
|
+
const db = getDatabase();
|
|
56
|
+
const outgoing = db.prepare(`
|
|
57
|
+
SELECT m.*, ml.relationship, ml.strength
|
|
58
|
+
FROM memory_links ml
|
|
59
|
+
JOIN memories m ON m.id = ml.target_id
|
|
60
|
+
WHERE ml.source_id = ?
|
|
61
|
+
`).all(memoryId);
|
|
62
|
+
const incoming = db.prepare(`
|
|
63
|
+
SELECT m.*, ml.relationship, ml.strength
|
|
64
|
+
FROM memory_links ml
|
|
65
|
+
JOIN memories m ON m.id = ml.source_id
|
|
66
|
+
WHERE ml.target_id = ?
|
|
67
|
+
`).all(memoryId);
|
|
68
|
+
const results = [];
|
|
69
|
+
for (const row of outgoing) {
|
|
70
|
+
results.push({
|
|
71
|
+
memory: rowToMemory(row),
|
|
72
|
+
relationship: row.relationship,
|
|
73
|
+
strength: row.strength,
|
|
74
|
+
direction: 'outgoing',
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
for (const row of incoming) {
|
|
78
|
+
results.push({
|
|
79
|
+
memory: rowToMemory(row),
|
|
80
|
+
relationship: row.relationship,
|
|
81
|
+
strength: row.strength,
|
|
82
|
+
direction: 'incoming',
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return results;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Delete a memory link by source/target id pair. Returns true if a row was removed.
|
|
89
|
+
*/
|
|
90
|
+
export function deleteMemoryLink(sourceId, targetId) {
|
|
91
|
+
const db = getDatabase();
|
|
92
|
+
const result = db.prepare(`
|
|
93
|
+
DELETE FROM memory_links WHERE source_id = ? AND target_id = ?
|
|
94
|
+
`).run(sourceId, targetId);
|
|
95
|
+
return result.changes > 0;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get every memory link in the database, newest first.
|
|
99
|
+
*/
|
|
100
|
+
export function getAllMemoryLinks() {
|
|
101
|
+
const db = getDatabase();
|
|
102
|
+
const rows = db.prepare('SELECT * FROM memory_links ORDER BY created_at DESC').all();
|
|
103
|
+
return rows.map((row) => ({
|
|
104
|
+
id: row.id,
|
|
105
|
+
sourceId: row.source_id,
|
|
106
|
+
targetId: row.target_id,
|
|
107
|
+
relationship: row.relationship,
|
|
108
|
+
strength: row.strength,
|
|
109
|
+
createdAt: new Date(row.created_at),
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Detect tag-based links for a memory.
|
|
114
|
+
* Finds memories sharing tags and scores by overlap count.
|
|
115
|
+
*/
|
|
116
|
+
function detectTagLinks(db, memory, maxResults) {
|
|
117
|
+
const results = [];
|
|
118
|
+
if (memory.tags.length > 0) {
|
|
119
|
+
const tagPlaceholders = memory.tags.map(() => '?').join(',');
|
|
120
|
+
const tagMatches = db.prepare(`
|
|
121
|
+
SELECT DISTINCT m.id, m.tags
|
|
122
|
+
FROM memories m, json_each(m.tags)
|
|
123
|
+
WHERE json_each.value IN (${tagPlaceholders})
|
|
124
|
+
AND m.id != ?
|
|
125
|
+
LIMIT ?
|
|
126
|
+
`).all(...memory.tags, memory.id, maxResults);
|
|
127
|
+
for (const match of tagMatches) {
|
|
128
|
+
const matchTags = JSON.parse(match.tags);
|
|
129
|
+
const sharedCount = memory.tags.filter((t) => matchTags.includes(t)).length;
|
|
130
|
+
const strength = Math.min(0.9, 0.3 + (sharedCount * 0.2));
|
|
131
|
+
results.push({ targetId: match.id, relationship: 'related', strength });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return results;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Detect embedding-based semantic links for a memory.
|
|
138
|
+
* Computes cosine similarity against top memories that have embeddings.
|
|
139
|
+
*/
|
|
140
|
+
function detectEmbeddingLinks(db, memory, maxResults) {
|
|
141
|
+
if (!memory.embedding)
|
|
142
|
+
return [];
|
|
143
|
+
const candidates = db.prepare(`
|
|
144
|
+
SELECT id, embedding FROM memories
|
|
145
|
+
WHERE embedding IS NOT NULL AND id != ?
|
|
146
|
+
ORDER BY decayed_score DESC
|
|
147
|
+
LIMIT 100
|
|
148
|
+
`).all(memory.id);
|
|
149
|
+
const results = [];
|
|
150
|
+
const sourceEmbedding = new Float32Array(memory.embedding.buffer, memory.embedding.byteOffset, memory.embedding.byteLength / 4);
|
|
151
|
+
for (const candidate of candidates) {
|
|
152
|
+
const candidateEmbedding = new Float32Array(candidate.embedding.buffer, candidate.embedding.byteOffset, candidate.embedding.byteLength / 4);
|
|
153
|
+
const similarity = cosineSimilarity(sourceEmbedding, candidateEmbedding);
|
|
154
|
+
if (similarity >= 0.6) {
|
|
155
|
+
results.push({
|
|
156
|
+
targetId: candidate.id,
|
|
157
|
+
relationship: 'related',
|
|
158
|
+
strength: Math.min(0.9, similarity),
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return results;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Detect content-based links using FTS5 and Jaccard similarity.
|
|
166
|
+
* Fallback when embeddings are not available.
|
|
167
|
+
*/
|
|
168
|
+
function detectFtsLinks(db, memory, maxResults) {
|
|
169
|
+
const queryText = `${memory.title} ${memory.content.slice(0, 200)}`;
|
|
170
|
+
const escapedQuery = escapeFts5Query(queryText);
|
|
171
|
+
if (!escapedQuery.trim())
|
|
172
|
+
return [];
|
|
173
|
+
let ftsMatches;
|
|
174
|
+
try {
|
|
175
|
+
ftsMatches = db.prepare(`
|
|
176
|
+
SELECT m.id, m.title, m.content
|
|
177
|
+
FROM memories_fts fts
|
|
178
|
+
JOIN memories m ON m.id = fts.rowid
|
|
179
|
+
WHERE memories_fts MATCH ?
|
|
180
|
+
AND m.id != ?
|
|
181
|
+
LIMIT ?
|
|
182
|
+
`).all(escapedQuery, memory.id, maxResults * 2);
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
return [];
|
|
186
|
+
}
|
|
187
|
+
const results = [];
|
|
188
|
+
for (const match of ftsMatches) {
|
|
189
|
+
const matchText = `${match.title} ${match.content.slice(0, 200)}`;
|
|
190
|
+
const sim = jaccardSimilarity(queryText, matchText);
|
|
191
|
+
if (sim >= 0.3) {
|
|
192
|
+
results.push({
|
|
193
|
+
targetId: match.id,
|
|
194
|
+
relationship: 'related',
|
|
195
|
+
strength: Math.min(0.7, sim + 0.2),
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return results;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Detect potential relationships for a new memory.
|
|
203
|
+
*
|
|
204
|
+
* Three strategies in priority order:
|
|
205
|
+
* 1. Tag-based linking (shared tags)
|
|
206
|
+
* 2. Embedding-based semantic linking (cosine similarity >= 0.6)
|
|
207
|
+
* 3. FTS content similarity fallback (Jaccard similarity >= 0.3)
|
|
208
|
+
*
|
|
209
|
+
* Returns deduped results sorted by strength descending, capped at
|
|
210
|
+
* maxResults.
|
|
211
|
+
*/
|
|
212
|
+
export function detectRelationships(memory, maxResults = 5) {
|
|
213
|
+
const db = getDatabase();
|
|
214
|
+
const seen = new Set();
|
|
215
|
+
const results = [];
|
|
216
|
+
function addResults(links) {
|
|
217
|
+
for (const link of links) {
|
|
218
|
+
if (!seen.has(link.targetId)) {
|
|
219
|
+
seen.add(link.targetId);
|
|
220
|
+
results.push(link);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
addResults(detectTagLinks(db, memory, maxResults));
|
|
225
|
+
addResults(detectEmbeddingLinks(db, memory, maxResults));
|
|
226
|
+
if (!memory.embedding) {
|
|
227
|
+
addResults(detectFtsLinks(db, memory, maxResults));
|
|
228
|
+
}
|
|
229
|
+
return results
|
|
230
|
+
.sort((a, b) => b.strength - a.strength)
|
|
231
|
+
.slice(0, maxResults);
|
|
232
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface PruneOptions {
|
|
2
|
+
/** Salience ceiling (inclusive). Memories with salience <= this are candidates. 0..1, default 0.2. */
|
|
3
|
+
salienceLte?: number;
|
|
4
|
+
/** Minimum age in days. Memories older than this are candidates. 1..365, default 30. */
|
|
5
|
+
ageDaysGte?: number;
|
|
6
|
+
/** Optional project scope. Omit for all projects. */
|
|
7
|
+
project?: string;
|
|
8
|
+
/** When true (default) pinned memories are never pruned. */
|
|
9
|
+
excludePinned?: boolean;
|
|
10
|
+
/** When true (default) only count + sample, no deletes. */
|
|
11
|
+
dryRun?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface PruneSampleEntry {
|
|
14
|
+
id: number;
|
|
15
|
+
title: string;
|
|
16
|
+
project: string | null;
|
|
17
|
+
salience: number;
|
|
18
|
+
ageDays: number;
|
|
19
|
+
}
|
|
20
|
+
export interface PruneResult {
|
|
21
|
+
options: Required<Omit<PruneOptions, 'project'>> & {
|
|
22
|
+
project: string | null;
|
|
23
|
+
};
|
|
24
|
+
matched: number;
|
|
25
|
+
sample: PruneSampleEntry[];
|
|
26
|
+
deleted?: number;
|
|
27
|
+
backupPath?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Find + optionally delete memories below a salience threshold older than N
|
|
31
|
+
* days. Always backs up the live DB before any delete; the backup path is
|
|
32
|
+
* returned in the result so the caller can surface it to the user.
|
|
33
|
+
*/
|
|
34
|
+
export declare function pruneMemories(rawOptions?: PruneOptions): Promise<PruneResult>;
|