feat(lite): ask before host deletes and widen the sandbox on approval (#4076)
- feat(localsandbox): path grants, git metadata protection and delete detection
Grants now name a directory and read or write access. ProposeGrant only offers a directory the policy really withholds, and never the home, system dirs, credentials, the application tree or anything inside .git. Write grants and project workspaces keep every .git below them read-only, and read-only subpaths are final denies in Seatbelt and in PathGuard so a covering root cannot reopen them. DeleteSegments recognizes rm, rmdir, unlink, git rm/clean and find -delete, including wrapped and hidden forms, and reduces each to a session rule.
- feat(localsandbox): ask the user before deletes and widen the sandbox on approval
Run asks before any delete and, after a Seatbelt denial it can tie to a path, offers that directory and re-runs the command once approved, at most two directories per call. Approvals wait outside the root lock. Session approvals (delete rules per cwd, directory grants) live in memory and are released with the session; a grant also widens the file tools’ layout. The approver travels in the context from the caller; without one every question is refused.
- feat(lite): keep session workspaces under ~/.weknora/sessions
Auto-allocated workspaces move from ~/Documents/WeKnoraLite to ~/.weknora/sessions///
/session-. The policy builder is told where they live so no grant can open another session’s workspace.
- feat(approval): host command approvals through the tool approval gate
RequestHostAndWait emits a tool_approval_required event with kind host_command and the command details, and never takes the nil-checker shortcut that auto-approves MCP calls. The resolve endpoint accepts scope (once or session) and access (read or write); MCP events serialize as before.
- feat(agent): let shell_exec on a Lite host wait for the session owner
On a host workspace shell_exec attaches an approver that asks through the gate with this turn’s event bus, user and tool call. The wait is rooted at the approval context so it does not use up the command timeout. Deleting a session releases its host approvals. The tool description says paths outside the workspace may be tried and that deletes ask.
- feat(session): store approval decisions with agent steps and push waiting prompts
Each approval and its outcome is attached to the step that ran the tool, so a reloaded chat still shows what was allowed or refused. After an approval or OAuth prompt the stream writes a 32 KB SSE comment: the Lite webview holds back a short trailing chunk, and the prompt is otherwise the last write until the user answers.
- feat(agent): tell the Lite model about approved directories
The host system prompt, the attachment prompt and the read/write/edit tool descriptions now say that directories the user approved for this session are in scope, that shell_exec may try paths outside the workspace, and that deletes ask first. Remote sandbox wording is unchanged.
- feat(frontend): host approval cards above the chat composer
Pending approvals stack above the composer as HostApprovalCard (Lite host commands) or ToolApprovalCard (MCP), one per pending_id, and close as soon as the user answers. Resolved approvals stay in the step timeline and are rebuilt from stored agent steps on reload. The card shows the command, the directory to open with a read-only option, the session rules a delete would remember, and the block details.
- fix(localsandbox): ask once before deleting outside the workspace
Deleting a file outside the workspace showed two cards: the delete question, then, after the sandbox blocked the run, a second card for the directory and a re-run. The delete card now carries the directory the delete needs (the target’s parent), the command runs once with it, and a session approval remembers both the delete rule and the directory. The delete card no longer offers read-only, which a delete cannot use.
- fix(localsandbox): detect quoted git -C deletes with shell word splitting
commandWords split segments on whitespace, so a quoted path after git -C (e.g. git -C “my repo” clean -fd) shifted the subcommand out of position: gitSubcommandArgs skipped only the first word of the path, saw “repo” as the subcommand and left the delete unclassified, skipping the approval card. Reuse shellWords, which honours quotes and escapes, at the three call sites and drop commandWords.
Add a classification and rule regression for quoted/escaped git -C paths, and an approval-path test asserting the delete card still appears.
- fix(localsandbox): never grant directories under a home dot entry
Toolchain bins (
/.local/bin, ~/.cargo/bin), version managers (/.nvm) and shell or git config (~/.config/fish, ~/.config/git) run outside the sandbox the next time the user uses them. A write grant on one of them is a persistent escape, and the card cannot tell the user that.
- fix(localsandbox): keep session delete rules below cwd
A session rule ignores operands, so approving rm -rf build also covered rm -rf *, rm -rf . and deletes in a directory the session had opened for something else. A delete is now rememberable only when every target stays strictly inside cwd; anything else is asked every time.
A program word that is itself an expansion (RM:−rm,x, $(printf rm)) is treated as a hidden delete when the command mentions a delete program.
- refactor(localsandbox): put session workspaces at sessions/session-
The dated layout made the path depend on when the session started, so every resolve globbed three directory levels. The path now follows from the session ID alone. Resolve also refuses a symlink planted where the workspace should be: MkdirAll accepts it as an existing directory.
- fix(agent): keep the output budget on host commands
hostApprovalContext roots the command at ApprovalCtx, which dropped the registry’s output budget. Also drop waiter.prompt, which nothing read.
- fix(frontend): give the progress timeline test the approval filter
The chronological stream hides host cards that live above the composer, and the extracted displayEvents slice needs that filter in its test context.
- fix(approval): pass the answered prompt into consumeDecision
Upstream now remembers session grants from the prompt itself, so the host approval path has to hand over that prompt instead of the old session fields.
Co-authored-by: hailongzhao hailongzhao@tencent.com Co-authored-by: wizardchen wizardchen@tencent.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
English · 简体中文 · 日本語 · 한국어
项目介绍 · 快速开始 · 最新更新 · 功能概览 · 客户端与生态 · 文档 · 开发指南
项目介绍
WeKnora(维娜拉) 是一款开源的、基于大语言模型(LLM)的知识管理框架,面向企业级文档理解、语义检索与智能推理场景。它把团队分散的文档汇集起来,用于检索、推理,并随资料更新持续维护。
https://github.com/user-attachments/assets/5722b10d-d04d-49ed-a6cc-635a8c77d91f
1 分 52 秒 · 1080p · 无旁白,英文画面文字
查询资料用 RAG,处理多步任务用 Agent,整理知识用 Wiki。三种能力共享同一知识库。
Agent 的工具箱。 技能可从 ClawHub / SkillHub / Git / ZIP 安装,在会话级持久的 Docker / E2B / Cube 沙箱中运行,对话旁可打开交互式终端与图形桌面。借助 BrowserSkill 扩展,Agent 可以操作用户自己的 Chrome / Edge;外部 MCP 服务(支持 OAuth)可以接入,并按工具逐个启用。
除此之外:
快速开始
在线使用
微信对话开放平台
在线管理知识库,将问答服务接入公众号、小程序等微信场景。
进入平台 →
云端部署
腾讯云轻量应用服务器
通过应用模板部署 WeKnora,在自己的云服务器上运行。
前往腾讯云部署 →
自行部署
部署到自己的环境
使用 Docker 或 Kubernetes 部署,自行配置模型、存储和网络。
使用 Docker Compose 部署 ↓
使用 Docker Compose 部署
需要 Docker、Docker Compose 与 Git。
启动成功后访问 **http://localhost**,按新手引导完成配置即可使用。带样例数据的完整上手流程见快速上手。
http://localhosthttp://localhost:8080http://localhost:3000可选服务
按需添加
--profile启动额外组件,多个 profile 可叠加使用:fullneo4jminiolangfuse版本升级
若已有部署并下载了更新的 release:
其他部署方式
helm/全部部署形态、硬件要求与常见拓扑见安装部署。
最新更新
v0.8.3 · 2026-10-14 · 版本说明
v0.8.2 · 2026-09-24 · 版本说明
智能体可以操作你电脑上的浏览器,知识库可以通过 MCP 接入其他 AI 工具,进行中的对话可以补充要求、分叉或回滚。
/mcp/<endpoint_id>端点,Streamable HTTP,每个端点独立令牌、知识库范围、限流与工具分组;Python 版mcp-server/已弃用。search_knowledge/read_document/list_documents。v0.8.0 · 版本说明
search_memory。@wxg-prc-cpg/dsh-weknora;LiteLLM;Exa 与 Metaso 网络搜索。更早版本(v0.2.0 – v0.7.2)
resource_urls=public);飞书云盘数据源;批量打标签;MCP Server 1.1(29 个工具);AWS S3 默认凭据链。@Skill / @MCP提及;会话内 MCP OAuth;QQBot 与 Lark IM;Redis TLS;weknoraCLI v0.10。process_config)+ 上传确认对话框;文档重新解析(reparse)支持覆盖配置;weknoraCLI v0.9(内置 Agent Skills、session stop、auth/profile 统一);知识库框选多选;pgvector 1024 维 HNSW 索引;对话资源 Store 重构;仅保留 Langfuse 追踪(移除 Jaeger)。weknoraCLI v0.7 / v0.8(Agent 优先线协议、NDJSON、--dry-run);OpenDataLoader 与 PaddleOCR-VL 解析引擎;MCP Server 多传输(stdio / SSE / HTTP);按模型的思考模式配置;腾讯云 LKEAP 重排 + 原生 Gemini Embedding + MiniMax-M3。Owner/Admin/Contributor/Viewer+ 按 KB 归属 + 每空间审计日志)、空间成员管理与多工作区 UX、自助创建工作区;weknoraCLI v0.4 正式版 +mcp serve;KB 检索跨向量库扇出;MCP / 数据源凭据 AES-256-GCM 加密 + docreader gRPC TLS + Token;新增智谱 Embedding 与华为云 OBS;服务端用户偏好;Go 1.26.0。详见多租户与认证。weknoraCLI 早期版本。final_answer工具。完整变更记录见
CHANGELOG.md。功能展示
快速问答与智能推理
两种提问方式。 快速问答基于知识库做 RAG 检索作答,并标注引用来源;智能推理由智能体规划多步任务,检索、阅读文档、调用工具与技能,每一步都在对话中展示。 文档 →
本机浏览器
操作你电脑上的浏览器。 借助腾讯开源的 BrowserSkill 扩展,智能体直接在你的 Chrome 或 Edge 中打开网页、填写表单;遇到登录或验证码时交给你。 文档 →
技能与沙箱
运行技能,生成文件。 支持 Docker、E2B、Cube。同一会话的多轮任务共用一个工作区,生成的文件可预览和下载;还可以在对话旁打开图形桌面或交互终端,查看智能体的每一步操作,必要时亲自接手。 文档 →
工具箱:MCP 服务与技能
智能体可用的工具。 接入外部 MCP 服务,逐个选择启用哪些工具、哪些调用需要审批;从 ClawHub、SkillHub、Git 或 ZIP 安装技能,在空间内统一管理,供各个沙箱复用。 文档 →
自动 Wiki
把文档整理成可浏览的 Wiki。 开启 Wiki 后,从知识库文档中提取人物、产品和概念,生成带来源引用的页面,按目录浏览;在知识图谱中查看页面之间的关系,页面可直接编辑,改动可回溯。 文档 →
可观测性
追踪与运行监控。 Langfuse 追踪智能体每一步的推理、工具调用与 Token 用量;文档解析时间线逐阶段展示进度;任务队列面板列出排队与失败的任务。 文档 →
架构设计
从文档解析、向量化、检索到大模型推理,各环节模块化解耦,组件可替换、可扩展。支持本地与私有云部署,Web UI 开箱即用。延伸阅读:架构总览 · RAG 流水线 · 扩展点。
功能概览
支持的组件
客户端与生态
weknoramcp-server/下的 Python 服务已弃用dsh编码 Agent 提供四个只读工具:检索、读取文档、提问、列出知识库命令行工具
weknora是官方命令行工具,可在终端或 AI Agent 中驱动 API。它以 Agent 为先:每条命令默认输出稳定的 JSON 信封(带类型化错误码并映射到退出码),--format text则面向人类阅读。它还提供精选的 MCP 工具面(weknora mcp serve),并内置 Agent Skills。在无界面 / CI 场景下,设置
WEKNORA_API_KEY与WEKNORA_HOST即可跳过auth login,不会有凭据写入磁盘。安装与 5 分钟上手见cli/README.md,AI Agent 依赖的操作约定见cli/AGENTS.md。文档
完整产品文档见 **weknora.weixin.qq.com/docs**,按「入门 → 架构 → 功能 → API → 客户端 → 开发」六个板块组织,覆盖约 360 个 API 端点、约 150 个环境变量与 9 大扩展点。
开发指南
频繁修改代码时不需要每次重新构建 Docker 镜像,使用快速开发模式即可:
详细说明见开发环境快速入门。
文档站与产品主页的源码位于
website-docs/。使用 Node.js 24 运行cd website-docs && npm run setup && npm run build && npm run preview即可同时预览两者;统一的静态产物在/提供主页、在/docs/提供文档。Nginx 与 Docker 部署方式见该目录的 README。贡献指南
欢迎通过 Issue 反馈问题或提交 Pull Request。
gofmt格式化代码,遵循 Conventional Commits 提交(feat:/fix:/docs:/test:/refactor:)验证方式
对于范围集中的 PR,优先验证本次改动涉及的文件和包:
提交前请对改动过的 Go 文件运行
gofmt。对于前端改动,请在frontend/目录运行相关测试;如果改动涉及 TypeScript 或 Vue 组件,还应运行npm run type-check。维护者使用的全仓验证命令仍然是:
make fmt会格式化整个 Go 仓库,因此请仅在工作区干净时运行,并检查产生的 diff。部分全量测试依赖本地基础设施或服务配置。如果全仓检查因无关的基线问题或环境依赖失败,请在 PR 中写明具体命令和错误,同时提供本次改动范围内通过的定向测试。贡献者
感谢所有贡献者:
许可证
本项目基于 MIT 协议发布。你可以自由使用、修改和分发本项目代码,但需保留原始版权声明。