Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
671d561
CONTRACT: feat(ui-react): review individual safety triggers in chat
schlessera Nov 7, 2026
f02ebe1
CONTRACT: fix(ui-react): retain read-only safety evidence during reco…
schlessera Nov 7, 2026
96b2af3
test(ui-react): locate renderer headers by tool row identity
schlessera Nov 7, 2026
c66b347
fix(ui-react): use the named popover layer for safety details
schlessera Nov 7, 2026
312d963
test(ui-react): isolate conversation controls and establish reveal po…
schlessera Nov 7, 2026
fd8d127
test(ui-sdk): retain managed inference admission diagnostics
schlessera Nov 7, 2026
8a21eb3
CONTRACT: reconcile chat safety with current main
schlessera Nov 8, 2026
d46fdd3
CONTRACT: reconcile chat safety with current main
schlessera Nov 9, 2026
49974f8
CONTRACT: chore(ui-react): reconcile chat safety with current main
schlessera Nov 10, 2026
07994a0
CONTRACT: chore(ui-react): preserve safety and recovery API descriptions
schlessera Nov 10, 2026
92c8667
chore: align chat safety candidate with hybrid CI proof policy
schlessera Nov 10, 2026
5e0cd47
CONTRACT: chore(ui): reconcile safety controls with live voice field
schlessera Nov 10, 2026
0ec2b31
CONTRACT: chore(ui): retain safety correlation with scoped recorder r…
schlessera Nov 11, 2026
e21f23b
Merge current account and voice behavior into chat safety review
schlessera Nov 11, 2026
9fc0e02
CONTRACT: merge main for chat safety qualification
schlessera Nov 11, 2026
8ed8db6
CONTRACT: refresh chat safety over current main
schlessera Nov 11, 2026
8a95c2e
CONTRACT: refresh chat safety over host web executor
schlessera Nov 12, 2026
ed32d67
CONTRACT: refresh chat safety over mandatory web egress
schlessera Nov 13, 2026
821569a
CONTRACT: refresh chat safety over per-turn web admission
schlessera Nov 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/chat-safety-review-controls.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@schlessera/brain-ui-sdk": minor
"@schlessera/brain-ui-server": minor
"@schlessera/brain-ui-react": minor
---

Show host-owned safety triggers beside their exact tool entries, with honest turn-event fallback, accessible persistent details and owner-only individual review. Keep B/C restricted after reviewing A, retain historical human verdicts, and never replay decisions or replace newer live evidence with a receipt. Add opt-in durable tool correlation while preserving older readers' strict sidecar shape, continuing the approved pre-1.0 change to unconditional restriction.

Keep last-read safety evidence visible and read-only during reconnect, preserving reading position while requiring a fresh complete snapshot before review controls return.

