WeKnora/internal/handler/session
lyingbug 4d4acec418
feat(assistant): manage agents and skills, separate history, refresh pages (#4344)
* feat(assistant): let the assistant manage agents

Expose custom agents to the operation catalog (list, get, create, copy,
update, delete) plus read-only model and MCP service lookups, so the
assistant can set up agents end to end.

- Add PATCH /api/v1/agents/:id. PUT replaces the whole config, so a
  one-field change from the assistant would wipe the rest; PATCH only
  overlays the fields it carries and reuses the PUT validation path.
- Add x-agent-detail so long fields such as the system prompt are only
  projected for single-object reads, not lists.
- Add label_param so a create without a target is labelled by its name.
- The approval card lists agent setting changes and resolves model,
  knowledge base and MCP IDs to names.
- Deny sharing, publishing channels, credentials and OAuth routes; model
  and MCP endpoints, headers and secrets are never projected.
- Update the assistant prompt, starters, API docs and Go SDK.

* feat(assistant): list skills and configure agent skill scope

- Expose usable skill names for an agent sandbox without exposing skill
  administration or connection settings to the model.
- Validate PATCH selections against the workspace sandbox usable set so
  invented names and missing sandbox selections cannot be saved.
- Show skill changes in approvals and align the assistant prompt, API
  documentation, and Go SDK with focused refusal and projection tests.

* feat(assistant): isolate conversation history

- Keep assistant conversations out of ordinary session lists, search, artifacts and delete-all cleanup.
- Add private, paginated assistant history with session switching, confirmed deletion and stale-session recovery.
- Backfill session kinds safely on Postgres and SQLite, preserve kinds on forks, and align API docs and SDK coverage.

* feat(assistant): refresh pages after successful data changes

- Carry decoded mutation targets through live tool-result events without
  exposing refresh metadata to the model or persisted chat history.
- Coalesce page and selector refreshes, update document drawers, and warn
  about changed agents while preserving open editor drafts.
- Cover mutation, approval, stream, lifecycle and cache behavior with Go
  and Node tests using the existing frontend runner and component fixtures.

* feat(assistant): add agent page context and resource scope limits

- Attach verified agent context and persist personal scope across turns and approvals.
- Enforce resource boundaries before operation and Wiki approvals, including edited arguments.
- Add scope controls, translations, API and SDK support, and regression coverage.

* refactor(assistant): remove the scope limit

The scope picker confused users and duplicated what RBAC and the access
level already enforce. Keep the agent page context: the agent editor
still publishes agent_id and the backend still verifies it.

* feat(assistant): render operation and product-doc results

Show find/run operations and WeKnora docs as structured cards instead of raw JSON.

* feat(assistant): default new agents to smart-reasoning

Quick-answer cannot call MCP, and agent.update could not change the mode. New agents now start in smart-reasoning, and a patch can switch agent_mode.

* fix: resolve assistant management CI failures
2026-10-15 21:43:20 +08:00
..
agent_stream_handler.go feat(agent): persist human-in-the-loop prompts with a shared broker (#4250) 2026-10-14 20:37:28 +08:00
agent_stream_handler_test.go feat(assistant): manage agents and skills, separate history, refresh pages (#4344) 2026-10-15 21:43:20 +08:00
artifact_completion_test.go fix(chat): restore shared workspace images after stream completion (#3523) 2026-09-22 00:16:58 +08:00
artifact_delete.go feat(artifacts): let users delete generated files (#3447) 2026-09-20 13:01:46 +08:00
artifact_delete_test.go feat(artifacts): let users delete generated files (#3447) 2026-09-20 13:01:46 +08:00
artifact_download.go feat(artifacts): let users delete generated files (#3447) 2026-09-20 13:01:46 +08:00
artifact_download_test.go refactor(resource-access): unify scoped authorization and transfer recovery (#3097) 2026-09-08 15:36:33 +08:00
artifact_library.go feat(artifacts): artifacts library page backed by a message_artifacts table (#3384) 2026-09-18 12:10:19 +08:00
artifact_reference.go feat(session): fork conversations from a historical user message (#3304) 2026-09-17 14:20:18 +08:00
artifact_reference_test.go feat(session): fork conversations from a historical user message (#3304) 2026-09-17 14:20:18 +08:00
artifact_storage.go feat(artifacts): let users delete generated files (#3447) 2026-09-20 13:01:46 +08:00
attachment_processor.go feat(docparser): 引入 anydoc 引擎,在 Go 进程内解析 office 文档 2026-08-16 11:37:27 +08:00
browserskill.go fix(desktop): pair the Lite browser against the local API listener (#3677) 2026-09-24 20:43:25 +08:00
browserskill_test.go fix(desktop): pair the Lite browser against the local API listener (#3677) 2026-09-24 20:43:25 +08:00
chat_history_tenant_test.go fix(security): close cross-workspace access paths in shared spaces (#3408) 2026-09-18 22:00:02 +08:00
command_output_test.go feat(session): fork conversations from a historical user message (#3304) 2026-09-17 14:20:18 +08:00
complete_model_test.go feat(agent): name the turn's chat model on the completion event (#4252) 2026-10-13 23:07:32 +08:00
continue_stream_coalesce.go perf(chat): replay a stored stream a segment at a time 2026-09-19 21:43:57 +08:00
continue_stream_coalesce_test.go perf(chat): replay a stored stream a segment at a time 2026-09-19 21:43:57 +08:00
continue_stream_resource_urls_test.go feat(agent): persist human-in-the-loop prompts with a shared broker (#4250) 2026-10-14 20:37:28 +08:00
create_session_host_test.go feat(sandbox): run unpinned Lite sessions on the host OS sandbox (#3549) 2026-09-22 19:35:03 +08:00
fork.go feat(session): fork conversations from a historical user message (#3304) 2026-09-17 14:20:18 +08:00
fork_test.go feat(session): fork conversations from a historical user message (#3304) 2026-09-17 14:20:18 +08:00
handler.go feat(assistant): manage agents and skills, separate history, refresh pages (#4344) 2026-10-15 21:43:20 +08:00
helpers.go fix(chat): keep custom metadata on knowledge-chat references (#4087) 2026-10-10 14:20:38 +08:00
helpers_test.go fix(chat): keep custom metadata on knowledge-chat references (#4087) 2026-10-10 14:20:38 +08:00
image_completion_test.go fix(chat): restore shared workspace images after stream completion (#3523) 2026-09-22 00:16:58 +08:00
image_upload.go feat(storage): add multi-instance storage backends per workspace 2026-07-15 14:54:39 +08:00
kind_test.go feat(assistant): manage agents and skills, separate history, refresh pages (#4344) 2026-10-15 21:43:20 +08:00
knowledge_search_options_test.go fix(retrieval): fix recall correctness, score scales, cost and agent tools (#3687) 2026-09-25 10:48:18 +08:00
project_dir.go feat(sandbox): run unpinned Lite sessions on the host OS sandbox (#3549) 2026-09-22 19:35:03 +08:00
project_dir_test.go feat(sandbox): run unpinned Lite sessions on the host OS sandbox (#3549) 2026-09-22 19:35:03 +08:00
qa.go feat(assistant): side panel, access levels and role-aware operations (#4342) 2026-10-15 18:18:22 +08:00
qa_attachment_test.go feat(sandbox) (#2301) 2026-08-10 21:28:20 +08:00
qa_query_validation_test.go fix(embed): 内嵌网页只传图片不输入文字时不再返回 400 2026-09-30 15:26:51 +08:00
qa_reasoning_effort_test.go feat(chat): add session reasoning controls and polish model configuration 2026-09-23 17:12:19 +08:00
quick_answer_timeline.go fix(chat): surface truncated quick answers 2026-09-22 19:44:38 +08:00
quick_answer_timeline_test.go fix(chat): report truncated model fallback answers 2026-09-23 11:57:21 +08:00
resolve_agent_test.go fix(sandbox): resolve a session's pinned sandbox in the workspace that owns it (#3471) 2026-09-21 15:38:39 +08:00
resource_urls.go fix(api): close the resource_urls=public gaps found in review 2026-08-05 14:42:51 +08:00
resource_urls_test.go fix(api): close the resource_urls=public gaps found in review 2026-08-05 14:42:51 +08:00
resume.go feat(assistant): side panel, access levels and role-aware operations (#4342) 2026-10-15 18:18:22 +08:00
resume_context_test.go feat(agent): add the built-in WeKnora assistant with an operation catalog (#4302) 2026-10-15 12:18:30 +08:00
resume_settle_test.go feat(agent): persist human-in-the-loop prompts with a shared broker (#4250) 2026-10-14 20:37:28 +08:00
rewind.go feat(session): in-place rewind with workspace checkpoint reset (#3469) 2026-09-20 21:01:00 +08:00
rewind_test.go feat(session): in-place rewind with workspace checkpoint reset (#3469) 2026-09-20 21:01:00 +08:00
sandbox_desktop_rfb.go feat(sandbox): add a graphical desktop to session sandboxes (#3245) 2026-09-14 20:37:37 +08:00
sandbox_desktop_rfb_test.go feat(sandbox): add a graphical desktop to session sandboxes (#3245) 2026-09-14 20:37:37 +08:00
sandbox_desktop_ws.go fix(sandbox): pass desktop slot timing to the renew goroutine 2026-09-28 22:01:39 +08:00
sandbox_desktop_ws_test.go fix(sandbox): resolve a session's pinned sandbox in the workspace that owns it (#3471) 2026-09-21 15:38:39 +08:00
sandbox_terminal_bridge.go feat(sandbox): Docker 后端支持交互式终端 (#4023) 2026-10-10 21:38:03 +08:00
sandbox_terminal_bridge_test.go feat(sandbox): Docker 后端支持交互式终端 (#4023) 2026-10-10 21:38:03 +08:00
sandbox_terminal_idle_test.go feat(sandbox): Docker 后端支持交互式终端 (#4023) 2026-10-10 21:38:03 +08:00
sandbox_terminal_ws.go feat(sandbox): Docker 后端支持交互式终端 (#4023) 2026-10-10 21:38:03 +08:00
search_knowledge_resource_urls_test.go feat(retrieval): unify rerank across search APIs and expose diagnostics (#3675) 2026-09-24 20:41:49 +08:00
steer.go feat(agent): persist human-in-the-loop prompts with a shared broker (#4250) 2026-10-14 20:37:28 +08:00
steer_delivery_test.go fix(agent): preserve steering order across persistence failures (#4078) 2026-10-10 20:32:20 +08:00
steer_live_run_test.go feat(agent): persist human-in-the-loop prompts with a shared broker (#4250) 2026-10-14 20:37:28 +08:00
steer_order_integration_test.go fix(agent): preserve steering order across persistence failures (#4078) 2026-10-10 20:32:20 +08:00
steer_wiring_test.go feat(chat): append messages to a running agent turn (#3123) 2026-09-09 16:43:33 +08:00
stream.go docs(swagger): document the real request and response types (#4304) 2026-10-15 01:41:42 +08:00
stream_usage_test.go feat(agent): report and attribute per-turn LLM token usage 2026-08-24 10:36:19 +08:00
suspended_completion_test.go feat(agent): persist human-in-the-loop prompts with a shared broker (#4250) 2026-10-14 20:37:28 +08:00
temporary_attachment_persist_test.go feat(attachments): implement normalization and limits for temporary attachment IDs 2026-07-16 17:41:27 +08:00
temporary_document.go feat(agent): read chat attachments on demand (#4203) 2026-10-13 14:37:17 +08:00
temporary_document_engine_test.go fix(security): close the low-severity shared-space findings (#3416) 2026-09-18 22:58:46 +08:00
title.go feat(session): implement strict owner scope for API-key sessions 2026-07-20 19:31:02 +08:00
types.go feat(assistant): manage agents and skills, separate history, refresh pages (#4344) 2026-10-15 21:43:20 +08:00
wiki_fixer_scope.go feat(agent): add the built-in WeKnora assistant with an operation catalog (#4302) 2026-10-15 12:18:30 +08:00
wiki_fixer_scope_test.go feat(agent): add the built-in WeKnora assistant with an operation catalog (#4302) 2026-10-15 12:18:30 +08:00
workspace_checkpoint_completion_test.go feat(sandbox): run unpinned Lite sessions on the host OS sandbox (#3549) 2026-09-22 19:35:03 +08:00