### Changed

- Rebrand the project as **Chainlit NG**, an independent fork that continues
  the chainlit 2.x line now that the original project is no longer actively
  maintained upstream. The Python distribution is `chainlit-ng`; the import
  stays `import chainlit as cl`, and the CLI adds `chainlit-ng` while keeping
  `chainlit` as an alias. The published React client is
  `@chainlit-ng/react-client`. Both are released as `3.0.0`.
- See the [3.0 migration guide](docs/migration-3.0.md) for the package renames,
  the Recoil to Zustand state change, and the breaking configuration updates.

### Added

- Add opt-in read-only thread sharing with named users (`feat(data)`):
  `[features] thread_grants = true` plus a data layer that implements the grant
  contract. `SQLAlchemyDataLayer` stores grants in a lazily created
  `thread_grants` table, a grantee's thread list includes the threads they own
  or were granted, the grantee reads through the existing share route without
  owner identity or settings, and feedback writes are owner-gated with a typed,
  non-swallowing thread lookup. `DynamoDBDataLayer` supports direct reads but
  omits shared threads from its list. Off by default. See
  [the thread-sharing guide](docs/thread-sharing.md).
- Add opt-in tool-call approvals: `@cl.step(requires_approval=True)` with an
  optional `approval_schema`, or the explicit `cl.Approval` API. The server
  keeps the execution arguments, persists only a redacted preview, and requires
  a proven terminal write before the tool runs. Manual
  `Step(requires_approval=True)` and `metadata={"approval": ...}` are refused.
  See [the approvals guide](docs/approvals.md).
- Add markdown `content` to tool-call approvals (`cl.Approval(content=...)`,
  `@cl.step(approval_content=...)`) so the card shows tables and formatted text
  instead of raw JSON. Content is display-only, capped at 16 KiB, preserved
  across resume, and excluded from public shares.
- Add schema-generated editing and review feedback to tool-call approvals:
  `arguments_schema` fields render as inputs (string, multiline text, integer,
  number, boolean, enum, string list) with a JSON fallback for complex schemas.
  Reject stops immediately; Request changes opens a required comment box. The
  comment is returned as `decision.comment` with `decision.decision ==
"request_changes"` and persisted as the `changes_requested` status. The card
  never renders raw arguments; `content` is the review body. Edit is hidden
  once only a redacted resume preview remains.
- Add `cl.ask(...)` for agent-authored questions on the persisted approvals
  engine: options plus optional free text, a live `question` card, and
  `POST /project/question`. Answers are stored on the step record and returned
  as `cl.QuestionAnswer`; its `as_tool_result()` handoff carries explicit
  `provenance`/`trust: "untrusted_user_input"`/`durable` markers. No data-layer
  or schema change. See [the questions guide](docs/questions.md).
- Add `[features.spontaneous_file_upload] directory` to store uploaded files outside `APP_ROOT`. Relative paths resolve against `APP_ROOT`, absolute paths are used as-is, and startup fails with an actionable error when uploads are enabled and the directory is not writable. Only the legacy default `.files` directory is removed on shutdown; a configured directory is preserved.
- Add opt-in OpenTelemetry trace export from the Step tree (`feat(otel)`):
  `[features.telemetry] enabled = true` plus the new `chainlit[otel]` extra
  exports one OTLP/HTTP trace per message or edit turn, with one span per
  executed step. Attributes are a fixed redaction allowlist; content, names,
  inputs, outputs, metadata, elements and exception messages are never
  exported. Telemetry is off by default, and a missing extra or export failure
  never affects a turn.

### Changed

- `thread_grants` (opt-in): the owner check uses the typed `ThreadOwner`
  predicate, so a row whose `userId` and `userIdentifier` disagree is owned only
  by the matching `userId` (an identifier-only match fails closed), and a row
  with `userId` but no `userIdentifier` becomes readable by its owner by id.
  The flag-off owner path keeps the legacy comparison unchanged. DynamoDB's
  thread list stays owner-only, so grantees reach shared threads through
  `/project/share/{id}` only.

- Harden and document the OpenTelemetry export bounds: a turn exports at most
  200 step spans (excess spans are counted in
  `chainlit.telemetry.dropped_spans`), each span Chainlit creates carries at
  most 8 scalar attributes with string values capped at 128 characters, and
  shutdown returns within 2 seconds even when the collector stalls. The
  telemetry guide now covers verify/disable, resource-attribute exclusion, and
  the failure matrix. See [the telemetry guide](docs/telemetry.md).
