Document prepared message content hashes

This commit is contained in:
2026-11-20 04:22:33 +00:00
parent 718cd05043
commit 019e077ba9
8 changed files with 82 additions and 35 deletions

View File

@@ -144,7 +144,7 @@ profile, or backend:
3. render messages and the prompt-defined session;
4. apply any direct session ID, then compose captured history, rendered
definition messages, and already-normalized request messages in that order;
5. hash the effective rendered prompt; and
5. hash the effective rendered prompt and its ordered message content; and
6. construct the prepared value and preparation timing.
`Prepare` runs both phases consecutively and never performs capacity admission.
@@ -185,6 +185,12 @@ sequence. The rendered-prompt hash uses a versioned, length-framed SHA-256
encoding of that session, every role and content value, and cache-control
presence and values; its hexadecimal value is opaque.
The separate message-content hash is computed once after that same composition.
It streams a versioned prefix, message count, and length-framed role and text
bytes into SHA-256, excluding session and cache metadata. Fixed reference
vectors protect the selected v1 scheme across refactors; the public
[`PreparedRun` GoDoc](../../types.go) owns its compatibility contract.
The configuration snapshot is read-only after engine construction. Concurrent
`Prepare` and `Run` calls use detached captured targets and keep invocation
state local.