# Praxis AI Composer Attachments Quick Replies

> Use when implementing, auditing, or consuming `@praxisui/ai` composer submission, quick replies, recommended intents, clarification continuation, pasted/selected attachments, safe attachment forwarding, edit/resend/feedback actions, governed provider-backed audio transcription, MediaRecorder capture, or optional browser speech compatibility.

- Skill: `codexrodrigues/praxis-ai-composer-attachments-quick-replies` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx get-skill add codexrodrigues/praxis-ai-composer-attachments-quick-replies`
- Raw SKILL.md: https://api.skillmd.com/api/skills/codexrodrigues/praxis-ai-composer-attachments-quick-replies/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: codexrodrigues (https://skillmd.com/u/codexrodrigues)
- Updated: 2026-11-15
- Page: https://skillmd.com/skills/codexrodrigues/praxis-ai-composer-attachments-quick-replies

---


# Praxis AI Composer, Attachments, And Quick Replies

The composer captures local interaction and renders backend-authored choices. It must preserve structured evidence and turn state without becoming an intent router, uploader, persistence layer, or patch authority.

## Owner Flow

`PraxisAiAssistantShellComponent` owns accessible input, display, file/paste events, object-URL cleanup, optional voice UX, and emits typed actions. `PraxisGovernedAudioTranscriptionService` owns browser audio capture and delegates transcription to `AiBackendApiService`; it does not own provider routing. `assistant-quick-reply.utils` preserves a reply's canonical value and structured metadata. `AgenticAuthoringTurnClientService` maps backend stream quick replies, pending clarification, preview, patch, diagnostics, and consultative catalog answers into shell turn results. `PraxisAssistantTurnOrchestratorService` owns submit/clarification/edit/resend/retry/cancel state and stale-artifact reset. Backend contracts own semantic intent, canonical actions, decisions, risk, clarification authority, upload references, provider transcription, and apply authorization.

Read `projects/praxis-ai/AGENTS.md`, the README voice section, `docs/voice-transcription-platform-investigation.md`, shell types/component/tokens, quick-reply utility, turn models/orchestrator, context snapshot models, both speech services, `AiBackendApiService.transcribeAudio(...)`, and focused specs. Use `praxis-ai-turn-orchestration-transport` for turn/stream state, `praxis-ai-shell-session-context` for snapshots or serializable attachment summaries, and `praxis-ai-backend-config-contracts` for the governed transcription endpoint.

## Structured Continuations

- Streamed quick replies are accepted only when they have stable `id` and `label`, then mapped into shell types with `kind`, `prompt`, description, icon/tone, `presentation`, `contextHints`, `canonicalAction`, `semanticDecision`, and `value`. Do not fabricate missing identity or infer a route from display text.
- A quick reply preserves `id`, `value`, `rawValue`, `displayPrompt`, `contextHints`, `canonicalAction`, `semanticDecision`, description, and presentation. Clone structured objects before handing them between UI/turn state so later mutation cannot change a submitted continuation.
- Its canonical submitted prompt is the nonempty string `value`, falling back to `prompt`; the visible label is only display text. Never route by label, translated copy, regex, aliases, `includes`, resource-path fragments, or hidden commands.
- Treat direct `quickReply.semanticDecision` as the only quick-reply field that may become
  `activeSemanticDecision` for the next request. A `semanticDecision` nested inside
  `contextHints` is carried as context evidence for the backend, but it must not be promoted to
  active decision or inherited by a later free-form prompt. This protects backend-authored choices
  from hint-only or forged context payloads.
- In clarification state call the canonical clarification path and preserve the pending clarification lineage. Outside it, submit a typed action carrying structured context. A free prompt must not inherit a quick reply's semantic decision.
- Recommended intents are governed opportunities, not local permissions. Their current action kinds are `submit-prompt`, `start-review`, `open-guidance`, or an explicit custom kind; preview/apply still requires backend semantic resolution and contract gates.
- Consultative catalog answers may include quick replies without forcing clarification. Preserve the backend's consultative/clarification distinction instead of treating every quick-reply list as a required user decision.
- Presentation helpers may format server-provided details, icons, tone, resource labels, and evidence. They cannot turn hints into authorization, canonical target selection, or a new semantic route.
- Prefer `presentation.kind`, `canonicalAction`, `semanticDecision`, `value`, and explicit `contextHints`
  when classifying quick-reply UX. Any residual `id`/`label`/`prompt` matching must remain a display-only
  compatibility fallback for icon, tone, badge, chip, or description, never the source of continuation intent,
  selected resource, capability, apply authority, or backend route.
- `displayPrompt` is conversation copy only. The canonical continuation is the structured action plus the
  submitted `value`/`prompt`; do not persist or replay `displayPrompt`, label text, ARIA text, or tooltip details
  as semantic evidence in history, context snapshots, or a later turn.

## Attachments, Messages, And Voice

- Shell attachments may temporarily hold `File`, `source` (`paste`, `file-picker`, or `host`), `status`, and owned `previewUrl` for local UX. Emit them to a host adapter; do not upload, persist, or put raw handles, bytes, base64, blob URLs, or file payloads into assistant context or backend turns.
- Backend-facing context uses only serializable safe summaries or a contract-owned upload reference. A new upload requirement belongs to the canonical backend/files contract, not a composer workaround.
- Image attachments created by paste or file picker receive an owned object URL. Revoke owned preview URLs when attachments are removed, detached, or the shell is destroyed. Preserve host-owned URLs and do not revoke an URL still used by active attachments.
- Edit/resend branches from the selected user message and clears stale quick replies, preview, pending patch, diagnostics, clarification, and apply state before the replacement turn. Retry/cancel follow the orchestrator's same reset authority.
- Feedback is write-only evidence linked to assistant/status/error observation IDs; it cannot mutate a semantic decision or applied result without backend acknowledgement.
- `voiceInputMode="governed-transcription"` is the enterprise/provider-backed path. Capture with `getUserMedia` plus `MediaRecorder`, select a supported audio MIME type, and post the resulting blob through `AiBackendApiService.transcribeAudio(...)` to the canonical Config endpoint with normal tenant/user/environment scope and credentials. Angular must never call a provider directly.
- For host-wide voice policy, provide `PRAXIS_ASSISTANT_VOICE_INPUT_MODE` (default `disabled`) and optionally `PRAXIS_ASSISTANT_VOICE_LANGUAGE`. The shared shell and the Page Builder `agenticAuthoringVoiceInputMode` / Table `aiAssistantVoiceInputMode` inputs inherit that mode; an explicit `disabled` input overrides the host policy. Reuse this inheritance instead of adding per-screen microphone implementations or enabling browser speech as an automatic fallback.
- Before governed capture, check browser capture support and `GET /api/praxis/config/ai/transcriptions/capabilities` through the official client. Only `{ available: true }` permits requesting microphone access. Missing, false, failed or unauthorized discovery must not start capture. This is local backend configuration readiness, not provider connectivity/quota proof; chat status is not voice availability.
- Bind each capture to the existing enterprise authority before readiness and keep it valid through permission, recording, upload and insertion. Observe canonical context invalidation/version and discard results when tenant, user, profile, session or owner changes. Reuse the runtime context service; comparing display labels or only request headers cannot prove cookie/session identity. A configured corporate host without a ready context must not capture. Header-only hosts need explicit scope and cannot claim detection of unobserved external cookie changes.
- Verify Angular injector ownership: session transport, voice client and capture must observe the same canonical runtime authority. A root session service invalidating one context while a route provides another is not isolation. Prove root/route composition with real DI, not a single stub shared artificially by every consumer.
- A canonical Page Builder owner/session reset must invalidate active voice even when state remains idle. Normal draft edits must remain editable and must not cancel recording. Test both paths; keep cancellation local to each shell.
- Governed transcription returns editable prompt text only. Trim and append a valid transcript without auto-submitting, resolving intent, starting a turn, granting apply authority, or treating provider/model metadata as semantic evidence. The user must review or explicitly submit the normal backend semantic-resolution turn.
- Stop every `MediaStreamTrack` after stop, cancel, error, mode change, or teardown. Preserve unsupported, permission-denied, aborted, no-speech, capture, HTTP, and empty-transcript outcomes without exposing raw provider errors. Invalidate late captures through the shell capture sequence so a stale result cannot alter the prompt.
- Keep capture sessions isolated across permission, recording and upload. Cancellation must settle the pending capture immediately, stop tracks arriving after a cancelled permission request, detach recorder callbacks and unsubscribe an in-flight upload. A late permission or HTTP result cannot affect a newer session. Unsubscribing browser HTTP does not prove that a paid provider operation stopped remotely.
- `PraxisGovernedAudioTranscriptionService.transcribe(options, onRecording?)` keeps the recording callback optional; call it only after permission succeeds and `MediaRecorder.start()` completes. Use it for the shell recording state, distinct from checking readiness, waiting for permission and transcribing after stop.
- Keep the microphone a standard shared icon button with a 44px interaction target beside Send; place attachments on the left. Use the microphone to stop an active recording, disable it during readiness/permission/transcription, and expose a separate Cancel dictation control throughout busy voice states. Reserve a status row with pending spinner and a stable recording label plus elapsed time. Keep the timer outside the polite live region and hidden from assistive technology; stop its interval on stop, completion, cancellation, error, mode/turn change and teardown.
- Preserve focus ownership: if a pending state disables the focused microphone, move focus to the separate cancel control. On completion/cancellation restore the microphone only when focus still belongs to the voice controls. Never steal focus from the editable draft or another control; Escape cancels from anywhere inside the panel.
- `browser-speech` is an explicit compatibility option for approved low-risk environments, not the enterprise/default architecture. It keeps the same no-auto-submit, stale-result, cleanup, accessibility, and normal semantic-resolution rules.

## Contract Inventory And Impact

Before fields/events, inventory existing shell types, context snapshot, upload contract, manifests, actions, capabilities, clarification/turn contracts, diagnostics, and backend tools. Classify `ja-suportado-so-ux`, `ja-suportado-mal-nomeado-ou-mal-materializado`, `suportado-parcialmente`, or `lacuna-real-de-contrato`. Only a real gap permits a public payload, upload route, or local storage addition.

Public shell/type changes require the AI build, direct consumer and local-AGENTS E2E proof. For source/manifest/docs changes, review AI registry and public docs artifacts; state explicitly when they are unaffected.

## Validation

```sh
npm exec -- ng test praxis-ai --watch=false --progress=false \
  --include='projects/praxis-ai/src/lib/ui/assistant-shell/assistant-shell.component.spec.ts' \
  --include='projects/praxis-ai/src/lib/core/models/assistant-context.models.spec.ts' \
  --include='projects/praxis-ai/src/lib/core/services/assistant-turn-orchestrator.service.spec.ts' \
  --include='projects/praxis-ai/src/lib/core/services/ai-backend-api.service.spec.ts' \
  --include='projects/praxis-ai/src/lib/core/services/browser-speech-transcription.service.spec.ts'
