mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-07 01:21:37 +00:00
* feat(web): persist and send voice input message across session navigation (#1435)
* fix(web): address bot review findings for voice send across session switch (#1435)
* fix(web): resolve teardown, inactive session, send error recovery and mention serialization findings (#1435)
* fix(web): preserve draft initialText on error and handle async cross-session permission lookup (#1435)
* fix(web): preserve session draft on background failure and send via composer delivery policy (#1435)
* fix(web): send dictation directly via API and fix standard dictation language and recording support (#1435)
* trigger CI rerun for voice dictation session switch fixes (#1435)
* fix(web): prevent failed voice sends from clobbering replacement composer text (#1435)
* fix(web): prevent zero-byte recording failure from clobbering replacement composer draft (#1435)
* fix(web): prevent unmount voice transcription, clear draft on send success, and clear partial transcript (#1435)
* fix(web): stop button transcribes into composer without auto-sending; only send button triggers stopAndSend (#1435)
* ci: rerun CI for flaky claudeRemote test timeout (#1435)
* ci: retry flaky claudeRemote test (#1435)
* fix(web): guard dictation send path against attachments/schedule/connecting and protect newer drafts from late overwrite (#1435)
* fix(web): preserve Pi steer delivery mode for background dictation sends (#1435)
* fix(web): include active state in handleSend dependency array (#1435)
* fix(voice): surface MediaRecorder failures instead of transcribing partial audio
A MediaRecorder error can still be followed by dataavailable and stop
with partial bytes, so the previous onstop-only flow could transcribe
and auto-send corrupt audio. Track recorder.onerror and short-circuit
the stop handler: restore the draft and surface an error instead of
transcribing. Add a regression test for error -> dataavailable -> stop.
* fix(web): resume inactive sessions for voice dictation direct-sends
A voice dictation direct-send (mic -> send) posts the transcribed message
straight to the session, bypassing the text pipeline's inactive-session
resume. The hub rejects message POSTs to inactive sessions with 409
session_inactive, so sending to an archived session always failed (while
reopening it first made the same send succeed).
- stopAndSend now accepts { resolveSessionId, onSessionResolved } and
resolves the target session after transcription, before the POST
- HappyComposer allows direct voice sends on inactive sessions when a
resolver is provided (instead of downgrading to a plain stop), and
threads SessionPage's canonical resolveSessionId + handleSessionResolved
(the same ones the text send path uses) into the dictation hooks
- after the message is delivered to the resumed session, the UI
navigates/seeds the live session; failed sends keep the existing
draft-restore + error surfacing
- realtime dictation sends apply the same resolution
* fix(web): satisfy HappyChatContextValue in markdown-a test helper
Upstream 51ae260a added the required showSessionSummaryInChat field to
HappyChatContextValue but missed the markdown-a test helper, so web
typecheck (part of CI) fails at the upstream tip. Provide the field like
the sibling test helpers do.
* fix(web): expose a Send action during connected dictation
The visible composer button becomes Stop-only while dictation is
connected, so mouse/touch users could never reach the session-bound
stopAndSend path in handleSend (keyboard Enter was the only entry
point). Add an explicit Send button next to Stop when dictation is
connected; it routes through onSend('default') so the transcript is
captured to the target session and survives navigation (per #1435),
while Stop keeps its stop-without-sending semantics.
Addresses HAPI bot review on #1436.
* fix(web): hide dictation Send button when direct send is not eligible
The Send button shown during connected dictation only performs a real
send when handleSend's direct-send path runs; with attachments, a
pending schedule, or scratchlist mode it silently falls back to
dictation.toggle() (stop + transcribe). Gate the button on the same
eligibility conditions as handleSend so a visible Send control always
actually submits.
Addresses HAPI bot review (Minor) on #1436.
* fix(web): drop superseded markdown-a test context fix
Upstream merged its own showSessionSummaryInChat fix for the markdown-a
test helper; the duplicate property added for the pre-merge CI break is
no longer needed.
* fix(web): gate dictation direct-send on full attachment state and guard late navigation
- dictationDirectSendEligible now uses blocksScheduling (visible + hidden
persisted + still-hydrating attachment drafts) instead of only the
visible attachments array. An inactive composer keeps persisted
attachment blobs out of the visible array, so the previous check could
expose direct Send, resume the session, and POST only the voice text,
stranding the blobs on the obsolete source session. handleSend's
canDirectSend and the Send-button gate share one helper so they can
never disagree.
- The voice send survives unmount by design (#1435); a send that finishes
after the operator left the source session no longer navigates them
back. handleVoiceSessionResolved only navigates when still on the
source session's page.
Addresses HAPI bot review (Major + Minor) on #1436.
* fix(web): read live route state when a background voice send completes
The previous guard captured the render-time pathname; once the source
SessionPage unmounts, that captured value still points at the source
route, so a voice send that finishes after the operator left would still
navigate them back. Read router.state.location.pathname at callback time
instead (the router instance is stable; its state is always current).
Addresses HAPI bot review (Minor) on #1436.
* fix(web): recover post-resume send failures under the resumed session id
When a voice dictation send fails after the inactive session was already
resumed, the catch path persisted the retryable transcript under the
archived source session id — which the hub has superseded — so the
recovery was invisible on the live session. Save the draft under the
resumed id, and fire onSessionResolved so the operator is taken to the
live session where the retryable text lives. Applies to both standard
and realtime dictation.
Addresses HAPI bot review (Major) on #1436.
* fix(web): snapshot resumed-session draft before the post-resume send
The previous recovery guard read getDraft(targetSessionId) inside the
catch — after the send already rejected — so it compared the current
draft to itself and always overwrote text the operator typed into the
resumed composer while the request was in flight. Snapshot the resumed
session's draft at resolve time instead, so a newer draft is never
clobbered. Applies to both standard and realtime dictation.
Addresses HAPI bot review (Major) on #1436.
* fix(web): preserve both drafts when a post-resume send fails
When the operator typed a newer draft into the resumed composer while
the voice send was in flight and the send then failed, the recovery
guard correctly refused to overwrite the newer draft — but that dropped
the failed voice text entirely. Merge instead: append the failed message
after the newer draft so both remain recoverable. Applies to both
standard and realtime dictation.
Addresses HAPI bot review (Major) on #1436.
* fix(web): merge live composer text into failed voice-send recovery
Failure recovery previously read only the persisted draft store, but
while the composer is mounted its edits live in memory (session storage
is written only on unmount). If the operator typed replacement text
while transcription or delivery was pending, recovery either skipped the
composer restore (persisting only the voice text, which the later unmount
then overwrote) or clobbered the replacement. Recovery now reads the live
composer text when mounted and appends the failed voice text after it,
reseating the composer to the merged draft; the unmounted case merges a
persisted draft written since the snapshot. Applies to recording,
zero-byte, transcription, send, and realtime failure paths in both
dictation implementations.
Addresses HAPI bot review (Major) on #1436.
* fix(web): preserve dictation audio constraints
* fix(web): transfer follow-up drafts after voice resume
* fix(web): merge source drafts on failed voice resume
* Preserve resumed voice drafts and replace recovered composer text
Sample destination/source draft merges at persistence time; use a replacement callback for realtime recovery. Six regressions fail before the fix; 66 focused tests, all five package suites, typecheck and 16 Playwright checks pass.
* Recover delayed voice failures into the current composer mount
Resolve live recovery targets by session identity and update the draft ref synchronously before later unmount. Both standard/realtime remount regressions fail before the fix. 85 focused tests, full package suites, typecheck and 16 Playwright checks pass.
* fix: preserve live composer drafts after background voice success
Use shared transfer sampling for standard and realtime sends; update the mounted destination before navigation and unmount. Verified focused voice/transfer tests, typecheck, all five full package suites (CLI rerun serially), and 16 browser checks.
* fix: retain resumed voice follow-ups and destination attachments
Verified focused regressions, root typecheck, all five complete package suites (environment-sensitive failures rerun serially), and 16 browser checks.
* fix: preserve independent destination drafts during voice recovery
Cross-session recovery always retains destination text and independently merges source follow-ups. Remove destination baseline replacement from both hooks. Verified 72 focused regressions, root typecheck, all five full package suites (Hub rerun serially), and 16 browser checks.
* fix: preserve voice recovery drafts before composer hydration
Expose persisted draft text until hydration and update the text ref synchronously when restoring. Cover both voice modes with a held animation frame and intentional empty text after hydration. Verified 94 focused checks, full package suites, root typecheck, and 16 browser checks.
* fix(web): retain ElevenLabs finalization across navigation
* fix(web): preserve new same-text drafts across pending voice sends
* fix(web): refresh voice send callback after draft hydration
* fix(web): resolve voice destinations from current session activity
* fix(web): give voice direct-sends a localId so agent echoes dedupe
Voice dictation, realtime dictation and the cross-session voice tool sent
through api.sendMessage with localId null. Shared Codex then minted a
random clientUserMessageId for the turn and echoed the user message back
with it; the hub dedupes only on (session, localId), so every voice
message was stored and shown twice.
Route all voice sends through sendVoiceMessage, which mints the same
local-* id useSendMessage uses.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
86 lines
2.9 KiB
JSON
86 lines
2.9 KiB
JSON
{
|
|
"name": "hapi-web",
|
|
"private": true,
|
|
"version": "0.1.0",
|
|
"license": "AGPL-3.0-only",
|
|
"type": "module",
|
|
"scripts": {
|
|
"dev": "vite",
|
|
"build": "vite build && cp dist/index.html dist/404.html",
|
|
"typecheck": "tsc --noEmit",
|
|
"preview": "vite preview",
|
|
"test": "vitest run",
|
|
"test:mermaid-lightbox:e2e": "playwright test e2e/mermaid-lightbox.spec.ts"
|
|
},
|
|
"dependencies": {
|
|
"@assistant-ui/react": "^0.15.21",
|
|
"@assistant-ui/react-markdown": "^0.14.16",
|
|
"@assistant-ui/tap": "^0.9.18",
|
|
"@elevenlabs/client": "0.13.0",
|
|
"@elevenlabs/react": "^0.13.0",
|
|
"@hapi/protocol": "workspace:*",
|
|
"@lobehub/icons": "^5.14.0",
|
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
"@radix-ui/react-popover": "^1.1.15",
|
|
"@radix-ui/react-slot": "^1.2.4",
|
|
"@shikijs/langs": "^3.20.0",
|
|
"@shikijs/themes": "^3.20.0",
|
|
"@tanstack/react-query": "^5.90.12",
|
|
"@tanstack/react-query-devtools": "^5.91.1",
|
|
"@tanstack/react-router": "^1.170.8",
|
|
"@tanstack/router-core": "^1.171.6",
|
|
"@xterm/addon-canvas": "^0.7.0",
|
|
"@xterm/addon-fit": "^0.11.0",
|
|
"@xterm/addon-web-links": "^0.12.0",
|
|
"@xterm/xterm": "^6.0.0",
|
|
"class-variance-authority": "^0.7.1",
|
|
"clsx": "^2.1.1",
|
|
"diff": "^8.0.2",
|
|
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
"html2canvas-pro": "^2.0.4",
|
|
"katex": "^0.16.45",
|
|
"mermaid": "^11.12.0",
|
|
"react": "^19.2.3",
|
|
"react-dom": "^19.2.3",
|
|
"react-markdown": "^10.1.0",
|
|
"qrcode": "^1.5.4",
|
|
"rehype-katex": "^7.0.1",
|
|
"remark-breaks": "^4.0.0",
|
|
"remark-gfm": "^4.0.1",
|
|
"remark-math": "^6.0.0",
|
|
"shiki": "^3.20.0",
|
|
"socket.io-client": "^4.8.3",
|
|
"tailwind-merge": "^3.4.0",
|
|
"workbox-expiration": "^7.4.0",
|
|
"workbox-precaching": "^7.4.0",
|
|
"workbox-routing": "^7.4.0",
|
|
"workbox-strategies": "^7.4.0",
|
|
"workbox-window": "^7.4.0"
|
|
},
|
|
"devDependencies": {
|
|
"@testing-library/jest-dom": "^6.6.3",
|
|
"@testing-library/react": "^16.3.0",
|
|
"@types/hast": "^3.0.4",
|
|
"@types/mdast": "^4.0.4",
|
|
"@types/react": "^19.2.7",
|
|
"@types/react-dom": "^19.2.3",
|
|
"@types/qrcode": "^1.5.6",
|
|
"@tailwindcss/postcss": "^4.1.18",
|
|
"@vitejs/plugin-react": "^5.1.2",
|
|
"autoprefixer": "^10.4.23",
|
|
"hast-util-to-html": "^9.0.5",
|
|
"jsdom": "^26.1.0",
|
|
"postcss": "^8.5.6",
|
|
"remark-parse": "^11.0.0",
|
|
"remark-rehype": "^11.1.2",
|
|
"remark-stringify": "^11.0.0",
|
|
"tailwindcss": "^4.1.18",
|
|
"typescript": "^5.9.3",
|
|
"unified": "^11.0.5",
|
|
"vfile": "^6.0.3",
|
|
"vite": "^7.3.0",
|
|
"vitest": "^4.0.16",
|
|
"@playwright/test": "1.60.0"
|
|
}
|
|
}
|