Combines the P0 event-id fix with the three transport fixes that rewrite the same stream loop; they are not separable in these two files. fix(astrbot): scope stream event ids per request (P0-1 / F-01) `AstrBotStreamMapper` restarts its sequence at zero for every stream, but `seen_event_ids` lives on the client and outlives a request. Event ids were built from `server_instance_id + sequence` alone, so the second message on a connection replayed the first message's ids and every one of its events was discarded as a duplicate: the assistant's reply never reached the UI or the database. Ids now carry a per-request `stream_id`. fix(protocol): serialize model options in camelCase (P1-7b / F-07) `AstrBotModelOption` had no `rename_all`, so the frontend's `isDefault` was always undefined and no model was preselected. fix(net): stop total timeouts from killing streams (P1-1 / F-10) `Client::timeout` runs from the start of the request until the body is finished and keeps counting while `bytes_stream()` is consumed. The 30s desktop-v1 budget therefore tore the long-lived SSE connection down every 30 seconds no matter how healthy it was — heartbeats could not keep it alive — and the 120s AstrBot budget cut off any generation longer than two minutes. Streaming now uses a separate client with no total deadline, detecting a stalled peer with `read_timeout` (which resets on every successful read) plus a TCP keepalive. REST endpoints keep their total deadline. fix(astrbot): decode sse bytes on line boundaries (P1-3 / F-11) Decoding each network chunk with `String::from_utf8_lossy` corrupted any character straddling a chunk boundary. For CJK text that is one replacement character per unlucky chunk, persisted into the message. The stream is now split into lines at the byte level and only complete lines are decoded. fix(astrbot): finalize streams on cancel and error (P2-2 / F-13) Cancellation and every error path returned without a `MessageCompleted` event, leaving the row `streaming = 1` so it rendered as "generating" again after a restart. All exit paths now finalize with `Cancelled` or `Error` and keep the text received so far. Cancelling also no longer flips the connection to Disconnected and back, which was a visible flicker (P3-4 / F-56). Hardening found while reviewing the above: a 64 MiB per-response ceiling (removing the total timeout removed the only bound on a response, and `read_timeout` cannot replace it), and a cursor-based line buffer instead of draining from the front, which was quadratic in the chunk size. Tests drive a real `AstrBotClient` against a hand-rolled HTTP/1.1 chunked-SSE server on a raw `TcpListener`: byte-exact control over chunk boundaries and dropping a socket mid-body without the terminal chunk are not expressible through an HTTP framework, and both are needed here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|---|---|---|
| .forgejo/workflows | ||
| assets | ||
| crates | ||
| docs | ||
| src | ||
| src-tauri | ||
| tests | ||
| .editorconfig | ||
| .gitignore | ||
| .node-version | ||
| .npmrc | ||
| .prettierignore | ||
| AGENTS.md | ||
| AstrBot_Desktop_Codex_Forgejo_Predevelopment_Workflow.md | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CHANGELOG.md | ||
| eslint.config.js | ||
| index.html | ||
| package.json | ||
| playwright.config.ts | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| README.md | ||
| rust-toolchain.toml | ||
| tsconfig.app.json | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
| vite.config.ts | ||
AstrBot Desktop
AstrBot Desktop is a Windows companion and local-assistance client built with Tauri 2, React, TypeScript, Vite, and Rust.
The MVP supports two isolated active AstrBot connection slots:
companionfor chat, proactive messages, voice, and game companionship;operationsfor user-authorized, policy-controlled diagnostics and recoverable file operations.
Security boundaries
- Credentials remain in Windows secure storage and are never exposed to React.
- Server tool requests are proposals; the Rust policy layer makes the final decision.
- The application does not provide arbitrary PowerShell, CMD, or shell execution.
- NAS transfers use
plan -> dry run -> copy -> verify -> commitand preserve source files on failure.
Current phase
The repository is in the P00 bootstrap and high-risk Spike phase. See docs/implementation-plan.md and docs/progress.md.
Authoritative documents
AGENTS.mddocs/01_Architecture_Design.mddocs/02_Codex_Implementation_Tasks.mdAstrBot_Desktop_Codex_Forgejo_Predevelopment_Workflow.md
Development prerequisites
- Windows 11
- Node.js and pnpm
- Rust stable with the MSVC target
- Visual Studio 2022 Build Tools with Desktop development with C++
- WebView2 Evergreen Runtime
Local commands
pnpm install --frozen-lockfile
pnpm check:frontend
pnpm test:e2e
pnpm rust:fmt
pnpm rust:clippy
pnpm rust:test
pnpm rust:check
pnpm tauri:dev
pnpm tauri:build
On Windows, Cargo build output can be redirected away from a NAS workspace:
$env:CARGO_TARGET_DIR = "$env:LOCALAPPDATA\Temp\AstrBot-Desktop-target"
The 30-minute connection soak and the controlled Windows UIA/capture smoke are ignored by the normal suite and must be invoked explicitly as documented in tests/README.md. The UIA/capture smoke opens only a generated, non-sensitive standard dialog and never writes captured pixels to disk.
P00 results and unresolved environment boundaries are recorded in docs/spikes and docs/progress.md.