提交图

48 提交

作者 SHA1 备注 提交日期
50c75b1105 fix(pet): show the floating pet, and take the card out from behind it
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
Switching the pet to the floating desktop mode made it vanish.
close_pet_window destroys the window rather than hiding it, and the app
closes it on startup whenever the pet renders inside the UI, so opening
the floating pet always went through the rebuild path — which honours
the config's `visible: false` and never showed what it had just built.
Only the already-exists path called show() and placed the window. Both
paths now share one helper.

The in-app pet also sat on an opaque card: .app-pet-overlay
.pet-window-embedded painted a 92% gradient with a border and a drop
shadow over a base class that is transparent. Verified against the real
stylesheet — the backdrop now computes to no image, no colour, no
border and no shadow, with the drag box unchanged at 188x226.

Also record the state of voice chat, window awareness and game
companionship, all three of which are in the declared product scope but
largely unwired: the voice path uses a Web Speech API that WebView2 does
not provide and points away from the architecture's server-side STT
design, the window capture and UI automation modules exist in Rust with
no command registered and no route to the companion, and game mode
toggles a window preference and produces no data at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 04:13:32 +08:00
1eba70d292 feat(chat): give the conversation the height the header was using
一些检测仍在等待运行
ci / Windows Tauri build (push) Waiting to run
ci / Portable quality checks (push) Waiting to run
The chat panel opened with three stacked blocks above the messages: a
title and subtitle naming the panel, a strip repeating the profile id,
session id and connection state, and the session pills. Only the last
carried anything the reader needed.

Move the slot tabs into the window title bar and delete the rest. The
tabs go there through a portal rather than by lifting state into the
shell, which keeps the slot selection and its status polling in the
panel that owns them; the quick chat and bubble windows have no title
bar, and they are slot-fixed already, so the tabs simply do not render
there.

The connection actions move onto the session row, which costs no height
because that row already exists. 刷新 is dropped: the status refreshes on
a 500ms poll, so the button did nothing the panel was not already doing.
重连, 断开 and 新对话 stay, since losing them would leave no way to
recover a dropped connection or start a conversation.

The panel now puts 82px above the messages instead of three blocks. The
title-bar rules carry [role="tab"] on purpose — the panel's own
.chat-slot[role=tab] rule sets a 2.75rem minimum and sits later in the
sheet, so an unqualified selector loses to it and the tabs overflow a
44px bar.

Verified against the real stylesheet: tabs 33px inside a 44px bar,
vertically centred, clear of both the title text and the window
controls; the removed blocks are absent from the DOM.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 03:59:29 +08:00
ca65c465b9 refactor(chat): drop the speaker name from the message bubble
The bubble header repeated what the avatar and the side of the bubble
already say. Removing it leaves the header holding only the generating
indicator, so it is rendered only while a reply is streaming.

The name moves into the avatar as a clipped label rather than
disappearing: the avatar's glyph is aria-hidden, so without it a screen
reader would announce nothing at all for the speaker.

Verified against the real stylesheet: avatar and bubble tops differ by
0px for both roles, the glyph stays centred in a 32px avatar, the label
measures 1x1, and the bubble no longer contains the name.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 02:37:36 +08:00
0b4a7de62a fix(astrbot): resolve an attachment's type from its bytes when needed
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
An attachment downloaded and then rendered as a broken image. A blob URL
is decoded according to the blob's type, so handing the webview
application/octet-stream makes img refuse bytes that are a perfectly
good PNG — and octet-stream is exactly what the client substitutes when
the server names no type.

Prefer a concrete image type from the server, otherwise identify the
format from its leading bytes. Every signature checked is a fixed marker
at a fixed offset, so this reads no user content, and a JSON error body
served with HTTP 200 is deliberately not mistaken for an image.

