* fix: append steering input as user messages
* fix: group steering input into one user message
* feat: detach pending tools on steering and wake on completion
* fix: continue pending steering after plain replies
* test: decode prepared media file URIs on Windows
* fix: preserve whitespace in steering input
* fix: separate batched steering inputs with newlines
* docs: remove verbose steering implementation details
* fix: preserve Gemini user agents and verify background delivery
* fix: honor realtime segmented replies in QQ group chats
* revert: keep QQ streaming changes out of this PR
* test: align plugin page expectations with view metadata
* fix: preserve background tool permissions and result handling
* fix: retain wakeup ownership and initialize context before appending
* fix: combine background wakeup input into one user message
* test: remove redundant background wakeup coverage
* fix: relax background completion prompt restrictions
* fix: simplify background completion prompt
* docs(plugin-new): change QQ Group
**Chit-Chat Group** change to **AstrBot Plugin & Agent interflow Group**.
* docs: update QQ group information and add community guidelines
* docs(plugin-new): remove group rules
* stage
* refactor: linearize conversation events and reclaim plugin snapshots
* test: adapt master tests to event-context APIs after merge
- test_tool_loop_agent_runner: restore @pytest.mark.asyncio on
test_step_notices_reach_model_once_per_threshold (lost in merge).
- test_cron_manager: give the build_main_agent / runner mocks the
conversation_events field and an awaitable aclose, matching the
event-writer wiring in cron/manager.py.
* style: apply ruff formatting to exclude_ids filter in sqlite.py
* test: adapt gemini/message-tools tests to event-context APIs
- test_gemini_source: fake_retry now accepts request_event_recorder,
matching retry_provider_request's new keyword argument.
- test_message_tools: _DummyRespondEvent exposes conversation_events,
which call_event_hook now reads when emitting the after-send hook.
* fix: merge duplicate chat history translations
* refactor: consolidate plugin conversation APIs
* refactor: bind conversation writers to agent execution context
* refactor: separate conversation migration and display projection
Remove deprecated conversation metadata methods and align architecture and plugin documentation with the current APIs.
* refactor: make conversation writer ownership explicit
Use per-run hooks instead of ambient writer and plugin identity bindings. Require explicit conversation IDs for append APIs and separate persistence from execution context mutation.
* fix: harden conversation event writes and request capture
* refactor: remove legacy checkpoints and unify conversation history
* perf: incrementally project acknowledged conversation events
* refactor: clarify agent event and persistence boundaries
* docs: remove event context design notes
* perf: reduce conversation SQL round trips and support PostgreSQL
* refactor: remove PostgreSQL support while retaining SQL optimizations
* refactor: store raw context once and filter temporary content on replay
* test: retain essential event context regression coverage
* refactor: derive conversation revisions from events
Remove persisted event head, context leaf and replay baseline pointers. Derive positions through indexed queries, migrate existing databases and preserve backup compatibility. Refresh conversation activity at turn settlement instead of every execution event.
* refactor: use compact IDs for conversation events
* feat(provider): add OpenAI Decisions API decision provider
Add an independent `openai_decision` provider backed by POST /v1/decisions.
It reuses DecisionService (ask/choose/yes_no) and never joins the main agent
flow.
- Map boolean/choice/score questions to predicate/choice/score with
generated names; match answers by name, keep full distributions,
confidence, fractional scores and the score legend.
- Send string state as text and dict/list-of-dict state as input_json;
reject state and questions the API cannot express before sending.
- Treat refusals and contract violations as DecisionError; reuse the
existing timeout, concurrency and retry conventions.
- Add the "OpenAI Decisions" config template, manager lazy import,
single-string key validation, WebUI support and i18n hints.
- Document configuration and supported inputs; System One is unchanged.
* fix: clarify OpenAI Decisions model hint
* fix(provider): harden OpenAI decision request handling
* fix(provider): validate decision score consistency
* fix(provider): validate decision question input types
* fix(provider): support list state in OpenAI Decisions
---------
Co-authored-by: Soulter <905617992@qq.com>
* feat(dashboard): foldable plugin config groups with a declarative default state
Plugin config pages rendered every group flat, so a plugin with many fields
turned into one long page where the group you care about was hard to find.
`template_list` already solved this for its own entries, so the same folding is
now available for ordinary config groups in the plugin configuration dialog.
- `object` groups in the plugin config editor can be collapsed from their title:
the whole title row is clickable, the hover highlight fills the card, folding
uses `v-expand-transition`, and the header is reachable by keyboard
(role/tabindex/Enter/Space/aria-expanded). The root plugin config object stays
non-collapsible so dialog titles behave as before.
- Folding is opt-in through the `foldable` prop, which only the plugin config
editor passes. Provider and platform editors share the same component and keep
their flat rendering, so no other settings page changes.
- `collapsed: true` in the schema only decides the initial state: such a group
starts folded, groups without it stay expanded. Folding and "starts folded"
are therefore independent.
- Fold toggles are remembered for the current page instance only, via the
in-memory helper `utils/configFoldState.mjs`: switching configs, reopening the
dialog, or navigating within the page keeps the choice, while a reload follows
the schema again instead of a stale preference. A remembered toggle always wins
over the schema default, and a reloaded plugin schema re-seeds the groups the
user has not touched.
- The plugin config dialog drops the previous plugin's schema before requesting
the new one, so groups can no longer be toggled under a namespace that is still
loading.
- The hover block is painted by a pseudo-element rather than by negative margins,
so the header keeps its layout: its geometry comes from two custom properties
the container publishes, `--config-group-inset` (its own padding) and
`--config-group-radius` (its inner corner radius). Expanded and folded groups
use the same block height; folded groups let the container clip the overshoot
and round the corners. The whole block is only painted, never laid out, so
titles never shift and hovering cannot cover a neighbouring group.
* docs(plugin-config): document the collapsible config groups
Describe the `collapsed` field next to the other schema keys, add a collapsible
group example, and spell out the semantics developers and users can rely on:
every `object` group can be folded, the flag only sets the initial state, the
fold state lasts for the current page, and the outermost config object cannot be
folded.
---------
Co-authored-by: XTsat <XTsat@users.noreply.github.com>
* feat(dashboard): expose theme colors to plugin page bridge
Include the active primary and secondary colors in plugin context updates. Resend context on color edits, resets and theme switches without changing sandbox permissions or forcing plugin styles. Cover reactive Vuetify colors and legacy bridge contexts, and document optional color handling in Chinese and English.
* docs(dashboard): simplify plugin theme bridge guidance
Remove the newly added theme bridge tests and keep the developer documentation focused on available color fields, context updates and fallback behavior.
* docs(dashboard): add concise theme color subscription example
* docs(dashboard): translate theme example comments into Chinese
* 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
* 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>
* 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
* 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.
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
* 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
* 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
* 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.