WeKnora/cli/internal/cmdutil
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
..
agentconfig.go feat(assistant): manage agents and skills, separate history, refresh pages (#4344) 2026-10-15 21:43:20 +08:00
agentconfig_test.go chore(cli): polish + docs sync + pre-PR audit fixes 2026-05-16 16:56:33 +08:00
agenthelp.go feat(cli): agent-first WeKnora CLI 2026-07-06 22:53:01 +08:00
agenthelp_test.go feat(cli): --format json default + NDJSON event stream + context→profile cascade + help calibration + docs (BREAKING) 2026-05-27 10:56:34 +08:00
authrefresh.go refactor(cli): finish context→profile cascade + post-review hardening (BREAKING) 2026-05-27 10:56:34 +08:00
authrefresh_http_classification_test.go fix(cli): classify wrapped SDK HTTP errors correctly (#3992) 2026-10-08 01:28:31 +08:00
authretry.go refactor(cli): finish context→profile cascade + post-review hardening (BREAKING) 2026-05-27 10:56:34 +08:00
authretry_test.go refactor(cli): drop aiclient package; align AGENTS.md with mainstream 2026-05-15 12:03:56 +08:00
batch.go feat(cli)!: v0.10 reliability, agent-UX, and command-surface hardening 2026-07-06 22:53:01 +08:00
batch_test.go feat(cli)!: v0.10 reliability, agent-UX, and command-surface hardening 2026-07-06 22:53:01 +08:00
charcheck.go feat(cli): agent-first WeKnora CLI 2026-07-06 22:53:01 +08:00
charcheck_test.go feat(cli): agent-first WeKnora CLI 2026-07-06 22:53:01 +08:00
confirm.go fix(cli): preserve agent update flags in retry_argv 2026-08-10 19:33:39 +08:00
confirm_test.go fix(cli): preserve agent update flags in retry_argv 2026-08-10 19:33:39 +08:00
dryrun.go feat(cli): agent-first WeKnora CLI 2026-07-06 22:53:01 +08:00
dryrun_test.go feat(cli): agent-first WeKnora CLI 2026-07-06 22:53:01 +08:00
errors.go fix(cli): classify wrapped SDK HTTP errors correctly (#3992) 2026-10-08 01:28:31 +08:00
errors_codes_test.go refactor(cli): drop aiclient package; align AGENTS.md with mainstream 2026-05-15 12:03:56 +08:00
errors_doc_test.go fix(cli): wrap overlong t.Errorf so golangci-lint lll passes 2026-08-20 18:16:21 +08:00
errors_retry_test.go feat(cli)!: v0.10 reliability, agent-UX, and command-surface hardening 2026-07-06 22:53:01 +08:00
errors_test.go fix(cli): align stream error handling after output-mode merge 2026-07-03 00:30:34 +08:00
exit.go docs(cli): sweep stale wire vocab from AGENTS.md and close the CI gap that let it drift 2026-08-20 18:16:21 +08:00
exit_test.go feat(cli): agent-first WeKnora CLI 2026-07-06 22:53:01 +08:00
factory.go feat(cli)!: v0.10 reliability, agent-UX, and command-surface hardening 2026-07-06 22:53:01 +08:00
factory_test.go feat(cli)!: v0.10 reliability, agent-UX, and command-surface hardening 2026-07-06 22:53:01 +08:00
format.go feat(cli)!: v0.10 reliability, agent-UX, and command-surface hardening 2026-07-06 22:53:01 +08:00
format_envelope_test.go feat(cli): agent-first WeKnora CLI 2026-07-06 22:53:01 +08:00
format_test.go feat(cli)!: v0.10 reliability, agent-UX, and command-surface hardening 2026-07-06 22:53:01 +08:00
host.go refactor(cli): drop aiclient package; align AGENTS.md with mainstream 2026-05-15 12:03:56 +08:00
input.go feat(cli): agent-first WeKnora CLI 2026-07-06 22:53:01 +08:00
input_test.go feat(cli): agent-first WeKnora CLI 2026-07-06 22:53:01 +08:00
kb.go refactor(cli): drop aiclient package; align AGENTS.md with mainstream 2026-05-15 12:03:56 +08:00
loglevel.go refactor(cli): envelope sweep — Emit shape, batch ops, MCP StructuredContent, api flag cleanup 2026-05-27 10:56:34 +08:00
loglevel_test.go feat(cli): --log-level + kb/agent status & check + cross-cutting refactor 2026-05-18 11:10:19 +08:00
model.go feat(cli): agent-first WeKnora CLI 2026-07-06 22:53:01 +08:00
model_test.go feat(cli): agent-first WeKnora CLI 2026-07-06 22:53:01 +08:00
multipart_replay_test.go fix(client): make multipart uploads replayable (#3989) 2026-10-08 01:28:12 +08:00
profilename.go feat(cli): agent-first WeKnora CLI 2026-07-06 22:53:01 +08:00
profilename_test.go feat(cli)!: v0.10 reliability, agent-UX, and command-surface hardening 2026-07-06 22:53:01 +08:00
risk.go feat(cli)!: v0.10 reliability, agent-UX, and command-surface hardening 2026-07-06 22:53:01 +08:00
risk_help_test.go feat(cli): --dry-run + risk metadata + validation parity on 19 mutations 2026-05-28 19:29:50 +08:00
risk_test.go feat(cli): --dry-run + risk metadata + validation parity on 19 mutations 2026-05-28 19:29:50 +08:00
suggest.go feat(cli): agent-first WeKnora CLI 2026-07-06 22:53:01 +08:00
suggest_test.go feat(cli): agent-first WeKnora CLI 2026-07-06 22:53:01 +08:00