Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
777c885
CONTRACT: feat(ui-server): add durable owner trust Settings publication
schlessera Nov 5, 2026
0f88044
CONTRACT: fix(ui-server): describe unavailable trust runtime precisely
schlessera Nov 5, 2026
4f3fb69
CONTRACT: fix(ui-server): refuse exhausted trust revisions before pub…
schlessera Nov 5, 2026
758152e
Merge origin/main into trust Settings publication
schlessera Nov 5, 2026
1f5c0df
CONTRACT: fix(ui-server): classify trust Settings HTTP routes
schlessera Nov 5, 2026
6a814ee
chore: refresh trust Settings against delivered safety ledger
schlessera Nov 5, 2026
cf7e122
chore: refresh durable trust Settings on qualified main
schlessera Nov 18, 2026
00cc3e0
CONTRACT: feat(ui-server): resolve Settings repository identity witho…
schlessera Nov 18, 2026
e8ede9c
Merge commit '00cc3e0930d70c8cdf94124a0ee8911b73832476' into feat/360…
schlessera Nov 18, 2026
eeff70b
feat(ui-server): retain metadata authority through Settings publicati…
schlessera Nov 18, 2026
09e4a94
Merge remote-tracking branch 'origin/main' into feat/3613-settings-id…
schlessera Nov 18, 2026
b77da31
Merge branch 'feat/3613-settings-identity-20261118' into feat/3608-du…
schlessera Nov 18, 2026
b841e59
CONTRACT: feat(ui-server): complete host-verified trust Settings publ…
schlessera Nov 20, 2026
84fb772
CONTRACT: fix(ui-server): attribute only synchronous Settings publica…
schlessera Nov 20, 2026
0e98766
CONTRACT: fix(ui-server): read trust receipts after acquiring the pub…
schlessera Nov 20, 2026
76325e4
Merge remote-tracking branch 'origin/main' into feat/3608-durable-tru…
schlessera Nov 20, 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
6 changes: 6 additions & 0 deletions .changeset/durable-human-trust-settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@schlessera/brain-ui-server": minor
---

