20 Commits
Author SHA1 Message Date
e5deed8d62 fix(knowledge): warn when container recreate drops local runtimes (#2130)
Packages installed from the dashboard live in the image venv and disappear
when the container is recreated, while settings and indexes stay on the data
volume. Say so at startup, and bake the same extras into the manual FnOS
source image.

Co-authored-by: jubaoliang <jubaoliang@tencent.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-16 23:14:12 +08:00
Bosheng0422 e9d01401e7 fix: bound local knowledge indexing memory and service restarts 2026-10-13 16:03:03 +08:00
HUANG Cheng 99b3c173e0 Merge pull request #1938 from huangcheng/feature/1345-wps-kb-chat-anydoc
feat(knowledge): support .wps/.doc via firecrawl-anydoc (#1345)
2026-10-13 10:24:22 +08:00
jubaoliangandCursor 5e34c8a001 fix: connectors empty layout and restore prior control-plane behaviors
Apply the remaining working-tree changes: connectors empty-state layout,
plus the knowledge, HITL, captcha, workspace, user-cache, and SSRF
adjustments with matching tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-24 22:40:47 +08:00
02b807fd9e fix(knowledge): keep the suffix that keys a renamed document (#1108)
files.document_path() keys the stored bytes on {doc_id}{suffix}, so a rename
that drops or swaps the extension moves the row off its own file: the
original-file route 404s, delete_document() unlinks the wrong key with
missing_ok=True and leaks the bytes, and re-saving an md/txt document
writes a second file. rename_document() now restores the document suffix
the way create_text_document() already normalises it; folders and names that
already carry the right extension are untouched.

Closes #1107

Co-authored-by: sxh313 <250161920+sxh313@users.noreply.github.com>
Co-authored-by: jubaoliang <jubaoliang@tencent.com>
2026-09-24 15:11:04 +08:00
jubaoliang 4510f25dc9 fix(knowledge): decode GBK text documents instead of mojibake
Merged from #879.
2026-09-21 03:03:24 +00:00
jubaoliang aba6b0bb8f fix(knowledge): 远程 OCR 的「请上传图片」拒绝提示不再作为正文入库
Merged from #867.
2026-09-21 03:02:35 +00:00
jubaoliang 5b6c91302c feat: expert composer defaults (KB + MCP) and per-user policies
Allow experts and skill packages to carry composer defaults so that
installed/created agents start with the author's chosen knowledge bases
and MCP servers. Defaults are persisted as agent profile columns and
validated against the installing user. Adds the per-user policy resource
table (migration 014) and wires the dashboard composer fields plus
locale strings.

- Add knowledge_base_ids and mcp_servers to the agent profile schema
- Validate KB/MCP ids on expert/skill-package install and create paths
- Persist defaults via migrate.py helper and 014_user_policy migration
- Surface composer default fields in the dashboard expert/skill UI
2026-09-11 02:00:01 +08:00
HUANG Cheng ce5a7505f0 fix(chat): in-chat preview for knowledge citations (#634) (#642)
* feat(knowledge): include document path in citation markers

* feat(chat): in-chat preview for knowledge citations (#634)

Open Sources chips in a chat modal (rich with text fallback), show KB/path
in the tooltip, and deep-link View in knowledge base to the right folder.

* polish(chat): citation preview UX — tooltip, nav, download, path

Only show tooltip when nested path or truncation; match KB modal width
for markdown; hide download without original; prev/next + arrow keys;
scroll-to-top for long MD; resolve path/has_original from document list.

* polish(dashboard): open citation preview and expert file edit as right drawers

Align chat knowledge citation preview and expert workspace file edit with
the knowledge-base text editor: placement=right, shared width, footer actions.

* polish(chat): put knowledge base name inline in citation drawer title

Show filename · kbName on one line; keep nested folder path as the only subtitle.

* refactor(chat): open knowledge citations in the shared dock panel

Match “edited files” behavior: Sources chips open knowledge tabs in the
chat dock instead of a separate Ant Design drawer.

* fix(dashboard): keep nearby PDF pages mounted to avoid blank scroll canvases

Windowed react-pdf unmount/remount left blank pages while scrolling; keep
pages sticky around the current page and tighten citation dock flex height.
2026-09-10 17:47:22 +08:00
jubaoliang 118bad5c24 feat: optimize AskQuestionCard UI and knowledge parsing 2026-09-04 17:26:06 +08:00
jubaoliangandCursor 8401f892da feat(knowledge): expand document formats, add optional OCR, and show upload progress
Parse more text and spreadsheet types, add optional local/remote OCR for images and scanned PDFs, and surface upload progress so indexing no longer appears stuck.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-03 20:03:21 +08:00
chujieHong 90b8ca2560 feat(knowledge): 支持按知识库配置文档数量上限 (#427)
- schema v10: knowledge_bases 新增 max_documents 列(默认 100,0=不限制,上限 10000)
- 上传时按 KB 自身上限在 SQL 事务内原子拦截,第 N+1 个文档被拒绝
- 前端编辑模态框在"描述"与"图标"之间新增"文档数量上限"输入项,保存即同步
- 详情面板"X/Y 文档"文本、上限 Alert、上传按钮均改用该 KB 自身上限
- SQLite 通过启动兜底加列,PostgreSQL 使用 ADD COLUMN IF NOT EXISTS 幂等迁移
2026-08-27 15:38:05 +08:00
jubaoliangandCursor 8b2f1ecdd7 feat: 内置插件随包分发、可配置上传上限,并补齐 Dashboard 推送与聊天音视频
把 bundled 插件打进 wheel 并在启动时按需种植;上传大小走 config/env;聊天支持音视频预览,定时任务通过 WS toast 推到 Dashboard。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-26 14:06:02 +08:00
chujieHong 76db0e1752 feat(knowledge): 支持知识库文件夹重命名 (#417)
* feat(knowledge): 支持文件夹重命名

- repo: 新增 rename_document,使用 path_parent + normalize_kb_path 计算新路径,
  对文件夹执行基于 substr 的精确前缀匹配(替代 LIKE,避免 _/% 通配符误匹配),
  同步重写所有后代文档的 path 字段
- service: 新增 rename_document,处理权限、名称校验、幂等性与重名冲突,
  同名重命名直接返回避免无谓写库
- api: 新增 POST /{kb_id}/documents/{doc_id}/rename,新增 KNOWLEDGE_NAME_INVALID
  错误码(400)与 KNOWLEDGE_NAME_TAKEN 错误码(409)路由映射
- 前端: KnowledgeBases 文件夹行删除按钮左侧新增重命名按钮(type=text size=small),
  弹窗复用 Modal + Input,名称未变时直接关闭、不发请求
- i18n/locales: 新增 KNOMEDGE_NAME_INVALID 错误消息及重命名成功/失败提示
- tests: 新增 4 个 repo 测试、5 个 service 测试、2 个 api 错误映射测试,
  覆盖后代路径改写、跨根/嵌套文件夹、重名冲突、含分隔符拒绝、幂等、ACL 拒绝

* fix(knowledge): remove stray SKILL_DETAILS_PROTECTED error code

The folder-rename PR accidentally carried SKILL_DETAILS_PROTECTED from an
unrelated feature branch into ErrorCode and _DEFAULT_STATUS without its
i18n entries, failing test_dashboard_api_errors_match_backend and
test_every_error_code_has_i18n_entry in CI. Drop it here; the
published-expert skill-details feature ships it separately with locales.
2026-08-26 10:28:48 +08:00
0ce9cf46d3 feat(dashboard): layout refactor, email invites, KB text editor, remote desktop (#380)
* feat: minimal layout, user email, KB text docs, and remote desktop hub

Add classic/minimal chrome with a unified chat records host, optional user
email (invite/login), in-app markdown/txt knowledge editing, and a combined
remote desktop/phone control surface—plus host path and mobile setup hardening.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(host_dirs): don't jail host-root browse to home drive on Windows

The restrict_to_home=False case allows any absolute host path (no home
jail). On POSIX everything sits under '/'; on Windows the denylist is
empty and windows_neutralize_host_root rewrites root_dir '/' at runtime,
so a drive-relative '/' must stay allowed. The new _path_within_base
containment incorrectly rejected root_dir '/' on Windows when the checkout
drive differed from the home drive, breaking from-expert/local_shell agent
creation.

Also mark test_install_published_expert_accepts_create_options posix_only:
it relies on local_shell workspace file writes unsupported on Windows.

---------

Co-authored-by: jubaoliang <jubaoliang@tencent.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-22 22:04:09 +08:00
jubaoliangandjubaoliang 18ab9f6ba9 feat: workspace backend sandboxing, execute-env injection, and ephemeral image refs (#376)
* feat: workspace backend sandboxing, execute-env injection, and ephemeral image refs

Workspace file-I/O hardening across backend and dashboard:
- Host directory sandboxing via root_dir allow-list and denied prefixes
- Execute-environment defaults injected into harness backend specs
- Ephemeral workspace image rematerialization for model calls
- Attachment hint expansion and inbound store improvements
- Portable memory backend and skill workspace catalog updates
- Dashboard UI for agent backend fields and root-dir selection
- Bump harness-agent 0.9.23 / harness-memory 0.9.7; docs + install notes

* feat: add user invitation codes with admin management and redeem flow

- Add user_invites table (migration 009) plus SQLite/Postgres reconcile paths
- Add InviteRepo and InviteService for create/revoke/list/redeem
- Expose public validate/redeem endpoints and admin create/revoke/list routers
- Extract default-agent bootstrap into octop.infra.agents.default_agent
- Add invite error codes and en/zh i18n strings
- Dashboard: invite drawer, login redeem UI, users list, and locales

* fix: add Windows cross-platform guards for pre-existing sandbox/rootfs tests

- Guard POSIX/container-only tests (rootfs-absolute /.octop/... workspace
  paths) with posix_only in test_thread_artifacts.py and test_agent_manager.py
- Normalize the rendered workspace path assertion in test_octop_builtin_skills.py
  (forward slashes on Windows, not str(tmp_path) backslashes)
- Canonicalize ws_dir before the prefix check in attachment hint/path tests
  (tempfile may yield an 8.3 short path on Windows while the resolved
  attachment path uses the long form)

These failures predate the user-invites commit and are unrelated to it; the
product path logic is correct.

---------

Co-authored-by: jubaoliang <jubaoliang@tencent.com>
2026-08-21 22:32:48 +08:00
e07824e6a9 Fix/agent env usage workspace (#351)
* fix: inject Admin env into running agents and sum turn token usage

Running shells and Docker sandboxes now pick up ~/.octop/env (and workspace .env) without a full reload; MCP stdio no longer inherits the entire host environment. Usage accounting adds every model call in the turn, and workspace I/O survives the harness rebuild window.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: schema v7 identity, expert profiles, chat artifacts, and KB citations (#346)

* feat: schema v7 identity, expert profiles, chat artifacts, and KB citations

Fold integer PKs plus public string ids, document folders, agent profile columns, and thread artifacts into v7 SQL (not only Python helpers). Experts get workspace avatars and a single welcome_message; chat keeps file changes across sessions, shows knowledge citations, and can drag workspace files.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore: drop cron JobDrawer UX from the schema v7 PR

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: prefer tool-arg paths when recording chat artifacts

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: jubaoliang <jubaoliang@tencent.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: jubaoliang <jubaoliang@tencent.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-20 10:17:39 +08:00
jubaoliangandCursor 8b15af47e6 feat: harden knowledge embedding setup and settings ACL
Separate instance KB toggle from page CRUD with knowledge_settings, probe
embedding endpoints correctly, and polish ONNX download/settings UX.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-15 11:43:02 +08:00
jubaoliangandjubaoliang 041628cb76 feat: per-user module permissions (RBAC) with admin bypass (#276)
* feat: add per-user module permissions (RBAC) with admin bypass

Introduce a module-level permission system so non-admin users can be
scoped to a subset of dashboard modules. Adds a `permissions` TEXT column
on the `users` table (migration 006, SQLite + PostgreSQL), a central
permission catalog in `infra/users/permissions.py`, backend ACL checks
across routers, and dashboard gating via `RequirePermission` /
`ForbiddenPage` keyed by nav module. `admin` always bypasses every gate;
read access and chat/agent use are never gated.

* fix: gate connector install-cli by connectors permission (not admin-only)

The host CLI installer is a connectors-module operation and should be
gated by the `connectors` module permission, consistent with the rest of
the connector routes, instead of being admin-only.

The earlier RBAC change demoted this route from `current_admin` but the
test `test_install_cli_forbidden_for_non_admin` still failed because the
`create_user` test helper grants `BASELINE_PERMISSIONS` (which includes
`connectors`) by default, so the "non-admin" user actually held the
permission. Gate the route with `require_permission("connectors")` and
create the test user with `permissions=[]` so it genuinely lacks the
key and is rejected with 403.

---------

Co-authored-by: jubaoliang <jubaoliang@tencent.com>
2026-08-14 14:05:37 +08:00
jubaoliangandCursor e8a824bb1e feat(knowledge): add knowledge bases with chat retrieval
Introduce document indexing, embedding (ONNX/remote), and chat/IM injection with default-open selection in the dashboard composer.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-12 18:56:23 +08:00