Commit Graph
71 Commits
Author SHA1 Message Date
Soulter 35c46433f4 refactor: remove unused subagent API and SDK surface 2026-11-08 22:03:14 +08:00
Soulter 6e8d7eb48f refactor: route agent stop requests through runtime turns 2026-11-08 21:53:22 +08:00
Soulter be4c46035b refactor: decouple main agent input from the native runtime 2026-11-04 23:34:52 +08:00
Soulter 9bbe3168e1 refactor: move subagent orchestration into the native runtime 2026-11-04 21:22:48 +08:00
Soulter 3ef71bcf30 refactor: unify native agents behind runtime sessions (#10973)
* refactor: code structure and agent runtime

* feat: enhance plugin SDK with public agent contexts, message types, and utility functions

* docs: update import statements to reflect changes before AstrBot v4.30.0

* feat: expose conversation agent SDK with turn controls

* refactor: introduce AgentConfig and profile-scoped subagent management

* fix: complete AgentConfig backup and CI integration
2026-11-04 16:28:02 +08:00
Gao JinzheandSoulter abaf9a0d68 refactor: extract subagent orchestration into a built-in extension (#10733)
* refactor: move subagent orchestration into plugin

* fix: retain legacy Agent SDK during plugin extraction

* fix: retain legacy subagent orchestrator for plugin compatibility

* fix: stop injecting legacy subagent router instructions

* refactor: retain legacy subagents only for plugin SDK compatibility

* docs: update subagent expert management guide and screenshots

* docs: describe current subagent workflows without migration history

* feat: bundle subagents as a built-in extension

---------

Co-authored-by: Soulter <905617992@qq.com>
2026-11-03 17:22:44 +08:00
Soulter 15e1b9996e fix: notify plugin views when SSE streams close (#10932)
* fix: notify plugin views when SSE streams close

* Delete dashboard/tests/pluginPageSSE.test.mjs
2026-11-01 18:42:57 +08:00
Soulter 734b357fe3 feat: add portable message buttons (#9809)
* fix: handle DingTalk app creation status

* feat: add portable message buttons

* test: mark command group messages as non-interactive

* feat: add button action timeouts and rename plugin filter

* feat: show bilingual notices for expired button actions

* refactor: nest button actions and styles under Button

* docs: describe current button API without draft history

* docs: list supported button platforms
2026-10-31 11:16:36 +08:00
lxfightandSoulter dad255c60f feat(provider): add decision provider with System One adapter (#10775)
* feat(provider): add decision provider service

* feat(provider): add System One decision adapter

* feat(dashboard): configure decision providers

* docs: document decision providers

* fix(provider): avoid logging decision response bodies

* fix(provider): roll back failed provider creation

* fix(provider): reject unknown decision option keys

* fix(provider): normalize invalid decision response encoding

* refactor(provider): inline decision provider lookup

* fix(dashboard): remove OpenAI-specific header hint

* fix(provider): bound decision latency

Use a two-second default timeout and treat request_max_retries as retries after the initial request, with no retries by default.

* test(provider): cover terminating an unknown provider

* fix(provider): relax decision probability validation

Make probability tolerance configurable, allow the selected option to deviate from the maximum within that tolerance, and include a bounded response summary in warnings and errors.

* fix(decision): cap state size and add yes_no default

Reject oversized decision state before dispatch and allow callers to provide a fail-open or fail-close fallback for yes/no questions.

* refactor(provider): avoid indexing missing provider IDs

Look up the provider instance once and return early for unknown IDs, removing repeated inst_map indexing from termination.

* fix(provider): enforce a total decision timeout

Cap the complete decision request, including retries and backoff, with a configurable five-second total timeout.

* fix(provider): limit concurrent decision requests

Use a per-provider semaphore with a configurable default limit of four concurrent requests.

* refactor(provider): narrow decision state type

Restrict decision state to str, list, or dict and expose the shared DecisionState alias through the plugin provider API.

* fix(provider): update decision tab order and provider logos

* fix(provider): use a single API key for System One

* fix(config): validate System One keys as strings

* chore: remove extra tests and changelog updates

* refactor(webui): group decision provider advanced settings

* refactor(decision): remove arbitrary state character limit

* refactor(decision): keep probability validation internal

* docs: remove decision provider setup section

* docs: remove English decision provider setup section

* refactor(decision): rename choice options to criteria

* feat(decision): support System One score questions

* docs: name decision convenience method arguments

* refactor(decision): use criteria in choose convenience method

* refactor(decision): split answers by question type

---------

Co-authored-by: Soulter <905617992@qq.com>
2026-10-27 14:52:18 +08:00
Magenta QinandSoulter 866f6f420a feat: integrate SerpApi Google News API (#10773)
* refactor: migrate SerpApi requests to official Python SDK

* feat: add SerpApi Google News search

* refactor: restore direct HTTP requests for SerpApi

* Update unreleased.md

---------

Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
2026-10-27 11:38:07 +08:00
Soulter c766b43794 feat: add sender and umo source selectors for core and plugin (#10747)
* feat(dashboard): add user and session source selectors

* test(dashboard): remove selector interaction tests

* docs: remove WebUI guide changes from selector PR

* feat(dashboard): add session source refresh button

* feat(qq_official): cache group metadata before creating events

* feat(lark): cache group metadata before creating events

* fix(dashboard): order session sources and deduplicate user suggestions

* fix(lark): reuse sender name lookup for group chats

* docs(webui): add sid command hints to user and session selectors

* feat(dashboard): paginate recorded user selection

* feat(dashboard): align session source display with user rows

* fix(dashboard): keep session titles single-line with consistent fonts

* feat(dashboard): add hover copy buttons to user and session selectors

* fix(dashboard): reclaim copy button space and wrap selected session titles

* fix(dashboard): disable copy button fade transitions
2026-10-25 14:41:36 +08:00
Wei ChengqianandSoulter 1f1d3fb004 fix(dashboard): localize plugin names in sidebar (#10576)
* fix(dashboard): localize plugin names in sidebar

* test: simplify plugin sidebar i18n regression coverage

* Delete dashboard/tests/pluginSidebarItems.test.mjs

---------

Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com>
2026-10-18 18:24:32 +08:00
Soulter 8774e53ff4 feat: improve message tracing and add bounded SQLite history (#10515) (#10614)
* feat: expand message tracing and redesign trace explorer

* feat: add trace metadata chips and preserve response ownership

* feat: show full-width tracing list with optional details

* style: remove gray trace tab card

* feat: unify trace toolbar controls and use Vuetify datatable

* style: use native Vuetify trace table rows

* fix: prevent trace platform header wrapping

* feat: persist message traces in bounded SQLite storage

* fix: expose trace settings and preserve long prompt attributes

* docs: simplify trace storage setting hints

* feat: add trace history cleanup and disk usage accounting

* fix: finish event traces and fold Agent execution chains

* feat: fold long trace messages and consolidate persona metadata

* fix: hide redundant adapter event labels in traces

* refactor: remove redundant persisted span metadata

* feat: paginate trace history with Vuetify table controls

* style: reduce trace table text size

* style: increase trace table text to 13px

* style: flatten trace status chips and narrow platform column

* feat: show independent Agent and command trace types

* feat: show cumulative Agent token usage in trace details

* style: abbreviate trace token counts with k and M

* style: reduce trace table header height

* feat: show group and private chat trace types

* fix: include month and day in trace timestamps

* style: use system trace fonts and blue running status

* style: separate trace origin and sender metadata rows

* fix: trace successful proactive message tool deliveries

* feat: show model persona and tool counts on Agent headings

* style: prefix trace plugin chips with puzzle icons

* style: add icons and spacing to Agent metadata chips

* style: remove execution mode prefix from trace chips

* refactor: centralize response tracing without source attribution

* style: hide module metadata in trace details

* refactor: omit redundant module metadata from plugin traces

* refactor: remove obsolete module filtering from trace UI

* feat: expose trace recording toggle in system settings

* docs: simplify trace recording setting description

* feat: retain traces only for command responses and Agent calls

* fix: revert trace admission filtering and expand writer queue

* refactor: adopt OpenTelemetry SDK and simplify trace tests

* refactor: separate event and trace execution contexts

* fix: include OpenTelemetry SDK in runtime requirements

* refactor: dispatch session waiters in the core pipeline

Preserve access and safety checks before waiter dispatch and limit built-in group context handlers to group messages.

* test: remove trace dashboard tests

* fix: recover orphaned traces and enforce minimum storage budget

* fix: increase trace queue byte budgets and remove frame count limit
2026-10-18 17:09:08 +08:00
Soulter 3be08aca2e feat: add SerpApi search tools and provider descriptions (#10601) 2026-10-17 17:31:47 +08:00
letr ff22dacf05 feat(websearch): add DeepSeek search and page fetching (#10599)
* feat(websearch): add DeepSeek search and page fetching

Add DeepSeek Search and Fetch builtin tools with validated inputs, API key rotation, and WebChat source citations. Expose the provider in WebUI configuration and update localized metadata, documentation, and tests.

Refs #10598

* fix(websearch): validate ports in DeepSeek fetch URLs

* docs(websearch): add DeepSeek query examples and clarify fetching
2026-10-17 14:16:39 +08:00
Soulter 170eeca08b fix: disambiguate plugin view sidebar items (#10502)
* fix: disambiguate plugin view sidebar items

* docs: explain plugin view metadata

* docs: clarify plugin view metadata location
2026-10-11 18:07:46 +08:00
ankaandSoulter 8763c58a98 feat(dashboard): add model settings shortcuts and access control section (#10321)
* feat(dashboard): add model settings shortcuts and access control section

* docs: align remaining configuration paths and permission guidance

---------

Co-authored-by: Soulter <905617992@qq.com>
2026-10-10 00:23:24 +08:00
Soulter 8831d95025 feat(dashboard): scoped path-token auth for plugin views and complete the views rename (#10415)
* refactor(dashboard): complete the plugin pages to views rename

Finish the remaining Pages -> Views rename on the dashboard:

- Fix the plugin card "Open View" button crash by pointing
  openPluginWebui at the renamed PluginView route
- Rename PluginPagePage.vue to PluginViewPage.vue and update its
  internals (loadPluginView, pluginViewTitle, .plugin-view-* classes)
- Rename openPluginWebui -> openPluginView and the open-webui emit to
  open-view; pluginPageTitle/Description -> pluginViewTitle/Description;
  isPluginPageRoute -> isPluginViewRoute
- Rename i18n keys (pluginWebui -> pluginView, openWebui -> openView,
  pluginPageType -> pluginViewType, messages) across en/zh/ja/ru locales

The postMessage bridge channel name (astrbot-plugin-page) is kept
unchanged because it is part of the wire protocol shared with
plugin_page_bridge.js.

* feat(dashboard): authenticate plugin view assets with scoped path tokens

Serve plugin view assets from
/api/v1/plugins/{id}/views/{page}/_t/{token}/... so the scoped token
travels in the URL path. Relative URLs inside the view then inherit the
token through normal path resolution, which removes the need for
server-side HTML/CSS/JS URL rewriting on this route.

- Add the _t routes with a require_plugin_view_token dependency
  (v1 paths bypass the dashboard auth middleware)
- Extend the plugin page asset token to a session-length TTL (7 days,
  aligned with the dashboard session) with a page_session purpose claim,
  still scoped to a single plugin and page
- Serialize the view entry content_path as the _t URL, keeping the
  asset_token query for plugins that parse location.search
- Keep the legacy /api/plugin/page/content/...?asset_token= form working
  during the transition
- Rename the OpenAPI tag Plugin Pages -> Plugin Views, document the new
  route, regenerate the frontend API client, and update the zh/en
  plugin-pages docs

* refactor(dashboard): remove the legacy plugin page content route and URL rewriting

The path-token view route makes the compatibility surface unnecessary:

- Drop /api/plugin/page/content/... (query asset_token form)
- Drop the redundant authenticated asset routes /plugins/page/assets,
  /plugins/view/assets, and /plugins/{id}/(pages|views)/{page}/assets/...
  which had no callers outside the generated client
- Remove the HTML/CSS/JS URL rewriting helpers; view assets are always
  served raw and only HTML gets bridge SDK injection plus theme handling
- Slim PluginPageAuth down to the bridge SDK endpoint, the only
  non-v1 path still authenticating scoped query tokens
- serialize_plugin_page no longer falls back to the legacy content path
- Update the plugin-pages docs (zh/en) and the OpenAPI spec, and
  regenerate the frontend API client

* refactor(dashboard): drop legacy plugin page API aliases

Remove the page-named plugin view API aliases now that the views rename
is complete and legacy compatibility is intentionally dropped:

- DELETE /api/v1/plugins/page(s) and /plugins/{plugin_id}/pages{,/{page_name}}
  aliases; /plugins/view(s) and /plugins/{plugin_id}/views{,/{page_name}}
  are the only entry config routes
- Remove the unused /api/v1/plugins/page-bridge-sdk.js route; the live
  bridge SDK stays at /api/plugin/page/bridge-sdk.js
- Dashboard calls the view-named endpoints; regenerate the API client
  and the OpenAPI scopes docs

* refactor(dashboard): keep plugin page APIs as deprecated view aliases

Restore the page-named plugin view routes removed in the previous commit
and keep them for a transition period, with view as the canonical API:

- /plugins/page(s) and /plugins/{plugin_id}/pages{,/{page_name}} serve as
  aliases of the corresponding /views routes (same handlers)
- The OpenAPI spec marks the page operations deprecated and points new
  clients at the view routes; the v1 page-bridge-sdk.js route is restored
- The dashboard keeps calling the view endpoints by default

* refactor(dashboard): rename the plugin view path parameter to view_name

The view entry and path-token asset routes now use {view_name} instead of
{page_name} in the OpenAPI-visible path, and the service layer renames its
internal page_name variables to match. Wire-compatible surfaces stay
unchanged: the page_name JWT claim, the pageName JSON field, query
parameters, and the deprecated /pages aliases. Error messages and the
plugin view docs (zh/en) complete the Page to View rename.
2026-10-06 18:18:22 +08:00
Sekken 64430fa2e1 docs: sync Lark/Feishu guide with current capabilities and permissions (#10400)
* docs: sync Lark/Feishu guide with current capabilities and permissions

The Lark guide still described the adapter as of v4.15.0:

- Receiving voice, video, and files has been supported since v4.16.0, and quoted (reply) message contents are parsed as well.

- Documented config field names (encrypt_key, verification_token) did not match the actual lark_encrypt_key / lark_verification_token.

- The permission list recommended im:message:send and im:resource:upload, which Feishu no longer accepts for new applications; im:message covers sending and im:resource covers resource upload/download. The one-click permission URL is updated accordingly.

- Group chats only receive @-mentioned messages unless im:message.group_msg is granted, so the wake-prefix wording and the final /help step were corrected.

- Long connections are supported for both Lark China and Lark International; webhook is only a fallback, not a requirement for international Lark.

* docs: correct Lark media support in plugin platform matrix

The zh plugin platform matrix marked Lark Record and Video as unsupported, but the adapter receives and sends both.

* docs: clarify Lark group delivery and wake conditions

The group-chat wording only mentioned @ mentions. Delivery (which events Lark pushes to AstrBot) and waking (which received messages AstrBot responds to) are separate layers: a group chat only pushes messages that @ mention the bot unless im:message.group_msg is granted, while AstrBot also responds to @all (unless ignore_at_all is set), replies to its own messages, and wake-prefixed messages.
2026-10-06 12:55:16 +08:00
Yufeng He 63aa363d9c test(dashboard): catch up with the plugin Pages to Views rename (#10307) (#10319)
The rename merged without updating the suites that assert the old
names, leaving the pytest matrix red on master:

- test_plugin_manager: assert StarMetadata.views; the metadata.yaml
  case now uses the views: key, plus a new test for the pages: alias
  the rename kept for compatibility
- test_dashboard: the injected bridge snippet now reads
  window.AstrBotPluginView?.__setInitialContext; the served bridge
  keeps the AstrBotPluginPage alias, so that assertion stays
- regenerate docs/public/openapi.json (and the two openapi-scopes
  tables) with docs/scripts/update_openapi_json.py so the public
  spec matches the runtime spec again after the six /plugins/view(s)
  alias routes

Fixes #10318
2026-10-02 19:14:01 +08:00
Soulter 4b049d1e57 feat(dashboard): regroup sidebar into labeled sections and rename plugin Pages to Views (#10307)
* feat(dashboard): regroup the sidebar into labeled System and Extensions sections

- Add static group headers (System / Extensions) to the sidebar, in the
  style of AI Studio's labeled sections
- System: welcome, platforms, providers, extensions, config profiles,
  data & logs, custom rules
- Extensions: knowledge base, cron, subagent orchestration, personas;
  plugin pages are flattened into this section and the collapsible
  plugin-pages group is removed
- Dissolve the collapsible More Features group; headers hide in rail mode
- Skip the legacy sidebar customization when building the menu (the
  feature is slated for removal)
- Update zh/en docs for the new locations

* feat(dashboard): place personas before knowledge base in the extensions group

* feat(dashboard): make the extensions sidebar group collapsible

Add a chevron toggle to the extensions group header; collapsing hides
the group's items and the state persists in localStorage. Rail mode is
unaffected and always shows every icon.

* feat(dashboard): pin extension sidebar items to the top of their group

Extension group items show a pin button on hover; pinned items move to
the top of the extensions group (hidden together with the group when
collapsed) and the pinned set is persisted in localStorage.

* feat(dashboard): keep the unpin icon always visible on pinned items

Pinned items now show a PinOff icon in the primary color without
requiring hover; unpinned items still reveal the Pin icon on hover.

* feat(dashboard): show a hover card with plugin details on plugin page items

Hovering a plugin-provided page in the extensions group reveals a card
with the page name, plugin ID, and author. The data comes from the
existing plugin list API (no backend change); static items and rail
mode are unaffected.

* fix(dashboard): add author and version to the PluginEntry type

* feat(dashboard): refine the plugin hover card

- Show the card immediately on hover (no open delay) and drop the
  expand animation
- Plugin row shows an icon plus 'display_name (id)' with the id muted,
  or just the id when the plugin has no display name
- Author row gets its own icon

* feat(dashboard): add a type row to the plugin hover card

Defaults to '插件可视化视图' (localized in all four locales).

* feat: rename plugin Pages to Views and group plugin views by plugin

Rename (Views preferred, Pages kept as a compatible alias everywhere):
- StarMetadata.pages -> views; metadata.yaml accepts views: (pages: alias)
- Plugin view directory views/ preferred, pages/ still accepted
- v1 API gains /plugins/view(s) alias routes alongside /plugins/page(s)
- Bridge global window.AstrBotPluginView with AstrBotPluginPage as alias
- Plugin i18n keys views.<name>.* preferred, pages.<name>.* alias
- Frontend route /plugin-view/... with /plugin-page/... redirecting
- OpenAPI spec + regenerated client; docs use Views (zh: 插件可视化视图)

Sidebar (extensions group):
- Default mode shows the view name for plugin views
- New group-by-plugin toggle on the extensions header (grid icon, off by
  default, persisted in localStorage): plugin views are grouped per plugin
  under the extensions group, each group listing all of the plugin's views
- Hover card on plugin view items shows page name, plugin display name
  (with id), author, and type; white card style reused for the toggle
  tooltip
- Pinning works for nested views too, lifting them to the group top
2026-10-01 16:26:56 +08:00
Soulter da4811ae81 feat(config): move text-to-image settings into the config profile extension group (#10306)
* feat(star): add umo and template_name params to Star.text_to_image

Plugins can now pass umo (unified_message_origin) so the t2i template is
resolved from the configuration file bound to that session, falling back
to the default configuration when unbound or omitted. An explicit
template_name always takes precedence over configuration.

* feat(config): move text-to-image settings into the config profile extension group

Consolidate all t2i settings under Config Profile -> Extension Features
(ext_group) so they are isolated per configuration file:

- Move the t2i object (output toggle, word threshold) from
  platform_group to ext_group
- Move t2i_strategy, t2i_endpoint, t2i_template and t2i_active_template
  from the system-wide settings group (Settings -> Appearance) into the
  same ext_group t2i object
- Remove the Text-to-Image card from the Settings appearance section
- Relocate the matching i18n entries in all four locales and update the
  zh/en docs with the new location

* fix(dashboard): hide trailing divider after invisible config items

getVisibleItemEntries did not filter invisible items, so an invisible
last item (e.g. t2i_active_template) left a dangling divider below the
last visible row.

* feat(dashboard): rename the sidebar Settings entry to System Settings

The Settings page now only holds global/system-wide options after
behavior configs (such as text-to-image) moved into config profiles.
Rename the sidebar entry in all four locales and update the zh/en docs
to reference the new name.

* feat(config): hide dependent t2i options when text-to-image output is off

Add a t2i=true condition to the word threshold, strategy, endpoint and
custom template items so they only appear when the output toggle is on.
The endpoint/template items keep their t2i_strategy=remote condition.

* fix(star): fall back to the default template when get_config returns None

text_to_image called .get() directly on the result of
context.get_config(umo), which can be None for context implementations
without a default configuration. Guard the lookup so the renderer
receives None instead, restoring the behavior covered by
test_text_to_image_without_config.

* feat(star): hold html_renderer on Context and resolve t2i endpoint per config

- Context now exposes the shared html_renderer, injected by the core
  lifecycle, so plugins can call self.context.html_renderer directly
- Star.text_to_image/html_render resolve the t2i template and render
  endpoint from the configuration file bound to the given umo and pass
  them through per call (no renderer cache, no restart needed)
- The render chain (HtmlRenderer/NetworkRenderStrategy) accepts an
  optional per-call endpoint
- The pipeline's automatic t2i conversion passes the endpoint from its
  own per-profile configuration

* refactor(init): remove unnecessary comments and add deprecation notice for HtmlRenderer usage
2026-10-01 15:18:06 +08:00
Waterwzyandsourcery-ai[bot] ac515d984d docs: add slider key to plugin dev docs (#10289)
* docs: add slider key to plugin dev docs

* Update docs/en/dev/star/guides/plugin-config.md

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
2026-09-30 18:40:25 +08:00
卷卷andsourcery-ai[bot] 96d9504b6c docs: explain HTTP proxy address when AstrBot runs in Docker (#10162)
* docs: explain HTTP proxy address when AstrBot runs in Docker

* Apply suggestion from @sourcery-ai[bot]

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
2026-09-21 12:40:26 +08:00
Soulter b62d9a9612 feat: extend shell session waits and raise default agent step limit (#10131) 2026-09-19 10:53:07 +08:00
Ruochen Pan f99c76ec10 fix(dashboard): bound upload memory and add resumable chunked uploads (#10123)
* refactor(dashboard): consolidate upload saves into streaming helper

Five copies of the same upload-save logic existed: three file wrappers
(UploadFileAdapter, RequestUploadFile, PluginUploadFile) plus one
_save_upload() in each of BackupService and SkillsService. The backup
variant fell back to a full-body read() for raw FastAPI UploadFile,
buffering entire uploads in memory.

Introduce save_upload_stream() as the single streaming implementation
(1 MiB blocks, optional max_bytes with in-loop abort and partial-file
cleanup). The wrappers keep their public signatures and delegate to it;
skills/chat/config save paths call save() directly with max_bytes,
replacing their post-save size checks.

* fix(dashboard): bound backup upload size and harden chunked flow

Backup routes passed raw FastAPI UploadFile into the service layer,
hitting the full-body read() fallback: a single authenticated request
with an oversized chunk or whole-file upload could OOM-kill the
process (verified with a 512 MiB memory-limited container, exit 137).

- Wrap uploads in UploadFileAdapter so all saves stream to disk
- Enforce CHUNK_SIZE (1 MiB) per chunk and 128 MiB for whole-file
  uploads, aborting mid-stream with partial-file cleanup
- Cap chunked backup totals at 8 GiB and point larger backups at
  manual restore via the data directory
- Verify the merged backup size against the declared total

* fix(dashboard): enforce MAX_CONTENT_LENGTH with per-route overrides

The 128 MiB MAX_CONTENT_LENGTH value was written into the compat-layer
config dict but nothing read it, so the FastAPI/hypercorn path had no
request body limit at all.

Add a middleware that rejects oversized bodies with 413 before auth or
body parsing, using MAX_CONTENT_LENGTH as the default with per-route
overrides for legitimate large uploads (attachments 512 MiB, plugin
config files 500 MiB, knowledge bases 512 MiB) and a tight 2 MiB cap
on the backup chunk endpoint. Requests without a Content-Length header
pass through and remain bounded by per-endpoint max_bytes at save time.

* refactor(dashboard): extract generic chunked upload session service

Pull the chunk session machinery out of BackupService into a reusable
ChunkedUploadService owning session lifecycle, chunk storage, streaming
assembly and expiry cleanup, in preparation for webchat attachment
chunked uploads.

Sessions are now bound to an owner (the authenticated username) and a
purpose; chunk/complete/abort calls from another owner fail with the
same "not found or expired" error as unknown sessions, so upload IDs
cannot be probed or consumed cross-user. BackupService keeps business
concerns (zip validation, size caps, manifest marking) and delegates
the rest; API shapes and frontend flows are unchanged.

* feat(dashboard): add resumable upload status endpoint

Expose per-session progress (received chunk indexes, totals, expiry)
so clients can resume an interrupted chunked upload by sending only
the missing chunks instead of starting over.

Abuse considerations baked in: the lookup inherits owner binding and
answers "not found or expired" for both unknown sessions and sessions
owned by someone else (no probing), the response carries no filename
(minimal disclosure), and the query is strictly read-only — it never
touches last_activity, so polling it cannot anchor a session and its
on-disk chunks alive past expiry.

* fix(dashboard): bound file signature memory with chunked hashing

getFileSignature() read the entire file into browser memory via
arrayBuffer() before computing SHA-256, spiking renderer memory by the
full attachment size (up to the 512 MiB upload cap).

The signature is only used for in-session staging dedup and never
leaves the browser, so it does not need to be the canonical whole-file
SHA-256. Hash 8 MiB blocks individually and digest the concatenated
block digests instead; the prefix changes to sha256m: to mark the
algorithm change (old signatures vanish with the page session, so no
compatibility concern).

* feat(dashboard): resumable chunked upload UI for backup import

Extract the chunk scheduling logic from BackupDialog into a reusable
useChunkedUpload composable (5-way concurrency, per-chunk silent
retries, progress accounting) and add resume support on top of the
new upload status endpoint: a failed upload now offers a "Resume
Upload" action that queries received chunk indexes and sends only the
missing ones. Expired sessions transparently re-initialize and start
over; a failed complete() drops the poisoned session by design.

Wires the new /backups/upload/status endpoint through the OpenAPI
spec and regenerated client, and adds the resumeUpload label to all
four locales.

* feat(dashboard): chunked upload endpoints for webchat attachments

Mirror the backup chunked-upload flow for chat attachments so large
files (>128 MiB request-body default, up to the 512 MiB attachment
cap) can be uploaded in slices: POST /api/v1/files/upload/{init,
chunk,complete,abort,status}, owner-bound sessions, and a per-route
body limit on the chunk endpoint.

ChatService reuses the generic ChunkedUploadService with a new meta
passthrough carrying the client content_type through the session;
completion merges outside the chunk dir and feeds the result through
save_uploaded_file() unchanged via a move-based LocalUploadFile
adapter, keeping MIME sniffing, type classification and attachment
insertion in exactly one place.

Also repairs two pre-existing test stubs that predated the
max_bytes-aware save() contract and were already failing on this
branch.

* feat(dashboard): chunked upload with resume for webchat attachments

Route staged files >= 32 MiB through the new chunked upload endpoints
via useChunkedUpload; smaller files keep the single POST path so paste
and quick picks stay low-latency. The content_type travels through the
init payload so server-side attachment classification is unchanged.

A failed chunked upload is kept as an error chip in the input area
with a retry action that resumes from the last received chunk (and
transparently restarts when the session expired) plus a discard action
that aborts the session. Failed entries hold their uploader in a
shallowRef so Vue's deep ref unwrapping cannot strip the composable's
internal refs, and their signatures stay reserved to block duplicate
staging while a failed entry exists.

* docs: regenerate openapi artifacts for file upload endpoints

* fix(dashboard): harden chunk save and request body limits

Address review findings on the upload-hardening branch:

- save_chunk() now writes to a uniquely named temp file, verifies the
  save() byte count against the expected chunk length, and publishes
  via atomic rename. A failed or concurrent same-index retry can no
  longer truncate and delete an already-received chunk (previously
  left received_chunks claiming data that assemble() then failed to
  find), and short writes are rejected instead of published.
- Requests with multipart bodies but no Content-Length are rejected
  with 411: form parsing spools large bodies to disk before any
  per-file size check can run. This is a documented stopgap — other
  lengthless bodies still pass and are bounded only at save time;
  closing that fully requires counting bytes as they arrive.
- Whole-file upload overrides gain 1 MiB of multipart framing slack
  so a file exactly at the size cap is no longer rejected with 413.

The body-limit decision is extracted into a pure function for direct
unit tests; the assemble-time size recheck is now covered by an
out-of-band corruption test since chunk-level verification rejects
short writes earlier.

* fix(dashboard): drain upload pool and pin session on resume

A failed chunk made runPool() reject immediately while the remaining
in-flight requests kept writing; a resume could then race them on the
same chunk, stale retries read the mutable uploadId (potentially
writing into a re-initialized session), and late completions kept
counting progress (150% after resume).

The pool now stops scheduling on first failure but drains issued
requests via allSettled before surfacing the error, each request pins
the uploadId captured at run start, and a run-generation counter
(bumped on start/resume/cancel) blocks stale completions from the
progress accounting.

* fix(dashboard): close 411 bypass and temp-file residue on publish

Address the second round of review findings:

- The 411 media-type check used a raw startswith(), but the form
  parser strips surrounding whitespace, so a leading-space
  Content-Type was let through without a Content-Length while
  Starlette still parsed the body as multipart. Detection now uses
  the same parse_options_header the parser uses.
- A failing os.replace() during chunk publish left the uniquely
  named temp file behind; it is now covered by the same cleanup
  discipline as the save path.

Backup direct-upload routes deliberately get no framing slack: they
are legacy paths with no remaining callers, and the pre-existing
exact-limit 413 edge is answered by chunked upload.

* fix(dashboard): abort sessions created after a cancel

Cancelling while initUpload was still in flight cleared local state
before an upload id existed; when the delayed init returned, the run
flipped from idle to error and the freshly created server session was
never aborted. handleFailure now lets cancel win over any late
resolution and aborts the session id captured at that point.

* fix(dashboard): check cancel flag after completeUpload resolves

Cancelling while completeUpload was in flight let the late success
response flip the uploader from idle to done and hand the result to
the caller, which proceeded to the precheck. completeSession() now
re-checks the cancel flag after the response arrives and routes the
late success through the cancelled path instead.

* fix(dashboard): gate the 411 rule to body-capable methods

The 411 stopgap rejected GET /api/v1/logs/live: the SSE log client
sends a bogus "Content-Type: multipart/form-data" header on a GET
(copy-paste relic), and a GET with no Content-Length matched the
multipart-without-length rule. Body-less methods never trigger form
parsing, so no disk-spool risk exists for them — the 411 now applies
only to POST/PUT/PATCH. The junk header on the SSE client is removed
as well; the other two SSE consumers never had it.

* feat(dashboard): show in-progress chips for chunked attachments

Chunked uploads gave no feedback while in flight: the staged chip
only appeared after completion, leaving multi-minute uploads silent.
Track in-flight uploads alongside the failed ones and render progress
chips (filename, percent, thin progress bar) with a cancel action in
the input area; on success the chip hands off to the staged
attachment, on failure to the resumable error chip.

* fix(dashboard): type active upload chips upfront and align progress bar

The in-progress chip used a generic cloud icon even though the file
type is known locally before the upload starts; it now derives
icon/color/label from the filename via attachmentPresentation, same
as the staged chip. The progress bar's left edge is aligned with the
filename text instead of the card padding.

* fix(dashboard): keep active-chip progress bar inside the card

v-progress-linear ships width:100%, which wins over the right offset
in absolute positioning; the bar ran 52px past the card's right edge
and was clipped by overflow:hidden. Give it width:auto so the left/
right offsets determine the width.

* fix(dashboard): rework active-chip progress track and cancel button

Positioning a Vuetify component root directly proved fragile — the
progress bar drifted to the card's top edge. Wrap it in a plain track
div that owns the absolute positioning and let the component fill it.
Replace the corner tonal badge cancel with an inline text-variant
icon button after the percent label, and drop the padding reserved
for the badge.

* fix(dashboard): enforce session expiry and atomic save semantics

Address the third review round (sourcery-ai findings):

- get_session() now actually enforces the idle expiry it advertises
  in its "not found or expired" error; expired sessions stay
  abortable for cleanup, and backup upload_init starts the janitor
  just like chat's does, so chunk dirs cannot linger indefinitely.
- cleanup_session() only unregisters a session after rmtree()
  succeeds, letting the janitor retry on transient filesystem errors
  instead of permanently leaking the chunk directory.
- save_upload_stream() writes to a uniquely named temp sibling and
  atomically renames on success, so a failed or cancelled overwrite
  can no longer delete a pre-existing destination (e.g. re-uploading
  over an existing attachment), and all callers inherit the behavior.

The write()-return-value finding is a non-issue: BufferedWriter
writes fully or raises, and the chunk path already verifies byte
counts.

* fix(dashboard): guard failed-upload retry against double clicks

retryFailedUpload() ran resume() without any in-flight marker, so a
second click started a concurrent resume on the same session; the
loser hit "not found or expired" and left a failed chip next to the
successfully staged attachment. The entry now moves to activeUploads
while resuming, which blocks the second click and shows live
progress, and returns to failedUploads only if the resume errors.
2026-09-18 17:55:30 +08:00
Soulter 553096b0c1 docs: sync guides with current WebUI navigation (#10093) 2026-09-15 22:10:21 +08:00
w31rd c264e1d92a feat: unify /new and /reset behavior (#10004)
* feat: unify new and reset conversation behavior

* fix(i18n): align conversation isolation labels

* fix(i18n): clarify group conversation permission hints

* feat: centralize conversation command permissions

* fix(i18n): clarify administrator-only command permissions

* docs: correct conversation command permission instructions

* test: isolate conversation restart command registration

* feat: follow conversation isolation for restart permissions
2026-09-12 14:19:58 +08:00
WangPan59and王磐 f845a8d654 feat(websearch): add AnySearch as a web search provider (#9767)
Co-authored-by: 王磐 <wangpan.com>
2026-08-31 09:30:46 +08:00
Soulter 69030851d4 feat: consolidate data dashboard and redesign conversations (#9846)
* feat: consolidate data dashboard

* feat: redesign conversation workspace

* docs: sync conversation OpenAPI artifacts

* docs: update data workspace navigation

* feat: group conversations by session

* fix: optimize mobile conversation workspace

* feat: refine log workspace

* fix: honor console auto-scroll setting

* feat: refine trace workspace
2026-08-27 18:53:02 +08:00
Soulter e183dd285f feat(dashboard): support masked secret config fields (#9824)
* feat(dashboard): support masked secret config fields

* docs: document secret plugin configuration fields
2026-08-26 20:41:29 +08:00
Soulter 0fceeb3b6b docs: add plugin attribution guidelines 2026-08-15 01:29:23 +08:00
Soulter e9ae69f93a fix: prevent SharedPreferences deadlocks (#9649)
* fix: avoid blocking shared preference access

* docs: clarify shared preference cache roles

* docs: explain shared preference cache purpose

* docs: link cache rationale to pull request
2026-08-13 00:44:42 +08:00
Soulter cfe6424742 fix: harden API key scope boundaries (#9503) 2026-08-02 13:19:38 +08:00
Soulter e80e01c776 feat: implement group message history persistence and retrieval features (#9465)
* feat: implement group message history persistence and retrieval features

* feat: update group message history configuration and documentation
2026-07-30 18:58:24 +08:00
XTsat 9c9d6095b8 docs: update plugin publish (#9415)
* docs: update plugin publish

* docs: update plugin publish example

* docs: update plugin publish
2026-07-28 10:16:02 +08:00
Ruochen Pan 10e5ca6958 Feat: Allow adjust plugin log levels (#9342)
* feat(logging): add isolated plugin loggers

* feat(dashboard): configure plugin log levels

* fix(logging): support legacy plugin loggers

* fix(dashboard): sync plugin log level response

* perf(logging): avoid rescanning plugin handlers

* fix(logging): persist plugin levels atomically

* test(logging): use valid logger level mocks
2026-07-24 10:03:55 +08:00
Weilong Liao 0ef790d289 fix: track plugin install source for updates (#9037)
* fix: track plugin install source for updates

* feat: refine plugin source management flow

* test: align plugin update expectation
2026-06-27 15:02:04 +08:00
NayukiChiba 0a0c677404 docs: 文档更新 - 指令、FAQ、网页搜索、插件发布等 (#8912)
* docs(community): 更新 QQ 群组信息
- 移除了旧的 QQ 群组信息并添加了新的群组。
- 确保所有群组信息的准确性和完整性。
- 提升文档的可读性和用户体验。

* docs(webui): 为忘记密码章节添加 FAQ 引用链接

- 在英文和中文文档的"忘记密码"章节末尾添加 TIP 提示框
- 提示框链接至对应 FAQ 条目,提供更详细的操作说明
- 增强文档之间的关联性,提升用户查阅体验

* docs(command): 新增 /stats 和 /provider 指令文档,更新 FAQ 管理员指令列表

- 在英文和中文的命令文档中添加 /stats 和 /provider 指令的详细使用说明
- 更新中英文 FAQ 页面的管理员指令列表,与最新的默认指令保持一致
- 确保中英文文档内容同步,提升文档准确性和用户查阅体验

* docs(websearch): 新增 Firecrawl 网页搜索提供商文档支持

- 在开发版配置文档中补充 websearch_provider 选项,加入 firecrawl 及对应密钥配置项
- 更新中英文网页搜索使用指南,将支持搜索源数量同步为五种并提供 Firecrawl 注册指引
- 确保中英文文档内容一致,提升配置说明的完整性和用户查阅体验

* docs(plugin-publish): 更新插件提交方式至新仓库

- 废弃通过 AstrBot 主仓库 Issue 提交插件的方式
- 新增警告框提示正确提交入口为 AstrBot_Plugins_Collection
- 同步更新中英文版插件发布文档
2026-06-20 16:43:58 +08:00
Weilong Liao 49b86320cb docs: clarify OpenAPI chat username identity (#8880) 2026-06-18 23:17:50 +08:00
Weilong Liao 264e7eaaa3 fix: restore OpenAPI file uploads
Expose /api/v1/file in OpenAPI, enable file-scoped API keys, and regenerate docs/client artifacts.
2026-06-18 12:37:38 +08:00
Weilong Liao 5566bd621c feat: reorganize settings system configuration (#8777)
* feat: reorganize settings system configuration

* fix: float system config restart notice

* fix: blur system config restart notice

* fix: tint restart notice blur background

* fix: allow totp setup without body

* fix: filter public openapi docs

* fix: handle settings autosave cleanup

* chore: ui
2026-06-16 11:03:42 +08:00
Weilong Liao 0d8e8682db refactor(core): migrate backend backbone from Quart to FastAPI and introduce more OpenAPI (#8688)
* refactor: migrate to fastapi

* structure refactor

* fix: pyright fix

* refactor: improve error handling and public messages in plugin services

* feat(api): refactor API client integration and enhance request handling

- Updated API client configuration to use a dedicated HTTP client.
- Introduced utility functions for generating options, queries, and form data for API requests.
- Refactored multiple API methods to utilize the new utility functions for improved consistency and readability.
- Renamed types for clarity and updated import statements accordingly.

feat(docs): add script to update OpenAPI JSON from YAML spec

- Created a Python script to convert OpenAPI YAML specification to JSON format.
- The script supports customizable input and output paths.
- Ensured the script handles directory creation for output paths and validates the YAML structure.

* fix

* feat(auth): implement rate limiting for v1 login endpoint and enhance request handling

* Refactor dashboard API routers to use legacy_router for backward compatibility

- Changed all instances of dashboard_router to legacy_router across multiple API modules including platform, plugins, providers, sessions, skills, stats, subagents, t2i, tools, updates, and asgi_runtime.
- Updated route definitions to ensure existing endpoints remain functional under the new router structure.
- Introduced support for Quart request context in asgi_runtime to enhance compatibility with existing Quart-based plugins.
- Added a test case to validate the functionality of the new Quart request context handling in plugin extensions.

* chore: remove cli test

* fix: update dashboard tests for fastapi migration

* chore: satisfy ruff checks

* fix: update openapi api key scopes

* fix: sync config scope chip selection

* fix: restore quart dependency

* docs: clarify quart plugin api compatibility

* docs: update openapi scope documentation

* fix: use singular skill openapi scope

* fix: hide update service exception details

* fix: address fastapi review comments

* fix: address dashboard review findings

* docs: revert unrelated package deployment changes

* docs: update agent api generation guidance

* feat: add plugin page web api helpers

* docs: add plugin page bridge demo

* fix: type plugin upload files

* fix: stabilize plugin page uploads

* fix: type plugin web request proxy

* docs: remove plugin page docs example

* fix: authenticate plugin page SSE bridge
2026-06-14 15:03:26 +08:00
7c366a708b fix: unify media reference handling (#8764)
* fix: unify media reference handling

* fix: accept bare base64 record media refs

* chore: update agents.md

* fix: unify file URI handling across media components and utilities

* fix: unify media reference type handling with MediaRefStr alias

* Potential fix for pull request finding 'CodeQL / Incomplete URL substring sanitization'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Update astrbot/core/platform/sources/discord/discord_platform_adapter.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* fix: unify media handling and improve base64 decoding across components

* fix: simplify client_kwargs type definition and enhance media message handling in platform adapter

* fix: unify media utility documentation and enhance function descriptions

* perf: drop "pilk" requirement, improve audio outbound for tencent-related IM apps which using silk

* fix: unify Tencent Silk audio handling and enhance media resolver functionality

---

- Centralize media reference materialization and base64 resolution for local paths, http(s), base64://, data URIs, and legacy bare base64 payloads.
- Normalize incoming Record audio to wav and Image media to temporary jpg during preprocess, with event-scoped cleanup.
- Reuse the shared media resolver across OpenAI, Gemini, Anthropic, MiMo, DeerFlow, STT, and platform media paths while sanitizing logs and cleaning temporary conversion outputs.
- Ensure generated TTS audio is tracked for cleanup after the event finishes.

fix #8676
fix #8543
fix #7588
fix #7580
fix #8030
fix #8034
fix #7461
fix #7565
fix #6509
fix #7144
fix #7795



---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-06-14 10:37:16 +08:00
lingyun14 d2b86c5991 feat(dashboard): add a configurable theme mode with light, dark, and system options and centralize theme synchronization with system preferences. (#8648)
* Update main.ts

* Update config.ts

* Update header.json

* Update auth.json

* Update header.json

* Update auth.json

* Update header.json

* Update auth.json

* Update VerticalHeader.vue

* Update customizer.ts

* Update LoginPage.vue

* Update SetupPage.vue

* Update config.ts

* Update customizer.ts

* Update plugin-pages.md

* docs: add Follow System note to plugin-pages theme section
2026-06-13 16:41:54 +08:00
lxfightandlxfight 65fe0574b9 feat: sync dashboard theme to plugin pages (#8390)
* feat(plugin): pass theme through plugin page asset URLs and initial context

Add theme query parameter propagation through the plugin page asset pipeline
so that the bridge SDK initial context includes isDark.

* feat(plugin): inject data-theme and color-scheme into plugin page HTML

Set data-theme on <html> and add color-scheme meta tag server-side
to prevent flash when entering plugin pages in dark mode.

* feat(webui): add isDark getter to customizer store

* feat(webui): sync theme to plugin iframe via URL param and postMessage

Append theme query parameter to iframe src URL and include isDark
in the postMessage context. Watch uiTheme changes to re-send context.

* feat(bridge): auto-apply data-theme from context in plugin bridge SDK

Set data-theme attribute on document.documentElement when context
includes isDark, enabling live theme switching via postMessage.

* docs: add light/dark theme adaptation guide for plugin pages

Add theme adaptation section to existing plugin-pages docs in both
Chinese and English, covering CSS variables and onContext() usage.

* test: add theme sync tests for plugin page bridge and content

Verify isDark in bridge SDK initial context with various theme params,
and verify data-theme and color-scheme injection in rewritten HTML.

* fix(plugin): use case-insensitive regex for head tag in HTML rewrite

Replace string match for <head> with case-insensitive regex to handle
uppercase tags and tags with attributes, preventing duplicate injection
of color-scheme meta tag.

* refactor(webui): generalize isDark getter to support any dark theme

Replace hardcoded PurpleThemeDark check with suffix-based detection
so all dark theme variants are recognized automatically.

* refactor(plugin): extract theme helpers for HTML rewriting

Extract _get_request_theme and _apply_theme_to_html to eliminate
duplicate theme-parsing logic and isolate HTML mutation. Use case-
insensitive regex for head tag detection to prevent duplicate
injection when tags use mixed casing.

* style: apply ruff formatting to plugin page tests

Wrap long function call lines for consistency with project style.

* fix(plugin): handle existing data-theme and case-sensitive fallback in HTML rewrite

Strip any existing data-theme attribute before adding the new one to
prevent duplicate attributes. Use case-insensitive regex for the
<head> fallback insertion to avoid corrupting <html> tag attributes.

* fix(webui): add null guard to isDark getter

Guard against undefined uiTheme to prevent TypeError when the
theme config has not been initialized.

* fix(webui): centralize theme mapping and preserve hash in plugin page URL

Extract themeParam computed to avoid drift between URL and context.
Include hash fragment in iframe URL to support SPA hash routing.

* fix(webui): address CR feedback - deduplicate color-scheme meta, harden isDark getter, consolidate theme source

- _apply_theme_to_html: strip existing color-scheme meta before injecting to
  avoid duplicates; merge data-theme strip+add into single-pass regex callback
- customizer.ts: replace brittle endsWith('Dark') with explicit theme name check
- _rewrite_plugin_page_html: use _get_request_theme() directly instead of
  reading theme from extra_query_params

* fix(webui): 简化 isDark 推导、优化查询参数构建、使用暗色主题集合

- isDark 推导简化为 theme == "dark"(None == "dark" 为 False,去掉多余三元表达式)
- _prepare_plugin_page_query_params 改为线性构建,先计算再构建字典
- isDark getter 改用显式 DARK_THEMES Set,替代硬编码单值比较

---------

Co-authored-by: lxfight <lxfight@192.168.5.50>
2026-06-06 00:35:47 +08:00
Rain-0x01_ fbc0633cd3 chore: fix token terminology in zh (#8465) 2026-05-31 21:54:44 +08:00
Misaka Mikoto 90a3a2171a fix: Template config optimization (#8228)
* fix: improve template list config handling

* feat(webui): show template list display item

* feat(webui): allow hiding template list hints

* docs: document template list metadata fields

* fix: support file fields in template list configs
2026-05-30 22:13:09 +08:00
lingyun14 fd4fe84310 fix: docs (#8229)
* Update listen-message-event.md

* Update other.md

* Update send-message.md

* Update ai.md

* Update ai.md

* Update send-message.md

* Update listen-message-event.md

* Delete docs/zh/dev/star/guides/env.md

* Delete docs/en/dev/star/guides/env.md

* Update simple.md

* Update discord.md

* Update discord.md

* Update matrix.md

* Update matrix.md

* Update index.md

* Update index.md

* Update openapi.md

* Update ppio.md

* Update ppio.md

* Update function-calling.md

* Update function-calling.md

* Update config.mjs

* docs: add EN desktop deployment page

* Update plugin.md

* Update ai.md

* Update ai.md

* Update ai.md

* Update desktop.md
2026-05-22 20:35:29 +08:00
lingyun14 ef73d2da33 docs: Clarify and expand the LLM tool registration guidance in the AI plugin documentation (#8178)
* docs(zh/ai): fix misleading tool registration guide and add warnings

* docs(en/ai): add tool registration section with deprecation warnings
2026-05-14 08:58:37 +08:00