Keep safety hints and persistent details on the named anchored-popover layer beneath navigation and destination panels.
592 changes: 592 additions & 0 deletions api-report/ui-react.txt

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions api-report/ui-sdk.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13966,6 +13966,7 @@ signatures (every public export and the types it is made of)
}>;
}, z.core.$strict>, z.ZodObject<{
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
includeEntries: z.ZodOptional<z.ZodLiteral<true>>;
limit: z.ZodOptional<z.ZodNumber>;
requestId: z.ZodString;
target: z.ZodUnion<readonly [z.ZodObject<{
Expand Down Expand Up @@ -14131,6 +14132,7 @@ signatures (every public export and the types it is made of)
clientSafetyReadSchema (packages/ui-sdk/src/safety.ts)
const clientSafetyReadSchema: z.ZodObject<{
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
includeEntries: z.ZodOptional<z.ZodLiteral<true>>;
limit: z.ZodOptional<z.ZodNumber>;
requestId: z.ZodString;
target: z.ZodUnion<readonly [z.ZodObject<{
Expand Down Expand Up @@ -18962,6 +18964,10 @@ signatures (every public export and the types it is made of)
bindingId: z.ZodString;
detailPruned: z.ZodBoolean;
detector: z.ZodNullable<z.ZodString>;
entry: z.ZodOptional<z.ZodObject<{
kind: z.ZodLiteral<"tool">;
toolUseId: z.ZodString;
}, z.core.$strict>>;
epochId: z.ZodString;
exposure: z.ZodEnum<{
finalized: "finalized";
Expand Down Expand Up @@ -19103,6 +19109,10 @@ signatures (every public export and the types it is made of)
bindingId: z.ZodString;
detailPruned: z.ZodBoolean;
detector: z.ZodNullable<z.ZodString>;
entry: z.ZodOptional<z.ZodObject<{
kind: z.ZodLiteral<"tool">;
toolUseId: z.ZodString;
}, z.core.$strict>>;
epochId: z.ZodString;
exposure: z.ZodEnum<{
finalized: "finalized";
Expand Down Expand Up @@ -19595,6 +19605,10 @@ signatures (every public export and the types it is made of)
bindingId: z.ZodString;
detailPruned: z.ZodBoolean;
detector: z.ZodNullable<z.ZodString>;
entry: z.ZodOptional<z.ZodObject<{
kind: z.ZodLiteral<"tool">;
toolUseId: z.ZodString;
}, z.core.$strict>>;
epochId: z.ZodString;
exposure: z.ZodEnum<{
finalized: "finalized";
Expand Down Expand Up @@ -24460,6 +24474,10 @@ signatures (every public export and the types it is made of)
bindingId: z.ZodString;
detailPruned: z.ZodBoolean;
detector: z.ZodNullable<z.ZodString>;
entry: z.ZodOptional<z.ZodObject<{
kind: z.ZodLiteral<"tool">;
toolUseId: z.ZodString;
}, z.core.$strict>>;
epochId: z.ZodString;
exposure: z.ZodEnum<{
finalized: "finalized";
Expand Down Expand Up @@ -24613,6 +24631,10 @@ signatures (every public export and the types it is made of)
bindingId: z.ZodString;
detailPruned: z.ZodBoolean;
detector: z.ZodNullable<z.ZodString>;
entry: z.ZodOptional<z.ZodObject<{
kind: z.ZodLiteral<"tool">;
toolUseId: z.ZodString;
}, z.core.$strict>>;
epochId: z.ZodString;
exposure: z.ZodEnum<{
finalized: "finalized";
Expand Down Expand Up @@ -25287,6 +25309,10 @@ signatures (every public export and the types it is made of)
bindingId: z.ZodString;
detailPruned: z.ZodBoolean;
detector: z.ZodNullable<z.ZodString>;
entry: z.ZodOptional<z.ZodObject<{
kind: z.ZodLiteral<"tool">;
toolUseId: z.ZodString;
}, z.core.$strict>>;
epochId: z.ZodString;
exposure: z.ZodEnum<{
finalized: "finalized";
Expand Down Expand Up @@ -25456,6 +25482,10 @@ signatures (every public export and the types it is made of)
bindingId: z.ZodString;
detailPruned: z.ZodBoolean;
detector: z.ZodNullable<z.ZodString>;
entry: z.ZodOptional<z.ZodObject<{
kind: z.ZodLiteral<"tool">;
toolUseId: z.ZodString;
}, z.core.$strict>>;
epochId: z.ZodString;
exposure: z.ZodEnum<{
finalized: "finalized";
Expand Down
4 changes: 4 additions & 0 deletions api-report/ui-server.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,10 @@ signatures (every public export and the types it is made of)
tool_web_input: "tool_web_input";
unproxied_shell_input: "unproxied_shell_input";
}>;
entry: z.ZodOptional<z.ZodObject<{
kind: z.ZodLiteral<"tool">;
toolUseId: z.ZodString;
}, z.core.$strict>>;
epochId: z.ZodString;
exposure: z.ZodEnum<{
finalized: "finalized";
Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/answer-delivery.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ Before this, the terminal frame replaced an unanswered card with a dismissed
stub, and its draft went with the controls. Now the card stays the editable
question under a prompt that says the turn ended or timed out
(`const [endedDismissed`,
`packages/ui-react/src/components/chat/message-bubble.tsx:632-650`). Its
`packages/ui-react/src/components/chat/message-bubble.tsx:633-651`). Its
Submit sends no frame to the ended request. It records the answer locally as
a `closed`/`ended` delivery, so the card shows the shipped Not delivered
footer with Copy answer and Send as message (R1). Send as message is the only
Expand Down
8 changes: 8 additions & 0 deletions docs/http-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2087,6 +2087,14 @@ and `detailPruned`. Responses are `Cache-Control: no-store` and at most 262144
UTF-8 bytes. No request invokes a verdict, policy writer, backend turn or
provider transcript write.

Optional `entries=1` includes the host-owned `entry:{kind:"tool",toolUseId}`
only where recorded. The same choice is required on every cursor page; its
subscription inherits it. No other `entries` value is accepted. The default
response retains the original strict version-1 record shape. Correlation
requires both the exact host turn and tool identity; opaque network input and
unknown legacy attribution remain separate named turn events. Minimal entry
identity survives detail pruning; retirement removes it with the evidence.

The live principal must belong to the retained history's account (#3952). A
principal id always matches itself. Two different ids match only when both
resolve to the same account partition in every auth mode, which today means
Expand Down
5 changes: 5 additions & 0 deletions docs/integration-contract/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,11 @@ detector completeness are separate; neither omitted details nor a review receipt
replace the aggregate. Route absence and refused reads are explicitly
unavailable. Existing history visibility and mutation authority remain intact.

Additively for #3605, `entries=1` requests explicit bounded tool-entry
correlation on this read. No other value or duplicate parameter is accepted.
The cursor and subsequent subscription retain that choice. Omitting it keeps
the original strict version-1 record shape. This metadata grants no authority
and never infers attribution for opaque transport.

### Selectable dictation providers (additive, #3707)

Expand Down
35 changes: 34 additions & 1 deletion docs/integration-contract/package-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5291,7 +5291,38 @@ its read-only reason additionally accepts `owner_required` or null; optional
literal review lifetime/body bounds describe a supporting host. Absent or
unsupported capability remains unavailable and grants no mutation authority.

### Native recovery quarantine status (#3816)
## Chat safety review controls (additive, #3605)

`createBrainApi` adds `safetyPrepare(body, signal)` and
`safetyCommit(requestId, body, signal)` for the existing two-phase owner HTTP
review. Both parse the bounded SDK response, including refusal receipts.
There is no retry queue or persisted mutation authority. A lost commit response
remains unknown until a new read; reconnect and reload never send a verdict.

The React transcript renders host-owned sidecars independently of chat message
objects. An explicit turn/tool correlation places a 44px safety indicator on
that entry and on its collapsed run. Uncorrelated input has a named turn event.
Persistent details expose source, observation time, provenance, finalization and
individual human verdicts. The narrow review is **Only this trigger**; a safe
shield means **Marked safe by you**, never objective verification or removal of
provider context. Standing-rule choices remain absent. Receipt projections
never replace newer live evidence; only complete, zero-unresolved, healthy
coverage can display **Normal policy restored**. Auth loss, selection changes
and retirement discard pending authority. Any retained detail during a same-chat
refresh is read-only until the new snapshot completes.


Transport loss retains already read evidence as **last read**, with review
capability, pending request authority and normal-policy claims removed. The
notice and entry indicators keep their geometry while the same owner obtains
a fresh snapshot. This display cache is partitioned by the host's opaque
principal key, active session and auth epoch; a missing principal key creates
a new partition at every hello. It grants no authority. New principals, auth
loss, explicit unavailable/retired reads and deletion purge retained details.
Late updates from a disconnected socket cannot loosen the retained facts, and
recovery never resumes a prepared decision.

## Native recovery quarantine status (#3816)

`NativeManagerReady` gains optional `recovery` with `quarantinedIntents`,
`stagingChargedBytes` (null when no safe stage bound is known) and
Expand All @@ -5308,6 +5339,8 @@ absent stage directory or invalid UUID charges zero; a surviving stage retains
its independently persisted historical tmpfs cap. Public `/api/health` remains
unchanged.

## Journal cleanup diagnostics (additive, #3815)

The journal host's additive `cleanupStatus()` method (#3815) returns
`{ retained: { pending, failed, retainedBytes }, lastFailure }`, the same
current accounting and historical diagnostic record exposed as
Expand Down
12 changes: 12 additions & 0 deletions docs/integration-contract/wire.md
Original file line number Diff line number Diff line change
Expand Up @@ -3132,6 +3132,18 @@ After declaring the same capability in `client_hello`, clients may send:
is `{sessionId}` or the exact provisional `{turnId,bindingId}`. Reads cannot
discover/create a session by guessing aliases. The host replies
`safety_history: {type,requestId,page:SafetyPage}`.
Additively for #3605, hosts advertise the independent boolean
`server_hello.capabilities.sessionSafetyEntryCorrelation`. Only after this
declaration may a client add `includeEntries:true`. Opted-in occurrence
records may contain `entry:{kind:"tool",toolUseId}`; the tool ID uses the
existing bounded ID grammar. Both the occurrence's host `turnId` and this
explicit tool identity must match a displayed entry. A host operation UUID,
names, arguments, timing and adjacency do not establish that join. Absent
correlation uses a separately named turn event. The snapshot pins this
choice for all pages and its subscription; changing it through a cursor
refuses. Default reads and subscriptions retain the original strict record
shape, and `safetyCapabilities` itself is unchanged for older clients.
Minimal correlation survives detail pruning and is deleted with its evidence.
- `safety_subscribe`: `{type,version:1,requestId,identity,afterRevision,snapshotId}`.
One selected history subscription per connection replaces its predecessor.
`identity` is the canonical `{sessionId,historyOwnerId,historyGeneration}`
Expand Down
3 changes: 2 additions & 1 deletion packages/ui-kit/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { mermaidMedia, mermaidOutput, mermaidScreenComparison } from "../ui-reac
import { consumerParityViewport } from "./tests/visual/consumer-parity-viewport.ts";
import { artifactParityRoute } from "./tests/visual/artifact-parity-route.ts";
import { storageServer } from "../ui-react/tests/browser/storage-server-command.ts";
import { safetyServer } from "../ui-react/tests/browser/safety-server-command.ts";
import { policyServer } from "../ui-react/tests/browser/policy-server-command.ts";
import { hygieneLoop } from "../ui-react/tests/browser/hygiene-loop-command.ts";
import { hygieneLifecycleFailures } from "../ui-react/tests/browser/hygiene-lifecycle-failures.ts";
Expand Down Expand Up @@ -173,7 +174,7 @@ export default mergeConfig(
browser: {
enabled: true,
screenshotFailures: false,
commands: { recordingProof, rankTap, conversationServer, mermaidMedia, mermaidOutput, mermaidScreenComparison, buttonCapture, overlayMouse, dictationMotion, policyServer, storageServer, hygieneLoop, hygieneServer, hygieneLifecycle, hygieneContextLifecycle, hygieneLifecycleCleanup, hygieneLifecycleFailures, dispatchActions, safetyGapChats, sheetInput, focusCapture, formViewport, formConsumerStyles, rankFooterFonts, codeHighlightFailure, codeHighlightFailureCount, offlineScene, coldCapture, shareReview, transcriptionHttp, startRequestLog, requestLog, grantMicrophone },
commands: { safetyServer, recordingProof, rankTap, conversationServer, mermaidMedia, mermaidOutput, mermaidScreenComparison, buttonCapture, overlayMouse, dictationMotion, policyServer, storageServer, hygieneLoop, hygieneServer, hygieneLifecycle, hygieneContextLifecycle, hygieneLifecycleCleanup, hygieneLifecycleFailures, dispatchActions, safetyGapChats, sheetInput, focusCapture, formViewport, formConsumerStyles, rankFooterFonts, codeHighlightFailure, codeHighlightFailureCount, offlineScene, coldCapture, shareReview, transcriptionHttp, startRequestLog, requestLog, grantMicrophone },
// The fake microphone plays the generated 10-second fixture
// (#1016). Chromium reads the file at launch, so it is written
// when this config loads; the fake UI grants the permission.
Expand Down
2 changes: 2 additions & 0 deletions packages/ui-react/src/components/chat/chat-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { useWebSocket } from "../../hooks/use-websocket.js";
import { useTrackerSeen } from "../../hooks/use-tracker-seen.js";
import { MaskEditor } from "../images/mask-editor.js";
import { MessageBubble } from "./message-bubble.js";
import { SessionSafety } from "./safety-indicator.js";
import { useWorkRestore } from "../../hooks/use-local-work.js";
import { messageFingerprint } from "../../lib/local-work.js";

Expand Down Expand Up @@ -738,6 +739,7 @@ export function ChatPage() {
className="mx-auto max-w-3xl divide-y divide-border/20"
>
{dialogueNotice && <p role="status" className="py-3 text-sm">{dialogueNotice}</p>}
<SessionSafety />
{dialoguePage?.coverage === "legacy" && <p className="py-3 text-sm">Earlier spoken dialogue was not saved.</p>}
{dialoguePage?.before !== undefined && <Button label="Load earlier conversation" tone="ghost" onClick={()=>root.connection.conversation.loadDialogue(sessionId ?? `dialogue:${dialoguePage.ownerId}`,true)} />}
{dialoguePage && (dialoguePage.records.length > 0 || dialoguePage.through > 0) && <Button label="Show latest conversation" tone="ghost" onClick={()=>root.connection.conversation.loadDialogue(sessionId ?? `dialogue:${dialoguePage.ownerId}`)} />}
Expand Down
1 change: 1 addition & 0 deletions packages/ui-react/src/components/chat/message-bubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ function AssistantContent({
<ToolCallTimelineCell
key={`tool:${tool.id}`}
toolCalls={group.toolCalls}
turnId={message.turnId ?? message.streamTurnId}
toolIndex={toolIndex}
onApproval={onToolApproval}
live={!!message.isStreaming}
Expand Down
Loading
Loading