feat(openclaw): sync OpenViking plugin runtime and docs#2613
feat(openclaw): sync OpenViking plugin runtime and docs#2613superops-team wants to merge 1 commit into
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
qin-ctx
left a comment
There was a problem hiding this comment.
这版实现看起来是从旧版 OpenClaw plugin runtime 同步过来的,但目标分支 main 现在已经迁到 user/peer contract。当前 patch 会把主线已有的 peer_role、X-OpenViking-Actor-Peer、peer_id、peer memory policy 等行为覆盖回旧的 user/agent 路径。模块化、recall trace、runtime query config 这些方向可以继续推进,但需要先基于当前 main 重新 port:新迭代应继续使用 user/peer,agent 相关字段只保留薄兼容或迁移入口,不能成为默认 runtime path。
| const effectiveAgentId = this.resolveEffectiveAgentId(agentId); | ||
| const controller = new AbortController(); | ||
| const timer = setTimeout(() => controller.abort(), requestTimeoutMs ?? this.timeoutMs); | ||
| try { |
There was a problem hiding this comment.
[Design] (blocking) 这一段请求路径把 OpenClaw plugin 的身份重新切回了 X-OpenViking-Agent(本 hunk 里 headers.set("X-OpenViking-Agent", effectiveAgentId)),并且后续 addSessionMessage 也从当前 main 的 peer_id 改成了 role_id。这看起来是从旧 runtime 基线同步过来的,但目标分支已经切到 user/peer:recall 应通过 X-OpenViking-Actor-Peer 过滤,session message 应用 peer_id 做归因,agentId 只能作为 legacy alias/migration 入口。否则群聊/多用户场景会回退到旧的 user/agent 隔离语义。
| parse(value: unknown): ParsedMemoryOpenVikingConfig { | ||
| parse(value: unknown): Required<MemoryOpenVikingConfig> { | ||
| if (!value || typeof value !== "object" || Array.isArray(value)) { | ||
| value = {}; |
There was a problem hiding this comment.
[Bug] (blocking) 这个 parser 改动删除了 main 上已经支持的 peer_role、peer_prefix、autoRecallTimeoutMs、agentExperience 等配置项,允许字段列表里只保留了新的 agent 配置面。现有安装升级到这个 PR 后会配置解析失败或丢功能,这说明这次同步不是薄兼容,而是在用旧配置面覆盖当前主线配置面。建议保留 current user/peer 配置,并把旧外部分支里的 agent 字段映射到新模型。
| @@ -0,0 +1,80 @@ | |||
| export const ALLOWED_RECALL_RESOURCE_TYPES = ["resource", "session", "user", "agent"] as const; | |||
| export type RecallResourceType = typeof ALLOWED_RECALL_RESOURCE_TYPES[number]; | |||
| export const DEFAULT_RECALL_RESOURCE_TYPES: readonly RecallResourceType[] = ["user", "agent"]; | |||
There was a problem hiding this comment.
[Design] (blocking) 默认 recall target 现在是 user + agent,并会默认查 viking://agent/memories。当前主线迭代要求是 user/peer,所以默认召回不应依赖旧 agent namespace;person/assistant 相关记忆应通过 user scope 加 actor peer 过滤。agent scope 可以保留为显式 legacy 选项,但不能成为默认 runtime path。
Summary
This PR syncs the OpenViking OpenClaw plugin runtime into the community
examples/openclaw-plugintree while preserving upstream behavior and the plugin capabilities that were previously developed in the external OpenClaw/OpenViking integration branch.The main goal is to make the OpenClaw plugin easier to install, test, observe, and maintain from the community repository itself.
What changed
1. Modularized the OpenClaw plugin runtime
The previous plugin entrypoint had too much logic in large files. This PR splits the runtime into smaller, testable modules:
ov_search,ov_read,ov_multi_read, andov_list2. Added runtime query configuration
Adds a runtime query configuration store so recall/search behavior can be tuned without restarting OpenClaw.
Supported override layers:
Supported settings include recall limit, candidate limit, score threshold, injected context budget, resource types, target URI,
ov_searchdefault limit, and ranking/category/resource-type weights.3. Added recall trace observability
Adds recall trace recording, persistence, query tools, and HTTP APIs so users can inspect what the plugin recalled and why.
Capabilities:
ov_search,memory_recall, and auto-recall pathsov_recall_tracetool supportov_searchresult list, and URI detail lookup4. Improved install and release paths
Adds a more complete plugin packaging and install flow, including GitHub-free / TOS-based install support.
5. Expanded tests and architecture guards
Adds regression coverage for module boundaries, query config, feature gates, install contracts, tool registration, and runtime behavior.
Why this refactor
This refactor solves four maintenance problems:
Validation
Local verification from
examples/openclaw-plugin:Result: passed.
Result: passed.
Additional real-scenario validation was performed with Docker OpenClaw 2026.5.28:
ov_searchhealth,status,system-presence,tools.catalog,tools.effective, andtools.invokeNotes for reviewers
This is a large refactor, but the functional center is limited to
examples/openclaw-plugin.Recommended review order:
examples/openclaw-plugin/index.tsfor the new composition flowexamples/openclaw-plugin/services/context-lifecycle-service.tsfor lifecycle behaviorexamples/openclaw-plugin/plugin/openviking-query-runtime.tsfor query tool behaviorexamples/openclaw-plugin/plugin/openviking-recall-trace-runtime.tsandrecall-trace.tsfor observabilityexamples/openclaw-plugin/query-config.tsfor runtime config semanticsexamples/openclaw-plugin/tests/ut/*for regression coverageCompatibility
>=2026.4.8.openclaw openviking setup.