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

推荐订阅源

宝玉的分享
宝玉的分享
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
博客园 - 叶小钗
T
Tailwind CSS Blog
博客园 - Franky
WordPress大学
WordPress大学
博客园 - 司徒正美
D
DataBreaches.Net
L
LangChain Blog
G
Google Developers Blog
C
Check Point Blog
爱范儿
爱范儿
阮一峰的网络日志
阮一峰的网络日志
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
SegmentFault 最新的问题
Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
美团技术团队
腾讯CDC
Martin Fowler
Martin Fowler
博客园 - 聂微东
MongoDB | Blog
MongoDB | Blog
Jina AI
Jina AI

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: share session tab registry helpers · openclaw/o...
vincentkoc · 2026-05-29 · via Recent Commits to openclaw:main

@@ -13,6 +13,15 @@ type TrackedSessionBrowserTab = {

1313

lastUsedAt: number;

1414

};

151516+

type SessionBrowserTabIdentityParams = {

17+

sessionKey?: string;

18+

targetId?: string;

19+

baseUrl?: string;

20+

profile?: string;

21+

};

22+23+

type TrackedSessionBrowserTabIdentity = Omit<TrackedSessionBrowserTab, "trackedAt" | "lastUsedAt">;

24+1625

const trackedTabsBySession = new Map<string, Map<string, TrackedSessionBrowserTab>>();

17261827

function normalizeSessionKey(raw: string): string {

@@ -39,12 +48,9 @@ function toTrackedTabId(params: { targetId: string; baseUrl?: string; profile?:

3948

return `${params.targetId}\u0000${params.baseUrl ?? ""}\u0000${params.profile ?? ""}`;

4049

}

415042-

function resolveTrackedTabIdentity(params: {

43-

sessionKey?: string;

44-

targetId?: string;

45-

baseUrl?: string;

46-

profile?: string;

47-

}): Omit<TrackedSessionBrowserTab, "trackedAt" | "lastUsedAt"> | undefined {

51+

function resolveTrackedTabIdentity(

52+

params: SessionBrowserTabIdentityParams,

53+

): TrackedSessionBrowserTabIdentity | undefined {

4854

const sessionKeyRaw = params.sessionKey?.trim();

4955

const targetIdRaw = params.targetId?.trim();

5056

if (!sessionKeyRaw || !targetIdRaw) {

@@ -58,6 +64,23 @@ function resolveTrackedTabIdentity(params: {

5864

};

5965

}

606667+

function trackedTabsForIdentity(

68+

identity: TrackedSessionBrowserTabIdentity,

69+

): Map<string, TrackedSessionBrowserTab> | undefined {

70+

return trackedTabsBySession.get(identity.sessionKey);

71+

}

72+73+

function deleteTrackedTab(identity: TrackedSessionBrowserTabIdentity): void {

74+

const trackedForSession = trackedTabsForIdentity(identity);

75+

if (!trackedForSession) {

76+

return;

77+

}

78+

trackedForSession.delete(toTrackedTabId(identity));

79+

if (trackedForSession.size === 0) {

80+

trackedTabsBySession.delete(identity.sessionKey);

81+

}

82+

}

83+6184

function isIgnorableCloseError(err: unknown): boolean {

6285

const message = normalizeLowercaseStringOrEmpty(String(err));

6386

return (

@@ -68,12 +91,7 @@ function isIgnorableCloseError(err: unknown): boolean {

6891

);

6992

}

709371-

export function trackSessionBrowserTab(params: {

72-

sessionKey?: string;

73-

targetId?: string;

74-

baseUrl?: string;

75-

profile?: string;

76-

}): void {

94+

export function trackSessionBrowserTab(params: SessionBrowserTabIdentityParams): void {

7795

const identity = resolveTrackedTabIdentity(params);

7896

if (!identity) {

7997

return;

@@ -97,18 +115,14 @@ export function trackSessionBrowserTab(params: {

97115

});

98116

}

99117100-

export function touchSessionBrowserTab(params: {

101-

sessionKey?: string;

102-

targetId?: string;

103-

baseUrl?: string;

104-

profile?: string;

105-

now?: number;

106-

}): void {

118+

export function touchSessionBrowserTab(

119+

params: SessionBrowserTabIdentityParams & { now?: number },

120+

): void {

107121

const identity = resolveTrackedTabIdentity(params);

108122

if (!identity) {

109123

return;

110124

}

111-

const trackedForSession = trackedTabsBySession.get(identity.sessionKey);

125+

const trackedForSession = trackedTabsForIdentity(identity);

112126

if (!trackedForSession) {

113127

return;

114128

}

@@ -123,25 +137,12 @@ export function touchSessionBrowserTab(params: {

123137

});

124138

}

125139126-

export function untrackSessionBrowserTab(params: {

127-

sessionKey?: string;

128-

targetId?: string;

129-

baseUrl?: string;

130-

profile?: string;

131-

}): void {

140+

export function untrackSessionBrowserTab(params: SessionBrowserTabIdentityParams): void {

132141

const identity = resolveTrackedTabIdentity(params);

133142

if (!identity) {

134143

return;

135144

}

136-

const trackedForSession = trackedTabsBySession.get(identity.sessionKey);

137-

if (!trackedForSession) {

138-

return;

139-

}

140-

const trackedId = toTrackedTabId(identity);

141-

trackedForSession.delete(trackedId);

142-

if (trackedForSession.size === 0) {

143-

trackedTabsBySession.delete(identity.sessionKey);

144-

}

145+

deleteTrackedTab(identity);

145146

}

146147147148

function takeTrackedTabsForSessionKeys(