Replies: 1 comment 1 reply
-
|
补充轻量的ov_search设计,ov-read、ov-tree等完整功能需要后续对标完备的ov cli实现,当前先提示用户可以通过已有 OpenViking CLI 查询 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
[RFC] OpenClaw Plugin 支持通过 OpenViking 导入/查询 Resource 与 Skill
背景
当前
examples/openclaw-plugin已经承担 OpenClaw 与 OpenViking 的 context-engine 集成,包括 session context、memory recall/store/forget、archive expand,以及 local/remote OpenViking runtime 管理。随着 OpenViking 的 resource 和 skill 能力完善,OpenClaw 侧也需要一个自然入口,让用户可以在 OpenClaw 对话或显式命令中把外部资料导入到 OpenViking:
viking://resources/...SKILL.md、skill 目录、raw skill 内容或 MCP tool dict,落到viking://agent/skills/...本 RFC 讨论 OpenClaw plugin 侧的导入入口、HTTP 对接方式、安全边界和测试方案。
目标
ov_import/ov-importkind: "resource" | "skill"区分导入类型,默认resource。OpenVikingClient.addResource()/OpenVikingClient.addSkill(),避免在 resource 和 skill 之间复制上传逻辑。非目标
SKILL.md多行内容或 MCP dict JSON;这些能力通过 LLM tool 的data参数支持。当前 OpenViking 支持的 Resource 输入
OpenViking resource 侧当前支持多类输入源:
http://、https://git@、ssh://、git://,以及常见 Git hosting URL.zip常见文件 parser 覆盖:
.txt、.text、.md、.markdown、.mdown、.mkd、.pdf、.html、.htm.docx、.doc、.pptx、.xlsx、.xls、.xlsm、.epub.png、.jpg、.jpeg、.gif、.bmp、.webp、.svg.mp3、.wav、.ogg、.flac、.aac、.m4a、.opus.mp4、.avi、.mov、.mkv、.webm、.flv、.wmv.py、.js、.ts、.go、.rs、.java、.cpp、.json、.yaml、.toml、.csv、.rst、.proto、.tf、.vue补充说明:media parser 当前主要复制原始文件并提取基础元数据;后续向量化主要依赖摘要。
当前 OpenViking 支持的 Skill 输入
OpenViking 当前已经有独立的 skill 导入链路:
POST /api/v1/skillsResourceService.add_skill(...)SkillProcessor.process_skill(...)viking://agent/skills/{skill_name}支持的输入形态包括:
SKILL.md文件SKILL.md的 skill 目录SKILL.md字符串内容mcp_to_skill()转成 skillHTTP 安全边界是:直接通过 HTTP 调
/api/v1/skills时,不能传宿主本地路径;本地文件/目录需要先上传到/api/v1/resources/temp_upload,再把返回的temp_file_id传给/api/v1/skills。设计方案
1. 对外合并为一个入口
为简化用户和 LLM 的使用成本,对外只暴露一个导入入口:
ov_import/ov-import使用
kind参数区分导入类型:默认:
这样最常见的 resource 导入不需要额外指定类型:
导入 skill 时显式指定:
2. 为什么不拆成两个入口
最初也可以设计为:
ov_resource_importov_skill_import但个人更倾向统一入口,原因是:
/ov-importov_importkind=skill仍然是显式选择,不依赖完全自动猜测换句话说:对外入口合并,对内处理分流。
3. LLM Tool 参数设计
新增工具:
参数:
校验规则:
kind为空时按resource。kind=resource:sourcesource可为本地路径、目录、远程 URL 或 Git URLto与parent互斥datakind=skill:source或datasource可为本地SKILL.md、skill 目录或 zipdata可为 rawSKILL.md或 MCP tool dictto、parent、reason、instruction工具描述中应明确:只有当用户明确要求导入、添加或索引 OpenViking resource/skill 时才调用,避免模型误触发。
4. Resource 导入路径设置
Resource 的导入路径由
to或parent控制,二者互斥:to:精确指定最终 resource URI。parent:只指定父目录,由 OpenViking 根据源文件名、目录名、URL 或仓库名生成子路径。viking://resources/...下按默认规则生成路径。推荐用户在希望得到稳定引用 URI 时使用
to:结果会尽量落到:
如果只想把资源放到某个集合下,可使用
parent:结果会落在类似:
5. Slash Command 参数设计
新增命令:
默认 resource:
导入远程 resource:
导入 skill:
Slash command 暂不支持 raw multi-line
SKILL.md或 MCP dict JSON;如果需要导入这些结构化数据,使用 LLM tool 的data参数。目录导入的高级过滤参数暂不放进 v1 对外入口。后续可以按需增加:
6. Client 层实现
在
OpenVikingClient增加底层方法:uploadTempFile(filePath)zipDirectoryForUpload(dirPath)addResource(input)addSkill(input)ov_import工具和/ov-import命令根据kind分流:本地文件/目录流程:
远程 resource 流程:
Skill raw data 流程:
7. 安全边界
保持 OpenViking HTTP server 当前安全模型:
/api/v1/resources/temp_upload。zip命令。to与parent保持互斥,沿用服务端约束。8. 导入后的检索入口:ov_search
只提供
ov_import会让体验不闭环:用户可以把 resource 或 skill 导入 OpenViking,但在 OpenClaw 内不一定知道如何检索、读取或验证导入结果。因此建议同时讨论一个轻量检索入口:
ov_search/ov-searchov_search的目标不是替代 OpenViking CLI 的全部能力,而是提供最小闭环:root_uri。root_uri检索。ov_import 返回建议
ov_import导入 resource 后,结果中应包含:root_uristatusqueue_status(如果wait=true)示例:
ov_import导入 skill 后也应返回 skill URI,并给出 skill 检索建议:ov_search 参数设计
v1 建议保持简洁:
示例命令:
对应 LLM tool 示例:
ov_search 返回结果
ov_search应尽量贴近 OpenViking 当前/api/v1/search/find的返回结构。OpenViking search 的 raw HTTP 返回外层是:其中
MatchedContext当前包含:因此
ov_search建议也返回两层结果:content.textdetails有结果时的用户可见文本示例:
对应结构化返回建议:
无结果时:
对应结构化返回:
v1 应检索
resources和skills,所以用户可见文本按分桶展示resources和skills;details中保留 OpenViking 原始的memories/resources/skills/total结构。由于 v1 不检索 memory,memories通常为空数组。v1 建议只返回检索结果摘要和 URI,不直接返回完整文件内容。原因:
/ov-read或未来的ov_read。ov_search作为导入后的最小消费闭环,而不是完整文件浏览器。是否同时检索 memory/resource/skill
memory_recall当前偏向长期记忆,不适合作为 resource/skill 导入后的默认消费入口。ov_searchv1 应检索:后续如果希望统一上下文检索 memory/resource/skill,可扩展:
但 v1 不建议一开始加入 memory,避免和既有
memory_recall职责重叠。读取与树形查看
ov_search只解决“查到相关上下文”的问题。若用户需要更明确的文件浏览能力,后续可以再讨论:/ov-read <uri>/ov-tree <uri>v1 暂不加入,避免把导入 RFC 扩展成完整 OpenViking CLI replica。
测试计划
Unit tests
覆盖
OpenVikingClient:addResourcepathwait=true保留queue_statusaddSkillSKILL.md先 temp uploadSKILL.md通过data直传data直传覆盖
ov_import:ov_import/ov-importkind默认resourcekind=skill正确分流到addSkill--kind skill--flag--key value--key=value--to与--parent冲突kind=skill时拒绝to、parent、reason、instruction覆盖
ov_search:ov_search/ov-searchuri时默认检索viking://resources和viking://agent/skills--uri时只检索该范围Manual smoke
以及自然语言触发:
待讨论问题
ov_import是否应默认wait=false?wait=true时才等待。kind=skill时 resource-only 参数应直接报错,还是静默忽略?to/parent对 skill 生效。SKILL.md或目录包含SKILL.md时自动设置kind=skill。--kind skill,默认 resource,行为更可解释。ov_searchv1 是否默认检索viking://resources和viking://agent/skills?memory_recall,避免职责重叠。/ov-read或/ov-tree?ov_search完成导入后的最小消费闭环。Beta Was this translation helpful? Give feedback.
All reactions