Commit Graph

3491 Commits (c40b33ecc34f5a2c33bc47d33e33c577e2ae1c2d)

Author SHA1 Message Date
lyingbug c40b33ecc3
fix(agent): admit catalog operations only from knowledge API areas (#4317)
The operation catalog refused routes under a list of forbidden prefixes,
matched as "<prefix>" or "<prefix>/". Areas whose names only extend a
listed one passed: /sandbox-configs, /storage-backends,
/web-search-providers and /im-channels. Areas nobody listed passed too,
including /agent/tool-approvals and /agent/prompts, where an annotated
operation would let the assistant answer its own approval prompts.
Nothing reachable is annotated today, so this closes the gap before an
annotation can open it.

The check is now an allow-list of first path segments (knowledge bases,
knowledge, Wiki, chunks, FAQ). Anything else, including APIs added
later, is refused until listed on purpose. Inside those areas, "shares"
is refused: who can reach a knowledge base is the user's decision.
2026-10-15 14:20:27 +08:00
lyingbug 33b77f8440
fix(ui): compact resource list headers in Lite mode (#4316) 2026-10-15 13:35:31 +08:00
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
lyingbug 687b178706
feat(agent): add the built-in WeKnora assistant with an operation catalog (#4302)
* feat(agent): add the built-in WeKnora assistant with an operation catalog

Adds builtin-weknora-assistant, which inspects and manages WeKnora with the
signed-in user's permissions:

- find_operations / run_operation over an allow-listed API operation catalog,
  dispatched in-process through the real router as the user
- builtin approval for write/destructive operations, refused when
  non-interactive
- agent attribution in knowledge base activity, including async tasks
- page_context request field, narrowed to the turn's search targets and
  rendered into runtime_context with model handles

* refactor(agent): compile the operation catalog from x-agent Swagger annotations

The catalog was a hand-written copy of what the swag annotations already
describe: routes, parameters, enums and response shapes. It now compiles
from the Swagger document embedded in the binary. Handlers opt in with

  // @x-agent      {"id":"knowledge.delete","risk":"destructive",...}
  // @x-agent-hint "Cannot be undone."
  // @Param        id path string true "知识ID" extensions(x-agent=knowledge_id)

and response types mark the fields the model may see with an
extensions:"x-agent" struct tag. Exposure stays opt-in at every level:
unmarked operations, parameters and fields are not reachable, so a new
field on Knowledge or a new query parameter never reaches the model by
accident. NewCatalog still enforces the safety rules (forbidden areas,
risk versus method, approval targets), and a test fails when the
annotations and docs/swagger.json disagree.

The twelve operations compile to the same routes, parameters and
results as before; document results now share one field set, and the
parse_status filter accepts deleting, which the API supports.

* fix(agent): enforce resume and wiki context scopes
2026-10-15 12:18:30 +08:00
lyingbug 234aa948db
docs(swagger): document the real request and response types (#4304)
* docs(swagger): add shared response envelope types

* docs(swagger): type knowledge base responses

* docs(swagger): add concrete response body types

* docs(swagger): type chunk list responses

* docs(swagger): type knowledge mutation responses

* docs(swagger): type wiki search and autofix responses

* docs(swagger): type FAQ responses

* docs(swagger): type tag responses

* docs(swagger): type message responses and SSE schemas

* docs(swagger): type agent responses

* docs(swagger): type remaining handler responses

* docs(swagger): regenerate OpenAPI spec

* docs(swagger): type knowledge, activity and wiki maintenance endpoints

Covers the endpoints left out of the earlier passes: knowledge base
detail, document list/detail/spans/reparse/cancel/delete, knowledge
base activity and the Wiki stats, issues, lint and rebuild-links
endpoints. The spans handler now writes the documented structs instead
of gin.H, so the schema cannot drift from the body; the JSON is
unchanged. List filters gain their real enums and bounds, including
the finalizing, cancelled and deleting parse states.

* docs(swagger): document JSON-valued fields as JSON, not byte arrays

types.JSON and json.RawMessage are byte slices, so swag rendered every
metadata, details and config field as an array of integers. A swag
overrides file documents them as objects; the four fields that hold
arrays (relation chunk ids, allowed origins, image refs) say so with a
swaggertype tag.

* chore(lint): exempt swag annotation lines from the line-length limit

swag reads each @Param, @Success and @Failure as a single line, so an
enum list or a composed response type cannot be wrapped to fit.

* chore(lint): exempt struct tags carrying swag attributes from the line limit

Struct tags cannot wrap either; a field documented with swaggertype or
extensions keeps its tags on the declaration line.
2026-10-15 01:41:42 +08:00
lyingbug a77d83fe0e
feat(search): add RRF controls in a tabbed settings popover (#4300) 2026-10-14 23:41:16 +08:00
lyingbug 383d26535a
feat(agent): persist human-in-the-loop prompts with a shared broker (#4250)
* feat(agent): persist human-in-the-loop prompts with a shared broker

Tool approvals and MCP OAuth prompts are now rows in agent_prompts,
awaited through hitl.Broker (lease, DB polling, Redis wake-up, per-kind
answer validation). Resolve is bound to session and kind. This is P1 of
the suspend/resume design; runs still block as before.

* feat(agent): suspend runs whose prompt outlives a short in-memory wait

Behind agent.prompt_suspend_enabled (off by default). A run raised from the
HTTP stream saves its state when a tool approval is raised; after the hot
wait the prompt moves to suspended and the assistant message is saved as
awaiting_input instead of blocking. A reaper takes over prompts whose
waiting replica stopped renewing its lease. Resume comes in a later change.

* feat(agent): resume suspended runs once their prompt is answered

The replica that records the answer resumes the run in process under the
prompt's lease. Superseded, expired and abandoned runs are closed with a
result for every tool call, and approved tools are never replayed.

* feat(agent): let users answer suspended tool approvals and follow the resumed run

* feat(agent): ask_user tool and generic prompt answer endpoint

- ask_user built-in tool: options, short forms or free text; validated
  answers, decline, suspend/resume like tool approval; non-interactive
  callers (IM, API keys) are told to ask in the reply instead
- POST /agent/prompts/{prompt_id} (and embed variant) answers ask_user
  and tool_approval prompts, returns resumed; SDK ResolveAgentPrompt
- agent_prompt_required/resolved events; AskUserCard sharing the
  countdown with ToolApprovalCard; answered questions rebuilt as cards
  from history
- awaiting-input messages keep their steps expanded so the pending card
  stays visible; prompt cards keyed by their own id
- i18n for all locales; design doc updated

* fix(agent): keep prompt answers that race a suspending or vanished owner

- Resolve suspends a pending prompt whose owner's lease lapsed, as the
  reaper would, so the answer resumes the run instead of waking nobody.
- Resuming waits for the suspending run to persist its message and clear
  its live-run marker; a marker left by a vanished owner is cleared.
- A resumed run that suspends again on a new prompt no longer has its
  message closed from the old state.
- tool_approval answers are decoded strictly and require "approved";
  fix the SDK doc that showed {"decision": "approve"}.
- API-key runs block instead of suspending, since they cannot answer.
- A run state that cannot be saved falls back to an in-memory wait, and
  NUL escapes are stripped from snapshots for jsonb.

* style(chat): align the ask_user card with the other interaction cards

Question and answer use the timeline's step text styles instead of
primary-colored and monospace text; options and form controls use the
compact step size, the number input spans the row, and the free-text
character counter is hidden.

* feat(chat): dock pending agent prompts above the composer

Tool approvals, ask_user questions and MCP OAuth prompts were answered
inline in the agent timeline, where a long answer or scrolling back
pushes them out of view. Open prompts of a streaming or suspended run
now gather in a dock above the composer (main chat and embed), one at a
time with a pager, lettered options and Enter to submit. The timeline
keeps a one-line record with a link back to the dock and the outcome
once answered. Views without a dock still answer inline.

* fix(agent): fence prompt ownership and preserve resumed turn context

* fix(agent): keep runs through consume errors and file prompts under the caller

Consume reported a store error as a lost claim, so an answer consumed
during a database hiccup detached its run: the message was never
persisted, the live-run marker stayed, and the reaper skipped the row
because the waiter had already dropped the snapshot. Consume now retries,
then decides from the row, and gives a run up only when the prompt is
known to have moved on.

Tool approvals and OAuth prompts of a shared agent were filed under the
agent's workspace, so the user's answer failed the tenant check and the
prompt timed out. Like ask_user, they now use the caller's workspace;
policy and token lookups stay in the agent's.

Enter on a picked option submits it instead of toggling it off, and
resume errors no longer report a nil cause.

* fix(agent): validate prompt choices and require durable approval claims

Reject malformed serialized option lists so the model can retry with valid arguments. Distinguish prompt consumption failures from lost ownership without authorizing side effects, and preserve native Enter selection for unselected choices.

* fix(agent): resolve prompt workflow lint errors
2026-10-14 20:37:28 +08:00
lyingbug 6c3730a6ad
fix(docs): stabilize anchor navigation and link release topics (#4287)
* docs: link v0.8.3 README topics to release sections

* fix(docs): reserve screenshot space for stable anchor navigation
2026-10-14 16:13:44 +08:00
lyingbug 3e22822c1d
chore(release): finalize v0.8.3 website and documentation (#4285)
* chore(release): prepare v0.8.3 website and documentation

* docs(website): broaden release highlights and simplify browser layout

* docs(website): keep feature descriptions and screenshots in view

* docs(website): show four expanded release highlights

* docs(website): show browser states beside screenshots

* docs(website): unify section backgrounds and spacing

* fix(website): sync product screenshots and refine hero content

* fix(website): add gallery detail view and refine feature headings

* docs: illustrate mention resource selection in v0.8.3 release notes

* docs(release): finalize v0.8.3 release date and publication wording
2026-10-14 15:20:30 +08:00
lyingbug 3b3b519310
fix(agent): clarify attachment image paths and chart readings (#4283) 2026-10-14 14:23:28 +08:00
lyingbug 76ff398e01
fix(chat): locate citations in manual Markdown documents (#4278) 2026-10-14 11:53:58 +08:00
Ochan Kwon 31c6055687
feat(agent): name the turn's chat model on the completion event (#4252)
The agent completion event carries the turn's aggregated token usage
but not the chat model that produced it. A relay or gateway that meters
agent chat cannot price that usage: unit prices, and the discounts for
cache reads, cache writes and uncached input, differ per model, and
changing an agent's model blends the old and the new numbers in one
total.

The completion event's data now carries model_id, taken from the
engine's chat model. The turn's usage is aggregated only from calls
made through that model (each round and the final answer), so it names
the model the usage belongs to. A consumer resolves the model's name
and settings through the model API with its own credentials. The
message row's model_id keeps the requested binding and can differ when
a request override is invalid and the turn falls back to the agent's
model; the event names the model that actually ran. The key is omitted
when no model is known. The quick-answer path is not changed.

The model name is left out on purpose. The completion event reaches
everyone who chats with the agent, including shared-agent users and
embed visitors, and an operator may not want to reveal which model
serves an agent; the provider-facing string can also be a deployment
override that the model API hides from non-admin callers. The message
history already returns the same ID to these users.
2026-10-13 23:07:32 +08:00
lyingbug 9238220867
feat(chat): add global search to the @ mention menu and align its styling (#4249) 2026-10-13 21:35:43 +08:00
lyingbug 2511a1f932
fix(mcp): offer OAuth prompt after tool approval and tidy tools panel (#4248)
* fix(mcp): offer OAuth prompt after tool approval and tidy tools panel

* test(mcp): wrap long line for lll

* style(mcp): use font-size token in tools list header

* test(style): report guard hits by line, skip comments, tighten baselines

* style(chat): use font-size token for rewind icon and drop touch-only !important
2026-10-13 21:06:35 +08:00
lyingbug e51dee8297
feat(chat): polish rewind confirm and mark sessions with unread replies (#4247) 2026-10-13 20:42:32 +08:00
lyingbug 4356f8c16d
fix(skill): do not fail installs on non-blocking observations (#4246)
* fix(skill): do not fail installs on non-blocking observations

A working skill was rejected when the installer recorded a docs mismatch
as a blocker. Keep real setup failures in blockers and surface harmless
observations as notes.

* style(skill): wrap the install-report validation error

* feat(frontend): compact skill cards and install progress

Show each sandbox install on the card and collapse installer prompts, so
the skills page stays readable when a skill is installed in more than one place.

* fix(chat): include shared KBs in starter questions and stop composer jitter

Agents using all knowledge bases now draw starters from KBs shared into
the tenant, matching chat retrieval. The new-chat page skips refetches
whose scope did not change and only shows the skeleton on first load.
2026-10-13 19:47:14 +08:00
lyingbug 94fae6de43
feat(models): add WeMM embedding presets and Transformers serving (#4238) 2026-10-13 17:22:24 +08:00
Ochan Kwon 8af7938aed
fix(mcp): keep OAuth token expiry independent of the process time zone (#4207)
* fix(mcp): keep OAuth token expiry independent of the process time zone

mcp_oauth_tokens.expires_at is a naive TIMESTAMP column. The token store
computes the expiry from the process clock, the column drops its offset,
and the driver reads the stored wall clock back as UTC. When the
application runs outside UTC, every stored expiry is therefore shifted
by the process offset: with TZ=Asia/Shanghai, the docker compose default,
a token is reported as expiring eight hours after it really does.

WeKnora trusts that value. The OAuth status endpoint reports a token as
authorized for those extra hours, and the runtime neither refreshes it
ahead of time nor asks for authorization again. It sends the expired
access token to the MCP server and only recovers after the server
rejects it.

Promote the token and client timestamps to TIMESTAMP WITH TIME ZONE, as
migration 000072 did for API keys and resource grants, and normalize the
values the repository writes to UTC, so new rows are right even before
the migration is applied. The status endpoint keeps reporting the expiry
in UTC as before: the driver returns timestamptz values in the process
time zone, and the response would otherwise vary by deployment.

The migration cannot repair existing rows, because the time zone of the
process that wrote them is unknown. Like 000072, it reads them as UTC,
so they keep their shifted value until the token is authorized or
refreshed again.

* fix(migrations): renumber MCP OAuth timestamptz migration to 000118

000117 is now taken on main by messages_attachment_lookup.

---------

Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-10-13 16:56:51 +08:00
jack 621bc9b98a
fix(website-docs): prebundle fastdom when mermaid imports it (#4208)
mermaid >= 11.17 dynamically imports the UMD package fastdom. Vite's
dependency scanner misses that import during vitepress dev, so the
browser loads raw fastdom.js and throws "does not provide an export
named 'default'". Pre-bundle fastdom only when this install can resolve
it. The lockfile pins mermaid 11.16.0, which does not depend on
fastdom, and an unconditional optimizeDeps.include makes Vite report
"Failed to resolve dependency".

Fixes #2899

Co-authored-by: Frank-zhu2000 <332350688+Frank-zhu2000@users.noreply.github.com>
2026-10-13 16:47:39 +08:00
LuckVd 7972cdd251
fix(knowledge): make the knowledge base description token budget configurable (#4230)
The knowledge base description call hardcoded MaxTokens=800, sized for a
short JSON reply. Reasoning-style models can spend that budget on thinking
even when thinking is disabled, returning an empty completion that fails
generation with 'no gist' (issue #4221), and deployments had no way to
raise it.

Raise the default to 2048 and let operators override it with the
KNOWLEDGE_BASE_PROFILE_MAX_TOKENS environment variable (invalid or
non-positive values fall back to the default). Documented in .env.example.

Co-authored-by: LuckVd <LuckVd@users.noreply.github.com>
2026-10-13 16:43:34 +08:00
Jarvis a7a5f47625
fix(frontend): preserve nonempty lists when pressing Enter (#4224) 2026-10-13 16:40:24 +08:00
Jarvis ec382d7911
fix(frontend): preserve inline images in EPUB previews (#4226) 2026-10-13 16:39:37 +08:00
Ochan Kwon e0712df3e0
feat(mcp): let callers without a browser obtain MCP OAuth tokens (#4229)
WeKnora runs behind other applications: they sign their users in and
call WeKnora with a tenant API key and X-External-User-ID, and WeKnora
keeps sessions and MCP OAuth tokens per external user. When an agent
uses an OAuth-protected MCP service, the only way to get that user's
token is the browser authorization code flow, and in this deployment
the user never sees WeKnora, so there is no browser to complete it.
Independently, an OAuth MCP service can only get its client through
dynamic client registration (RFC 7591), so authorization servers
without a registration endpoint cannot be used at all ("server does not
support dynamic client registration"), and servers that allow a grant
only to clients an administrator registered refuse a dynamic one.

JWT bearer grant. The application in front already knows who the user
is. POST /api/v1/mcp-services/:id/oauth/assertion lets it present a
signed assertion of that identity, such as the Identity Assertion JWT
Authorization Grant (ID-JAG) used by MCP's Enterprise-Managed
Authorization extension. WeKnora sends it to the service's
authorization server with the JWT bearer grant (RFC 7523) and stores
the token exactly like the callback does, so status, revoke, runtime
connections and, when the response carries a refresh token, refresh
use it unchanged. The assertion is forwarded unread; validating it is
up to the authorization server. The request reuses the principal from
authorize-url, the SSRF-safe HTTP client and the callback's connection
recycling, and the client the service already has. It does not run
dynamic client registration, which describes a redirect-based client;
without a client it answers 400. The token request outlives the caller,
so a token issued for an assertion that can only be used once is not
lost. A 4xx response other than 408 and 429, or a 2xx response carrying
an OAuth error, answers 400 with the OAuth error code and is logged; a
5xx, 408 or 429 response or a network failure answers 500. Request
logging masks the assertion field.

Pre-registered client. auth_config.client_id names a client registered
with the authorization server in advance, and client_secret is its
secret for a confidential client. When client_id is set it takes the
place of dynamic registration everywhere a client is read: the
authorization URL, the code exchange, the assertion grant and runtime
connections with their token refreshes. The values live on the service
rather than in mcp_oauth_clients, because a refresh rejected with
invalid_client deletes that row so the next authorization registers
again; an administrator's client would silently disappear. client_id is
non-secret: it is set through the main PUT, where an empty value clears
it, and returned in auth_config. client_secret follows api_key and
token: encrypted at rest, never returned, accepted in the create body,
and changed afterwards through the credentials subresource. Changing
client_id rebuilds the service's connections, and a connection built
with a pre-registered client is not treated as holding a replaced
registration when an authorization recycles connections. The MCP
service dialog adds optional Client ID and Client Secret fields to the
OAuth section, in all six locales.

Nothing changes for existing services: with client_id empty every
existing path reads the stored registration and registers dynamically
as before, and the authorization code flow, its state, the callback and
the dynamic registration request are untouched. The authorization
server HTTP client is moved into a function that both paths call.
2026-10-13 16:37:24 +08:00
lyingbug 194bffbb0a
feat(agent): read chat attachments on demand (#4203)
* feat(agent): read chat attachments on demand

Agent turns pasted query-selected attachment excerpts into the prompt before the model could act. List stored files as a manifest so the agent can page and search them through read_attachment.

* fix(agent): preserve attachment access and image reads

* fix(agent): bound attachment cleanup and image processing

* Remove standalone read_attachment tool

* Read attachments and images through read_file

Merge read_attachment into read_file (attachment:// paths, numbered
document images, staged-copy aliasing, query search), return sandbox
images as images, describe images for non-vision models inside the
tool call with bounded concurrency and model-chosen detail/focus,
render image reads in the UI, and record image metadata in Langfuse.

* fix(agent): make attachment pagination complete and bound image reads

* refactor(agent): separate attachment reads and cache image observations

* fix(attachment): read image batches concurrently and harden description cache

- ReadImages authorizes once and describes images in parallel
- start VLM deadlines after a slot is held; longer timeout for full reads
- detach shared description calls from the first caller's context
- skip rewriting unchanged sandbox projections
- strip the description cache from temporary document API responses
- render upload text before calling the vision model

* fix(attachment): number images in document order and polish attachment UI

- return resolved images in document order instead of reverse
- show attachment file names instead of attachment:// IDs in tool titles
- use the shared file icon and a lighter card for chat attachments

* fix(ci): renumber attachment migrations and satisfy lint

Main already took sqlite 000035 and versioned 000116, so the attachment
lookup indexes move to the next free numbers. Also wrap the ReadImages
signature and drop an unused test parameter.

* fix(ci): expect sqlite migrations to reach version 36
2026-10-13 14:37:17 +08:00
Ochan Kwon 809bda7b2f
fix(agent): make agent tool selection match the tools the runtime registers (#4211)
The tools a smart-reasoning agent may use were defined in three places
that never checked each other: the agent editor's checkboxes, the stored
allowed_tools, and what registerTools registers. The editor drew from a
hard-coded list that had drifted (search_conversations, a default tool,
had no checkbox), hid stored entries outside that list, and could not
untick a tool whose knowledge base capability was missing. The save API
stored any name. And an empty list could not mean "no tools": three
places treated it as "use the default tools", so clearing every checkbox
gave an agent without a knowledge base search_conversations, while the
editor's preview said it had none.

One source for the tool list: GET /api/v1/agents/tools serves the tools
of AvailableToolDefinitions with their group, danger flag and knowledge
base requirement, the default tools, and the tools other agent settings
register whatever the list says. The editor renders from it, falling
back to the catalog's label for a tool it has no translation for.

Stored values stay visible: a missing capability only blocks ticking a
tool, and stored names the catalog does not offer are shown ticked in
their own section and can be removed.

An empty list now means no built-in tools; only a list that was never
set selects the defaults. tools.EffectiveAllowedTools makes that
decision for tool registration, the session config and the rerank
requirement. Migration 000116 (SQLite 000035) writes the default tools
into the empty list of every existing smart-reasoning agent, so they
keep the tools they ran with. The knowledge base filter follows the
stored list, so such an agent with an "all" scope now gets the same
scope as one that ticked the defaults: bases search_knowledge cannot use
leave it. The editor writes the defaults into an unset list it loads,
so saving does not silently turn the defaults into no tools.

Saving validates the list: retired names are rewritten, switch-managed
and retired skill tools are dropped, names the request adds that no
tool answers to are rejected with a 400 that lists them, and unknown
names already stored are kept so an existing agent can still be saved.
The response reports what was kept or dropped.
2026-10-13 11:29:24 +08:00
Jarvis 97796c637a
fix(helm): configure app rollouts and document shared storage (#4180) 2026-10-12 18:10:29 +08:00
Jarvis fd4cc45848
fix(frontend): respect Markdown indentation selection boundaries (#4195) 2026-10-12 18:08:10 +08:00
lyingbug 8fae51c640
style(frontend): polish knowledge base settings hints and sub-sections (#4193)
- Replace heavy warning alerts for locked states (embedding model, indexing
  strategy, storage engine) with subtle lock-icon hints
- Redesign the AI-generated description card with empty state and footer actions
- Replace the graph-database-disabled alert with an inline empty-state card
- Drop thick left-border panels in advanced and chunking settings in favor of
  rounded secondary containers; widen descriptions for switch rows
2026-10-12 18:04:35 +08:00
lyingbug ef54e835c9
docs(api): clarify knowledge-search scope union of knowledge_base_ids and knowledge_ids (#4191) 2026-10-12 17:40:56 +08:00
lyingbug 1c54beb551
refactor(gallery): turn source document filter into a toolbar popover (#4190)
Replace the modal dialog with a dropdown panel matching the filter and
sort popovers: ticks apply immediately, the list loads on scroll, and
the overflow guards (recent window, select-all cap, 1000-doc limit) are
kept. Also enlarge the source file icon on gallery cards.
2026-10-12 17:18:11 +08:00
tayadwx 98362dd296
feat(gallery): filter images by source document (#4159)
* feat(gallery): filter images by source document

Add a gallery toolbar button that opens a paginated, keyword-searchable
document picker; confirming restricts the listing to images owned by
the selected documents. The backend gallery endpoint accepts a
knowledge_ids query param (capped at 50) narrowing chunk_images by the
owning document before de-duplication, so the count query stays index
served.

* feat(gallery): lift knowledge_ids cap via POST body, sortable doc picker

Add POST /knowledge-bases/:id/images accepting the gallery filter as a
JSON body so knowledge_ids escapes the URL-length cap (50 -> 1000, an
abuse guard rather than a transport limit); the GET variant keeps its
cap and both share the contract-constrain logic. The source picker
gains sortable column headers (file name / upload time, newest first
by default), a header select-all that unions and removes whole hit
lists across keyword searches, overflow guards capping the no-keyword
view at the 500 most recent documents, and a wider dialog.

* style(gallery): replace td-token fallbacks and font-size literals with design tokens

styleGuard.test.mjs enforces ratchets: --td-* vars must not carry
fallbacks (theme.css guarantees them) and font sizes must use
--app-text-* tokens. GallerySourcePicker.vue added 4 of each,
pushing the ratchets over baseline.

* fix(gallery): keep shared images in source filter and align picker UI

- Scope the de-duplication probe to the selected documents, so an image
  whose newer copy lives in an unselected document is no longer hidden.
- Reset the source filter when the gallery switches knowledge bases.
- Accept an empty POST /images body; drop pruned attribute maps to nil.
- Keep the source filter out of the filter panel's count and clear action;
  the empty state's clear still resets it.
- Rework the picker dialog to the BatchTagDialog shell: heading with
  subtitle, footer with selection count, clickable rows, debounced search,
  select-all toggling against every hit, stale select-all responses dropped.
- Remove the unreachable GET knowledge_ids branch in the API client.

---------

Co-authored-by: tayadwx <tayadwx@users.noreply.github.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-10-12 15:43:28 +08:00
lyingbug 089711f92c
fix(mcp): ignore discover probe in resource list tests (#4179)
mcp-go sends server/discover before the legacy handshake, and the
pagination tests were counting that probe as a resources/list page.
2026-10-12 14:53:16 +08:00
Jarvis c2edec192b
docs: explain knowledge upload folder paths (#4177) 2026-10-12 14:30:07 +08:00
lyingbug ecdcd14e1d
docs: refresh LICENSE third-party notices (#4178)
Replace the bundled third-party license dump with the current WeKnora attribution for opencc, anydoc, and wails.
2026-10-12 14:29:53 +08:00
澍 6a7094ceac
fix(mcp): bound resource listing pagination (#4007)
Fixes Tencent/WeKnora#4005
2026-10-12 13:33:21 +08:00
澍 7982c6a3bd
fix(agent): accept adjacent prefixed Python string literals (#4006)
Fixes Tencent/WeKnora#4004
2026-10-12 13:30:30 +08:00
Mohamed Arbi 9b031a6576
fix: accept qdrant collection created concurrently (#3999) 2026-10-12 13:24:36 +08:00
ordinary being 7925f774d1
fix(datasource/gitlab): emptied files no longer leave their old body searchable (#4008)
A blob that a commit emptied is still a blob, and ingestion reads an item with
neither content nor URL as nothing to sync: applyFetchedItem counts it as
skipped and the sync reports success. The body indexed from an earlier commit
stays fully searchable, and no later sync revisits it — a full sync still sees
the path in the tree, and an incremental sync only walks the diffs of commits
newer than the recorded head, which the emptying commit already moved past.

Emit the file's path as the content in that case so ingestion replaces the stale
body, matching what the Notion (b9be7d0d), Confluence and IMA (b71b31c8)
connectors already do. The check is on length alone: a blob holding only
whitespace still carries content the repository has.
2026-10-12 13:06:19 +08:00
Jarvis 24b5ca3f23
docs: clarify frontend development proxy configuration (#4171) 2026-10-12 13:03:01 +08:00
Lyang77 fe444c851e
fix(feishu): add shared request pacing and improve HTTP 429 / error 99991400 retries in Feishu Wiki synchronization (#4039)
* fix(feishu): 修复同步请求限流与共享重试等待

* fix(feishu): 完善知识库限流冷却和导出轮询

Bound export polling by poll count so shared pacing and cooldowns retain the
same export ticket without causing false 60-second timeouts. Preserve the
feishu_timeout failure classification when the poll budget is exhausted.

Cap cooldowns, isolate reactive waits by API path, and use a configurable
10-second default when no valid retry hint is available. Refresh expired
tokens before rejoining the request gate to preserve pacing and new cooldowns.

Skip JSON decoding when the legacy rate-limit code is absent, derive the
prefilter from the shared protocol constant, and update configuration docs.
Isolate shared gates in tests and cover cooldowns, cancellation, API grouping,
concurrent token refresh, and timeout classification.

Validation: Feishu core tests pass; diff-scoped Feishu lint reports 0 issues;
gofmt and git diff --check pass. No live Feishu sync was run for this commit.

* fix(feishu): grant request gate slots in arrival order and improve rate-limit logs

- Reserve the next slot before sleeping so concurrent callers are paced in
  FIFO order instead of racing after a shared wake-up.
- Restore the error log for non-rate-limited HTTP 400 download failures.
- Include the API gate name in rate-limit warnings.

---------

Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-10-12 13:00:33 +08:00
kwsYeager e5f9f9deab feat(rerank): add Cohere provider for the v2 rerank API 2026-10-12 11:57:53 +08:00
Perfecto c6bfe81894
feat(helm): allow Service name overrides with matching consumer references (#4109)
* feat(helm): support compatible service name overrides

* refactor(helm): keep verification within existing chart workflow

* docs(helm): focus service naming guidance on configuration and upgrades
2026-10-12 11:53:32 +08:00
LuckVd 3c36cb19a2
fix(deploy): bump paradedb image to v0.25.11-pg17 (#4120)
* fix(deploy): bump paradedb image to v0.25.11-pg17

Batch-importing large knowledge bases on the pinned
paradedb/paradedb:v0.22.6-pg17 image drives PostgreSQL into a
PANIC/crash-recovery loop (corrupted page pointers in shared buffers,
amcheck clean, no OOM), taking every ingest task down with it.

Three independent fixes upstream cover this exact write path, and the
pinned image predates all of them:

- pgvector 0.8.2 fixed a buffer overflow in parallel HNSW index
  builds, 0.8.3 fixed possible index corruption during HNSW vacuuming,
  and 0.8.4 fixed inserts during HNSW vacuuming; the image ships
  pgvector 0.8.1, and the embeddings table maintains three HNSW
  halfvec indexes on import.
- pg_search gained WAL-based crash recovery in 0.24.0 (paradedb#4901):
  without it, any backend crash corrupts BM25 segment metadata and
  turns a single crash into a recovery loop (paradedb#4935).
- PostgreSQL core moved 17.9 -> 17.11; its release notes contain no
  fix matching this failure signature, ruling the core out.

Bump the compose image tags to v0.25.11-pg17 (postgres and
langfuse-db-init, prod and dev) and update the docs that pin the old
tag. Fresh installs are covered by the existing schema SQL (verified
against 0.25.11: extensions, BM25 index and HNSW halfvec indexes all
create cleanly). Existing data volumes keep working across the image
swap without any action (keyword and vector queries byte-identical in
testing); ALTER EXTENSION pg_search/vector UPDATE aligns the SQL
catalog afterwards, and migration 000099 is a no-op for 0.25.x by
design. The Helm chart pins a different image line and is left alone.

Fixes #4077

* fix(migrations): upgrade pg_search catalog to 0.25.11 with the image

Swapping in the v0.25.11 image leaves the extension catalog at 0.22.x.
Calling extension functions such as paradedb.version_info() against the
mismatched catalog segfaults the backend and sends the whole server into
crash recovery, so the catalog upgrade is required rather than optional.

- Add migration 000115 to update pg_search 0.22.0-0.25.10 to 0.25.11 and
  pgvector 0.8.0-0.8.3 to 0.8.4 when the server ships those versions.
- Skip 000099 on newer images instead of advising UPDATE TO '0.22.6',
  which leaves the catalog behind the shared library and crashes.
- Rewrite the upgrade guide as one 0.22.x -> 0.25.11 path with a required
  ALTER EXTENSION UPDATE and a note that rollback needs a backup.
- Extend scripts/test_paradedb_upgrade.py to verify 0.22.2 -> 0.25.11 by
  default (--to 0.22.6 keeps the old path) and run CONCURRENTLY
  migrations outside a transaction like golang-migrate does.

---------

Co-authored-by: LuckVd <LuckVd@users.noreply.github.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-10-12 11:50:11 +08:00
AndyZhang 21ef506fc9
fix(agent): scope database queries to authorized shared knowledge bases (#4136)
Resolve database query tenant scopes for authorized shared knowledge bases and add regression coverage for cross-tenant access.

Fixes Tencent/WeKnora#4084
2026-10-12 11:26:34 +08:00
Ochan Kwon be581c41e0
fix(mcp): close only the authorizing user's connection after OAuth (#4138)
An OAuth MCP service keeps one cached connection per user. After a
successful OAuth callback, after a token is revoked, and when an agent
resumes from an in-conversation authorization, the service's connections
were recycled with CloseClient, which disconnects every user's
connection and cancels connection attempts still in flight. Closing a
Streamable HTTP connection cancels the requests it has in flight, so one
user authorizing again cancelled other users' running tool calls on the
same server process. The agent retries a failed call once on a fresh
connection, but a long call fails, and a non-idempotent tool can run
twice.

A connection is not affected when another user's token changes: each
one reads its own user's token from the store on every request. Add
MCPManager.CloseClientForPrincipal, which closes only that user's
connection, and use it when a token is revoked.

After an authorization, the callback and the in-conversation retry call
CloseClientsAfterAuthorization instead. It closes the authorizing user's
connection, since the new authorization may be for another account of
the upstream service, and every connection of the service in the tenant
that was built with an OAuth client ID other than the registration
stored now. The registration is shared by all users of the service and
can be replaced by any replica. A connection still holding the old
client ID can fail its next refresh with invalid_client, and handling
that failure deletes the stored registration, by then the replacement.
If the registration cannot be read, the whole service is closed as
before, unless the caller's context has ended, in which case only the
authorizing user's connection is closed. The callback bounds this
cleanup with its own timeout.

This runs in the process that handles the callback and, for an
in-conversation authorization, in the process where the agent waits.
Connections cached by other replicas are not examined, as before, and
neither are other users' connection attempts still in flight.

CompleteAuthorization now returns the tenant, service and principal of
the attempt, and connections report the client ID they were built with.
Disconnecting happens after the manager lock is released, because
closing a transport can wait on the server.
2026-10-12 11:19:42 +08:00
VictorMaznyuk d272a83cfc
fix(deploy): pass WEKNORA_OUTBOUND_DIAL_TIMEOUT through to the app container (#4157)
#4122 made the outbound (SSRF-safe) dial timeout configurable through
WEKNORA_OUTBOUND_DIAL_TIMEOUT (internal/config/config.go,
applyNetworkEnvOverrides), but the variable is not listed in
services.app.environment, so in a Docker Compose deployment there is no way
to set it: a value in the host .env never reaches the container, and slow
serverless endpoints keep failing at the 5s default.

Pass it through with an empty default. applyNetworkEnvOverrides only
overrides the timeout when the trimmed value is non-empty and parses as a
positive duration, so an unset variable keeps the 5s default unchanged.
Also document it in .env.example next to the other outbound settings.

Co-authored-by: Victor Maznyuk <victor@maznyuk.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 11:01:06 +08:00
alexcastgonz 9efe94cc6f
feat(models): add Claude Opus 5.5, Sonnet 5.5 and Haiku 5.5 to the catalog (#4158)
These three models were missing from the catalog, so they resolved to the
anthropic defaults: budget thinking (they reject budget_tokens) and
temperature/top_p (they reject non-default sampling values).

seed.json pins their metadata from the models overview and pricing pages:
1M context, 128K output, and base, 5m cache write, cache hit and output
prices. Haiku 5.5 is priced by prompt length, and the catalog has one price
per model, so it carries the prompts-up-to-100k tier. overrides.json gives
all three adaptive thinking with effort (all five levels), with temperature
and top_p off.

Thinking off differs per model. Opus 5.5 can't turn thinking off, so off is
unsupported, like Fable 5.1. Haiku 5.5 accepts "disabled". Sonnet 5.5
rejects "disabled" and turns off up-front thinking with "between_tools". The
new thinking_off_type compat field carries that value. Empty keeps
"disabled", and it is omitempty so the parity hashes of other entries don't
change.


Claude-Session: https://claude.ai/code/session_01BeNHkjF4spsH9d18UiYPiU

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 10:59:51 +08:00
lyingbug 00474f734d
fix: align settings layouts and tolerate existing migration objects (#4164)
* fix(frontend): unify settings layouts and compact integration guides

* fix(migrations): tolerate existing browser memory and catalog objects
2026-10-11 22:48:57 +08:00
alexcastgonz 5343ac47b7
fix(models): stop sending temperature to Claude models that reject it (#4155)
Disable temperature and top_p for Claude models that reject non-default sampling values. Regenerate the model catalog and parity baseline, add request-body regression coverage, and clarify the documented sampling restrictions.
2026-10-11 22:44:56 +08:00
JLi 643f64180e
feat(system): add platform user management and streamline settings (#4153)
* feat(system): platform user management — list, enable/disable, reset password, role toggle

Adds a SystemAdmin-only user management panel under platform settings
(System global -> Access). The backend already had repository primitives
and promote/revoke endpoints; this wires the missing service/handler/route
for listing and account-status changes and adds the UI.

Backend
- New GET /system/admin/users: paginated, cross-tenant user list
  (offset/limit, limit capped at 200), serialised via ToUserInfo so password
  hashes are never exposed; has_more derived with a limit+1 fetch (no COUNT).
- New POST /system/admin/users/status: enable/disable an account.
  Disabling revokes all of the user's tokens immediately. Service guards
  reject self-disable and disabling the last active system administrator.
- ValidateToken now re-checks is_active on every request, so a disabled
  account cannot keep using a previously issued access token.

Frontend
- UserListDialog: table with status/role tags, pagination, in-page
  username/email filter, enable/disable and reset-password actions, and
  one-click system-admin promote/revoke (reuses existing endpoints) with
  confirmation prompts. Reset-password dialog is a sibling (not nested)
  dialog so close/cancel/overlay all work.
- All new strings are i18n keys under system.globalSettings.userList in
  all six locales (en-US, zh-CN, zh-TW, ja-JP, ko-KR, ru-RU).

Tests: handler unit tests for list pagination/redaction/limit-cap and for
status-change success/guard/404 paths; existing handler/service/router
suites pass.

Co-authored-by: MOSS Agent <noreply@example.com>

* fix(system): make account status changes atomic and validate requests

* refactor(system): streamline settings and add dedicated user management tab

* fix(system): resolve user management CI lint findings

* fix(system): preserve account status during ordinary user updates

---------

Co-authored-by: desksk <26273255+desksk@users.noreply.github.com>
Co-authored-by: MOSS Agent <noreply@example.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-10-11 17:07:00 +08:00