refactor: trim memory core helper exports · openclaw/openclaw@f3d2ae8
steipete
·
2026-05-02
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2,25 +2,12 @@ import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
2 | 2 | import { registerMemoryCli } from "./src/cli.js"; |
3 | 3 | import { registerDreamingCommand } from "./src/dreaming-command.js"; |
4 | 4 | import { registerShortTermPromotionDreaming } from "./src/dreaming.js"; |
5 | | -import { |
6 | | -buildMemoryFlushPlan, |
7 | | -DEFAULT_MEMORY_FLUSH_FORCE_TRANSCRIPT_BYTES, |
8 | | -DEFAULT_MEMORY_FLUSH_PROMPT, |
9 | | -DEFAULT_MEMORY_FLUSH_SOFT_TOKENS, |
10 | | -} from "./src/flush-plan.js"; |
| 5 | +import { buildMemoryFlushPlan } from "./src/flush-plan.js"; |
11 | 6 | import { registerBuiltInMemoryEmbeddingProviders } from "./src/memory/provider-adapters.js"; |
12 | 7 | import { buildPromptSection } from "./src/prompt-section.js"; |
13 | 8 | import { listMemoryCorePublicArtifacts } from "./src/public-artifacts.js"; |
14 | 9 | import { memoryRuntime } from "./src/runtime-provider.js"; |
15 | 10 | import { createMemoryGetTool, createMemorySearchTool } from "./src/tools.js"; |
16 | | -export { |
17 | | -buildMemoryFlushPlan, |
18 | | -DEFAULT_MEMORY_FLUSH_FORCE_TRANSCRIPT_BYTES, |
19 | | -DEFAULT_MEMORY_FLUSH_PROMPT, |
20 | | -DEFAULT_MEMORY_FLUSH_SOFT_TOKENS, |
21 | | -} from "./src/flush-plan.js"; |
22 | | -export { buildPromptSection } from "./src/prompt-section.js"; |
23 | | - |
24 | 11 | export default definePluginEntry({ |
25 | 12 | id: "memory-core", |
26 | 13 | name: "Memory (Core)", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3,7 +3,7 @@ import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtim
|
3 | 3 | |
4 | 4 | export const MAX_CONCEPT_TAGS = 8; |
5 | 5 | |
6 | | -export type ConceptTagScriptFamily = "latin" | "cjk" | "mixed" | "other"; |
| 6 | +type ConceptTagScriptFamily = "latin" | "cjk" | "mixed" | "other"; |
7 | 7 | |
8 | 8 | export type ConceptTagScriptCoverage = { |
9 | 9 | latinEntryCount: number; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -244,7 +244,7 @@ async function startNarrativeRunOrFallback(params: {
|
244 | 244 | /** |
245 | 245 | * Build the deterministic subagent session key used for dream narratives. |
246 | 246 | */ |
247 | | -export function buildNarrativeSessionKey(params: { |
| 247 | +function buildNarrativeSessionKey(params: { |
248 | 248 | workspaceDir: string; |
249 | 249 | phase: NarrativePhaseData["phase"]; |
250 | 250 | nowMs: number; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2,7 +2,7 @@ import { randomUUID } from "node:crypto";
|
2 | 2 | import fs from "node:fs/promises"; |
3 | 3 | import path from "node:path"; |
4 | 4 | |
5 | | -export type DreamingArtifactsAuditIssue = { |
| 5 | +type DreamingArtifactsAuditIssue = { |
6 | 6 | severity: "warn" | "error"; |
7 | 7 | code: |
8 | 8 | | "dreaming-session-corpus-unreadable" |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -108,7 +108,7 @@ type CronServiceLike = {
|
108 | 108 | remove: (id: string) => Promise<{ removed?: boolean }>; |
109 | 109 | }; |
110 | 110 | |
111 | | -export type ShortTermPromotionDreamingConfig = { |
| 111 | +type ShortTermPromotionDreamingConfig = { |
112 | 112 | enabled: boolean; |
113 | 113 | cron: string; |
114 | 114 | timezone?: string; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -31,7 +31,7 @@ export const DEFAULT_MEMORY_FLUSH_PROMPT = [
|
31 | 31 | `If nothing to store, reply with ${SILENT_REPLY_TOKEN}.`, |
32 | 32 | ].join(" "); |
33 | 33 | |
34 | | -export const DEFAULT_MEMORY_FLUSH_SYSTEM_PROMPT = [ |
| 34 | +const DEFAULT_MEMORY_FLUSH_SYSTEM_PROMPT = [ |
35 | 35 | "Pre-compaction memory flush turn.", |
36 | 36 | "The session is near auto-compaction; capture durable memories to disk.", |
37 | 37 | MEMORY_FLUSH_TARGET_HINT, |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import type { MemorySearchRuntimeDebug } from "openclaw/plugin-sdk/memory-core-host-runtime-files"; |
2 | 2 | import { vi } from "vitest"; |
3 | 3 | |
4 | | -export type SearchImpl = (opts?: { |
| 4 | +type SearchImpl = (opts?: { |
5 | 5 | maxResults?: number; |
6 | 6 | minScore?: number; |
7 | 7 | sessionKey?: string; |
8 | 8 | qmdSearchModeOverride?: "query" | "search" | "vsearch"; |
9 | 9 | onDebug?: (debug: MemorySearchRuntimeDebug) => void; |
10 | 10 | }) => Promise<unknown[]>; |
11 | 11 | export type MemoryReadParams = { relPath: string; from?: number; lines?: number }; |
12 | | -export type MemoryReadResult = { |
| 12 | +type MemoryReadResult = { |
13 | 13 | text: string; |
14 | 14 | path: string; |
15 | 15 | truncated?: boolean; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { |
2 | | -DEFAULT_LOCAL_MODEL, |
3 | 2 | getMemoryEmbeddingProvider, |
4 | 3 | listMemoryEmbeddingProviders, |
5 | 4 | type MemoryEmbeddingProvider, |
@@ -10,12 +9,10 @@ import {
|
10 | 9 | import { formatErrorMessage } from "../dreaming-shared.js"; |
11 | 10 | import { canAutoSelectLocal } from "./provider-adapters.js"; |
12 | 11 | |
13 | | -export { DEFAULT_LOCAL_MODEL } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings"; |
14 | | - |
15 | 12 | export type EmbeddingProvider = MemoryEmbeddingProvider; |
16 | 13 | export type EmbeddingProviderId = string; |
17 | 14 | export type EmbeddingProviderRequest = string; |
18 | | -export type EmbeddingProviderFallback = string; |
| 15 | +type EmbeddingProviderFallback = string; |
19 | 16 | export type EmbeddingProviderRuntime = MemoryEmbeddingProviderRuntime; |
20 | 17 | |
21 | 18 | export type EmbeddingProviderResult = { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,12 +5,9 @@ import {
|
5 | 5 | DEFAULT_TEMPORAL_DECAY_CONFIG, |
6 | 6 | } from "./temporal-decay.js"; |
7 | 7 | |
8 | | -export type HybridSource = string; |
| 8 | +type HybridSource = string; |
9 | 9 | |
10 | | -export { type MMRConfig, DEFAULT_MMR_CONFIG }; |
11 | | -export { type TemporalDecayConfig, DEFAULT_TEMPORAL_DECAY_CONFIG }; |
12 | | - |
13 | | -export type HybridVectorResult = { |
| 10 | +type HybridVectorResult = { |
14 | 11 | id: string; |
15 | 12 | path: string; |
16 | 13 | startLine: number; |
@@ -20,7 +17,7 @@ export type HybridVectorResult = {
|
20 | 17 | vectorScore: number; |
21 | 18 | }; |
22 | 19 | |
23 | | -export type HybridKeywordResult = { |
| 20 | +type HybridKeywordResult = { |
24 | 21 | id: string; |
25 | 22 | path: string; |
26 | 23 | startLine: number; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { randomUUID } from "node:crypto"; |
2 | 2 | import fs from "node:fs/promises"; |
3 | 3 | |
4 | | -export async function moveMemoryIndexFiles(sourceBase: string, targetBase: string): Promise<void> { |
| 4 | +async function moveMemoryIndexFiles(sourceBase: string, targetBase: string): Promise<void> { |
5 | 5 | const suffixes = ["", "-wal", "-shm"]; |
6 | 6 | for (const suffix of suffixes) { |
7 | 7 | const source = `${sourceBase}${suffix}`; |
@@ -16,12 +16,12 @@ export async function moveMemoryIndexFiles(sourceBase: string, targetBase: strin
|
16 | 16 | } |
17 | 17 | } |
18 | 18 | |
19 | | -export async function removeMemoryIndexFiles(basePath: string): Promise<void> { |
| 19 | +async function removeMemoryIndexFiles(basePath: string): Promise<void> { |
20 | 20 | const suffixes = ["", "-wal", "-shm"]; |
21 | 21 | await Promise.all(suffixes.map((suffix) => fs.rm(`${basePath}${suffix}`, { force: true }))); |
22 | 22 | } |
23 | 23 | |
24 | | -export async function swapMemoryIndexFiles(targetPath: string, tempPath: string): Promise<void> { |
| 24 | +async function swapMemoryIndexFiles(targetPath: string, tempPath: string): Promise<void> { |
25 | 25 | const backupPath = `${targetPath}.backup-${randomUUID()}`; |
26 | 26 | await moveMemoryIndexFiles(targetPath, backupPath); |
27 | 27 | try { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。