Whether that was the cause is not yet established, so the alternative is
made self-diagnosing rather than guessed at. The download outcome —
status, the type the server gave, the type the bytes indicate, and the
length — is now traced, and the frontend reports why an attachment did
not render instead of leaving a bare broken-image icon: a failed
download shows its error, and a payload the browser cannot decode says
so. Both paths were previously swallowed.

Refs: N-6.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 02:29:33 +08:00
529357523c feat(chat): follow the newest message in the conversation
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
The message list had no scroll code at all. Opening a conversation
landed at the top of the history, and every message sent or received
appeared below the fold, so reading a reply meant scrolling down by
hand each time.

Scroll to the tail when the rendered messages change and when the slot
or session changes. Following stops as soon as the reader scrolls more
than 80px away from the bottom and resumes when they return, so reading
back through history is not interrupted by an arriving delta.

scrollTo carries the smooth behaviour but is not universally available —
jsdom has none — so it falls back to assigning scrollTop.

Refs: F-44 (audit P2-28).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 02:21:30 +08:00
79dbb40a25 feat(profiles): reduce the connection form to what a connection needs
Adding an AstrBot connection asked for eleven fields. Three of them
reach nothing: the SSE URL has no consumer anywhere in networking (the
desktop transport builds its own endpoint and AstrBot never reads it),
the certificate fingerprint is stored but TLS pinning is not
implemented, and the role only decides a word in the profile list.

The form is now the four things an activation actually requires — server
address, adapter id, API key, slot — with everything else behind a
collapsed advanced section.

The adapter id is the remote username. It was previously entered twice,
once in the profile form and again in the credential card, and it is
what keeps two slots on one server from sharing a conversation, so the
field now says that.

Three values are derived rather than asked for. The display name falls
back to identity@host. The role follows the chosen slot. The insecure
HTTP approval appears only for an http:// address and is required there,
because normalize_url rejects such an address without it — showing it
unconditionally invited enabling it for an https:// endpoint that never
needed it.

Choosing a slot now does the whole job: it assigns the slot, sets the
role, and points startup auto-connect at it, replacing a separate slot
card interaction and a separate auto-connect slot dropdown that could
disagree with each other. The API key is enrolled in the same submit.
Both steps need the profile to exist, so they run after the save and
report their own failures rather than failing the save.

Verified in a browser against the real stylesheet: four fields plus a
collapsed advanced section, the insecure checkbox appears only for
http:// and carries required, and the display name placeholder resolves
to identity@host.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 01:41:42 +08:00
ef8bc430d9 chore(format): normalize ProfileManager line endings
The file held 603 CRLF and 85 LF-only lines, while .editorconfig and
prettier both pin LF. Any substantive edit therefore produced a
whole-file diff that buried the actual change, which is why the fix
queue carries a standing warning about this file.

Isolated on purpose: `git diff --ignore-cr-at-eol` on this commit is
empty, so it can be reviewed as whitespace and the form rework that
follows reads as logic alone.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 01:33:49 +08:00
779ffc3d55 fix(tauri): grant the window controls the permissions they call
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
The minimize, maximize and close buttons did nothing. They were wired
correctly; the ACL rejected them. core:default resolves to
core🪟default, which grants only read-only queries — is-maximized
is in it, which is why the maximize icon tracked state correctly, but
minimize, toggle-maximize, close and start-dragging are not. Both
windows are decorations: false, so with close denied the main window
could not be closed at all except through the tray.

Add two capabilities rather than widening the shared one: the main
window gets the four controls it draws, and the pet window gets dragging
alone, since it is moved by dragging its body and must not be able to
close or resize itself.

Every one of these calls was a bare void expression, so the rejection
was swallowed and looked identical to an unwired button. Route them
through a helper that reports the failure in the shell error banner.

This is the second time a missing capability has surfaced as a silent
no-op — the pet window previously had no entry at all. Add tests that
read the shipped capability files and assert each permission the UI
calls is granted to the window that calls it.

