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

推荐订阅源

M
MIT News - Artificial intelligence
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
J
Java Code Geeks
G
Google Developers Blog
美团技术团队
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
The Blog of Author Tim Ferriss
月光博客
月光博客
B
Blog
WordPress大学
WordPress大学
云风的 BLOG
云风的 BLOG
博客园_首页
人人都是产品经理
人人都是产品经理
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
Jina AI
Jina AI
S
SegmentFault 最新的问题
H
Help Net Security
博客园 - 聂微东
Microsoft Azure Blog
Microsoft Azure Blog
Google DeepMind News
Google DeepMind News

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 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 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
refactor(sessions): dedupe generated transcript parsing ·...
vincentkoc · 2026-06-18 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -0,0 +1,29 @@

1+

import path from "node:path";

2+
3+

export function extractGeneratedTranscriptSessionId(sessionFile?: string): string | undefined {

4+

const trimmed = sessionFile?.trim();

5+

if (!trimmed) {

6+

return undefined;

7+

}

8+

const base = path.basename(trimmed);

9+

if (!base.endsWith(".jsonl")) {

10+

return undefined;

11+

}

12+

const withoutExt = base.slice(0, -".jsonl".length);

13+

const topicIndex = withoutExt.indexOf("-topic-");

14+

if (topicIndex > 0) {

15+

const topicSessionId = withoutExt.slice(0, topicIndex);

16+

return looksLikeGeneratedSessionId(topicSessionId) ? topicSessionId : undefined;

17+

}

18+

const forkMatch = withoutExt.match(

19+

/^(\d{4}-\d{2}-\d{2}T[\w-]+(?:Z|[+-]\d{2}(?:-\d{2})?)?)_(.+)$/,

20+

);

21+

if (forkMatch?.[2]) {

22+

return looksLikeGeneratedSessionId(forkMatch[2]) ? forkMatch[2] : undefined;

23+

}

24+

return looksLikeGeneratedSessionId(withoutExt) ? withoutExt : undefined;

25+

}

26+
27+

function looksLikeGeneratedSessionId(value: string): boolean {

28+

return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);

29+

}

Original file line numberDiff line numberDiff line change

@@ -14,6 +14,7 @@ import type { SessionTranscriptUpdate } from "../../sessions/transcript-events.j

1414

import { getRuntimeConfig } from "../io.js";

1515

import type { OpenClawConfig } from "../types.openclaw.js";

1616

import { formatSessionArchiveTimestamp } from "./artifacts.js";

17+

import { extractGeneratedTranscriptSessionId } from "./generated-transcript-session-id.js";

1718

import {

1819

resolveSessionFilePath,

1920

resolveSessionFilePathOptions,

@@ -915,34 +916,6 @@ function classifyGeneratedTranscriptCandidate(

915916

return transcriptSessionId === sessionId ? "current" : "stale";

916917

}

917918
918-

function extractGeneratedTranscriptSessionId(sessionFile?: string): string | undefined {

919-

const trimmed = sessionFile?.trim();

920-

if (!trimmed) {

921-

return undefined;

922-

}

923-

const base = path.basename(trimmed);

924-

if (!base.endsWith(".jsonl")) {

925-

return undefined;

926-

}

927-

const withoutExt = base.slice(0, -".jsonl".length);

928-

const topicIndex = withoutExt.indexOf("-topic-");

929-

if (topicIndex > 0) {

930-

const topicSessionId = withoutExt.slice(0, topicIndex);

931-

return looksLikeGeneratedSessionId(topicSessionId) ? topicSessionId : undefined;

932-

}

933-

const forkMatch = withoutExt.match(

934-

/^(\d{4}-\d{2}-\d{2}T[\w-]+(?:Z|[+-]\d{2}(?:-\d{2})?)?)_(.+)$/,

935-

);

936-

if (forkMatch?.[2]) {

937-

return looksLikeGeneratedSessionId(forkMatch[2]) ? forkMatch[2] : undefined;

938-

}

939-

return looksLikeGeneratedSessionId(withoutExt) ? withoutExt : undefined;

940-

}

941-
942-

function looksLikeGeneratedSessionId(value: string): boolean {

943-

return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);

944-

}

945-
946919

/**

947920

* Persists one logical transcript turn through the current file-backed writer.

948921

* The file implementation resolves/rebinds the transcript file, holds one

Original file line numberDiff line numberDiff line change

@@ -9,6 +9,7 @@ import {

99

parseSessionArchiveTimestamp,

1010

type SessionArchiveReason,

1111

} from "../config/sessions/artifacts.js";

12+

import { extractGeneratedTranscriptSessionId } from "../config/sessions/generated-transcript-session-id.js";

1213

import {

1314

resolveSessionFilePath,

1415

resolveSessionTranscriptPath,

@@ -106,33 +107,7 @@ function classifySessionTranscriptCandidate(

106107

return transcriptSessionId === sessionId ? "current" : "stale";

107108

}

108109
109-

export function extractGeneratedTranscriptSessionId(sessionFile?: string): string | undefined {

110-

const trimmed = sessionFile?.trim();

111-

if (!trimmed) {

112-

return undefined;

113-

}

114-

const base = path.basename(trimmed);

115-

if (!base.endsWith(".jsonl")) {

116-

return undefined;

117-

}

118-

const withoutExt = base.slice(0, -".jsonl".length);

119-

const topicIndex = withoutExt.indexOf("-topic-");

120-

if (topicIndex > 0) {

121-

const topicSessionId = withoutExt.slice(0, topicIndex);

122-

return looksLikeGeneratedSessionId(topicSessionId) ? topicSessionId : undefined;

123-

}

124-

const forkMatch = withoutExt.match(

125-

/^(\d{4}-\d{2}-\d{2}T[\w-]+(?:Z|[+-]\d{2}(?:-\d{2})?)?)_(.+)$/,

126-

);

127-

if (forkMatch?.[2]) {

128-

return looksLikeGeneratedSessionId(forkMatch[2]) ? forkMatch[2] : undefined;

129-

}

130-

return looksLikeGeneratedSessionId(withoutExt) ? withoutExt : undefined;

131-

}

132-
133-

function looksLikeGeneratedSessionId(value: string): boolean {

134-

return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);

135-

}

110+

export { extractGeneratedTranscriptSessionId };

136111
137112

function canonicalizePathForComparison(filePath: string): string {

138113

const resolved = path.resolve(filePath);