- **Breaking (MCP):** Configure MCP servers by name under `[[features.mcp.servers]]`; the client no longer supplies stdio commands or named-server URLs. User-provided SSE/streamable-HTTP servers require `[features.mcp.user_servers]` with `enabled = true` and `allowed_urls`. Legacy `[features.mcp.sse|stdio|streamable-http]` keys (including `allowed_executables`) abort startup only when `features.mcp.enabled = true`; MCP remains off by default. See the [2.12.0 MCP advisory and migration guide](docs/security-advisory-2026-mcp.md#migrating-a-211-config).
- **Breaking (`@chainlit-ng/react-client`):** `connectMcp(sessionId, name)` replaces the removed `connectStdioMCP`, `connectSseMCP` and `connectStreamableHttpMCP`; user-provided servers use `connectUserMcp(...)`. The next release bumps the package to `3.0.0`; see the [client migration table](docs/security-advisory-2026-mcp.md#5-client-library-changes).

### Fixed

- Return a structured 422 instead of a 500 when a request body contains a lone
  UTF-16 surrogate. Validation errors keep the `{"detail": [...]}` envelope
  but no longer echo the rejected `input`/`ctx` values.
- Redact free-text question answers from shared threads, keep prompt/options
  and option labels in the read-only question card, and fail closed when share
  step metadata is malformed or has an unknown interaction kind (closes S1 F1).
  Resume hydration renders persisted questions read-only after a reload while a
  same-session reconnect keeps a live question answerable.
- Render inline LaTeX math literally when its closer is more than ~254 characters away, and bound both the `\(` and `$` inline lookahead so repeated unclosed openers parse in linear time.
- Declare `aiohttp` and SQLAlchemy's `asyncio` extra in the `custom-data` extra so the SQLAlchemy and DynamoDB data layers import on a clean install.
- Verify `azure-ad-hybrid` OAuth state and `id_token`, and generate a per-login nonce.
- Limit thread metadata in list, get, and resume responses to browser-visible keys.
- Normalize data-layer timestamps and accept stored timestamps without a trailing `Z`.
- Serve images, PDFs, audio, and video with an inline content disposition after resume.
- Delete child steps, feedback, and elements when a message is edited.
- Avoid replaying a resumed thread on reconnect and cache resume state per session.
- Preserve binary element content and tolerate missing storage URLs when resuming threads.
- Warn when `LITERAL_API_KEY` is set, since the LiteralAI data layer was removed.
- Raise `AttributeError` for unknown lazy `chainlit` attributes so `hasattr` works.
- Serialize generation objects with `to_dict()` when persisting steps, preserving compatibility with legacy generation models.
- Render pending approval and question cards inline at the step that created them, between the user's input and the assistant's follow-up, and scroll a newly pending card into view. Approvals previously rendered above the whole conversation and questions after every message, so the active controls could be misplaced or off-screen.
- Do not render raw approval arguments in the card. A title-only approval shows only the title and Approve/Reject buttons, and markdown `content` is the review surface.
- Name both pending interactions in the run guard: a pending question now refuses a new run with "Resolve the pending approval or question", matching the shared registry. Server-side refusals are logged rather than toasted, so queued messages cannot spam the UI. A blocked send scrolls the pending card into view instead of showing a toast, and starting a new chat asks for confirmation before discarding a live approval or question. Pending approval and question cards no longer show a redundant status label.
- Title-case approval tool names (`send_email` → `Send Email`) instead of showing the raw identifier.
- Give the generated approval edit form a separated "Edit fields" section with bottom spacing, and render embedded newlines in approval diffs as layout instead of JSON escapes. Long review bodies, question controls and edit fields only scroll once they exceed 80% of the viewport height, and the scroll-to-bottom control no longer covers card actions.

### Security

- `thread_grants` (opt-in): list rows for a thread the caller does not own drop
  `userId`, `userIdentifier` and the Dynamo internal key fields, so a grantee
  never sees the owner's identity. The strip is gated on the flag like the
  feature itself; with the flag off a public share still returns the
  pre-existing `userId`/`userIdentifier` fields. Unconditionally stripping them
  is a response-shape change and needs explicit approval, so it is not part of
  this release.
- Port the upstream MCP endpoint fixes for CVE-2026-45018 (client-supplied stdio command execution) and CVE-2026-45019 (SSRF via user-provided MCP URLs/headers). See the [security advisory](docs/security-advisory-2026-mcp.md).
- Require `opentelemetry-api>=1.45.1,<2.0.0` in the core install, so the `>=1.28.0` floor admitted by the core `mcp` dependency can no longer resolve to a version affected by CVE-2026-114603 (unbounded `tracestate` parsing). No new package: `opentelemetry-api` was already installed through `mcp` and `fastapi`.