diff --git a/.changeset/attach-names-live-conversation.md b/.changeset/attach-names-live-conversation.md new file mode 100644 index 0000000000..9c68a3a955 --- /dev/null +++ b/.changeset/attach-names-live-conversation.md @@ -0,0 +1,5 @@ +--- +"@schlessera/brain-ui-kit": minor +"@schlessera/brain-ui-react": patch +--- +The composer's paperclip now says what its menu offers. The kit `Composer` gains an optional `attachLabel` prop for the attach trigger's accessible name, which defaults to "Attach — photo, camera, files". A pointer sees the same name as a tooltip after 400ms of hover, or at once on keyboard focus. Escape or opening the menu dismisses it, and touch screens never show it. When live conversation is available, the app names it in the trigger ("Attach — live conversation, photo, camera, files") and in the phone attach sheet's subtitle. diff --git a/.changeset/fresh-owner-alias-admission.md b/.changeset/fresh-owner-alias-admission.md new file mode 100644 index 0000000000..9f30b47be0 --- /dev/null +++ b/.changeset/fresh-owner-alias-admission.md @@ -0,0 +1,5 @@ +--- +"@schlessera/brain-ui-server": patch +--- + +A provisional dialogue archive that binds into an existing session no longer gets a second pending-write budget while that bind is in flight (#3215). Both routes that bind it through a fresh owner — binding an inactive conversation, and adopting a provisional chat on a turn's first `session_info` — now count their pending observations and bytes against the archive they merge into. The thresholds, stored records, coverage and wire messages are unchanged; a burst that used to fit under two budgets is now refused at one, as `queue_pressure`. diff --git a/api-report/ui-kit.txt b/api-report/ui-kit.txt index 7b44c69f3e..e352a97382 100644 --- a/api-report/ui-kit.txt +++ b/api-report/ui-kit.txt @@ -833,6 +833,7 @@ signatures (every public export and the types it is made of) onSend?: (value: string) => void; onStop?: () => void; onAttach?: () => void; + attachLabel?: string; onMic?: () => void; mic?: boolean; micLabel?: string; diff --git a/docs/decisions/design-kit/navigation.md b/docs/decisions/design-kit/navigation.md index b3a99ecf24..4a7755bf33 100644 --- a/docs/decisions/design-kit/navigation.md +++ b/docs/decisions/design-kit/navigation.md @@ -38,6 +38,22 @@ The fifth drop answered the eleven questions the maintainer forwarded its reason rather than omitted. The query is a real input. 4. **The composer is kit-owned.** The app's `ComposerView` retires; the app keeps only the attach sheet, the provider list and the handlers. + + > **2026-11-02 — Clarified by #3045 (maintainer ruling of 2026-10-29).** + > The attach trigger's name and pointer tooltip list the menu's current + > actions; live conversation is reached through it. The name always starts + > with "Attach" and, when live conversation is available, reads + > "Attach — live conversation, photo, camera, files"; otherwise + > "Attach — photo, camera, files". The kit `Composer` takes that name as + > its additive `attachLabel` prop and paints it as a tooltip after 400ms + > of hover and at once on keyboard focus, dismissed by Escape or by opening + > the menu, and never under `(hover: none)`. On touch the attach sheet's + > subtitle names the same actions, and instructions say "Tap the paperclip + > (Attach), then Live conversation." A dictating composer's trigger stays + > inert, with no name and no tooltip. This clarifies §4 and the reviewed + > composer detail (capture is a menu behind attach); it adds no separate + > entry, no persistent desktop label and no touch long-press, and the kit + > and the menu keep their ownership. 5. **No snooze on a blocking approval**; "Always allow" has no key. 6. **Focus after the last decision in a list goes to the `EmptyState` heading that replaces the section, with the `InlineToast` receipt above it**; the diff --git a/docs/integration-contract/package-api.md b/docs/integration-contract/package-api.md index b3fc1c3de3..3f8a8d19e4 100644 --- a/docs/integration-contract/package-api.md +++ b/docs/integration-contract/package-api.md @@ -4363,3 +4363,15 @@ packet audio. Unsupported codec/container forms, including audio/mp4, retain conservative elapsed-wall timestamps for the rest of that recording. Old stored wall timestamps remain readable without migration. No field, stop reason or state is added. This semantic change ships in a minor before 1.0. + + + +## Composer attach label (additive, 0.45.0, #3045) + +`ComposerProps` in `@schlessera/brain-ui-kit` gains optional +`attachLabel?: string`, the attach trigger's accessible name. Omitted or empty, +it is "Attach — photo, camera, files" (previously the fixed +"Attach — photo, camera, file"). An actionable trigger also paints that name as +an `aria-hidden` pointer tooltip; an inert trigger, including a dictating +composer's, has neither. Existing props and defaults are otherwise unchanged, +and no wire schema changes. `api-report/` records the added prop. diff --git a/docs/plans/README.md b/docs/plans/README.md index 8c601bfce5..0088f6700a 100644 --- a/docs/plans/README.md +++ b/docs/plans/README.md @@ -19,6 +19,7 @@ because the code has become the better answer to "what does this do". | [navigation-recovery.md](navigation-recovery.md) | Measured navigation reach, cold-session evidence and draft races informing the tracker design. | | [storage-accounting.md](storage-accounting.md) | Proposed local storage ownership, deduplicated capacity and bounded measurement model, with synthetic evidence. | | [voice-conversation.md](voice-conversation.md) | Proposed turn-taking, screen and interruption model; requirements for the later speech-architecture ruling. | +| [eleven-realtime-evaluation.md](eleven-realtime-evaluation.md) | Documentation-stage evaluation of Eleven Realtime v1 Max as a third live-conversation engine, the API choice, the unresolved nonblocking-result question and the prepared live probe. | | [storage-growth.md](storage-growth.md) | Proposed bounded aggregate history, comparable growth and capacity-specific guidance, with explicit policy choices. | | [storage-lifecycle.md](storage-lifecycle.md) | Storage cleanup eligibility, recovery boundaries and synthetic byte-lifecycle evidence for the storage design. | | [host-owned-web-search.md](host-owned-web-search.md) | Pinned MCP/full-extension comparison, offline worker prototypes and authority boundaries for executor selection. | diff --git a/docs/plans/eleven-realtime-evaluation.md b/docs/plans/eleven-realtime-evaluation.md new file mode 100644 index 0000000000..5440bbee9b --- /dev/null +++ b/docs/plans/eleven-realtime-evaluation.md @@ -0,0 +1,229 @@ +# Eleven Realtime as a third live-conversation engine: evaluation + +This is the evaluation for #3100. The question is whether Eleven Realtime v1 Max can +join Gemini Live and GPT-Live behind the existing provider seam +(`LiveConversationSession`, `packages/ui-sdk/src/server/conversation.ts:188-201`) +and (`LiveConversationProvider`, `packages/ui-sdk/src/server/conversation.ts:208-213`), +under the host authority that +[the live-conversation decision](../decisions/live-conversation.md) and +[the voice-permission decision](../decisions/voice-permission.md) set. + +**Verdict at the documentation stage: unresolved.** The vendor documentation +covers streaming audio, transcripts, interruption and native tool-call IDs. It +does not establish the decisive capability: a tool call that does not block the +dialogue and whose exact result, returned minutes later, is spoken in a later +reply. One bounded live probe settles it. Until then, do not schedule a +production adapter. If no probe is authorized, close #3100 as unresolved rather +than as unsuitable. + +The evidence is vendor documentation and pricing, checked on 2026-11-02, plus +the repository source cited here. There were **zero provider calls, zero +credentials and zero audio samples**. No account, workspace rollout, latency, +recognition quality or audibility was tested. Nothing below qualifies a live +behavior. + +## Which ElevenLabs API + +Use the **ElevenAgents native WebSocket** +([`/v1/convai/conversation`](https://elevenlabs.io/docs/eleven-agents/api-reference/eleven-agents/websocket)), +with an agent in Realtime voice mode and one **client tool**, connected from the +server. + +- **Server-owned connection.** The server requests a + [signed URL](https://elevenlabs.io/docs/eleven-agents/api-reference/conversations/get-signed-url) + with its `xi-api-key` and opens the socket itself. The + [WebSocket guide](https://elevenlabs.io/docs/eleven-agents/libraries/web-sockets) + says never to expose the API key client-side. The browser keeps talking only + to the host, as it does for the other two engines, so no credential reaches + it. +- **Client tools keep execution in the host.** A `client_tool_call` carries a + `tool_call_id`. The client answers with `client_tool_result` carrying the same + `tool_call_id`, a `result` string and `is_error`. ElevenLabs runs nothing for a + client tool. Webhook tools, MCP servers and system tools such as call transfer + would let the provider act on its own, so the probe agent configures none of + them. + +**The standalone OpenAI-compatible Realtime endpoint was rejected** +([compatibility guide](https://elevenlabs.io/docs/eleven-agents/guides/openai-realtime-compatibility), +`wss://api.elevenlabs.io/v1/convai/realtime`): + +- The guide covers only a browser holding a short-lived client secret. It says + documentation for server-side OpenAI Realtime SDKs "isn't published yet". That + is a documentation gap, not proof that a server relay fails. It still means a + server relay would rest on undocumented behavior. +- It speaks OpenAI's *Realtime* protocol. Our GPT-Live adapter uses the + different OpenAI Live v1 delegation protocol + (`ENDPOINT`, `packages/ui-server/src/voice/gpt-live-conversation.ts:7`), so + swapping the URL would not reuse that adapter. +- Its [session schema](https://elevenlabs.io/docs/eleven-agents/api-reference/conversations/create-client-secret) + accepts provider-called MCP tools (`server_label`, `server_url`), which the + issue excludes. +- The guide documents no tool-call or execution-mode semantics. ElevenAgents + settings such as `execution_mode` cannot be assumed to carry over. + +## Model, availability and pricing + +| Fact | Source and value | +| --- | --- | +| Model | `eleven_realtime_v1_max`, set as `conversation_config.realtime_model`. "Reasons before it responds, for complex instructions and multi-step tool use." Mini (`eleven_realtime_v1_mini`) is the default. [Realtime models](https://elevenlabs.io/docs/eleven-agents/customization/realtime-models), [models](https://elevenlabs.io/docs/overview/models). | +| Architecture | Cascaded: separate recognition, LLM and speech models, not one fused model ([compatibility guide FAQ](https://elevenlabs.io/docs/eleven-agents/guides/openai-realtime-compatibility)). The pricing page still labels both models "Speech to Speech". | +| Workspace rollout | "Rolling out gradually." An unavailable workspace gets the API error `Realtime models are not available for this workspace.` ([Realtime models](https://elevenlabs.io/docs/eleven-agents/customization/realtime-models)). **Unverified for any workspace.** | +| Residency and compliance | Max: US and EU, plus Zero Retention Mode/HIPAA in the US and EU. Not available in India or Singapore. Mini is not available under Zero Retention Mode. | +| Managed settings | In Realtime mode ElevenLabs picks the LLM, reasoning effort, parallel tool calls, cascade timeout, TTS model and recognition provider. Max needs a token limit of at least 1,024, or none. | +| Model fallback | If the Realtime model is late or fails, "the agent falls back to backup LLMs" ([LLM cascading](https://elevenlabs.io/docs/eleven-agents/customization/llm/llm-cascading)). The cascading guide calls the fallback "automatic and transparent to the end-user", and documents no socket event for it, so the model identity a session actually used is unproven. Whether `backup_llm_config: disabled` turns it off for a Realtime agent is undocumented. | +| Pricing basis | The standard ElevenAgents per-minute rate plus input, cached-input and output tokens at the model's rates ([Realtime models § Pricing](https://elevenlabs.io/docs/eleven-agents/customization/realtime-models#pricing)). | +| Listed rates | [API pricing](https://elevenlabs.io/pricing/api): connected audio $0.080 per additional minute for both models. Max tokens: $1.80 input and $9.00 output per 1M. Mini: $0.20 and $6.00. Burst audio above the concurrency limit costs $0.160 per minute. No cached-input rate is listed. Included plan minutes are labelled estimates. | +| Retention | Transcripts and audio recordings are kept for **2 years by default**. Retention is configurable per agent, and 0 schedules deletion ([retention](https://elevenlabs.io/docs/eleven-agents/customization/privacy/retention)). | + +## The seam against the documented protocol + +Field names come from the AsyncAPI schema in the +[WebSocket reference](https://elevenlabs.io/docs/eleven-agents/api-reference/eleven-agents/websocket) +and the [tool schema](https://elevenlabs.io/docs/eleven-agents/api-reference/tools/create). +"Documented" means the field exists, not that it behaves as described. + +| Seam need | ElevenAgents evidence | Profile value it would support | +| --- | --- | --- | +| `ready` with formats | `conversation_initiation_metadata`: `conversation_id`, `agent_output_audio_format`, `user_input_audio_format`. No model field. | Model taken from configuration; actual model unproven because of the fallback. | +| Input transcript | `user_transcript`: `user_transcript` and `event_id` only. No finality, utterance identity, timing or origin. | `unassigned_input_fragment` with finalization unknown. `finalTranscript`: unsupported. | +| Manual endpoint | No client endpoint message. `user_activity` only holds off agent interruptions. | `manualEndpoint`: unsupported. | +| Output transcript and audio | `agent_response` (`response_id`, `event_id`), `agent_chat_response_part` deltas, and `audio` with `event_id`, an `is_final` last-chunk flag and optional character `alignment`. | `outputWordAlignment`: unproven, since alignment is optional. | +| Interruption | `interruption` (only `event_id`), then `agent_response_correction` with the truncated text. | Separate evidence of interruption and of truncation. `remoteOutputCancelAck`: unproven, because there is no client cancel or acknowledgement message. | +| Work request | `client_tool_call`: `tool_name`, `tool_call_id`, `parameters`, `expects_response`. | `work_requested` with `handle = tool_call_id`. The call is not tied to an utterance. | +| Exact result | `client_tool_result`: `tool_call_id` ("ID of the tool call this result corresponds to"), `result`, `is_error`. | `returnWork` keyed on the native handle. There is no acceptance acknowledgement, so `acceptance: "unknown"`. | +| Exact refusal | `client_tool_result` with `error_type: user_rejected`, which "mark[s] the tool as not having been called". | A candidate for `refuseContextualWork`. Unproven. | +| `quiet` or `when-idle` delivery | No delivery or scheduling control on `client_tool_result`. | Cannot honor `ConversationWorkResult.delivery` natively. | +| Withdrawal | No event withdraws a pending client tool call. | `work_withdrawn` is never emitted, and timeouts are undocumented (below). | +| Close | Closing the socket. No remote close acknowledgement is documented. | `closed` with `remote: "unknown"`. Billing counts connected audio, but the docs do not say when a closed session stops counting. | +| Permission speech | No host exact-copy speech path. | `exactPermissionSpeech`: unsupported. | + +## The decisive question: nonblocking work with a late, exact result + +The issue requires a held lookup to stay pending through three further spoken +exchanges, then return its exact result and have it spoken. The documentation +offers two client-tool behaviors, and each misses half of that: + +- **`expects_response: true`:** "calling this tool should block the + conversation until the client responds with some response which is passed to + the llm" ([tool schema](https://elevenlabs.io/docs/eleven-agents/api-reference/tools/create)). + The [client-tools guide](https://elevenlabs.io/docs/eleven-agents/customization/tools/client-tools) + likewise says the agent "will wait for its response and append the response to + the conversation context". That gives an exact result, but the dialogue blocks. +- **`execution_mode: async`:** "runs the tool in the background without blocking + - best for long-running operations" (tool schema). ElevenLabs' + [orchestration article](https://elevenlabs.io/blog/unpacking-elevenagents-orchestration-engine) + describes Async Mode as for "fire-and-forget operations … where the agent does + not need to reference the result in its reply". That keeps the dialogue going, + but does not say a late result is used. + +`response_timeout_secs` defaults to 20 and accepts 1 to 120, or -1 to "wait for +the client's response indefinitely (requires expects_response)". Four things are +undocumented, and only a live session can answer them: + +1. Whether `execution_mode: async` together with `expects_response: true` is + accepted, and whether the model keeps holding new spoken exchanges while the + call is pending. +2. Whether a `client_tool_result` sent after those exchanges is accepted and + added to the context, and whether it prompts a spoken reply or waits for the + user to speak. +3. What a pending call does when its timeout expires, when the user interrupts, + or when the socket closes. Any of these could leave a native handle pending + with no event for it. +4. Whether a second or stale `client_tool_result` for the same ID is rejected, + ignored or added to the context. + +The fallbacks below would look like success, but none meets the requirement: + +- **`contextual_update`** injects text "without interrupting", with no + `tool_call_id`, so correlation would rest on our wording rather than on a + native ID. Its `context_id` supersession "dropped from the LLM view" earlier + updates, which rewrites provider-held history and conflicts with + [append-only provider history](../decisions/provider-history.md). +- **`user_message`** would make up a user turn that the user never spoke. +- **Filler speech, `pre_tool_speech` and tool-call sounds** cover waiting time. + They are not continued dialogue. + +## Provider-side configuration and disclosure + +Unlike the other two engines, an ElevenAgents session runs an **agent stored in +the vendor workspace**: its prompt, voice, tools and retention live there, and +`conversation_initiation_client_data` can override some of them per +conversation. Before any production work, three things need checks and, +probably, rulings: + +- Brain must own the agent definition and verify at session start that only the + one client tool is configured. A webhook, MCP or system tool added in the + dashboard would bypass host authority. +- The disclosure must state the 2-year default retention of transcripts and + audio, and the per-agent setting it depends on. Zero Retention Mode is + available for Max in the US and EU only. +- Opening an epoch with prior chat history needs a mechanism that keeps + provider history append-only. The documented options are prompt and + first-message overrides at initiation, plus `contextual_update` without a + `context_id`. None was evaluated against the startup-context bounds in the + live-conversation decision. + +## The live probe, prepared but not run + +The probe is outside the ordinary test suite. It needs a maintainer to supply, +through a protected channel: + +- confirmation that the workspace exposes Realtime voice mode, with US or EU + residency; +- an API key restricted to ElevenAgents; +- explicit approval of the caps below. + +**Recommended caps:** Max only. At most 12 sessions, 5 minutes each and 45 +connected minutes in total, and a **US$10 spend limit** across connected audio +and tokens. Connected audio alone at the listed $0.080 per minute is $3.60 for +45 minutes, which leaves the rest for Max tokens. Mini is used only if Max fails +a functional step that Mini could plausibly resolve. + +**Setup:** one temporary agent with retention set to 0, Realtime voice mode on +`eleven_realtime_v1_max`, the backup LLM disabled if the API accepts that for +a Realtime agent, and one client tool `lookup_ledger(query)` with +`expects_response: true`. The tool runs under each `execution_mode` and with +`response_timeout_secs` of 120 and of -1. The fictional lookup is held by the +host and released on command. It returns one Odysseus fact on the pinned +`2026-07-12` date, for example how many oarsmen are rostered on the Ithaca +ship's ledger. + +**Steps, one per acceptance criterion:** + +1. Record the workspace error or success, the model the configuration set, the + residency host and the caps before speaking. +2. Stream server-side audio both ways. Record every `user_transcript` and + `agent_response`, plus the absence of finality fields. +3. Start the held lookup, complete three further spoken exchanges, release it, + send `client_tool_result` with the exact `tool_call_id`, and check whether a + later spoken reply contains the fact. Record local send separately from + provider acceptance, which is unknown. +4. Exercise these controls: release early, send a mismatched `tool_call_id`, send + a duplicate result, deliver a result after the socket is replaced, refuse + with `user_rejected`, interrupt during the pending call, let the timeout + expire, and close with a call pending. +5. Clean up: close the socket, delete the probe conversations, the tool and the + agent through the + [conversation](https://elevenlabs.io/docs/eleven-agents/api-reference/conversations/delete), + [tool](https://elevenlabs.io/docs/eleven-agents/api-reference/tools/delete) and + [agent](https://elevenlabs.io/docs/eleven-agents/api-reference/agents/delete) + delete endpoints, and record the billed usage. + +Keep only sanitized event metadata: types, IDs hashed per probe, timing and +first-failure captures. A listener confirms any claim that the fact was spoken. + +**Reading the result:** if step 3 succeeds under any configuration and step 4 +leaves no pending handle and no stale narration, Eleven Realtime is suitable for +a scheduled adapter. If a late result is refused, ignored or never spoken, it is +unsuitable for the contextual-task path. That holds whatever its other +qualities, and the requirement is not weakened to fit. + +## Keyless preparation still open + +The issue also asks for an evaluation-only adapter on the existing seam and +deterministic tests with a bounded delayed-task fixture. The tests would release +early, mismatch the native ID and deliver a stale result across epochs. None of +that is built. The mapping table above is its specification. Building it before +the probe would mean writing an adapter for behavior that may not exist, so the +probe goes first. If step 3 succeeds, the adapter and its failing-first tests are +the next unit. No contract, capability or schema change is proposed here. diff --git a/packages/ui-kit/src/chrome/Composer.tsx b/packages/ui-kit/src/chrome/Composer.tsx index 621f2554dc..2d2b81f0db 100644 --- a/packages/ui-kit/src/chrome/Composer.tsx +++ b/packages/ui-kit/src/chrome/Composer.tsx @@ -126,8 +126,15 @@ export interface ComposerProps { onSend?: (value: string) => void; /** The stop disc while `streaming`, and `esc` inside the field. */ onStop?: () => void; - /** Opens the app's own capture menu (photo, camera, file). */ + /** Opens the app's own capture menu (photo, camera, files). */ onAttach?: () => void; + /** + * The attach trigger's accessible name, and the pointer tooltip that shows + * it: the actions the app's menu currently offers, in menu order. Starts + * with "Attach" so an instruction naming the control still matches it. + * Defaults to "Attach — photo, camera, files". + */ + attachLabel?: string; /** Opens capture, or stops it while `dictating`. */ onMic?: () => void; /** @@ -141,6 +148,9 @@ export interface ComposerProps { maxRows?: number; } +/** The attach trigger's default name: the capture menu with no live conversation in it. */ +const ATTACH_LABEL = "Attach — photo, camera, files"; + export type ComposerState = "ready" | "streaming" | "reconnecting" | "offline" | "dictating"; export interface ComposerRecall { @@ -218,6 +228,8 @@ export function Composer(p: ComposerProps) { } const field: CSSProperties = { + // The attach tooltip anchors to the field, so it clears a grown field. + position: "relative", flex: 1, minWidth: 0, display: "flex", @@ -302,7 +314,7 @@ export function Composer(p: ComposerProps) {
{showAttach ? ( - + ) : null}