Add password-owner Settings trust publication with exact-byte reviews, descriptor-bound writes, bounded durable operation receipts and crash-safe readback. Verify GitHub repository and owner identities through the bounded host transport and retain approved-owner evidence only with proved publication. Runtime trust enforcement remains unavailable; saving policy never clears historical taint or grants runtime permission.
Refuse exhausted trust revisions before creating reviews or publishing protected policy bytes.
3 changes: 2 additions & 1 deletion api-report/ui-server.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2658,7 +2658,8 @@ signatures (every public export and the types it is made of)
isHeld(): boolean;
maintain: () => Promise<void>;
observe(): Promise<void>;
observeUserPolicy(turnId: string, approvedWrite: () => Promise<void> | void): Promise<void>;
observeSettingsPolicy(_operationId: string, operation: (publish?: (write: () => void) => Promise<void>) => Promise<void> | void): Promise<void>;
observeUserPolicy(turnId: string, approvedWrite: () => void): Promise<void>;
onObservation(observer: (turnId: string, facts: {
changedPaths: number;
observedBytes: number;
Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/bounded-multi-read.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ parallel default, with concurrency 1.
proves only `read_file`, `write_file` and `edit_file`. So
(`toolObservation`, `packages/ui-server/src/brain/tool-observation.ts:37-42`)
calls it `unproven`, and
(`toolEnded`, `packages/ui-server/src/brain/turn-journal.ts:584-591`)
(`toolEnded`, `packages/ui-server/src/brain/turn-journal.ts:614-621`)
observes every result and marks the turn lasting. Four reads made four
observations, sequential or parallel. One batch call made one. That is a
real host-side saving, small in time (8.3 ms against 1.4 ms on the fixture).
Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/claude-code-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ next to it.
of this binary. The only version probe in the server is for the `brain` CLI
(`Probe the selected content CLI`,
`packages/ui-server/src/brain/client.ts:180-248`, called at
`probeBrainCliVersion(config.brainPath`, `packages/ui-server/src/app.ts:510`).
`probeBrainCliVersion(config.brainPath`, `packages/ui-server/src/app.ts:513`).
`brain doctor` runs `claude mcp list` from `PATH` (`which("claude")`,
`packages/core/src/cli/commands/doctor.ts:507-511`) — the user's own Claude
Code on their own machine, to check the MCP registration, not the server's
Expand Down
18 changes: 9 additions & 9 deletions docs/decisions/governed-writable-workers.md
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ replacement and the deadline publish nothing and record no policy-updated
event; a no-publication attempt records none either. Real observation and
storage failures keep their existing handling, and a publication that
committed before its report failed stays `unknown` and is never retried
(`const held`, `packages/ui-server/src/brain/policy-proposal.ts:159-254`).
(`const held`, `packages/ui-server/src/brain/policy-proposal.ts:160-252`).

Every retained turn has one initially collapsed receipt. Known no-change is
zero; legacy/unknown detail and unknown cost/limits remain explicitly unknown.
Expand All @@ -1274,7 +1274,7 @@ principal authority remain the caller's responsibility. The policy publisher
creates, writes, fsyncs and removes its operation-owned staging name entirely
inside that synchronous callback, between the two serialized observations
(`await options.observeUserPolicy`,
`packages/ui-server/src/brain/policy-proposal.ts:217-251`). First publication
`packages/ui-server/src/brain/policy-proposal.ts:218-232`). First publication
also removes the temporary hardlink before the final observation. No filename
prefix is ignored; a similarly named real agent change is still retained.
Failed staging preserves the original policy, while failed recording after
Expand Down Expand Up @@ -1533,7 +1533,7 @@ starts one per result and carries on
(`void host.journal?.toolEnded`, `packages/ui-server/src/ws/bridge-capabilities/emission.ts:273`).
The wait is the observation's hold. `held` takes it synchronously, before it
queues the capture
(`function held<T>`, `packages/ui-server/src/brain/turn-journal.ts:279-300`),
(`function held<T>`, `packages/ui-server/src/brain/turn-journal.ts:293-314`),
and the scope monitor's hold freezes every active turn's productive workers
until the capture completes (`before() {`,
`packages/ui-server/src/brain/turn-scope.ts:158-166`). Pi's agent loop runs in
Expand All @@ -1545,7 +1545,7 @@ tracked the hold, not the bridge call.
proven read-only, no other call of an active turn is still running, and no
active turn has run a call whose effects may outlast it
(`toolEnded(turnId: string, toolUseId: string)`,
`packages/ui-server/src/brain/turn-journal.ts:584-591`). Admission, turn end,
`packages/ui-server/src/brain/turn-journal.ts:614-621`). Admission, turn end,
the 15-second timer, scope-limit observations, approved policy writes and
removal coverage observe exactly as before.

Expand Down Expand Up @@ -1804,7 +1804,7 @@ these versions as metadata-only and never open them for retention
kind, mode, size and its ignored flag, carries `metadataOnly: true` and records
its opaque change stamp, with no content hash and no symlink target. Two
versions of equal size are told apart by that stamp, as ignored ones are
(`const identity`, `packages/ui-server/src/brain/turn-journal.ts:83`),
(`const identity`, `packages/ui-server/src/brain/turn-journal.ts:84`),
so every observed refresh remains a recorded change. A metadata-only version is an intentional
observation state: it adds no `missing` entry and does not make the turn
partial. Removal coverage never treats the family as eligible, and history
Expand All @@ -1816,7 +1816,7 @@ stays now counts its largest size once too, rather than each version.
**History.** History presents every index-family version as metadata-only
however it was recorded, so a version an earlier release retained is no
longer read
(`const presented`, `packages/ui-server/src/brain/turn-journal.ts:76-81`).
(`const presented`, `packages/ui-server/src/brain/turn-journal.ts:77-82`).
The reader groups these entries as the search index, recorded by size and
timestamps only, with no review action. Preview reports `metadata_only` and
download has nothing to serve. History revert and Undo read that same
Expand Down Expand Up @@ -1873,7 +1873,7 @@ keeps its bytes.