Also translate the TypeError the Tauri shim throws outside the
application into a sentence a user can act on. The dev server is
reachable at 127.0.0.1:1420, so opening it in a browser and hitting save
produced "Cannot read properties of undefined (reading 'invoke')".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 01:19:42 +08:00
0bfd12ed1a fix(pet): surface context menu failures instead of swallowing them
Right-clicking the pet showed the native WebView menu and never the
application's own menu. The handler was a bare void invoke(...) with no
catch, so any failure to build or pop the menu was completely invisible
and indistinguishable from preventDefault not taking effect.

Report the error in the pet window and stop propagation as well as the
default action. This does not yet explain which of the two is happening
— it makes the difference observable, which is the prerequisite for
fixing the right one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 00:59:20 +08:00
fa48a21e65 fix(chat): repair the message row layout and action buttons
Three defects reported from real-machine testing, all rooted in the same
few conflicting CSS blocks, so they are fixed together — separating them
would leave intermediate states that render worse than either end.

The action buttons showed wrapped vertical text inside a 2rem box.
styles.css already defined .message-action-label, a clip-rect
screen-reader-only class clearly written for these buttons, but nothing
in the tree ever used it: ChatPanel rendered a bare span. Wire the class
up so the buttons are icon-only, and drop the border so they read as
plain icons rather than pills.

.chat-message-actions and its buttons were defined five times across the
stylesheet, three of those styling them as bordered pills that the final
block then partially overrode. Remove .chat-message-actions button from
the three pill rule groups and the small-screen grid rule, leaving one
definition next to .message-action-icon. .chat-runtime-actions and
.chat-stop-button keep the pill treatment; they are different controls.

The avatar rendered below its bubble instead of beside it.
.chat-message-row used align-items: flex-end, and .chat-message-content
is taller than the bubble because the action bar reserves a row, so the
avatar was pinned to the bottom of that taller box. Align to the top.

Removing visibility: hidden from the hidden action bar also closes F-40
(audit P2-24): visibility removed the buttons from the tab order, so
:focus-within could never fire and a keyboard user could never reveal
them. Opacity alone keeps them focusable.

Verified against the real stylesheet in a browser: avatar and bubble
tops differ by 0px, the button computes to 34x34 with 0px border, the
label measures 1x1, and focusing a button takes the bar from opacity 0
to 1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 00:59:11 +08:00
49dccc5eac fix(chat): scope draft, attachments, and errors per slot
The composer draft, the pending attachment list and the error banner
were single values shared by both slots. Uploading on companion and
then switching to operations routed the companion instance's
attachment ids into the operations instance, the operations error
banner stayed visible on the companion tab, and a half-typed message
followed the user across tabs.

Make all three Record<ChatSlot, ...>, mirroring the sending,
unreadCounts and storedSessions state that was already per slot. Every
asynchronous action now pins its slot at the start, so an upload or a
send that resolves after the user switched tabs still lands on the slot
it belonged to.

Splitting the error state is required rather than incidental. refresh()
runs every 500ms and wrote the shared error on failure and cleared it on
success, so any send or upload error was silently wiped within half a
second. The polling failure describes the IPC channel rather than a
slot, so it keeps its own runtimeError; slotError is owned solely by
user actions and takes precedence when both are present.

All three new tests were checked against a mutation that reads the
companion slot regardless of selection, and all three fail under it.

Refs: F-16 (audit P1-11).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 00:28:27 +08:00
124cf32fa2 fix(ui): release tauri event listeners on unmount
All four listen() call sites assigned the resolved unregister function
unconditionally. When the effect was cleaned up before the promise
settled, that assignment landed on a dead closure and the listener was
never unregistered. React StrictMode mounts, cleans up and mounts again,
so the first listener leaked on every development mount. In ChatPanel
that meant applyRuntimeEvents ran twice per event and, because a delta
is appended to the existing content, every character of a streamed reply
was doubled.

