惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
Martin Fowler
Martin Fowler
J
Java Code Geeks
The GitHub Blog
The GitHub Blog
C
Check Point Blog
H
Help Net Security
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
P
Proofpoint News Feed
V
Visual Studio Blog
Stack Overflow Blog
Stack Overflow Blog
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Vercel News
Vercel News
S
SegmentFault 最新的问题
L
LangChain Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The Cloudflare Blog
Hugging Face - Blog
Hugging Face - Blog
有赞技术团队
有赞技术团队
博客园_首页
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 test: merge chat context notice checks · openclaw/openclaw@5c2f4af feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248
fix(memory-core): skip dreaming transcript ingestion via ...
2026-04-16 · via Recent Commits to openclaw:main

@@ -2,6 +2,7 @@ import fs from "node:fs/promises";

22

import path from "node:path";

33

import { isUsageCountedSessionTranscriptFileName } from "../../config/sessions/artifacts.js";

44

import { resolveSessionTranscriptsDirForAgent } from "../../config/sessions/paths.js";

5+

import { loadSessionStore } from "../../config/sessions/store-load.js";

56

import { redactSensitiveText } from "../../logging/redact.js";

67

import { createSubsystemLogger } from "../../logging/subsystem.js";

78

import { hashText } from "./internal.js";

@@ -24,6 +25,11 @@ export type SessionFileEntry = {

2425

generatedByDreamingNarrative?: boolean;

2526

};

262728+

export type BuildSessionEntryOptions = {

29+

/** Optional preclassification from a caller-managed dreaming transcript lookup. */

30+

generatedByDreamingNarrative?: boolean;

31+

};

32+2733

function isDreamingNarrativeBootstrapRecord(record: unknown): boolean {

2834

if (!record || typeof record !== "object" || Array.isArray(record)) {

2935

return false;

@@ -78,6 +84,79 @@ function isDreamingNarrativeGeneratedRecord(record: unknown): boolean {

7884

return hasDreamingNarrativeRunId(nested.runId) || hasDreamingNarrativeRunId(nested.sessionKey);

7985

}

808687+

function isDreamingNarrativeSessionStoreKey(sessionKey: string): boolean {

88+

const trimmed = sessionKey.trim();

89+

if (!trimmed) {

90+

return false;

91+

}

92+

const firstSeparator = trimmed.indexOf(":");

93+

if (firstSeparator < 0) {

94+

return trimmed.startsWith(DREAMING_NARRATIVE_RUN_PREFIX);

95+

}

96+

const secondSeparator = trimmed.indexOf(":", firstSeparator + 1);

97+

const sessionSegment = secondSeparator < 0 ? trimmed : trimmed.slice(secondSeparator + 1);

98+

return sessionSegment.startsWith(DREAMING_NARRATIVE_RUN_PREFIX);

99+

}

100+101+

function normalizeComparablePath(pathname: string): string {

102+

const resolved = path.resolve(pathname);

103+

return process.platform === "win32" ? resolved.toLowerCase() : resolved;

104+

}

105+106+

export function normalizeSessionTranscriptPathForComparison(pathname: string): string {

107+

return normalizeComparablePath(pathname);

108+

}

109+110+

function resolveSessionStoreTranscriptPath(

111+

sessionsDir: string,

112+

entry: { sessionFile?: unknown; sessionId?: unknown } | undefined,

113+

): string | null {

114+

if (typeof entry?.sessionFile === "string" && entry.sessionFile.trim().length > 0) {

115+

const sessionFile = entry.sessionFile.trim();

116+

const resolved = path.isAbsolute(sessionFile)

117+

? sessionFile

118+

: path.resolve(sessionsDir, sessionFile);

119+

return normalizeComparablePath(resolved);

120+

}

121+

if (typeof entry?.sessionId === "string" && entry.sessionId.trim().length > 0) {

122+

return normalizeComparablePath(path.join(sessionsDir, `${entry.sessionId.trim()}.jsonl`));

123+

}

124+

return null;

125+

}

126+127+

export function loadDreamingNarrativeTranscriptPathSetForSessionsDir(

128+

sessionsDir: string,

129+

): ReadonlySet<string> {

130+

const storePath = path.join(sessionsDir, "sessions.json");

131+

const store = loadSessionStore(storePath);

132+

const dreamingTranscriptPaths = new Set<string>();

133+

for (const [sessionKey, entry] of Object.entries(store)) {

134+

if (!isDreamingNarrativeSessionStoreKey(sessionKey)) {

135+

continue;

136+

}

137+

const transcriptPath = resolveSessionStoreTranscriptPath(sessionsDir, entry);

138+

if (transcriptPath) {

139+

dreamingTranscriptPaths.add(transcriptPath);

140+

}

141+

}

142+

return dreamingTranscriptPaths;

143+

}

144+145+

export function loadDreamingNarrativeTranscriptPathSetForAgent(

146+

agentId: string,

147+

): ReadonlySet<string> {

148+

return loadDreamingNarrativeTranscriptPathSetForSessionsDir(

149+

resolveSessionTranscriptsDirForAgent(agentId),

150+

);

151+

}

152+153+

function isDreamingNarrativeTranscriptFromSessionStore(absPath: string): boolean {

154+

const sessionsDir = path.dirname(absPath);

155+

const normalizedAbsPath = normalizeComparablePath(absPath);

156+

const dreamingTranscriptPaths = loadDreamingNarrativeTranscriptPathSetForSessionsDir(sessionsDir);

157+

return dreamingTranscriptPaths.has(normalizedAbsPath);

158+

}

159+81160

export async function listSessionFilesForAgent(agentId: string): Promise<string[]> {

82161

const dir = resolveSessionTranscriptsDirForAgent(agentId);

83162

try {

@@ -153,15 +232,19 @@ function parseSessionTimestampMs(

153232

return 0;

154233

}

155234156-

export async function buildSessionEntry(absPath: string): Promise<SessionFileEntry | null> {

235+

export async function buildSessionEntry(

236+

absPath: string,

237+

opts: BuildSessionEntryOptions = {},

238+

): Promise<SessionFileEntry | null> {

157239

try {

158240

const stat = await fs.stat(absPath);

159241

const raw = await fs.readFile(absPath, "utf-8");

160242

const lines = raw.split("\n");

161243

const collected: string[] = [];

162244

const lineMap: number[] = [];

163245

const messageTimestampsMs: number[] = [];

164-

let generatedByDreamingNarrative = false;

246+

let generatedByDreamingNarrative =

247+

opts.generatedByDreamingNarrative ?? isDreamingNarrativeTranscriptFromSessionStore(absPath);

165248

for (let jsonlIdx = 0; jsonlIdx < lines.length; jsonlIdx++) {

166249

const line = lines[jsonlIdx];

167250

if (!line.trim()) {