**The purge.** It runs once, on the journal's write worker, when the journal
opens, after interrupted turns have been ended
(`while (await ledger.call`, `packages/ui-server/src/brain/turn-journal.ts:129`),
(`while (await ledger.call`, `packages/ui-server/src/brain/turn-journal.ts:144`),
in at most two accounted commits whose progress is recorded in
`turn_journal_allocation.index_purge`
(`purgeIndexVersions(): IndexPurgeResult`,
Expand Down Expand Up @@ -4744,7 +4744,7 @@ attribution. If an existing same-session/turn taint event precedes an agent
observation, the journal retains its source ID with that change. Replay never
infers taint from a later event, and absence of evidence does not assert complete
untrusted-input detection. User history operations are not tainted agent writes
(`async function observe`, `packages/ui-server/src/brain/turn-journal.ts:413-478`).
(`async function observe`, `packages/ui-server/src/brain/turn-journal.ts:430-495`).

Claude auto-memory persists outside the authoritative brain. Its validated
native copy-out wraps each changed direct `.md` note in host journal retention:
Expand All @@ -4767,7 +4767,7 @@ memory completion of the earlier 0.42.0 steering slice, not a widening of memory
providers or a claim of capturing intervening external writes. The copy-out
boundary is `const write`, `packages/ui-backend-claude/src/worker-state.ts:210-224`;
retention/finalization is `persistClaudeMemory`,
`packages/ui-server/src/brain/turn-journal.ts:698-728`; destination-bound recovery
`packages/ui-server/src/brain/turn-journal.ts:763-793`; destination-bound recovery
is `const target`, `packages/ui-server/src/brain/turn-revert.ts:113-123`.

### Concurrent edits
Expand Down
8 changes: 4 additions & 4 deletions docs/decisions/http-api-boundary.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ explicit supported rows, not silently excluded by this distinction.

The source audit on 2026-09-30 used
`e0875269b21b707482545be9e94901acb897893b`. The public health mount precedes auth
(`createHealthRoutes`, `packages/ui-server/src/app.ts:1102`), the API guard follows
public ceremonies (`authGuard`, `packages/ui-server/src/app.ts:1123`), and the
WebSocket admission is separate (`"/ws"`, `packages/ui-server/src/app.ts:1364`).
(`createHealthRoutes`, `packages/ui-server/src/app.ts:1107`), the API guard follows
public ceremonies (`authGuard`, `packages/ui-server/src/app.ts:1128`), and the
WebSocket admission is separate (`"/ws"`, `packages/ui-server/src/app.ts:1378`).
Static serving is conditional (`if (options.staticRoot)`,
`packages/ui-server/src/app.ts:1384-1405`). That order establishes access;
`packages/ui-server/src/app.ts:1398-1419`). That order establishes access;
it does not select compatibility status.