Track whether the effect is still live and unregister immediately when
the promise settles late. Each site also gains a catch, since these were
all bare void listen(...).then(...) chains — a rejected listen, such as
the missing desktop-pet capability, became an unhandled rejection rather
than anything observable.

The listener mock in src/test/setup.ts resolved eagerly, which made the
race impossible to express. Replace it with a controllable double in
src/test/tauriEvent.ts that defers resolution until the test asks for
it, tracks each registration separately, and only dispatches to handlers
that have not been unregistered. The registry is plain module state, so
setup.ts resets it after each test.

ChatPanel had no test file; this adds one. Both new tests were checked
against a mutation restoring the old assignment, and both fail under it.

Refs: F-15 (audit P1-10).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 00:23:42 +08:00
5ecfaa433b fix(pet): restore prettier formatting in the sprite error branch
Commit 41592e2 shortened the localized fallback string but left the
ternary wrapped across three lines, which prettier now collapses. This
file passed `prettier --check` at 785f125 and failed afterwards, so it
is the only formatting regression introduced by the R1/R2 batch.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 00:00:33 +08:00
41592e2504 fix(ui): restore corrupted localized strings
Historical UTF-8 corruption left question-mark runs in user-visible copy and in
one accessible name: the sprite load failure message, the canvas context
failure message, the pet window's `aria-label`, and the page loading state.
A separate spot had the "desktop floating" option label hard-coded as numeric
HTML entities.

Refs P1-17 / F-09.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 22:31:44 +08:00
828f7c586d fix(chat): accept null in runtime event contracts
Rust serializes `Option<String>` without `skip_serializing_if`, so absent
fields arrive as `null`. Zod's `.optional()` accepts only `undefined`, so
`safeParse` failed and three chains silently died:

- `boundRuntimeEventSchema.sessionId/messageId`: desktop-v1 and mock events
  carry no session id, so every one of them was discarded; AstrBot error and
  heartbeat frames were discarded too.
- `remoteChatSessionSchema.displayName/updatedAt`: one null field threw for
  the whole array, leaving the remote session list permanently empty.
- `astrbotModelOptionSchema.name`: a null name failed capability parsing,
  which permanently disabled the file upload button.

The sibling `slotRuntimeSnapshotSchema` in the same file already used
`.nullish()` throughout, which is what makes this look like a miss during the
de-enveloping change rather than a deliberate choice.

`formatSessionTime` widens with it: `updatedAt` is now `string | null` and the
existing falsy guard already handled null.

Refs P1-7a / F-06.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 22:31:44 +08:00
e8d9dbc8f6 refactor(ui): share ipc error formatting
Tauri rejects `invoke` with the deserialized Rust error value, which for
`RuntimeCommandError { code, message }` is a plain object rather than an
`Error`. Nine call sites used `reason instanceof Error ? reason.message :
String(reason)`, so every send, reconnect, stop, and settings failure showed
the user `[object Object]`.

`ProfileManager` already had a correct implementation; this lifts it into
`src/lib/errorMessage.ts` and routes the other call sites through it. The
module also exports `isCancelledError`, which a later batch needs to tell a
deliberate stop apart from a real failure.

Refs P1-16 / F-08.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 22:31:16 +08:00
051b9ced6a fix(chat): restrict markdown link protocols
Assistant messages come from a remote AstrBot instance and are untrusted, but
the markdown renderer passed the href through verbatim, so `javascript:` and
`data:` URLs reached an anchor. Inside this webview, script execution has
access to the full Tauri IPC surface.

Links are now resolved with `new URL()` and only http/https/mailto survive;
anything else renders as the original plain text. Relative hrefs are rejected
too rather than being presented as absolute links against the placeholder base.
`rel` gains `noopener`.

The helper lives in `src/lib/` rather than beside the component because a
non-component export in a component module fails `react-refresh` under the
repository's `--max-warnings 0` lint gate.

