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

推荐订阅源

Recent Announcements
Recent Announcements
J
Java Code Geeks
U
Unit 42
GbyAI
GbyAI
大猫的无限游戏
大猫的无限游戏
L
LangChain Blog
D
Docker
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
罗磊的独立博客
I
InfoQ
The Cloudflare Blog
小众软件
小众软件
V
Visual Studio Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Engineering at Meta
Engineering at Meta
S
SegmentFault 最新的问题
爱范儿
爱范儿
Hugging Face - Blog
Hugging Face - Blog
P
Proofpoint News Feed
V
V2EX
月光博客
月光博客
Martin Fowler
Martin Fowler

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
feat(plugin-sdk): add session entry workflow helpers · op...
steipete · 2026-05-22 · via Recent Commits to openclaw:main

@@ -20,10 +20,6 @@ import {

2020

import { definePluginEntry, type OpenClawPluginApi } from "openclaw/plugin-sdk/plugin-entry";

2121

import { parseAgentSessionKey, parseThreadSessionSuffix } from "openclaw/plugin-sdk/routing";

2222

import { isPathInside, replaceFileAtomic } from "openclaw/plugin-sdk/security-runtime";

23-

import {

24-

resolveSessionStoreEntry,

25-

updateSessionStore,

26-

} from "openclaw/plugin-sdk/session-store-runtime";

2723

import { tempWorkspace, resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";

28242925

const DEFAULT_TIMEOUT_MS = 15_000;

@@ -542,20 +538,15 @@ function resolveCanonicalSessionKeyFromSessionId(params: {

542538

return undefined;

543539

}

544540

try {

545-

const storePath = params.api.runtime.agent.session.resolveStorePath(

546-

params.api.config.session?.store,

547-

{

548-

agentId: params.agentId,

549-

},

550-

);

551-

const store = params.api.runtime.agent.session.loadSessionStore(storePath, { clone: false });

552541

let bestMatch:

553542

| {

554543

sessionKey: string;

555544

updatedAt: number;

556545

}

557546

| undefined;

558-

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

547+

for (const { sessionKey, entry } of params.api.runtime.agent.session.listSessionEntries({

548+

agentId: params.agentId,

549+

})) {

559550

if (!entry || typeof entry !== "object") {

560551

continue;

561552

}

@@ -673,17 +664,10 @@ function resolveRecallRunChannelContext(params: {

673664

}

674665675666

try {

676-

const storePath = params.api.runtime.agent.session.resolveStorePath(

677-

params.api.config.session?.store,

678-

{

679-

agentId: params.agentId,

680-

},

681-

);

682-

const store = params.api.runtime.agent.session.loadSessionStore(storePath, { clone: false });

683-

const sessionEntry = resolveSessionStoreEntry({

684-

store,

667+

const sessionEntry = params.api.runtime.agent.session.getSessionEntry({

668+

agentId: params.agentId,

685669

sessionKey: resolvedSessionKey,

686-

}).existing;

670+

});

687671

const rawStrongEntryChannel =

688672

normalizeOptionalString(sessionEntry?.lastChannel) ??

689673

normalizeOptionalString(sessionEntry?.channel);

@@ -1594,53 +1578,50 @@ async function persistPluginStatusLines(params: {

15941578

return;

15951579

}

15961580

try {

1597-

const storePath = params.api.runtime.agent.session.resolveStorePath(

1598-

params.api.config.session?.store,

1599-

agentId ? { agentId } : undefined,

1600-

);

16011581

if (!params.statusLine && !debugLine) {

1602-

const store = params.api.runtime.agent.session.loadSessionStore(storePath, { clone: false });

1603-

const existingEntry = resolveSessionStoreEntry({ store, sessionKey }).existing;

1582+

const existingEntry = params.api.runtime.agent.session.getSessionEntry({

1583+

agentId,

1584+

sessionKey,

1585+

});

16041586

const hasActiveMemoryEntry = Array.isArray(existingEntry?.pluginDebugEntries)

16051587

? existingEntry.pluginDebugEntries.some((entry) => entry?.pluginId === "active-memory")

16061588

: false;

16071589

if (!hasActiveMemoryEntry) {

16081590

return;

16091591

}

16101592

}

1611-

await updateSessionStore(storePath, (store) => {

1612-

const resolved = resolveSessionStoreEntry({ store, sessionKey });

1613-

const existing = resolved.existing;

1614-

if (!existing) {

1615-

return;

1616-

}

1617-

const previousEntries = Array.isArray(existing.pluginDebugEntries)

1618-

? existing.pluginDebugEntries

1619-

: [];

1620-

const nextEntries = previousEntries.filter(

1621-

(entry): entry is PluginDebugEntry =>

1622-

Boolean(entry) &&

1623-

typeof entry === "object" &&

1624-

typeof entry.pluginId === "string" &&

1625-

entry.pluginId !== "active-memory",

1626-

);

1627-

const nextLines: string[] = [];

1628-

if (params.statusLine) {

1629-

nextLines.push(params.statusLine);

1630-

}

1631-

if (debugLine) {

1632-

nextLines.push(debugLine);

1633-

}

1634-

if (nextLines.length > 0) {

1635-

nextEntries.push({

1636-

pluginId: "active-memory",

1637-

lines: nextLines,

1638-

});

1639-

}

1640-

store[resolved.normalizedKey] = {

1641-

...existing,

1642-

pluginDebugEntries: nextEntries.length > 0 ? nextEntries : undefined,

1643-

};

1593+

await params.api.runtime.agent.session.patchSessionEntry({

1594+

agentId,

1595+

sessionKey,

1596+

preserveActivity: true,

1597+

update: (existing) => {

1598+

const previousEntries = Array.isArray(existing.pluginDebugEntries)

1599+

? existing.pluginDebugEntries

1600+

: [];

1601+

const nextEntries = previousEntries.filter(

1602+

(entry): entry is PluginDebugEntry =>

1603+

Boolean(entry) &&

1604+

typeof entry === "object" &&

1605+

typeof entry.pluginId === "string" &&

1606+

entry.pluginId !== "active-memory",

1607+

);

1608+

const nextLines: string[] = [];

1609+

if (params.statusLine) {

1610+

nextLines.push(params.statusLine);

1611+

}

1612+

if (debugLine) {

1613+

nextLines.push(debugLine);

1614+

}

1615+

if (nextLines.length > 0) {

1616+

nextEntries.push({

1617+

pluginId: "active-memory",

1618+

lines: nextLines,

1619+

});

1620+

}

1621+

return {

1622+

pluginDebugEntries: nextEntries.length > 0 ? nextEntries : undefined,

1623+

};

1624+

},

16441625

});

16451626

} catch (error) {

16461627

params.api.logger.debug?.(