A hermetic real-app launch, with temporary brain root, in-memory database,
Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/journal-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ that no pre-charge covers. The evidence is on the issue.
readers understand the arrays until then, and an empty legacy array stays
"no set recorded". The brain's current set is the one the most recent complete,
inventoried turn recorded
(`configurationCoverage(): ConfigurationCoverageRead`, `packages/ui-server/src/brain/turn-journal.ts:779-785`).
(`configurationCoverage(): ConfigurationCoverageRead`, `packages/ui-server/src/brain/turn-journal.ts:844-850`).
The sets table is an ordinary rowid table, as every journal table is: the
operational backup copies and compares journal rows in rowid order.

Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/scheduled-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Source inspected at `b5c30c180df5584584f261b446c4d440380d2441`:
(`else if (item.status === "scheduled"`, `packages/ui-server/src/inbox/actions.ts:196-197`).
The runtime ticks every minute (`INBOX_TICK_MS`, `packages/ui-server/src/inbox/runtime.ts:11-13`).
- Production app wiring supplies recovery and budgets, without a dispatcher
(`// Recovery/heartbeat only.`, `packages/ui-server/src/app.ts:592-608`).
(`// Recovery/heartbeat only.`, `packages/ui-server/src/app.ts:597-613`).
A scripted nonempty ready-item test still reports no claim, attempt or
Activity root. That proves disabled wiring, not safe execution of a schedule.
- Headless plumbing checks backend support, a usable principal, lifetime and
Expand Down
6 changes: 3 additions & 3 deletions docs/decisions/session-principals.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ Both reviewers verified every row below against the source.
| Cookie verify | `auth.ts:265-296` | strict `^(\d+)\.(\d+)$`, safe integers, future/expired rejection, `cookieEpoch === sessionsEpoch(db)` |
| Global epoch | `auth.ts:302-318` | `settings` row; missing = 0; non-integer **throws** |
| Global revoke | `auth.ts:321-330` | `setSetting` (overflow-guarded) + `clients.closeAll(1008, …)` |
| Auth routes | `authRoutes`, `app.ts:1108` | mounted **before** the guard at `authGuard(authMode`, `app.ts:1124`; logout guards itself (`resolveCookiePrincipal(c, auth, deps.db)`, `auth.ts:798`) |
| Passkey management | `passkeyManagementRoutes`, `app.ts:1132` | mounted **after** the guard ("Mount AFTER the auth guard") |
| WS guard | `"/ws"`, `app.ts:1364-1381` | origin → `isWsAuthorized` (returns a boolean, `auth.ts:221-237`) → capacity → upgrade |
| Auth routes | `authRoutes`, `app.ts:1113` | mounted **before** the guard at `authGuard(authMode`, `app.ts:1128`; logout guards itself (`resolveCookiePrincipal(c, auth, deps.db)`, `auth.ts:798`) |
| Passkey management | `passkeyManagementRoutes`, `app.ts:1137` | mounted **after** the guard ("Mount AFTER the auth guard") |
| WS guard | `"/ws"`, `app.ts:1378-1395` | origin → `isWsAuthorized` (returns a boolean, `auth.ts:221-237`) → capacity → upgrade |
| WS upgrade | `ws/connection.ts:262-264` | `createWsUpgrade` ignores the request context |
| WS admission | `ws/connection.ts:84` | `clients.add(ws)` — the socket's identity is unknown |
| Turn record | `ws/run-session.ts:136-144` | recorder built from `{turnId, sessionId, billing}`; `RunningTurn` (`ws/turns.ts:55-77`) has no actor |
Expand Down
11 changes: 11 additions & 0 deletions docs/decisions/session-safety-reviews.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,17 @@ and no fabricated agent turn. A human Settings operation has its own host audit
identity and exact reviewed policy bytes/base hash. No personal accounts,
configuration or real deployment details belong in the public tree.

The v1 repository selector keeps its stable repository ID and canonical owner
name. The independent provider owner ID is retained as host publication
evidence, preserving that policy format. A prepared metadata observation or
matching current file bytes cannot create an approved-owner boundary: the
operation's descriptor-bound write and directory sync precede the FULL durable
transaction that records its proof and owner identity together. Current boundary
facts survive bounded operation-receipt pruning, and removal or selector change
retires them. They establish the owner's historical reviewed choice, not current
repository identity, private access or runtime permission. Every later qualified
read still needs independently verified immutable provenance and fresh identity.

Source trust and recipient permission are distinct. Incoming trust never
silently permits sending data while another trigger restricts the chat.
Recipient permission defaults off and needs its own explicit review. Exact
Expand Down
30 changes: 28 additions & 2 deletions docs/http-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ compatibility guarantee. Authentication requirements are a separate property.
A public liveness probe can be supported; an authenticated settings route can
be internal.