Refs P1-15 / F-05.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 22:28:46 +08:00
28ec3001ac fix(pet): correct manifest image pattern
The manifest filename pattern used `\.` inside a regex literal, which matches
a literal backslash followed by any character, while the surrounding character
class already excludes backslashes. Every valid pack was rejected, including
the one bundled in this repository, so pack import was entirely unusable.

Adds a test that parses the bundled manifest so the pattern cannot regress.

Refs P1-12 / F-02.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 22:28:34 +08:00
f61f44021b chore(roadmap): sync roadmap status and acceptance gate 2026-07-22 03:09:35 +08:00
d100da324d fix(chat): prevent duplicate history on session switch
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-22 02:52:31 +08:00
02dfb618b9 refactor(ui): complete desktop frontend redesign 2026-07-22 00:27:06 +08:00
ea332257ac feat(chat): advance Q10-Q15 experience
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-21 15:25:11 +08:00
ceb7512bf2 feat(desktop): complete Q9 chat and stability increment
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-21 14:43:14 +08:00
92ad44d327 fix(pet): add stable desktop rendering and context menu
一些检查失败了
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
ci / Portable quality checks (pull_request) Has been cancelled
ci / Windows Tauri build (pull_request) Has been cancelled
2026-07-20 20:50:27 +08:00
16b66d3435 fix(pet): render sprites reliably in transparent window
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 17:44:50 +08:00
610e21c995 fix(pet): resolve bundled sprite asset directly
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 17:28:56 +08:00
6adf752c3a feat(pet): integrate attributed pixel sprite pack
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 17:20:43 +08:00
68614824c0 feat(pet): bind companion actions to runtime state
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 17:00:42 +08:00
74fe19f7e4 feat(auth): handle jwt expiry and relogin state
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 16:52:29 +08:00
7dae4898cb feat(pet): separate remote identity and add paper pet window
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 16:28:42 +08:00
b2856ce075 feat(auth): add dashboard jwt login
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 16:12:11 +08:00
058bfc7029 feat(identity): add jwt and paper pet actions
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 15:55:36 +08:00
95317d62d8 fix(ui): clean status bubble labels
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 15:02:19 +08:00
06e0b411ea feat(chat): add remote session navigation
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 14:32:07 +08:00
bcaebee6f3 feat(chat): add model and attachment interfaces
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 13:30:29 +08:00
cbe88dd592 feat(ui): split main shell into navigable pages
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 12:58:42 +08:00
1828c6183a feat(pet): validate local pet pack manifests
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 12:36:20 +08:00
4f13581809 feat(desktop): configure quick chat and bubble routing
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 12:34:56 +08:00
9f235a34e2 feat(chat): add main layout focus modes
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 12:30:12 +08:00
e0b48c0a5c feat(chat): persist sessions and unread state
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 12:25:08 +08:00
2e84ea52e9 feat(connection): auto-connect configured slots
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 12:01:18 +08:00
3d1d962461 feat(chat): add AstrBot dual-slot chat foundation
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
2026-07-20 11:31:41 +08:00
34a563c65b feat(connection): validate auto-connect and guard operations switches
Add configuration-only auto-connect rules, runtime operations slot lock
while tasks are active, and duplicate server-instance warnings without
silent Profile merge. Surface policy status to the settings UI and cover
the new boundaries with Rust and Vitest checks.
2026-07-20 00:49:15 +08:00
bcc08cf29c feat(connection): add persistent dual slot assignment 2026-07-19 21:37:10 +08:00
907a8a38da feat(profile-ui): add basic profile management 2026-07-18 23:36:59 +08:00
ed743422b5 feat(foundation): add persistent bootstrap safeguards 2026-07-18 22:17:29 +08:00
69b432b6ed test(p00): add frontend browser rust and windows checks 2026-07-18 20:42:40 +08:00
01607c69ff feat(p00): add Tauri desktop spike foundation 2026-07-18 20:34:47 +08:00