```

When `PraxisGovernedAudioTranscriptionService` changes, require its focused
MediaRecorder lifecycle spec in addition to the shell and backend-client specs.
If that spec is absent, record a platform test gap rather than treating the
browser-speech fixture as equivalent proof.

For voice policy changes, prove inherited host mode in the shell and a direct consumer, explicit `disabled` override, readiness rejection before microphone permission, cancellation during permission/upload, late callbacks from superseded sessions and the optional recording notification. Keep the transcript editable and assert that no assistant turn is submitted automatically.

For voice composer UX changes, verify 44px targets, microphone/Send grouping, left-side attachments, separate cancellation, pending/recording/transcribing feedback, timer cleanup and timer exclusion from live announcements. Exercise focus on the microphone, cancel and editable draft. Inspect real browser screenshots in desktop and narrow viewports for idle, pending, recording, transcribing and recoverable error states; a build or DOM fixture alone does not prove the visual layout or focus journey.

`assistant-context.models.spec.ts` is the focused proof that attachment summaries remain serializable, redact unsafe text, and drop raw `File`, blob/preview URL, runtime state, config payload, diagnostics, or pending patch details before entering assistant context.

Exercise: structured clarification; direct prompt after clarification; edit/resend cleanup; pasted and selected attachment with preview cleanup; hostile label that must not route intent; scoped multipart governed transcription; stop/cancel/track cleanup; stale governed and browser-speech transcripts; transcript review without auto-submit; serializable attachment summaries with no local file/blob leakage; and a requested upload with no contract that must be rejected/escalated.

Use `praxis-ai-semantic-intent` for routing, `praxis-files-upload-backend-contract` for uploads, `praxis-ai-backend-config-contracts` for endpoint changes, and `praxis-angular-i18n-governance` for framework copy.

For corporate voice corrections, cover tenant/user/profile/version/revocation during permission, recording and upload, owner reset while idle, two independent shells, global language inheritance/override, and canonical context headers on GET/POST. Distinguish mocked transport, real security filter-chain tests with simulated stores, and durable authenticated HTTP proof on isolated Neon.

