Commit Graph

92 Commits (main)

Author SHA1 Message Date
lyingbug 7c9088d0fe
feat(agent): let the WeKnora assistant read the bundled documentation (#4303)
* feat(agent): let the WeKnora assistant read the bundled documentation

Embeds the website-docs pages (01-07) into the server and adds
search_weknora_docs / read_weknora_doc for the built-in assistant, so it
answers how WeKnora works from the docs of the running version.

- pages split into sections with the site's VitePress anchors; Mermaid
  dropped, screenshots reduced to captions, links rewritten to public URLs
- in-memory BM25 over sections, with Han character pairs and whole
  identifiers such as OLLAMA_BASE_URL or v0.8.3
- granted to the built-in assistant by ID, like the operation tools; the
  docs are public, so no signed-in user is required
- tests check every embedded page parses and every internal link resolves

* fix(agent): read long doc sections to the end and keep docs on a broken page

- read_weknora_doc takes an offset: a section too long for one read is cut
  at a line break and returns next_offset, so leaf sections such as the
  model field reference are readable to the end instead of losing the tail.
- Reads follow the registry's output budget (capped at 8000 runes).
- Percent-encoded anchors, as a browser copies them, and http:// doc URLs
  resolve.
- productdocs.Load leaves out a page it cannot parse and reports it, so one
  broken page no longer withholds the documentation tools.
- App CI runs on changes to the embedded doc pages and the sidebar config,
  where the parse and link tests now apply.
2026-10-15 13:06:58 +08:00
Jarvis 97796c637a
fix(helm): configure app rollouts and document shared storage (#4180) 2026-10-12 18:10:29 +08:00
hailongzhao 176aa0d02b fix(sandbox): build real arm64 sandbox images and ship arm64 Cube variants
The global `ARG TARGETPLATFORM=linux/amd64` in Dockerfile.sandbox overrode
the per-platform value BuildKit injects, so the multi-platform CI build ran
every platform on the amd64 rootfs and only relabeled the arm64 config.
The published arm64 entries of main, latest and main-desktop are byte-for-byte
the amd64 layers. The stage-level `ARG TARGETARCH=amd64` had the same effect,
so the cube "amd64 only" guard could never fire.

- Declare TARGETPLATFORM without a default and fall back to linux/amd64 in
  FROM only when it is empty (legacy builder).
- Fail the runtime stage when the rootfs architecture differs from
  TARGETARCH.
- cubesandbox-base:2026.16 publishes linux/arm64 as well, and Cube runs on
  arm64 bare-metal KVM (PVM stays x86_64-only). Follow TARGETPLATFORM for
  cube-base, replace the amd64-only guard with an envd-vs-rootfs check, and
  build cube / desktop-cube for linux/amd64,linux/arm64 in CI and
  build_images.sh.
2026-09-30 13:34:01 +08:00
wizardchen 6c83d7ab47 revert: take the plugin system back out of main
Reverts the eleven plugin system PRs merged on 2026-09-26 so they can be
reviewed before landing:

* a829d7cc9 agent tools served by plugins (#3733)
* 4f5d475c3 Jira example plugin (#3730)
* 01222aac8 dynamic form options, OAuth connections and resource limits (#3729)
* cf502ba46 event delivery and webhooks (#3728)
* 996696057 sandboxed plugin pages (#3727)
* da4ef68d9 standalone plugin hosts (#3725)
* 728007ada remote runtime, Python SDK (#3724)
* ff49f9491 Host API and document parsers (#3721)
* 4328ab26a code plugins (#3720)
* ed63e35cc declarative plugins (#3716)
* c91a8d11f plugin system foundation (#3711)

The tree is back to 47773b5bd, migrations included: no environment ran
the plugin migrations (versioned 000115-000119, sqlite 000034-000038).
2026-09-26 14:58:18 +08:00
lyingbug cf502ba46a
feat(plugin): event delivery and webhooks for plugins (P2 batch 6) (#3728)
* feat(plugin): event delivery and webhooks for plugins
2026-09-26 14:47:13 +08:00
lyingbug 996696057f
feat(plugin): sandboxed plugin pages and the @weknora/plugin-ui bridge (P2 batch 5) (#3727)
* feat(plugin): sandboxed plugin pages and the @weknora/plugin-ui bridge
* ci(pluginsdk): run the Python job's steps in bash on Windows too
2026-09-26 14:46:49 +08:00
lyingbug 728007ada9
feat(plugin): remote runtime, Python SDK and python host plugins (P2 batch 3) (#3724)
* feat(plugin): remote runtime
* feat(plugin): Python SDK and python host plugins
* fix(pluginsdk): skip reverse DNS when a Python plugin binds
2026-09-26 14:46:03 +08:00
lyingbug 4328ab26a9
feat(plugin): code plugins — extension protocol, Go SDK, plugin host, web search and data source adapters (#3720)
* feat(pluginsdk): extension protocol v1, Go SDK and conformance suite
* feat(plugin): run code plugins in an embedded plugin host
* feat(plugin): remote adapters for web search and data sources
* fix(plugin): show plugin errors by their message
* feat(frontend): plugin connectors and web search providers in the UI
* docs(pluginsdk): how to write, package, test and install a plugin
* fix(plugin): gofmt two files and read openapi.yaml line-ending agnostic
* fix(plugin): mark a host plugin ready before Activate returns
2026-09-26 14:45:15 +08:00
dafyy321-pixel 4668447aa6
fix(helm): pin application images to chart version (#3669)
Co-authored-by: dafyy321-pixel <dafyy321-pixel@users.noreply.github.com>
2026-09-25 18:52:02 +08:00
wizardchen 9253b2c1dc fix(frontend): link docs to the public docs site instead of GitHub
In-app doc links opened raw Markdown on GitHub. Point them at the
deployed site (https://weknora.weixin.qq.com/docs/) instead, collected
in utils/docsUrl.ts with a test that checks every linked page and anchor
still exists in website-docs. The issue template's FAQ link moves too.
2026-09-24 20:41:27 +08:00
lyingbug e179f44445
refactor(models): separate provider definitions, model catalogs, and runtime configuration (#3589)
* refactor(models): separate providers, catalog and runtime configuration

* refactor(models): isolate provider definitions and runtime catalogs

* docs: exclude refactoring analysis notes from the pull request
2026-09-23 14:20:08 +08:00
lyingbug 63ef76dd80
docs: 迁移有效文档至 website-docs 并清理旧文档 (#3580)
* docs: consolidate maintained documentation in website-docs

* docs: remove migrated legacy documentation and update remaining references
2026-09-22 23:25:40 +08:00
nullptr-error 22cbcdfa57
feat(sandbox): run unpinned Lite sessions on the host OS sandbox (#3549)
* feat(sandbox): resolve workspace paths through WorkspaceLayout

Keep remote sessions on the /workspace contract, while file, shell, and
artifact code follow the session layout instead of hardcoded paths.

* fix(sandbox): fail closed on host layout lookup and restore the shell blacklist

Treat host vs remote as an explicit origin, refuse inspect outside ReadRoots,
and skip collection when the output tree is missing or equals the project root.

* fix(sandbox): close leftover fail-open holes in the layout path

Keep host copy, collection, and prompt text from falling back to /workspace when a lookup fails or an adapter returns unclean roots.

* fix(sandbox): satisfy golangci-lint on the layout helpers

Wrap new copy and test lines to 120 columns, and add the exported comments revive requires.

* fix(sandbox): gofmt the read_file layout copy wrap

* feat(sandbox): add host as an OS-enforced backend type

Host is not a named/pinnable config: each command is a fresh local process, unlike Docker, Cube, and E2B.

* feat(session): persist Lite host workspace directory

Empty means an auto-allocated folder. Standard edition leaves the column unused so the shared session model still loads. SQLite also gains the tenant skill tables Lite shell_exec already expects.

* feat(localsandbox): adapt the host OS sandbox to session interfaces

File tools stay outside Seatbelt and are bounded by PathGuard. A revoked project directory fails closed instead of allocating a replacement workspace.

* feat(sandbox): run unpinned Lite sessions on the host backend

Lite opts into host explicitly; web stays disabled when no named remote config exists. Host workspaces are not destroyed or auto-committed.

* feat(desktop): pick and persist host project directories

The native folder dialog is the authorization path; typed paths are rejected. settings.sandbox.host tells the client when this edition can use it.

* fix(sandbox): fail closed on Lite host layout lookup misses

Unpinned host sessions were described as /workspace when pin read or
sandbox resolve failed. Prompts and attachment staging now share the
same fallback so Lite never pretends the remote tree exists.

* fix(frontend): keep settings.sandbox.host in sync with the backend keys

TestDeploymentCapabilityKeysMatchFrontend requires the lists to match. Host stays fail-closed like docker so a missed probe does not show Lite-only UI.

* fix(lint): satisfy golangci-lint on the host sandbox wiring

Check c.Error, wrap lines over 120 columns, put context first on versionsWorkspace, and document exported adapter methods.

---------

Co-authored-by: hailongzhao <hailongzhao@tencent.com>
2026-09-22 19:35:03 +08:00
wizardchen 733fdd69a6 fix(mcp): proxy server endpoints through frontend gateways 2026-09-22 17:36:03 +08:00
wizardchen 9b0b0910ba ci(lint): filter new issues from git instead of the PR patch API
`only-new-issues: true` makes golangci-lint-action ask the GitHub API for
the pull request patch, and that endpoint refuses any diff over 20000
lines:

    failed to fetch pull request patch: RequestError [HttpError]:
    Sorry, the diff exceeded the maximum number of lines (20000):
    {"resource":"PullRequest","field":"diff","code":"too_large"}

The action does not fail on that error — it falls back to linting
everything. With the backlog this repository carries (5672 findings at
the time of writing) the job then reports hundreds of issues in files the
pull request never touched, capped at 50 per linter, and cannot pass no
matter how clean the change is. Tencent/WeKnora#3470 hit this at 28050
diff lines.

golangci-lint computes the same filter itself with --new-from-merge-base,
which reads git rather than the API and has no size limit. `fetch-depth: 0`
on the checkout is what makes the base commit available, and the changes
job above already relies on it, so nothing else needs to move.

Verified against that pull request's branch: full run reports 5672 issues,
`--new-from-merge-base=<base sha>` reports 0, both from the repository root
and from the cli module directory.
2026-09-20 17:42:43 +08:00
lyingbug 5780cb0a71
fix(sandbox): separate file access from artifact publishing (#3356)
* fix(sandbox): separate file access from artifact publishing

* test(sandbox): align service coverage and pre-push checks with CI
2026-09-17 16:18:01 +08:00
lyingbug d7ccd5ba51
fix: align client sessions and integration request handling (#3305)
* fix: align client sessions and integration request handling

* fix: preserve trusted Doris redirects and prepare browser tests

* fix: align proxy address checks and integration test coverage
2026-09-16 16:20:57 +08:00
wizardchen 2bc1261b87 chore: remove vendored archives and unused Python helpers 2026-09-16 15:49:36 +08:00
nullptr-error 6ccc5cedf1
feat(sandbox): add a graphical desktop to session sandboxes (#3245) 2026-09-14 20:37:37 +08:00
wizardchen e18cf138a3 fix: remove GPL converter and bundle third-party license sources 2026-09-08 15:19:10 +08:00
HUANG Cheng 6a55860431
feat(ui): multi-stage Docker frontend build (no host npm) (#3074)
* feat(ui): multi-stage Docker build without host npm

Build frontend assets inside the image with node:24-bookworm, then
copy into the existing digest-pinned nginx runtime so docker compose
and CI no longer require a host-side dist step.

* fix(ui): copy local xlsx package and raise Node heap in Docker build

npm ci needs packages/xlsx before install, and vite OOM'd under the
default Node heap during the multi-stage image build.

* fix(ui): native multi-arch frontend Docker build and layer cache

Keep Vite on BUILDPLATFORM so CI does not qemu-emulate Node, pin the
builder image, and move the commit ARG after npm ci so dependency
layers stay cacheable.

---------

Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-07 19:33:57 +08:00
wizardchen 8db2e4f381 ci(docreader): install Playwright WebKit for TestReadURL
The Go client URL test was a false positive: missing WebKit used to
surface as markdown content. #2883 raises instead, so CI must install
the same browser the DocReader image uses.
2026-08-31 14:12:11 +08:00
wizardchen 53cb613419 fix(anydoc): rebuild truncated patched crate instead of failing cargo
A leftover .weknora-patched marker made the build skip recopying even when
Cargo.toml was missing. Require that file before reusing the tree, and build
the archive before cargo audit so CI has the gitignored patch path.
2026-08-21 16:16:33 +08:00
wizardchen d4f4787fb2 ci(dsh-weknora): restore e2e timeout for cold dsh cache
First-run npm install of @deepseek-ai/dsh still takes ~15 minutes; the
10-minute job limit cancelled the run before the cache could warm up.
2026-08-21 14:36:45 +08:00
wizardchen 4e25684b8f ci(dsh-weknora): cache pinned dsh install to speed up e2e
The e2e job spends ~15 minutes downloading @deepseek-ai/dsh on every run
while the actual harness scenarios finish in seconds. Cache the install
directory keyed by DSH_PINNED_SPEC and enable npm dependency caching.
2026-08-21 13:30:41 +08:00
lyingbug 5b14020621
feat(dsh-weknora): DeepSeek Harness plugin exposing WeKnora retrieval tools (#2759)
* feat(dsh-weknora): DeepSeek Harness plugin exposing WeKnora retrieval tools

dsh ships no retrieval, embedding or knowledge-base capability of its own:
its search tools read the workspace and web_search reads the internet. This
plugin fills that gap with the user's own documents, registering four
read-only tools against a WeKnora deployment — knowledge base listing,
hybrid retrieval, full document reading, and WeKnora's own composed answer
with citations.

The package declares no runtime dependency on any harness package. It
mirrors the slice of the tool-definition contract it uses as structural
types and hands ctx.tools.register() a plain object, so a harness release
that adds optional fields cannot break an installed copy. Configuration is
validated at plugin load, so a typo fails the load with every violation
named rather than failing inside the first tool call.

* test(dsh-weknora): unit, API contract and in-harness end-to-end coverage

Three layers, each catching a different class of break.

The unit tests drive the tools against a mock WeKnora and assert what the
model actually sees. The contract layer pins every WeKnora call the plugin
makes in a fixture, then asserts it from both sides: contract.test.mjs
checks the plugin still emits exactly those calls, and contract_test.go
checks WeKnora's real Go request and response types still accept and serve
them — so a rename on either side fails CI instead of a user's agent.

The end-to-end check installs the package into a throwaway dsh profile with
`dsh plugin add`, boots the headless profile against a deterministic
OpenAI-compatible model and a mock backend, and asserts the harness agent
loop really called the tools and answered from what they returned. It runs
both documented paths: the shipped bundle configured only by environment
variables, and a profile patch that overrides the row and renames the tool
prefix.

* docs(dsh-weknora): document the plugin and wire up its CI

The package READMEs cover installation, the configuration reference, the
permission and data-flow story, and the compatibility note naming the dsh
release the plugin is verified against. The four root READMEs gain a short
paragraph pointing at it.

CI runs the tests and a packaging check on every touch, and the end-to-end
check against a pinned harness release so a plugin change is the only thing
that can turn it red. A weekly advisory job runs the same check against
dsh@latest to notice a harness breaking change early, since dsh is in
developer preview and states that breaking changes will happen. Publishing
is gated on a tag that names the packaged version, skips a version already
on npm, and goes out with provenance.

* fix(dsh-weknora): demand the retrieval scope WeKnora actually requires

WeKnora rejects a knowledge-search that names no knowledge base,
document or tag. The search tool told the model the opposite — that the
deployment would decide the scope when a call named none — so on a
deployment with no configured default, which is what the quickstart's
optional WEKNORA_KNOWLEDGE_BASE_IDS leaves behind, the model's first
search failed with an opaque HTTP 400.

The mock backend answered unscoped retrievals where the real handler
refuses them, which is why no test caught this. Align the mock with the
handler, state the requirement in the description, and reject the call
inside the plugin so the model gets a message naming the argument to
supply instead of a transport error. Scenario C covers the resulting
discovery path end to end inside dsh.

* feat(dsh-weknora): make search resolve its own scope and match names

Two gaps made the tool set awkward to use against a real deployment.

Scope: WeKnora refuses an unscoped retrieval, so the model had to pick a
knowledge base before it could search. On a real workspace that choice is
not makeable — 25 bases named "多福多寿", "撒打算", "test 副本 2". Since
knowledge bases sharing a vector store retrieve through a single fan-out
group, searching all of them costs about what searching one costs, so an
unconfigured deployment now resolves the visible set once and searches it.

Names: read_document needs a knowledge_id that only a passage hit could
supply, so "read the X handbook" had no path at all. Search now also
matches document names through /knowledge/search, which spans every base
and needs no scope, and reports the matches it finds inside the caller's
scope. A question-shaped query matches no name and costs nothing.

Also: page 1 of a document now leads with its title and WeKnora's
generated summary, so a long document can be judged without paging; ask
is described as the broad-synthesis tool it is rather than a peer of
search; and a wide scope renders as a count instead of spelling out
every id on every result.

* feat(dsh-weknora): enhance CI workflow and documentation for WeKnora plugin

Updated the GitHub Actions workflow to include Go contract tests, ensuring compatibility with WeKnora's Go types. Enhanced README files to clarify the plugin's functionality and usage. Added error handling for incomplete responses in the client, ensuring that truncated streams are properly managed. Improved test coverage for the ask tool to validate scope resolution and agent behavior.
2026-08-21 11:54:23 +08:00
drakezhang a788115ef3 docs(cli): sweep stale wire vocab from AGENTS.md and close the CI gap that let it drift
The v0.9/v0.10 renames left `agent_invoke`, `session continue-stream`, and three
deleted `mcp.*` error codes documented as current, so agents integrating against
AGENTS.md branch on a surface the CLI no longer has.

Two gaps let this drift sit undetected:

- check-skill-wire-vocab.sh already banned every one of these terms, but only
  scanned skills/. The authoritative contract doc that skills are condensed from
  was never checked. Scan AGENTS.md and README.md too, and assert the scan
  targets exist so coverage cannot silently shrink again. CHANGELOG.md stays out
  of scope: recording a rename requires naming the legacy term.
- errors_doc_test.go only verified code -> doc, so a removed code could linger in
  the reference table forever. Add the reverse direction.

Also drops the matching `mcp.*` reference from the ExitCode doc comment.
2026-08-20 18:16:21 +08:00
wizardchen 6ea2485fa1 ci: 按路径裁剪 PR checks,避免 anydoc 与无关模块 lint 误触发
migrations 或根模块测试变更不应编译 Rust 解析引擎,也不应排队 cli/client 的 golangci-lint。
2026-08-20 15:31:26 +08:00
wizardchen 9b4f792a04 fix(docker): 默认在 app 镜像中链接 anydoc 解析引擎
Hub / compose 打包的二进制此前走 stub,设置页会显示引擎未编入。WITH_ANYDOC 改为默认开启,并补上 builder 所需的 curl。
2026-08-16 13:31:51 +08:00
wizardchen e123f8247e feat(docparser): 引入 anydoc 引擎,在 Go 进程内解析 office 文档
通过 cgo 链接 anydoc Rust 静态库,把 docx/pptx/xlsx 等转为带原位图片的 Markdown;扫描版 PDF 无文字层时回落到 DocReader OCR。默认构建不链接该库。

Co-authored-by: lyingbug <lyingbug@users.noreply.github.com>
2026-08-16 11:37:27 +08:00
lyingbug aaad96ef86
ci: add golangci-lint workflow gating new PR code (#2696)
* ci: add golangci-lint workflow gating new PR code

The repo already ships a .golangci.yml and a `make lint` target, but linting
never ran in CI. A full-tree run currently reports ~5.4k pre-existing findings,
so blocking on it is not viable; instead the workflow enables `only-new-issues`
so a PR is judged solely on the code it introduces.

Runs on pull_request only: `only-new-issues` relies on the PR diff and would
degrade into a full-tree run (and fail) on push. The matrix covers all three Go
modules, since a single run cannot span separate go.mod trees; each resolves the
shared root .golangci.yml via upward config discovery.

* fix: migrate .golangci.yml to the v2 schema

The file declared `version: 2` while still using v1 keys. `golangci-lint run`
tolerates this, but `config verify` (which golangci-lint-action runs before
linting) rejects it: `version` must be a string, and `linters-settings` is not a
valid top-level key in v2.

Quoting the version and moving the block under `linters.settings` also restores
the lll settings, which were silently ignored until now -- applying tab-width 4
raises the lll count in client/ from 32 to 42.

* ci: warm the lint cache on main so pull requests stay fast

Caches written by a pull request run are scoped to that pull request, and the
gating job only runs on `pull_request`, so no shared cache was ever produced.
Every pull request therefore recompiled the whole package graph: the first run
on this branch spent 5m39s of its 6m09s with both the Go build cache and the
golangci-lint analysis cache reporting a miss.

Add a job on main that lints purely for the cache side effect, with
`--issues-exit-code=0` so the existing backlog cannot turn the default branch
red. Manual runs route here as well, giving a full backlog report without the
misleading red status a gating run would produce.

* ci: split the lint cache warmer into its own workflow

A job excluded by a job-level `if` is still reported as a check on every pull
request, and because the matrix is never expanded for a skipped job, GitHub
renders the name literally as "warm lint cache (${{ matrix.module }})".

Separating the triggers into two files removes the stray check instead of
papering over the name. Cache keys are derived from the working directory and
go.sum rather than the workflow, so the caches written on main are still the
ones pull requests restore.
2026-08-13 19:26:30 +08:00
lyingbug 517942c846
feat(sandbox): unify remote sandbox on E2B protocol with self-hosted support (#2655)
* feat(sandbox): unify remote sandbox on E2B protocol with self-hosted support

- Add e2b.proxy_url gateway config and generic gateway transport layer
- Add envd compat layer for Basic auth and multipart /files uploads
- Support Dockerfile.sandbox runtime and e2b-backend build targets in CI
- Rename sandbox image non-root user to align with E2B template convention
- Add sandbox-protocol.md and extend cluster deployment / local repro docs

Enables connecting to any E2B-compatible control plane (E2B Cloud,
CubeSandbox, Agent-Sandbox, etc.) without per-backend client code.

* style(sandbox): gofmt tenant_resolver struct alignment
2026-08-11 20:14:19 +08:00
wizardchen 2611babfef ci(frontend): remove docs terminology coupling 2026-07-30 17:32:44 +08:00
wizardchen a76c6ef24e fix(mcp-server): adopt official PyPI package tencent-weknora-mcp [v1.1.1]
Rename the distribution to tencent-weknora-mcp, point metadata at
Tencent/WeKnora, bump to 1.1.1 for the transport/session fixes, and
tighten publish to main/tags only via Trusted Publishing.
2026-07-30 15:52:28 +08:00
veater 37837c00a9 fix(mcp-server): migrate to MCPServer high-level API (mcp 2.x) [v1.1.0]
MCP Python SDK 2.0 removed the low-level Server decorator API
(@app.list_tools() / @app.call_tool() / app.get_capabilities()), so the
server crashed at startup with:
  AttributeError: 'Server' object has no attribute 'list_tools'

The released PyPI package weknora-mcp==1.0.1 declared 'mcp>=1.0.0' with
no upper bound, so uvx resolved to the latest 2.0.0 and the plugin's
weknora MCP server could no longer connect.

Fix: rewrite the server on top of the mcp 2.x high-level MCPServer API
(formerly FastMCP), and cap the dependency at 'mcp>=2,<3'.

- weknora_mcp_server.py: replace @app.list_tools()/@app.call_tool() with
  28 @mcp.tool() function-signature tools (input schema auto-generated
  from type hints, descriptions from docstrings, plain return values
  serialized by the framework). Transports use run_stdio_async() /
  sse_app() / streamable_http_app(). WeKnoraClient business logic is
  unchanged.
- deps: mcp>=2,<3 in pyproject.toml / requirements.txt / setup.py;
  commit uv.lock pinning mcp 2.0.0.
- version bump to 1.1.0 (pyproject, setup, __init__, main --version,
  server_version).
- check_imports.py: validate MCPServer / ToolError / mcp_types imports.
- ci(.github/workflows/mcp-server.yml): publish on merge to main +
  manual dispatch, not only on tags; add PyPI version-dedup check so
  re-runs on an unchanged version stay green (absorbed from PR #2399).

Verified: stdio initialize + tools/list returns all 28 tools; no
list_tools AttributeError; tool dispatch + error wrapping confirmed.

Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-07-30 15:52:28 +08:00
wizardchen cbe668c06f fix(ci): scope gofmt check to PR commits and format kb_access_test
Compare base...head for pull_request events instead of the merge commit
so unrelated main-branch files are not checked. Also gofmt
kb_access_test.go, which was unformatted on main.
2026-07-30 14:13:15 +08:00
wizardchen fafa925b26 perf(ci): speed up App workflow Go dependency caching
Use setup-go v6 default go.mod cache key instead of go.sum, warm the
module cache with an explicit go mod download step, and scope vet to the
same package set as tests.
2026-07-30 14:13:15 +08:00
wizardchen 4efc987abb fix(ci): make DocReader client tests runnable in PR checks
Start the DocReader gRPC server in the DocReader workflow, skip client
integration tests when the server is unavailable, exclude docreader
packages from the App workflow test scope, and trigger DocReader checks
on go.mod/go.sum changes.
2026-07-30 14:13:15 +08:00
wizardchen a52137d450 ci: add app frontend and docreader checks 2026-07-30 14:13:15 +08:00
wizardchen 55840b1a02 test(mcp-server): restore unittest coverage after workflow dedup
Convert test_module.py to unittest.TestCase so mcp-server.yml's
unittest discover picks up integration checks. Rename test_imports.py
to check_imports.py to keep manual diagnostics out of discovery.
2026-07-29 19:51:47 +08:00
veater 510f6d1dd2 ci(mcp-server): remove duplicate workflow.yml (superseded by mcp-server.yml)
Upstream introduced mcp-server.yml on merge — an improved version of this
file (unittest instead of pytest, python3 in the guard). Keeping both
would run duplicate CI. Drop workflow.yml, keep mcp-server.yml.
2026-07-29 19:51:47 +08:00
annopick 400bbbf717
fix(mcp-server): route diagnostics to stderr to fix stdio protocol crash (#2371)
* fix(mcp-server): route diagnostics to stderr to fix stdio protocol crash

Entry scripts (run_server.py, main.py, run.py) printed diagnostics to
stdout via bare print(). Under the stdio transport (the default and the
path used by all MCP clients per MCP_CONFIG.md: `uv run run_server.py`),
stdout is the JSON-RPC channel, so the plain-text lines emitted before
the initialize handshake corrupted the protocol stream. Strict MCP clients
(Claude Desktop / Cursor / ZCode / VS Code Copilot) treated this as a
fatal protocol error and reported the server as failed-to-start.

Redirect all diagnostic print() to sys.stderr (per MCP spec, only
JSON-RPC may use stdout). weknora_mcp_server.py already routes through
logging (stderr) and is unchanged.

Verified against a live backend (initialize -> tools/list (28 tools) ->
tools/call list_knowledge_bases); stdout first byte is now '{' with all
diagnostics on stderr.

* chore(mcp-server): publish package name as weknora-mcp

Rename the PyPI distribution name from weknora-mcp-server to weknora-mcp
(tools used: pyproject [project].name + setup.py name). The installed
console-script commands (weknora-mcp-server, weknora-server) and the
Python module (weknora_mcp_server) are unchanged for backward compatibility.

* fix(mcp-server): include upload_paths in wheel + bump to 1.0.1

The 1.0.0 wheel was missing upload_paths.py: it was absent from the
[tool.setuptools] py-modules list (and setup.py py_modules), so setuptools
never packed it. weknora_mcp_server.py line 26 does
`from upload_paths import resolve_upload_file_path, set_active_transport`,
so any path that fully imports the module — i.e. the MCP client initialize
handshake — crashed with ModuleNotFoundError. `--version` survived only
because argparse exits before that import runs.

Fix: add 'upload_paths' to py-modules (pyproject.toml + setup.py) and bump
to 1.0.1 (1.0.0 is immutable on PyPI). Also sync the user-facing version
strings (__version__, server_version, main --version) to 1.0.1.

* ci(mcp-server): add workflow.yml to build & publish to PyPI via OIDC

Adds .github/workflows/workflow.yml adapted from annopick/tuomin's ci.yml:
- test: matrix Python 3.10–3.13 (matches requires-python >=3.10), runs the
  flat test_*.py suite in mcp-server/
- build: on mcp-server-v* tags, builds sdist + wheel via uv build, and
  guards against the 1.0.0 regression by asserting upload_paths.py is in
  the wheel before publishing
- publish: PyPI Trusted Publishing (OIDC, id-token: write) to weknora-mcp,
  no API token needed

Publishing is gated on tags named mcp-server-v* to decouple from the Go
release workflow that already targets v* tags.

* fix(mcp-server): route diagnostics to stderr and fix packaging/CI

Prevent MCP stdio startup crashes by sending entry-script diagnostics to
stderr, package upload_paths in the wheel, and add unittest-based CI with
stdout purity regression tests.

---------

Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-07-28 21:23:09 +08:00
zhangzherui 00614b0148 docs: clarify contributor validation workflow 2026-07-28 20:45:30 +08:00
nullkey 6f8b825f5f feat(cli): agent-first WeKnora CLI
The `weknora` command-line client for the WeKnora RAG server. Full command
surface: kb / doc / chunk / session / message / agent / model / search / chat /
auth / profile / link / api / mcp / skills / config / doctor / schema /
exit-codes.

Agent-first wire contract: JSON envelope by default, typed error codes mapped to
stable exit codes, error.retry_argv / retryable / partial-failure status,
global --dry-run preview, the exit-10 confirmation protocol for writes, and
control/ANSI/Bidi input hygiene. Stateless env-credential auth
(WEKNORA_API_KEY / WEKNORA_TOKEN + WEKNORA_HOST) for headless/CI/agent use.
A curated read-only MCP tool surface (`mcp serve`) and embedded Agent Skills
(`skills install`). Extensive unit + contract-golden tests and CI.
2026-07-06 22:53:01 +08:00
wizardchen 1c31d649a7 feat(docker): streamline frontend build process and update Docker configuration
- Added a new script `build_frontend_dist.sh` to handle the building of frontend static assets.
- Updated `docker-compose.yml` to include a note about running the build script before building the frontend service.
- Modified the GitHub Actions workflow to integrate the new build script for frontend assets.
- Adjusted the Dockerfile to copy built assets directly from the `dist` directory.
- Refined the `.dockerignore` to exclude unnecessary files while keeping the `dist` directory.
2026-06-10 16:04:11 +08:00
wizardchen 589d2a6e52 feat(frontend): inject commit ID into frontend build for version tracking
- Added a new build argument `COMMIT_ID_ARG` to pass the commit ID during the Docker build process.
- Updated the Dockerfile to set an environment variable `VITE_FRONTEND_COMMIT` with the commit ID.
- Enhanced the Vite configuration to resolve the frontend commit ID from the environment or Git.
- Modified the SystemInfo component to display the frontend commit ID in the UI.
- Implemented a version info preparation step in the GitHub Actions workflow to capture the commit ID.
2026-06-09 18:08:57 +08:00
wizardchen cdfc9ce23a chore(release): v0.6.0
Tenant RBAC headline release: 4-tier role matrix (Owner/Admin/
Contributor/Viewer), per-KB resource ownership, per-tenant audit
log, tenant member management, self-service workspaces.

Also: CLI v0.3/v0.4 GA, KB retrieval fan-out across vector stores,
AES-256-GCM credential at-rest, docreader gRPC TLS+Token, Zhipu
embedding, Huawei OBS, vLLM URL for MinerU, Apache Doris compat
modes, server-side user preferences, Go 1.26.0.

See CHANGELOG.md for the full list.

docs(rbac): wire RBAC screenshots into READMEs and RBAC guide

- README.md / README_CN.md / README_JA.md / README_KO.md: replace the
  single member-management thumbnail under the v0.6.0 RBAC highlight
  with a 2×2 showcase (member management, workspace switcher,
  self-service workspace creation, pending invitations).
- docs/RBAC说明.md: add the member-management screenshot to the
  existing 前端实际界面 showcase so the guide is self-contained
  and no longer cross-references README for it.

feat(rbac-ui): link tenant member page to RBAC guide

Add an inline doc-link in the Tenant Members settings page that
opens docs/RBAC说明.md on GitHub in a new tab, complementing the
existing in-app role-matrix popover. New i18n key
tenantMember.learnRbacGuide covered for zh-CN / en-US / ko-KR /
ru-RU.
2026-05-21 16:56:19 +08:00
nullkey bdc589e1c0 refactor(cli): --limit/--all-pages, Go 1.26, internal/agent → aiclient
Cross-cutting cleanup that lands alongside the new feature surface:

- `--limit / -L` and `--all-pages` on every list command. Default
  --limit 30 (gh-parity); --all-pages drains every server page
  client-side, capped by --limit. Closes the audit finding that the
  old "1000 max per call" implicit cap was undiscoverable.
- `auth token` emits a TTY-only stderr advisory when stdout is a
  terminal (the credential just got displayed in scrollback) plus an
  api-key-mode rotation hint.
- Comment + doc discipline pass: drop external project name
  references from in-code comments (we reference them in design notes,
  not inline).
- Bump `go` directive to 1.26.0 and CI matrix to 1.26.x to align with
  the main module's go.mod.
- Rename `cli/internal/agent` → `cli/internal/aiclient` to
  disambiguate from the new `cli/cmd/agent` resource subtree. The
  package handles AI coding-agent env detection + per-command --help
  annotations; the new name reflects that more precisely.
2026-05-15 12:03:56 +08:00
wizardchen f0b1851281 docs(issues): require concrete app/UI versions instead of "latest"
Update the bug report and question issue templates to direct users to
the Settings → System Info page and ask for the concrete "App Version"
and "UI Version" values shown there, explicitly disallowing "latest",
"main" or "master" as answers. This pairs with the new UI Version row
on the System Info page so version-mismatch bugs (e.g. SearXNG
base_url field missing on stale UI builds) can be triaged at a glance.
2026-05-13 17:54:15 +08:00
wizardchen f635eaf466 chore(github): translate templates to English and improve content
- Convert issue and PR templates to English only for broader reach
- Bug report: add Steps to Reproduce, Actual Behavior, WeKnora Version,
  and Deployment Method as required fields; expand log guide to cover
  Lite / Desktop / source builds
- Feature request: replace user-selected Priority with Impact to reduce
  severity inflation
- PR template: slim down to 6 sections, add Conventional Commits hint
  in the title, and require `make fmt && make lint && make test` in the
  checklist
2026-05-12 18:28:08 +08:00