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

推荐订阅源

J
Java Code Geeks
腾讯CDC
M
MIT News - Artificial intelligence
Y
Y Combinator Blog
L
LangChain Blog
Vercel News
Vercel News
云风的 BLOG
云风的 BLOG
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog RSS Feed
The GitHub Blog
The GitHub Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
B
Blog
P
Proofpoint News Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园_首页
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
小众软件
小众软件
IT之家
IT之家
A
About on SuperTechFans
H
Help Net Security

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: add session accessor seam with gateway consumer...
jalehman · 2026-06-14 · via Recent Commits to openclaw:main
1+

#!/usr/bin/env node

2+3+

import path from "node:path";

4+

import ts from "typescript";

5+

import {

6+

collectFileViolations,

7+

resolveRepoRoot,

8+

resolveSourceRoots,

9+

runAsScript,

10+

toLine,

11+

unwrapExpression,

12+

} from "./lib/ts-guard-utils.mjs";

13+14+

const legacyReaderNames = new Set(["loadSessionStore", "readSessionEntries"]);

15+16+

export const migratedSessionAccessorFiles = new Set([

17+

"src/config/sessions/combined-store-gateway.ts",

18+

"src/gateway/session-utils.ts",

19+

"src/gateway/sessions-resolve.ts",

20+

"src/gateway/server-methods/sessions.ts",

21+

]);

22+23+

function normalizeRelativePath(filePath) {

24+

return filePath.replaceAll(path.sep, "/");

25+

}

26+27+

function propertyAccessName(expression) {

28+

const unwrapped = unwrapExpression(expression);

29+

if (ts.isIdentifier(unwrapped)) {

30+

return unwrapped.text;

31+

}

32+

if (ts.isPropertyAccessExpression(unwrapped)) {

33+

return unwrapped.name.text;

34+

}

35+

if (ts.isElementAccessExpression(unwrapped) && ts.isStringLiteral(unwrapped.argumentExpression)) {

36+

return unwrapped.argumentExpression.text;

37+

}

38+

return null;

39+

}

40+41+

function bindingName(node) {

42+

if (node.propertyName && ts.isIdentifier(node.propertyName)) {

43+

return node.propertyName.text;

44+

}

45+

if (ts.isIdentifier(node.name)) {

46+

return node.name.text;

47+

}

48+

return null;

49+

}

50+51+

export function findSessionAccessorBoundaryViolations(content, fileName = "source.ts") {

52+

const sourceFile = ts.createSourceFile(fileName, content, ts.ScriptTarget.Latest, true);

53+

const violations = [];

54+55+

const visit = (node) => {

56+

if (ts.isImportDeclaration(node)) {

57+

const namedBindings = node.importClause?.namedBindings;

58+

if (namedBindings && ts.isNamedImports(namedBindings)) {

59+

for (const specifier of namedBindings.elements) {

60+

const importedName = specifier.propertyName?.text ?? specifier.name.text;

61+

if (legacyReaderNames.has(importedName)) {

62+

violations.push({

63+

line: toLine(sourceFile, specifier),

64+

reason: `imports legacy session store reader "${importedName}"`,

65+

});

66+

}

67+

}

68+

}

69+

}

70+71+

if (ts.isBindingElement(node)) {

72+

const name = bindingName(node);

73+

if (name && legacyReaderNames.has(name)) {

74+

violations.push({

75+

line: toLine(sourceFile, node),

76+

reason: `aliases legacy session store reader "${name}"`,

77+

});

78+

}

79+

}

80+81+

if (ts.isPropertyAccessExpression(node) && legacyReaderNames.has(node.name.text)) {

82+

violations.push({

83+

line: toLine(sourceFile, node.name),

84+

reason: `references legacy session store reader "${node.name.text}"`,

85+

});

86+

}

87+88+

if (

89+

ts.isElementAccessExpression(node) &&

90+

ts.isStringLiteral(node.argumentExpression) &&

91+

legacyReaderNames.has(node.argumentExpression.text)

92+

) {

93+

violations.push({

94+

line: toLine(sourceFile, node.argumentExpression),

95+

reason: `references legacy session store reader "${node.argumentExpression.text}"`,

96+

});

97+

}

98+99+

if (ts.isCallExpression(node)) {

100+

const calleeName = propertyAccessName(node.expression);

101+

if (

102+

calleeName &&

103+

legacyReaderNames.has(calleeName) &&

104+

ts.isIdentifier(unwrapExpression(node.expression))

105+

) {

106+

violations.push({

107+

line: toLine(sourceFile, node.expression),

108+

reason: `calls legacy session store reader "${calleeName}"`,

109+

});

110+

}

111+

}

112+113+

ts.forEachChild(node, visit);

114+

};

115+116+

visit(sourceFile);

117+

return violations;

118+

}

119+120+

export async function main() {

121+

const repoRoot = resolveRepoRoot(import.meta.url);

122+

const sourceRoots = resolveSourceRoots(repoRoot, ["src/config/sessions", "src/gateway"]);

123+

const violations = await collectFileViolations({

124+

repoRoot,

125+

sourceRoots,

126+

skipFile: (filePath) =>

127+

!migratedSessionAccessorFiles.has(normalizeRelativePath(path.relative(repoRoot, filePath))),

128+

findViolations: findSessionAccessorBoundaryViolations,

129+

});

130+131+

if (violations.length === 0) {

132+

console.log("session accessor boundary guard passed.");

133+

return;

134+

}

135+136+

console.error("Found legacy session store reader usage in session-accessor migrated files:");

137+

for (const violation of violations) {

138+

console.error(`- ${violation.path}:${violation.line}: ${violation.reason}`);

139+

}

140+

console.error(

141+

"Use src/config/sessions/session-accessor.ts helpers for migrated read/projection paths. Expand this ratchet only after a slice migrates more files.",

142+

);

143+

process.exit(1);

144+

}

145+146+

runAsScript(import.meta.url, main);