The inventory includes the additive Queue intake, poke, scheduled-task, session-draft, composer-file, session-recovery, attachment-read, interactive HTML preview, saved-audio transcription, human-started hygiene-review, governance-event, roadblock-report, reference-grant, Apify-state, Apify-policy, retained-journal/user-revert, untrusted-mark, chat-deletion, individual safety-review, safety-recording recovery, GitHub detail-page, live-persona and markup-upload routes (whose `/api/settings/voice` also carries the live-service default) mounted by `createApp`: 191 unique declared
The inventory includes the additive Queue intake, poke, scheduled-task, session-draft, composer-file, session-recovery, attachment-read, interactive HTML preview, saved-audio transcription, human-started hygiene-review, governance-event, roadblock-report, reference-grant, Apify-state, Apify-policy, retained-journal/user-revert, untrusted-mark, chat-deletion, individual safety-review, safety-recording recovery, GitHub detail-page, live-persona and markup-upload and human trust Settings routes (whose `/api/settings/voice` also carries the live-service default) mounted by `createApp`: 195 unique declared
method/path pairs, plus the conditional SPA fallback. It describes the current
implementation, including limitations, rather than a proposed redesign.
Unknown response fields must be tolerated. There is no HTTP API revision
Expand Down Expand Up @@ -158,6 +158,10 @@ client code has a gap. Source owners are listed after the table.
| GET | `/api/journal/configuration-coverage` | S | Read the brain's current untraced configuration-input set | Latest complete inventoried turn only; explicit `unknown`, never an empty list. |
| GET | `/api/agent-policy` | I | Read shared admission policy and reported enforcing limits | Read-only Devices & agents facts; no editor or duplicate policy cache. |
| GET | `/api/policy-proposals/:turnId/:requestId` | I | Read one principal-owned policy request receipt | Same-request reconciliation only; never writes or reactivates approval. |
| GET | `/api/trust-settings` | I | Read trust policy data and publication availability | Paired Security settings transport (#3608); live password-mode human owners only; runtime trust remains disabled. |
| GET | `/api/trust-settings/:request` | I | Read one owner-bound trust publication receipt and review | Same-request reconciliation only; never republishes or resolves a taint trigger. |
| POST | `/api/trust-settings/prepare` | I | Prepare one exact-base trust change | Paired Security settings transport; same-origin JSON and live owner authority; repository create/edit independently verifies host metadata. |
| POST | `/api/trust-settings/commit` | I | Publish the exact owner-reviewed trust change | Shared descriptor-bound publisher; bounded durable receipt; saved policy does not imply runtime enforcement. |
| GET | `/api/sessions/:id/safety` | S | Read bounded revisioned host safety evidence | Authenticated principal of the history owner's account (#3952); immutable records, snapshot aggregate/high-water, scoped cursor, explicit coverage/unavailable, no mutation (#3604). |
| POST | `/api/sessions/:id/safety/reviews/prepare` | S | Prepare review of one finalized safety occurrence | Live password-mode human owner, exact Origin and bounded JSON; host-issued body/brain/principal/generation-bound handle (#3603). |
| POST | `/api/sessions/:id/safety/reviews/:requestId/commit` | S | Commit or read back one individual safe verdict | Live owner rechecked on the acquired FULL transaction and final response; immutable receipt plus fresh aggregate, no bulk clear or standing rule (#3603). |
Expand Down Expand Up @@ -224,7 +228,7 @@ Authentication factories live in [auth.ts](../packages/ui-server/src/middleware/
[passkeys.ts](../packages/ui-server/src/middleware/passkeys.ts) and
[principals.ts](../packages/ui-server/src/middleware/principals.ts).
[app.ts](../packages/ui-server/src/app.ts) owns prefixing and middleware order.
All 191 declared endpoints are mounted regardless of backend, renderer or
All 195 declared endpoints are mounted regardless of backend, renderer or
speech-provider availability: unavailable capabilities return the responses
below rather than removing their handlers. Only static serving is conditional.

Expand Down Expand Up @@ -2375,3 +2379,25 @@ current retained-checkpoint counts and bytes, plus `lastFailure`, a durable
historical cause even when cleanup failed before the first turn. The historical
record survives successful cleanup; current retained charges are reported
separately. It is never part of public `/health`.

## Human trust Settings publication

The four `/api/trust-settings` operations are internal paired Security settings
transport. Their exact review/receipt shapes and limits are described in the
[publication contract](integration-contract/package-api.md#human-trust-settings-publication).
They require a live password-mode human owner; mutation additionally requires a
present exact same-origin Origin and bounded JSON. Principal, voice and channel
claims in a body supply no authority. Receipts are private, no-store, scoped to
the served brain and requesting owner, and readback never repeats a write.

Publication reuses the protected policy writer without an agent turn. Prepared
state, reviewed bytes/base, publication proof and partial/unknown completion
survive restart. Saved origin/tunnel rules do not enable unbuilt trust admission;
repository create/edit independently verifies fixed-endpoint metadata at review
and again inside the publication observation window. Browser IDs cannot
self-verify; unknown or changed identity withholds the write. Approved owner
boundaries derive from this operation's durable publication proof and are not
inferred from matching policy bytes. Owner-scope review explicitly covers
future repositories currently in that namespace. Runtime trust remains disabled.
Removal/readback remain available for existing rules. Revision exhaustion refuses
before protected publication. No historical trigger is resolved by these routes.
Loading
Loading