WeKnora/internal/container
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
..
audit_sink.go feat(retriever): activate OpenSearch k-NN driver (PR 3 of 3) 2026-05-29 16:32:27 +08:00
audit_sink_test.go feat(retriever): activate OpenSearch k-NN driver (PR 3 of 3) 2026-05-29 16:32:27 +08:00
cleanup.go fix(server): run ResourceCleaner on signal shutdown instead of racing Fatalf exit (#3804) 2026-09-28 23:37:36 +08:00
cleanup_test.go fix(server): run ResourceCleaner on signal shutdown instead of racing Fatalf exit (#3804) 2026-09-28 23:37:36 +08:00
container.go feat(agent): add the built-in WeKnora assistant with an operation catalog (#4302) 2026-10-15 12:18:30 +08:00
datasource_registry_test.go feat(datasource): add Seafile data source connector (#3616) 2026-10-08 16:18:09 +08:00
engine_factory.go fix(security): harden outbound URL SSRF protection (#2626) 2026-08-10 13:24:14 +08:00
engine_factory_opensearch_test.go fix(retriever): rebuild a missing vector store engine on demand 2026-07-29 12:25:18 +08:00
engine_factory_test.go fix(security): harden outbound URL SSRF protection (#2626) 2026-08-10 13:24:14 +08:00
host_project_lookup.go fix(container): propagate host project lookup errors (#3611) 2026-09-25 18:51:54 +08:00
host_project_lookup_test.go fix(container): propagate host project lookup errors (#3611) 2026-09-25 18:51:54 +08:00
nolocalsandbox_test.go feat(sandbox): run unpinned Lite sessions on the host OS sandbox (#3549) 2026-09-22 19:35:03 +08:00
recover_pending_wiki_tasks.go fix(tenant): stop wiki tasks of soft-deleted tenants from issuing model requests (#3602) 2026-09-23 12:13:32 +08:00
reset_pending_tasks.go fix(knowledge): recover tasks safely after server restart 2026-07-14 17:55:26 +08:00
reset_pending_tasks_test.go fix(tenant): stop wiki tasks of soft-deleted tenants from issuing model requests (#3602) 2026-09-23 12:13:32 +08:00
retrieve_registry_wiring_test.go fix(retriever): rebuild a missing vector store engine on demand 2026-07-29 12:25:18 +08:00
router_wiring_test.go fix(container): wire shared agent lookup for MCP handler 2026-09-21 14:38:54 +08:00
sandbox.go feat(session): fork conversations from a historical user message (#3304) 2026-09-17 14:20:18 +08:00
sandbox_host.go feat(lite): install and run skills on the host (#3661) 2026-09-24 21:30:34 +08:00
sandbox_host_shared.go feat(sandbox): run unpinned Lite sessions on the host OS sandbox (#3549) 2026-09-22 19:35:03 +08:00
sandbox_host_stub.go feat(sandbox): run unpinned Lite sessions on the host OS sandbox (#3549) 2026-09-22 19:35:03 +08:00
sandbox_host_test.go feat(lite): install and run skills on the host (#3661) 2026-09-24 21:30:34 +08:00
sandbox_test.go feat(sandbox): 沙箱后端改为按空间配置,并补齐 E2B 模板与检测诊断 2026-08-11 15:42:02 +08:00
ssrf_test.go fix(security): harden outbound URL SSRF protection (#2626) 2026-08-10 13:24:14 +08:00
storagebackend_migration_test.go feat(knowledge): derive knowledge base descriptions from document profiles (#3370) 2026-09-17 22:21:55 +08:00
vector_store_whitelist_only_test.go feat(security): add a whitelist-only outbound mode that refuses before DNS (#3393) 2026-09-23 12:02:06 +08:00